From b2f1fe6cd7393ca328297774c07de81bf3b62ee1 Mon Sep 17 00:00:00 2001 From: hwillson Date: Tue, 3 Jan 2023 14:22:22 -0500 Subject: [PATCH 01/47] Add initial typescript `@defer` support This commit takes a first pass at introducing `@defer` typescript codegen support. It follows a similar approach as the `@skip` / `@include` functionality introduced in #5017. Related issue: #7885 --- .changeset/calm-oranges-speak.md | 6 + .../src/selection-set-processor/base.ts | 9 +- .../pre-resolve-types.ts | 5 +- .../src/selection-set-to-object.ts | 53 +- .../other/visitor-plugin-common/src/types.ts | 6 +- .../other/visitor-plugin-common/src/utils.ts | 9 +- .../src/ts-selection-set-processor.ts | 14 +- .../typescript/operations/src/visitor.ts | 6 +- .../operations/tests/ts-documents.spec.ts | 565 ++++++++++++++++++ 9 files changed, 648 insertions(+), 25 deletions(-) create mode 100644 .changeset/calm-oranges-speak.md diff --git a/.changeset/calm-oranges-speak.md b/.changeset/calm-oranges-speak.md new file mode 100644 index 00000000000..35a4cabe907 --- /dev/null +++ b/.changeset/calm-oranges-speak.md @@ -0,0 +1,6 @@ +--- +'@graphql-codegen/visitor-plugin-common': minor +'@graphql-codegen/typescript-operations': minor +--- + +Add typescript codegen `@defer` support diff --git a/packages/plugins/other/visitor-plugin-common/src/selection-set-processor/base.ts b/packages/plugins/other/visitor-plugin-common/src/selection-set-processor/base.ts index 9ac00ff1e0f..728895840ab 100644 --- a/packages/plugins/other/visitor-plugin-common/src/selection-set-processor/base.ts +++ b/packages/plugins/other/visitor-plugin-common/src/selection-set-processor/base.ts @@ -1,7 +1,7 @@ import { GraphQLInterfaceType, GraphQLNamedType, GraphQLObjectType, GraphQLOutputType } from 'graphql'; import { AvoidOptionalsConfig, ConvertNameFn, ScalarsMap } from '../types.js'; -export type PrimitiveField = { isConditional: boolean; fieldName: string }; +export type PrimitiveField = { isConditional: boolean; isIncremental: boolean; fieldName: string }; export type PrimitiveAliasedFields = { alias: string; fieldName: string }; export type LinkField = { alias: string; name: string; type: string; selectionSet: string }; export type NameAndType = { name: string; type: string }; @@ -12,7 +12,12 @@ export type SelectionSetProcessorConfig = { convertName: ConvertNameFn; enumPrefix: boolean | null; scalars: ScalarsMap; - formatNamedField(name: string, type?: GraphQLOutputType | GraphQLNamedType | null, isConditional?: boolean): string; + formatNamedField( + name: string, + type?: GraphQLOutputType | GraphQLNamedType | null, + isConditional?: boolean, + isIncremental?: boolean + ): string; wrapTypeWithModifiers(baseType: string, type: GraphQLOutputType | GraphQLNamedType): string; avoidOptionals?: AvoidOptionalsConfig | boolean; }; diff --git a/packages/plugins/other/visitor-plugin-common/src/selection-set-processor/pre-resolve-types.ts b/packages/plugins/other/visitor-plugin-common/src/selection-set-processor/pre-resolve-types.ts index 0cf4075d643..66042b0593a 100644 --- a/packages/plugins/other/visitor-plugin-common/src/selection-set-processor/pre-resolve-types.ts +++ b/packages/plugins/other/visitor-plugin-common/src/selection-set-processor/pre-resolve-types.ts @@ -33,7 +33,7 @@ export class PreResolveTypesProcessor extends BaseSelectionSetProcessor; }; +type CollectedFragmentNode = (SelectionNode | FragmentSpreadUsage | DirectiveNode) & FragmentDirectives; + function isMetadataFieldName(name: string) { return ['__schema', '__type'].includes(name); } @@ -99,8 +108,8 @@ export class SelectionSetToObject> + nodes: Array, + types: Map> ) { if (isListType(parentType) || isNonNullType(parentType)) { return this._collectInlineFragments(parentType.ofType as GraphQLNamedType, nodes, types); @@ -112,8 +121,18 @@ export class SelectionSetToObject ({ + ...field, + fragmentDirectives: field.fragmentDirectives || directives, + })); + if (isObjectType(typeOnSchema)) { - this._appendToTypeMap(types, typeOnSchema.name, fields); + this._appendToTypeMap(types, typeOnSchema.name, fieldsWithFragmentDirectives); this._appendToTypeMap(types, typeOnSchema.name, spreadsUsage[typeOnSchema.name]); this._appendToTypeMap(types, typeOnSchema.name, directives); this._collectInlineFragments(typeOnSchema, inlines, types); @@ -232,11 +251,18 @@ export class SelectionSetToObject { + return { + ...selectionNode, + fragmentDirectives: [...(spread.directives || [])], + }; + }); + selectionNodesByTypeName[possibleType.name].push({ fragmentName: spread.name.value, typeName: usage, onType: fragmentSpreadObject.onType, - selectionNodes: [...fragmentSpreadObject.node.selectionSet.selections], + selectionNodes, }); } } @@ -253,7 +279,6 @@ export class SelectionSetToObject(types: Map>, typeName: string, nodes: Array): void { + private _appendToTypeMap( + types: Map>, + typeName: string, + nodes: Array + ): void { if (!types.has(typeName)) { types.set(typeName, []); } @@ -442,7 +471,6 @@ export class SelectionSetToObject ({ isConditional: hasConditionalDirectives(field), + isIncremental: hasIncrementalDeliveryDirectives(field), fieldName: field.name.value, })) ), diff --git a/packages/plugins/other/visitor-plugin-common/src/types.ts b/packages/plugins/other/visitor-plugin-common/src/types.ts index ec32f658a19..8e22a90daa9 100644 --- a/packages/plugins/other/visitor-plugin-common/src/types.ts +++ b/packages/plugins/other/visitor-plugin-common/src/types.ts @@ -1,4 +1,4 @@ -import { ASTNode, FragmentDefinitionNode } from 'graphql'; +import { ASTNode, FragmentDefinitionNode, DirectiveNode } from 'graphql'; import { ParsedMapper } from './mappers.js'; /** @@ -102,3 +102,7 @@ export interface ParsedImport { moduleName: string | null; propName: string; } + +export type FragmentDirectives = { + fragmentDirectives?: Array; +}; diff --git a/packages/plugins/other/visitor-plugin-common/src/utils.ts b/packages/plugins/other/visitor-plugin-common/src/utils.ts index c9590f43702..526fea0025d 100644 --- a/packages/plugins/other/visitor-plugin-common/src/utils.ts +++ b/packages/plugins/other/visitor-plugin-common/src/utils.ts @@ -25,7 +25,7 @@ import { import { RawConfig } from './base-visitor.js'; import { parseMapper } from './mappers.js'; import { DEFAULT_SCALARS } from './scalars.js'; -import { NormalizedScalarsMap, ParsedScalarsMap, ScalarsMap } from './types.js'; +import { NormalizedScalarsMap, ParsedScalarsMap, ScalarsMap, FragmentDirectives } from './types.js'; export const getConfigValue = (value: T, defaultValue: T): T => { if (value === null || value === undefined) { @@ -408,7 +408,7 @@ export const getFieldNodeNameValue = (node: FieldNode): string => { }; export function separateSelectionSet(selections: ReadonlyArray): { - fields: FieldNode[]; + fields: (FieldNode & FragmentDirectives)[]; spreads: FragmentSpreadNode[]; inlines: InlineFragmentNode[]; } { @@ -438,6 +438,11 @@ export function hasConditionalDirectives(field: FieldNode): boolean { return field.directives?.some(directive => CONDITIONAL_DIRECTIVES.includes(directive.name.value)); } +export function hasIncrementalDeliveryDirectives(field: FieldNode & FragmentDirectives): boolean { + const INCREMENTAL_DELIVERY_DIRECTIVES = ['defer']; + return field.fragmentDirectives?.some(directive => INCREMENTAL_DELIVERY_DIRECTIVES.includes(directive.name.value)); +} + type WrapModifiersOptions = { wrapOptional(type: string): string; wrapArray(type: string): string; diff --git a/packages/plugins/typescript/operations/src/ts-selection-set-processor.ts b/packages/plugins/typescript/operations/src/ts-selection-set-processor.ts index 254c336162f..dc39ac1fda1 100644 --- a/packages/plugins/typescript/operations/src/ts-selection-set-processor.ts +++ b/packages/plugins/typescript/operations/src/ts-selection-set-processor.ts @@ -23,19 +23,19 @@ export class TypeScriptSelectionSetProcessor extends BaseSelectionSetProcessor { - if (field.isConditional) { - hasConditionals = true; - conditilnalsList.push(field.fieldName); + if (field.isConditional || field.isIncremental) { + hasOptional = true; + optionalList.push(field.fieldName); } return `'${field.fieldName}'`; }) .join(' | ')}>`; - if (hasConditionals) { + if (hasOptional) { const avoidOptional = // TODO: check type and exec only if relevant this.config.avoidOptionals === true || @@ -47,7 +47,7 @@ export class TypeScriptSelectionSetProcessor extends BaseSelectionSetProcessor `'${field}'`).join(' | ')}>`; + }${transform}<${resString}, ${optionalList.map(field => `'${field}'`).join(' | ')}>`; } return [resString]; } diff --git a/packages/plugins/typescript/operations/src/visitor.ts b/packages/plugins/typescript/operations/src/visitor.ts index c07b2d5736c..83ce5908373 100644 --- a/packages/plugins/typescript/operations/src/visitor.ts +++ b/packages/plugins/typescript/operations/src/visitor.ts @@ -66,9 +66,11 @@ export class TypeScriptDocumentsVisitor extends BaseDocumentsVisitor< const formatNamedField = ( name: string, type: GraphQLOutputType | GraphQLNamedType | null, - isConditional = false + isConditional = false, + isIncremental = false ): string => { - const optional = isConditional || (!this.config.avoidOptionals.field && !!type && !isNonNullType(type)); + const optional = + isConditional || isIncremental || (!this.config.avoidOptionals.field && !!type && !isNonNullType(type)); return (this.config.immutableTypes ? `readonly ${name}` : name) + (optional ? '?' : ''); }; diff --git a/packages/plugins/typescript/operations/tests/ts-documents.spec.ts b/packages/plugins/typescript/operations/tests/ts-documents.spec.ts index de9b5c5dfe8..b9b8016f03d 100644 --- a/packages/plugins/typescript/operations/tests/ts-documents.spec.ts +++ b/packages/plugins/typescript/operations/tests/ts-documents.spec.ts @@ -6434,6 +6434,571 @@ function test(q: GetEntityBrandDataQuery): void { }); }); + describe('incremental delivery directive handling', () => { + it('should mark fields in deferred fragments as optional (preResolveTypes: true)', async () => { + const schema = buildSchema(` + type Address { + street1: String! + } + + type Phone { + home: String! + } + + type Employment { + title: String! + } + + type User { + name: String! + email: String! + address: Address! + phone: Phone! + employment: Employment! + widgetCount: Int! + widgetPreference: String! + clearanceLevel: String! + favoriteFood: String! + leastFavoriteFood: String! + } + + type Query { + user: User! + } + `); + + const fragment = parse(` + fragment WidgetFragment on User { + widgetCount + widgetPreference + } + + fragment FoodFragment on User { + favoriteFood + leastFavoriteFood + } + + fragment EmploymentFragment on User { + employment { + title + } + } + + query user { + user { + # Test inline fragment defer + ... @defer { + email + } + + # Test inline fragment defer with nested selection set + ... @defer { + address { + street1 + } + } + + # Test named fragment defer + ...WidgetFragment @defer + + # Test a secondary named fragment defer + ...FoodFragment @defer + + # Not deferred fields, fragments, selection sets, etc are left alone + name + phone { + home + } + ...EmploymentFragment + ... { + clearanceLevel + } + } + } + `); + + const { content } = await plugin( + schema, + [{ location: '', document: fragment }], + { preResolveTypes: true }, + { outputFile: 'graphql.ts' } + ); + + expect(content).toBeSimilarStringTo(` + export type UserQueryVariables = Exact<{ [key: string]: never; }>; + export type UserQuery = { + __typename?: 'Query', + user: { + __typename?: 'User', + email?: string, + clearanceLevel: string, + name: string, + widgetCount?: number, + widgetPreference?: string, + favoriteFood?: string, + leastFavoriteFood?: string, + address?: { + __typename?: 'Address', + street1: string + }, + phone: { + __typename?: 'Phone', + home: string + }, + employment: { + __typename?: 'Employment', + title: string + } + } + }; + `); + }); + + it('should mark fields in deferred fragments as optional using MakeOptional (preResolveTypes: false)', async () => { + const schema = buildSchema(` + type Address { + street1: String! + } + + type Phone { + home: String! + } + + type Employment { + title: String! + } + + type User { + name: String! + email: String! + address: Address! + phone: Phone! + employment: Employment! + widgetCount: Int! + clearanceLevel: String! + } + + type Query { + user: User! + } + `); + + const fragment = parse(` + fragment WidgetFragment on User { + widgetCount + } + + fragment EmploymentFragment on User { + employment { + title + } + } + + query user { + user { + # Test inline fragment defer + ... @defer { + email + } + + # Test inline fragment defer with nested selection set + ... @defer { + address { + street1 + } + } + + # Test named fragment defer + ...WidgetFragment @defer + + # Not deferred fields, fragments, selection sets, etc are left alone + name + phone { + home + } + ...EmploymentFragment + ... { + clearanceLevel + } + } + } + `); + + const { content } = await plugin( + schema, + [{ location: '', document: fragment }], + { preResolveTypes: false }, + { outputFile: 'graphql.ts' } + ); + + expect(content).toBeSimilarStringTo(` + export type WidgetFragmentFragment = ( + { __typename?: 'User' } + & Pick + ); + + export type EmploymentFragmentFragment = ( + { __typename?: 'User' } + & { employment: ( + { __typename?: 'Employment' } + & Pick + ) } + ); + + export type UserQueryVariables = Exact<{ [key: string]: never; }>; + + export type UserQuery = ( + { __typename?: 'Query' } + & { user: ( + { __typename?: 'User' } + & MakeOptional, 'email' | 'widgetCount'> + & { address?: ( + { __typename?: 'Address' } + & Pick + ), phone: ( + { __typename?: 'Phone' } + & Pick + ), employment: ( + { __typename?: 'Employment' } + & Pick + ) } + ) } + ); + `); + }); + + it('should mark fields in deferred fragments as optional using MakeMaybe (avoidOptionals: true)', async () => { + const schema = buildSchema(` + type Address { + street1: String! + } + + type Phone { + home: String! + } + + type Employment { + title: String! + } + + type User { + name: String! + email: String! + address: Address! + phone: Phone! + employment: Employment! + widgetCount: Int! + clearanceLevel: String! + } + + type Query { + user: User! + } + `); + + const fragment = parse(` + fragment WidgetFragment on User { + widgetCount + } + + fragment EmploymentFragment on User { + employment { + title + } + } + + query user { + user { + # Test inline fragment defer + ... @defer { + email + } + + # Test inline fragment defer with nested selection set + ... @defer { + address { + street1 + } + } + + # Test named fragment defer + ...WidgetFragment @defer + + # Not deferred fields, fragments, selection sets, etc are left alone + name + phone { + home + } + ...EmploymentFragment + ... { + clearanceLevel + } + } + } + `); + + const { content } = await plugin( + schema, + [{ location: '', document: fragment }], + { + avoidOptionals: true, + preResolveTypes: false, + }, + { outputFile: 'graphql.ts' } + ); + + expect(content).toBeSimilarStringTo(` + export type WidgetFragmentFragment = ( + { __typename?: 'User' } + & Pick + ); + + export type EmploymentFragmentFragment = ( + { __typename?: 'User' } + & { employment: ( + { __typename?: 'Employment' } + & Pick + ) } + ); + + export type UserQueryVariables = Exact<{ [key: string]: never; }>; + + export type UserQuery = ( + { __typename?: 'Query' } + & { user: ( + { __typename?: 'User' } + & MakeMaybe, 'email' | 'widgetCount'> + & { address?: ( + { __typename?: 'Address' } + & Pick + ), phone: ( + { __typename?: 'Phone' } + & Pick + ), employment: ( + { __typename?: 'Employment' } + & Pick + ) } + ) } + ); + `); + }); + + it('should support "preResolveTypes: true" and "avoidOptionals: true" together', async () => { + const schema = buildSchema(` + type Address { + street1: String! + } + + type Phone { + home: String! + } + + type Employment { + title: String! + } + + type User { + name: String! + email: String! + address: Address! + phone: Phone! + employment: Employment! + widgetCount: Int! + clearanceLevel: String! + } + + type Query { + user: User! + } + `); + + const fragment = parse(` + fragment WidgetFragment on User { + widgetCount + } + + fragment EmploymentFragment on User { + employment { + title + } + } + + query user { + user { + # Test inline fragment defer + ... @defer { + email + } + + # Test inline fragment defer with nested selection set + ... @defer { + address { + street1 + } + } + + # Test named fragment defer + ...WidgetFragment @defer + + # Not deferred fields, fragments, selection sets, etc are left alone + name + phone { + home + } + ...EmploymentFragment + ... { + clearanceLevel + } + } + } + `); + + const { content } = await plugin( + schema, + [{ location: '', document: fragment }], + { + avoidOptionals: true, + preResolveTypes: true, + }, + { outputFile: 'graphql.ts' } + ); + + expect(content).toBeSimilarStringTo(` + export type UserQueryVariables = Exact<{ [key: string]: never; }>; + export type UserQuery = { + __typename?: 'Query', + user: { + __typename?: 'User', + email?: string, + clearanceLevel: string, + name: string, + widgetCount?: number, + address?: { + __typename?: 'Address', + street1: string + }, + phone: { + __typename?: 'Phone', + home: string + }, + employment: { + __typename?: 'Employment', + title: string + } + } + }; + `); + }); + + it('should resolve optionals according to maybeValue together with avoidOptionals and deferred fragments', async () => { + const schema = buildSchema(` + type Address { + street1: String + } + + type Phone { + home: String! + } + + type Employment { + title: String! + } + + type User { + name: String! + email: String! + address: Address! + phone: Phone! + employment: Employment! + widgetCount: Int! + clearanceLevel: String! + } + + type Query { + user: User! + } + `); + + const fragment = parse(` + fragment WidgetFragment on User { + widgetCount + } + + fragment EmploymentFragment on User { + employment { + title + } + } + + query user { + user { + # Test inline fragment defer + ... @defer { + email + } + + # Test inline fragment defer with nested selection set + ... @defer { + address { + street1 + } + } + + # Test named fragment defer + ...WidgetFragment @defer + + # Not deferred fields, fragments, selection sets, etc are left alone + name + phone { + home + } + ...EmploymentFragment + ... { + clearanceLevel + } + } + } + `); + + const { content } = await plugin( + schema, + [{ location: '', document: fragment }], + { + preResolveTypes: true, + maybeValue: "T | 'specialType'", + avoidOptionals: true, + }, + { outputFile: 'graphql.ts' } + ); + + expect(content).toBeSimilarStringTo(` + export type UserQueryVariables = Exact<{ [key: string]: never; }>; + export type UserQuery = { + __typename?: 'Query', + user: { + __typename?: 'User', + email?: string, + clearanceLevel: string, + name: string, + widgetCount?: number, + address?: { + __typename?: 'Address', + street1: string | 'specialType' + }, + phone: { + __typename?: 'Phone', + home: string + }, + employment: { + __typename?: 'Employment', + title: string + } + } + }; + `); + }); + }); + it('handles unnamed queries', async () => { const ast = parse(/* GraphQL */ ` query { From 9696d7e51e21268f085e5443ca54f3c3a7df53b6 Mon Sep 17 00:00:00 2001 From: beerose Date: Thu, 16 Mar 2023 12:01:11 +0100 Subject: [PATCH 02/47] Add defer apollo example --- examples/react/apollo-client-defer/.gitignore | 23 +++++++ examples/react/apollo-client-defer/README.md | 17 ++++++ examples/react/apollo-client-defer/codegen.ts | 15 +++++ .../apollo-client-defer/cypress.config.ts | 10 +++ .../cypress/e2e/end2end.cy.ts | 10 +++ .../cypress/support/commands.ts | 1 + .../cypress/support/e2e.ts | 2 + examples/react/apollo-client-defer/index.html | 13 ++++ .../react/apollo-client-defer/package.json | 36 +++++++++++ .../react/apollo-client-defer/public/vite.svg | 1 + .../react/apollo-client-defer/src/App.css | 38 ++++++++++++ .../react/apollo-client-defer/src/App.tsx | 34 +++++++++++ .../src/gql/fragment-masking.ts | 50 +++++++++++++++ .../react/apollo-client-defer/src/gql/gql.ts | 50 +++++++++++++++ .../apollo-client-defer/src/gql/graphql.ts | 61 +++++++++++++++++++ .../apollo-client-defer/src/gql/index.ts | 2 + .../react/apollo-client-defer/src/main.css | 11 ++++ .../react/apollo-client-defer/src/main.tsx | 19 ++++++ .../react/apollo-client-defer/src/yoga.mjs | 55 +++++++++++++++++ .../react/apollo-client-defer/tsconfig.json | 18 ++++++ .../apollo-client-defer/tsconfig.node.json | 9 +++ .../react/apollo-client-defer/vite.config.ts | 8 +++ .../apollo-client-swc-plugin/package.json | 2 +- examples/react/apollo-client/package.json | 2 +- examples/vite/vite-react-cts/package.json | 2 +- examples/vite/vite-react-mts/package.json | 2 +- examples/vite/vite-react-ts/package.json | 2 +- examples/vue/apollo-composable/package.json | 2 +- yarn.lock | 17 ++++-- 29 files changed, 501 insertions(+), 11 deletions(-) create mode 100644 examples/react/apollo-client-defer/.gitignore create mode 100644 examples/react/apollo-client-defer/README.md create mode 100644 examples/react/apollo-client-defer/codegen.ts create mode 100644 examples/react/apollo-client-defer/cypress.config.ts create mode 100644 examples/react/apollo-client-defer/cypress/e2e/end2end.cy.ts create mode 100644 examples/react/apollo-client-defer/cypress/support/commands.ts create mode 100644 examples/react/apollo-client-defer/cypress/support/e2e.ts create mode 100644 examples/react/apollo-client-defer/index.html create mode 100644 examples/react/apollo-client-defer/package.json create mode 100644 examples/react/apollo-client-defer/public/vite.svg create mode 100644 examples/react/apollo-client-defer/src/App.css create mode 100644 examples/react/apollo-client-defer/src/App.tsx create mode 100644 examples/react/apollo-client-defer/src/gql/fragment-masking.ts create mode 100644 examples/react/apollo-client-defer/src/gql/gql.ts create mode 100644 examples/react/apollo-client-defer/src/gql/graphql.ts create mode 100644 examples/react/apollo-client-defer/src/gql/index.ts create mode 100644 examples/react/apollo-client-defer/src/main.css create mode 100644 examples/react/apollo-client-defer/src/main.tsx create mode 100644 examples/react/apollo-client-defer/src/yoga.mjs create mode 100644 examples/react/apollo-client-defer/tsconfig.json create mode 100644 examples/react/apollo-client-defer/tsconfig.node.json create mode 100644 examples/react/apollo-client-defer/vite.config.ts diff --git a/examples/react/apollo-client-defer/.gitignore b/examples/react/apollo-client-defer/.gitignore new file mode 100644 index 00000000000..4d29575de80 --- /dev/null +++ b/examples/react/apollo-client-defer/.gitignore @@ -0,0 +1,23 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# production +/build + +# misc +.DS_Store +.env.local +.env.development.local +.env.test.local +.env.production.local + +npm-debug.log* +yarn-debug.log* +yarn-error.log* diff --git a/examples/react/apollo-client-defer/README.md b/examples/react/apollo-client-defer/README.md new file mode 100644 index 00000000000..e808d30aa8a --- /dev/null +++ b/examples/react/apollo-client-defer/README.md @@ -0,0 +1,17 @@ +# Using GraphQL Code Generator with Apollo Client and React + +This example illustrates how to use GraphQL Code Generator in a React application using the Apollo React GraphQL Client. + +You will find the TypeScript-based codegen configuration in [`codegen.ts`](./codegen.ts). + +This simple codegen configuration generates types and helpers in the [`src/gql`](./src/gql/) folder that help you to get typed GraphQL Queries and Mutations seamlessly ⚡️ + +
+ +For a step-by-step implementation tutorial, please refer to the related guide: + +https://www.the-guild.dev/graphql/codegen/docs/guides/react-vue-angular + +-- + +Please note that the `client` preset used in this example is compatible with `@apollo/client` (since `3.2.0`, not when using React Components (``)). diff --git a/examples/react/apollo-client-defer/codegen.ts b/examples/react/apollo-client-defer/codegen.ts new file mode 100644 index 00000000000..117250afa81 --- /dev/null +++ b/examples/react/apollo-client-defer/codegen.ts @@ -0,0 +1,15 @@ +// eslint-disable-next-line import/no-extraneous-dependencies +import { type CodegenConfig } from '@graphql-codegen/cli'; + +const config: CodegenConfig = { + schema: './src/yoga.mjs', + documents: ['src/**/*.tsx'], + generates: { + './src/gql/': { + preset: 'client', + }, + }, + hooks: { afterAllFileWrite: ['prettier --write'] }, +}; + +export default config; diff --git a/examples/react/apollo-client-defer/cypress.config.ts b/examples/react/apollo-client-defer/cypress.config.ts new file mode 100644 index 00000000000..b1c137b9e05 --- /dev/null +++ b/examples/react/apollo-client-defer/cypress.config.ts @@ -0,0 +1,10 @@ +/* eslint-disable import/no-extraneous-dependencies */ +import { defineConfig } from 'cypress'; + +export default defineConfig({ + e2e: { + setupNodeEvents(_on, _config) { + // implement node event listeners here + }, + }, +}); diff --git a/examples/react/apollo-client-defer/cypress/e2e/end2end.cy.ts b/examples/react/apollo-client-defer/cypress/e2e/end2end.cy.ts new file mode 100644 index 00000000000..b76795a439d --- /dev/null +++ b/examples/react/apollo-client-defer/cypress/e2e/end2end.cy.ts @@ -0,0 +1,10 @@ +describe('template spec', () => { + it('renders everything correctly', () => { + cy.visit('http://localhost:3000'); + cy.get('.App').should('contain', 'I am speed'); + cy.get('.App').should('not.contain', 'I am slow'); + + cy.wait(1000); + cy.get('.App').should('contain', 'I am slow'); + }); +}); diff --git a/examples/react/apollo-client-defer/cypress/support/commands.ts b/examples/react/apollo-client-defer/cypress/support/commands.ts new file mode 100644 index 00000000000..6d4cbd5a68a --- /dev/null +++ b/examples/react/apollo-client-defer/cypress/support/commands.ts @@ -0,0 +1 @@ +/// diff --git a/examples/react/apollo-client-defer/cypress/support/e2e.ts b/examples/react/apollo-client-defer/cypress/support/e2e.ts new file mode 100644 index 00000000000..663a7b21f51 --- /dev/null +++ b/examples/react/apollo-client-defer/cypress/support/e2e.ts @@ -0,0 +1,2 @@ +// Import commands.js using ES2015 syntax: +import './commands'; diff --git a/examples/react/apollo-client-defer/index.html b/examples/react/apollo-client-defer/index.html new file mode 100644 index 00000000000..ab66da90506 --- /dev/null +++ b/examples/react/apollo-client-defer/index.html @@ -0,0 +1,13 @@ + + + + + + + Vite App + + +
+ + + diff --git a/examples/react/apollo-client-defer/package.json b/examples/react/apollo-client-defer/package.json new file mode 100644 index 00000000000..919f77716c7 --- /dev/null +++ b/examples/react/apollo-client-defer/package.json @@ -0,0 +1,36 @@ +{ + "name": "example-react-apollo-client-defer", + "version": "0.1.0", + "private": true, + "dependencies": { + "@apollo/client": "^3.7.10", + "graphql": "^16.6.0", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "graphql-yoga": "3.7.3" + }, + "devDependencies": { + "@graphql-codegen/cli": "^3.2.2", + "@graphql-codegen/client-preset": "^2.1.1", + "@graphql-yoga/plugin-defer-stream": "^1.7.3", + "@types/jest": "^27.5.2", + "@types/node": "^18.11.18", + "@types/react": "^18.0.15", + "@types/react-dom": "^18.0.10", + "@vitejs/plugin-react": "^3.1.0", + "cypress": "12.6.0", + "serve": "14.2.0", + "start-server-and-test": "2.0.0", + "typescript": "4.9.5", + "vite": "^4.1.0" + }, + "scripts": { + "dev": "vite", + "build": "vite build", + "start:yoga": "node src/yoga.mjs", + "start": "yarn start:yoga & serve -s dist", + "test": "cypress run", + "test:end2end": "start-server-and-test start http://localhost:3000 test", + "codegen": "graphql-codegen --config codegen.ts" + } +} diff --git a/examples/react/apollo-client-defer/public/vite.svg b/examples/react/apollo-client-defer/public/vite.svg new file mode 100644 index 00000000000..e7b8dfb1b2a --- /dev/null +++ b/examples/react/apollo-client-defer/public/vite.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/react/apollo-client-defer/src/App.css b/examples/react/apollo-client-defer/src/App.css new file mode 100644 index 00000000000..74b5e053450 --- /dev/null +++ b/examples/react/apollo-client-defer/src/App.css @@ -0,0 +1,38 @@ +.App { + text-align: center; +} + +.App-logo { + height: 40vmin; + pointer-events: none; +} + +@media (prefers-reduced-motion: no-preference) { + .App-logo { + animation: App-logo-spin infinite 20s linear; + } +} + +.App-header { + background-color: #282c34; + min-height: 100vh; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + font-size: calc(10px + 2vmin); + color: white; +} + +.App-link { + color: #61dafb; +} + +@keyframes App-logo-spin { + from { + transform: rotate(0deg); + } + to { + transform: rotate(360deg); + } +} diff --git a/examples/react/apollo-client-defer/src/App.tsx b/examples/react/apollo-client-defer/src/App.tsx new file mode 100644 index 00000000000..9dc2e37034b --- /dev/null +++ b/examples/react/apollo-client-defer/src/App.tsx @@ -0,0 +1,34 @@ +import { useQuery } from '@apollo/client'; + +import './App.css'; +import { graphql } from './gql/gql'; + +const alphabetQuery = graphql(/* GraphQL */ ` + query SlowAndFastFieldWithDefer { + ... on Query @defer { + slowField + } + fastField + } +`); + +const Field = ({ field }: { field: string }) => { + return

{field}

; +}; + +function App() { + const { data } = useQuery(alphabetQuery); + return ( +
+ {data && ( + <> + + {/* @ts-expect-error expected because slowField can be undefined */} + + + )} +
+ ); +} + +export default App; diff --git a/examples/react/apollo-client-defer/src/gql/fragment-masking.ts b/examples/react/apollo-client-defer/src/gql/fragment-masking.ts new file mode 100644 index 00000000000..195a11ebd3e --- /dev/null +++ b/examples/react/apollo-client-defer/src/gql/fragment-masking.ts @@ -0,0 +1,50 @@ +import { ResultOf, TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core'; + +export type FragmentType> = TDocumentType extends DocumentNode< + infer TType, + any +> + ? TType extends { ' $fragmentName'?: infer TKey } + ? TKey extends string + ? { ' $fragmentRefs'?: { [key in TKey]: TType } } + : never + : never + : never; + +// return non-nullable if `fragmentType` is non-nullable +export function useFragment( + _documentNode: DocumentNode, + fragmentType: FragmentType> +): TType; +// return nullable if `fragmentType` is nullable +export function useFragment( + _documentNode: DocumentNode, + fragmentType: FragmentType> | null | undefined +): TType | null | undefined; +// return array of non-nullable if `fragmentType` is array of non-nullable +export function useFragment( + _documentNode: DocumentNode, + fragmentType: ReadonlyArray>> +): ReadonlyArray; +// return array of nullable if `fragmentType` is array of nullable +export function useFragment( + _documentNode: DocumentNode, + fragmentType: ReadonlyArray>> | null | undefined +): ReadonlyArray | null | undefined; +export function useFragment( + _documentNode: DocumentNode, + fragmentType: + | FragmentType> + | ReadonlyArray>> + | null + | undefined +): TType | ReadonlyArray | null | undefined { + return fragmentType as any; +} + +export function makeFragmentData>( + data: FT, + _fragment: F +): FragmentType { + return data as FragmentType; +} diff --git a/examples/react/apollo-client-defer/src/gql/gql.ts b/examples/react/apollo-client-defer/src/gql/gql.ts new file mode 100644 index 00000000000..3ff1f79bac1 --- /dev/null +++ b/examples/react/apollo-client-defer/src/gql/gql.ts @@ -0,0 +1,50 @@ +/* eslint-disable */ +import * as types from './graphql'; +import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core'; + +/** + * Map of all GraphQL operations in the project. + * + * This map has several performance disadvantages: + * 1. It is not tree-shakeable, so it will include all operations in the project. + * 2. It is not minifiable, so the string of a GraphQL query will be multiple times inside the bundle. + * 3. It does not support dead code elimination, so it will add unused operations. + * + * Therefore it is highly recommended to use the babel or swc plugin for production. + */ +const documents = { + '\n query SlowAndFastFieldWithDefer {\n ... on Query @defer {\n slowField\n }\n fastField\n }\n': + types.SlowAndFastFieldWithDeferDocument, +}; + +/** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + * + * + * @example + * ```ts + * const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`); + * ``` + * + * The query argument is unknown! + * Please regenerate the types. + */ +export function graphql(source: string): unknown; + +/** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function graphql( + source: '\n query SlowAndFastFieldWithDefer {\n ... on Query @defer {\n slowField\n }\n fastField\n }\n' +): (typeof documents)['\n query SlowAndFastFieldWithDefer {\n ... on Query @defer {\n slowField\n }\n fastField\n }\n']; + +export function graphql(source: string) { + return (documents as any)[source] ?? {}; +} + +export type DocumentType> = TDocumentNode extends DocumentNode< + infer TType, + any +> + ? TType + : never; diff --git a/examples/react/apollo-client-defer/src/gql/graphql.ts b/examples/react/apollo-client-defer/src/gql/graphql.ts new file mode 100644 index 00000000000..4db4b00b8d7 --- /dev/null +++ b/examples/react/apollo-client-defer/src/gql/graphql.ts @@ -0,0 +1,61 @@ +/* eslint-disable */ +import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core'; +export type Maybe = T | null; +export type InputMaybe = Maybe; +export type Exact = { [K in keyof T]: T[K] }; +export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; +export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +/** All built-in and custom scalars, mapped to their actual values */ +export type Scalars = { + ID: string; + String: string; + Boolean: boolean; + Int: number; + Float: number; +}; + +export type Query = { + __typename?: 'Query'; + alphabet: Array; + /** A field that resolves fast. */ + fastField: Scalars['String']; + /** + * A field that resolves slowly. + * Maybe you want to @defer this field ;) + */ + slowField?: Maybe; +}; + +export type QuerySlowFieldArgs = { + waitFor?: Scalars['Int']; +}; + +export type SlowAndFastFieldWithDeferQueryVariables = Exact<{ [key: string]: never }>; + +export type SlowAndFastFieldWithDeferQuery = { __typename?: 'Query'; slowField?: string | null; fastField: string }; + +export const SlowAndFastFieldWithDeferDocument = { + kind: 'Document', + definitions: [ + { + kind: 'OperationDefinition', + operation: 'query', + name: { kind: 'Name', value: 'SlowAndFastFieldWithDefer' }, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'InlineFragment', + typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'Query' } }, + directives: [{ kind: 'Directive', name: { kind: 'Name', value: 'defer' } }], + selectionSet: { + kind: 'SelectionSet', + selections: [{ kind: 'Field', name: { kind: 'Name', value: 'slowField' } }], + }, + }, + { kind: 'Field', name: { kind: 'Name', value: 'fastField' } }, + ], + }, + }, + ], +} as unknown as DocumentNode; diff --git a/examples/react/apollo-client-defer/src/gql/index.ts b/examples/react/apollo-client-defer/src/gql/index.ts new file mode 100644 index 00000000000..c682b1e2f99 --- /dev/null +++ b/examples/react/apollo-client-defer/src/gql/index.ts @@ -0,0 +1,2 @@ +export * from './fragment-masking'; +export * from './gql'; diff --git a/examples/react/apollo-client-defer/src/main.css b/examples/react/apollo-client-defer/src/main.css new file mode 100644 index 00000000000..7323ae85c54 --- /dev/null +++ b/examples/react/apollo-client-defer/src/main.css @@ -0,0 +1,11 @@ +body { + margin: 0; + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', + 'Droid Sans', 'Helvetica Neue', sans-serif; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +code { + font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace; +} diff --git a/examples/react/apollo-client-defer/src/main.tsx b/examples/react/apollo-client-defer/src/main.tsx new file mode 100644 index 00000000000..f94b44f7bb0 --- /dev/null +++ b/examples/react/apollo-client-defer/src/main.tsx @@ -0,0 +1,19 @@ +import React from 'react'; +import ReactDOM from 'react-dom/client'; +import './main.css'; +import App from './App'; +import { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client'; + +const client = new ApolloClient({ + uri: 'http://localhost:4000/graphql', + cache: new InMemoryCache(), +}); + +const root = ReactDOM.createRoot(document.getElementById('app') as HTMLElement); +root.render( + + + + + +); diff --git a/examples/react/apollo-client-defer/src/yoga.mjs b/examples/react/apollo-client-defer/src/yoga.mjs new file mode 100644 index 00000000000..7b70293d3b4 --- /dev/null +++ b/examples/react/apollo-client-defer/src/yoga.mjs @@ -0,0 +1,55 @@ +import { createSchema, createYoga } from 'graphql-yoga'; +import { useDeferStream } from '@graphql-yoga/plugin-defer-stream'; +import { createServer } from 'node:http'; + +const typeDefs = /* GraphQL */ ` + type Query { + alphabet: [String!]! + """ + A field that resolves fast. + """ + fastField: String! + + """ + A field that resolves slowly. + Maybe you want to @defer this field ;) + """ + slowField(waitFor: Int! = 5000): String + } +`; + +const wait = time => new Promise(resolve => setTimeout(resolve, time)); + +const resolvers = { + Query: { + async *alphabet() { + for (const character of ['a', 'b', 'c', 'd', 'e', 'f', 'g']) { + yield character; + await wait(1000); + } + }, + fastField: async () => { + await wait(100); + return 'I am speed'; + }, + slowField: async (_, { waitFor }) => { + await wait(waitFor); + return 'I am slow'; + }, + }, +}; + +export const yoga = createYoga({ + schema: createSchema({ + typeDefs, + resolvers, + }), + plugins: [useDeferStream()], +}); + +const server = createServer(yoga); + +server.listen(4000, () => { + // eslint-disable-next-line no-console + console.info('Server is running on http://localhost:4000/graphql'); +}); diff --git a/examples/react/apollo-client-defer/tsconfig.json b/examples/react/apollo-client-defer/tsconfig.json new file mode 100644 index 00000000000..b557c4047ca --- /dev/null +++ b/examples/react/apollo-client-defer/tsconfig.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "target": "ESNext", + "useDefineForClassFields": true, + "module": "ESNext", + "moduleResolution": "Node", + "strict": true, + "jsx": "preserve", + "resolveJsonModule": true, + "isolatedModules": true, + "esModuleInterop": true, + "lib": ["ESNext", "DOM"], + "skipLibCheck": true, + "noEmit": true + }, + "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"], + "references": [{ "path": "./tsconfig.node.json" }] +} diff --git a/examples/react/apollo-client-defer/tsconfig.node.json b/examples/react/apollo-client-defer/tsconfig.node.json new file mode 100644 index 00000000000..9d31e2aed93 --- /dev/null +++ b/examples/react/apollo-client-defer/tsconfig.node.json @@ -0,0 +1,9 @@ +{ + "compilerOptions": { + "composite": true, + "module": "ESNext", + "moduleResolution": "Node", + "allowSyntheticDefaultImports": true + }, + "include": ["vite.config.ts"] +} diff --git a/examples/react/apollo-client-defer/vite.config.ts b/examples/react/apollo-client-defer/vite.config.ts new file mode 100644 index 00000000000..779543405fa --- /dev/null +++ b/examples/react/apollo-client-defer/vite.config.ts @@ -0,0 +1,8 @@ +/* eslint-disable import/no-extraneous-dependencies */ +import { defineConfig } from 'vite'; +import react from '@vitejs/plugin-react'; + +// https://vitejs.dev/config/ +export default defineConfig({ + plugins: [react()], +}); diff --git a/examples/react/apollo-client-swc-plugin/package.json b/examples/react/apollo-client-swc-plugin/package.json index 91252dafee2..7e4e5b183fe 100644 --- a/examples/react/apollo-client-swc-plugin/package.json +++ b/examples/react/apollo-client-swc-plugin/package.json @@ -3,7 +3,7 @@ "version": "0.1.0", "private": true, "dependencies": { - "@apollo/client": "^3.6.9", + "@apollo/client": "^3.7.10", "react": "18.2.0", "react-dom": "18.2.0" }, diff --git a/examples/react/apollo-client/package.json b/examples/react/apollo-client/package.json index f1e2024cbfe..0d04d36a102 100644 --- a/examples/react/apollo-client/package.json +++ b/examples/react/apollo-client/package.json @@ -3,7 +3,7 @@ "version": "0.1.0", "private": true, "dependencies": { - "@apollo/client": "^3.6.9", + "@apollo/client": "^3.7.10", "graphql": "^16.6.0", "react": "^18.2.0", "react-dom": "^18.2.0" diff --git a/examples/vite/vite-react-cts/package.json b/examples/vite/vite-react-cts/package.json index 775637d07cd..a890b95e57a 100644 --- a/examples/vite/vite-react-cts/package.json +++ b/examples/vite/vite-react-cts/package.json @@ -12,7 +12,7 @@ "test:end2end": "start-server-and-test start http://localhost:3000 test" }, "dependencies": { - "@apollo/client": "^3.6.9", + "@apollo/client": "^3.7.10", "@graphql-typed-document-node/core": "3.1.2", "@vitejs/plugin-react-swc": "^3.0.0", "graphql": "16.6.0", diff --git a/examples/vite/vite-react-mts/package.json b/examples/vite/vite-react-mts/package.json index a0f97c721c7..52b7ae22e5a 100644 --- a/examples/vite/vite-react-mts/package.json +++ b/examples/vite/vite-react-mts/package.json @@ -12,7 +12,7 @@ "test:end2end": "start-server-and-test start http://localhost:3000 test" }, "dependencies": { - "@apollo/client": "^3.6.9", + "@apollo/client": "^3.7.10", "@graphql-typed-document-node/core": "3.1.2", "@vitejs/plugin-react-swc": "^3.0.0", "graphql": "16.6.0", diff --git a/examples/vite/vite-react-ts/package.json b/examples/vite/vite-react-ts/package.json index c25a3042a2a..f04f9470c0d 100644 --- a/examples/vite/vite-react-ts/package.json +++ b/examples/vite/vite-react-ts/package.json @@ -12,7 +12,7 @@ "test:end2end": "start-server-and-test start http://localhost:3000 test" }, "dependencies": { - "@apollo/client": "^3.6.9", + "@apollo/client": "^3.7.10", "@graphql-typed-document-node/core": "3.1.2", "@vitejs/plugin-react-swc": "^3.0.0", "graphql": "16.6.0", diff --git a/examples/vue/apollo-composable/package.json b/examples/vue/apollo-composable/package.json index 831c45a56fe..8778543b19f 100644 --- a/examples/vue/apollo-composable/package.json +++ b/examples/vue/apollo-composable/package.json @@ -11,7 +11,7 @@ "test:end2end": "start-server-and-test start http://localhost:3000 test" }, "dependencies": { - "@apollo/client": "^3.7.7", + "@apollo/client": "^3.7.10", "@vue/apollo-composable": "4.0.0-beta.4", "graphql": "^16.6.0", "vue": "^3.2.37" diff --git a/yarn.lock b/yarn.lock index de64a9b3435..f770e2aef3e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -172,10 +172,10 @@ "@jridgewell/gen-mapping" "^0.1.0" "@jridgewell/trace-mapping" "^0.3.9" -"@apollo/client@^3.6.9", "@apollo/client@^3.7.7": - version "3.7.8" - resolved "https://registry.yarnpkg.com/@apollo/client/-/client-3.7.8.tgz#e1c8dfd02cbbe1baf9b18fa86918904efd9cc580" - integrity sha512-o1NxF4ytET2w9HSVMLwYUEEdv6H3XPpbh9M+ABVGnUVT0s6T9pgqRtYO4pFP1TmeDmb1pbRfVhFwh3gC167j5Q== +"@apollo/client@^3.7.10": + version "3.7.10" + resolved "https://registry.yarnpkg.com/@apollo/client/-/client-3.7.10.tgz#addc5fcebaf016981d9476268a06d529be83f568" + integrity sha512-/k1MfrqPKYiPNdHcOzdxg9cEx96vhAGxAcSorzfBvV29XtFQcYW2cPNQOTjK/fpSMtqVo8UNmu5vwQAWD1gfCg== dependencies: "@graphql-typed-document-node/core" "^3.1.1" "@wry/context" "^0.7.0" @@ -2663,7 +2663,7 @@ value-or-promise "^1.0.11" ws "^8.12.0" -"@graphql-tools/utils@9.2.1", "@graphql-tools/utils@^9.0.0", "@graphql-tools/utils@^9.1.1", "@graphql-tools/utils@^9.2.1": +"@graphql-tools/utils@9.2.1", "@graphql-tools/utils@^9.0.0", "@graphql-tools/utils@^9.0.1", "@graphql-tools/utils@^9.1.1", "@graphql-tools/utils@^9.2.1": version "9.2.1" resolved "https://registry.yarnpkg.com/@graphql-tools/utils/-/utils-9.2.1.tgz#1b3df0ef166cfa3eae706e3518b17d5922721c57" integrity sha512-WUw506Ql6xzmOORlriNrD6Ugx+HjVgYxt9KCXD9mHAak+eaXSwuGGPyE60hy9xaDEoXKBsG7SkG69ybitaVl6A== @@ -2706,6 +2706,13 @@ dependencies: tslib "^2.3.1" +"@graphql-yoga/plugin-defer-stream@^1.7.3": + version "1.7.3" + resolved "https://registry.yarnpkg.com/@graphql-yoga/plugin-defer-stream/-/plugin-defer-stream-1.7.3.tgz#6314270e36ed21c54b72d872f5d8abcaec20b5e7" + integrity sha512-XyGoQsdW0zWUZhCB8yBT4sAhmf4VWLbXXrDYAFwBxJSNv+yJB+rnd8NeML/1MKh0zGwbbnbeeSP1zU1NRXgA+Q== + dependencies: + "@graphql-tools/utils" "^9.0.1" + "@graphql-yoga/plugin-persisted-operations@1.7.3": version "1.7.3" resolved "https://registry.yarnpkg.com/@graphql-yoga/plugin-persisted-operations/-/plugin-persisted-operations-1.7.3.tgz#7db03e6551bcdf6d205e7ce024db3a97d3750a86" From 6658aaa8336ee2e6e52c1cbe7b17efe487badb9b Mon Sep 17 00:00:00 2001 From: beerose Date: Thu, 16 Mar 2023 22:12:23 +0100 Subject: [PATCH 03/47] Add union of initial and deferred fields --- .../react/apollo-client-defer/src/App.tsx | 5 +- .../react/apollo-client-defer/src/gql/gql.ts | 6 +- .../apollo-client-defer/src/gql/graphql.ts | 9 ++- .../react/apollo-client-defer/src/yoga.mjs | 2 +- .../src/selection-set-processor/base.ts | 2 +- .../pre-resolve-types.ts | 5 +- .../src/selection-set-to-object.ts | 71 ++++++++++++------- .../other/visitor-plugin-common/src/utils.ts | 3 +- .../src/ts-selection-set-processor.ts | 3 +- .../typescript/operations/src/visitor.ts | 7 +- .../operations/tests/ts-documents.spec.ts | 9 ++- 11 files changed, 73 insertions(+), 49 deletions(-) diff --git a/examples/react/apollo-client-defer/src/App.tsx b/examples/react/apollo-client-defer/src/App.tsx index 9dc2e37034b..2a2ebf6bd69 100644 --- a/examples/react/apollo-client-defer/src/App.tsx +++ b/examples/react/apollo-client-defer/src/App.tsx @@ -5,10 +5,10 @@ import { graphql } from './gql/gql'; const alphabetQuery = graphql(/* GraphQL */ ` query SlowAndFastFieldWithDefer { + fastField ... on Query @defer { slowField } - fastField } `); @@ -18,6 +18,9 @@ const Field = ({ field }: { field: string }) => { function App() { const { data } = useQuery(alphabetQuery); + if (data) { + type _x = typeof data; + } return (
{data && ( diff --git a/examples/react/apollo-client-defer/src/gql/gql.ts b/examples/react/apollo-client-defer/src/gql/gql.ts index 3ff1f79bac1..dcb1f0ecc47 100644 --- a/examples/react/apollo-client-defer/src/gql/gql.ts +++ b/examples/react/apollo-client-defer/src/gql/gql.ts @@ -13,7 +13,7 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/ * Therefore it is highly recommended to use the babel or swc plugin for production. */ const documents = { - '\n query SlowAndFastFieldWithDefer {\n ... on Query @defer {\n slowField\n }\n fastField\n }\n': + '\n query SlowAndFastFieldWithDefer {\n fastField\n ... on Query @defer {\n slowField\n }\n }\n': types.SlowAndFastFieldWithDeferDocument, }; @@ -35,8 +35,8 @@ export function graphql(source: string): unknown; * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ export function graphql( - source: '\n query SlowAndFastFieldWithDefer {\n ... on Query @defer {\n slowField\n }\n fastField\n }\n' -): (typeof documents)['\n query SlowAndFastFieldWithDefer {\n ... on Query @defer {\n slowField\n }\n fastField\n }\n']; + source: '\n query SlowAndFastFieldWithDefer {\n fastField\n ... on Query @defer {\n slowField\n }\n }\n' +): (typeof documents)['\n query SlowAndFastFieldWithDefer {\n fastField\n ... on Query @defer {\n slowField\n }\n }\n']; export function graphql(source: string) { return (documents as any)[source] ?? {}; diff --git a/examples/react/apollo-client-defer/src/gql/graphql.ts b/examples/react/apollo-client-defer/src/gql/graphql.ts index 4db4b00b8d7..fff1dd5e3f0 100644 --- a/examples/react/apollo-client-defer/src/gql/graphql.ts +++ b/examples/react/apollo-client-defer/src/gql/graphql.ts @@ -23,7 +23,7 @@ export type Query = { * A field that resolves slowly. * Maybe you want to @defer this field ;) */ - slowField?: Maybe; + slowField: Scalars['String']; }; export type QuerySlowFieldArgs = { @@ -32,7 +32,10 @@ export type QuerySlowFieldArgs = { export type SlowAndFastFieldWithDeferQueryVariables = Exact<{ [key: string]: never }>; -export type SlowAndFastFieldWithDeferQuery = { __typename?: 'Query'; slowField?: string | null; fastField: string }; +export type SlowAndFastFieldWithDeferQuery = ( + | { __typename?: 'Query'; slowField: string } + | { __typename?: never; slowField: never } +) & { __typename?: 'Query'; fastField: string }; export const SlowAndFastFieldWithDeferDocument = { kind: 'Document', @@ -44,6 +47,7 @@ export const SlowAndFastFieldWithDeferDocument = { selectionSet: { kind: 'SelectionSet', selections: [ + { kind: 'Field', name: { kind: 'Name', value: 'fastField' } }, { kind: 'InlineFragment', typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'Query' } }, @@ -53,7 +57,6 @@ export const SlowAndFastFieldWithDeferDocument = { selections: [{ kind: 'Field', name: { kind: 'Name', value: 'slowField' } }], }, }, - { kind: 'Field', name: { kind: 'Name', value: 'fastField' } }, ], }, }, diff --git a/examples/react/apollo-client-defer/src/yoga.mjs b/examples/react/apollo-client-defer/src/yoga.mjs index 7b70293d3b4..ce0a710ca02 100644 --- a/examples/react/apollo-client-defer/src/yoga.mjs +++ b/examples/react/apollo-client-defer/src/yoga.mjs @@ -14,7 +14,7 @@ const typeDefs = /* GraphQL */ ` A field that resolves slowly. Maybe you want to @defer this field ;) """ - slowField(waitFor: Int! = 5000): String + slowField(waitFor: Int! = 5000): String! } `; diff --git a/packages/plugins/other/visitor-plugin-common/src/selection-set-processor/base.ts b/packages/plugins/other/visitor-plugin-common/src/selection-set-processor/base.ts index 728895840ab..1e5e89afc58 100644 --- a/packages/plugins/other/visitor-plugin-common/src/selection-set-processor/base.ts +++ b/packages/plugins/other/visitor-plugin-common/src/selection-set-processor/base.ts @@ -1,7 +1,7 @@ import { GraphQLInterfaceType, GraphQLNamedType, GraphQLObjectType, GraphQLOutputType } from 'graphql'; import { AvoidOptionalsConfig, ConvertNameFn, ScalarsMap } from '../types.js'; -export type PrimitiveField = { isConditional: boolean; isIncremental: boolean; fieldName: string }; +export type PrimitiveField = { isConditional: boolean; fieldName: string }; export type PrimitiveAliasedFields = { alias: string; fieldName: string }; export type LinkField = { alias: string; name: string; type: string; selectionSet: string }; export type NameAndType = { name: string; type: string }; diff --git a/packages/plugins/other/visitor-plugin-common/src/selection-set-processor/pre-resolve-types.ts b/packages/plugins/other/visitor-plugin-common/src/selection-set-processor/pre-resolve-types.ts index 66042b0593a..0cf4075d643 100644 --- a/packages/plugins/other/visitor-plugin-common/src/selection-set-processor/pre-resolve-types.ts +++ b/packages/plugins/other/visitor-plugin-common/src/selection-set-processor/pre-resolve-types.ts @@ -33,7 +33,7 @@ export class PreResolveTypesProcessor extends BaseSelectionSetProcessor; + fragmentDirectives: DirectiveNode[]; }; type CollectedFragmentNode = (SelectionNode | FragmentSpreadUsage | DirectiveNode) & FragmentDirectives; +type GroupedStringifedTypes = Record>; function isMetadataFieldName(name: string) { return ['__schema', '__type'].includes(name); @@ -232,7 +233,7 @@ export class SelectionSetToObject { - const selectionNodesByTypeName: Record = {}; + const selectionNodesByTypeName: Record> = {}; for (const spread of spreads) { const fragmentSpreadObject = this._loadedFragments.find(lf => lf.name === spread.name.value); @@ -254,7 +255,6 @@ export class SelectionSetToObject { return { ...selectionNode, - fragmentDirectives: [...(spread.directives || [])], }; }); @@ -263,6 +263,7 @@ export class SelectionSetToObject; mustAddEmptyObject: boolean } { + protected _buildGroupedSelections(): { grouped: GroupedStringifedTypes; mustAddEmptyObject: boolean } { if (!this._selectionSet?.selections || this._selectionSet.selections.length === 0) { return { grouped: {}, mustAddEmptyObject: true }; } @@ -343,7 +344,7 @@ export class SelectionSetToObject { + const grouped = possibleTypes.reduce((prev, type) => { const typeName = type.name; const schemaType = this._schema.getType(typeName); @@ -355,17 +356,35 @@ export class SelectionSetToObject + 'fragmentDirectives' in node ? node.fragmentDirectives.some(d => d.name.value === 'defer') : false + ); + + const filteredSelectionNodes = selectionNodes.filter( + (node: any) => !node.fragmentDirectives?.some(d => d.name.value === 'defer') + ); + const { fields } = this.buildSelectionSet(schemaType, filteredSelectionNodes); + + const transformedSet = this.selectionSetStringFromFields(fields); if (transformedSet) { prev[typeName].push(transformedSet); } else { mustAddEmptyObject = true; } + for (const deferredNode of deferredNodes) { + const { fields: initialFields } = this.buildSelectionSet(schemaType, [deferredNode]); + const { fields: subsequentFields } = this.buildSelectionSet(schemaType, [deferredNode], { unsetTypes: true }); + + const initialSet = this.selectionSetStringFromFields(initialFields); + const subsequentSet = this.selectionSetStringFromFields(subsequentFields); + + prev[typeName].push({ union: [initialSet, subsequentSet] }); + } + return prev; - }, {} as Record); + }, {}); return { grouped, mustAddEmptyObject }; } @@ -452,7 +471,8 @@ export class SelectionSetToObject + selectionNodes: Array, + options?: { unsetTypes: boolean } ) { const primitiveFields = new Map(); const primitiveAliasFields = new Map(); @@ -557,15 +577,9 @@ export class SelectionSetToObject ({ isConditional: hasConditionalDirectives(field), - isIncremental: hasIncrementalDeliveryDirectives(field), fieldName: field.name.value, })) ), @@ -606,10 +619,13 @@ export class SelectionSetToObject typeof t === 'string') as string[]; - const allObjectsMerged: string[] = transformed - .filter(t => typeof t !== 'string') - .map((t: NameAndType) => `${t.name}: ${t.type}`); + + const allObjectsMerged: string[] = options.unsetTypes + ? transformed.filter(t => typeof t !== 'string').map((t: NameAndType) => `${t.name}: ${t.type}`) + : transformed.filter(t => typeof t !== 'string').map((t: NameAndType) => `${t.name}?: ${this.getUnknownType()}`); + let mergedObjectsAsString: string = null; if (allObjectsMerged.length > 0) { @@ -643,7 +659,6 @@ export class SelectionSetToObject { + if (typeof selectionObject === 'string') return selectionObject; + + return '(' + selectionObject.union.join(' | ') + ')'; + }) + .join(' & '); + + return relevant.length > 1 ? `( ${res} )` : res; }) .filter(Boolean) .join(' | ') + this.getEmptyObjectTypeString(mustAddEmptyObject) diff --git a/packages/plugins/other/visitor-plugin-common/src/utils.ts b/packages/plugins/other/visitor-plugin-common/src/utils.ts index 526fea0025d..60a223f4f51 100644 --- a/packages/plugins/other/visitor-plugin-common/src/utils.ts +++ b/packages/plugins/other/visitor-plugin-common/src/utils.ts @@ -21,6 +21,7 @@ import { SelectionSetNode, StringValueNode, TypeNode, + DirectiveNode, } from 'graphql'; import { RawConfig } from './base-visitor.js'; import { parseMapper } from './mappers.js'; @@ -438,7 +439,7 @@ export function hasConditionalDirectives(field: FieldNode): boolean { return field.directives?.some(directive => CONDITIONAL_DIRECTIVES.includes(directive.name.value)); } -export function hasIncrementalDeliveryDirectives(field: FieldNode & FragmentDirectives): boolean { +export function hasIncrementalDeliveryDirectives(field: { fragmentDirectives?: DirectiveNode[] }): boolean { const INCREMENTAL_DELIVERY_DIRECTIVES = ['defer']; return field.fragmentDirectives?.some(directive => INCREMENTAL_DELIVERY_DIRECTIVES.includes(directive.name.value)); } diff --git a/packages/plugins/typescript/operations/src/ts-selection-set-processor.ts b/packages/plugins/typescript/operations/src/ts-selection-set-processor.ts index dc39ac1fda1..d1d053fd1fa 100644 --- a/packages/plugins/typescript/operations/src/ts-selection-set-processor.ts +++ b/packages/plugins/typescript/operations/src/ts-selection-set-processor.ts @@ -16,7 +16,6 @@ export class TypeScriptSelectionSetProcessor extends BaseSelectionSetProcessor { - if (field.isConditional || field.isIncremental) { + if (field.isConditional) { hasOptional = true; optionalList.push(field.fieldName); } diff --git a/packages/plugins/typescript/operations/src/visitor.ts b/packages/plugins/typescript/operations/src/visitor.ts index 83ce5908373..3a8ed730cbc 100644 --- a/packages/plugins/typescript/operations/src/visitor.ts +++ b/packages/plugins/typescript/operations/src/visitor.ts @@ -66,11 +66,10 @@ export class TypeScriptDocumentsVisitor extends BaseDocumentsVisitor< const formatNamedField = ( name: string, type: GraphQLOutputType | GraphQLNamedType | null, - isConditional = false, - isIncremental = false + isConditional = false ): string => { - const optional = - isConditional || isIncremental || (!this.config.avoidOptionals.field && !!type && !isNonNullType(type)); + const optional = isConditional || (!this.config.avoidOptionals.field && !!type && !isNonNullType(type)); + return (this.config.immutableTypes ? `readonly ${name}` : name) + (optional ? '?' : ''); }; diff --git a/packages/plugins/typescript/operations/tests/ts-documents.spec.ts b/packages/plugins/typescript/operations/tests/ts-documents.spec.ts index b9b8016f03d..498ecefc4e1 100644 --- a/packages/plugins/typescript/operations/tests/ts-documents.spec.ts +++ b/packages/plugins/typescript/operations/tests/ts-documents.spec.ts @@ -6435,7 +6435,7 @@ function test(q: GetEntityBrandDataQuery): void { }); describe('incremental delivery directive handling', () => { - it('should mark fields in deferred fragments as optional (preResolveTypes: true)', async () => { + it.only('should mark fields in deferred fragments as optional (preResolveTypes: true)', async () => { const schema = buildSchema(` type Address { street1: String! @@ -6524,6 +6524,7 @@ function test(q: GetEntityBrandDataQuery): void { { outputFile: 'graphql.ts' } ); + // todo expect(content).toBeSimilarStringTo(` export type UserQueryVariables = Exact<{ [key: string]: never; }>; export type UserQuery = { @@ -6533,10 +6534,6 @@ function test(q: GetEntityBrandDataQuery): void { email?: string, clearanceLevel: string, name: string, - widgetCount?: number, - widgetPreference?: string, - favoriteFood?: string, - leastFavoriteFood?: string, address?: { __typename?: 'Address', street1: string @@ -6550,6 +6547,8 @@ function test(q: GetEntityBrandDataQuery): void { title: string } } + & ({ widgetCount?: never; widgetPreference?: never; } | { widgetCoun: number; widgetPreference: string; }) + & ({ favoriteFood?: never; leastFavoriteFood?: never; } | { favoriteFood: number; leastFavoriteFood: string; }) }; `); }); From b5443b1e3c4ce12da3029e7e705821ee48320fee Mon Sep 17 00:00:00 2001 From: beerose Date: Mon, 20 Mar 2023 17:15:44 +0100 Subject: [PATCH 04/47] Update cypress version in example --- .../react/apollo-client-defer/package.json | 2 +- yarn.lock | 48 ------------------- 2 files changed, 1 insertion(+), 49 deletions(-) diff --git a/examples/react/apollo-client-defer/package.json b/examples/react/apollo-client-defer/package.json index 919f77716c7..fb922c99d56 100644 --- a/examples/react/apollo-client-defer/package.json +++ b/examples/react/apollo-client-defer/package.json @@ -18,7 +18,7 @@ "@types/react": "^18.0.15", "@types/react-dom": "^18.0.10", "@vitejs/plugin-react": "^3.1.0", - "cypress": "12.6.0", + "cypress": "12.8.1", "serve": "14.2.0", "start-server-and-test": "2.0.0", "typescript": "4.9.5", diff --git a/yarn.lock b/yarn.lock index 407e948cb2a..6a6d0add1c2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5968,54 +5968,6 @@ csv@^5.5.0: csv-stringify "^5.6.5" stream-transform "^2.1.3" -cypress@12.6.0: - version "12.6.0" - resolved "https://registry.yarnpkg.com/cypress/-/cypress-12.6.0.tgz#d71a82639756173c0682b3d467eb9f0523460e91" - integrity sha512-WdHSVaS1lumSd5XpVTslZd8ui9GIGphrzvXq9+3DtVhqjRZC5M70gu5SW/Y/SLPq3D1wiXGZoHC6HJ7ESVE2lw== - dependencies: - "@cypress/request" "^2.88.10" - "@cypress/xvfb" "^1.2.4" - "@types/node" "^14.14.31" - "@types/sinonjs__fake-timers" "8.1.1" - "@types/sizzle" "^2.3.2" - arch "^2.2.0" - blob-util "^2.0.2" - bluebird "^3.7.2" - buffer "^5.6.0" - cachedir "^2.3.0" - chalk "^4.1.0" - check-more-types "^2.24.0" - cli-cursor "^3.1.0" - cli-table3 "~0.6.1" - commander "^5.1.0" - common-tags "^1.8.0" - dayjs "^1.10.4" - debug "^4.3.4" - enquirer "^2.3.6" - eventemitter2 "6.4.7" - execa "4.1.0" - executable "^4.1.1" - extract-zip "2.0.1" - figures "^3.2.0" - fs-extra "^9.1.0" - getos "^3.2.1" - is-ci "^3.0.0" - is-installed-globally "~0.4.0" - lazy-ass "^1.6.0" - listr2 "^3.8.3" - lodash "^4.17.21" - log-symbols "^4.0.0" - minimist "^1.2.6" - ospath "^1.2.2" - pretty-bytes "^5.6.0" - proxy-from-env "1.0.0" - request-progress "^3.0.0" - semver "^7.3.2" - supports-color "^8.1.1" - tmp "~0.2.1" - untildify "^4.0.0" - yauzl "^2.10.0" - cypress@12.8.1: version "12.8.1" resolved "https://registry.yarnpkg.com/cypress/-/cypress-12.8.1.tgz#0c6e67f34554d553138697aaf349b637d80004eb" From 162269dfcd35be714103b2a63469fb0254e82832 Mon Sep 17 00:00:00 2001 From: beerose Date: Mon, 20 Mar 2023 17:39:45 +0100 Subject: [PATCH 05/47] Fix ternary order --- examples/react/apollo-client-defer/src/App.tsx | 3 --- examples/react/apollo-client-defer/src/gql/graphql.ts | 6 +++--- .../src/selection-set-to-object.ts | 10 +++++++--- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/examples/react/apollo-client-defer/src/App.tsx b/examples/react/apollo-client-defer/src/App.tsx index 2a2ebf6bd69..2d72d6d2423 100644 --- a/examples/react/apollo-client-defer/src/App.tsx +++ b/examples/react/apollo-client-defer/src/App.tsx @@ -18,9 +18,6 @@ const Field = ({ field }: { field: string }) => { function App() { const { data } = useQuery(alphabetQuery); - if (data) { - type _x = typeof data; - } return (
{data && ( diff --git a/examples/react/apollo-client-defer/src/gql/graphql.ts b/examples/react/apollo-client-defer/src/gql/graphql.ts index fff1dd5e3f0..37206165e99 100644 --- a/examples/react/apollo-client-defer/src/gql/graphql.ts +++ b/examples/react/apollo-client-defer/src/gql/graphql.ts @@ -32,10 +32,10 @@ export type QuerySlowFieldArgs = { export type SlowAndFastFieldWithDeferQueryVariables = Exact<{ [key: string]: never }>; -export type SlowAndFastFieldWithDeferQuery = ( +export type SlowAndFastFieldWithDeferQuery = { __typename?: 'Query'; fastField: string } & ( | { __typename?: 'Query'; slowField: string } - | { __typename?: never; slowField: never } -) & { __typename?: 'Query'; fastField: string }; + | { __typename?: never; slowField?: never } +); export const SlowAndFastFieldWithDeferDocument = { kind: 'Document', diff --git a/packages/plugins/other/visitor-plugin-common/src/selection-set-to-object.ts b/packages/plugins/other/visitor-plugin-common/src/selection-set-to-object.ts index b8f9bfc95f5..08cd686ed2f 100644 --- a/packages/plugins/other/visitor-plugin-common/src/selection-set-to-object.ts +++ b/packages/plugins/other/visitor-plugin-common/src/selection-set-to-object.ts @@ -474,6 +474,8 @@ export class SelectionSetToObject, options?: { unsetTypes: boolean } ) { + // const x = options + // why is it narrowed to { unsetTypes: boolean } const primitiveFields = new Map(); const primitiveAliasFields = new Map(); const linkFieldSelectionSets = new Map< @@ -622,9 +624,11 @@ export class SelectionSetToObject typeof t === 'string') as string[]; - const allObjectsMerged: string[] = options.unsetTypes - ? transformed.filter(t => typeof t !== 'string').map((t: NameAndType) => `${t.name}: ${t.type}`) - : transformed.filter(t => typeof t !== 'string').map((t: NameAndType) => `${t.name}?: ${this.getUnknownType()}`); + const allObjectsMerged: string[] = options?.unsetTypes + ? transformed + .filter(t => typeof t !== 'string') + .map((t: NameAndType) => `${t.name}${t.name.endsWith('?') ? '' : '?'}: ${this.getUnknownType()}`) + : transformed.filter(t => typeof t !== 'string').map((t: NameAndType) => `${t.name}: ${t.type}`); let mergedObjectsAsString: string = null; From 65694a5f3eb22ed559984a6484a165050274cb0f Mon Sep 17 00:00:00 2001 From: beerose Date: Mon, 20 Mar 2023 18:00:44 +0100 Subject: [PATCH 06/47] Refactor code a bit --- .../src/selection-set-to-object.ts | 45 ++++++++++--------- .../other/visitor-plugin-common/src/utils.ts | 4 +- .../src/ts-selection-set-processor.ts | 13 +++--- .../typescript/operations/src/visitor.ts | 1 - 4 files changed, 33 insertions(+), 30 deletions(-) diff --git a/packages/plugins/other/visitor-plugin-common/src/selection-set-to-object.ts b/packages/plugins/other/visitor-plugin-common/src/selection-set-to-object.ts index 08cd686ed2f..3c86b3e4559 100644 --- a/packages/plugins/other/visitor-plugin-common/src/selection-set-to-object.ts +++ b/packages/plugins/other/visitor-plugin-common/src/selection-set-to-object.ts @@ -46,6 +46,7 @@ import { getFieldNodeNameValue, getPossibleTypes, hasConditionalDirectives, + hasIncrementalDeliveryDirectives, mergeSelectionSets, separateSelectionSet, } from './utils.js'; @@ -55,7 +56,7 @@ type FragmentSpreadUsage = { typeName: string; onType: string; selectionNodes: Array; - fragmentDirectives: DirectiveNode[]; + fragmentDirectives?: DirectiveNode[]; }; type CollectedFragmentNode = (SelectionNode | FragmentSpreadUsage | DirectiveNode) & FragmentDirectives; @@ -233,7 +234,7 @@ export class SelectionSetToObject { - const selectionNodesByTypeName: Record> = {}; + const selectionNodesByTypeName: Record = {}; for (const spread of spreads) { const fragmentSpreadObject = this._loadedFragments.find(lf => lf.name === spread.name.value); @@ -252,18 +253,11 @@ export class SelectionSetToObject { - return { - ...selectionNode, - }; - }); - selectionNodesByTypeName[possibleType.name].push({ fragmentName: spread.name.value, typeName: usage, onType: fragmentSpreadObject.onType, - selectionNodes, - fragmentDirectives: [...(spread.directives || [])], + selectionNodes: [...fragmentSpreadObject.node.selectionSet.selections], }); } } @@ -352,19 +346,26 @@ export class SelectionSetToObject - 'fragmentDirectives' in node ? node.fragmentDirectives.some(d => d.name.value === 'defer') : false - ); - - const filteredSelectionNodes = selectionNodes.filter( - (node: any) => !node.fragmentDirectives?.some(d => d.name.value === 'defer') + const { incrementalNodes, selectionNodes } = allNodes.reduce<{ + selectionNodes: (SelectionNode | FragmentSpreadUsage)[]; + incrementalNodes: FragmentSpreadUsage[]; + }>( + (acc, node) => { + if ('fragmentDirectives' in node && hasIncrementalDeliveryDirectives(node.fragmentDirectives)) { + acc.incrementalNodes.push(node); + } else { + acc.selectionNodes.push(node); + } + return acc; + }, + { selectionNodes: [], incrementalNodes: [] } ); - const { fields } = this.buildSelectionSet(schemaType, filteredSelectionNodes); + const { fields } = this.buildSelectionSet(schemaType, selectionNodes); const transformedSet = this.selectionSetStringFromFields(fields); if (transformedSet) { @@ -373,9 +374,11 @@ export class SelectionSetToObject CONDITIONAL_DIRECTIVES.includes(directive.name.value)); } -export function hasIncrementalDeliveryDirectives(field: { fragmentDirectives?: DirectiveNode[] }): boolean { +export function hasIncrementalDeliveryDirectives(directives: DirectiveNode[]): boolean { const INCREMENTAL_DELIVERY_DIRECTIVES = ['defer']; - return field.fragmentDirectives?.some(directive => INCREMENTAL_DELIVERY_DIRECTIVES.includes(directive.name.value)); + return directives?.some(directive => INCREMENTAL_DELIVERY_DIRECTIVES.includes(directive.name.value)); } type WrapModifiersOptions = { diff --git a/packages/plugins/typescript/operations/src/ts-selection-set-processor.ts b/packages/plugins/typescript/operations/src/ts-selection-set-processor.ts index d1d053fd1fa..254c336162f 100644 --- a/packages/plugins/typescript/operations/src/ts-selection-set-processor.ts +++ b/packages/plugins/typescript/operations/src/ts-selection-set-processor.ts @@ -16,25 +16,26 @@ export class TypeScriptSelectionSetProcessor extends BaseSelectionSetProcessor { if (field.isConditional) { - hasOptional = true; - optionalList.push(field.fieldName); + hasConditionals = true; + conditilnalsList.push(field.fieldName); } return `'${field.fieldName}'`; }) .join(' | ')}>`; - if (hasOptional) { + if (hasConditionals) { const avoidOptional = // TODO: check type and exec only if relevant this.config.avoidOptionals === true || @@ -46,7 +47,7 @@ export class TypeScriptSelectionSetProcessor extends BaseSelectionSetProcessor `'${field}'`).join(' | ')}>`; + }${transform}<${resString}, ${conditilnalsList.map(field => `'${field}'`).join(' | ')}>`; } return [resString]; } diff --git a/packages/plugins/typescript/operations/src/visitor.ts b/packages/plugins/typescript/operations/src/visitor.ts index 3a8ed730cbc..c07b2d5736c 100644 --- a/packages/plugins/typescript/operations/src/visitor.ts +++ b/packages/plugins/typescript/operations/src/visitor.ts @@ -69,7 +69,6 @@ export class TypeScriptDocumentsVisitor extends BaseDocumentsVisitor< isConditional = false ): string => { const optional = isConditional || (!this.config.avoidOptionals.field && !!type && !isNonNullType(type)); - return (this.config.immutableTypes ? `readonly ${name}` : name) + (optional ? '?' : ''); }; From 0d8a6b9edc03cea17ee3019874d14344dc5a06a1 Mon Sep 17 00:00:00 2001 From: beerose Date: Mon, 20 Mar 2023 19:07:36 +0100 Subject: [PATCH 07/47] Update tests --- .../react/apollo-client-defer/package.json | 2 +- .../src/selection-set-to-object.ts | 4 +- .../operations/tests/ts-documents.spec.ts | 72 ++++++++----------- 3 files changed, 33 insertions(+), 45 deletions(-) diff --git a/examples/react/apollo-client-defer/package.json b/examples/react/apollo-client-defer/package.json index fb922c99d56..771f3e5bb94 100644 --- a/examples/react/apollo-client-defer/package.json +++ b/examples/react/apollo-client-defer/package.json @@ -4,6 +4,7 @@ "private": true, "dependencies": { "@apollo/client": "^3.7.10", + "@graphql-yoga/plugin-defer-stream": "^1.7.3", "graphql": "^16.6.0", "react": "^18.2.0", "react-dom": "^18.2.0", @@ -12,7 +13,6 @@ "devDependencies": { "@graphql-codegen/cli": "^3.2.2", "@graphql-codegen/client-preset": "^2.1.1", - "@graphql-yoga/plugin-defer-stream": "^1.7.3", "@types/jest": "^27.5.2", "@types/node": "^18.11.18", "@types/react": "^18.0.15", diff --git a/packages/plugins/other/visitor-plugin-common/src/selection-set-to-object.ts b/packages/plugins/other/visitor-plugin-common/src/selection-set-to-object.ts index 3c86b3e4559..801498bcae5 100644 --- a/packages/plugins/other/visitor-plugin-common/src/selection-set-to-object.ts +++ b/packages/plugins/other/visitor-plugin-common/src/selection-set-to-object.ts @@ -258,6 +258,7 @@ export class SelectionSetToObject { + const hasUnions = grouped[typeName].filter(s => typeof s !== 'string' && s.union).length > 0; const relevant = grouped[typeName].filter(Boolean); if (relevant.length === 0) { @@ -714,7 +716,7 @@ export class SelectionSetToObject 1 ? `( ${res} )` : res; + return relevant.length > 1 && !hasUnions ? `( ${res} )` : res; }) .filter(Boolean) .join(' | ') + this.getEmptyObjectTypeString(mustAddEmptyObject) diff --git a/packages/plugins/typescript/operations/tests/ts-documents.spec.ts b/packages/plugins/typescript/operations/tests/ts-documents.spec.ts index 498ecefc4e1..c8c6ea3564b 100644 --- a/packages/plugins/typescript/operations/tests/ts-documents.spec.ts +++ b/packages/plugins/typescript/operations/tests/ts-documents.spec.ts @@ -6435,7 +6435,7 @@ function test(q: GetEntityBrandDataQuery): void { }); describe('incremental delivery directive handling', () => { - it.only('should mark fields in deferred fragments as optional (preResolveTypes: true)', async () => { + it('should mark fields in deferred fragments as optional (preResolveTypes: true)', async () => { const schema = buildSchema(` type Address { street1: String! @@ -6524,20 +6524,14 @@ function test(q: GetEntityBrandDataQuery): void { { outputFile: 'graphql.ts' } ); - // todo expect(content).toBeSimilarStringTo(` export type UserQueryVariables = Exact<{ [key: string]: never; }>; export type UserQuery = { __typename?: 'Query', user: { __typename?: 'User', - email?: string, clearanceLevel: string, name: string, - address?: { - __typename?: 'Address', - street1: string - }, phone: { __typename?: 'Phone', home: string @@ -6546,10 +6540,14 @@ function test(q: GetEntityBrandDataQuery): void { __typename?: 'Employment', title: string } - } - & ({ widgetCount?: never; widgetPreference?: never; } | { widgetCoun: number; widgetPreference: string; }) - & ({ favoriteFood?: never; leastFavoriteFood?: never; } | { favoriteFood: number; leastFavoriteFood: string; }) - }; + } & ({ __typename?: 'User', email: string } + | { __typename?: never, email?: never }) + & ({ __typename?: 'User', address: { __typename?: 'Address', street1: string } } + | { __typename?: never, address?: never }) + & ({ __typename?: 'User', widgetCount: number, widgetPreference: string } + | { __typename?: never, widgetCount?: never, widgetPreference?: never }) + & ({ __typename?: 'User', favoriteFood: string, leastFavoriteFood: string } + | { __typename?: never, favoriteFood?: never, leastFavoriteFood?: never }) }; `); }); @@ -6868,24 +6866,17 @@ function test(q: GetEntityBrandDataQuery): void { __typename?: 'Query', user: { __typename?: 'User', - email?: string, clearanceLevel: string, name: string, - widgetCount?: number, - address?: { - __typename?: 'Address', - street1: string - }, - phone: { - __typename?: 'Phone', - home: string - }, - employment: { - __typename?: 'Employment', - title: string - } - } - }; + phone: { __typename?: 'Phone', home: string }, + employment: { __typename?: 'Employment', title: string } + } & ({ __typename?: 'User', email: string } + | { __typename?: never, email?: never }) + & ({ __typename?: 'User', address: { __typename?: 'Address', street1: string } } + | { __typename?: never, address?: never }) + & ({ __typename?: 'User', widgetCount: number } + | { __typename?: never, widgetCount?: never }) + }; `); }); @@ -6909,6 +6900,7 @@ function test(q: GetEntityBrandDataQuery): void { address: Address! phone: Phone! employment: Employment! + widgetName: String! widgetCount: Int! clearanceLevel: String! } @@ -6920,6 +6912,7 @@ function test(q: GetEntityBrandDataQuery): void { const fragment = parse(` fragment WidgetFragment on User { + widgetName widgetCount } @@ -6976,24 +6969,17 @@ function test(q: GetEntityBrandDataQuery): void { __typename?: 'Query', user: { __typename?: 'User', - email?: string, clearanceLevel: string, name: string, - widgetCount?: number, - address?: { - __typename?: 'Address', - street1: string | 'specialType' - }, - phone: { - __typename?: 'Phone', - home: string - }, - employment: { - __typename?: 'Employment', - title: string - } - } - }; + phone: { __typename?: 'Phone', home: string }, + employment: { __typename?: 'Employment', title: string } + } & ({ __typename?: 'User', email: string } + | { __typename?: never, email?: never }) + & ({ __typename?: 'User', address: { __typename?: 'Address', street1: string | 'specialType' } } + | { __typename?: never, address?: never }) + & ({ __typename?: 'User', widgetName: string, widgetCount: number } + | { __typename?: never, widgetName?: never, widgetCount?: never }) + }; `); }); }); From 982c5113ea15afe17dccd2c659877992d5256dfc Mon Sep 17 00:00:00 2001 From: beerose Date: Mon, 20 Mar 2023 19:30:41 +0100 Subject: [PATCH 08/47] Fix handling __typename --- .../src/selection-set-to-object.ts | 16 ++++++++------- .../operations/tests/ts-documents.spec.ts | 20 +++++++++---------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/packages/plugins/other/visitor-plugin-common/src/selection-set-to-object.ts b/packages/plugins/other/visitor-plugin-common/src/selection-set-to-object.ts index 801498bcae5..d43a5d5c7b9 100644 --- a/packages/plugins/other/visitor-plugin-common/src/selection-set-to-object.ts +++ b/packages/plugins/other/visitor-plugin-common/src/selection-set-to-object.ts @@ -478,8 +478,6 @@ export class SelectionSetToObject, options?: { unsetTypes: boolean } ) { - // const x = options - // why is it narrowed to { unsetTypes: boolean } const primitiveFields = new Map(); const primitiveAliasFields = new Map(); const linkFieldSelectionSets = new Map< @@ -628,11 +626,15 @@ export class SelectionSetToObject typeof t === 'string') as string[]; - const allObjectsMerged: string[] = options?.unsetTypes - ? transformed - .filter(t => typeof t !== 'string') - .map((t: NameAndType) => `${t.name}${t.name.endsWith('?') ? '' : '?'}: ${this.getUnknownType()}`) - : transformed.filter(t => typeof t !== 'string').map((t: NameAndType) => `${t.name}: ${t.type}`); + const allObjectsMerged: string[] = transformed + .filter(t => typeof t !== 'string') + .map(t => { + const { name, type } = t as NameAndType; + if (options?.unsetTypes && !name.startsWith('__typename')) { + return `${name}?: ${this.getUnknownType()}`; + } + return `${name}: ${type}`; + }); let mergedObjectsAsString: string = null; diff --git a/packages/plugins/typescript/operations/tests/ts-documents.spec.ts b/packages/plugins/typescript/operations/tests/ts-documents.spec.ts index c8c6ea3564b..db4e977ae01 100644 --- a/packages/plugins/typescript/operations/tests/ts-documents.spec.ts +++ b/packages/plugins/typescript/operations/tests/ts-documents.spec.ts @@ -6541,13 +6541,13 @@ function test(q: GetEntityBrandDataQuery): void { title: string } } & ({ __typename?: 'User', email: string } - | { __typename?: never, email?: never }) + | { __typename?: 'User', email?: never }) & ({ __typename?: 'User', address: { __typename?: 'Address', street1: string } } - | { __typename?: never, address?: never }) + | { __typename?: 'User', address?: never }) & ({ __typename?: 'User', widgetCount: number, widgetPreference: string } - | { __typename?: never, widgetCount?: never, widgetPreference?: never }) + | { __typename?: 'User', widgetCount?: never, widgetPreference?: never }) & ({ __typename?: 'User', favoriteFood: string, leastFavoriteFood: string } - | { __typename?: never, favoriteFood?: never, leastFavoriteFood?: never }) }; + | { __typename?: 'User', favoriteFood?: never, leastFavoriteFood?: never }) }; `); }); @@ -6871,11 +6871,11 @@ function test(q: GetEntityBrandDataQuery): void { phone: { __typename?: 'Phone', home: string }, employment: { __typename?: 'Employment', title: string } } & ({ __typename?: 'User', email: string } - | { __typename?: never, email?: never }) + | { __typename?: 'User', email?: never }) & ({ __typename?: 'User', address: { __typename?: 'Address', street1: string } } - | { __typename?: never, address?: never }) + | { __typename?: 'User', address?: never }) & ({ __typename?: 'User', widgetCount: number } - | { __typename?: never, widgetCount?: never }) + | { __typename?: 'User', widgetCount?: never }) }; `); }); @@ -6974,11 +6974,11 @@ function test(q: GetEntityBrandDataQuery): void { phone: { __typename?: 'Phone', home: string }, employment: { __typename?: 'Employment', title: string } } & ({ __typename?: 'User', email: string } - | { __typename?: never, email?: never }) + | { __typename?: 'User', email?: never }) & ({ __typename?: 'User', address: { __typename?: 'Address', street1: string | 'specialType' } } - | { __typename?: never, address?: never }) + | { __typename?: 'User', address?: never }) & ({ __typename?: 'User', widgetName: string, widgetCount: number } - | { __typename?: never, widgetName?: never, widgetCount?: never }) + | { __typename?: 'User', widgetName?: never, widgetCount?: never }) }; `); }); From 0ccb06b0a843dd2b9151857e0ccd3a606c50f8f7 Mon Sep 17 00:00:00 2001 From: beerose Date: Mon, 20 Mar 2023 22:32:11 +0100 Subject: [PATCH 09/47] Support avoidOptionals: true --- .../src/selection-set-processor/base.ts | 10 +-- .../pre-resolve-types.ts | 41 ++++++++--- .../src/selection-set-to-object.ts | 20 +++--- .../src/ts-selection-set-processor.ts | 8 ++- .../typescript/operations/src/visitor.ts | 6 +- .../operations/tests/ts-documents.spec.ts | 70 +++++++++++++++---- 6 files changed, 112 insertions(+), 43 deletions(-) diff --git a/packages/plugins/other/visitor-plugin-common/src/selection-set-processor/base.ts b/packages/plugins/other/visitor-plugin-common/src/selection-set-processor/base.ts index 1e5e89afc58..7441b5cdbfc 100644 --- a/packages/plugins/other/visitor-plugin-common/src/selection-set-processor/base.ts +++ b/packages/plugins/other/visitor-plugin-common/src/selection-set-processor/base.ts @@ -16,7 +16,7 @@ export type SelectionSetProcessorConfig = { name: string, type?: GraphQLOutputType | GraphQLNamedType | null, isConditional?: boolean, - isIncremental?: boolean + isOptional?: boolean ): string; wrapTypeWithModifiers(baseType: string, type: GraphQLOutputType | GraphQLNamedType): string; avoidOptionals?: AvoidOptionalsConfig | boolean; @@ -41,7 +41,8 @@ export class BaseSelectionSetProcessor { + const x = fields.map(field => { const fieldObj = schemaType.getFields()[field.fieldName]; const baseType = getBaseType(fieldObj.type); @@ -36,6 +37,20 @@ export class PreResolveTypesProcessor extends BaseSelectionSetProcessor ({ name: field.alias || field.name, - type: field.selectionSet, + type: unsetTypes ? 'never' : field.selectionSet, })); } } diff --git a/packages/plugins/other/visitor-plugin-common/src/selection-set-to-object.ts b/packages/plugins/other/visitor-plugin-common/src/selection-set-to-object.ts index d43a5d5c7b9..d57509b6f45 100644 --- a/packages/plugins/other/visitor-plugin-common/src/selection-set-to-object.ts +++ b/packages/plugins/other/visitor-plugin-common/src/selection-set-to-object.ts @@ -581,9 +581,10 @@ export class SelectionSetToObject ({ isConditional: hasConditionalDirectives(field), fieldName: field.name.value, - })) + })), + options?.unsetTypes ), ...this._processor.transformAliasesPrimitiveFields( parentSchemaType, Array.from(primitiveAliasFields.values()).map(field => ({ alias: field.alias.value, fieldName: field.name.value, - })) + })), + options?.unsetTypes ), - ...this._processor.transformLinkFields(linkFields), + ...this._processor.transformLinkFields(linkFields, options?.unsetTypes), ].filter(Boolean); - // TODO: This needs TESTS! const allStrings: string[] = transformed.filter(t => typeof t === 'string') as string[]; const allObjectsMerged: string[] = transformed .filter(t => typeof t !== 'string') - .map(t => { - const { name, type } = t as NameAndType; - if (options?.unsetTypes && !name.startsWith('__typename')) { - return `${name}?: ${this.getUnknownType()}`; - } - return `${name}: ${type}`; - }); + .map((t: NameAndType) => `${t.name}: ${t.type}`); let mergedObjectsAsString: string = null; diff --git a/packages/plugins/typescript/operations/src/ts-selection-set-processor.ts b/packages/plugins/typescript/operations/src/ts-selection-set-processor.ts index 254c336162f..4f6a345f8d8 100644 --- a/packages/plugins/typescript/operations/src/ts-selection-set-processor.ts +++ b/packages/plugins/typescript/operations/src/ts-selection-set-processor.ts @@ -11,7 +11,8 @@ import { GraphQLInterfaceType, GraphQLObjectType } from 'graphql'; export class TypeScriptSelectionSetProcessor extends BaseSelectionSetProcessor { transformPrimitiveFields( schemaType: GraphQLObjectType | GraphQLInterfaceType, - fields: PrimitiveField[] + fields: PrimitiveField[], + unsetTypes?: boolean ): ProcessResult { if (fields.length === 0) { return []; @@ -23,6 +24,11 @@ export class TypeScriptSelectionSetProcessor extends BaseSelectionSetProcessor `'${field.fieldName}'`).join(' | ')}>`]; + } + let hasConditionals = false; const conditilnalsList: string[] = []; let resString = `Pick<${parentName}, ${fields diff --git a/packages/plugins/typescript/operations/src/visitor.ts b/packages/plugins/typescript/operations/src/visitor.ts index c07b2d5736c..f71a5144f20 100644 --- a/packages/plugins/typescript/operations/src/visitor.ts +++ b/packages/plugins/typescript/operations/src/visitor.ts @@ -66,9 +66,11 @@ export class TypeScriptDocumentsVisitor extends BaseDocumentsVisitor< const formatNamedField = ( name: string, type: GraphQLOutputType | GraphQLNamedType | null, - isConditional = false + isConditional = false, + isOptional = false ): string => { - const optional = isConditional || (!this.config.avoidOptionals.field && !!type && !isNonNullType(type)); + const optional = + isOptional || isConditional || (!this.config.avoidOptionals.field && !!type && !isNonNullType(type)); return (this.config.immutableTypes ? `readonly ${name}` : name) + (optional ? '?' : ''); }; diff --git a/packages/plugins/typescript/operations/tests/ts-documents.spec.ts b/packages/plugins/typescript/operations/tests/ts-documents.spec.ts index db4e977ae01..75212c56544 100644 --- a/packages/plugins/typescript/operations/tests/ts-documents.spec.ts +++ b/packages/plugins/typescript/operations/tests/ts-documents.spec.ts @@ -6648,18 +6648,39 @@ function test(q: GetEntityBrandDataQuery): void { { __typename?: 'Query' } & { user: ( { __typename?: 'User' } - & MakeOptional, 'email' | 'widgetCount'> - & { address?: ( - { __typename?: 'Address' } - & Pick - ), phone: ( + & Pick + & { phone: ( { __typename?: 'Phone' } & Pick ), employment: ( { __typename?: 'Employment' } & Pick ) } - ) } + ) & (( + { __typename?: 'User' } + & Pick + ) | ( + { __typename?: 'User' } + & Empty + )) & (( + { __typename?: 'User' } + & { address: ( + { __typename?: 'Address' } + & Pick + ) } + ) | ( + { __typename?: 'User' } + & { address?: ( + { __typename?: 'Address' } + & Pick + ) } + )) & (( + { __typename?: 'User' } + & Pick + ) | ( + { __typename?: 'User' } + & Empty + )) } ); `); }); @@ -6684,6 +6705,7 @@ function test(q: GetEntityBrandDataQuery): void { address: Address! phone: Phone! employment: Employment! + widgetName: String! widgetCount: Int! clearanceLevel: String! } @@ -6695,6 +6717,7 @@ function test(q: GetEntityBrandDataQuery): void { const fragment = parse(` fragment WidgetFragment on User { + widgetName widgetCount } @@ -6747,7 +6770,7 @@ function test(q: GetEntityBrandDataQuery): void { expect(content).toBeSimilarStringTo(` export type WidgetFragmentFragment = ( { __typename?: 'User' } - & Pick + & Pick ); export type EmploymentFragmentFragment = ( @@ -6764,18 +6787,39 @@ function test(q: GetEntityBrandDataQuery): void { { __typename?: 'Query' } & { user: ( { __typename?: 'User' } - & MakeMaybe, 'email' | 'widgetCount'> - & { address?: ( - { __typename?: 'Address' } - & Pick - ), phone: ( + & Pick + & { phone: ( { __typename?: 'Phone' } & Pick ), employment: ( { __typename?: 'Employment' } & Pick ) } - ) } + ) & (( + { __typename?: 'User' } + & Pick + ) | ( + { __typename?: 'User' } + & Empty + )) & (( + { __typename?: 'User' } + & { address: ( + { __typename?: 'Address' } + & Pick + ) } + ) | ( + { __typename?: 'User' } + & { address?: ( + { __typename?: 'Address' } + & Pick + ) } + )) & (( + { __typename?: 'User' } + & Pick + ) | ( + { __typename?: 'User' } + & Empty + )) } ); `); }); From 969e979d30a57e9bb7bce4e1ce8560b6e5b7b12b Mon Sep 17 00:00:00 2001 From: beerose Date: Mon, 20 Mar 2023 22:34:24 +0100 Subject: [PATCH 10/47] Update example --- examples/react/apollo-client-defer/src/gql/graphql.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/react/apollo-client-defer/src/gql/graphql.ts b/examples/react/apollo-client-defer/src/gql/graphql.ts index 37206165e99..82f09421368 100644 --- a/examples/react/apollo-client-defer/src/gql/graphql.ts +++ b/examples/react/apollo-client-defer/src/gql/graphql.ts @@ -34,7 +34,7 @@ export type SlowAndFastFieldWithDeferQueryVariables = Exact<{ [key: string]: nev export type SlowAndFastFieldWithDeferQuery = { __typename?: 'Query'; fastField: string } & ( | { __typename?: 'Query'; slowField: string } - | { __typename?: never; slowField?: never } + | { __typename?: 'Query'; slowField?: never } ); export const SlowAndFastFieldWithDeferDocument = { From 9e225d39d3da60f242bdd3f3183f81f692b9482b Mon Sep 17 00:00:00 2001 From: beerose Date: Tue, 21 Mar 2023 18:11:36 +0100 Subject: [PATCH 11/47] Add MakeEmpty type --- dev-test/githunt/typed-document-nodes.ts | 1 + dev-test/githunt/types.avoidOptionals.ts | 1 + dev-test/githunt/types.d.ts | 1 + dev-test/githunt/types.enumsAsTypes.ts | 1 + .../githunt/types.flatten.preResolveTypes.ts | 1 + dev-test/githunt/types.immutableTypes.ts | 1 + ...ypes.preResolveTypes.onlyOperationTypes.ts | 1 + dev-test/githunt/types.preResolveTypes.ts | 1 + dev-test/githunt/types.ts | 1 + .../gql/graphql.ts | 1 + .../gql-tag-operations-masking/gql/graphql.ts | 1 + .../gql-tag-operations-urql/gql/graphql.ts | 1 + dev-test/gql-tag-operations/gql/graphql.ts | 1 + .../gql-tag-operations/graphql/graphql.ts | 1 + dev-test/modules/types.ts | 1 + dev-test/star-wars/types.avoidOptionals.ts | 1 + dev-test/star-wars/types.d.ts | 1 + .../star-wars/types.globallyAvailable.d.ts | 1 + dev-test/star-wars/types.immutableTypes.ts | 1 + ...ypes.preResolveTypes.onlyOperationTypes.ts | 1 + dev-test/star-wars/types.preResolveTypes.ts | 1 + dev-test/star-wars/types.skipSchema.ts | 1 + dev-test/star-wars/types.ts | 1 + dev-test/test-schema/env.types.ts | 1 + dev-test/test-schema/resolvers-federation.ts | 1 + dev-test/test-schema/resolvers-root.ts | 1 + dev-test/test-schema/resolvers-stitching.ts | 1 + dev-test/test-schema/resolvers-types.ts | 1 + ...ypes.preResolveTypes.onlyOperationTypes.ts | 1 + dev-test/test-schema/types.preResolveTypes.ts | 1 + .../test-schema/typings.avoidOptionals.ts | 1 + dev-test/test-schema/typings.enum.ts | 1 + .../test-schema/typings.immutableTypes.ts | 1 + dev-test/test-schema/typings.ts | 1 + dev-test/test-schema/typings.wrapped.ts | 1 + .../src/gql/graphql.ts | 1 + .../persisted-documents/src/gql/graphql.ts | 1 + .../src/gql/fragment-masking.ts | 42 ++++++++-------- .../apollo-client-defer/src/gql/graphql.ts | 1 + .../src/gql/graphql.ts | 1 + .../react/apollo-client/src/gql/graphql.ts | 1 + .../react/http-executor/src/gql/graphql.ts | 1 + examples/react/nextjs-swr/gql/graphql.ts | 1 + .../tanstack-react-query/src/gql/graphql.ts | 1 + examples/react/urql/src/gql/graphql.ts | 1 + examples/typescript-esm/src/gql/graphql.ts | 1 + .../src/gql/graphql.ts | 1 + .../typescript-resolvers/src/type-defs.d.ts | 1 + .../vite/vite-react-cts/src/gql/graphql.ts | 1 + .../vite/vite-react-mts/src/gql/graphql.ts | 1 + .../vite/vite-react-ts/src/gql/graphql.ts | 1 + .../vue/apollo-composable/src/gql/graphql.ts | 1 + examples/vue/urql/src/gql/graphql.ts | 1 + examples/vue/villus/src/gql/graphql.ts | 1 + examples/yoga-tests/src/gql/graphql.ts | 1 + .../src/ts-selection-set-processor.ts | 3 +- .../__snapshots__/ts-documents.spec.ts.snap | 4 ++ .../operations/tests/ts-documents.spec.ts | 11 ++-- .../__snapshots__/ts-resolvers.spec.ts.snap | 2 + .../typescript/typescript/src/visitor.ts | 6 +++ .../client/tests/client-preset.spec.ts | 10 ++++ .../tests/gql-tag-operations.spec.ts | 2 + yarn.lock | 50 +++++++++++++++++-- 63 files changed, 153 insertions(+), 31 deletions(-) diff --git a/dev-test/githunt/typed-document-nodes.ts b/dev-test/githunt/typed-document-nodes.ts index 83d0a671e0c..00a635aa8b9 100644 --- a/dev-test/githunt/typed-document-nodes.ts +++ b/dev-test/githunt/typed-document-nodes.ts @@ -4,6 +4,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/githunt/types.avoidOptionals.ts b/dev-test/githunt/types.avoidOptionals.ts index d10a57f2f7d..157a367ef49 100644 --- a/dev-test/githunt/types.avoidOptionals.ts +++ b/dev-test/githunt/types.avoidOptionals.ts @@ -3,6 +3,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/githunt/types.d.ts b/dev-test/githunt/types.d.ts index c9fc2f34a23..c82ef5ccc12 100644 --- a/dev-test/githunt/types.d.ts +++ b/dev-test/githunt/types.d.ts @@ -3,6 +3,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/githunt/types.enumsAsTypes.ts b/dev-test/githunt/types.enumsAsTypes.ts index c9fc2f34a23..c82ef5ccc12 100644 --- a/dev-test/githunt/types.enumsAsTypes.ts +++ b/dev-test/githunt/types.enumsAsTypes.ts @@ -3,6 +3,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/githunt/types.flatten.preResolveTypes.ts b/dev-test/githunt/types.flatten.preResolveTypes.ts index a05c999876e..225dc2f7698 100644 --- a/dev-test/githunt/types.flatten.preResolveTypes.ts +++ b/dev-test/githunt/types.flatten.preResolveTypes.ts @@ -3,6 +3,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/githunt/types.immutableTypes.ts b/dev-test/githunt/types.immutableTypes.ts index 1da626f2b57..3adbd6f0759 100644 --- a/dev-test/githunt/types.immutableTypes.ts +++ b/dev-test/githunt/types.immutableTypes.ts @@ -3,6 +3,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/githunt/types.preResolveTypes.onlyOperationTypes.ts b/dev-test/githunt/types.preResolveTypes.onlyOperationTypes.ts index 118c86bfab5..2babf82775e 100644 --- a/dev-test/githunt/types.preResolveTypes.onlyOperationTypes.ts +++ b/dev-test/githunt/types.preResolveTypes.onlyOperationTypes.ts @@ -3,6 +3,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/githunt/types.preResolveTypes.ts b/dev-test/githunt/types.preResolveTypes.ts index 312db844b11..bae8c6f4c9c 100644 --- a/dev-test/githunt/types.preResolveTypes.ts +++ b/dev-test/githunt/types.preResolveTypes.ts @@ -3,6 +3,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/githunt/types.ts b/dev-test/githunt/types.ts index 312db844b11..bae8c6f4c9c 100644 --- a/dev-test/githunt/types.ts +++ b/dev-test/githunt/types.ts @@ -3,6 +3,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/gql-tag-operations-masking-star-wars/gql/graphql.ts b/dev-test/gql-tag-operations-masking-star-wars/gql/graphql.ts index 5dd9c74a357..cf1eb217d81 100644 --- a/dev-test/gql-tag-operations-masking-star-wars/gql/graphql.ts +++ b/dev-test/gql-tag-operations-masking-star-wars/gql/graphql.ts @@ -5,6 +5,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/gql-tag-operations-masking/gql/graphql.ts b/dev-test/gql-tag-operations-masking/gql/graphql.ts index cf80a16e14c..fd7a9021736 100644 --- a/dev-test/gql-tag-operations-masking/gql/graphql.ts +++ b/dev-test/gql-tag-operations-masking/gql/graphql.ts @@ -5,6 +5,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/gql-tag-operations-urql/gql/graphql.ts b/dev-test/gql-tag-operations-urql/gql/graphql.ts index 71a75b5953c..d02c497da96 100644 --- a/dev-test/gql-tag-operations-urql/gql/graphql.ts +++ b/dev-test/gql-tag-operations-urql/gql/graphql.ts @@ -5,6 +5,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/gql-tag-operations/gql/graphql.ts b/dev-test/gql-tag-operations/gql/graphql.ts index 71a75b5953c..d02c497da96 100644 --- a/dev-test/gql-tag-operations/gql/graphql.ts +++ b/dev-test/gql-tag-operations/gql/graphql.ts @@ -5,6 +5,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/gql-tag-operations/graphql/graphql.ts b/dev-test/gql-tag-operations/graphql/graphql.ts index 67bfe67faf7..9b9d34cb8e4 100644 --- a/dev-test/gql-tag-operations/graphql/graphql.ts +++ b/dev-test/gql-tag-operations/graphql/graphql.ts @@ -5,6 +5,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/modules/types.ts b/dev-test/modules/types.ts index 7f31678c4a4..bbb859b8263 100644 --- a/dev-test/modules/types.ts +++ b/dev-test/modules/types.ts @@ -4,6 +4,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; export type Omit = Pick>; export type RequireFields = Omit & { [P in K]-?: NonNullable }; /** All built-in and custom scalars, mapped to their actual values */ diff --git a/dev-test/star-wars/types.avoidOptionals.ts b/dev-test/star-wars/types.avoidOptionals.ts index 79cc40d04b2..f81cc2734c4 100644 --- a/dev-test/star-wars/types.avoidOptionals.ts +++ b/dev-test/star-wars/types.avoidOptionals.ts @@ -3,6 +3,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/star-wars/types.d.ts b/dev-test/star-wars/types.d.ts index 7f7577a548a..167ef958970 100644 --- a/dev-test/star-wars/types.d.ts +++ b/dev-test/star-wars/types.d.ts @@ -3,6 +3,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/star-wars/types.globallyAvailable.d.ts b/dev-test/star-wars/types.globallyAvailable.d.ts index 097c066666a..fc277367766 100644 --- a/dev-test/star-wars/types.globallyAvailable.d.ts +++ b/dev-test/star-wars/types.globallyAvailable.d.ts @@ -3,6 +3,7 @@ type InputMaybe = Maybe; type Exact = { [K in keyof T]: T[K] }; type MakeOptional = Omit & { [SubKey in K]?: Maybe }; type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +type MakeEmpty = { [p in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ type Scalars = { ID: string; diff --git a/dev-test/star-wars/types.immutableTypes.ts b/dev-test/star-wars/types.immutableTypes.ts index 308c916179d..43db7e02b24 100644 --- a/dev-test/star-wars/types.immutableTypes.ts +++ b/dev-test/star-wars/types.immutableTypes.ts @@ -3,6 +3,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/star-wars/types.preResolveTypes.onlyOperationTypes.ts b/dev-test/star-wars/types.preResolveTypes.onlyOperationTypes.ts index 58104b680ba..1641a32ef3f 100644 --- a/dev-test/star-wars/types.preResolveTypes.onlyOperationTypes.ts +++ b/dev-test/star-wars/types.preResolveTypes.onlyOperationTypes.ts @@ -3,6 +3,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/star-wars/types.preResolveTypes.ts b/dev-test/star-wars/types.preResolveTypes.ts index 16eaefea148..5304d1e4161 100644 --- a/dev-test/star-wars/types.preResolveTypes.ts +++ b/dev-test/star-wars/types.preResolveTypes.ts @@ -3,6 +3,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/star-wars/types.skipSchema.ts b/dev-test/star-wars/types.skipSchema.ts index 16eaefea148..5304d1e4161 100644 --- a/dev-test/star-wars/types.skipSchema.ts +++ b/dev-test/star-wars/types.skipSchema.ts @@ -3,6 +3,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/star-wars/types.ts b/dev-test/star-wars/types.ts index 16eaefea148..5304d1e4161 100644 --- a/dev-test/star-wars/types.ts +++ b/dev-test/star-wars/types.ts @@ -3,6 +3,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/test-schema/env.types.ts b/dev-test/test-schema/env.types.ts index 8f8f1b5b588..418cb291927 100644 --- a/dev-test/test-schema/env.types.ts +++ b/dev-test/test-schema/env.types.ts @@ -3,6 +3,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/test-schema/resolvers-federation.ts b/dev-test/test-schema/resolvers-federation.ts index 5a33b696555..21e83e43ff8 100644 --- a/dev-test/test-schema/resolvers-federation.ts +++ b/dev-test/test-schema/resolvers-federation.ts @@ -4,6 +4,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/test-schema/resolvers-root.ts b/dev-test/test-schema/resolvers-root.ts index 384d4c43bff..114713478ba 100644 --- a/dev-test/test-schema/resolvers-root.ts +++ b/dev-test/test-schema/resolvers-root.ts @@ -4,6 +4,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; export type RequireFields = Omit & { [P in K]-?: NonNullable }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { diff --git a/dev-test/test-schema/resolvers-stitching.ts b/dev-test/test-schema/resolvers-stitching.ts index 0221fe70e4f..f5a2e85c950 100644 --- a/dev-test/test-schema/resolvers-stitching.ts +++ b/dev-test/test-schema/resolvers-stitching.ts @@ -4,6 +4,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; export type RequireFields = Omit & { [P in K]-?: NonNullable }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { diff --git a/dev-test/test-schema/resolvers-types.ts b/dev-test/test-schema/resolvers-types.ts index 751529eae6a..283d5fd8947 100644 --- a/dev-test/test-schema/resolvers-types.ts +++ b/dev-test/test-schema/resolvers-types.ts @@ -4,6 +4,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; export type RequireFields = Omit & { [P in K]-?: NonNullable }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { diff --git a/dev-test/test-schema/types.preResolveTypes.onlyOperationTypes.ts b/dev-test/test-schema/types.preResolveTypes.onlyOperationTypes.ts index ff64cdd6408..e926a162499 100644 --- a/dev-test/test-schema/types.preResolveTypes.onlyOperationTypes.ts +++ b/dev-test/test-schema/types.preResolveTypes.onlyOperationTypes.ts @@ -3,6 +3,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/test-schema/types.preResolveTypes.ts b/dev-test/test-schema/types.preResolveTypes.ts index c2611ac2c97..a00f8fb6164 100644 --- a/dev-test/test-schema/types.preResolveTypes.ts +++ b/dev-test/test-schema/types.preResolveTypes.ts @@ -3,6 +3,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/test-schema/typings.avoidOptionals.ts b/dev-test/test-schema/typings.avoidOptionals.ts index c4da945f8d3..1a0e0073a85 100644 --- a/dev-test/test-schema/typings.avoidOptionals.ts +++ b/dev-test/test-schema/typings.avoidOptionals.ts @@ -3,6 +3,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/test-schema/typings.enum.ts b/dev-test/test-schema/typings.enum.ts index 4d27a6aa56b..ad5b87ba749 100644 --- a/dev-test/test-schema/typings.enum.ts +++ b/dev-test/test-schema/typings.enum.ts @@ -3,6 +3,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/test-schema/typings.immutableTypes.ts b/dev-test/test-schema/typings.immutableTypes.ts index 01f29495fee..0832478af4e 100644 --- a/dev-test/test-schema/typings.immutableTypes.ts +++ b/dev-test/test-schema/typings.immutableTypes.ts @@ -3,6 +3,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/test-schema/typings.ts b/dev-test/test-schema/typings.ts index 9f1bf80ffa5..e18a3bc6736 100644 --- a/dev-test/test-schema/typings.ts +++ b/dev-test/test-schema/typings.ts @@ -4,6 +4,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; export type RequireFields = Omit & { [P in K]-?: NonNullable }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { diff --git a/dev-test/test-schema/typings.wrapped.ts b/dev-test/test-schema/typings.wrapped.ts index 4229727530a..dd9799633ac 100644 --- a/dev-test/test-schema/typings.wrapped.ts +++ b/dev-test/test-schema/typings.wrapped.ts @@ -4,6 +4,7 @@ declare namespace GraphQL { export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; + export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/persisted-documents-string-mode/src/gql/graphql.ts b/examples/persisted-documents-string-mode/src/gql/graphql.ts index eec941afa44..d431c2b24d2 100644 --- a/examples/persisted-documents-string-mode/src/gql/graphql.ts +++ b/examples/persisted-documents-string-mode/src/gql/graphql.ts @@ -5,6 +5,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/persisted-documents/src/gql/graphql.ts b/examples/persisted-documents/src/gql/graphql.ts index a85407d9609..53c35f44a9b 100644 --- a/examples/persisted-documents/src/gql/graphql.ts +++ b/examples/persisted-documents/src/gql/graphql.ts @@ -5,6 +5,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/react/apollo-client-defer/src/gql/fragment-masking.ts b/examples/react/apollo-client-defer/src/gql/fragment-masking.ts index 195a11ebd3e..dc2836d43e3 100644 --- a/examples/react/apollo-client-defer/src/gql/fragment-masking.ts +++ b/examples/react/apollo-client-defer/src/gql/fragment-masking.ts @@ -1,48 +1,46 @@ -import { ResultOf, TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core'; +import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -export type FragmentType> = TDocumentType extends DocumentNode< - infer TType, - any -> - ? TType extends { ' $fragmentName'?: infer TKey } - ? TKey extends string - ? { ' $fragmentRefs'?: { [key in TKey]: TType } } +export type FragmentType> = + TDocumentType extends DocumentTypeDecoration + ? TType extends { ' $fragmentName'?: infer TKey } + ? TKey extends string + ? { ' $fragmentRefs'?: { [key in TKey]: TType } } + : never : never - : never - : never; + : never; // return non-nullable if `fragmentType` is non-nullable export function useFragment( - _documentNode: DocumentNode, - fragmentType: FragmentType> + _documentNode: DocumentTypeDecoration, + fragmentType: FragmentType> ): TType; // return nullable if `fragmentType` is nullable export function useFragment( - _documentNode: DocumentNode, - fragmentType: FragmentType> | null | undefined + _documentNode: DocumentTypeDecoration, + fragmentType: FragmentType> | null | undefined ): TType | null | undefined; // return array of non-nullable if `fragmentType` is array of non-nullable export function useFragment( - _documentNode: DocumentNode, - fragmentType: ReadonlyArray>> + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray>> ): ReadonlyArray; // return array of nullable if `fragmentType` is array of nullable export function useFragment( - _documentNode: DocumentNode, - fragmentType: ReadonlyArray>> | null | undefined + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray>> | null | undefined ): ReadonlyArray | null | undefined; export function useFragment( - _documentNode: DocumentNode, + _documentNode: DocumentTypeDecoration, fragmentType: - | FragmentType> - | ReadonlyArray>> + | FragmentType> + | ReadonlyArray>> | null | undefined ): TType | ReadonlyArray | null | undefined { return fragmentType as any; } -export function makeFragmentData>( +export function makeFragmentData, FT extends ResultOf>( data: FT, _fragment: F ): FragmentType { diff --git a/examples/react/apollo-client-defer/src/gql/graphql.ts b/examples/react/apollo-client-defer/src/gql/graphql.ts index 82f09421368..0ed15a841eb 100644 --- a/examples/react/apollo-client-defer/src/gql/graphql.ts +++ b/examples/react/apollo-client-defer/src/gql/graphql.ts @@ -5,6 +5,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/react/apollo-client-swc-plugin/src/gql/graphql.ts b/examples/react/apollo-client-swc-plugin/src/gql/graphql.ts index 9ca792fa77d..805c3e491e7 100644 --- a/examples/react/apollo-client-swc-plugin/src/gql/graphql.ts +++ b/examples/react/apollo-client-swc-plugin/src/gql/graphql.ts @@ -5,6 +5,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/react/apollo-client/src/gql/graphql.ts b/examples/react/apollo-client/src/gql/graphql.ts index 9ca792fa77d..805c3e491e7 100644 --- a/examples/react/apollo-client/src/gql/graphql.ts +++ b/examples/react/apollo-client/src/gql/graphql.ts @@ -5,6 +5,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/react/http-executor/src/gql/graphql.ts b/examples/react/http-executor/src/gql/graphql.ts index 9ca792fa77d..805c3e491e7 100644 --- a/examples/react/http-executor/src/gql/graphql.ts +++ b/examples/react/http-executor/src/gql/graphql.ts @@ -5,6 +5,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/react/nextjs-swr/gql/graphql.ts b/examples/react/nextjs-swr/gql/graphql.ts index 1b439fa77dd..d50dce92f32 100644 --- a/examples/react/nextjs-swr/gql/graphql.ts +++ b/examples/react/nextjs-swr/gql/graphql.ts @@ -5,6 +5,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/react/tanstack-react-query/src/gql/graphql.ts b/examples/react/tanstack-react-query/src/gql/graphql.ts index 239024a493c..99e259432b3 100644 --- a/examples/react/tanstack-react-query/src/gql/graphql.ts +++ b/examples/react/tanstack-react-query/src/gql/graphql.ts @@ -5,6 +5,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/react/urql/src/gql/graphql.ts b/examples/react/urql/src/gql/graphql.ts index b62e6096cf6..6414dc3faad 100644 --- a/examples/react/urql/src/gql/graphql.ts +++ b/examples/react/urql/src/gql/graphql.ts @@ -5,6 +5,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/typescript-esm/src/gql/graphql.ts b/examples/typescript-esm/src/gql/graphql.ts index a689c8a2080..49fb4ae6e96 100644 --- a/examples/typescript-esm/src/gql/graphql.ts +++ b/examples/typescript-esm/src/gql/graphql.ts @@ -5,6 +5,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/typescript-graphql-request/src/gql/graphql.ts b/examples/typescript-graphql-request/src/gql/graphql.ts index 1b9d64da87e..cbb27428af6 100644 --- a/examples/typescript-graphql-request/src/gql/graphql.ts +++ b/examples/typescript-graphql-request/src/gql/graphql.ts @@ -5,6 +5,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/typescript-resolvers/src/type-defs.d.ts b/examples/typescript-resolvers/src/type-defs.d.ts index 160b23311fb..1a5c6555d76 100644 --- a/examples/typescript-resolvers/src/type-defs.d.ts +++ b/examples/typescript-resolvers/src/type-defs.d.ts @@ -4,6 +4,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; export type RequireFields = Omit & { [P in K]-?: NonNullable }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { diff --git a/examples/vite/vite-react-cts/src/gql/graphql.ts b/examples/vite/vite-react-cts/src/gql/graphql.ts index 1b439fa77dd..d50dce92f32 100644 --- a/examples/vite/vite-react-cts/src/gql/graphql.ts +++ b/examples/vite/vite-react-cts/src/gql/graphql.ts @@ -5,6 +5,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/vite/vite-react-mts/src/gql/graphql.ts b/examples/vite/vite-react-mts/src/gql/graphql.ts index 1b439fa77dd..d50dce92f32 100644 --- a/examples/vite/vite-react-mts/src/gql/graphql.ts +++ b/examples/vite/vite-react-mts/src/gql/graphql.ts @@ -5,6 +5,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/vite/vite-react-ts/src/gql/graphql.ts b/examples/vite/vite-react-ts/src/gql/graphql.ts index 1b439fa77dd..d50dce92f32 100644 --- a/examples/vite/vite-react-ts/src/gql/graphql.ts +++ b/examples/vite/vite-react-ts/src/gql/graphql.ts @@ -5,6 +5,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/vue/apollo-composable/src/gql/graphql.ts b/examples/vue/apollo-composable/src/gql/graphql.ts index 2f497291a3c..3da0b06933e 100644 --- a/examples/vue/apollo-composable/src/gql/graphql.ts +++ b/examples/vue/apollo-composable/src/gql/graphql.ts @@ -5,6 +5,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/vue/urql/src/gql/graphql.ts b/examples/vue/urql/src/gql/graphql.ts index 2f497291a3c..3da0b06933e 100644 --- a/examples/vue/urql/src/gql/graphql.ts +++ b/examples/vue/urql/src/gql/graphql.ts @@ -5,6 +5,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/vue/villus/src/gql/graphql.ts b/examples/vue/villus/src/gql/graphql.ts index 2f497291a3c..3da0b06933e 100644 --- a/examples/vue/villus/src/gql/graphql.ts +++ b/examples/vue/villus/src/gql/graphql.ts @@ -5,6 +5,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/yoga-tests/src/gql/graphql.ts b/examples/yoga-tests/src/gql/graphql.ts index 51c26c9b9bf..4a240fe6d3f 100644 --- a/examples/yoga-tests/src/gql/graphql.ts +++ b/examples/yoga-tests/src/gql/graphql.ts @@ -5,6 +5,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/packages/plugins/typescript/operations/src/ts-selection-set-processor.ts b/packages/plugins/typescript/operations/src/ts-selection-set-processor.ts index 4f6a345f8d8..6de86a0c45d 100644 --- a/packages/plugins/typescript/operations/src/ts-selection-set-processor.ts +++ b/packages/plugins/typescript/operations/src/ts-selection-set-processor.ts @@ -24,9 +24,8 @@ export class TypeScriptSelectionSetProcessor extends BaseSelectionSetProcessor `'${field.fieldName}'`).join(' | ')}>`]; + return [`MakeEmpty<${parentName}, ${fields.map(field => `'${field.fieldName}'`).join(' | ')}>`]; } let hasConditionals = false; diff --git a/packages/plugins/typescript/operations/tests/__snapshots__/ts-documents.spec.ts.snap b/packages/plugins/typescript/operations/tests/__snapshots__/ts-documents.spec.ts.snap index 6ea53d261ec..ee40b80b268 100644 --- a/packages/plugins/typescript/operations/tests/__snapshots__/ts-documents.spec.ts.snap +++ b/packages/plugins/typescript/operations/tests/__snapshots__/ts-documents.spec.ts.snap @@ -69,6 +69,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -358,6 +359,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -474,6 +476,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -567,6 +570,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/packages/plugins/typescript/operations/tests/ts-documents.spec.ts b/packages/plugins/typescript/operations/tests/ts-documents.spec.ts index 75212c56544..500161bfd7d 100644 --- a/packages/plugins/typescript/operations/tests/ts-documents.spec.ts +++ b/packages/plugins/typescript/operations/tests/ts-documents.spec.ts @@ -4049,6 +4049,7 @@ describe('TypeScript Operations Plugin', () => { export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; + export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -4157,6 +4158,7 @@ describe('TypeScript Operations Plugin', () => { export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; + export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -4243,6 +4245,7 @@ describe('TypeScript Operations Plugin', () => { export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; + export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -6661,7 +6664,7 @@ function test(q: GetEntityBrandDataQuery): void { & Pick ) | ( { __typename?: 'User' } - & Empty + & MakeEmpty )) & (( { __typename?: 'User' } & { address: ( @@ -6679,7 +6682,7 @@ function test(q: GetEntityBrandDataQuery): void { & Pick ) | ( { __typename?: 'User' } - & Empty + & MakeEmpty )) } ); `); @@ -6800,7 +6803,7 @@ function test(q: GetEntityBrandDataQuery): void { & Pick ) | ( { __typename?: 'User' } - & Empty + & MakeEmpty )) & (( { __typename?: 'User' } & { address: ( @@ -6818,7 +6821,7 @@ function test(q: GetEntityBrandDataQuery): void { & Pick ) | ( { __typename?: 'User' } - & Empty + & MakeEmpty )) } ); `); diff --git a/packages/plugins/typescript/resolvers/tests/__snapshots__/ts-resolvers.spec.ts.snap b/packages/plugins/typescript/resolvers/tests/__snapshots__/ts-resolvers.spec.ts.snap index a99e2af3186..6325b0be3bd 100644 --- a/packages/plugins/typescript/resolvers/tests/__snapshots__/ts-resolvers.spec.ts.snap +++ b/packages/plugins/typescript/resolvers/tests/__snapshots__/ts-resolvers.spec.ts.snap @@ -6,6 +6,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; import { GraphQLResolveInfo, GraphQLScalarType, GraphQLScalarTypeConfig } from 'graphql'; export type Omit = Pick>; export type RequireFields = Omit & { [P in K]-?: NonNullable }; @@ -478,6 +479,7 @@ export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; import { GraphQLResolveInfo, GraphQLScalarType, GraphQLScalarTypeConfig } from 'graphql'; export type Omit = Pick>; export type RequireFields = Omit & { [P in K]-?: NonNullable }; diff --git a/packages/plugins/typescript/typescript/src/visitor.ts b/packages/plugins/typescript/typescript/src/visitor.ts index d3e88532d6a..2dc9a02a619 100644 --- a/packages/plugins/typescript/typescript/src/visitor.ts +++ b/packages/plugins/typescript/typescript/src/visitor.ts @@ -49,6 +49,7 @@ export interface TypeScriptPluginParsedConfig extends ParsedTypesConfig { export const EXACT_SIGNATURE = `type Exact = { [K in keyof T]: T[K] };`; export const MAKE_OPTIONAL_SIGNATURE = `type MakeOptional = Omit & { [SubKey in K]?: Maybe };`; export const MAKE_MAYBE_SIGNATURE = `type MakeMaybe = Omit & { [SubKey in K]: Maybe };`; +export const MAKE_EMPTY_SIGNATURE = `type MakeEmpty = { [_ in K]?: never };`; export class TsVisitor< TRawConfig extends TypeScriptPluginConfig = TypeScriptPluginConfig, @@ -159,6 +160,7 @@ export class TsVisitor< this.getExactDefinition(), this.getMakeOptionalDefinition(), this.getMakeMaybeDefinition(), + this.getMakeEmptyDefinition(), ]; if (this.config.wrapFieldDefinitions) { @@ -187,6 +189,10 @@ export class TsVisitor< return `${this.getExportPrefix()}${MAKE_MAYBE_SIGNATURE}`; } + public getMakeEmptyDefinition(): string { + return `${this.getExportPrefix()}${MAKE_EMPTY_SIGNATURE}`; + } + public getMaybeValue(): string { return `${this.getExportPrefix()}type Maybe = ${this.config.maybeValue};`; } diff --git a/packages/presets/client/tests/client-preset.spec.ts b/packages/presets/client/tests/client-preset.spec.ts index 6673406cc4a..39d6fed73af 100644 --- a/packages/presets/client/tests/client-preset.spec.ts +++ b/packages/presets/client/tests/client-preset.spec.ts @@ -343,6 +343,7 @@ export * from "./gql";`); export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; + export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -471,6 +472,7 @@ export * from "./gql";`); export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; + export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -582,6 +584,7 @@ export * from "./gql";`); export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; + export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -1227,6 +1230,7 @@ export * from "./gql.js";`); export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; + export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -1303,6 +1307,7 @@ export * from "./gql.js";`); export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; + export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -1382,6 +1387,7 @@ export * from "./gql.js";`); export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; + export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -1461,6 +1467,7 @@ export * from "./gql.js";`); export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; + export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -1542,6 +1549,7 @@ export * from "./gql.js";`); export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; + export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -1630,6 +1638,7 @@ export * from "./gql.js";`); export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; + export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -1709,6 +1718,7 @@ export * from "./gql.js";`); export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; + export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/packages/presets/gql-tag-operations/tests/gql-tag-operations.spec.ts b/packages/presets/gql-tag-operations/tests/gql-tag-operations.spec.ts index a3b570e7c82..f9df02e7599 100644 --- a/packages/presets/gql-tag-operations/tests/gql-tag-operations.spec.ts +++ b/packages/presets/gql-tag-operations/tests/gql-tag-operations.spec.ts @@ -340,6 +340,7 @@ describe('gql-tag-operations-preset', () => { export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; + export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -456,6 +457,7 @@ describe('gql-tag-operations-preset', () => { export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; + export type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/yarn.lock b/yarn.lock index 30adb4232b9..827fd00f089 100644 --- a/yarn.lock +++ b/yarn.lock @@ -233,6 +233,27 @@ resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.20.14.tgz#4106fc8b755f3e3ee0a0a7c27dde5de1d2b2baf8" integrity sha512-0YpKHD6ImkWMEINCyDAD0HLLUH/lPCefG8ld9it8DJB2wnApraKuhgYTvTY1z7UFIfBTGy5LwncZ+5HWWGbhFw== +"@babel/core@7.21.0": + version "7.21.0" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.21.0.tgz#1341aefdcc14ccc7553fcc688dd8986a2daffc13" + integrity sha512-PuxUbxcW6ZYe656yL3EAhpy7qXKq0DmYsrJLpbB8XrsCP9Nm+XCg9XFMb5vIDliPD7+U/+M+QJlH17XOcB7eXA== + dependencies: + "@ampproject/remapping" "^2.2.0" + "@babel/code-frame" "^7.18.6" + "@babel/generator" "^7.21.0" + "@babel/helper-compilation-targets" "^7.20.7" + "@babel/helper-module-transforms" "^7.21.0" + "@babel/helpers" "^7.21.0" + "@babel/parser" "^7.21.0" + "@babel/template" "^7.20.7" + "@babel/traverse" "^7.21.0" + "@babel/types" "^7.21.0" + convert-source-map "^1.7.0" + debug "^4.1.0" + gensync "^1.0.0-beta.2" + json5 "^2.2.2" + semver "^6.3.0" + "@babel/core@7.21.3", "@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.14.0", "@babel/core@^7.20.12": version "7.21.3" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.21.3.tgz#cf1c877284a469da5d1ce1d1e53665253fae712e" @@ -254,7 +275,7 @@ json5 "^2.2.2" semver "^6.3.0" -"@babel/generator@^7.14.0", "@babel/generator@^7.18.13", "@babel/generator@^7.21.3", "@babel/generator@^7.7.2": +"@babel/generator@^7.14.0", "@babel/generator@^7.18.13", "@babel/generator@^7.21.0", "@babel/generator@^7.21.3", "@babel/generator@^7.7.2": version "7.21.3" resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.21.3.tgz#232359d0874b392df04045d72ce2fd9bb5045fce" integrity sha512-QS3iR1GYC/YGUnW7IdggFeN5c1poPUurnGttOV/bZgPGV+izC/D8HnD6DLwod0fsatNyVn1G3EVWMYIF0nHbeA== @@ -365,7 +386,7 @@ dependencies: "@babel/types" "^7.18.6" -"@babel/helper-module-transforms@^7.18.6", "@babel/helper-module-transforms@^7.20.11", "@babel/helper-module-transforms@^7.21.2": +"@babel/helper-module-transforms@^7.18.6", "@babel/helper-module-transforms@^7.20.11", "@babel/helper-module-transforms@^7.21.0", "@babel/helper-module-transforms@^7.21.2": version "7.21.2" resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.21.2.tgz#160caafa4978ac8c00ac66636cb0fa37b024e2d2" integrity sha512-79yj2AR4U/Oqq/WOV7Lx6hUjau1Zfo4cI+JLAVYeMV5XIlbOhmjEk5ulbTc9fMpmlojzZHkUUxAiK+UKn+hNQQ== @@ -477,7 +498,7 @@ chalk "^2.0.0" js-tokens "^4.0.0" -"@babel/parser@^7.1.0", "@babel/parser@^7.14.0", "@babel/parser@^7.14.7", "@babel/parser@^7.16.4", "@babel/parser@^7.16.8", "@babel/parser@^7.20.7", "@babel/parser@^7.21.3": +"@babel/parser@^7.1.0", "@babel/parser@^7.14.0", "@babel/parser@^7.14.7", "@babel/parser@^7.16.4", "@babel/parser@^7.16.8", "@babel/parser@^7.20.7", "@babel/parser@^7.21.0", "@babel/parser@^7.21.3": version "7.21.3" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.21.3.tgz#1d285d67a19162ff9daa358d4cb41d50c06220b3" integrity sha512-lobG0d7aOfQRXh8AyklEAgZGvA4FShxo6xQbUrrT/cNBPUdIDojlokwJsQyCC/eKia7ifqM0yP+2DRZ4WKw2RQ== @@ -2718,6 +2739,11 @@ dependencies: "@graphql-tools/utils" "^9.0.1" +"@graphql-yoga/plugin-persisted-operations@1.7.2": + version "1.7.2" + resolved "https://registry.yarnpkg.com/@graphql-yoga/plugin-persisted-operations/-/plugin-persisted-operations-1.7.2.tgz#63a74718a4fa5967d05b7a9b20c97c7a593b9e9e" + integrity sha512-ITzfOQ4ex+ag5BDLqeyFx004ifYmGbUQ4EboPVeZwdX9i3H4OXGE8U9z7jl939K0kXxIB8as5nA7HMuYPxhLgg== + "@graphql-yoga/plugin-persisted-operations@1.7.3": version "1.7.3" resolved "https://registry.yarnpkg.com/@graphql-yoga/plugin-persisted-operations/-/plugin-persisted-operations-1.7.3.tgz#7db03e6551bcdf6d205e7ce024db3a97d3750a86" @@ -8088,6 +8114,24 @@ graphql-ws@5.11.3: resolved "https://registry.yarnpkg.com/graphql-ws/-/graphql-ws-5.11.3.tgz#eaf8e6baf669d167975cff13ad86abca4ecfe82f" integrity sha512-fU8zwSgAX2noXAsuFiCZ8BtXeXZOzXyK5u1LloCdacsVth4skdBMPO74EG51lBoWSIZ8beUocdpV8+cQHBODnQ== +graphql-yoga@3.7.2: + version "3.7.2" + resolved "https://registry.yarnpkg.com/graphql-yoga/-/graphql-yoga-3.7.2.tgz#e0731c33b10fe51efc273d7c141cdd7fbfbcf516" + integrity sha512-T7Uxrf2Mc8RTqcSrVz69Fwek4VHwLEhxjgkiX6VVtO76ngWBCp6kNQGmcw06LGQz4PRkhMg9dbM3XAGxfCB73A== + dependencies: + "@envelop/core" "^3.0.4" + "@envelop/validation-cache" "^5.1.2" + "@graphql-tools/executor" "^0.0.15" + "@graphql-tools/schema" "^9.0.0" + "@graphql-tools/utils" "^9.2.1" + "@graphql-yoga/logger" "^0.0.1" + "@graphql-yoga/subscription" "^3.1.0" + "@whatwg-node/fetch" "^0.8.2" + "@whatwg-node/server" "^0.7.3" + dset "^3.1.1" + lru-cache "^7.14.1" + tslib "^2.3.1" + graphql-yoga@3.7.3: version "3.7.3" resolved "https://registry.yarnpkg.com/graphql-yoga/-/graphql-yoga-3.7.3.tgz#6b26b3bf4b8d87005cbdfdef34f4c0e7fc1e9286" From d68995d3af7feb2b890c7cd28a4bb1f209c36535 Mon Sep 17 00:00:00 2001 From: beerose Date: Tue, 21 Mar 2023 18:45:34 +0100 Subject: [PATCH 12/47] Change test names --- .../typescript/operations/tests/ts-documents.spec.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/plugins/typescript/operations/tests/ts-documents.spec.ts b/packages/plugins/typescript/operations/tests/ts-documents.spec.ts index 500161bfd7d..b39545088b5 100644 --- a/packages/plugins/typescript/operations/tests/ts-documents.spec.ts +++ b/packages/plugins/typescript/operations/tests/ts-documents.spec.ts @@ -6438,7 +6438,7 @@ function test(q: GetEntityBrandDataQuery): void { }); describe('incremental delivery directive handling', () => { - it('should mark fields in deferred fragments as optional (preResolveTypes: true)', async () => { + it('should generate an union of initial and deferred fields for fragments (preResolveTypes: true)', async () => { const schema = buildSchema(` type Address { street1: String! @@ -6554,7 +6554,7 @@ function test(q: GetEntityBrandDataQuery): void { `); }); - it('should mark fields in deferred fragments as optional using MakeOptional (preResolveTypes: false)', async () => { + it('should generate an union of initial and deferred fields for fragments using MakeEmpty (preResolveTypes: false)', async () => { const schema = buildSchema(` type Address { street1: String! @@ -6688,7 +6688,7 @@ function test(q: GetEntityBrandDataQuery): void { `); }); - it('should mark fields in deferred fragments as optional using MakeMaybe (avoidOptionals: true)', async () => { + it('should generate an union of initial and deferred fields for fragments MakeEmpty (avoidOptionals: true)', async () => { const schema = buildSchema(` type Address { street1: String! From 43402e89d955c488ff940eba0e340de16fbfbec3 Mon Sep 17 00:00:00 2001 From: beerose Date: Tue, 21 Mar 2023 18:50:34 +0100 Subject: [PATCH 13/47] Update example --- dev-test/star-wars/types.globallyAvailable.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-test/star-wars/types.globallyAvailable.d.ts b/dev-test/star-wars/types.globallyAvailable.d.ts index fc277367766..39453664dd0 100644 --- a/dev-test/star-wars/types.globallyAvailable.d.ts +++ b/dev-test/star-wars/types.globallyAvailable.d.ts @@ -3,7 +3,7 @@ type InputMaybe = Maybe; type Exact = { [K in keyof T]: T[K] }; type MakeOptional = Omit & { [SubKey in K]?: Maybe }; type MakeMaybe = Omit & { [SubKey in K]: Maybe }; -type MakeEmpty = { [p in K]?: never }; +type MakeEmpty = { [_ in K]?: never }; /** All built-in and custom scalars, mapped to their actual values */ type Scalars = { ID: string; From 4fe8ca095c146c0777ad06fa5a798447b9a9075c Mon Sep 17 00:00:00 2001 From: beerose Date: Wed, 22 Mar 2023 15:45:42 +0100 Subject: [PATCH 14/47] Add failing test --- .../operations/tests/ts-documents.spec.ts | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+) diff --git a/packages/plugins/typescript/operations/tests/ts-documents.spec.ts b/packages/plugins/typescript/operations/tests/ts-documents.spec.ts index b39545088b5..43af9dcad41 100644 --- a/packages/plugins/typescript/operations/tests/ts-documents.spec.ts +++ b/packages/plugins/typescript/operations/tests/ts-documents.spec.ts @@ -7029,6 +7029,100 @@ function test(q: GetEntityBrandDataQuery): void { }; `); }); + + it('should generate correct types with inlineFragmentTypes: "mask""', async () => { + const schema = buildSchema(` + type Address { + street1: String! + } + + type Phone { + home: String! + } + + type Employment { + title: String! + } + + type User { + name: String! + email: String! + address: Address! + phone: Phone! + employment: Employment! + widgetCount: Int! + widgetPreference: String! + clearanceLevel: String! + favoriteFood: String! + leastFavoriteFood: String! + } + + type Query { + user: User! + } + `); + + const fragment = parse(` + fragment WidgetFragment on User { + widgetCount + widgetPreference + } + + fragment FoodFragment on User { + favoriteFood + leastFavoriteFood + } + + fragment EmploymentFragment on User { + employment { + title + } + } + + query user { + user { + # Test inline fragment defer + ... @defer { + email + } + + # Test inline fragment defer with nested selection set + ... @defer { + address { + street1 + } + } + + # Test named fragment defer + ...WidgetFragment @defer + + # Test a secondary named fragment defer + ...FoodFragment @defer + + # Not deferred fields, fragments, selection sets, etc are left alone + name + phone { + home + } + ...EmploymentFragment + ... { + clearanceLevel + } + } + } + `); + + const { content } = await plugin( + schema, + [{ location: '', document: fragment }], + { preResolveTypes: true, inlineFragmentTypes: 'mask' }, + { outputFile: 'graphql.ts' } + ); + + expect(content).toBeSimilarStringTo(` + TODO + `); + }); }); it('handles unnamed queries', async () => { From 7b7e0a63a92cf2bf6011dc9b56bb6c63e3a3f3fd Mon Sep 17 00:00:00 2001 From: beerose Date: Wed, 22 Mar 2023 17:14:57 +0100 Subject: [PATCH 15/47] Modify example to contain a failing test --- .../react/apollo-client-defer/src/App.tsx | 23 ++++++---- .../react/apollo-client-defer/src/gql/gql.ts | 13 ++++-- .../apollo-client-defer/src/gql/graphql.ts | 45 ++++++++++++++----- 3 files changed, 59 insertions(+), 22 deletions(-) diff --git a/examples/react/apollo-client-defer/src/App.tsx b/examples/react/apollo-client-defer/src/App.tsx index 2d72d6d2423..240b70eebf1 100644 --- a/examples/react/apollo-client-defer/src/App.tsx +++ b/examples/react/apollo-client-defer/src/App.tsx @@ -1,19 +1,25 @@ import { useQuery } from '@apollo/client'; import './App.css'; -import { graphql } from './gql/gql'; +import { useFragment, graphql, FragmentType } from './gql'; + +export const slowFieldFragment = graphql(/* GraphQL */ ` + fragment SlowFieldFragment on Query { + slowField + } +`); const alphabetQuery = graphql(/* GraphQL */ ` query SlowAndFastFieldWithDefer { fastField - ... on Query @defer { - slowField - } + ...SlowFieldFragment @defer } `); -const Field = ({ field }: { field: string }) => { - return

{field}

; +const SlowDataField = (props: { data: FragmentType }) => { + const fragment = useFragment(slowFieldFragment, props.data); + // should be string | undefined + return

{fragment.slowField}

; }; function App() { @@ -22,9 +28,8 @@ function App() {
{data && ( <> - - {/* @ts-expect-error expected because slowField can be undefined */} - +

{data.fastField}

+ )}
diff --git a/examples/react/apollo-client-defer/src/gql/gql.ts b/examples/react/apollo-client-defer/src/gql/gql.ts index dcb1f0ecc47..a0015dd743e 100644 --- a/examples/react/apollo-client-defer/src/gql/gql.ts +++ b/examples/react/apollo-client-defer/src/gql/gql.ts @@ -13,7 +13,8 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/ * Therefore it is highly recommended to use the babel or swc plugin for production. */ const documents = { - '\n query SlowAndFastFieldWithDefer {\n fastField\n ... on Query @defer {\n slowField\n }\n }\n': + '\n fragment SlowFieldFragment on Query {\n slowField\n }\n': types.SlowFieldFragmentFragmentDoc, + '\n query SlowAndFastFieldWithDefer {\n fastField\n ...SlowFieldFragment @defer\n }\n': types.SlowAndFastFieldWithDeferDocument, }; @@ -35,8 +36,14 @@ export function graphql(source: string): unknown; * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ export function graphql( - source: '\n query SlowAndFastFieldWithDefer {\n fastField\n ... on Query @defer {\n slowField\n }\n }\n' -): (typeof documents)['\n query SlowAndFastFieldWithDefer {\n fastField\n ... on Query @defer {\n slowField\n }\n }\n']; + source: '\n fragment SlowFieldFragment on Query {\n slowField\n }\n' +): (typeof documents)['\n fragment SlowFieldFragment on Query {\n slowField\n }\n']; +/** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function graphql( + source: '\n query SlowAndFastFieldWithDefer {\n fastField\n ...SlowFieldFragment @defer\n }\n' +): (typeof documents)['\n query SlowAndFastFieldWithDefer {\n fastField\n ...SlowFieldFragment @defer\n }\n']; export function graphql(source: string) { return (documents as any)[source] ?? {}; diff --git a/examples/react/apollo-client-defer/src/gql/graphql.ts b/examples/react/apollo-client-defer/src/gql/graphql.ts index 0ed15a841eb..0e86e27bf70 100644 --- a/examples/react/apollo-client-defer/src/gql/graphql.ts +++ b/examples/react/apollo-client-defer/src/gql/graphql.ts @@ -31,13 +31,33 @@ export type QuerySlowFieldArgs = { waitFor?: Scalars['Int']; }; -export type SlowAndFastFieldWithDeferQueryVariables = Exact<{ [key: string]: never }>; - -export type SlowAndFastFieldWithDeferQuery = { __typename?: 'Query'; fastField: string } & ( +export type SlowFieldFragmentFragment = ( | { __typename?: 'Query'; slowField: string } | { __typename?: 'Query'; slowField?: never } -); +) & { + ' $fragmentName'?: 'SlowFieldFragmentFragment'; +}; + +export type SlowAndFastFieldWithDeferQueryVariables = Exact<{ [key: string]: never }>; +export type SlowAndFastFieldWithDeferQuery = { __typename?: 'Query'; fastField: string } & ({ __typename?: 'Query' } & { + ' $fragmentRefs'?: { SlowFieldFragmentFragment: SlowFieldFragmentFragment }; +}); + +export const SlowFieldFragmentFragmentDoc = { + kind: 'Document', + definitions: [ + { + kind: 'FragmentDefinition', + name: { kind: 'Name', value: 'SlowFieldFragment' }, + typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'Query' } }, + selectionSet: { + kind: 'SelectionSet', + selections: [{ kind: 'Field', name: { kind: 'Name', value: 'slowField' } }], + }, + }, + ], +} as unknown as DocumentNode; export const SlowAndFastFieldWithDeferDocument = { kind: 'Document', definitions: [ @@ -50,16 +70,21 @@ export const SlowAndFastFieldWithDeferDocument = { selections: [ { kind: 'Field', name: { kind: 'Name', value: 'fastField' } }, { - kind: 'InlineFragment', - typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'Query' } }, + kind: 'FragmentSpread', + name: { kind: 'Name', value: 'SlowFieldFragment' }, directives: [{ kind: 'Directive', name: { kind: 'Name', value: 'defer' } }], - selectionSet: { - kind: 'SelectionSet', - selections: [{ kind: 'Field', name: { kind: 'Name', value: 'slowField' } }], - }, }, ], }, }, + { + kind: 'FragmentDefinition', + name: { kind: 'Name', value: 'SlowFieldFragment' }, + typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'Query' } }, + selectionSet: { + kind: 'SelectionSet', + selections: [{ kind: 'Field', name: { kind: 'Name', value: 'slowField' } }], + }, + }, ], } as unknown as DocumentNode; From 84395ac1a7410923c1733b4d4bd786f0bff36754 Mon Sep 17 00:00:00 2001 From: beerose Date: Wed, 22 Mar 2023 17:27:54 +0100 Subject: [PATCH 16/47] Add an expected output to the new test --- .../operations/tests/ts-documents.spec.ts | 40 ++++++++++++++++++- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/packages/plugins/typescript/operations/tests/ts-documents.spec.ts b/packages/plugins/typescript/operations/tests/ts-documents.spec.ts index 43af9dcad41..79e1b6dfa53 100644 --- a/packages/plugins/typescript/operations/tests/ts-documents.spec.ts +++ b/packages/plugins/typescript/operations/tests/ts-documents.spec.ts @@ -7030,7 +7030,7 @@ function test(q: GetEntityBrandDataQuery): void { `); }); - it('should generate correct types with inlineFragmentTypes: "mask""', async () => { + it.only('should generate correct types with inlineFragmentTypes: "mask""', async () => { const schema = buildSchema(` type Address { street1: String! @@ -7120,7 +7120,43 @@ function test(q: GetEntityBrandDataQuery): void { ); expect(content).toBeSimilarStringTo(` - TODO + export type WidgetFragmentFragment = ( + | { __typename?: 'User'; widgetCount: number; widgetPreference: string } + | { __typename?: 'User'; widgetCount?: never; widgetPreference?: never } + ) & { + ' $fragmentName'?: 'WidgetFragmentFragment'; + }; + + export type FoodFragmentFragment = ( + | { __typename?: 'User'; favoriteFood: string; leastFavoriteFood: string } + | { __typename?: 'User'; favoriteFood?: never; leastFavoriteFood?: never } + ) & { + ' $fragmentName'?: 'FoodFragmentFragment'; + }; + + export type EmploymentFragmentFragment = { + __typename?: 'User'; + employment: { __typename?: 'Employment'; title: string }; + } & { ' $fragmentName'?: 'EmploymentFragmentFragment' }; + + export type UserQueryVariables = Exact<{ [key: string]: never }>; + + export type UserQuery = { + __typename?: 'Query'; + user: ({ + __typename?: 'User'; + clearanceLevel: string; + name: string; + phone: { __typename?: 'Phone'; home: string }; + } & { ' $fragmentRefs'?: { EmploymentFragmentFragment: EmploymentFragmentFragment } }) & + ({ __typename?: 'User'; email: string } | { __typename?: 'User'; email?: never }) & + ( + | { __typename?: 'User'; address: { __typename?: 'Address'; street1: string } } + | { __typename?: 'User'; address?: never } + ) & + { __typename?: 'User' } & { ' $fragmentRefs'?: { WidgetFragmentFragment: WidgetFragmentFragment } } & + { __typename?: 'User' } & { ' $fragmentRefs'?: { FoodFragmentFragment: FoodFragmentFragment } }; + }; `); }); }); From eb2c276fd311a36e5b58236eb24967a46f51a0e6 Mon Sep 17 00:00:00 2001 From: beerose Date: Wed, 22 Mar 2023 21:08:50 +0100 Subject: [PATCH 17/47] Handle generating types with inlineFragmentTypes mask --- dev-test/githunt/typed-document-nodes.ts | 1 + dev-test/githunt/types.avoidOptionals.ts | 1 + dev-test/githunt/types.d.ts | 1 + dev-test/githunt/types.enumsAsTypes.ts | 1 + .../githunt/types.flatten.preResolveTypes.ts | 1 + dev-test/githunt/types.immutableTypes.ts | 1 + ...ypes.preResolveTypes.onlyOperationTypes.ts | 1 + dev-test/githunt/types.preResolveTypes.ts | 1 + dev-test/githunt/types.ts | 1 + .../gql/graphql.ts | 1 + .../gql-tag-operations-masking/gql/graphql.ts | 1 + .../gql-tag-operations-urql/gql/graphql.ts | 1 + dev-test/gql-tag-operations/gql/graphql.ts | 1 + .../gql-tag-operations/graphql/graphql.ts | 1 + dev-test/modules/types.ts | 1 + dev-test/star-wars/types.avoidOptionals.ts | 1 + dev-test/star-wars/types.d.ts | 1 + .../star-wars/types.globallyAvailable.d.ts | 1 + dev-test/star-wars/types.immutableTypes.ts | 1 + ...ypes.preResolveTypes.onlyOperationTypes.ts | 1 + dev-test/star-wars/types.preResolveTypes.ts | 1 + dev-test/star-wars/types.skipSchema.ts | 1 + dev-test/star-wars/types.ts | 1 + dev-test/test-schema/env.types.ts | 1 + dev-test/test-schema/resolvers-federation.ts | 1 + dev-test/test-schema/resolvers-root.ts | 1 + dev-test/test-schema/resolvers-stitching.ts | 1 + dev-test/test-schema/resolvers-types.ts | 1 + ...ypes.preResolveTypes.onlyOperationTypes.ts | 1 + dev-test/test-schema/types.preResolveTypes.ts | 1 + .../test-schema/typings.avoidOptionals.ts | 1 + dev-test/test-schema/typings.enum.ts | 1 + .../test-schema/typings.immutableTypes.ts | 1 + dev-test/test-schema/typings.ts | 1 + dev-test/test-schema/typings.wrapped.ts | 1 + .../src/gql/graphql.ts | 1 + .../persisted-documents/src/gql/graphql.ts | 1 + .../react/apollo-client-defer/src/App.tsx | 3 +- .../apollo-client-defer/src/gql/graphql.ts | 8 +-- .../src/gql/graphql.ts | 1 + .../react/apollo-client/src/gql/graphql.ts | 1 + .../react/http-executor/src/gql/graphql.ts | 1 + examples/react/nextjs-swr/gql/graphql.ts | 1 + .../tanstack-react-query/src/gql/graphql.ts | 1 + examples/react/urql/src/gql/graphql.ts | 1 + examples/typescript-esm/src/gql/graphql.ts | 1 + .../src/gql/graphql.ts | 1 + .../typescript-resolvers/src/type-defs.d.ts | 1 + .../vite/vite-react-cts/src/gql/graphql.ts | 1 + .../vite/vite-react-mts/src/gql/graphql.ts | 1 + .../vite/vite-react-ts/src/gql/graphql.ts | 1 + .../vue/apollo-composable/src/gql/graphql.ts | 1 + examples/vue/urql/src/gql/graphql.ts | 1 + examples/vue/villus/src/gql/graphql.ts | 1 + examples/yoga-tests/src/gql/graphql.ts | 1 + packages/graphql-codegen-core/src/codegen.ts | 2 +- .../src/selection-set-to-object.ts | 15 ++++- .../__snapshots__/ts-documents.spec.ts.snap | 4 ++ .../operations/tests/ts-documents.spec.ts | 56 ++++++++----------- .../__snapshots__/ts-resolvers.spec.ts.snap | 2 + .../typescript/typescript/src/visitor.ts | 6 ++ .../client/tests/client-preset.spec.ts | 2 + 62 files changed, 109 insertions(+), 42 deletions(-) diff --git a/dev-test/githunt/typed-document-nodes.ts b/dev-test/githunt/typed-document-nodes.ts index 00a635aa8b9..70f0e1ef913 100644 --- a/dev-test/githunt/typed-document-nodes.ts +++ b/dev-test/githunt/typed-document-nodes.ts @@ -5,6 +5,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/githunt/types.avoidOptionals.ts b/dev-test/githunt/types.avoidOptionals.ts index 157a367ef49..50312a25cf8 100644 --- a/dev-test/githunt/types.avoidOptionals.ts +++ b/dev-test/githunt/types.avoidOptionals.ts @@ -4,6 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/githunt/types.d.ts b/dev-test/githunt/types.d.ts index c82ef5ccc12..1252158cb20 100644 --- a/dev-test/githunt/types.d.ts +++ b/dev-test/githunt/types.d.ts @@ -4,6 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/githunt/types.enumsAsTypes.ts b/dev-test/githunt/types.enumsAsTypes.ts index c82ef5ccc12..1252158cb20 100644 --- a/dev-test/githunt/types.enumsAsTypes.ts +++ b/dev-test/githunt/types.enumsAsTypes.ts @@ -4,6 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/githunt/types.flatten.preResolveTypes.ts b/dev-test/githunt/types.flatten.preResolveTypes.ts index 225dc2f7698..21c1d49f323 100644 --- a/dev-test/githunt/types.flatten.preResolveTypes.ts +++ b/dev-test/githunt/types.flatten.preResolveTypes.ts @@ -4,6 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/githunt/types.immutableTypes.ts b/dev-test/githunt/types.immutableTypes.ts index 3adbd6f0759..0eb9d59796e 100644 --- a/dev-test/githunt/types.immutableTypes.ts +++ b/dev-test/githunt/types.immutableTypes.ts @@ -4,6 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/githunt/types.preResolveTypes.onlyOperationTypes.ts b/dev-test/githunt/types.preResolveTypes.onlyOperationTypes.ts index 2babf82775e..687a7bcb636 100644 --- a/dev-test/githunt/types.preResolveTypes.onlyOperationTypes.ts +++ b/dev-test/githunt/types.preResolveTypes.onlyOperationTypes.ts @@ -4,6 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/githunt/types.preResolveTypes.ts b/dev-test/githunt/types.preResolveTypes.ts index bae8c6f4c9c..072b05e97c7 100644 --- a/dev-test/githunt/types.preResolveTypes.ts +++ b/dev-test/githunt/types.preResolveTypes.ts @@ -4,6 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/githunt/types.ts b/dev-test/githunt/types.ts index bae8c6f4c9c..072b05e97c7 100644 --- a/dev-test/githunt/types.ts +++ b/dev-test/githunt/types.ts @@ -4,6 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/gql-tag-operations-masking-star-wars/gql/graphql.ts b/dev-test/gql-tag-operations-masking-star-wars/gql/graphql.ts index cf1eb217d81..794762649e9 100644 --- a/dev-test/gql-tag-operations-masking-star-wars/gql/graphql.ts +++ b/dev-test/gql-tag-operations-masking-star-wars/gql/graphql.ts @@ -6,6 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/gql-tag-operations-masking/gql/graphql.ts b/dev-test/gql-tag-operations-masking/gql/graphql.ts index fd7a9021736..40684942c8b 100644 --- a/dev-test/gql-tag-operations-masking/gql/graphql.ts +++ b/dev-test/gql-tag-operations-masking/gql/graphql.ts @@ -6,6 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/gql-tag-operations-urql/gql/graphql.ts b/dev-test/gql-tag-operations-urql/gql/graphql.ts index d02c497da96..c3aac9958f4 100644 --- a/dev-test/gql-tag-operations-urql/gql/graphql.ts +++ b/dev-test/gql-tag-operations-urql/gql/graphql.ts @@ -6,6 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/gql-tag-operations/gql/graphql.ts b/dev-test/gql-tag-operations/gql/graphql.ts index d02c497da96..c3aac9958f4 100644 --- a/dev-test/gql-tag-operations/gql/graphql.ts +++ b/dev-test/gql-tag-operations/gql/graphql.ts @@ -6,6 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/gql-tag-operations/graphql/graphql.ts b/dev-test/gql-tag-operations/graphql/graphql.ts index 9b9d34cb8e4..3acfd3a5c8e 100644 --- a/dev-test/gql-tag-operations/graphql/graphql.ts +++ b/dev-test/gql-tag-operations/graphql/graphql.ts @@ -6,6 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/modules/types.ts b/dev-test/modules/types.ts index bbb859b8263..36b19f26989 100644 --- a/dev-test/modules/types.ts +++ b/dev-test/modules/types.ts @@ -5,6 +5,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; export type Omit = Pick>; export type RequireFields = Omit & { [P in K]-?: NonNullable }; /** All built-in and custom scalars, mapped to their actual values */ diff --git a/dev-test/star-wars/types.avoidOptionals.ts b/dev-test/star-wars/types.avoidOptionals.ts index f81cc2734c4..3844a2e56d1 100644 --- a/dev-test/star-wars/types.avoidOptionals.ts +++ b/dev-test/star-wars/types.avoidOptionals.ts @@ -4,6 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/star-wars/types.d.ts b/dev-test/star-wars/types.d.ts index 167ef958970..02c1200bb73 100644 --- a/dev-test/star-wars/types.d.ts +++ b/dev-test/star-wars/types.d.ts @@ -4,6 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/star-wars/types.globallyAvailable.d.ts b/dev-test/star-wars/types.globallyAvailable.d.ts index 39453664dd0..e5e274f37e1 100644 --- a/dev-test/star-wars/types.globallyAvailable.d.ts +++ b/dev-test/star-wars/types.globallyAvailable.d.ts @@ -4,6 +4,7 @@ type Exact = { [K in keyof T]: T[K] }; type MakeOptional = Omit & { [SubKey in K]?: Maybe }; type MakeMaybe = Omit & { [SubKey in K]: Maybe }; type MakeEmpty = { [_ in K]?: never }; +type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ type Scalars = { ID: string; diff --git a/dev-test/star-wars/types.immutableTypes.ts b/dev-test/star-wars/types.immutableTypes.ts index 43db7e02b24..83e88b96989 100644 --- a/dev-test/star-wars/types.immutableTypes.ts +++ b/dev-test/star-wars/types.immutableTypes.ts @@ -4,6 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/star-wars/types.preResolveTypes.onlyOperationTypes.ts b/dev-test/star-wars/types.preResolveTypes.onlyOperationTypes.ts index 1641a32ef3f..09c5da6eaaa 100644 --- a/dev-test/star-wars/types.preResolveTypes.onlyOperationTypes.ts +++ b/dev-test/star-wars/types.preResolveTypes.onlyOperationTypes.ts @@ -4,6 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/star-wars/types.preResolveTypes.ts b/dev-test/star-wars/types.preResolveTypes.ts index 5304d1e4161..766128ab14a 100644 --- a/dev-test/star-wars/types.preResolveTypes.ts +++ b/dev-test/star-wars/types.preResolveTypes.ts @@ -4,6 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/star-wars/types.skipSchema.ts b/dev-test/star-wars/types.skipSchema.ts index 5304d1e4161..766128ab14a 100644 --- a/dev-test/star-wars/types.skipSchema.ts +++ b/dev-test/star-wars/types.skipSchema.ts @@ -4,6 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/star-wars/types.ts b/dev-test/star-wars/types.ts index 5304d1e4161..766128ab14a 100644 --- a/dev-test/star-wars/types.ts +++ b/dev-test/star-wars/types.ts @@ -4,6 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/test-schema/env.types.ts b/dev-test/test-schema/env.types.ts index 418cb291927..f67a69a5cdc 100644 --- a/dev-test/test-schema/env.types.ts +++ b/dev-test/test-schema/env.types.ts @@ -4,6 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/test-schema/resolvers-federation.ts b/dev-test/test-schema/resolvers-federation.ts index 21e83e43ff8..56f351d5c55 100644 --- a/dev-test/test-schema/resolvers-federation.ts +++ b/dev-test/test-schema/resolvers-federation.ts @@ -5,6 +5,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/test-schema/resolvers-root.ts b/dev-test/test-schema/resolvers-root.ts index 114713478ba..5f5ff6d7c79 100644 --- a/dev-test/test-schema/resolvers-root.ts +++ b/dev-test/test-schema/resolvers-root.ts @@ -5,6 +5,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; export type RequireFields = Omit & { [P in K]-?: NonNullable }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { diff --git a/dev-test/test-schema/resolvers-stitching.ts b/dev-test/test-schema/resolvers-stitching.ts index f5a2e85c950..567a54eb937 100644 --- a/dev-test/test-schema/resolvers-stitching.ts +++ b/dev-test/test-schema/resolvers-stitching.ts @@ -5,6 +5,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; export type RequireFields = Omit & { [P in K]-?: NonNullable }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { diff --git a/dev-test/test-schema/resolvers-types.ts b/dev-test/test-schema/resolvers-types.ts index 283d5fd8947..787b065f01f 100644 --- a/dev-test/test-schema/resolvers-types.ts +++ b/dev-test/test-schema/resolvers-types.ts @@ -5,6 +5,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; export type RequireFields = Omit & { [P in K]-?: NonNullable }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { diff --git a/dev-test/test-schema/types.preResolveTypes.onlyOperationTypes.ts b/dev-test/test-schema/types.preResolveTypes.onlyOperationTypes.ts index e926a162499..9a2b2c0f6a5 100644 --- a/dev-test/test-schema/types.preResolveTypes.onlyOperationTypes.ts +++ b/dev-test/test-schema/types.preResolveTypes.onlyOperationTypes.ts @@ -4,6 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/test-schema/types.preResolveTypes.ts b/dev-test/test-schema/types.preResolveTypes.ts index a00f8fb6164..b40f984afea 100644 --- a/dev-test/test-schema/types.preResolveTypes.ts +++ b/dev-test/test-schema/types.preResolveTypes.ts @@ -4,6 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/test-schema/typings.avoidOptionals.ts b/dev-test/test-schema/typings.avoidOptionals.ts index 1a0e0073a85..636488e8678 100644 --- a/dev-test/test-schema/typings.avoidOptionals.ts +++ b/dev-test/test-schema/typings.avoidOptionals.ts @@ -4,6 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/test-schema/typings.enum.ts b/dev-test/test-schema/typings.enum.ts index ad5b87ba749..6593e71b258 100644 --- a/dev-test/test-schema/typings.enum.ts +++ b/dev-test/test-schema/typings.enum.ts @@ -4,6 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/test-schema/typings.immutableTypes.ts b/dev-test/test-schema/typings.immutableTypes.ts index 0832478af4e..a06e77ba8f6 100644 --- a/dev-test/test-schema/typings.immutableTypes.ts +++ b/dev-test/test-schema/typings.immutableTypes.ts @@ -4,6 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/test-schema/typings.ts b/dev-test/test-schema/typings.ts index e18a3bc6736..86643f49b50 100644 --- a/dev-test/test-schema/typings.ts +++ b/dev-test/test-schema/typings.ts @@ -5,6 +5,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; export type RequireFields = Omit & { [P in K]-?: NonNullable }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { diff --git a/dev-test/test-schema/typings.wrapped.ts b/dev-test/test-schema/typings.wrapped.ts index dd9799633ac..c7022b5d5c7 100644 --- a/dev-test/test-schema/typings.wrapped.ts +++ b/dev-test/test-schema/typings.wrapped.ts @@ -5,6 +5,7 @@ declare namespace GraphQL { export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; + export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/persisted-documents-string-mode/src/gql/graphql.ts b/examples/persisted-documents-string-mode/src/gql/graphql.ts index d431c2b24d2..1567e577e42 100644 --- a/examples/persisted-documents-string-mode/src/gql/graphql.ts +++ b/examples/persisted-documents-string-mode/src/gql/graphql.ts @@ -6,6 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/persisted-documents/src/gql/graphql.ts b/examples/persisted-documents/src/gql/graphql.ts index 53c35f44a9b..65cd5ccbb1a 100644 --- a/examples/persisted-documents/src/gql/graphql.ts +++ b/examples/persisted-documents/src/gql/graphql.ts @@ -6,6 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/react/apollo-client-defer/src/App.tsx b/examples/react/apollo-client-defer/src/App.tsx index 240b70eebf1..2933eae0e30 100644 --- a/examples/react/apollo-client-defer/src/App.tsx +++ b/examples/react/apollo-client-defer/src/App.tsx @@ -18,7 +18,6 @@ const alphabetQuery = graphql(/* GraphQL */ ` const SlowDataField = (props: { data: FragmentType }) => { const fragment = useFragment(slowFieldFragment, props.data); - // should be string | undefined return

{fragment.slowField}

; }; @@ -29,6 +28,8 @@ function App() { {data && ( <>

{data.fastField}

+ {/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */} + {/* @ts-expect-error */} )} diff --git a/examples/react/apollo-client-defer/src/gql/graphql.ts b/examples/react/apollo-client-defer/src/gql/graphql.ts index 0e86e27bf70..a3fd6e53d47 100644 --- a/examples/react/apollo-client-defer/src/gql/graphql.ts +++ b/examples/react/apollo-client-defer/src/gql/graphql.ts @@ -6,6 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -31,17 +32,14 @@ export type QuerySlowFieldArgs = { waitFor?: Scalars['Int']; }; -export type SlowFieldFragmentFragment = ( - | { __typename?: 'Query'; slowField: string } - | { __typename?: 'Query'; slowField?: never } -) & { +export type SlowFieldFragmentFragment = { __typename?: 'Query'; slowField: string } & { ' $fragmentName'?: 'SlowFieldFragmentFragment'; }; export type SlowAndFastFieldWithDeferQueryVariables = Exact<{ [key: string]: never }>; export type SlowAndFastFieldWithDeferQuery = { __typename?: 'Query'; fastField: string } & ({ __typename?: 'Query' } & { - ' $fragmentRefs'?: { SlowFieldFragmentFragment: SlowFieldFragmentFragment }; + ' $fragmentRefs'?: { SlowFieldFragmentFragment: Incremental }; }); export const SlowFieldFragmentFragmentDoc = { diff --git a/examples/react/apollo-client-swc-plugin/src/gql/graphql.ts b/examples/react/apollo-client-swc-plugin/src/gql/graphql.ts index 805c3e491e7..30f063ade91 100644 --- a/examples/react/apollo-client-swc-plugin/src/gql/graphql.ts +++ b/examples/react/apollo-client-swc-plugin/src/gql/graphql.ts @@ -6,6 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/react/apollo-client/src/gql/graphql.ts b/examples/react/apollo-client/src/gql/graphql.ts index 805c3e491e7..30f063ade91 100644 --- a/examples/react/apollo-client/src/gql/graphql.ts +++ b/examples/react/apollo-client/src/gql/graphql.ts @@ -6,6 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/react/http-executor/src/gql/graphql.ts b/examples/react/http-executor/src/gql/graphql.ts index 805c3e491e7..30f063ade91 100644 --- a/examples/react/http-executor/src/gql/graphql.ts +++ b/examples/react/http-executor/src/gql/graphql.ts @@ -6,6 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/react/nextjs-swr/gql/graphql.ts b/examples/react/nextjs-swr/gql/graphql.ts index d50dce92f32..dd9dc33d0fe 100644 --- a/examples/react/nextjs-swr/gql/graphql.ts +++ b/examples/react/nextjs-swr/gql/graphql.ts @@ -6,6 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/react/tanstack-react-query/src/gql/graphql.ts b/examples/react/tanstack-react-query/src/gql/graphql.ts index 99e259432b3..05175cce48f 100644 --- a/examples/react/tanstack-react-query/src/gql/graphql.ts +++ b/examples/react/tanstack-react-query/src/gql/graphql.ts @@ -6,6 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/react/urql/src/gql/graphql.ts b/examples/react/urql/src/gql/graphql.ts index 6414dc3faad..64c7d663253 100644 --- a/examples/react/urql/src/gql/graphql.ts +++ b/examples/react/urql/src/gql/graphql.ts @@ -6,6 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/typescript-esm/src/gql/graphql.ts b/examples/typescript-esm/src/gql/graphql.ts index 49fb4ae6e96..5311b1361a8 100644 --- a/examples/typescript-esm/src/gql/graphql.ts +++ b/examples/typescript-esm/src/gql/graphql.ts @@ -6,6 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/typescript-graphql-request/src/gql/graphql.ts b/examples/typescript-graphql-request/src/gql/graphql.ts index cbb27428af6..50bba8062e0 100644 --- a/examples/typescript-graphql-request/src/gql/graphql.ts +++ b/examples/typescript-graphql-request/src/gql/graphql.ts @@ -6,6 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/typescript-resolvers/src/type-defs.d.ts b/examples/typescript-resolvers/src/type-defs.d.ts index 1a5c6555d76..e87802289ac 100644 --- a/examples/typescript-resolvers/src/type-defs.d.ts +++ b/examples/typescript-resolvers/src/type-defs.d.ts @@ -5,6 +5,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; export type RequireFields = Omit & { [P in K]-?: NonNullable }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { diff --git a/examples/vite/vite-react-cts/src/gql/graphql.ts b/examples/vite/vite-react-cts/src/gql/graphql.ts index d50dce92f32..dd9dc33d0fe 100644 --- a/examples/vite/vite-react-cts/src/gql/graphql.ts +++ b/examples/vite/vite-react-cts/src/gql/graphql.ts @@ -6,6 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/vite/vite-react-mts/src/gql/graphql.ts b/examples/vite/vite-react-mts/src/gql/graphql.ts index d50dce92f32..dd9dc33d0fe 100644 --- a/examples/vite/vite-react-mts/src/gql/graphql.ts +++ b/examples/vite/vite-react-mts/src/gql/graphql.ts @@ -6,6 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/vite/vite-react-ts/src/gql/graphql.ts b/examples/vite/vite-react-ts/src/gql/graphql.ts index d50dce92f32..dd9dc33d0fe 100644 --- a/examples/vite/vite-react-ts/src/gql/graphql.ts +++ b/examples/vite/vite-react-ts/src/gql/graphql.ts @@ -6,6 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/vue/apollo-composable/src/gql/graphql.ts b/examples/vue/apollo-composable/src/gql/graphql.ts index 3da0b06933e..43b9f1e46c2 100644 --- a/examples/vue/apollo-composable/src/gql/graphql.ts +++ b/examples/vue/apollo-composable/src/gql/graphql.ts @@ -6,6 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/vue/urql/src/gql/graphql.ts b/examples/vue/urql/src/gql/graphql.ts index 3da0b06933e..43b9f1e46c2 100644 --- a/examples/vue/urql/src/gql/graphql.ts +++ b/examples/vue/urql/src/gql/graphql.ts @@ -6,6 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/vue/villus/src/gql/graphql.ts b/examples/vue/villus/src/gql/graphql.ts index 3da0b06933e..43b9f1e46c2 100644 --- a/examples/vue/villus/src/gql/graphql.ts +++ b/examples/vue/villus/src/gql/graphql.ts @@ -6,6 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/yoga-tests/src/gql/graphql.ts b/examples/yoga-tests/src/gql/graphql.ts index 4a240fe6d3f..d9d418ee729 100644 --- a/examples/yoga-tests/src/gql/graphql.ts +++ b/examples/yoga-tests/src/gql/graphql.ts @@ -6,6 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/packages/graphql-codegen-core/src/codegen.ts b/packages/graphql-codegen-core/src/codegen.ts index e1da67b94ee..bdb99947c4f 100644 --- a/packages/graphql-codegen-core/src/codegen.ts +++ b/packages/graphql-codegen-core/src/codegen.ts @@ -298,7 +298,7 @@ function validateDuplicateDocuments(files: Types.DocumentFile[]) { `.trimRight(); }) .join('')} - `.trimRight() + `.trimEnd() ) .join(''); diff --git a/packages/plugins/other/visitor-plugin-common/src/selection-set-to-object.ts b/packages/plugins/other/visitor-plugin-common/src/selection-set-to-object.ts index d57509b6f45..361ef527064 100644 --- a/packages/plugins/other/visitor-plugin-common/src/selection-set-to-object.ts +++ b/packages/plugins/other/visitor-plugin-common/src/selection-set-to-object.ts @@ -376,6 +376,14 @@ export class SelectionSetToObject `'${name}': ${name}`).join(`;`)} } }`); + fields.push( + `{ ' $fragmentRefs'?: { ${fragmentsSpreadUsages + .map(name => `'${name}': ${options?.unsetTypes ? `Incremental<${name}>` : name}`) + .join(`;`)} } }` + ); } } @@ -748,7 +760,6 @@ export class SelectionSetToObject = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -360,6 +361,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -477,6 +479,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -571,6 +574,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/packages/plugins/typescript/operations/tests/ts-documents.spec.ts b/packages/plugins/typescript/operations/tests/ts-documents.spec.ts index 79e1b6dfa53..e2c97dffd6b 100644 --- a/packages/plugins/typescript/operations/tests/ts-documents.spec.ts +++ b/packages/plugins/typescript/operations/tests/ts-documents.spec.ts @@ -4050,6 +4050,7 @@ describe('TypeScript Operations Plugin', () => { export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; + export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -4159,6 +4160,7 @@ describe('TypeScript Operations Plugin', () => { export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; + export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -4246,6 +4248,7 @@ describe('TypeScript Operations Plugin', () => { export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; + export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -7030,7 +7033,7 @@ function test(q: GetEntityBrandDataQuery): void { `); }); - it.only('should generate correct types with inlineFragmentTypes: "mask""', async () => { + it('should generate correct types with inlineFragmentTypes: "mask""', async () => { const schema = buildSchema(` type Address { street1: String! @@ -7120,43 +7123,30 @@ function test(q: GetEntityBrandDataQuery): void { ); expect(content).toBeSimilarStringTo(` - export type WidgetFragmentFragment = ( - | { __typename?: 'User'; widgetCount: number; widgetPreference: string } - | { __typename?: 'User'; widgetCount?: never; widgetPreference?: never } - ) & { - ' $fragmentName'?: 'WidgetFragmentFragment'; - }; + export type WidgetFragmentFragment = { __typename?: 'User', widgetCount: number, widgetPreference: string } & { ' $fragmentName'?: 'WidgetFragmentFragment' }; - export type FoodFragmentFragment = ( - | { __typename?: 'User'; favoriteFood: string; leastFavoriteFood: string } - | { __typename?: 'User'; favoriteFood?: never; leastFavoriteFood?: never } - ) & { - ' $fragmentName'?: 'FoodFragmentFragment'; - }; + export type FoodFragmentFragment = { __typename?: 'User', favoriteFood: string, leastFavoriteFood: string } & { ' $fragmentName'?: 'FoodFragmentFragment' }; - export type EmploymentFragmentFragment = { - __typename?: 'User'; - employment: { __typename?: 'Employment'; title: string }; - } & { ' $fragmentName'?: 'EmploymentFragmentFragment' }; + export type EmploymentFragmentFragment = { __typename?: 'User', employment: { __typename?: 'Employment', title: string } } & { ' $fragmentName'?: 'EmploymentFragmentFragment' }; - export type UserQueryVariables = Exact<{ [key: string]: never }>; + export type UserQueryVariables = Exact<{ [key: string]: never; }>; export type UserQuery = { - __typename?: 'Query'; - user: ({ - __typename?: 'User'; - clearanceLevel: string; - name: string; - phone: { __typename?: 'Phone'; home: string }; - } & { ' $fragmentRefs'?: { EmploymentFragmentFragment: EmploymentFragmentFragment } }) & - ({ __typename?: 'User'; email: string } | { __typename?: 'User'; email?: never }) & - ( - | { __typename?: 'User'; address: { __typename?: 'Address'; street1: string } } - | { __typename?: 'User'; address?: never } - ) & - { __typename?: 'User' } & { ' $fragmentRefs'?: { WidgetFragmentFragment: WidgetFragmentFragment } } & - { __typename?: 'User' } & { ' $fragmentRefs'?: { FoodFragmentFragment: FoodFragmentFragment } }; - }; + __typename?: 'Query', + user: ( + { + __typename?: 'User', + clearanceLevel: string, + name: string, + phone: { __typename?: 'Phone', home: string } + } & { ' $fragmentRefs'?: { 'EmploymentFragmentFragment': EmploymentFragmentFragment } } + ) & ({ __typename?: 'User', email: string } | { __typename?: 'User', email?: never }) & ({ __typename?: 'User', address: { __typename?: 'Address', street1: string } } | { __typename?: 'User', address?: never }) & ( + { __typename?: 'User' } + & { ' $fragmentRefs'?: { 'WidgetFragmentFragment': Incremental } } + ) & ( + { __typename?: 'User' } + & { ' $fragmentRefs'?: { 'FoodFragmentFragment': Incremental } } + ) }; `); }); }); diff --git a/packages/plugins/typescript/resolvers/tests/__snapshots__/ts-resolvers.spec.ts.snap b/packages/plugins/typescript/resolvers/tests/__snapshots__/ts-resolvers.spec.ts.snap index 6325b0be3bd..25cfcda5f63 100644 --- a/packages/plugins/typescript/resolvers/tests/__snapshots__/ts-resolvers.spec.ts.snap +++ b/packages/plugins/typescript/resolvers/tests/__snapshots__/ts-resolvers.spec.ts.snap @@ -7,6 +7,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; import { GraphQLResolveInfo, GraphQLScalarType, GraphQLScalarTypeConfig } from 'graphql'; export type Omit = Pick>; export type RequireFields = Omit & { [P in K]-?: NonNullable }; @@ -480,6 +481,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; import { GraphQLResolveInfo, GraphQLScalarType, GraphQLScalarTypeConfig } from 'graphql'; export type Omit = Pick>; export type RequireFields = Omit & { [P in K]-?: NonNullable }; diff --git a/packages/plugins/typescript/typescript/src/visitor.ts b/packages/plugins/typescript/typescript/src/visitor.ts index 2dc9a02a619..4364e386dfb 100644 --- a/packages/plugins/typescript/typescript/src/visitor.ts +++ b/packages/plugins/typescript/typescript/src/visitor.ts @@ -50,6 +50,7 @@ export const EXACT_SIGNATURE = `type Exact export const MAKE_OPTIONAL_SIGNATURE = `type MakeOptional = Omit & { [SubKey in K]?: Maybe };`; export const MAKE_MAYBE_SIGNATURE = `type MakeMaybe = Omit & { [SubKey in K]: Maybe };`; export const MAKE_EMPTY_SIGNATURE = `type MakeEmpty = { [_ in K]?: never };`; +export const MAKE_INCREMENTAL_SIGNATURE = `type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never };`; export class TsVisitor< TRawConfig extends TypeScriptPluginConfig = TypeScriptPluginConfig, @@ -161,6 +162,7 @@ export class TsVisitor< this.getMakeOptionalDefinition(), this.getMakeMaybeDefinition(), this.getMakeEmptyDefinition(), + this.getIncrementalDefinition(), ]; if (this.config.wrapFieldDefinitions) { @@ -193,6 +195,10 @@ export class TsVisitor< return `${this.getExportPrefix()}${MAKE_EMPTY_SIGNATURE}`; } + public getIncrementalDefinition(): string { + return `${this.getExportPrefix()}${MAKE_INCREMENTAL_SIGNATURE}`; + } + public getMaybeValue(): string { return `${this.getExportPrefix()}type Maybe = ${this.config.maybeValue};`; } diff --git a/packages/presets/client/tests/client-preset.spec.ts b/packages/presets/client/tests/client-preset.spec.ts index 39d6fed73af..7f59b0bd8ef 100644 --- a/packages/presets/client/tests/client-preset.spec.ts +++ b/packages/presets/client/tests/client-preset.spec.ts @@ -344,6 +344,7 @@ export * from "./gql";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; + export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -473,6 +474,7 @@ export * from "./gql";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; + export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; From 3b0cb04bcb1ad4f06e4deb6deaac0d58dda9a0f9 Mon Sep 17 00:00:00 2001 From: beerose Date: Wed, 22 Mar 2023 21:42:58 +0100 Subject: [PATCH 18/47] Update test after merge --- packages/presets/client/tests/client-preset.spec.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/presets/client/tests/client-preset.spec.ts b/packages/presets/client/tests/client-preset.spec.ts index 7f59b0bd8ef..5eb339cebe1 100644 --- a/packages/presets/client/tests/client-preset.spec.ts +++ b/packages/presets/client/tests/client-preset.spec.ts @@ -587,6 +587,7 @@ export * from "./gql";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; + export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -1233,6 +1234,7 @@ export * from "./gql.js";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; + export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -1310,6 +1312,7 @@ export * from "./gql.js";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; + export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -1390,6 +1393,7 @@ export * from "./gql.js";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; + export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -1470,6 +1474,7 @@ export * from "./gql.js";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; + export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -1552,6 +1557,7 @@ export * from "./gql.js";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; + export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -1641,6 +1647,7 @@ export * from "./gql.js";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; + export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -1721,6 +1728,7 @@ export * from "./gql.js";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; + export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; From 192fd042b58e8a725cc4d3b74bbb411d4cf03c65 Mon Sep 17 00:00:00 2001 From: beerose Date: Thu, 23 Mar 2023 12:27:19 +0100 Subject: [PATCH 19/47] Another approach to handling incremental not inlined fragments --- dev-test/codegen.ts | 8 ++--- dev-test/githunt/typed-document-nodes.ts | 3 +- dev-test/githunt/types.avoidOptionals.ts | 3 +- dev-test/githunt/types.d.ts | 3 +- dev-test/githunt/types.enumsAsTypes.ts | 3 +- .../githunt/types.flatten.preResolveTypes.ts | 3 +- dev-test/githunt/types.immutableTypes.ts | 3 +- ...ypes.preResolveTypes.onlyOperationTypes.ts | 3 +- dev-test/githunt/types.preResolveTypes.ts | 3 +- dev-test/githunt/types.ts | 3 +- .../gql/graphql.ts | 3 +- .../gql-tag-operations-masking/gql/graphql.ts | 3 +- .../gql-tag-operations-urql/gql/graphql.ts | 3 +- dev-test/gql-tag-operations/gql/graphql.ts | 3 +- .../graphql/fragment-masking.ts | 6 ++++ .../gql-tag-operations/graphql/graphql.ts | 3 +- dev-test/modules/types.ts | 3 +- dev-test/star-wars/types.avoidOptionals.ts | 3 +- dev-test/star-wars/types.d.ts | 3 +- .../star-wars/types.globallyAvailable.d.ts | 3 +- dev-test/star-wars/types.immutableTypes.ts | 3 +- ...ypes.preResolveTypes.onlyOperationTypes.ts | 3 +- dev-test/star-wars/types.preResolveTypes.ts | 3 +- dev-test/star-wars/types.skipSchema.ts | 3 +- dev-test/star-wars/types.ts | 3 +- dev-test/test-schema/env.types.ts | 3 +- dev-test/test-schema/resolvers-federation.ts | 3 +- dev-test/test-schema/resolvers-root.ts | 3 +- dev-test/test-schema/resolvers-stitching.ts | 3 +- dev-test/test-schema/resolvers-types.ts | 3 +- ...ypes.preResolveTypes.onlyOperationTypes.ts | 3 +- dev-test/test-schema/types.preResolveTypes.ts | 3 +- .../test-schema/typings.avoidOptionals.ts | 3 +- dev-test/test-schema/typings.enum.ts | 3 +- .../test-schema/typings.immutableTypes.ts | 3 +- dev-test/test-schema/typings.ts | 3 +- dev-test/test-schema/typings.wrapped.ts | 3 +- .../src/gql/fragment-masking.ts | 6 ++++ .../src/gql/graphql.ts | 3 +- .../src/gql/fragment-masking.ts | 6 ++++ .../persisted-documents/src/gql/graphql.ts | 3 +- .../react/apollo-client-defer/src/App.tsx | 13 ++++--- .../src/gql/fragment-masking.ts | 6 ++++ .../apollo-client-defer/src/gql/graphql.ts | 3 +- .../src/gql/fragment-masking.ts | 6 ++++ .../src/gql/graphql.ts | 3 +- .../apollo-client/src/gql/fragment-masking.ts | 6 ++++ .../react/apollo-client/src/gql/graphql.ts | 3 +- .../http-executor/src/gql/fragment-masking.ts | 6 ++++ .../react/http-executor/src/gql/graphql.ts | 3 +- .../react/nextjs-swr/gql/fragment-masking.ts | 6 ++++ examples/react/nextjs-swr/gql/graphql.ts | 3 +- .../src/gql/fragment-masking.ts | 6 ++++ .../tanstack-react-query/src/gql/graphql.ts | 3 +- .../react/urql/src/gql/fragment-masking.ts | 6 ++++ examples/react/urql/src/gql/graphql.ts | 3 +- .../src/gql/fragment-masking.ts | 6 ++++ examples/typescript-esm/src/gql/graphql.ts | 3 +- .../src/gql/fragment-masking.ts | 6 ++++ .../src/gql/graphql.ts | 3 +- .../typescript-resolvers/src/type-defs.d.ts | 3 +- .../src/gql/fragment-masking.ts | 6 ++++ .../vite/vite-react-cts/src/gql/graphql.ts | 3 +- .../src/gql/fragment-masking.ts | 6 ++++ .../vite/vite-react-mts/src/gql/graphql.ts | 3 +- .../vite-react-ts/src/gql/fragment-masking.ts | 6 ++++ .../vite/vite-react-ts/src/gql/graphql.ts | 3 +- .../src/gql/fragment-masking.ts | 6 ++++ .../vue/apollo-composable/src/gql/graphql.ts | 3 +- examples/vue/urql/src/gql/fragment-masking.ts | 6 ++++ examples/vue/urql/src/gql/graphql.ts | 3 +- .../vue/villus/src/gql/fragment-masking.ts | 6 ++++ examples/vue/villus/src/gql/graphql.ts | 3 +- .../yoga-tests/src/gql/fragment-masking.ts | 6 ++++ examples/yoga-tests/src/gql/graphql.ts | 3 +- .../__snapshots__/ts-documents.spec.ts.snap | 12 ++++--- .../operations/tests/ts-documents.spec.ts | 9 +++-- .../__snapshots__/ts-resolvers.spec.ts.snap | 6 ++-- .../typescript/typescript/src/visitor.ts | 8 ++++- .../client/src/fragment-masking-plugin.ts | 36 +++++++++++++++---- .../client/tests/client-preset.spec.ts | 36 +++++++++++++------ 81 files changed, 313 insertions(+), 91 deletions(-) diff --git a/dev-test/codegen.ts b/dev-test/codegen.ts index 29c4b79cc94..e0c97a1ba18 100644 --- a/dev-test/codegen.ts +++ b/dev-test/codegen.ts @@ -188,7 +188,7 @@ const config: CodegenConfig = { './dev-test/gql-tag-operations/gql': { schema: './dev-test/gql-tag-operations/schema.graphql', documents: './dev-test/gql-tag-operations/src/**/*.ts', - preset: 'gql-tag-operations-preset', + preset: 'client', }, './dev-test/gql-tag-operations/graphql/': { schema: './dev-test/gql-tag-operations/schema.graphql', @@ -198,19 +198,19 @@ const config: CodegenConfig = { './dev-test/gql-tag-operations-urql/gql': { schema: './dev-test/gql-tag-operations-urql/schema.graphql', documents: './dev-test/gql-tag-operations-urql/src/**/*.ts', - preset: 'gql-tag-operations-preset', + preset: 'client', presetConfig: { augmentedModuleName: '@urql/core' }, }, './dev-test/gql-tag-operations-masking/gql': { schema: './dev-test/gql-tag-operations-masking/schema.graphql', documents: './dev-test/gql-tag-operations-masking/src/**/*.tsx', - preset: 'gql-tag-operations-preset', + preset: 'client', presetConfig: { fragmentMasking: true }, }, './dev-test/gql-tag-operations-masking-star-wars/gql': { schema: './dev-test/gql-tag-operations-masking-star-wars/schema.json', documents: './dev-test/gql-tag-operations-masking-star-wars/src/**/*.tsx', - preset: 'gql-tag-operations-preset', + preset: 'client', presetConfig: { fragmentMasking: true }, }, }, diff --git a/dev-test/githunt/typed-document-nodes.ts b/dev-test/githunt/typed-document-nodes.ts index 70f0e1ef913..79f88651b19 100644 --- a/dev-test/githunt/typed-document-nodes.ts +++ b/dev-test/githunt/typed-document-nodes.ts @@ -5,7 +5,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/githunt/types.avoidOptionals.ts b/dev-test/githunt/types.avoidOptionals.ts index 50312a25cf8..d65ab789290 100644 --- a/dev-test/githunt/types.avoidOptionals.ts +++ b/dev-test/githunt/types.avoidOptionals.ts @@ -4,7 +4,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/githunt/types.d.ts b/dev-test/githunt/types.d.ts index 1252158cb20..10785977727 100644 --- a/dev-test/githunt/types.d.ts +++ b/dev-test/githunt/types.d.ts @@ -4,7 +4,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/githunt/types.enumsAsTypes.ts b/dev-test/githunt/types.enumsAsTypes.ts index 1252158cb20..10785977727 100644 --- a/dev-test/githunt/types.enumsAsTypes.ts +++ b/dev-test/githunt/types.enumsAsTypes.ts @@ -4,7 +4,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/githunt/types.flatten.preResolveTypes.ts b/dev-test/githunt/types.flatten.preResolveTypes.ts index 21c1d49f323..a772560c4ad 100644 --- a/dev-test/githunt/types.flatten.preResolveTypes.ts +++ b/dev-test/githunt/types.flatten.preResolveTypes.ts @@ -4,7 +4,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/githunt/types.immutableTypes.ts b/dev-test/githunt/types.immutableTypes.ts index 0eb9d59796e..dd9ff9ef216 100644 --- a/dev-test/githunt/types.immutableTypes.ts +++ b/dev-test/githunt/types.immutableTypes.ts @@ -4,7 +4,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/githunt/types.preResolveTypes.onlyOperationTypes.ts b/dev-test/githunt/types.preResolveTypes.onlyOperationTypes.ts index 687a7bcb636..a6752629dfd 100644 --- a/dev-test/githunt/types.preResolveTypes.onlyOperationTypes.ts +++ b/dev-test/githunt/types.preResolveTypes.onlyOperationTypes.ts @@ -4,7 +4,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/githunt/types.preResolveTypes.ts b/dev-test/githunt/types.preResolveTypes.ts index 072b05e97c7..d6a7f66985b 100644 --- a/dev-test/githunt/types.preResolveTypes.ts +++ b/dev-test/githunt/types.preResolveTypes.ts @@ -4,7 +4,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/githunt/types.ts b/dev-test/githunt/types.ts index 072b05e97c7..d6a7f66985b 100644 --- a/dev-test/githunt/types.ts +++ b/dev-test/githunt/types.ts @@ -4,7 +4,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/gql-tag-operations-masking-star-wars/gql/graphql.ts b/dev-test/gql-tag-operations-masking-star-wars/gql/graphql.ts index 794762649e9..a5fe55b5eda 100644 --- a/dev-test/gql-tag-operations-masking-star-wars/gql/graphql.ts +++ b/dev-test/gql-tag-operations-masking-star-wars/gql/graphql.ts @@ -6,7 +6,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/gql-tag-operations-masking/gql/graphql.ts b/dev-test/gql-tag-operations-masking/gql/graphql.ts index 40684942c8b..0b2d4574402 100644 --- a/dev-test/gql-tag-operations-masking/gql/graphql.ts +++ b/dev-test/gql-tag-operations-masking/gql/graphql.ts @@ -6,7 +6,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/gql-tag-operations-urql/gql/graphql.ts b/dev-test/gql-tag-operations-urql/gql/graphql.ts index c3aac9958f4..9ecb8265209 100644 --- a/dev-test/gql-tag-operations-urql/gql/graphql.ts +++ b/dev-test/gql-tag-operations-urql/gql/graphql.ts @@ -6,7 +6,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/gql-tag-operations/gql/graphql.ts b/dev-test/gql-tag-operations/gql/graphql.ts index c3aac9958f4..9ecb8265209 100644 --- a/dev-test/gql-tag-operations/gql/graphql.ts +++ b/dev-test/gql-tag-operations/gql/graphql.ts @@ -6,7 +6,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/gql-tag-operations/graphql/fragment-masking.ts b/dev-test/gql-tag-operations/graphql/fragment-masking.ts index dc2836d43e3..061b6de8911 100644 --- a/dev-test/gql-tag-operations/graphql/fragment-masking.ts +++ b/dev-test/gql-tag-operations/graphql/fragment-masking.ts @@ -1,4 +1,5 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import { Empty, Incremental } from './graphql.js'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -9,6 +10,11 @@ export type FragmentType> : never : never; +// return union with empty object if `fragmentType` is `Incremental +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: FragmentType, any>> | null | undefined +): TType | Empty | null | undefined; // return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, diff --git a/dev-test/gql-tag-operations/graphql/graphql.ts b/dev-test/gql-tag-operations/graphql/graphql.ts index 3acfd3a5c8e..b35215f46a6 100644 --- a/dev-test/gql-tag-operations/graphql/graphql.ts +++ b/dev-test/gql-tag-operations/graphql/graphql.ts @@ -6,7 +6,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/modules/types.ts b/dev-test/modules/types.ts index 36b19f26989..ee3505dcfd4 100644 --- a/dev-test/modules/types.ts +++ b/dev-test/modules/types.ts @@ -5,7 +5,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; export type Omit = Pick>; export type RequireFields = Omit & { [P in K]-?: NonNullable }; /** All built-in and custom scalars, mapped to their actual values */ diff --git a/dev-test/star-wars/types.avoidOptionals.ts b/dev-test/star-wars/types.avoidOptionals.ts index 3844a2e56d1..b38793f619c 100644 --- a/dev-test/star-wars/types.avoidOptionals.ts +++ b/dev-test/star-wars/types.avoidOptionals.ts @@ -4,7 +4,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/star-wars/types.d.ts b/dev-test/star-wars/types.d.ts index 02c1200bb73..546dc87a28f 100644 --- a/dev-test/star-wars/types.d.ts +++ b/dev-test/star-wars/types.d.ts @@ -4,7 +4,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/star-wars/types.globallyAvailable.d.ts b/dev-test/star-wars/types.globallyAvailable.d.ts index e5e274f37e1..e621c397bd1 100644 --- a/dev-test/star-wars/types.globallyAvailable.d.ts +++ b/dev-test/star-wars/types.globallyAvailable.d.ts @@ -4,7 +4,8 @@ type Exact = { [K in keyof T]: T[K] }; type MakeOptional = Omit & { [SubKey in K]?: Maybe }; type MakeMaybe = Omit & { [SubKey in K]: Maybe }; type MakeEmpty = { [_ in K]?: never }; -type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +type Empty = { [P in keyof T]?: never }; +type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ type Scalars = { ID: string; diff --git a/dev-test/star-wars/types.immutableTypes.ts b/dev-test/star-wars/types.immutableTypes.ts index 83e88b96989..7676d0cfb8a 100644 --- a/dev-test/star-wars/types.immutableTypes.ts +++ b/dev-test/star-wars/types.immutableTypes.ts @@ -4,7 +4,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/star-wars/types.preResolveTypes.onlyOperationTypes.ts b/dev-test/star-wars/types.preResolveTypes.onlyOperationTypes.ts index 09c5da6eaaa..0938495eec6 100644 --- a/dev-test/star-wars/types.preResolveTypes.onlyOperationTypes.ts +++ b/dev-test/star-wars/types.preResolveTypes.onlyOperationTypes.ts @@ -4,7 +4,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/star-wars/types.preResolveTypes.ts b/dev-test/star-wars/types.preResolveTypes.ts index 766128ab14a..97ed065ae9f 100644 --- a/dev-test/star-wars/types.preResolveTypes.ts +++ b/dev-test/star-wars/types.preResolveTypes.ts @@ -4,7 +4,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/star-wars/types.skipSchema.ts b/dev-test/star-wars/types.skipSchema.ts index 766128ab14a..97ed065ae9f 100644 --- a/dev-test/star-wars/types.skipSchema.ts +++ b/dev-test/star-wars/types.skipSchema.ts @@ -4,7 +4,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/star-wars/types.ts b/dev-test/star-wars/types.ts index 766128ab14a..97ed065ae9f 100644 --- a/dev-test/star-wars/types.ts +++ b/dev-test/star-wars/types.ts @@ -4,7 +4,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/test-schema/env.types.ts b/dev-test/test-schema/env.types.ts index f67a69a5cdc..0e0b5461426 100644 --- a/dev-test/test-schema/env.types.ts +++ b/dev-test/test-schema/env.types.ts @@ -4,7 +4,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/test-schema/resolvers-federation.ts b/dev-test/test-schema/resolvers-federation.ts index 56f351d5c55..f956ce6aa48 100644 --- a/dev-test/test-schema/resolvers-federation.ts +++ b/dev-test/test-schema/resolvers-federation.ts @@ -5,7 +5,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/test-schema/resolvers-root.ts b/dev-test/test-schema/resolvers-root.ts index 5f5ff6d7c79..05b7078c4cd 100644 --- a/dev-test/test-schema/resolvers-root.ts +++ b/dev-test/test-schema/resolvers-root.ts @@ -5,7 +5,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; export type RequireFields = Omit & { [P in K]-?: NonNullable }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { diff --git a/dev-test/test-schema/resolvers-stitching.ts b/dev-test/test-schema/resolvers-stitching.ts index 567a54eb937..5f0b7b095aa 100644 --- a/dev-test/test-schema/resolvers-stitching.ts +++ b/dev-test/test-schema/resolvers-stitching.ts @@ -5,7 +5,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; export type RequireFields = Omit & { [P in K]-?: NonNullable }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { diff --git a/dev-test/test-schema/resolvers-types.ts b/dev-test/test-schema/resolvers-types.ts index 787b065f01f..caa6ce2db56 100644 --- a/dev-test/test-schema/resolvers-types.ts +++ b/dev-test/test-schema/resolvers-types.ts @@ -5,7 +5,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; export type RequireFields = Omit & { [P in K]-?: NonNullable }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { diff --git a/dev-test/test-schema/types.preResolveTypes.onlyOperationTypes.ts b/dev-test/test-schema/types.preResolveTypes.onlyOperationTypes.ts index 9a2b2c0f6a5..32713f238d4 100644 --- a/dev-test/test-schema/types.preResolveTypes.onlyOperationTypes.ts +++ b/dev-test/test-schema/types.preResolveTypes.onlyOperationTypes.ts @@ -4,7 +4,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/test-schema/types.preResolveTypes.ts b/dev-test/test-schema/types.preResolveTypes.ts index b40f984afea..2567ae1ea76 100644 --- a/dev-test/test-schema/types.preResolveTypes.ts +++ b/dev-test/test-schema/types.preResolveTypes.ts @@ -4,7 +4,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/test-schema/typings.avoidOptionals.ts b/dev-test/test-schema/typings.avoidOptionals.ts index 636488e8678..84747e28e06 100644 --- a/dev-test/test-schema/typings.avoidOptionals.ts +++ b/dev-test/test-schema/typings.avoidOptionals.ts @@ -4,7 +4,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/test-schema/typings.enum.ts b/dev-test/test-schema/typings.enum.ts index 6593e71b258..20db33adc33 100644 --- a/dev-test/test-schema/typings.enum.ts +++ b/dev-test/test-schema/typings.enum.ts @@ -4,7 +4,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/test-schema/typings.immutableTypes.ts b/dev-test/test-schema/typings.immutableTypes.ts index a06e77ba8f6..99510d5823d 100644 --- a/dev-test/test-schema/typings.immutableTypes.ts +++ b/dev-test/test-schema/typings.immutableTypes.ts @@ -4,7 +4,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/test-schema/typings.ts b/dev-test/test-schema/typings.ts index 86643f49b50..04665196d4c 100644 --- a/dev-test/test-schema/typings.ts +++ b/dev-test/test-schema/typings.ts @@ -5,7 +5,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; export type RequireFields = Omit & { [P in K]-?: NonNullable }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { diff --git a/dev-test/test-schema/typings.wrapped.ts b/dev-test/test-schema/typings.wrapped.ts index c7022b5d5c7..75541025a15 100644 --- a/dev-test/test-schema/typings.wrapped.ts +++ b/dev-test/test-schema/typings.wrapped.ts @@ -5,7 +5,8 @@ declare namespace GraphQL { export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; + export type Empty = { [P in keyof T]?: never }; + export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts b/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts index dc2836d43e3..061b6de8911 100644 --- a/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts +++ b/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts @@ -1,4 +1,5 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import { Empty, Incremental } from './graphql.js'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -9,6 +10,11 @@ export type FragmentType> : never : never; +// return union with empty object if `fragmentType` is `Incremental +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: FragmentType, any>> | null | undefined +): TType | Empty | null | undefined; // return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, diff --git a/examples/persisted-documents-string-mode/src/gql/graphql.ts b/examples/persisted-documents-string-mode/src/gql/graphql.ts index 1567e577e42..21763f690ff 100644 --- a/examples/persisted-documents-string-mode/src/gql/graphql.ts +++ b/examples/persisted-documents-string-mode/src/gql/graphql.ts @@ -6,7 +6,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/persisted-documents/src/gql/fragment-masking.ts b/examples/persisted-documents/src/gql/fragment-masking.ts index dc2836d43e3..061b6de8911 100644 --- a/examples/persisted-documents/src/gql/fragment-masking.ts +++ b/examples/persisted-documents/src/gql/fragment-masking.ts @@ -1,4 +1,5 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import { Empty, Incremental } from './graphql.js'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -9,6 +10,11 @@ export type FragmentType> : never : never; +// return union with empty object if `fragmentType` is `Incremental +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: FragmentType, any>> | null | undefined +): TType | Empty | null | undefined; // return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, diff --git a/examples/persisted-documents/src/gql/graphql.ts b/examples/persisted-documents/src/gql/graphql.ts index 65cd5ccbb1a..bde0769a9bf 100644 --- a/examples/persisted-documents/src/gql/graphql.ts +++ b/examples/persisted-documents/src/gql/graphql.ts @@ -6,7 +6,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/react/apollo-client-defer/src/App.tsx b/examples/react/apollo-client-defer/src/App.tsx index 2933eae0e30..7498c5880db 100644 --- a/examples/react/apollo-client-defer/src/App.tsx +++ b/examples/react/apollo-client-defer/src/App.tsx @@ -1,7 +1,8 @@ import { useQuery } from '@apollo/client'; import './App.css'; -import { useFragment, graphql, FragmentType } from './gql'; +import { useFragment, graphql } from './gql'; +import { SlowFieldFragmentFragment } from './gql/graphql'; export const slowFieldFragment = graphql(/* GraphQL */ ` fragment SlowFieldFragment on Query { @@ -16,21 +17,19 @@ const alphabetQuery = graphql(/* GraphQL */ ` } `); -const SlowDataField = (props: { data: FragmentType }) => { - const fragment = useFragment(slowFieldFragment, props.data); - return

{fragment.slowField}

; +const SlowDataField = (props: { data: SlowFieldFragmentFragment }) => { + return

{props.data.slowField}

; }; function App() { const { data } = useQuery(alphabetQuery); + const slowData = useFragment(slowFieldFragment, data); return (
{data && ( <>

{data.fastField}

- {/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */} - {/* @ts-expect-error */} - + {slowData?.slowField && } )}
diff --git a/examples/react/apollo-client-defer/src/gql/fragment-masking.ts b/examples/react/apollo-client-defer/src/gql/fragment-masking.ts index dc2836d43e3..061b6de8911 100644 --- a/examples/react/apollo-client-defer/src/gql/fragment-masking.ts +++ b/examples/react/apollo-client-defer/src/gql/fragment-masking.ts @@ -1,4 +1,5 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import { Empty, Incremental } from './graphql.js'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -9,6 +10,11 @@ export type FragmentType> : never : never; +// return union with empty object if `fragmentType` is `Incremental +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: FragmentType, any>> | null | undefined +): TType | Empty | null | undefined; // return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, diff --git a/examples/react/apollo-client-defer/src/gql/graphql.ts b/examples/react/apollo-client-defer/src/gql/graphql.ts index a3fd6e53d47..ddf786e09f3 100644 --- a/examples/react/apollo-client-defer/src/gql/graphql.ts +++ b/examples/react/apollo-client-defer/src/gql/graphql.ts @@ -6,7 +6,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts b/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts index dc2836d43e3..061b6de8911 100644 --- a/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts +++ b/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts @@ -1,4 +1,5 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import { Empty, Incremental } from './graphql.js'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -9,6 +10,11 @@ export type FragmentType> : never : never; +// return union with empty object if `fragmentType` is `Incremental +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: FragmentType, any>> | null | undefined +): TType | Empty | null | undefined; // return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, diff --git a/examples/react/apollo-client-swc-plugin/src/gql/graphql.ts b/examples/react/apollo-client-swc-plugin/src/gql/graphql.ts index 30f063ade91..547f2d500cb 100644 --- a/examples/react/apollo-client-swc-plugin/src/gql/graphql.ts +++ b/examples/react/apollo-client-swc-plugin/src/gql/graphql.ts @@ -6,7 +6,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/react/apollo-client/src/gql/fragment-masking.ts b/examples/react/apollo-client/src/gql/fragment-masking.ts index dc2836d43e3..061b6de8911 100644 --- a/examples/react/apollo-client/src/gql/fragment-masking.ts +++ b/examples/react/apollo-client/src/gql/fragment-masking.ts @@ -1,4 +1,5 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import { Empty, Incremental } from './graphql.js'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -9,6 +10,11 @@ export type FragmentType> : never : never; +// return union with empty object if `fragmentType` is `Incremental +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: FragmentType, any>> | null | undefined +): TType | Empty | null | undefined; // return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, diff --git a/examples/react/apollo-client/src/gql/graphql.ts b/examples/react/apollo-client/src/gql/graphql.ts index 30f063ade91..547f2d500cb 100644 --- a/examples/react/apollo-client/src/gql/graphql.ts +++ b/examples/react/apollo-client/src/gql/graphql.ts @@ -6,7 +6,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/react/http-executor/src/gql/fragment-masking.ts b/examples/react/http-executor/src/gql/fragment-masking.ts index dc2836d43e3..061b6de8911 100644 --- a/examples/react/http-executor/src/gql/fragment-masking.ts +++ b/examples/react/http-executor/src/gql/fragment-masking.ts @@ -1,4 +1,5 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import { Empty, Incremental } from './graphql.js'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -9,6 +10,11 @@ export type FragmentType> : never : never; +// return union with empty object if `fragmentType` is `Incremental +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: FragmentType, any>> | null | undefined +): TType | Empty | null | undefined; // return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, diff --git a/examples/react/http-executor/src/gql/graphql.ts b/examples/react/http-executor/src/gql/graphql.ts index 30f063ade91..547f2d500cb 100644 --- a/examples/react/http-executor/src/gql/graphql.ts +++ b/examples/react/http-executor/src/gql/graphql.ts @@ -6,7 +6,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/react/nextjs-swr/gql/fragment-masking.ts b/examples/react/nextjs-swr/gql/fragment-masking.ts index dc2836d43e3..061b6de8911 100644 --- a/examples/react/nextjs-swr/gql/fragment-masking.ts +++ b/examples/react/nextjs-swr/gql/fragment-masking.ts @@ -1,4 +1,5 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import { Empty, Incremental } from './graphql.js'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -9,6 +10,11 @@ export type FragmentType> : never : never; +// return union with empty object if `fragmentType` is `Incremental +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: FragmentType, any>> | null | undefined +): TType | Empty | null | undefined; // return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, diff --git a/examples/react/nextjs-swr/gql/graphql.ts b/examples/react/nextjs-swr/gql/graphql.ts index dd9dc33d0fe..0249ab03132 100644 --- a/examples/react/nextjs-swr/gql/graphql.ts +++ b/examples/react/nextjs-swr/gql/graphql.ts @@ -6,7 +6,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/react/tanstack-react-query/src/gql/fragment-masking.ts b/examples/react/tanstack-react-query/src/gql/fragment-masking.ts index dc2836d43e3..061b6de8911 100644 --- a/examples/react/tanstack-react-query/src/gql/fragment-masking.ts +++ b/examples/react/tanstack-react-query/src/gql/fragment-masking.ts @@ -1,4 +1,5 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import { Empty, Incremental } from './graphql.js'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -9,6 +10,11 @@ export type FragmentType> : never : never; +// return union with empty object if `fragmentType` is `Incremental +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: FragmentType, any>> | null | undefined +): TType | Empty | null | undefined; // return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, diff --git a/examples/react/tanstack-react-query/src/gql/graphql.ts b/examples/react/tanstack-react-query/src/gql/graphql.ts index 05175cce48f..b2f97130f3a 100644 --- a/examples/react/tanstack-react-query/src/gql/graphql.ts +++ b/examples/react/tanstack-react-query/src/gql/graphql.ts @@ -6,7 +6,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/react/urql/src/gql/fragment-masking.ts b/examples/react/urql/src/gql/fragment-masking.ts index dc2836d43e3..061b6de8911 100644 --- a/examples/react/urql/src/gql/fragment-masking.ts +++ b/examples/react/urql/src/gql/fragment-masking.ts @@ -1,4 +1,5 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import { Empty, Incremental } from './graphql.js'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -9,6 +10,11 @@ export type FragmentType> : never : never; +// return union with empty object if `fragmentType` is `Incremental +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: FragmentType, any>> | null | undefined +): TType | Empty | null | undefined; // return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, diff --git a/examples/react/urql/src/gql/graphql.ts b/examples/react/urql/src/gql/graphql.ts index 64c7d663253..5e6513aab67 100644 --- a/examples/react/urql/src/gql/graphql.ts +++ b/examples/react/urql/src/gql/graphql.ts @@ -6,7 +6,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/typescript-esm/src/gql/fragment-masking.ts b/examples/typescript-esm/src/gql/fragment-masking.ts index dc2836d43e3..061b6de8911 100644 --- a/examples/typescript-esm/src/gql/fragment-masking.ts +++ b/examples/typescript-esm/src/gql/fragment-masking.ts @@ -1,4 +1,5 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import { Empty, Incremental } from './graphql.js'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -9,6 +10,11 @@ export type FragmentType> : never : never; +// return union with empty object if `fragmentType` is `Incremental +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: FragmentType, any>> | null | undefined +): TType | Empty | null | undefined; // return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, diff --git a/examples/typescript-esm/src/gql/graphql.ts b/examples/typescript-esm/src/gql/graphql.ts index 5311b1361a8..0345d4e4e9d 100644 --- a/examples/typescript-esm/src/gql/graphql.ts +++ b/examples/typescript-esm/src/gql/graphql.ts @@ -6,7 +6,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/typescript-graphql-request/src/gql/fragment-masking.ts b/examples/typescript-graphql-request/src/gql/fragment-masking.ts index dc2836d43e3..061b6de8911 100644 --- a/examples/typescript-graphql-request/src/gql/fragment-masking.ts +++ b/examples/typescript-graphql-request/src/gql/fragment-masking.ts @@ -1,4 +1,5 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import { Empty, Incremental } from './graphql.js'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -9,6 +10,11 @@ export type FragmentType> : never : never; +// return union with empty object if `fragmentType` is `Incremental +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: FragmentType, any>> | null | undefined +): TType | Empty | null | undefined; // return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, diff --git a/examples/typescript-graphql-request/src/gql/graphql.ts b/examples/typescript-graphql-request/src/gql/graphql.ts index 50bba8062e0..0ad80338b4c 100644 --- a/examples/typescript-graphql-request/src/gql/graphql.ts +++ b/examples/typescript-graphql-request/src/gql/graphql.ts @@ -6,7 +6,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/typescript-resolvers/src/type-defs.d.ts b/examples/typescript-resolvers/src/type-defs.d.ts index e87802289ac..3cf01c4fb8c 100644 --- a/examples/typescript-resolvers/src/type-defs.d.ts +++ b/examples/typescript-resolvers/src/type-defs.d.ts @@ -5,7 +5,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; export type RequireFields = Omit & { [P in K]-?: NonNullable }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { diff --git a/examples/vite/vite-react-cts/src/gql/fragment-masking.ts b/examples/vite/vite-react-cts/src/gql/fragment-masking.ts index dc2836d43e3..061b6de8911 100644 --- a/examples/vite/vite-react-cts/src/gql/fragment-masking.ts +++ b/examples/vite/vite-react-cts/src/gql/fragment-masking.ts @@ -1,4 +1,5 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import { Empty, Incremental } from './graphql.js'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -9,6 +10,11 @@ export type FragmentType> : never : never; +// return union with empty object if `fragmentType` is `Incremental +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: FragmentType, any>> | null | undefined +): TType | Empty | null | undefined; // return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, diff --git a/examples/vite/vite-react-cts/src/gql/graphql.ts b/examples/vite/vite-react-cts/src/gql/graphql.ts index dd9dc33d0fe..0249ab03132 100644 --- a/examples/vite/vite-react-cts/src/gql/graphql.ts +++ b/examples/vite/vite-react-cts/src/gql/graphql.ts @@ -6,7 +6,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/vite/vite-react-mts/src/gql/fragment-masking.ts b/examples/vite/vite-react-mts/src/gql/fragment-masking.ts index dc2836d43e3..061b6de8911 100644 --- a/examples/vite/vite-react-mts/src/gql/fragment-masking.ts +++ b/examples/vite/vite-react-mts/src/gql/fragment-masking.ts @@ -1,4 +1,5 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import { Empty, Incremental } from './graphql.js'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -9,6 +10,11 @@ export type FragmentType> : never : never; +// return union with empty object if `fragmentType` is `Incremental +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: FragmentType, any>> | null | undefined +): TType | Empty | null | undefined; // return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, diff --git a/examples/vite/vite-react-mts/src/gql/graphql.ts b/examples/vite/vite-react-mts/src/gql/graphql.ts index dd9dc33d0fe..0249ab03132 100644 --- a/examples/vite/vite-react-mts/src/gql/graphql.ts +++ b/examples/vite/vite-react-mts/src/gql/graphql.ts @@ -6,7 +6,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/vite/vite-react-ts/src/gql/fragment-masking.ts b/examples/vite/vite-react-ts/src/gql/fragment-masking.ts index dc2836d43e3..061b6de8911 100644 --- a/examples/vite/vite-react-ts/src/gql/fragment-masking.ts +++ b/examples/vite/vite-react-ts/src/gql/fragment-masking.ts @@ -1,4 +1,5 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import { Empty, Incremental } from './graphql.js'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -9,6 +10,11 @@ export type FragmentType> : never : never; +// return union with empty object if `fragmentType` is `Incremental +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: FragmentType, any>> | null | undefined +): TType | Empty | null | undefined; // return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, diff --git a/examples/vite/vite-react-ts/src/gql/graphql.ts b/examples/vite/vite-react-ts/src/gql/graphql.ts index dd9dc33d0fe..0249ab03132 100644 --- a/examples/vite/vite-react-ts/src/gql/graphql.ts +++ b/examples/vite/vite-react-ts/src/gql/graphql.ts @@ -6,7 +6,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/vue/apollo-composable/src/gql/fragment-masking.ts b/examples/vue/apollo-composable/src/gql/fragment-masking.ts index bb601eea66b..b511a23813e 100644 --- a/examples/vue/apollo-composable/src/gql/fragment-masking.ts +++ b/examples/vue/apollo-composable/src/gql/fragment-masking.ts @@ -1,4 +1,5 @@ import type { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import type { Empty, Incremental } from './graphql.js'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -9,6 +10,11 @@ export type FragmentType> : never : never; +// return union with empty object if `fragmentType` is `Incremental +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: FragmentType, any>> | null | undefined +): TType | Empty | null | undefined; // return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, diff --git a/examples/vue/apollo-composable/src/gql/graphql.ts b/examples/vue/apollo-composable/src/gql/graphql.ts index 43b9f1e46c2..8cd3683c51c 100644 --- a/examples/vue/apollo-composable/src/gql/graphql.ts +++ b/examples/vue/apollo-composable/src/gql/graphql.ts @@ -6,7 +6,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/vue/urql/src/gql/fragment-masking.ts b/examples/vue/urql/src/gql/fragment-masking.ts index bb601eea66b..b511a23813e 100644 --- a/examples/vue/urql/src/gql/fragment-masking.ts +++ b/examples/vue/urql/src/gql/fragment-masking.ts @@ -1,4 +1,5 @@ import type { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import type { Empty, Incremental } from './graphql.js'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -9,6 +10,11 @@ export type FragmentType> : never : never; +// return union with empty object if `fragmentType` is `Incremental +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: FragmentType, any>> | null | undefined +): TType | Empty | null | undefined; // return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, diff --git a/examples/vue/urql/src/gql/graphql.ts b/examples/vue/urql/src/gql/graphql.ts index 43b9f1e46c2..8cd3683c51c 100644 --- a/examples/vue/urql/src/gql/graphql.ts +++ b/examples/vue/urql/src/gql/graphql.ts @@ -6,7 +6,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/vue/villus/src/gql/fragment-masking.ts b/examples/vue/villus/src/gql/fragment-masking.ts index bb601eea66b..b511a23813e 100644 --- a/examples/vue/villus/src/gql/fragment-masking.ts +++ b/examples/vue/villus/src/gql/fragment-masking.ts @@ -1,4 +1,5 @@ import type { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import type { Empty, Incremental } from './graphql.js'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -9,6 +10,11 @@ export type FragmentType> : never : never; +// return union with empty object if `fragmentType` is `Incremental +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: FragmentType, any>> | null | undefined +): TType | Empty | null | undefined; // return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, diff --git a/examples/vue/villus/src/gql/graphql.ts b/examples/vue/villus/src/gql/graphql.ts index 43b9f1e46c2..8cd3683c51c 100644 --- a/examples/vue/villus/src/gql/graphql.ts +++ b/examples/vue/villus/src/gql/graphql.ts @@ -6,7 +6,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/yoga-tests/src/gql/fragment-masking.ts b/examples/yoga-tests/src/gql/fragment-masking.ts index dc2836d43e3..061b6de8911 100644 --- a/examples/yoga-tests/src/gql/fragment-masking.ts +++ b/examples/yoga-tests/src/gql/fragment-masking.ts @@ -1,4 +1,5 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import { Empty, Incremental } from './graphql.js'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -9,6 +10,11 @@ export type FragmentType> : never : never; +// return union with empty object if `fragmentType` is `Incremental +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: FragmentType, any>> | null | undefined +): TType | Empty | null | undefined; // return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, diff --git a/examples/yoga-tests/src/gql/graphql.ts b/examples/yoga-tests/src/gql/graphql.ts index d9d418ee729..a0ff73cdea7 100644 --- a/examples/yoga-tests/src/gql/graphql.ts +++ b/examples/yoga-tests/src/gql/graphql.ts @@ -6,7 +6,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/packages/plugins/typescript/operations/tests/__snapshots__/ts-documents.spec.ts.snap b/packages/plugins/typescript/operations/tests/__snapshots__/ts-documents.spec.ts.snap index 0c6fea9bae0..6c2090b6654 100644 --- a/packages/plugins/typescript/operations/tests/__snapshots__/ts-documents.spec.ts.snap +++ b/packages/plugins/typescript/operations/tests/__snapshots__/ts-documents.spec.ts.snap @@ -70,7 +70,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -361,7 +362,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -479,7 +481,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -574,7 +577,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/packages/plugins/typescript/operations/tests/ts-documents.spec.ts b/packages/plugins/typescript/operations/tests/ts-documents.spec.ts index e2c97dffd6b..4d0726266b3 100644 --- a/packages/plugins/typescript/operations/tests/ts-documents.spec.ts +++ b/packages/plugins/typescript/operations/tests/ts-documents.spec.ts @@ -4050,7 +4050,8 @@ describe('TypeScript Operations Plugin', () => { export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; + export type Empty = { [P in keyof T]?: never }; + export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -4160,7 +4161,8 @@ describe('TypeScript Operations Plugin', () => { export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; + export type Empty = { [P in keyof T]?: never }; + export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -4248,7 +4250,8 @@ describe('TypeScript Operations Plugin', () => { export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; + export type Empty = { [P in keyof T]?: never }; + export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/packages/plugins/typescript/resolvers/tests/__snapshots__/ts-resolvers.spec.ts.snap b/packages/plugins/typescript/resolvers/tests/__snapshots__/ts-resolvers.spec.ts.snap index 25cfcda5f63..b28bd58329d 100644 --- a/packages/plugins/typescript/resolvers/tests/__snapshots__/ts-resolvers.spec.ts.snap +++ b/packages/plugins/typescript/resolvers/tests/__snapshots__/ts-resolvers.spec.ts.snap @@ -7,7 +7,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; import { GraphQLResolveInfo, GraphQLScalarType, GraphQLScalarTypeConfig } from 'graphql'; export type Omit = Pick>; export type RequireFields = Omit & { [P in K]-?: NonNullable }; @@ -481,7 +482,8 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; +export type Empty = { [P in keyof T]?: never }; +export type Incremental = T & { ' $defer': true }; import { GraphQLResolveInfo, GraphQLScalarType, GraphQLScalarTypeConfig } from 'graphql'; export type Omit = Pick>; export type RequireFields = Omit & { [P in K]-?: NonNullable }; diff --git a/packages/plugins/typescript/typescript/src/visitor.ts b/packages/plugins/typescript/typescript/src/visitor.ts index 4364e386dfb..c1bbd6150dc 100644 --- a/packages/plugins/typescript/typescript/src/visitor.ts +++ b/packages/plugins/typescript/typescript/src/visitor.ts @@ -50,7 +50,8 @@ export const EXACT_SIGNATURE = `type Exact export const MAKE_OPTIONAL_SIGNATURE = `type MakeOptional = Omit & { [SubKey in K]?: Maybe };`; export const MAKE_MAYBE_SIGNATURE = `type MakeMaybe = Omit & { [SubKey in K]: Maybe };`; export const MAKE_EMPTY_SIGNATURE = `type MakeEmpty = { [_ in K]?: never };`; -export const MAKE_INCREMENTAL_SIGNATURE = `type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never };`; +export const MAKE_ALL_EMPTY_SIGNATURE = `type Empty = { [P in keyof T]?: never };`; +export const MAKE_INCREMENTAL_SIGNATURE = `type Incremental = T & { ' $defer': true };`; export class TsVisitor< TRawConfig extends TypeScriptPluginConfig = TypeScriptPluginConfig, @@ -162,6 +163,7 @@ export class TsVisitor< this.getMakeOptionalDefinition(), this.getMakeMaybeDefinition(), this.getMakeEmptyDefinition(), + this.getMakeAllEmptyDefinition(), this.getIncrementalDefinition(), ]; @@ -195,6 +197,10 @@ export class TsVisitor< return `${this.getExportPrefix()}${MAKE_EMPTY_SIGNATURE}`; } + public getMakeAllEmptyDefinition(): string { + return `${this.getExportPrefix()}${MAKE_ALL_EMPTY_SIGNATURE}`; + } + public getIncrementalDefinition(): string { return `${this.getExportPrefix()}${MAKE_INCREMENTAL_SIGNATURE}`; } diff --git a/packages/presets/client/src/fragment-masking-plugin.ts b/packages/presets/client/src/fragment-masking-plugin.ts index df1224c21ce..13853ed4cae 100644 --- a/packages/presets/client/src/fragment-masking-plugin.ts +++ b/packages/presets/client/src/fragment-masking-plugin.ts @@ -22,24 +22,42 @@ export function makeFragmentData< const defaultUnmaskFunctionName = 'useFragment'; -const modifyType = (rawType: string, opts: { nullable: boolean; list: 'with-list' | 'only-list' | false }) => - `${ +const modifyType = ( + initialRawType: string, + opts: { nullable: boolean; list: 'with-list' | 'only-list' | false; empty?: boolean } +) => { + let rawType = initialRawType; + if (opts.empty) { + rawType = `${initialRawType} | Empty<${initialRawType}>`; + } + return `${ opts.list === 'only-list' ? `ReadonlyArray<${rawType}>` : opts.list === 'with-list' ? `${rawType} | ReadonlyArray<${rawType}>` : rawType }${opts.nullable ? ' | null | undefined' : ''}`; +}; const createUnmaskFunctionTypeDefinition = ( unmaskFunctionName = defaultUnmaskFunctionName, - opts: { nullable: boolean; list: 'with-list' | 'only-list' | false } -) => `export function ${unmaskFunctionName}( + opts: { nullable: boolean; list: 'with-list' | 'only-list' | false }, + empty?: boolean +) => { + const tType = empty ? 'Incremental' : 'TType'; + + return `export function ${unmaskFunctionName}( _documentNode: DocumentTypeDecoration, - fragmentType: ${modifyType('FragmentType>', opts)} -): ${modifyType('TType', opts)}`; + fragmentType: ${modifyType(`FragmentType>`, opts)} +): ${modifyType('TType', { ...opts, empty })}`; +}; const createUnmaskFunctionTypeDefinitions = (unmaskFunctionName = defaultUnmaskFunctionName) => [ + `// return union with empty object if \`fragmentType\` is \`Incremental\n${createUnmaskFunctionTypeDefinition( + unmaskFunctionName, + { nullable: true, list: false }, + true + )}`, `// return non-nullable if \`fragmentType\` is non-nullable\n${createUnmaskFunctionTypeDefinition( unmaskFunctionName, { nullable: false, list: false } @@ -78,9 +96,15 @@ export const plugin: PluginFunction<{ useTypeImports ? 'import type' : 'import' } { ResultOf, DocumentTypeDecoration, } from '@graphql-typed-document-node/core';\n`; + const emitLegacyCommonJSImports = true; // todo + const typeHelpersImport = `${useTypeImports ? 'import type' : 'import'} { Empty, Incremental } from './graphql${ + emitLegacyCommonJSImports ? '' : '.js' + }';\n`; + if (augmentedModuleName == null) { return [ documentNodeImport, + typeHelpersImport, `\n`, fragmentTypeHelper, `\n`, diff --git a/packages/presets/client/tests/client-preset.spec.ts b/packages/presets/client/tests/client-preset.spec.ts index 5eb339cebe1..597c0441a4c 100644 --- a/packages/presets/client/tests/client-preset.spec.ts +++ b/packages/presets/client/tests/client-preset.spec.ts @@ -344,7 +344,8 @@ export * from "./gql";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; + export type Empty = { [P in keyof T]?: never }; + export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -474,7 +475,8 @@ export * from "./gql";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; + export type Empty = { [P in keyof T]?: never }; + export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -587,7 +589,8 @@ export * from "./gql";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; + export type Empty = { [P in keyof T]?: never }; + export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -755,6 +758,7 @@ export * from "./gql";`); const gqlFile = result.find(file => file.filename === 'out1/fragment-masking.ts'); expect(gqlFile.content).toMatchInlineSnapshot(` "import { ResultOf, DocumentTypeDecoration, } from '@graphql-typed-document-node/core'; + import { Empty, Incremental } from './graphql.js'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration< @@ -768,6 +772,11 @@ export * from "./gql";`); : never : never; + // return union with empty object if \`fragmentType\` is \`Incremental + export function iLikeTurtles( + _documentNode: DocumentTypeDecoration, + fragmentType: FragmentType, any>> | null | undefined + ): TType | Empty | null | undefined; // return non-nullable if \`fragmentType\` is non-nullable export function iLikeTurtles( _documentNode: DocumentTypeDecoration, @@ -1234,7 +1243,8 @@ export * from "./gql.js";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; + export type Empty = { [P in keyof T]?: never }; + export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -1312,7 +1322,8 @@ export * from "./gql.js";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; + export type Empty = { [P in keyof T]?: never }; + export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -1393,7 +1404,8 @@ export * from "./gql.js";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; + export type Empty = { [P in keyof T]?: never }; + export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -1474,7 +1486,8 @@ export * from "./gql.js";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; + export type Empty = { [P in keyof T]?: never }; + export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -1557,7 +1570,8 @@ export * from "./gql.js";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; + export type Empty = { [P in keyof T]?: never }; + export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -1647,7 +1661,8 @@ export * from "./gql.js";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; + export type Empty = { [P in keyof T]?: never }; + export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -1728,7 +1743,8 @@ export * from "./gql.js";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = { [P in keyof T]: T[P] } | { [P in keyof T]?: never }; + export type Empty = { [P in keyof T]?: never }; + export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; From 6c79bad855e5367aa919603ae4e402cf76a88274 Mon Sep 17 00:00:00 2001 From: beerose Date: Thu, 23 Mar 2023 12:34:21 +0100 Subject: [PATCH 20/47] Update examples --- dev-test/codegen.ts | 8 +-- .../gql/fragment-masking.ts | 53 +++++++++------- .../gql/gql.ts | 16 ++--- .../gql/index.ts | 2 +- .../gql/fragment-masking.ts | 53 +++++++++------- .../gql-tag-operations-masking/gql/gql.ts | 24 +++---- .../gql-tag-operations-masking/gql/index.ts | 2 +- .../gql/fragment-masking.ts | 54 ++++++++++++++++ dev-test/gql-tag-operations-urql/gql/gql.ts | 63 +++++++++++++++++++ .../gql-tag-operations-urql/gql/graphql.ts | 6 +- dev-test/gql-tag-operations-urql/gql/index.ts | 2 + .../gql/fragment-masking.ts | 54 ++++++++++++++++ dev-test/gql-tag-operations/gql/gql.ts | 20 +++--- dev-test/gql-tag-operations/gql/graphql.ts | 6 +- dev-test/gql-tag-operations/gql/index.ts | 1 + .../graphql/fragment-masking.ts | 2 +- .../src/gql/fragment-masking.ts | 2 +- .../src/gql/fragment-masking.ts | 2 +- .../src/gql/fragment-masking.ts | 2 +- .../src/gql/fragment-masking.ts | 2 +- .../apollo-client/src/gql/fragment-masking.ts | 2 +- .../http-executor/src/gql/fragment-masking.ts | 2 +- .../react/nextjs-swr/gql/fragment-masking.ts | 2 +- .../src/gql/fragment-masking.ts | 2 +- .../react/urql/src/gql/fragment-masking.ts | 2 +- .../src/gql/fragment-masking.ts | 2 +- .../src/gql/fragment-masking.ts | 2 +- .../src/gql/fragment-masking.ts | 2 +- .../src/gql/fragment-masking.ts | 2 +- .../vite-react-ts/src/gql/fragment-masking.ts | 2 +- .../src/gql/fragment-masking.ts | 2 +- examples/vue/urql/src/gql/fragment-masking.ts | 2 +- .../vue/villus/src/gql/fragment-masking.ts | 2 +- .../yoga-tests/src/gql/fragment-masking.ts | 2 +- .../pre-resolve-types.ts | 3 +- .../client/tests/client-preset.spec.ts | 2 +- 36 files changed, 303 insertions(+), 104 deletions(-) create mode 100644 dev-test/gql-tag-operations-urql/gql/fragment-masking.ts create mode 100644 dev-test/gql-tag-operations-urql/gql/gql.ts create mode 100644 dev-test/gql-tag-operations-urql/gql/index.ts create mode 100644 dev-test/gql-tag-operations/gql/fragment-masking.ts diff --git a/dev-test/codegen.ts b/dev-test/codegen.ts index e0c97a1ba18..cdde5fb34cc 100644 --- a/dev-test/codegen.ts +++ b/dev-test/codegen.ts @@ -185,7 +185,7 @@ const config: CodegenConfig = { documents: './dev-test/star-wars/**/*.graphql', plugins: ['typescript', 'typescript-operations'], }, - './dev-test/gql-tag-operations/gql': { + './dev-test/gql-tag-operations/gql/': { schema: './dev-test/gql-tag-operations/schema.graphql', documents: './dev-test/gql-tag-operations/src/**/*.ts', preset: 'client', @@ -195,19 +195,19 @@ const config: CodegenConfig = { documents: './dev-test/gql-tag-operations/src/**/*.ts', preset: 'client', }, - './dev-test/gql-tag-operations-urql/gql': { + './dev-test/gql-tag-operations-urql/gql/': { schema: './dev-test/gql-tag-operations-urql/schema.graphql', documents: './dev-test/gql-tag-operations-urql/src/**/*.ts', preset: 'client', presetConfig: { augmentedModuleName: '@urql/core' }, }, - './dev-test/gql-tag-operations-masking/gql': { + './dev-test/gql-tag-operations-masking/gql/': { schema: './dev-test/gql-tag-operations-masking/schema.graphql', documents: './dev-test/gql-tag-operations-masking/src/**/*.tsx', preset: 'client', presetConfig: { fragmentMasking: true }, }, - './dev-test/gql-tag-operations-masking-star-wars/gql': { + './dev-test/gql-tag-operations-masking-star-wars/gql/': { schema: './dev-test/gql-tag-operations-masking-star-wars/schema.json', documents: './dev-test/gql-tag-operations-masking-star-wars/src/**/*.tsx', preset: 'client', diff --git a/dev-test/gql-tag-operations-masking-star-wars/gql/fragment-masking.ts b/dev-test/gql-tag-operations-masking-star-wars/gql/fragment-masking.ts index 0c3d1311f04..99734b9d4ee 100644 --- a/dev-test/gql-tag-operations-masking-star-wars/gql/fragment-masking.ts +++ b/dev-test/gql-tag-operations-masking-star-wars/gql/fragment-masking.ts @@ -1,43 +1,54 @@ -import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core'; +import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import { Empty, Incremental } from './graphql'; -export type FragmentType> = TDocumentType extends DocumentNode< - infer TType, - any -> - ? TType extends { ' $fragmentName'?: infer TKey } - ? TKey extends string - ? { ' $fragmentRefs'?: { [key in TKey]: TType } } +export type FragmentType> = + TDocumentType extends DocumentTypeDecoration + ? TType extends { ' $fragmentName'?: infer TKey } + ? TKey extends string + ? { ' $fragmentRefs'?: { [key in TKey]: TType } } + : never : never - : never - : never; + : never; +// return union with empty object if `fragmentType` is `Incremental +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: FragmentType, any>> | null | undefined +): TType | Empty | null | undefined; // return non-nullable if `fragmentType` is non-nullable export function useFragment( - _documentNode: DocumentNode, - fragmentType: FragmentType> + _documentNode: DocumentTypeDecoration, + fragmentType: FragmentType> ): TType; // return nullable if `fragmentType` is nullable export function useFragment( - _documentNode: DocumentNode, - fragmentType: FragmentType> | null | undefined + _documentNode: DocumentTypeDecoration, + fragmentType: FragmentType> | null | undefined ): TType | null | undefined; // return array of non-nullable if `fragmentType` is array of non-nullable export function useFragment( - _documentNode: DocumentNode, - fragmentType: ReadonlyArray>> + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray>> ): ReadonlyArray; // return array of nullable if `fragmentType` is array of nullable export function useFragment( - _documentNode: DocumentNode, - fragmentType: ReadonlyArray>> | null | undefined + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray>> | null | undefined ): ReadonlyArray | null | undefined; export function useFragment( - _documentNode: DocumentNode, + _documentNode: DocumentTypeDecoration, fragmentType: - | FragmentType> - | ReadonlyArray>> + | FragmentType> + | ReadonlyArray>> | null | undefined ): TType | ReadonlyArray | null | undefined { return fragmentType as any; } + +export function makeFragmentData, FT extends ResultOf>( + data: FT, + _fragment: F +): FragmentType { + return data as FragmentType; +} diff --git a/dev-test/gql-tag-operations-masking-star-wars/gql/gql.ts b/dev-test/gql-tag-operations-masking-star-wars/gql/gql.ts index 22dbf7ef01f..78ccc934f45 100644 --- a/dev-test/gql-tag-operations-masking-star-wars/gql/gql.ts +++ b/dev-test/gql-tag-operations-masking-star-wars/gql/gql.ts @@ -20,33 +20,33 @@ const documents = { }; /** - * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. * * * @example * ```ts - * const query = gql(`query GetUser($id: ID!) { user(id: $id) { name } }`); + * const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`); * ``` * * The query argument is unknown! * Please regenerate the types. */ -export function gql(source: string): unknown; +export function graphql(source: string): unknown; /** - * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function gql( +export function graphql( source: '\n query HeroDetailsWithFragment($episode: Episode) {\n hero(episode: $episode) {\n ...HeroDetails\n }\n }\n' ): (typeof documents)['\n query HeroDetailsWithFragment($episode: Episode) {\n hero(episode: $episode) {\n ...HeroDetails\n }\n }\n']; /** - * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function gql( +export function graphql( source: '\n fragment HeroDetails on Character {\n __typename\n name\n ... on Human {\n height\n }\n ... on Droid {\n primaryFunction\n }\n }\n' ): (typeof documents)['\n fragment HeroDetails on Character {\n __typename\n name\n ... on Human {\n height\n }\n ... on Droid {\n primaryFunction\n }\n }\n']; -export function gql(source: string) { +export function graphql(source: string) { return (documents as any)[source] ?? {}; } diff --git a/dev-test/gql-tag-operations-masking-star-wars/gql/index.ts b/dev-test/gql-tag-operations-masking-star-wars/gql/index.ts index 0fa85dc2148..873144cb2ce 100644 --- a/dev-test/gql-tag-operations-masking-star-wars/gql/index.ts +++ b/dev-test/gql-tag-operations-masking-star-wars/gql/index.ts @@ -1,2 +1,2 @@ -export * from './gql.js'; export * from './fragment-masking.js'; +export * from './gql.js'; diff --git a/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts b/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts index 0c3d1311f04..99734b9d4ee 100644 --- a/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts +++ b/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts @@ -1,43 +1,54 @@ -import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core'; +import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import { Empty, Incremental } from './graphql'; -export type FragmentType> = TDocumentType extends DocumentNode< - infer TType, - any -> - ? TType extends { ' $fragmentName'?: infer TKey } - ? TKey extends string - ? { ' $fragmentRefs'?: { [key in TKey]: TType } } +export type FragmentType> = + TDocumentType extends DocumentTypeDecoration + ? TType extends { ' $fragmentName'?: infer TKey } + ? TKey extends string + ? { ' $fragmentRefs'?: { [key in TKey]: TType } } + : never : never - : never - : never; + : never; +// return union with empty object if `fragmentType` is `Incremental +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: FragmentType, any>> | null | undefined +): TType | Empty | null | undefined; // return non-nullable if `fragmentType` is non-nullable export function useFragment( - _documentNode: DocumentNode, - fragmentType: FragmentType> + _documentNode: DocumentTypeDecoration, + fragmentType: FragmentType> ): TType; // return nullable if `fragmentType` is nullable export function useFragment( - _documentNode: DocumentNode, - fragmentType: FragmentType> | null | undefined + _documentNode: DocumentTypeDecoration, + fragmentType: FragmentType> | null | undefined ): TType | null | undefined; // return array of non-nullable if `fragmentType` is array of non-nullable export function useFragment( - _documentNode: DocumentNode, - fragmentType: ReadonlyArray>> + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray>> ): ReadonlyArray; // return array of nullable if `fragmentType` is array of nullable export function useFragment( - _documentNode: DocumentNode, - fragmentType: ReadonlyArray>> | null | undefined + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray>> | null | undefined ): ReadonlyArray | null | undefined; export function useFragment( - _documentNode: DocumentNode, + _documentNode: DocumentTypeDecoration, fragmentType: - | FragmentType> - | ReadonlyArray>> + | FragmentType> + | ReadonlyArray>> | null | undefined ): TType | ReadonlyArray | null | undefined { return fragmentType as any; } + +export function makeFragmentData, FT extends ResultOf>( + data: FT, + _fragment: F +): FragmentType { + return data as FragmentType; +} diff --git a/dev-test/gql-tag-operations-masking/gql/gql.ts b/dev-test/gql-tag-operations-masking/gql/gql.ts index ef022a8f9be..24123883ee0 100644 --- a/dev-test/gql-tag-operations-masking/gql/gql.ts +++ b/dev-test/gql-tag-operations-masking/gql/gql.ts @@ -23,45 +23,45 @@ const documents = { }; /** - * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. * * * @example * ```ts - * const query = gql(`query GetUser($id: ID!) { user(id: $id) { name } }`); + * const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`); * ``` * * The query argument is unknown! * Please regenerate the types. */ -export function gql(source: string): unknown; +export function graphql(source: string): unknown; /** - * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function gql( +export function graphql( source: '\n fragment TweetFragment on Tweet {\n id\n body\n ...TweetAuthorFragment\n }\n' ): (typeof documents)['\n fragment TweetFragment on Tweet {\n id\n body\n ...TweetAuthorFragment\n }\n']; /** - * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function gql( +export function graphql( source: '\n fragment TweetAuthorFragment on Tweet {\n id\n author {\n id\n username\n }\n }\n' ): (typeof documents)['\n fragment TweetAuthorFragment on Tweet {\n id\n author {\n id\n username\n }\n }\n']; /** - * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function gql( +export function graphql( source: '\n fragment TweetsFragment on Query {\n Tweets {\n id\n ...TweetFragment\n }\n }\n' ): (typeof documents)['\n fragment TweetsFragment on Query {\n Tweets {\n id\n ...TweetFragment\n }\n }\n']; /** - * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function gql( +export function graphql( source: '\n query TweetAppQuery {\n ...TweetsFragment\n }\n' ): (typeof documents)['\n query TweetAppQuery {\n ...TweetsFragment\n }\n']; -export function gql(source: string) { +export function graphql(source: string) { return (documents as any)[source] ?? {}; } diff --git a/dev-test/gql-tag-operations-masking/gql/index.ts b/dev-test/gql-tag-operations-masking/gql/index.ts index 0fa85dc2148..873144cb2ce 100644 --- a/dev-test/gql-tag-operations-masking/gql/index.ts +++ b/dev-test/gql-tag-operations-masking/gql/index.ts @@ -1,2 +1,2 @@ -export * from './gql.js'; export * from './fragment-masking.js'; +export * from './gql.js'; diff --git a/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts b/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts new file mode 100644 index 00000000000..99734b9d4ee --- /dev/null +++ b/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts @@ -0,0 +1,54 @@ +import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import { Empty, Incremental } from './graphql'; + +export type FragmentType> = + TDocumentType extends DocumentTypeDecoration + ? TType extends { ' $fragmentName'?: infer TKey } + ? TKey extends string + ? { ' $fragmentRefs'?: { [key in TKey]: TType } } + : never + : never + : never; + +// return union with empty object if `fragmentType` is `Incremental +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: FragmentType, any>> | null | undefined +): TType | Empty | null | undefined; +// return non-nullable if `fragmentType` is non-nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: FragmentType> +): TType; +// return nullable if `fragmentType` is nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: FragmentType> | null | undefined +): TType | null | undefined; +// return array of non-nullable if `fragmentType` is array of non-nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray>> +): ReadonlyArray; +// return array of nullable if `fragmentType` is array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray>> | null | undefined +): ReadonlyArray | null | undefined; +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: + | FragmentType> + | ReadonlyArray>> + | null + | undefined +): TType | ReadonlyArray | null | undefined { + return fragmentType as any; +} + +export function makeFragmentData, FT extends ResultOf>( + data: FT, + _fragment: F +): FragmentType { + return data as FragmentType; +} diff --git a/dev-test/gql-tag-operations-urql/gql/gql.ts b/dev-test/gql-tag-operations-urql/gql/gql.ts new file mode 100644 index 00000000000..8eca79729ed --- /dev/null +++ b/dev-test/gql-tag-operations-urql/gql/gql.ts @@ -0,0 +1,63 @@ +/* eslint-disable */ +import * as types from './graphql.js'; +import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core'; + +/** + * Map of all GraphQL operations in the project. + * + * This map has several performance disadvantages: + * 1. It is not tree-shakeable, so it will include all operations in the project. + * 2. It is not minifiable, so the string of a GraphQL query will be multiple times inside the bundle. + * 3. It does not support dead code elimination, so it will add unused operations. + * + * Therefore it is highly recommended to use the babel or swc plugin for production. + */ +const documents = { + '\n query Foo {\n Tweets {\n id\n }\n }\n': types.FooDocument, + '\n fragment Lel on Tweet {\n id\n body\n }\n': types.LelFragmentDoc, + '\n query Bar {\n Tweets {\n ...Lel\n }\n }\n': types.BarDocument, +}; + +/** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + * + * + * @example + * ```ts + * const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`); + * ``` + * + * The query argument is unknown! + * Please regenerate the types. + */ +export function graphql(source: string): unknown; + +/** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function graphql( + source: '\n query Foo {\n Tweets {\n id\n }\n }\n' +): (typeof documents)['\n query Foo {\n Tweets {\n id\n }\n }\n']; +/** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function graphql( + source: '\n fragment Lel on Tweet {\n id\n body\n }\n' +): (typeof documents)['\n fragment Lel on Tweet {\n id\n body\n }\n']; +/** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function graphql( + source: '\n query Bar {\n Tweets {\n ...Lel\n }\n }\n' +): (typeof documents)['\n query Bar {\n Tweets {\n ...Lel\n }\n }\n']; + +export function graphql(source: string) { + return (documents as any)[source] ?? {}; +} + +export type DocumentType> = TDocumentNode extends DocumentNode< + infer TType, + any +> + ? TType + : never; diff --git a/dev-test/gql-tag-operations-urql/gql/graphql.ts b/dev-test/gql-tag-operations-urql/gql/graphql.ts index 9ecb8265209..b35215f46a6 100644 --- a/dev-test/gql-tag-operations-urql/gql/graphql.ts +++ b/dev-test/gql-tag-operations-urql/gql/graphql.ts @@ -112,13 +112,15 @@ export type FooQueryVariables = Exact<{ [key: string]: never }>; export type FooQuery = { __typename?: 'Query'; Tweets?: Array<{ __typename?: 'Tweet'; id: string } | null> | null }; -export type LelFragment = { __typename?: 'Tweet'; id: string; body?: string | null }; +export type LelFragment = { __typename?: 'Tweet'; id: string; body?: string | null } & { + ' $fragmentName'?: 'LelFragment'; +}; export type BarQueryVariables = Exact<{ [key: string]: never }>; export type BarQuery = { __typename?: 'Query'; - Tweets?: Array<{ __typename?: 'Tweet'; id: string; body?: string | null } | null> | null; + Tweets?: Array<({ __typename?: 'Tweet' } & { ' $fragmentRefs'?: { LelFragment: LelFragment } }) | null> | null; }; export const LelFragmentDoc = { diff --git a/dev-test/gql-tag-operations-urql/gql/index.ts b/dev-test/gql-tag-operations-urql/gql/index.ts new file mode 100644 index 00000000000..873144cb2ce --- /dev/null +++ b/dev-test/gql-tag-operations-urql/gql/index.ts @@ -0,0 +1,2 @@ +export * from './fragment-masking.js'; +export * from './gql.js'; diff --git a/dev-test/gql-tag-operations/gql/fragment-masking.ts b/dev-test/gql-tag-operations/gql/fragment-masking.ts new file mode 100644 index 00000000000..99734b9d4ee --- /dev/null +++ b/dev-test/gql-tag-operations/gql/fragment-masking.ts @@ -0,0 +1,54 @@ +import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import { Empty, Incremental } from './graphql'; + +export type FragmentType> = + TDocumentType extends DocumentTypeDecoration + ? TType extends { ' $fragmentName'?: infer TKey } + ? TKey extends string + ? { ' $fragmentRefs'?: { [key in TKey]: TType } } + : never + : never + : never; + +// return union with empty object if `fragmentType` is `Incremental +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: FragmentType, any>> | null | undefined +): TType | Empty | null | undefined; +// return non-nullable if `fragmentType` is non-nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: FragmentType> +): TType; +// return nullable if `fragmentType` is nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: FragmentType> | null | undefined +): TType | null | undefined; +// return array of non-nullable if `fragmentType` is array of non-nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray>> +): ReadonlyArray; +// return array of nullable if `fragmentType` is array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray>> | null | undefined +): ReadonlyArray | null | undefined; +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: + | FragmentType> + | ReadonlyArray>> + | null + | undefined +): TType | ReadonlyArray | null | undefined { + return fragmentType as any; +} + +export function makeFragmentData, FT extends ResultOf>( + data: FT, + _fragment: F +): FragmentType { + return data as FragmentType; +} diff --git a/dev-test/gql-tag-operations/gql/gql.ts b/dev-test/gql-tag-operations/gql/gql.ts index 4f1650f302b..8eca79729ed 100644 --- a/dev-test/gql-tag-operations/gql/gql.ts +++ b/dev-test/gql-tag-operations/gql/gql.ts @@ -19,39 +19,39 @@ const documents = { }; /** - * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. * * * @example * ```ts - * const query = gql(`query GetUser($id: ID!) { user(id: $id) { name } }`); + * const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`); * ``` * * The query argument is unknown! * Please regenerate the types. */ -export function gql(source: string): unknown; +export function graphql(source: string): unknown; /** - * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function gql( +export function graphql( source: '\n query Foo {\n Tweets {\n id\n }\n }\n' ): (typeof documents)['\n query Foo {\n Tweets {\n id\n }\n }\n']; /** - * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function gql( +export function graphql( source: '\n fragment Lel on Tweet {\n id\n body\n }\n' ): (typeof documents)['\n fragment Lel on Tweet {\n id\n body\n }\n']; /** - * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function gql( +export function graphql( source: '\n query Bar {\n Tweets {\n ...Lel\n }\n }\n' ): (typeof documents)['\n query Bar {\n Tweets {\n ...Lel\n }\n }\n']; -export function gql(source: string) { +export function graphql(source: string) { return (documents as any)[source] ?? {}; } diff --git a/dev-test/gql-tag-operations/gql/graphql.ts b/dev-test/gql-tag-operations/gql/graphql.ts index 9ecb8265209..b35215f46a6 100644 --- a/dev-test/gql-tag-operations/gql/graphql.ts +++ b/dev-test/gql-tag-operations/gql/graphql.ts @@ -112,13 +112,15 @@ export type FooQueryVariables = Exact<{ [key: string]: never }>; export type FooQuery = { __typename?: 'Query'; Tweets?: Array<{ __typename?: 'Tweet'; id: string } | null> | null }; -export type LelFragment = { __typename?: 'Tweet'; id: string; body?: string | null }; +export type LelFragment = { __typename?: 'Tweet'; id: string; body?: string | null } & { + ' $fragmentName'?: 'LelFragment'; +}; export type BarQueryVariables = Exact<{ [key: string]: never }>; export type BarQuery = { __typename?: 'Query'; - Tweets?: Array<{ __typename?: 'Tweet'; id: string; body?: string | null } | null> | null; + Tweets?: Array<({ __typename?: 'Tweet' } & { ' $fragmentRefs'?: { LelFragment: LelFragment } }) | null> | null; }; export const LelFragmentDoc = { diff --git a/dev-test/gql-tag-operations/gql/index.ts b/dev-test/gql-tag-operations/gql/index.ts index 1f555ebcde7..873144cb2ce 100644 --- a/dev-test/gql-tag-operations/gql/index.ts +++ b/dev-test/gql-tag-operations/gql/index.ts @@ -1 +1,2 @@ +export * from './fragment-masking.js'; export * from './gql.js'; diff --git a/dev-test/gql-tag-operations/graphql/fragment-masking.ts b/dev-test/gql-tag-operations/graphql/fragment-masking.ts index 061b6de8911..99734b9d4ee 100644 --- a/dev-test/gql-tag-operations/graphql/fragment-masking.ts +++ b/dev-test/gql-tag-operations/graphql/fragment-masking.ts @@ -1,5 +1,5 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { Empty, Incremental } from './graphql.js'; +import { Empty, Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts b/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts index 061b6de8911..99734b9d4ee 100644 --- a/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts +++ b/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts @@ -1,5 +1,5 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { Empty, Incremental } from './graphql.js'; +import { Empty, Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/examples/persisted-documents/src/gql/fragment-masking.ts b/examples/persisted-documents/src/gql/fragment-masking.ts index 061b6de8911..99734b9d4ee 100644 --- a/examples/persisted-documents/src/gql/fragment-masking.ts +++ b/examples/persisted-documents/src/gql/fragment-masking.ts @@ -1,5 +1,5 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { Empty, Incremental } from './graphql.js'; +import { Empty, Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/examples/react/apollo-client-defer/src/gql/fragment-masking.ts b/examples/react/apollo-client-defer/src/gql/fragment-masking.ts index 061b6de8911..99734b9d4ee 100644 --- a/examples/react/apollo-client-defer/src/gql/fragment-masking.ts +++ b/examples/react/apollo-client-defer/src/gql/fragment-masking.ts @@ -1,5 +1,5 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { Empty, Incremental } from './graphql.js'; +import { Empty, Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts b/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts index 061b6de8911..99734b9d4ee 100644 --- a/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts +++ b/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts @@ -1,5 +1,5 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { Empty, Incremental } from './graphql.js'; +import { Empty, Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/examples/react/apollo-client/src/gql/fragment-masking.ts b/examples/react/apollo-client/src/gql/fragment-masking.ts index 061b6de8911..99734b9d4ee 100644 --- a/examples/react/apollo-client/src/gql/fragment-masking.ts +++ b/examples/react/apollo-client/src/gql/fragment-masking.ts @@ -1,5 +1,5 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { Empty, Incremental } from './graphql.js'; +import { Empty, Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/examples/react/http-executor/src/gql/fragment-masking.ts b/examples/react/http-executor/src/gql/fragment-masking.ts index 061b6de8911..99734b9d4ee 100644 --- a/examples/react/http-executor/src/gql/fragment-masking.ts +++ b/examples/react/http-executor/src/gql/fragment-masking.ts @@ -1,5 +1,5 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { Empty, Incremental } from './graphql.js'; +import { Empty, Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/examples/react/nextjs-swr/gql/fragment-masking.ts b/examples/react/nextjs-swr/gql/fragment-masking.ts index 061b6de8911..99734b9d4ee 100644 --- a/examples/react/nextjs-swr/gql/fragment-masking.ts +++ b/examples/react/nextjs-swr/gql/fragment-masking.ts @@ -1,5 +1,5 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { Empty, Incremental } from './graphql.js'; +import { Empty, Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/examples/react/tanstack-react-query/src/gql/fragment-masking.ts b/examples/react/tanstack-react-query/src/gql/fragment-masking.ts index 061b6de8911..99734b9d4ee 100644 --- a/examples/react/tanstack-react-query/src/gql/fragment-masking.ts +++ b/examples/react/tanstack-react-query/src/gql/fragment-masking.ts @@ -1,5 +1,5 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { Empty, Incremental } from './graphql.js'; +import { Empty, Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/examples/react/urql/src/gql/fragment-masking.ts b/examples/react/urql/src/gql/fragment-masking.ts index 061b6de8911..99734b9d4ee 100644 --- a/examples/react/urql/src/gql/fragment-masking.ts +++ b/examples/react/urql/src/gql/fragment-masking.ts @@ -1,5 +1,5 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { Empty, Incremental } from './graphql.js'; +import { Empty, Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/examples/typescript-esm/src/gql/fragment-masking.ts b/examples/typescript-esm/src/gql/fragment-masking.ts index 061b6de8911..99734b9d4ee 100644 --- a/examples/typescript-esm/src/gql/fragment-masking.ts +++ b/examples/typescript-esm/src/gql/fragment-masking.ts @@ -1,5 +1,5 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { Empty, Incremental } from './graphql.js'; +import { Empty, Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/examples/typescript-graphql-request/src/gql/fragment-masking.ts b/examples/typescript-graphql-request/src/gql/fragment-masking.ts index 061b6de8911..99734b9d4ee 100644 --- a/examples/typescript-graphql-request/src/gql/fragment-masking.ts +++ b/examples/typescript-graphql-request/src/gql/fragment-masking.ts @@ -1,5 +1,5 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { Empty, Incremental } from './graphql.js'; +import { Empty, Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/examples/vite/vite-react-cts/src/gql/fragment-masking.ts b/examples/vite/vite-react-cts/src/gql/fragment-masking.ts index 061b6de8911..99734b9d4ee 100644 --- a/examples/vite/vite-react-cts/src/gql/fragment-masking.ts +++ b/examples/vite/vite-react-cts/src/gql/fragment-masking.ts @@ -1,5 +1,5 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { Empty, Incremental } from './graphql.js'; +import { Empty, Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/examples/vite/vite-react-mts/src/gql/fragment-masking.ts b/examples/vite/vite-react-mts/src/gql/fragment-masking.ts index 061b6de8911..99734b9d4ee 100644 --- a/examples/vite/vite-react-mts/src/gql/fragment-masking.ts +++ b/examples/vite/vite-react-mts/src/gql/fragment-masking.ts @@ -1,5 +1,5 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { Empty, Incremental } from './graphql.js'; +import { Empty, Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/examples/vite/vite-react-ts/src/gql/fragment-masking.ts b/examples/vite/vite-react-ts/src/gql/fragment-masking.ts index 061b6de8911..99734b9d4ee 100644 --- a/examples/vite/vite-react-ts/src/gql/fragment-masking.ts +++ b/examples/vite/vite-react-ts/src/gql/fragment-masking.ts @@ -1,5 +1,5 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { Empty, Incremental } from './graphql.js'; +import { Empty, Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/examples/vue/apollo-composable/src/gql/fragment-masking.ts b/examples/vue/apollo-composable/src/gql/fragment-masking.ts index b511a23813e..c2ce23eb49c 100644 --- a/examples/vue/apollo-composable/src/gql/fragment-masking.ts +++ b/examples/vue/apollo-composable/src/gql/fragment-masking.ts @@ -1,5 +1,5 @@ import type { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import type { Empty, Incremental } from './graphql.js'; +import type { Empty, Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/examples/vue/urql/src/gql/fragment-masking.ts b/examples/vue/urql/src/gql/fragment-masking.ts index b511a23813e..c2ce23eb49c 100644 --- a/examples/vue/urql/src/gql/fragment-masking.ts +++ b/examples/vue/urql/src/gql/fragment-masking.ts @@ -1,5 +1,5 @@ import type { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import type { Empty, Incremental } from './graphql.js'; +import type { Empty, Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/examples/vue/villus/src/gql/fragment-masking.ts b/examples/vue/villus/src/gql/fragment-masking.ts index b511a23813e..c2ce23eb49c 100644 --- a/examples/vue/villus/src/gql/fragment-masking.ts +++ b/examples/vue/villus/src/gql/fragment-masking.ts @@ -1,5 +1,5 @@ import type { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import type { Empty, Incremental } from './graphql.js'; +import type { Empty, Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/examples/yoga-tests/src/gql/fragment-masking.ts b/examples/yoga-tests/src/gql/fragment-masking.ts index 061b6de8911..99734b9d4ee 100644 --- a/examples/yoga-tests/src/gql/fragment-masking.ts +++ b/examples/yoga-tests/src/gql/fragment-masking.ts @@ -1,5 +1,5 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { Empty, Incremental } from './graphql.js'; +import { Empty, Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/packages/plugins/other/visitor-plugin-common/src/selection-set-processor/pre-resolve-types.ts b/packages/plugins/other/visitor-plugin-common/src/selection-set-processor/pre-resolve-types.ts index aa606f5a9cc..d13f3bd49bb 100644 --- a/packages/plugins/other/visitor-plugin-common/src/selection-set-processor/pre-resolve-types.ts +++ b/packages/plugins/other/visitor-plugin-common/src/selection-set-processor/pre-resolve-types.ts @@ -28,7 +28,7 @@ export class PreResolveTypesProcessor extends BaseSelectionSetProcessor { + return fields.map(field => { const fieldObj = schemaType.getFields()[field.fieldName]; const baseType = getBaseType(fieldObj.type); @@ -66,7 +66,6 @@ export class PreResolveTypesProcessor extends BaseSelectionSetProcessor file.filename === 'out1/fragment-masking.ts'); expect(gqlFile.content).toMatchInlineSnapshot(` "import { ResultOf, DocumentTypeDecoration, } from '@graphql-typed-document-node/core'; - import { Empty, Incremental } from './graphql.js'; + import type { Empty, Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration< From 591d4d983114a7e0801d99ccce1b41bba7ec4eba Mon Sep 17 00:00:00 2001 From: beerose Date: Thu, 23 Mar 2023 15:16:24 +0100 Subject: [PATCH 21/47] Fix emitLegacyCommonJSImports --- packages/presets/client/src/fragment-masking-plugin.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/presets/client/src/fragment-masking-plugin.ts b/packages/presets/client/src/fragment-masking-plugin.ts index 13853ed4cae..c9a3e83a80a 100644 --- a/packages/presets/client/src/fragment-masking-plugin.ts +++ b/packages/presets/client/src/fragment-masking-plugin.ts @@ -91,12 +91,12 @@ export const plugin: PluginFunction<{ useTypeImports?: boolean; augmentedModuleName?: string; unmaskFunctionName?: string; -}> = (_, __, { useTypeImports, augmentedModuleName, unmaskFunctionName }, _info) => { + emitLegacyCommonJSImports?: boolean; +}> = (_, __, { useTypeImports, augmentedModuleName, unmaskFunctionName, emitLegacyCommonJSImports }, _info) => { const documentNodeImport = `${ useTypeImports ? 'import type' : 'import' } { ResultOf, DocumentTypeDecoration, } from '@graphql-typed-document-node/core';\n`; - const emitLegacyCommonJSImports = true; // todo const typeHelpersImport = `${useTypeImports ? 'import type' : 'import'} { Empty, Incremental } from './graphql${ emitLegacyCommonJSImports ? '' : '.js' }';\n`; From 9bfb3ea67c141b047d197fa5abdcd451d8bb29fd Mon Sep 17 00:00:00 2001 From: beerose Date: Thu, 23 Mar 2023 15:27:31 +0100 Subject: [PATCH 22/47] Pass config to plugin --- packages/presets/client/src/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/presets/client/src/index.ts b/packages/presets/client/src/index.ts index 92d4beddbab..6d72fe591f0 100644 --- a/packages/presets/client/src/index.ts +++ b/packages/presets/client/src/index.ts @@ -239,6 +239,7 @@ export const preset: Types.OutputPreset = { config: { useTypeImports: options.config.useTypeImports, unmaskFunctionName: fragmentMaskingConfig.unmaskFunctionName, + emitLegacyCommonJSImports: options.config.emitLegacyCommonJSImports, }, documents: [], documentTransforms: options.documentTransforms, From 3e38d32087dd9fbddafa6320b295c516be2393a5 Mon Sep 17 00:00:00 2001 From: beerose Date: Thu, 23 Mar 2023 16:47:40 +0100 Subject: [PATCH 23/47] Fix import in example --- dev-test/gql-tag-operations-masking/gql/fragment-masking.ts | 2 +- dev-test/gql-tag-operations-urql/gql/fragment-masking.ts | 2 +- dev-test/gql-tag-operations/gql/fragment-masking.ts | 2 +- dev-test/gql-tag-operations/graphql/fragment-masking.ts | 2 +- examples/typescript-esm/src/gql/fragment-masking.ts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts b/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts index 99734b9d4ee..061b6de8911 100644 --- a/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts +++ b/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts @@ -1,5 +1,5 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { Empty, Incremental } from './graphql'; +import { Empty, Incremental } from './graphql.js'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts b/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts index 99734b9d4ee..061b6de8911 100644 --- a/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts +++ b/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts @@ -1,5 +1,5 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { Empty, Incremental } from './graphql'; +import { Empty, Incremental } from './graphql.js'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/dev-test/gql-tag-operations/gql/fragment-masking.ts b/dev-test/gql-tag-operations/gql/fragment-masking.ts index 99734b9d4ee..061b6de8911 100644 --- a/dev-test/gql-tag-operations/gql/fragment-masking.ts +++ b/dev-test/gql-tag-operations/gql/fragment-masking.ts @@ -1,5 +1,5 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { Empty, Incremental } from './graphql'; +import { Empty, Incremental } from './graphql.js'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/dev-test/gql-tag-operations/graphql/fragment-masking.ts b/dev-test/gql-tag-operations/graphql/fragment-masking.ts index 99734b9d4ee..061b6de8911 100644 --- a/dev-test/gql-tag-operations/graphql/fragment-masking.ts +++ b/dev-test/gql-tag-operations/graphql/fragment-masking.ts @@ -1,5 +1,5 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { Empty, Incremental } from './graphql'; +import { Empty, Incremental } from './graphql.js'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/examples/typescript-esm/src/gql/fragment-masking.ts b/examples/typescript-esm/src/gql/fragment-masking.ts index 99734b9d4ee..061b6de8911 100644 --- a/examples/typescript-esm/src/gql/fragment-masking.ts +++ b/examples/typescript-esm/src/gql/fragment-masking.ts @@ -1,5 +1,5 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { Empty, Incremental } from './graphql'; +import { Empty, Incremental } from './graphql.js'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration From b0d6c203bde256841f7171e0ac8b4b4cf68e029d Mon Sep 17 00:00:00 2001 From: beerose Date: Mon, 27 Mar 2023 20:53:12 +0200 Subject: [PATCH 24/47] Add preferred output --- .../react/apollo-client-defer/src/App.tsx | 28 ++++++--- .../src/gql/fragment-masking.ts | 27 +++++--- .../react/apollo-client-defer/src/gql/gql.ts | 12 ++-- .../apollo-client-defer/src/gql/graphql.ts | 62 ++++++++++++++++--- 4 files changed, 101 insertions(+), 28 deletions(-) diff --git a/examples/react/apollo-client-defer/src/App.tsx b/examples/react/apollo-client-defer/src/App.tsx index 7498c5880db..515fb97af48 100644 --- a/examples/react/apollo-client-defer/src/App.tsx +++ b/examples/react/apollo-client-defer/src/App.tsx @@ -1,12 +1,12 @@ import { useQuery } from '@apollo/client'; import './App.css'; -import { useFragment, graphql } from './gql'; -import { SlowFieldFragmentFragment } from './gql/graphql'; +import { useFragment, graphql, FragmentType, isFragmentReady } from './gql'; +import { SlowAndFastFieldWithDeferQuery } from './gql/graphql'; export const slowFieldFragment = graphql(/* GraphQL */ ` fragment SlowFieldFragment on Query { - slowField + slowField(waitFor: 5000) } `); @@ -14,22 +14,36 @@ const alphabetQuery = graphql(/* GraphQL */ ` query SlowAndFastFieldWithDefer { fastField ...SlowFieldFragment @defer + + ... @defer { + inlinedSlowField: slowField(waitFor: 5000) + } } `); -const SlowDataField = (props: { data: SlowFieldFragmentFragment }) => { - return

{props.data.slowField}

; +const SlowDataField = (props: { data: FragmentType }) => { + const data = useFragment(slowFieldFragment, props.data); + return

{data.slowField}

; +}; + +const InlinedSlowDataField = (props: { data: SlowAndFastFieldWithDeferQuery }) => { + try { + // @ts-expect-error - this field should be either undefined or a string + const _ = props.data.inlinedSlowField.toLowerCase(); + } catch (e) {} + return

{props.data.inlinedSlowField}

; }; function App() { const { data } = useQuery(alphabetQuery); - const slowData = useFragment(slowFieldFragment, data); + return (
{data && ( <>

{data.fastField}

- {slowData?.slowField && } + {isFragmentReady(alphabetQuery, slowFieldFragment, data) && } + )}
diff --git a/examples/react/apollo-client-defer/src/gql/fragment-masking.ts b/examples/react/apollo-client-defer/src/gql/fragment-masking.ts index 99734b9d4ee..594140ffeff 100644 --- a/examples/react/apollo-client-defer/src/gql/fragment-masking.ts +++ b/examples/react/apollo-client-defer/src/gql/fragment-masking.ts @@ -1,5 +1,5 @@ -import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { Empty, Incremental } from './graphql'; +import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; +import { FragmentDefinitionNode } from 'graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -10,12 +10,6 @@ export type FragmentType> : never : never; -// return union with empty object if `fragmentType` is `Incremental -export function useFragment( - _documentNode: DocumentTypeDecoration, - fragmentType: FragmentType, any>> | null | undefined -): TType | Empty | null | undefined; -// return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: FragmentType> @@ -52,3 +46,20 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } + +export function isFragmentReady( + queryNode: DocumentTypeDecoration, // works for string + fragmentNode: TypedDocumentNode, // doesn't work with string yet + data: TQuery +): data is FragmentType { + const deferredFields = (queryNode as { __meta__?: Record }).__meta__?.deferredFields; + if (deferredFields) { + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; + const field = fragName && deferredFields[fragName]; + + return field && (data as any)[field]; + } + + return true; +} diff --git a/examples/react/apollo-client-defer/src/gql/gql.ts b/examples/react/apollo-client-defer/src/gql/gql.ts index a0015dd743e..f7b35ee845d 100644 --- a/examples/react/apollo-client-defer/src/gql/gql.ts +++ b/examples/react/apollo-client-defer/src/gql/gql.ts @@ -13,8 +13,8 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/ * Therefore it is highly recommended to use the babel or swc plugin for production. */ const documents = { - '\n fragment SlowFieldFragment on Query {\n slowField\n }\n': types.SlowFieldFragmentFragmentDoc, - '\n query SlowAndFastFieldWithDefer {\n fastField\n ...SlowFieldFragment @defer\n }\n': + '\n fragment SlowFieldFragment on Query {\n slowField(waitFor: 5000)\n }\n': types.SlowFieldFragmentFragmentDoc, + '\n query SlowAndFastFieldWithDefer {\n fastField\n ...SlowFieldFragment @defer\n\n ... @defer {\n inlinedSlowField: slowField(waitFor: 5000)\n }\n }\n': types.SlowAndFastFieldWithDeferDocument, }; @@ -36,14 +36,14 @@ export function graphql(source: string): unknown; * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ export function graphql( - source: '\n fragment SlowFieldFragment on Query {\n slowField\n }\n' -): (typeof documents)['\n fragment SlowFieldFragment on Query {\n slowField\n }\n']; + source: '\n fragment SlowFieldFragment on Query {\n slowField(waitFor: 5000)\n }\n' +): (typeof documents)['\n fragment SlowFieldFragment on Query {\n slowField(waitFor: 5000)\n }\n']; /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ export function graphql( - source: '\n query SlowAndFastFieldWithDefer {\n fastField\n ...SlowFieldFragment @defer\n }\n' -): (typeof documents)['\n query SlowAndFastFieldWithDefer {\n fastField\n ...SlowFieldFragment @defer\n }\n']; + source: '\n query SlowAndFastFieldWithDefer {\n fastField\n ...SlowFieldFragment @defer\n\n ... @defer {\n inlinedSlowField: slowField(waitFor: 5000)\n }\n }\n' +): (typeof documents)['\n query SlowAndFastFieldWithDefer {\n fastField\n ...SlowFieldFragment @defer\n\n ... @defer {\n inlinedSlowField: slowField(waitFor: 5000)\n }\n }\n']; export function graphql(source: string) { return (documents as any)[source] ?? {}; diff --git a/examples/react/apollo-client-defer/src/gql/graphql.ts b/examples/react/apollo-client-defer/src/gql/graphql.ts index ddf786e09f3..721dc956556 100644 --- a/examples/react/apollo-client-defer/src/gql/graphql.ts +++ b/examples/react/apollo-client-defer/src/gql/graphql.ts @@ -6,8 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -39,9 +38,13 @@ export type SlowFieldFragmentFragment = { __typename?: 'Query'; slowField: strin export type SlowAndFastFieldWithDeferQueryVariables = Exact<{ [key: string]: never }>; -export type SlowAndFastFieldWithDeferQuery = { __typename?: 'Query'; fastField: string } & ({ __typename?: 'Query' } & { - ' $fragmentRefs'?: { SlowFieldFragmentFragment: Incremental }; -}); +export type SlowAndFastFieldWithDeferQuery = { __typename?: 'Query'; fastField: string } & ( + | { __typename?: 'Query'; inlinedSlowField: string } + | { __typename?: 'Query'; inlinedSlowField?: never } +) & + ({ __typename?: 'Query' } & { + ' $fragmentRefs'?: { SlowFieldFragmentFragment: Incremental }; + }); export const SlowFieldFragmentFragmentDoc = { kind: 'Document', @@ -52,7 +55,19 @@ export const SlowFieldFragmentFragmentDoc = { typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'Query' } }, selectionSet: { kind: 'SelectionSet', - selections: [{ kind: 'Field', name: { kind: 'Name', value: 'slowField' } }], + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'slowField' }, + arguments: [ + { + kind: 'Argument', + name: { kind: 'Name', value: 'waitFor' }, + value: { kind: 'IntValue', value: '5000' }, + }, + ], + }, + ], }, }, ], @@ -73,6 +88,27 @@ export const SlowAndFastFieldWithDeferDocument = { name: { kind: 'Name', value: 'SlowFieldFragment' }, directives: [{ kind: 'Directive', name: { kind: 'Name', value: 'defer' } }], }, + { + kind: 'InlineFragment', + directives: [{ kind: 'Directive', name: { kind: 'Name', value: 'defer' } }], + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + alias: { kind: 'Name', value: 'inlinedSlowField' }, + name: { kind: 'Name', value: 'slowField' }, + arguments: [ + { + kind: 'Argument', + name: { kind: 'Name', value: 'waitFor' }, + value: { kind: 'IntValue', value: '5000' }, + }, + ], + }, + ], + }, + }, ], }, }, @@ -82,7 +118,19 @@ export const SlowAndFastFieldWithDeferDocument = { typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: 'Query' } }, selectionSet: { kind: 'SelectionSet', - selections: [{ kind: 'Field', name: { kind: 'Name', value: 'slowField' } }], + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: 'slowField' }, + arguments: [ + { + kind: 'Argument', + name: { kind: 'Name', value: 'waitFor' }, + value: { kind: 'IntValue', value: '5000' }, + }, + ], + }, + ], }, }, ], From 6e3a35d7389efefb0790f34e1b2c89f31ecf6e2b Mon Sep 17 00:00:00 2001 From: beerose Date: Mon, 27 Mar 2023 21:21:18 +0200 Subject: [PATCH 25/47] Run updated codegen on examples --- dev-test/githunt/typed-document-nodes.ts | 3 +- dev-test/githunt/types.avoidOptionals.ts | 3 +- dev-test/githunt/types.d.ts | 3 +- dev-test/githunt/types.enumsAsTypes.ts | 3 +- .../githunt/types.flatten.preResolveTypes.ts | 3 +- dev-test/githunt/types.immutableTypes.ts | 3 +- ...ypes.preResolveTypes.onlyOperationTypes.ts | 3 +- dev-test/githunt/types.preResolveTypes.ts | 3 +- dev-test/githunt/types.ts | 3 +- .../gql/fragment-masking.ts | 6 ---- .../gql-tag-operations-masking/gql/graphql.ts | 3 +- .../gql/fragment-masking.ts | 6 ---- .../gql-tag-operations-urql/gql/graphql.ts | 3 +- .../gql/fragment-masking.ts | 6 ---- dev-test/gql-tag-operations/gql/graphql.ts | 3 +- .../graphql/fragment-masking.ts | 6 ---- .../gql-tag-operations/graphql/graphql.ts | 3 +- dev-test/modules/types.ts | 3 +- dev-test/star-wars/types.avoidOptionals.ts | 3 +- dev-test/star-wars/types.d.ts | 3 +- .../star-wars/types.globallyAvailable.d.ts | 3 +- dev-test/star-wars/types.immutableTypes.ts | 3 +- ...ypes.preResolveTypes.onlyOperationTypes.ts | 3 +- dev-test/star-wars/types.preResolveTypes.ts | 3 +- dev-test/star-wars/types.skipSchema.ts | 3 +- dev-test/star-wars/types.ts | 3 +- dev-test/test-schema/env.types.ts | 3 +- dev-test/test-schema/resolvers-federation.ts | 3 +- dev-test/test-schema/resolvers-root.ts | 3 +- dev-test/test-schema/resolvers-stitching.ts | 3 +- dev-test/test-schema/resolvers-types.ts | 3 +- ...ypes.preResolveTypes.onlyOperationTypes.ts | 3 +- dev-test/test-schema/types.preResolveTypes.ts | 3 +- .../test-schema/typings.avoidOptionals.ts | 3 +- dev-test/test-schema/typings.enum.ts | 3 +- .../test-schema/typings.immutableTypes.ts | 3 +- dev-test/test-schema/typings.ts | 3 +- dev-test/test-schema/typings.wrapped.ts | 3 +- .../src/gql/fragment-masking.ts | 6 ---- .../src/gql/graphql.ts | 3 +- .../src/gql/fragment-masking.ts | 6 ---- .../persisted-documents/src/gql/graphql.ts | 3 +- .../src/gql/fragment-masking.ts | 1 + .../src/gql/fragment-masking.ts | 6 ---- .../src/gql/graphql.ts | 3 +- .../apollo-client/src/gql/fragment-masking.ts | 6 ---- .../react/apollo-client/src/gql/graphql.ts | 3 +- .../http-executor/src/gql/fragment-masking.ts | 6 ---- .../react/http-executor/src/gql/graphql.ts | 3 +- .../react/nextjs-swr/gql/fragment-masking.ts | 6 ---- examples/react/nextjs-swr/gql/graphql.ts | 3 +- .../src/gql/fragment-masking.ts | 6 ---- .../tanstack-react-query/src/gql/graphql.ts | 3 +- .../react/urql/src/gql/fragment-masking.ts | 6 ---- examples/react/urql/src/gql/graphql.ts | 3 +- .../src/gql/fragment-masking.ts | 6 ---- examples/typescript-esm/src/gql/graphql.ts | 3 +- .../src/gql/fragment-masking.ts | 6 ---- .../src/gql/graphql.ts | 3 +- .../typescript-resolvers/src/type-defs.d.ts | 3 +- .../src/gql/fragment-masking.ts | 6 ---- .../vite/vite-react-cts/src/gql/graphql.ts | 3 +- .../src/gql/fragment-masking.ts | 6 ---- .../vite/vite-react-mts/src/gql/graphql.ts | 3 +- .../vite-react-ts/src/gql/fragment-masking.ts | 6 ---- .../vite/vite-react-ts/src/gql/graphql.ts | 3 +- .../src/gql/fragment-masking.ts | 6 ---- .../vue/apollo-composable/src/gql/graphql.ts | 3 +- examples/vue/urql/src/gql/fragment-masking.ts | 6 ---- examples/vue/urql/src/gql/graphql.ts | 3 +- .../vue/villus/src/gql/fragment-masking.ts | 6 ---- examples/vue/villus/src/gql/graphql.ts | 3 +- .../yoga-tests/src/gql/fragment-masking.ts | 6 ---- examples/yoga-tests/src/gql/graphql.ts | 3 +- .../__snapshots__/ts-documents.spec.ts.snap | 4 --- .../operations/tests/ts-documents.spec.ts | 9 ++---- .../__snapshots__/ts-resolvers.spec.ts.snap | 2 -- .../typescript/typescript/src/visitor.ts | 8 +---- .../client/src/fragment-masking-plugin.ts | 28 ++++------------- .../client/tests/client-preset.spec.ts | 30 +++++++------------ 80 files changed, 72 insertions(+), 292 deletions(-) diff --git a/dev-test/githunt/typed-document-nodes.ts b/dev-test/githunt/typed-document-nodes.ts index 79f88651b19..c1869979b18 100644 --- a/dev-test/githunt/typed-document-nodes.ts +++ b/dev-test/githunt/typed-document-nodes.ts @@ -5,8 +5,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/githunt/types.avoidOptionals.ts b/dev-test/githunt/types.avoidOptionals.ts index d65ab789290..c0776da450e 100644 --- a/dev-test/githunt/types.avoidOptionals.ts +++ b/dev-test/githunt/types.avoidOptionals.ts @@ -4,8 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/githunt/types.d.ts b/dev-test/githunt/types.d.ts index 10785977727..49dd9885cae 100644 --- a/dev-test/githunt/types.d.ts +++ b/dev-test/githunt/types.d.ts @@ -4,8 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/githunt/types.enumsAsTypes.ts b/dev-test/githunt/types.enumsAsTypes.ts index 10785977727..49dd9885cae 100644 --- a/dev-test/githunt/types.enumsAsTypes.ts +++ b/dev-test/githunt/types.enumsAsTypes.ts @@ -4,8 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/githunt/types.flatten.preResolveTypes.ts b/dev-test/githunt/types.flatten.preResolveTypes.ts index a772560c4ad..7d9dbeb58ba 100644 --- a/dev-test/githunt/types.flatten.preResolveTypes.ts +++ b/dev-test/githunt/types.flatten.preResolveTypes.ts @@ -4,8 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/githunt/types.immutableTypes.ts b/dev-test/githunt/types.immutableTypes.ts index dd9ff9ef216..62a3bdf71e6 100644 --- a/dev-test/githunt/types.immutableTypes.ts +++ b/dev-test/githunt/types.immutableTypes.ts @@ -4,8 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/githunt/types.preResolveTypes.onlyOperationTypes.ts b/dev-test/githunt/types.preResolveTypes.onlyOperationTypes.ts index a6752629dfd..71b26f44e87 100644 --- a/dev-test/githunt/types.preResolveTypes.onlyOperationTypes.ts +++ b/dev-test/githunt/types.preResolveTypes.onlyOperationTypes.ts @@ -4,8 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/githunt/types.preResolveTypes.ts b/dev-test/githunt/types.preResolveTypes.ts index d6a7f66985b..48a6d7ca4a7 100644 --- a/dev-test/githunt/types.preResolveTypes.ts +++ b/dev-test/githunt/types.preResolveTypes.ts @@ -4,8 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/githunt/types.ts b/dev-test/githunt/types.ts index d6a7f66985b..48a6d7ca4a7 100644 --- a/dev-test/githunt/types.ts +++ b/dev-test/githunt/types.ts @@ -4,8 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts b/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts index 061b6de8911..dc2836d43e3 100644 --- a/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts +++ b/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts @@ -1,5 +1,4 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { Empty, Incremental } from './graphql.js'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -10,11 +9,6 @@ export type FragmentType> : never : never; -// return union with empty object if `fragmentType` is `Incremental -export function useFragment( - _documentNode: DocumentTypeDecoration, - fragmentType: FragmentType, any>> | null | undefined -): TType | Empty | null | undefined; // return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, diff --git a/dev-test/gql-tag-operations-masking/gql/graphql.ts b/dev-test/gql-tag-operations-masking/gql/graphql.ts index 0b2d4574402..72a9c35e3f1 100644 --- a/dev-test/gql-tag-operations-masking/gql/graphql.ts +++ b/dev-test/gql-tag-operations-masking/gql/graphql.ts @@ -6,8 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts b/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts index 061b6de8911..dc2836d43e3 100644 --- a/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts +++ b/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts @@ -1,5 +1,4 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { Empty, Incremental } from './graphql.js'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -10,11 +9,6 @@ export type FragmentType> : never : never; -// return union with empty object if `fragmentType` is `Incremental -export function useFragment( - _documentNode: DocumentTypeDecoration, - fragmentType: FragmentType, any>> | null | undefined -): TType | Empty | null | undefined; // return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, diff --git a/dev-test/gql-tag-operations-urql/gql/graphql.ts b/dev-test/gql-tag-operations-urql/gql/graphql.ts index b35215f46a6..70a0bcd01aa 100644 --- a/dev-test/gql-tag-operations-urql/gql/graphql.ts +++ b/dev-test/gql-tag-operations-urql/gql/graphql.ts @@ -6,8 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/gql-tag-operations/gql/fragment-masking.ts b/dev-test/gql-tag-operations/gql/fragment-masking.ts index 061b6de8911..dc2836d43e3 100644 --- a/dev-test/gql-tag-operations/gql/fragment-masking.ts +++ b/dev-test/gql-tag-operations/gql/fragment-masking.ts @@ -1,5 +1,4 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { Empty, Incremental } from './graphql.js'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -10,11 +9,6 @@ export type FragmentType> : never : never; -// return union with empty object if `fragmentType` is `Incremental -export function useFragment( - _documentNode: DocumentTypeDecoration, - fragmentType: FragmentType, any>> | null | undefined -): TType | Empty | null | undefined; // return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, diff --git a/dev-test/gql-tag-operations/gql/graphql.ts b/dev-test/gql-tag-operations/gql/graphql.ts index b35215f46a6..70a0bcd01aa 100644 --- a/dev-test/gql-tag-operations/gql/graphql.ts +++ b/dev-test/gql-tag-operations/gql/graphql.ts @@ -6,8 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/gql-tag-operations/graphql/fragment-masking.ts b/dev-test/gql-tag-operations/graphql/fragment-masking.ts index 061b6de8911..dc2836d43e3 100644 --- a/dev-test/gql-tag-operations/graphql/fragment-masking.ts +++ b/dev-test/gql-tag-operations/graphql/fragment-masking.ts @@ -1,5 +1,4 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { Empty, Incremental } from './graphql.js'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -10,11 +9,6 @@ export type FragmentType> : never : never; -// return union with empty object if `fragmentType` is `Incremental -export function useFragment( - _documentNode: DocumentTypeDecoration, - fragmentType: FragmentType, any>> | null | undefined -): TType | Empty | null | undefined; // return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, diff --git a/dev-test/gql-tag-operations/graphql/graphql.ts b/dev-test/gql-tag-operations/graphql/graphql.ts index b35215f46a6..70a0bcd01aa 100644 --- a/dev-test/gql-tag-operations/graphql/graphql.ts +++ b/dev-test/gql-tag-operations/graphql/graphql.ts @@ -6,8 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/modules/types.ts b/dev-test/modules/types.ts index ee3505dcfd4..e7fa2e3ca70 100644 --- a/dev-test/modules/types.ts +++ b/dev-test/modules/types.ts @@ -5,8 +5,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; export type Omit = Pick>; export type RequireFields = Omit & { [P in K]-?: NonNullable }; /** All built-in and custom scalars, mapped to their actual values */ diff --git a/dev-test/star-wars/types.avoidOptionals.ts b/dev-test/star-wars/types.avoidOptionals.ts index b38793f619c..7257d9a5497 100644 --- a/dev-test/star-wars/types.avoidOptionals.ts +++ b/dev-test/star-wars/types.avoidOptionals.ts @@ -4,8 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/star-wars/types.d.ts b/dev-test/star-wars/types.d.ts index 546dc87a28f..de45370b95b 100644 --- a/dev-test/star-wars/types.d.ts +++ b/dev-test/star-wars/types.d.ts @@ -4,8 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/star-wars/types.globallyAvailable.d.ts b/dev-test/star-wars/types.globallyAvailable.d.ts index e621c397bd1..d65de5b4cab 100644 --- a/dev-test/star-wars/types.globallyAvailable.d.ts +++ b/dev-test/star-wars/types.globallyAvailable.d.ts @@ -4,8 +4,7 @@ type Exact = { [K in keyof T]: T[K] }; type MakeOptional = Omit & { [SubKey in K]?: Maybe }; type MakeMaybe = Omit & { [SubKey in K]: Maybe }; type MakeEmpty = { [_ in K]?: never }; -type Empty = { [P in keyof T]?: never }; -type Incremental = T & { ' $defer': true }; +type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ type Scalars = { ID: string; diff --git a/dev-test/star-wars/types.immutableTypes.ts b/dev-test/star-wars/types.immutableTypes.ts index 7676d0cfb8a..1ca1a172a81 100644 --- a/dev-test/star-wars/types.immutableTypes.ts +++ b/dev-test/star-wars/types.immutableTypes.ts @@ -4,8 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/star-wars/types.preResolveTypes.onlyOperationTypes.ts b/dev-test/star-wars/types.preResolveTypes.onlyOperationTypes.ts index 0938495eec6..7662ccecc4e 100644 --- a/dev-test/star-wars/types.preResolveTypes.onlyOperationTypes.ts +++ b/dev-test/star-wars/types.preResolveTypes.onlyOperationTypes.ts @@ -4,8 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/star-wars/types.preResolveTypes.ts b/dev-test/star-wars/types.preResolveTypes.ts index 97ed065ae9f..edc205c0a74 100644 --- a/dev-test/star-wars/types.preResolveTypes.ts +++ b/dev-test/star-wars/types.preResolveTypes.ts @@ -4,8 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/star-wars/types.skipSchema.ts b/dev-test/star-wars/types.skipSchema.ts index 97ed065ae9f..edc205c0a74 100644 --- a/dev-test/star-wars/types.skipSchema.ts +++ b/dev-test/star-wars/types.skipSchema.ts @@ -4,8 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/star-wars/types.ts b/dev-test/star-wars/types.ts index 97ed065ae9f..edc205c0a74 100644 --- a/dev-test/star-wars/types.ts +++ b/dev-test/star-wars/types.ts @@ -4,8 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/test-schema/env.types.ts b/dev-test/test-schema/env.types.ts index 0e0b5461426..865579cf417 100644 --- a/dev-test/test-schema/env.types.ts +++ b/dev-test/test-schema/env.types.ts @@ -4,8 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/test-schema/resolvers-federation.ts b/dev-test/test-schema/resolvers-federation.ts index f956ce6aa48..efc51522202 100644 --- a/dev-test/test-schema/resolvers-federation.ts +++ b/dev-test/test-schema/resolvers-federation.ts @@ -5,8 +5,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/test-schema/resolvers-root.ts b/dev-test/test-schema/resolvers-root.ts index 05b7078c4cd..e6e409c81c5 100644 --- a/dev-test/test-schema/resolvers-root.ts +++ b/dev-test/test-schema/resolvers-root.ts @@ -5,8 +5,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; export type RequireFields = Omit & { [P in K]-?: NonNullable }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { diff --git a/dev-test/test-schema/resolvers-stitching.ts b/dev-test/test-schema/resolvers-stitching.ts index 5f0b7b095aa..66b12f03804 100644 --- a/dev-test/test-schema/resolvers-stitching.ts +++ b/dev-test/test-schema/resolvers-stitching.ts @@ -5,8 +5,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; export type RequireFields = Omit & { [P in K]-?: NonNullable }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { diff --git a/dev-test/test-schema/resolvers-types.ts b/dev-test/test-schema/resolvers-types.ts index caa6ce2db56..79975cd3322 100644 --- a/dev-test/test-schema/resolvers-types.ts +++ b/dev-test/test-schema/resolvers-types.ts @@ -5,8 +5,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; export type RequireFields = Omit & { [P in K]-?: NonNullable }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { diff --git a/dev-test/test-schema/types.preResolveTypes.onlyOperationTypes.ts b/dev-test/test-schema/types.preResolveTypes.onlyOperationTypes.ts index 32713f238d4..788bcca1855 100644 --- a/dev-test/test-schema/types.preResolveTypes.onlyOperationTypes.ts +++ b/dev-test/test-schema/types.preResolveTypes.onlyOperationTypes.ts @@ -4,8 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/test-schema/types.preResolveTypes.ts b/dev-test/test-schema/types.preResolveTypes.ts index 2567ae1ea76..ac27c41eeeb 100644 --- a/dev-test/test-schema/types.preResolveTypes.ts +++ b/dev-test/test-schema/types.preResolveTypes.ts @@ -4,8 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/test-schema/typings.avoidOptionals.ts b/dev-test/test-schema/typings.avoidOptionals.ts index 84747e28e06..27b38757995 100644 --- a/dev-test/test-schema/typings.avoidOptionals.ts +++ b/dev-test/test-schema/typings.avoidOptionals.ts @@ -4,8 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/test-schema/typings.enum.ts b/dev-test/test-schema/typings.enum.ts index 20db33adc33..42874c1883a 100644 --- a/dev-test/test-schema/typings.enum.ts +++ b/dev-test/test-schema/typings.enum.ts @@ -4,8 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/test-schema/typings.immutableTypes.ts b/dev-test/test-schema/typings.immutableTypes.ts index 99510d5823d..136fc2fb0fa 100644 --- a/dev-test/test-schema/typings.immutableTypes.ts +++ b/dev-test/test-schema/typings.immutableTypes.ts @@ -4,8 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/test-schema/typings.ts b/dev-test/test-schema/typings.ts index 04665196d4c..463811cd291 100644 --- a/dev-test/test-schema/typings.ts +++ b/dev-test/test-schema/typings.ts @@ -5,8 +5,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; export type RequireFields = Omit & { [P in K]-?: NonNullable }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { diff --git a/dev-test/test-schema/typings.wrapped.ts b/dev-test/test-schema/typings.wrapped.ts index 75541025a15..77ea912dca5 100644 --- a/dev-test/test-schema/typings.wrapped.ts +++ b/dev-test/test-schema/typings.wrapped.ts @@ -5,8 +5,7 @@ declare namespace GraphQL { export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Empty = { [P in keyof T]?: never }; - export type Incremental = T & { ' $defer': true }; + export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts b/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts index 99734b9d4ee..dc2836d43e3 100644 --- a/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts +++ b/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts @@ -1,5 +1,4 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { Empty, Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -10,11 +9,6 @@ export type FragmentType> : never : never; -// return union with empty object if `fragmentType` is `Incremental -export function useFragment( - _documentNode: DocumentTypeDecoration, - fragmentType: FragmentType, any>> | null | undefined -): TType | Empty | null | undefined; // return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, diff --git a/examples/persisted-documents-string-mode/src/gql/graphql.ts b/examples/persisted-documents-string-mode/src/gql/graphql.ts index 21763f690ff..de9dfa4bd63 100644 --- a/examples/persisted-documents-string-mode/src/gql/graphql.ts +++ b/examples/persisted-documents-string-mode/src/gql/graphql.ts @@ -6,8 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/persisted-documents/src/gql/fragment-masking.ts b/examples/persisted-documents/src/gql/fragment-masking.ts index 99734b9d4ee..dc2836d43e3 100644 --- a/examples/persisted-documents/src/gql/fragment-masking.ts +++ b/examples/persisted-documents/src/gql/fragment-masking.ts @@ -1,5 +1,4 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { Empty, Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -10,11 +9,6 @@ export type FragmentType> : never : never; -// return union with empty object if `fragmentType` is `Incremental -export function useFragment( - _documentNode: DocumentTypeDecoration, - fragmentType: FragmentType, any>> | null | undefined -): TType | Empty | null | undefined; // return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, diff --git a/examples/persisted-documents/src/gql/graphql.ts b/examples/persisted-documents/src/gql/graphql.ts index bde0769a9bf..aac2babde26 100644 --- a/examples/persisted-documents/src/gql/graphql.ts +++ b/examples/persisted-documents/src/gql/graphql.ts @@ -6,8 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/react/apollo-client-defer/src/gql/fragment-masking.ts b/examples/react/apollo-client-defer/src/gql/fragment-masking.ts index 594140ffeff..328e332216e 100644 --- a/examples/react/apollo-client-defer/src/gql/fragment-masking.ts +++ b/examples/react/apollo-client-defer/src/gql/fragment-masking.ts @@ -10,6 +10,7 @@ export type FragmentType> : never : never; +// return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: FragmentType> diff --git a/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts b/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts index 99734b9d4ee..dc2836d43e3 100644 --- a/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts +++ b/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts @@ -1,5 +1,4 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { Empty, Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -10,11 +9,6 @@ export type FragmentType> : never : never; -// return union with empty object if `fragmentType` is `Incremental -export function useFragment( - _documentNode: DocumentTypeDecoration, - fragmentType: FragmentType, any>> | null | undefined -): TType | Empty | null | undefined; // return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, diff --git a/examples/react/apollo-client-swc-plugin/src/gql/graphql.ts b/examples/react/apollo-client-swc-plugin/src/gql/graphql.ts index 547f2d500cb..70076f3c2a2 100644 --- a/examples/react/apollo-client-swc-plugin/src/gql/graphql.ts +++ b/examples/react/apollo-client-swc-plugin/src/gql/graphql.ts @@ -6,8 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/react/apollo-client/src/gql/fragment-masking.ts b/examples/react/apollo-client/src/gql/fragment-masking.ts index 99734b9d4ee..dc2836d43e3 100644 --- a/examples/react/apollo-client/src/gql/fragment-masking.ts +++ b/examples/react/apollo-client/src/gql/fragment-masking.ts @@ -1,5 +1,4 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { Empty, Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -10,11 +9,6 @@ export type FragmentType> : never : never; -// return union with empty object if `fragmentType` is `Incremental -export function useFragment( - _documentNode: DocumentTypeDecoration, - fragmentType: FragmentType, any>> | null | undefined -): TType | Empty | null | undefined; // return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, diff --git a/examples/react/apollo-client/src/gql/graphql.ts b/examples/react/apollo-client/src/gql/graphql.ts index 547f2d500cb..70076f3c2a2 100644 --- a/examples/react/apollo-client/src/gql/graphql.ts +++ b/examples/react/apollo-client/src/gql/graphql.ts @@ -6,8 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/react/http-executor/src/gql/fragment-masking.ts b/examples/react/http-executor/src/gql/fragment-masking.ts index 99734b9d4ee..dc2836d43e3 100644 --- a/examples/react/http-executor/src/gql/fragment-masking.ts +++ b/examples/react/http-executor/src/gql/fragment-masking.ts @@ -1,5 +1,4 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { Empty, Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -10,11 +9,6 @@ export type FragmentType> : never : never; -// return union with empty object if `fragmentType` is `Incremental -export function useFragment( - _documentNode: DocumentTypeDecoration, - fragmentType: FragmentType, any>> | null | undefined -): TType | Empty | null | undefined; // return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, diff --git a/examples/react/http-executor/src/gql/graphql.ts b/examples/react/http-executor/src/gql/graphql.ts index 547f2d500cb..70076f3c2a2 100644 --- a/examples/react/http-executor/src/gql/graphql.ts +++ b/examples/react/http-executor/src/gql/graphql.ts @@ -6,8 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/react/nextjs-swr/gql/fragment-masking.ts b/examples/react/nextjs-swr/gql/fragment-masking.ts index 99734b9d4ee..dc2836d43e3 100644 --- a/examples/react/nextjs-swr/gql/fragment-masking.ts +++ b/examples/react/nextjs-swr/gql/fragment-masking.ts @@ -1,5 +1,4 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { Empty, Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -10,11 +9,6 @@ export type FragmentType> : never : never; -// return union with empty object if `fragmentType` is `Incremental -export function useFragment( - _documentNode: DocumentTypeDecoration, - fragmentType: FragmentType, any>> | null | undefined -): TType | Empty | null | undefined; // return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, diff --git a/examples/react/nextjs-swr/gql/graphql.ts b/examples/react/nextjs-swr/gql/graphql.ts index 0249ab03132..e6bec1f6171 100644 --- a/examples/react/nextjs-swr/gql/graphql.ts +++ b/examples/react/nextjs-swr/gql/graphql.ts @@ -6,8 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/react/tanstack-react-query/src/gql/fragment-masking.ts b/examples/react/tanstack-react-query/src/gql/fragment-masking.ts index 99734b9d4ee..dc2836d43e3 100644 --- a/examples/react/tanstack-react-query/src/gql/fragment-masking.ts +++ b/examples/react/tanstack-react-query/src/gql/fragment-masking.ts @@ -1,5 +1,4 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { Empty, Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -10,11 +9,6 @@ export type FragmentType> : never : never; -// return union with empty object if `fragmentType` is `Incremental -export function useFragment( - _documentNode: DocumentTypeDecoration, - fragmentType: FragmentType, any>> | null | undefined -): TType | Empty | null | undefined; // return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, diff --git a/examples/react/tanstack-react-query/src/gql/graphql.ts b/examples/react/tanstack-react-query/src/gql/graphql.ts index b2f97130f3a..3764967a2c0 100644 --- a/examples/react/tanstack-react-query/src/gql/graphql.ts +++ b/examples/react/tanstack-react-query/src/gql/graphql.ts @@ -6,8 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/react/urql/src/gql/fragment-masking.ts b/examples/react/urql/src/gql/fragment-masking.ts index 99734b9d4ee..dc2836d43e3 100644 --- a/examples/react/urql/src/gql/fragment-masking.ts +++ b/examples/react/urql/src/gql/fragment-masking.ts @@ -1,5 +1,4 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { Empty, Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -10,11 +9,6 @@ export type FragmentType> : never : never; -// return union with empty object if `fragmentType` is `Incremental -export function useFragment( - _documentNode: DocumentTypeDecoration, - fragmentType: FragmentType, any>> | null | undefined -): TType | Empty | null | undefined; // return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, diff --git a/examples/react/urql/src/gql/graphql.ts b/examples/react/urql/src/gql/graphql.ts index 5e6513aab67..19de2965607 100644 --- a/examples/react/urql/src/gql/graphql.ts +++ b/examples/react/urql/src/gql/graphql.ts @@ -6,8 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/typescript-esm/src/gql/fragment-masking.ts b/examples/typescript-esm/src/gql/fragment-masking.ts index 061b6de8911..dc2836d43e3 100644 --- a/examples/typescript-esm/src/gql/fragment-masking.ts +++ b/examples/typescript-esm/src/gql/fragment-masking.ts @@ -1,5 +1,4 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { Empty, Incremental } from './graphql.js'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -10,11 +9,6 @@ export type FragmentType> : never : never; -// return union with empty object if `fragmentType` is `Incremental -export function useFragment( - _documentNode: DocumentTypeDecoration, - fragmentType: FragmentType, any>> | null | undefined -): TType | Empty | null | undefined; // return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, diff --git a/examples/typescript-esm/src/gql/graphql.ts b/examples/typescript-esm/src/gql/graphql.ts index 0345d4e4e9d..eb327a88572 100644 --- a/examples/typescript-esm/src/gql/graphql.ts +++ b/examples/typescript-esm/src/gql/graphql.ts @@ -6,8 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/typescript-graphql-request/src/gql/fragment-masking.ts b/examples/typescript-graphql-request/src/gql/fragment-masking.ts index 99734b9d4ee..dc2836d43e3 100644 --- a/examples/typescript-graphql-request/src/gql/fragment-masking.ts +++ b/examples/typescript-graphql-request/src/gql/fragment-masking.ts @@ -1,5 +1,4 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { Empty, Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -10,11 +9,6 @@ export type FragmentType> : never : never; -// return union with empty object if `fragmentType` is `Incremental -export function useFragment( - _documentNode: DocumentTypeDecoration, - fragmentType: FragmentType, any>> | null | undefined -): TType | Empty | null | undefined; // return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, diff --git a/examples/typescript-graphql-request/src/gql/graphql.ts b/examples/typescript-graphql-request/src/gql/graphql.ts index 0ad80338b4c..aa739dbb581 100644 --- a/examples/typescript-graphql-request/src/gql/graphql.ts +++ b/examples/typescript-graphql-request/src/gql/graphql.ts @@ -6,8 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/typescript-resolvers/src/type-defs.d.ts b/examples/typescript-resolvers/src/type-defs.d.ts index 3cf01c4fb8c..7e62e1ebcb2 100644 --- a/examples/typescript-resolvers/src/type-defs.d.ts +++ b/examples/typescript-resolvers/src/type-defs.d.ts @@ -5,8 +5,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; export type RequireFields = Omit & { [P in K]-?: NonNullable }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { diff --git a/examples/vite/vite-react-cts/src/gql/fragment-masking.ts b/examples/vite/vite-react-cts/src/gql/fragment-masking.ts index 99734b9d4ee..dc2836d43e3 100644 --- a/examples/vite/vite-react-cts/src/gql/fragment-masking.ts +++ b/examples/vite/vite-react-cts/src/gql/fragment-masking.ts @@ -1,5 +1,4 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { Empty, Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -10,11 +9,6 @@ export type FragmentType> : never : never; -// return union with empty object if `fragmentType` is `Incremental -export function useFragment( - _documentNode: DocumentTypeDecoration, - fragmentType: FragmentType, any>> | null | undefined -): TType | Empty | null | undefined; // return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, diff --git a/examples/vite/vite-react-cts/src/gql/graphql.ts b/examples/vite/vite-react-cts/src/gql/graphql.ts index 0249ab03132..e6bec1f6171 100644 --- a/examples/vite/vite-react-cts/src/gql/graphql.ts +++ b/examples/vite/vite-react-cts/src/gql/graphql.ts @@ -6,8 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/vite/vite-react-mts/src/gql/fragment-masking.ts b/examples/vite/vite-react-mts/src/gql/fragment-masking.ts index 99734b9d4ee..dc2836d43e3 100644 --- a/examples/vite/vite-react-mts/src/gql/fragment-masking.ts +++ b/examples/vite/vite-react-mts/src/gql/fragment-masking.ts @@ -1,5 +1,4 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { Empty, Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -10,11 +9,6 @@ export type FragmentType> : never : never; -// return union with empty object if `fragmentType` is `Incremental -export function useFragment( - _documentNode: DocumentTypeDecoration, - fragmentType: FragmentType, any>> | null | undefined -): TType | Empty | null | undefined; // return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, diff --git a/examples/vite/vite-react-mts/src/gql/graphql.ts b/examples/vite/vite-react-mts/src/gql/graphql.ts index 0249ab03132..e6bec1f6171 100644 --- a/examples/vite/vite-react-mts/src/gql/graphql.ts +++ b/examples/vite/vite-react-mts/src/gql/graphql.ts @@ -6,8 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/vite/vite-react-ts/src/gql/fragment-masking.ts b/examples/vite/vite-react-ts/src/gql/fragment-masking.ts index 99734b9d4ee..dc2836d43e3 100644 --- a/examples/vite/vite-react-ts/src/gql/fragment-masking.ts +++ b/examples/vite/vite-react-ts/src/gql/fragment-masking.ts @@ -1,5 +1,4 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { Empty, Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -10,11 +9,6 @@ export type FragmentType> : never : never; -// return union with empty object if `fragmentType` is `Incremental -export function useFragment( - _documentNode: DocumentTypeDecoration, - fragmentType: FragmentType, any>> | null | undefined -): TType | Empty | null | undefined; // return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, diff --git a/examples/vite/vite-react-ts/src/gql/graphql.ts b/examples/vite/vite-react-ts/src/gql/graphql.ts index 0249ab03132..e6bec1f6171 100644 --- a/examples/vite/vite-react-ts/src/gql/graphql.ts +++ b/examples/vite/vite-react-ts/src/gql/graphql.ts @@ -6,8 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/vue/apollo-composable/src/gql/fragment-masking.ts b/examples/vue/apollo-composable/src/gql/fragment-masking.ts index c2ce23eb49c..bb601eea66b 100644 --- a/examples/vue/apollo-composable/src/gql/fragment-masking.ts +++ b/examples/vue/apollo-composable/src/gql/fragment-masking.ts @@ -1,5 +1,4 @@ import type { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import type { Empty, Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -10,11 +9,6 @@ export type FragmentType> : never : never; -// return union with empty object if `fragmentType` is `Incremental -export function useFragment( - _documentNode: DocumentTypeDecoration, - fragmentType: FragmentType, any>> | null | undefined -): TType | Empty | null | undefined; // return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, diff --git a/examples/vue/apollo-composable/src/gql/graphql.ts b/examples/vue/apollo-composable/src/gql/graphql.ts index 8cd3683c51c..565d8430272 100644 --- a/examples/vue/apollo-composable/src/gql/graphql.ts +++ b/examples/vue/apollo-composable/src/gql/graphql.ts @@ -6,8 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/vue/urql/src/gql/fragment-masking.ts b/examples/vue/urql/src/gql/fragment-masking.ts index c2ce23eb49c..bb601eea66b 100644 --- a/examples/vue/urql/src/gql/fragment-masking.ts +++ b/examples/vue/urql/src/gql/fragment-masking.ts @@ -1,5 +1,4 @@ import type { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import type { Empty, Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -10,11 +9,6 @@ export type FragmentType> : never : never; -// return union with empty object if `fragmentType` is `Incremental -export function useFragment( - _documentNode: DocumentTypeDecoration, - fragmentType: FragmentType, any>> | null | undefined -): TType | Empty | null | undefined; // return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, diff --git a/examples/vue/urql/src/gql/graphql.ts b/examples/vue/urql/src/gql/graphql.ts index 8cd3683c51c..565d8430272 100644 --- a/examples/vue/urql/src/gql/graphql.ts +++ b/examples/vue/urql/src/gql/graphql.ts @@ -6,8 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/vue/villus/src/gql/fragment-masking.ts b/examples/vue/villus/src/gql/fragment-masking.ts index c2ce23eb49c..bb601eea66b 100644 --- a/examples/vue/villus/src/gql/fragment-masking.ts +++ b/examples/vue/villus/src/gql/fragment-masking.ts @@ -1,5 +1,4 @@ import type { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import type { Empty, Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -10,11 +9,6 @@ export type FragmentType> : never : never; -// return union with empty object if `fragmentType` is `Incremental -export function useFragment( - _documentNode: DocumentTypeDecoration, - fragmentType: FragmentType, any>> | null | undefined -): TType | Empty | null | undefined; // return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, diff --git a/examples/vue/villus/src/gql/graphql.ts b/examples/vue/villus/src/gql/graphql.ts index 8cd3683c51c..565d8430272 100644 --- a/examples/vue/villus/src/gql/graphql.ts +++ b/examples/vue/villus/src/gql/graphql.ts @@ -6,8 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/yoga-tests/src/gql/fragment-masking.ts b/examples/yoga-tests/src/gql/fragment-masking.ts index 99734b9d4ee..dc2836d43e3 100644 --- a/examples/yoga-tests/src/gql/fragment-masking.ts +++ b/examples/yoga-tests/src/gql/fragment-masking.ts @@ -1,5 +1,4 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { Empty, Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -10,11 +9,6 @@ export type FragmentType> : never : never; -// return union with empty object if `fragmentType` is `Incremental -export function useFragment( - _documentNode: DocumentTypeDecoration, - fragmentType: FragmentType, any>> | null | undefined -): TType | Empty | null | undefined; // return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, diff --git a/examples/yoga-tests/src/gql/graphql.ts b/examples/yoga-tests/src/gql/graphql.ts index a0ff73cdea7..0c75ab686bc 100644 --- a/examples/yoga-tests/src/gql/graphql.ts +++ b/examples/yoga-tests/src/gql/graphql.ts @@ -6,8 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/packages/plugins/typescript/operations/tests/__snapshots__/ts-documents.spec.ts.snap b/packages/plugins/typescript/operations/tests/__snapshots__/ts-documents.spec.ts.snap index 6c2090b6654..a2e20b2f3be 100644 --- a/packages/plugins/typescript/operations/tests/__snapshots__/ts-documents.spec.ts.snap +++ b/packages/plugins/typescript/operations/tests/__snapshots__/ts-documents.spec.ts.snap @@ -70,7 +70,6 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { @@ -362,7 +361,6 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { @@ -481,7 +479,6 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { @@ -577,7 +574,6 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { diff --git a/packages/plugins/typescript/operations/tests/ts-documents.spec.ts b/packages/plugins/typescript/operations/tests/ts-documents.spec.ts index 4d0726266b3..7a358db32b2 100644 --- a/packages/plugins/typescript/operations/tests/ts-documents.spec.ts +++ b/packages/plugins/typescript/operations/tests/ts-documents.spec.ts @@ -4050,8 +4050,7 @@ describe('TypeScript Operations Plugin', () => { export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Empty = { [P in keyof T]?: never }; - export type Incremental = T & { ' $defer': true }; + export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -4161,8 +4160,7 @@ describe('TypeScript Operations Plugin', () => { export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Empty = { [P in keyof T]?: never }; - export type Incremental = T & { ' $defer': true }; + export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -4250,8 +4248,7 @@ describe('TypeScript Operations Plugin', () => { export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Empty = { [P in keyof T]?: never }; - export type Incremental = T & { ' $defer': true }; + export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/packages/plugins/typescript/resolvers/tests/__snapshots__/ts-resolvers.spec.ts.snap b/packages/plugins/typescript/resolvers/tests/__snapshots__/ts-resolvers.spec.ts.snap index b28bd58329d..48ad96742f7 100644 --- a/packages/plugins/typescript/resolvers/tests/__snapshots__/ts-resolvers.spec.ts.snap +++ b/packages/plugins/typescript/resolvers/tests/__snapshots__/ts-resolvers.spec.ts.snap @@ -7,7 +7,6 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; export type Incremental = T & { ' $defer': true }; import { GraphQLResolveInfo, GraphQLScalarType, GraphQLScalarTypeConfig } from 'graphql'; export type Omit = Pick>; @@ -482,7 +481,6 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Empty = { [P in keyof T]?: never }; export type Incremental = T & { ' $defer': true }; import { GraphQLResolveInfo, GraphQLScalarType, GraphQLScalarTypeConfig } from 'graphql'; export type Omit = Pick>; diff --git a/packages/plugins/typescript/typescript/src/visitor.ts b/packages/plugins/typescript/typescript/src/visitor.ts index c1bbd6150dc..f3931f7a3d4 100644 --- a/packages/plugins/typescript/typescript/src/visitor.ts +++ b/packages/plugins/typescript/typescript/src/visitor.ts @@ -50,8 +50,7 @@ export const EXACT_SIGNATURE = `type Exact export const MAKE_OPTIONAL_SIGNATURE = `type MakeOptional = Omit & { [SubKey in K]?: Maybe };`; export const MAKE_MAYBE_SIGNATURE = `type MakeMaybe = Omit & { [SubKey in K]: Maybe };`; export const MAKE_EMPTY_SIGNATURE = `type MakeEmpty = { [_ in K]?: never };`; -export const MAKE_ALL_EMPTY_SIGNATURE = `type Empty = { [P in keyof T]?: never };`; -export const MAKE_INCREMENTAL_SIGNATURE = `type Incremental = T & { ' $defer': true };`; +export const MAKE_INCREMENTAL_SIGNATURE = `type Incremental = T | { [P in keyof T]?: never };`; export class TsVisitor< TRawConfig extends TypeScriptPluginConfig = TypeScriptPluginConfig, @@ -163,7 +162,6 @@ export class TsVisitor< this.getMakeOptionalDefinition(), this.getMakeMaybeDefinition(), this.getMakeEmptyDefinition(), - this.getMakeAllEmptyDefinition(), this.getIncrementalDefinition(), ]; @@ -197,10 +195,6 @@ export class TsVisitor< return `${this.getExportPrefix()}${MAKE_EMPTY_SIGNATURE}`; } - public getMakeAllEmptyDefinition(): string { - return `${this.getExportPrefix()}${MAKE_ALL_EMPTY_SIGNATURE}`; - } - public getIncrementalDefinition(): string { return `${this.getExportPrefix()}${MAKE_INCREMENTAL_SIGNATURE}`; } diff --git a/packages/presets/client/src/fragment-masking-plugin.ts b/packages/presets/client/src/fragment-masking-plugin.ts index c9a3e83a80a..bec6c3132d8 100644 --- a/packages/presets/client/src/fragment-masking-plugin.ts +++ b/packages/presets/client/src/fragment-masking-plugin.ts @@ -23,13 +23,9 @@ export function makeFragmentData< const defaultUnmaskFunctionName = 'useFragment'; const modifyType = ( - initialRawType: string, + rawType: string, opts: { nullable: boolean; list: 'with-list' | 'only-list' | false; empty?: boolean } ) => { - let rawType = initialRawType; - if (opts.empty) { - rawType = `${initialRawType} | Empty<${initialRawType}>`; - } return `${ opts.list === 'only-list' ? `ReadonlyArray<${rawType}>` @@ -41,23 +37,15 @@ const modifyType = ( const createUnmaskFunctionTypeDefinition = ( unmaskFunctionName = defaultUnmaskFunctionName, - opts: { nullable: boolean; list: 'with-list' | 'only-list' | false }, - empty?: boolean + opts: { nullable: boolean; list: 'with-list' | 'only-list' | false } ) => { - const tType = empty ? 'Incremental' : 'TType'; - return `export function ${unmaskFunctionName}( _documentNode: DocumentTypeDecoration, - fragmentType: ${modifyType(`FragmentType>`, opts)} -): ${modifyType('TType', { ...opts, empty })}`; + fragmentType: ${modifyType(`FragmentType>`, opts)} +): ${modifyType('TType', opts)}`; }; const createUnmaskFunctionTypeDefinitions = (unmaskFunctionName = defaultUnmaskFunctionName) => [ - `// return union with empty object if \`fragmentType\` is \`Incremental\n${createUnmaskFunctionTypeDefinition( - unmaskFunctionName, - { nullable: true, list: false }, - true - )}`, `// return non-nullable if \`fragmentType\` is non-nullable\n${createUnmaskFunctionTypeDefinition( unmaskFunctionName, { nullable: false, list: false } @@ -91,20 +79,14 @@ export const plugin: PluginFunction<{ useTypeImports?: boolean; augmentedModuleName?: string; unmaskFunctionName?: string; - emitLegacyCommonJSImports?: boolean; -}> = (_, __, { useTypeImports, augmentedModuleName, unmaskFunctionName, emitLegacyCommonJSImports }, _info) => { +}> = (_, __, { useTypeImports, augmentedModuleName, unmaskFunctionName }, _info) => { const documentNodeImport = `${ useTypeImports ? 'import type' : 'import' } { ResultOf, DocumentTypeDecoration, } from '@graphql-typed-document-node/core';\n`; - const typeHelpersImport = `${useTypeImports ? 'import type' : 'import'} { Empty, Incremental } from './graphql${ - emitLegacyCommonJSImports ? '' : '.js' - }';\n`; - if (augmentedModuleName == null) { return [ documentNodeImport, - typeHelpersImport, `\n`, fragmentTypeHelper, `\n`, diff --git a/packages/presets/client/tests/client-preset.spec.ts b/packages/presets/client/tests/client-preset.spec.ts index c6a3c1f1c7c..c1d59501687 100644 --- a/packages/presets/client/tests/client-preset.spec.ts +++ b/packages/presets/client/tests/client-preset.spec.ts @@ -344,8 +344,7 @@ export * from "./gql";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Empty = { [P in keyof T]?: never }; - export type Incremental = T & { ' $defer': true }; + export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -475,8 +474,7 @@ export * from "./gql";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Empty = { [P in keyof T]?: never }; - export type Incremental = T & { ' $defer': true }; + export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -589,8 +587,7 @@ export * from "./gql";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Empty = { [P in keyof T]?: never }; - export type Incremental = T & { ' $defer': true }; + export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -1243,8 +1240,7 @@ export * from "./gql.js";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Empty = { [P in keyof T]?: never }; - export type Incremental = T & { ' $defer': true }; + export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -1322,8 +1318,7 @@ export * from "./gql.js";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Empty = { [P in keyof T]?: never }; - export type Incremental = T & { ' $defer': true }; + export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -1404,8 +1399,7 @@ export * from "./gql.js";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Empty = { [P in keyof T]?: never }; - export type Incremental = T & { ' $defer': true }; + export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -1486,8 +1480,7 @@ export * from "./gql.js";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Empty = { [P in keyof T]?: never }; - export type Incremental = T & { ' $defer': true }; + export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -1570,8 +1563,7 @@ export * from "./gql.js";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Empty = { [P in keyof T]?: never }; - export type Incremental = T & { ' $defer': true }; + export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -1661,8 +1653,7 @@ export * from "./gql.js";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Empty = { [P in keyof T]?: never }; - export type Incremental = T & { ' $defer': true }; + export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -1743,8 +1734,7 @@ export * from "./gql.js";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Empty = { [P in keyof T]?: never }; - export type Incremental = T & { ' $defer': true }; + export type Incremental = T & { ' $defer': true }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; From bd2d527a52f47628b9e47011e8ed38f08649213c Mon Sep 17 00:00:00 2001 From: beerose Date: Mon, 27 Mar 2023 23:09:42 +0200 Subject: [PATCH 26/47] Store deferred fields info on query metadata --- .../gql/fragment-masking.ts | 21 +++++++- .../gql/fragment-masking.ts | 21 +++++++- .../gql/fragment-masking.ts | 21 +++++++- .../graphql/fragment-masking.ts | 21 +++++++- .../src/gql/fragment-masking.ts | 21 +++++++- .../src/gql/fragment-masking.ts | 21 +++++++- .../cypress/e2e/end2end.cy.ts | 3 +- .../react/apollo-client-defer/src/App.tsx | 6 ++- .../src/gql/fragment-masking.ts | 11 +++-- .../apollo-client-defer/src/gql/graphql.ts | 1 + .../src/gql/fragment-masking.ts | 21 +++++++- .../apollo-client/src/gql/fragment-masking.ts | 21 +++++++- .../http-executor/src/gql/fragment-masking.ts | 21 +++++++- .../react/nextjs-swr/gql/fragment-masking.ts | 21 +++++++- .../src/gql/fragment-masking.ts | 21 +++++++- .../react/urql/src/gql/fragment-masking.ts | 21 +++++++- .../src/gql/fragment-masking.ts | 21 +++++++- .../src/gql/fragment-masking.ts | 21 +++++++- .../src/gql/fragment-masking.ts | 21 +++++++- .../src/gql/fragment-masking.ts | 21 +++++++- .../vite-react-ts/src/gql/fragment-masking.ts | 21 +++++++- .../src/gql/fragment-masking.ts | 21 +++++++- examples/vue/urql/src/gql/fragment-masking.ts | 21 +++++++- .../vue/villus/src/gql/fragment-masking.ts | 21 +++++++- .../yoga-tests/src/gql/fragment-masking.ts | 21 +++++++- .../src/client-side-base-visitor.ts | 30 +++++++++++- .../__snapshots__/ts-documents.spec.ts.snap | 8 +-- .../operations/tests/ts-documents.spec.ts | 6 +-- .../__snapshots__/ts-resolvers.spec.ts.snap | 4 +- .../client/src/fragment-masking-plugin.ts | 28 ++++++++++- .../client/tests/client-preset.spec.ts | 49 ++++++++++++------- 31 files changed, 530 insertions(+), 57 deletions(-) diff --git a/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts b/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts index dc2836d43e3..0c6a1633db1 100644 --- a/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts +++ b/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts @@ -1,4 +1,5 @@ -import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; +import { FragmentDefinitionNode } from 'graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -46,3 +47,21 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } + +export function isFragmentReady( + queryNode: DocumentTypeDecoration, // works with strings + fragmentNode: TypedDocumentNode, // doesn't work with strings yet + data: TQuery +): data is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + ?.deferredFields; + if (deferredFields) { + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; + const fields = fragName ? deferredFields[fragName] : []; + + return fields.length > 0 && fields.some(field => field in (data as any)); + } + + return true; +} diff --git a/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts b/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts index dc2836d43e3..0c6a1633db1 100644 --- a/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts +++ b/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts @@ -1,4 +1,5 @@ -import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; +import { FragmentDefinitionNode } from 'graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -46,3 +47,21 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } + +export function isFragmentReady( + queryNode: DocumentTypeDecoration, // works with strings + fragmentNode: TypedDocumentNode, // doesn't work with strings yet + data: TQuery +): data is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + ?.deferredFields; + if (deferredFields) { + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; + const fields = fragName ? deferredFields[fragName] : []; + + return fields.length > 0 && fields.some(field => field in (data as any)); + } + + return true; +} diff --git a/dev-test/gql-tag-operations/gql/fragment-masking.ts b/dev-test/gql-tag-operations/gql/fragment-masking.ts index dc2836d43e3..0c6a1633db1 100644 --- a/dev-test/gql-tag-operations/gql/fragment-masking.ts +++ b/dev-test/gql-tag-operations/gql/fragment-masking.ts @@ -1,4 +1,5 @@ -import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; +import { FragmentDefinitionNode } from 'graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -46,3 +47,21 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } + +export function isFragmentReady( + queryNode: DocumentTypeDecoration, // works with strings + fragmentNode: TypedDocumentNode, // doesn't work with strings yet + data: TQuery +): data is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + ?.deferredFields; + if (deferredFields) { + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; + const fields = fragName ? deferredFields[fragName] : []; + + return fields.length > 0 && fields.some(field => field in (data as any)); + } + + return true; +} diff --git a/dev-test/gql-tag-operations/graphql/fragment-masking.ts b/dev-test/gql-tag-operations/graphql/fragment-masking.ts index dc2836d43e3..0c6a1633db1 100644 --- a/dev-test/gql-tag-operations/graphql/fragment-masking.ts +++ b/dev-test/gql-tag-operations/graphql/fragment-masking.ts @@ -1,4 +1,5 @@ -import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; +import { FragmentDefinitionNode } from 'graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -46,3 +47,21 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } + +export function isFragmentReady( + queryNode: DocumentTypeDecoration, // works with strings + fragmentNode: TypedDocumentNode, // doesn't work with strings yet + data: TQuery +): data is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + ?.deferredFields; + if (deferredFields) { + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; + const fields = fragName ? deferredFields[fragName] : []; + + return fields.length > 0 && fields.some(field => field in (data as any)); + } + + return true; +} diff --git a/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts b/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts index dc2836d43e3..0c6a1633db1 100644 --- a/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts +++ b/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts @@ -1,4 +1,5 @@ -import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; +import { FragmentDefinitionNode } from 'graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -46,3 +47,21 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } + +export function isFragmentReady( + queryNode: DocumentTypeDecoration, // works with strings + fragmentNode: TypedDocumentNode, // doesn't work with strings yet + data: TQuery +): data is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + ?.deferredFields; + if (deferredFields) { + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; + const fields = fragName ? deferredFields[fragName] : []; + + return fields.length > 0 && fields.some(field => field in (data as any)); + } + + return true; +} diff --git a/examples/persisted-documents/src/gql/fragment-masking.ts b/examples/persisted-documents/src/gql/fragment-masking.ts index dc2836d43e3..0c6a1633db1 100644 --- a/examples/persisted-documents/src/gql/fragment-masking.ts +++ b/examples/persisted-documents/src/gql/fragment-masking.ts @@ -1,4 +1,5 @@ -import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; +import { FragmentDefinitionNode } from 'graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -46,3 +47,21 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } + +export function isFragmentReady( + queryNode: DocumentTypeDecoration, // works with strings + fragmentNode: TypedDocumentNode, // doesn't work with strings yet + data: TQuery +): data is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + ?.deferredFields; + if (deferredFields) { + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; + const fields = fragName ? deferredFields[fragName] : []; + + return fields.length > 0 && fields.some(field => field in (data as any)); + } + + return true; +} diff --git a/examples/react/apollo-client-defer/cypress/e2e/end2end.cy.ts b/examples/react/apollo-client-defer/cypress/e2e/end2end.cy.ts index b76795a439d..312e7b4546b 100644 --- a/examples/react/apollo-client-defer/cypress/e2e/end2end.cy.ts +++ b/examples/react/apollo-client-defer/cypress/e2e/end2end.cy.ts @@ -4,7 +4,8 @@ describe('template spec', () => { cy.get('.App').should('contain', 'I am speed'); cy.get('.App').should('not.contain', 'I am slow'); - cy.wait(1000); + cy.wait(5000); cy.get('.App').should('contain', 'I am slow'); + cy.get('.App').should('contain', 'I am slow inlined fragment'); }); }); diff --git a/examples/react/apollo-client-defer/src/App.tsx b/examples/react/apollo-client-defer/src/App.tsx index 515fb97af48..53ca0bf5c32 100644 --- a/examples/react/apollo-client-defer/src/App.tsx +++ b/examples/react/apollo-client-defer/src/App.tsx @@ -31,7 +31,11 @@ const InlinedSlowDataField = (props: { data: SlowAndFastFieldWithDeferQuery }) = // @ts-expect-error - this field should be either undefined or a string const _ = props.data.inlinedSlowField.toLowerCase(); } catch (e) {} - return

{props.data.inlinedSlowField}

; + + if (!props.data.inlinedSlowField) { + return null; + } + return

{props.data.inlinedSlowField} inlined fragment

; }; function App() { diff --git a/examples/react/apollo-client-defer/src/gql/fragment-masking.ts b/examples/react/apollo-client-defer/src/gql/fragment-masking.ts index 328e332216e..0c6a1633db1 100644 --- a/examples/react/apollo-client-defer/src/gql/fragment-masking.ts +++ b/examples/react/apollo-client-defer/src/gql/fragment-masking.ts @@ -49,17 +49,18 @@ export function makeFragmentData, FT } export function isFragmentReady( - queryNode: DocumentTypeDecoration, // works for string - fragmentNode: TypedDocumentNode, // doesn't work with string yet + queryNode: DocumentTypeDecoration, // works with strings + fragmentNode: TypedDocumentNode, // doesn't work with strings yet data: TQuery ): data is FragmentType { - const deferredFields = (queryNode as { __meta__?: Record }).__meta__?.deferredFields; + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + ?.deferredFields; if (deferredFields) { const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; const fragName = fragDef?.name?.value; - const field = fragName && deferredFields[fragName]; + const fields = fragName ? deferredFields[fragName] : []; - return field && (data as any)[field]; + return fields.length > 0 && fields.some(field => field in (data as any)); } return true; diff --git a/examples/react/apollo-client-defer/src/gql/graphql.ts b/examples/react/apollo-client-defer/src/gql/graphql.ts index 721dc956556..1befb086a8b 100644 --- a/examples/react/apollo-client-defer/src/gql/graphql.ts +++ b/examples/react/apollo-client-defer/src/gql/graphql.ts @@ -73,6 +73,7 @@ export const SlowFieldFragmentFragmentDoc = { ], } as unknown as DocumentNode; export const SlowAndFastFieldWithDeferDocument = { + __meta__: { deferredFields: { SlowFieldFragment: ['slowField'] } }, kind: 'Document', definitions: [ { diff --git a/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts b/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts index dc2836d43e3..0c6a1633db1 100644 --- a/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts +++ b/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts @@ -1,4 +1,5 @@ -import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; +import { FragmentDefinitionNode } from 'graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -46,3 +47,21 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } + +export function isFragmentReady( + queryNode: DocumentTypeDecoration, // works with strings + fragmentNode: TypedDocumentNode, // doesn't work with strings yet + data: TQuery +): data is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + ?.deferredFields; + if (deferredFields) { + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; + const fields = fragName ? deferredFields[fragName] : []; + + return fields.length > 0 && fields.some(field => field in (data as any)); + } + + return true; +} diff --git a/examples/react/apollo-client/src/gql/fragment-masking.ts b/examples/react/apollo-client/src/gql/fragment-masking.ts index dc2836d43e3..0c6a1633db1 100644 --- a/examples/react/apollo-client/src/gql/fragment-masking.ts +++ b/examples/react/apollo-client/src/gql/fragment-masking.ts @@ -1,4 +1,5 @@ -import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; +import { FragmentDefinitionNode } from 'graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -46,3 +47,21 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } + +export function isFragmentReady( + queryNode: DocumentTypeDecoration, // works with strings + fragmentNode: TypedDocumentNode, // doesn't work with strings yet + data: TQuery +): data is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + ?.deferredFields; + if (deferredFields) { + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; + const fields = fragName ? deferredFields[fragName] : []; + + return fields.length > 0 && fields.some(field => field in (data as any)); + } + + return true; +} diff --git a/examples/react/http-executor/src/gql/fragment-masking.ts b/examples/react/http-executor/src/gql/fragment-masking.ts index dc2836d43e3..0c6a1633db1 100644 --- a/examples/react/http-executor/src/gql/fragment-masking.ts +++ b/examples/react/http-executor/src/gql/fragment-masking.ts @@ -1,4 +1,5 @@ -import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; +import { FragmentDefinitionNode } from 'graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -46,3 +47,21 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } + +export function isFragmentReady( + queryNode: DocumentTypeDecoration, // works with strings + fragmentNode: TypedDocumentNode, // doesn't work with strings yet + data: TQuery +): data is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + ?.deferredFields; + if (deferredFields) { + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; + const fields = fragName ? deferredFields[fragName] : []; + + return fields.length > 0 && fields.some(field => field in (data as any)); + } + + return true; +} diff --git a/examples/react/nextjs-swr/gql/fragment-masking.ts b/examples/react/nextjs-swr/gql/fragment-masking.ts index dc2836d43e3..0c6a1633db1 100644 --- a/examples/react/nextjs-swr/gql/fragment-masking.ts +++ b/examples/react/nextjs-swr/gql/fragment-masking.ts @@ -1,4 +1,5 @@ -import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; +import { FragmentDefinitionNode } from 'graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -46,3 +47,21 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } + +export function isFragmentReady( + queryNode: DocumentTypeDecoration, // works with strings + fragmentNode: TypedDocumentNode, // doesn't work with strings yet + data: TQuery +): data is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + ?.deferredFields; + if (deferredFields) { + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; + const fields = fragName ? deferredFields[fragName] : []; + + return fields.length > 0 && fields.some(field => field in (data as any)); + } + + return true; +} diff --git a/examples/react/tanstack-react-query/src/gql/fragment-masking.ts b/examples/react/tanstack-react-query/src/gql/fragment-masking.ts index dc2836d43e3..0c6a1633db1 100644 --- a/examples/react/tanstack-react-query/src/gql/fragment-masking.ts +++ b/examples/react/tanstack-react-query/src/gql/fragment-masking.ts @@ -1,4 +1,5 @@ -import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; +import { FragmentDefinitionNode } from 'graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -46,3 +47,21 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } + +export function isFragmentReady( + queryNode: DocumentTypeDecoration, // works with strings + fragmentNode: TypedDocumentNode, // doesn't work with strings yet + data: TQuery +): data is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + ?.deferredFields; + if (deferredFields) { + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; + const fields = fragName ? deferredFields[fragName] : []; + + return fields.length > 0 && fields.some(field => field in (data as any)); + } + + return true; +} diff --git a/examples/react/urql/src/gql/fragment-masking.ts b/examples/react/urql/src/gql/fragment-masking.ts index dc2836d43e3..0c6a1633db1 100644 --- a/examples/react/urql/src/gql/fragment-masking.ts +++ b/examples/react/urql/src/gql/fragment-masking.ts @@ -1,4 +1,5 @@ -import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; +import { FragmentDefinitionNode } from 'graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -46,3 +47,21 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } + +export function isFragmentReady( + queryNode: DocumentTypeDecoration, // works with strings + fragmentNode: TypedDocumentNode, // doesn't work with strings yet + data: TQuery +): data is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + ?.deferredFields; + if (deferredFields) { + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; + const fields = fragName ? deferredFields[fragName] : []; + + return fields.length > 0 && fields.some(field => field in (data as any)); + } + + return true; +} diff --git a/examples/typescript-esm/src/gql/fragment-masking.ts b/examples/typescript-esm/src/gql/fragment-masking.ts index dc2836d43e3..0c6a1633db1 100644 --- a/examples/typescript-esm/src/gql/fragment-masking.ts +++ b/examples/typescript-esm/src/gql/fragment-masking.ts @@ -1,4 +1,5 @@ -import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; +import { FragmentDefinitionNode } from 'graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -46,3 +47,21 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } + +export function isFragmentReady( + queryNode: DocumentTypeDecoration, // works with strings + fragmentNode: TypedDocumentNode, // doesn't work with strings yet + data: TQuery +): data is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + ?.deferredFields; + if (deferredFields) { + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; + const fields = fragName ? deferredFields[fragName] : []; + + return fields.length > 0 && fields.some(field => field in (data as any)); + } + + return true; +} diff --git a/examples/typescript-graphql-request/src/gql/fragment-masking.ts b/examples/typescript-graphql-request/src/gql/fragment-masking.ts index dc2836d43e3..0c6a1633db1 100644 --- a/examples/typescript-graphql-request/src/gql/fragment-masking.ts +++ b/examples/typescript-graphql-request/src/gql/fragment-masking.ts @@ -1,4 +1,5 @@ -import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; +import { FragmentDefinitionNode } from 'graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -46,3 +47,21 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } + +export function isFragmentReady( + queryNode: DocumentTypeDecoration, // works with strings + fragmentNode: TypedDocumentNode, // doesn't work with strings yet + data: TQuery +): data is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + ?.deferredFields; + if (deferredFields) { + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; + const fields = fragName ? deferredFields[fragName] : []; + + return fields.length > 0 && fields.some(field => field in (data as any)); + } + + return true; +} diff --git a/examples/vite/vite-react-cts/src/gql/fragment-masking.ts b/examples/vite/vite-react-cts/src/gql/fragment-masking.ts index dc2836d43e3..0c6a1633db1 100644 --- a/examples/vite/vite-react-cts/src/gql/fragment-masking.ts +++ b/examples/vite/vite-react-cts/src/gql/fragment-masking.ts @@ -1,4 +1,5 @@ -import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; +import { FragmentDefinitionNode } from 'graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -46,3 +47,21 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } + +export function isFragmentReady( + queryNode: DocumentTypeDecoration, // works with strings + fragmentNode: TypedDocumentNode, // doesn't work with strings yet + data: TQuery +): data is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + ?.deferredFields; + if (deferredFields) { + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; + const fields = fragName ? deferredFields[fragName] : []; + + return fields.length > 0 && fields.some(field => field in (data as any)); + } + + return true; +} diff --git a/examples/vite/vite-react-mts/src/gql/fragment-masking.ts b/examples/vite/vite-react-mts/src/gql/fragment-masking.ts index dc2836d43e3..0c6a1633db1 100644 --- a/examples/vite/vite-react-mts/src/gql/fragment-masking.ts +++ b/examples/vite/vite-react-mts/src/gql/fragment-masking.ts @@ -1,4 +1,5 @@ -import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; +import { FragmentDefinitionNode } from 'graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -46,3 +47,21 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } + +export function isFragmentReady( + queryNode: DocumentTypeDecoration, // works with strings + fragmentNode: TypedDocumentNode, // doesn't work with strings yet + data: TQuery +): data is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + ?.deferredFields; + if (deferredFields) { + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; + const fields = fragName ? deferredFields[fragName] : []; + + return fields.length > 0 && fields.some(field => field in (data as any)); + } + + return true; +} diff --git a/examples/vite/vite-react-ts/src/gql/fragment-masking.ts b/examples/vite/vite-react-ts/src/gql/fragment-masking.ts index dc2836d43e3..0c6a1633db1 100644 --- a/examples/vite/vite-react-ts/src/gql/fragment-masking.ts +++ b/examples/vite/vite-react-ts/src/gql/fragment-masking.ts @@ -1,4 +1,5 @@ -import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; +import { FragmentDefinitionNode } from 'graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -46,3 +47,21 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } + +export function isFragmentReady( + queryNode: DocumentTypeDecoration, // works with strings + fragmentNode: TypedDocumentNode, // doesn't work with strings yet + data: TQuery +): data is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + ?.deferredFields; + if (deferredFields) { + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; + const fields = fragName ? deferredFields[fragName] : []; + + return fields.length > 0 && fields.some(field => field in (data as any)); + } + + return true; +} diff --git a/examples/vue/apollo-composable/src/gql/fragment-masking.ts b/examples/vue/apollo-composable/src/gql/fragment-masking.ts index bb601eea66b..dc0e9fbc362 100644 --- a/examples/vue/apollo-composable/src/gql/fragment-masking.ts +++ b/examples/vue/apollo-composable/src/gql/fragment-masking.ts @@ -1,4 +1,5 @@ -import type { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import type { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; +import type { FragmentDefinitionNode } from 'graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -46,3 +47,21 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } + +export function isFragmentReady( + queryNode: DocumentTypeDecoration, // works with strings + fragmentNode: TypedDocumentNode, // doesn't work with strings yet + data: TQuery +): data is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + ?.deferredFields; + if (deferredFields) { + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; + const fields = fragName ? deferredFields[fragName] : []; + + return fields.length > 0 && fields.some(field => field in (data as any)); + } + + return true; +} diff --git a/examples/vue/urql/src/gql/fragment-masking.ts b/examples/vue/urql/src/gql/fragment-masking.ts index bb601eea66b..dc0e9fbc362 100644 --- a/examples/vue/urql/src/gql/fragment-masking.ts +++ b/examples/vue/urql/src/gql/fragment-masking.ts @@ -1,4 +1,5 @@ -import type { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import type { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; +import type { FragmentDefinitionNode } from 'graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -46,3 +47,21 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } + +export function isFragmentReady( + queryNode: DocumentTypeDecoration, // works with strings + fragmentNode: TypedDocumentNode, // doesn't work with strings yet + data: TQuery +): data is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + ?.deferredFields; + if (deferredFields) { + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; + const fields = fragName ? deferredFields[fragName] : []; + + return fields.length > 0 && fields.some(field => field in (data as any)); + } + + return true; +} diff --git a/examples/vue/villus/src/gql/fragment-masking.ts b/examples/vue/villus/src/gql/fragment-masking.ts index bb601eea66b..dc0e9fbc362 100644 --- a/examples/vue/villus/src/gql/fragment-masking.ts +++ b/examples/vue/villus/src/gql/fragment-masking.ts @@ -1,4 +1,5 @@ -import type { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import type { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; +import type { FragmentDefinitionNode } from 'graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -46,3 +47,21 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } + +export function isFragmentReady( + queryNode: DocumentTypeDecoration, // works with strings + fragmentNode: TypedDocumentNode, // doesn't work with strings yet + data: TQuery +): data is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + ?.deferredFields; + if (deferredFields) { + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; + const fields = fragName ? deferredFields[fragName] : []; + + return fields.length > 0 && fields.some(field => field in (data as any)); + } + + return true; +} diff --git a/examples/yoga-tests/src/gql/fragment-masking.ts b/examples/yoga-tests/src/gql/fragment-masking.ts index dc2836d43e3..0c6a1633db1 100644 --- a/examples/yoga-tests/src/gql/fragment-masking.ts +++ b/examples/yoga-tests/src/gql/fragment-masking.ts @@ -1,4 +1,5 @@ -import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; +import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; +import { FragmentDefinitionNode } from 'graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -46,3 +47,21 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } + +export function isFragmentReady( + queryNode: DocumentTypeDecoration, // works with strings + fragmentNode: TypedDocumentNode, // doesn't work with strings yet + data: TQuery +): data is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + ?.deferredFields; + if (deferredFields) { + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; + const fields = fragName ? deferredFields[fragName] : []; + + return fields.length > 0 && fields.some(field => field in (data as any)); + } + + return true; +} diff --git a/packages/plugins/other/visitor-plugin-common/src/client-side-base-visitor.ts b/packages/plugins/other/visitor-plugin-common/src/client-side-base-visitor.ts index df6196f24e7..00b922c8d16 100644 --- a/packages/plugins/other/visitor-plugin-common/src/client-side-base-visitor.ts +++ b/packages/plugins/other/visitor-plugin-common/src/client-side-base-visitor.ts @@ -409,11 +409,39 @@ export class ClientSideBaseVisitor< let metaString = ''; if (this._onExecutableDocumentNode && node.kind === Kind.OPERATION_DEFINITION) { - const meta = this._onExecutableDocumentNode({ + // find deferred fragments + const deferredFields = node.selectionSet.selections.reduce>((acc, selection) => { + if (selection.kind === Kind.FRAGMENT_SPREAD && selection.directives.some(d => d.name.value === 'defer')) { + const fragmentName = selection.name.value; + const fragment = this.fragmentsGraph.getNodeData(fragmentName); + if (fragment) { + const fields = fragment.node.selectionSet.selections.reduce((acc, selection) => { + if (selection.kind === Kind.FIELD) { + acc.push(selection.name.value); + } + return acc; + }, []); + + acc[fragmentName] = fields; + } + } + return acc; + }, {}); + + let meta: Record | void | undefined; + + meta = this._onExecutableDocumentNode({ kind: Kind.DOCUMENT, definitions, }); + if (Object.keys(deferredFields).length) { + meta = { + ...meta, + deferredFields, + }; + } + if (meta) { metaString = `"__meta__":${JSON.stringify(meta)},`; diff --git a/packages/plugins/typescript/operations/tests/__snapshots__/ts-documents.spec.ts.snap b/packages/plugins/typescript/operations/tests/__snapshots__/ts-documents.spec.ts.snap index a2e20b2f3be..bf869b9fcdf 100644 --- a/packages/plugins/typescript/operations/tests/__snapshots__/ts-documents.spec.ts.snap +++ b/packages/plugins/typescript/operations/tests/__snapshots__/ts-documents.spec.ts.snap @@ -70,7 +70,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -361,7 +361,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -479,7 +479,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -574,7 +574,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/packages/plugins/typescript/operations/tests/ts-documents.spec.ts b/packages/plugins/typescript/operations/tests/ts-documents.spec.ts index 7a358db32b2..148787b59c6 100644 --- a/packages/plugins/typescript/operations/tests/ts-documents.spec.ts +++ b/packages/plugins/typescript/operations/tests/ts-documents.spec.ts @@ -4050,7 +4050,7 @@ describe('TypeScript Operations Plugin', () => { export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = T & { ' $defer': true }; + export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -4160,7 +4160,7 @@ describe('TypeScript Operations Plugin', () => { export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = T & { ' $defer': true }; + export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -4248,7 +4248,7 @@ describe('TypeScript Operations Plugin', () => { export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = T & { ' $defer': true }; + export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/packages/plugins/typescript/resolvers/tests/__snapshots__/ts-resolvers.spec.ts.snap b/packages/plugins/typescript/resolvers/tests/__snapshots__/ts-resolvers.spec.ts.snap index 48ad96742f7..ac3a8d6d8bb 100644 --- a/packages/plugins/typescript/resolvers/tests/__snapshots__/ts-resolvers.spec.ts.snap +++ b/packages/plugins/typescript/resolvers/tests/__snapshots__/ts-resolvers.spec.ts.snap @@ -7,7 +7,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; import { GraphQLResolveInfo, GraphQLScalarType, GraphQLScalarTypeConfig } from 'graphql'; export type Omit = Pick>; export type RequireFields = Omit & { [P in K]-?: NonNullable }; @@ -481,7 +481,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T & { ' $defer': true }; +export type Incremental = T | { [P in keyof T]?: never }; import { GraphQLResolveInfo, GraphQLScalarType, GraphQLScalarTypeConfig } from 'graphql'; export type Omit = Pick>; export type RequireFields = Omit & { [P in K]-?: NonNullable }; diff --git a/packages/presets/client/src/fragment-masking-plugin.ts b/packages/presets/client/src/fragment-masking-plugin.ts index bec6c3132d8..9ad8ac0d645 100644 --- a/packages/presets/client/src/fragment-masking-plugin.ts +++ b/packages/presets/client/src/fragment-masking-plugin.ts @@ -72,6 +72,25 @@ ${createUnmaskFunctionTypeDefinitions(unmaskFunctionName) } `; +const isFragmentReadyFunction = ` +export function isFragmentReady( + queryNode: DocumentTypeDecoration, // works with strings + fragmentNode: TypedDocumentNode, // doesn't work with strings yet + data: TQuery +): data is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__?.deferredFields; + if (deferredFields) { + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; + const fields = fragName ? deferredFields[fragName] : []; + + return fields.length > 0 && fields.some(field => field in (data as any)); + } + + return true; +} +`; + /** * Plugin for generating fragment masking helper functions. */ @@ -82,17 +101,24 @@ export const plugin: PluginFunction<{ }> = (_, __, { useTypeImports, augmentedModuleName, unmaskFunctionName }, _info) => { const documentNodeImport = `${ useTypeImports ? 'import type' : 'import' - } { ResultOf, DocumentTypeDecoration, } from '@graphql-typed-document-node/core';\n`; + } { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core';\n`; + + const fragmentDefinitionNodeImport = `${ + useTypeImports ? 'import type' : 'import' + } { FragmentDefinitionNode } from 'graphql';\n`; if (augmentedModuleName == null) { return [ documentNodeImport, + fragmentDefinitionNodeImport, `\n`, fragmentTypeHelper, `\n`, createUnmaskFunction(unmaskFunctionName), `\n`, makeFragmentDataHelper, + `\n`, + isFragmentReadyFunction, ].join(``); } diff --git a/packages/presets/client/tests/client-preset.spec.ts b/packages/presets/client/tests/client-preset.spec.ts index c1d59501687..5a31f68038b 100644 --- a/packages/presets/client/tests/client-preset.spec.ts +++ b/packages/presets/client/tests/client-preset.spec.ts @@ -344,7 +344,7 @@ export * from "./gql";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = T & { ' $defer': true }; + export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -474,7 +474,7 @@ export * from "./gql";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = T & { ' $defer': true }; + export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -587,7 +587,7 @@ export * from "./gql";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = T & { ' $defer': true }; + export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -754,8 +754,8 @@ export * from "./gql";`); expect(result).toHaveLength(4); const gqlFile = result.find(file => file.filename === 'out1/fragment-masking.ts'); expect(gqlFile.content).toMatchInlineSnapshot(` - "import { ResultOf, DocumentTypeDecoration, } from '@graphql-typed-document-node/core'; - import type { Empty, Incremental } from './graphql'; + "import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; + import { FragmentDefinitionNode } from 'graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration< @@ -769,11 +769,6 @@ export * from "./gql";`); : never : never; - // return union with empty object if \`fragmentType\` is \`Incremental - export function iLikeTurtles( - _documentNode: DocumentTypeDecoration, - fragmentType: FragmentType, any>> | null | undefined - ): TType | Empty | null | undefined; // return non-nullable if \`fragmentType\` is non-nullable export function iLikeTurtles( _documentNode: DocumentTypeDecoration, @@ -807,7 +802,25 @@ export * from "./gql";`); FT extends ResultOf >(data: FT, _fragment: F): FragmentType { return data as FragmentType; - }" + } + + export function isFragmentReady( + queryNode: DocumentTypeDecoration, // works with strings + fragmentNode: TypedDocumentNode, // doesn't work with strings yet + data: TQuery + ): data is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__?.deferredFields; + if (deferredFields) { + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; + const fields = fragName ? deferredFields[fragName] : []; + + return fields.length > 0 && fields.some(field => field in (data as any)); + } + + return true; + } + " `); expect(gqlFile.content).toBeSimilarStringTo(` @@ -1240,7 +1253,7 @@ export * from "./gql.js";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = T & { ' $defer': true }; + export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -1318,7 +1331,7 @@ export * from "./gql.js";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = T & { ' $defer': true }; + export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -1399,7 +1412,7 @@ export * from "./gql.js";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = T & { ' $defer': true }; + export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -1480,7 +1493,7 @@ export * from "./gql.js";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = T & { ' $defer': true }; + export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -1563,7 +1576,7 @@ export * from "./gql.js";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = T & { ' $defer': true }; + export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -1653,7 +1666,7 @@ export * from "./gql.js";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = T & { ' $defer': true }; + export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -1734,7 +1747,7 @@ export * from "./gql.js";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = T & { ' $defer': true }; + export type Incremental = T | { [P in keyof T]?: never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; From 64fa6ff016fc40d170412683e9ce4baea229740d Mon Sep 17 00:00:00 2001 From: beerose Date: Tue, 28 Mar 2023 15:04:10 +0200 Subject: [PATCH 27/47] Traverse OperationDefinitionNode to find all deferred fields --- .../react/apollo-client-defer/public/vite.svg | 1 - .../react/apollo-client-defer/src/App.css | 38 -- .../react/apollo-client-defer/src/App.tsx | 1 - .../react/apollo-client-defer/src/main.css | 11 - .../react/apollo-client-defer/src/main.tsx | 1 - .../src/client-side-base-visitor.ts | 110 ++--- .../client/tests/client-preset.spec.ts | 390 ++++++++++++++++++ .../tests/fixtures/with-deferred-fragment.ts | 26 ++ 8 files changed, 479 insertions(+), 99 deletions(-) delete mode 100644 examples/react/apollo-client-defer/public/vite.svg delete mode 100644 examples/react/apollo-client-defer/src/App.css delete mode 100644 examples/react/apollo-client-defer/src/main.css create mode 100644 packages/presets/client/tests/fixtures/with-deferred-fragment.ts diff --git a/examples/react/apollo-client-defer/public/vite.svg b/examples/react/apollo-client-defer/public/vite.svg deleted file mode 100644 index e7b8dfb1b2a..00000000000 --- a/examples/react/apollo-client-defer/public/vite.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/examples/react/apollo-client-defer/src/App.css b/examples/react/apollo-client-defer/src/App.css deleted file mode 100644 index 74b5e053450..00000000000 --- a/examples/react/apollo-client-defer/src/App.css +++ /dev/null @@ -1,38 +0,0 @@ -.App { - text-align: center; -} - -.App-logo { - height: 40vmin; - pointer-events: none; -} - -@media (prefers-reduced-motion: no-preference) { - .App-logo { - animation: App-logo-spin infinite 20s linear; - } -} - -.App-header { - background-color: #282c34; - min-height: 100vh; - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - font-size: calc(10px + 2vmin); - color: white; -} - -.App-link { - color: #61dafb; -} - -@keyframes App-logo-spin { - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); - } -} diff --git a/examples/react/apollo-client-defer/src/App.tsx b/examples/react/apollo-client-defer/src/App.tsx index 53ca0bf5c32..97f5fc4ff8c 100644 --- a/examples/react/apollo-client-defer/src/App.tsx +++ b/examples/react/apollo-client-defer/src/App.tsx @@ -1,6 +1,5 @@ import { useQuery } from '@apollo/client'; -import './App.css'; import { useFragment, graphql, FragmentType, isFragmentReady } from './gql'; import { SlowAndFastFieldWithDeferQuery } from './gql/graphql'; diff --git a/examples/react/apollo-client-defer/src/main.css b/examples/react/apollo-client-defer/src/main.css deleted file mode 100644 index 7323ae85c54..00000000000 --- a/examples/react/apollo-client-defer/src/main.css +++ /dev/null @@ -1,11 +0,0 @@ -body { - margin: 0; - font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', - 'Droid Sans', 'Helvetica Neue', sans-serif; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - -code { - font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace; -} diff --git a/examples/react/apollo-client-defer/src/main.tsx b/examples/react/apollo-client-defer/src/main.tsx index f94b44f7bb0..21031c42f1c 100644 --- a/examples/react/apollo-client-defer/src/main.tsx +++ b/examples/react/apollo-client-defer/src/main.tsx @@ -1,6 +1,5 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; -import './main.css'; import App from './App'; import { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client'; diff --git a/packages/plugins/other/visitor-plugin-common/src/client-side-base-visitor.ts b/packages/plugins/other/visitor-plugin-common/src/client-side-base-visitor.ts index 00b922c8d16..c943d33996b 100644 --- a/packages/plugins/other/visitor-plugin-common/src/client-side-base-visitor.ts +++ b/packages/plugins/other/visitor-plugin-common/src/client-side-base-visitor.ts @@ -5,12 +5,15 @@ import autoBind from 'auto-bind'; import { pascalCase } from 'change-case-all'; import { DepGraph } from 'dependency-graph'; import { + DefinitionNode, + DirectiveNode, DocumentNode, FragmentDefinitionNode, FragmentSpreadNode, GraphQLSchema, Kind, OperationDefinitionNode, + SelectionNode, print, } from 'graphql'; import gqlTag from 'graphql-tag'; @@ -407,47 +410,15 @@ export class ClientSideBaseVisitor< } let metaString = ''; - if (this._onExecutableDocumentNode && node.kind === Kind.OPERATION_DEFINITION) { - // find deferred fragments - const deferredFields = node.selectionSet.selections.reduce>((acc, selection) => { - if (selection.kind === Kind.FRAGMENT_SPREAD && selection.directives.some(d => d.name.value === 'defer')) { - const fragmentName = selection.name.value; - const fragment = this.fragmentsGraph.getNodeData(fragmentName); - if (fragment) { - const fields = fragment.node.selectionSet.selections.reduce((acc, selection) => { - if (selection.kind === Kind.FIELD) { - acc.push(selection.name.value); - } - return acc; - }, []); - - acc[fragmentName] = fields; - } - } - return acc; - }, {}); - - let meta: Record | void | undefined; - - meta = this._onExecutableDocumentNode({ - kind: Kind.DOCUMENT, - definitions, - }); - - if (Object.keys(deferredFields).length) { - meta = { - ...meta, - deferredFields, - }; - } + const meta = this._getGraphQLCodegenMetadata(node, definitions); if (meta) { - metaString = `"__meta__":${JSON.stringify(meta)},`; - if (this._omitDefinitions === true) { - return `{${metaString.slice(0, -1)}}`; + return `{${`"__meta__":${JSON.stringify(meta)},`.slice(0, -1)}}`; } + + metaString = `"__meta__":${JSON.stringify(meta)},`; } } @@ -455,21 +426,16 @@ export class ClientSideBaseVisitor< } if (this.config.documentMode === DocumentMode.string) { - let meta: ExecutableDocumentNodeMeta | void; - if (this._onExecutableDocumentNode && node.kind === Kind.OPERATION_DEFINITION) { - meta = this._onExecutableDocumentNode({ - kind: Kind.DOCUMENT, - definitions: gqlTag([doc]).definitions, - }); + const meta = this._getGraphQLCodegenMetadata(node, gqlTag([doc]).definitions); - if (meta && this._omitDefinitions === true) { - return `{${`"__meta__":${JSON.stringify(meta)},`.slice(0, -1)}}`; + if (meta) { + if (this._omitDefinitions === true) { + return `{${`"__meta__":${JSON.stringify(meta)},`.slice(0, -1)}}`; + } + return `new TypedDocumentString(\`${doc}\`, ${JSON.stringify(meta)})`; } } - if (meta) { - return `new TypedDocumentString(\`${doc}\`, ${JSON.stringify(meta)})`; - } return `new TypedDocumentString(\`${doc}\`)`; } @@ -479,6 +445,56 @@ export class ClientSideBaseVisitor< return (gqlImport.propName || 'gql') + '`' + doc + '`'; } + protected _getGraphQLCodegenMetadata( + node: OperationDefinitionNode, + definitions?: ReadonlyArray + ): Record | void | undefined { + let meta: Record | void | undefined; + + meta = this._onExecutableDocumentNode({ + kind: Kind.DOCUMENT, + definitions, + }); + + const deferredFields = this._findDeferredFields(node); + if (Object.keys(deferredFields).length) { + meta = { + ...meta, + deferredFields, + }; + } + + return meta; + } + + protected _findDeferredFields(node: OperationDefinitionNode): { [fargmentName: string]: string[] } { + const deferredFields: { [fargmentName: string]: string[] } = {}; + const queue: SelectionNode[] = [...node.selectionSet.selections]; + while (queue.length) { + const selection = queue.shift(); + if ( + selection.kind === Kind.FRAGMENT_SPREAD && + selection.directives.some((d: DirectiveNode) => d.name.value === 'defer') + ) { + const fragmentName = selection.name.value; + const fragment = this.fragmentsGraph.getNodeData(fragmentName); + if (fragment) { + const fields = fragment.node.selectionSet.selections.reduce((acc, selection) => { + if (selection.kind === Kind.FIELD) { + acc.push(selection.name.value); + } + return acc; + }, []); + + deferredFields[fragmentName] = fields; + } + } else if (selection.kind === Kind.FIELD && selection.selectionSet) { + queue.push(...selection.selectionSet.selections); + } + } + return deferredFields; + } + protected _generateFragment(fragmentDocument: FragmentDefinitionNode): string | void { const name = this.getFragmentVariableName(fragmentDocument); const fragmentTypeSuffix = this.getFragmentSuffix(fragmentDocument); diff --git a/packages/presets/client/tests/client-preset.spec.ts b/packages/presets/client/tests/client-preset.spec.ts index 5a31f68038b..1f86faadb82 100644 --- a/packages/presets/client/tests/client-preset.spec.ts +++ b/packages/presets/client/tests/client-preset.spec.ts @@ -1711,6 +1711,396 @@ export * from "./gql.js";`); `); }); + describe('handles @defer directive', () => { + it('generates correct types and metadata', async () => { + const result = await executeCodegen({ + schema: [ + /* GraphQL */ ` + type Query { + foo: Foo + foos: [Foo] + } + + type Foo { + value: String + } + `, + ], + documents: path.join(__dirname, 'fixtures/with-deferred-fragment.ts'), + generates: { + 'out1/': { + preset, + }, + }, + }); + + const graphqlFile = result.find(file => file.filename === 'out1/graphql.ts'); + expect(graphqlFile.content).toMatchInlineSnapshot(` + "/* eslint-disable */ + import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core'; + export type Maybe = T | null; + export type InputMaybe = Maybe; + export type Exact = { [K in keyof T]: T[K] }; + export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; + export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; + export type MakeEmpty = { [_ in K]?: never }; + export type Incremental = T | { [P in keyof T]?: never }; + /** All built-in and custom scalars, mapped to their actual values */ + export type Scalars = { + ID: string; + String: string; + Boolean: boolean; + Int: number; + Float: number; + }; + + export type Foo = { + __typename?: 'Foo'; + value?: Maybe; + }; + + export type Query = { + __typename?: 'Query'; + foo?: Maybe; + foos?: Maybe>>; + }; + + export type FooQueryVariables = Exact<{ [key: string]: never; }>; + + + export type FooQuery = { __typename?: 'Query', foo?: ( { __typename?: 'Foo' } & ( + { __typename?: 'Foo' } + & { ' $fragmentRefs'?: { 'FooFragment': Incremental } } + ) ) | null }; + + export type FoosQueryVariables = Exact<{ [key: string]: never; }>; + + + export type FoosQuery = { __typename?: 'Query', foos?: Array<( { __typename?: 'Foo' } & ( + { __typename?: 'Foo' } + & { ' $fragmentRefs'?: { 'FooFragment': Incremental } } + ) ) | null> | null }; + + export type FooFragment = { __typename?: 'Foo', value?: string | null } & { ' $fragmentName'?: 'FooFragment' }; + + export const FooFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Foo"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Foo"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]} as unknown as DocumentNode; + export const FooDocument = {"__meta__":{"deferredFields":{"Foo":["value"]}},"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"Foo"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"foo"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Foo"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"defer"}}]}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Foo"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Foo"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]} as unknown as DocumentNode; + export const FoosDocument = {"__meta__":{"deferredFields":{"Foo":["value"]}},"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"Foos"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"foos"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Foo"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"defer"}}]}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Foo"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Foo"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]} as unknown as DocumentNode;" + `); + }); + + it('works with persisted documents', async () => { + const result = await executeCodegen({ + schema: [ + /* GraphQL */ ` + type Query { + foo: Foo + foos: [Foo] + } + + type Foo { + value: String + } + `, + ], + documents: path.join(__dirname, 'fixtures/with-deferred-fragment.ts'), + generates: { + 'out1/': { + preset, + presetConfig: { + persistedDocuments: true, + }, + }, + }, + }); + + const graphqlFile = result.find(file => file.filename === 'out1/graphql.ts'); + expect(graphqlFile.content).toMatchInlineSnapshot(` + "/* eslint-disable */ + import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core'; + export type Maybe = T | null; + export type InputMaybe = Maybe; + export type Exact = { [K in keyof T]: T[K] }; + export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; + export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; + export type MakeEmpty = { [_ in K]?: never }; + export type Incremental = T | { [P in keyof T]?: never }; + /** All built-in and custom scalars, mapped to their actual values */ + export type Scalars = { + ID: string; + String: string; + Boolean: boolean; + Int: number; + Float: number; + }; + + export type Foo = { + __typename?: 'Foo'; + value?: Maybe; + }; + + export type Query = { + __typename?: 'Query'; + foo?: Maybe; + foos?: Maybe>>; + }; + + export type FooQueryVariables = Exact<{ [key: string]: never; }>; + + + export type FooQuery = { __typename?: 'Query', foo?: ( { __typename?: 'Foo' } & ( + { __typename?: 'Foo' } + & { ' $fragmentRefs'?: { 'FooFragment': Incremental } } + ) ) | null }; + + export type FoosQueryVariables = Exact<{ [key: string]: never; }>; + + + export type FoosQuery = { __typename?: 'Query', foos?: Array<( { __typename?: 'Foo' } & ( + { __typename?: 'Foo' } + & { ' $fragmentRefs'?: { 'FooFragment': Incremental } } + ) ) | null> | null }; + + export type FooFragment = { __typename?: 'Foo', value?: string | null } & { ' $fragmentName'?: 'FooFragment' }; + + export const FooFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Foo"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Foo"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]} as unknown as DocumentNode; + export const FooDocument = {"__meta__":{"hash":"39c47d2da0fb0e6867abbe2ec942d9858f2d76c7","deferredFields":{"Foo":["value"]}},"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"Foo"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"foo"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Foo"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"defer"}}]}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Foo"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Foo"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]} as unknown as DocumentNode; + export const FoosDocument = {"__meta__":{"hash":"8aba765173b2302b9857334e9959d97a2168dbc8","deferredFields":{"Foo":["value"]}},"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"Foos"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"foos"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Foo"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"defer"}}]}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Foo"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Foo"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]} as unknown as DocumentNode;" + `); + }); + + it.only('works with documentMode: string', async () => { + const result = await executeCodegen({ + schema: [ + /* GraphQL */ ` + type Query { + foo: Foo + foos: [Foo] + } + + type Foo { + value: String + } + `, + ], + documents: path.join(__dirname, 'fixtures/with-deferred-fragment.ts'), + generates: { + 'out1/': { + preset, + config: { + documentMode: 'string', + }, + }, + }, + }); + + const graphqlFile = result.find(file => file.filename === 'out1/graphql.ts'); + expect(graphqlFile.content).toMatchInlineSnapshot(` + "/* eslint-disable */ + import { DocumentTypeDecoration } from '@graphql-typed-document-node/core'; + export type Maybe = T | null; + export type InputMaybe = Maybe; + export type Exact = { [K in keyof T]: T[K] }; + export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; + export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; + export type MakeEmpty = { [_ in K]?: never }; + export type Incremental = T | { [P in keyof T]?: never }; + /** All built-in and custom scalars, mapped to their actual values */ + export type Scalars = { + ID: string; + String: string; + Boolean: boolean; + Int: number; + Float: number; + }; + + export type Foo = { + __typename?: 'Foo'; + value?: Maybe; + }; + + export type Query = { + __typename?: 'Query'; + foo?: Maybe; + foos?: Maybe>>; + }; + + export type FooQueryVariables = Exact<{ [key: string]: never; }>; + + + export type FooQuery = { __typename?: 'Query', foo?: ( { __typename?: 'Foo' } & ( + { __typename?: 'Foo' } + & { ' $fragmentRefs'?: { 'FooFragment': Incremental } } + ) ) | null }; + + export type FoosQueryVariables = Exact<{ [key: string]: never; }>; + + + export type FoosQuery = { __typename?: 'Query', foos?: Array<( { __typename?: 'Foo' } & ( + { __typename?: 'Foo' } + & { ' $fragmentRefs'?: { 'FooFragment': Incremental } } + ) ) | null> | null }; + + export type FooFragment = { __typename?: 'Foo', value?: string | null } & { ' $fragmentName'?: 'FooFragment' }; + + export class TypedDocumentString + extends String + implements DocumentTypeDecoration + { + __apiType?: DocumentTypeDecoration['__apiType']; + + constructor(private value: string, public __meta__?: { hash: string }) { + super(value); + } + + toString(): string & DocumentTypeDecoration { + return this.value; + } + } + export const FooFragmentDoc = new TypedDocumentString(\` + fragment Foo on Foo { + value + } + \`) as unknown as TypedDocumentString; + export const FooDocument = new TypedDocumentString(\` + query Foo { + foo { + ...Foo @defer + } + } + fragment Foo on Foo { + value + }\`, {"deferredFields":{"Foo":["value"]}}) as unknown as TypedDocumentString; + export const FoosDocument = new TypedDocumentString(\` + query Foos { + foos { + ...Foo @defer + } + } + fragment Foo on Foo { + value + }\`, {"deferredFields":{"Foo":["value"]}}) as unknown as TypedDocumentString;" + `); + }); + + it('works with documentMode: string and persisted documents', async () => { + const result = await executeCodegen({ + schema: [ + /* GraphQL */ ` + type Query { + foo: Foo + foos: [Foo] + } + + type Foo { + value: String + } + `, + ], + documents: path.join(__dirname, 'fixtures/with-deferred-fragment.ts'), + generates: { + 'out1/': { + preset, + presetConfig: { + persistedDocuments: true, + }, + config: { + documentMode: 'string', + }, + }, + }, + }); + + const graphqlFile = result.find(file => file.filename === 'out1/graphql.ts'); + expect(graphqlFile.content).toMatchInlineSnapshot(` + "/* eslint-disable */ + import { DocumentTypeDecoration } from '@graphql-typed-document-node/core'; + export type Maybe = T | null; + export type InputMaybe = Maybe; + export type Exact = { [K in keyof T]: T[K] }; + export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; + export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; + export type MakeEmpty = { [_ in K]?: never }; + export type Incremental = T | { [P in keyof T]?: never }; + /** All built-in and custom scalars, mapped to their actual values */ + export type Scalars = { + ID: string; + String: string; + Boolean: boolean; + Int: number; + Float: number; + }; + + export type Foo = { + __typename?: 'Foo'; + value?: Maybe; + }; + + export type Query = { + __typename?: 'Query'; + foo?: Maybe; + foos?: Maybe>>; + }; + + export type FooQueryVariables = Exact<{ [key: string]: never; }>; + + + export type FooQuery = { __typename?: 'Query', foo?: ( { __typename?: 'Foo' } & ( + { __typename?: 'Foo' } + & { ' $fragmentRefs'?: { 'FooFragment': Incremental } } + ) ) | null }; + + export type FoosQueryVariables = Exact<{ [key: string]: never; }>; + + + export type FoosQuery = { __typename?: 'Query', foos?: Array<( { __typename?: 'Foo' } & ( + { __typename?: 'Foo' } + & { ' $fragmentRefs'?: { 'FooFragment': Incremental } } + ) ) | null> | null }; + + export type FooFragment = { __typename?: 'Foo', value?: string | null } & { ' $fragmentName'?: 'FooFragment' }; + + export class TypedDocumentString + extends String + implements DocumentTypeDecoration + { + __apiType?: DocumentTypeDecoration['__apiType']; + + constructor(private value: string, public __meta__?: { hash: string }) { + super(value); + } + + toString(): string & DocumentTypeDecoration { + return this.value; + } + } + export const FooFragmentDoc = new TypedDocumentString(\` + fragment Foo on Foo { + value + } + \`) as unknown as TypedDocumentString; + export const FooDocument = new TypedDocumentString(\` + query Foo { + foo { + ...Foo @defer + } + } + fragment Foo on Foo { + value + }\`, {"hash":"39c47d2da0fb0e6867abbe2ec942d9858f2d76c7","deferredFields":{"Foo":["value"]}}}) as unknown as TypedDocumentString; + export const FoosDocument = new TypedDocumentString(\` + query Foos { + foos { + ...Foo @defer + } + } + fragment Foo on Foo { + value + }\`, {"hash":"8aba765173b2302b9857334e9959d97a2168dbc8","deferredFields":{"Foo":["value"]}}}) as unknown as TypedDocumentString;" + `); + }); + }); + describe('documentMode: "string"', () => { it('generates correct types', async () => { const result = await executeCodegen({ diff --git a/packages/presets/client/tests/fixtures/with-deferred-fragment.ts b/packages/presets/client/tests/fixtures/with-deferred-fragment.ts new file mode 100644 index 00000000000..9c6421077ea --- /dev/null +++ b/packages/presets/client/tests/fixtures/with-deferred-fragment.ts @@ -0,0 +1,26 @@ +/* eslint-disable @typescript-eslint/ban-ts-comment */ + +//@ts-ignore +const Query = gql(/* GraphQL */ ` + query Foo { + foo { + ...Foo @defer + } + } +`); + +//@ts-ignore +const LsitQuery = gql(/* GraphQL */ ` + query Foos { + foos { + ...Foo @defer + } + } +`); + +//@ts-ignore +const Fragment = gql(/* GraphQL */ ` + fragment Foo on Foo { + value + } +`); From 938eb5781511befc445589a4b5051c7c782bbe98 Mon Sep 17 00:00:00 2001 From: beerose Date: Tue, 28 Mar 2023 16:23:41 +0200 Subject: [PATCH 28/47] Support string document mode with defer --- .../gql/fragment-masking.ts | 18 +++--- .../gql/fragment-masking.ts | 18 +++--- .../gql/fragment-masking.ts | 18 +++--- .../graphql/fragment-masking.ts | 18 +++--- .../src/gql/fragment-masking.ts | 22 +++---- .../src/gql/graphql.ts | 2 +- .../src/gql/fragment-masking.ts | 18 +++--- .../src/gql/fragment-masking.ts | 18 +++--- .../src/gql/fragment-masking.ts | 18 +++--- .../apollo-client/src/gql/fragment-masking.ts | 18 +++--- .../http-executor/src/gql/fragment-masking.ts | 18 +++--- .../react/nextjs-swr/gql/fragment-masking.ts | 18 +++--- .../src/gql/fragment-masking.ts | 22 +++---- .../tanstack-react-query/src/gql/graphql.ts | 2 +- .../react/urql/src/gql/fragment-masking.ts | 22 +++---- examples/react/urql/src/gql/graphql.ts | 2 +- .../src/gql/fragment-masking.ts | 18 +++--- .../src/gql/fragment-masking.ts | 22 +++---- .../src/gql/graphql.ts | 2 +- .../src/gql/fragment-masking.ts | 18 +++--- .../src/gql/fragment-masking.ts | 18 +++--- .../vite-react-ts/src/gql/fragment-masking.ts | 18 +++--- .../src/gql/fragment-masking.ts | 18 +++--- examples/vue/urql/src/gql/fragment-masking.ts | 18 +++--- .../vue/villus/src/gql/fragment-masking.ts | 18 +++--- .../yoga-tests/src/gql/fragment-masking.ts | 18 +++--- .../typed-document-node/src/index.ts | 2 +- .../client/src/fragment-masking-plugin.ts | 61 ++++++++++++++----- packages/presets/client/src/index.ts | 3 +- .../client/tests/client-preset.spec.ts | 33 +++++----- 30 files changed, 248 insertions(+), 271 deletions(-) diff --git a/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts b/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts index 0c6a1633db1..529cf3dddf2 100644 --- a/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts +++ b/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts @@ -47,21 +47,19 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } - export function isFragmentReady( - queryNode: DocumentTypeDecoration, // works with strings - fragmentNode: TypedDocumentNode, // doesn't work with strings yet + queryNode: TypedDocumentNode, + fragmentNode: TypedDocumentNode, data: TQuery ): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; - if (deferredFields) { - const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; - const fragName = fragDef?.name?.value; - const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => field in (data as any)); - } + if (!deferredFields) return true; + + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; - return true; + const fields = fragName ? deferredFields[fragName] : []; + return fields.length > 0 && fields.some(field => data && field in (data as any)); } diff --git a/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts b/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts index 0c6a1633db1..529cf3dddf2 100644 --- a/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts +++ b/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts @@ -47,21 +47,19 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } - export function isFragmentReady( - queryNode: DocumentTypeDecoration, // works with strings - fragmentNode: TypedDocumentNode, // doesn't work with strings yet + queryNode: TypedDocumentNode, + fragmentNode: TypedDocumentNode, data: TQuery ): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; - if (deferredFields) { - const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; - const fragName = fragDef?.name?.value; - const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => field in (data as any)); - } + if (!deferredFields) return true; + + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; - return true; + const fields = fragName ? deferredFields[fragName] : []; + return fields.length > 0 && fields.some(field => data && field in (data as any)); } diff --git a/dev-test/gql-tag-operations/gql/fragment-masking.ts b/dev-test/gql-tag-operations/gql/fragment-masking.ts index 0c6a1633db1..529cf3dddf2 100644 --- a/dev-test/gql-tag-operations/gql/fragment-masking.ts +++ b/dev-test/gql-tag-operations/gql/fragment-masking.ts @@ -47,21 +47,19 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } - export function isFragmentReady( - queryNode: DocumentTypeDecoration, // works with strings - fragmentNode: TypedDocumentNode, // doesn't work with strings yet + queryNode: TypedDocumentNode, + fragmentNode: TypedDocumentNode, data: TQuery ): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; - if (deferredFields) { - const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; - const fragName = fragDef?.name?.value; - const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => field in (data as any)); - } + if (!deferredFields) return true; + + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; - return true; + const fields = fragName ? deferredFields[fragName] : []; + return fields.length > 0 && fields.some(field => data && field in (data as any)); } diff --git a/dev-test/gql-tag-operations/graphql/fragment-masking.ts b/dev-test/gql-tag-operations/graphql/fragment-masking.ts index 0c6a1633db1..529cf3dddf2 100644 --- a/dev-test/gql-tag-operations/graphql/fragment-masking.ts +++ b/dev-test/gql-tag-operations/graphql/fragment-masking.ts @@ -47,21 +47,19 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } - export function isFragmentReady( - queryNode: DocumentTypeDecoration, // works with strings - fragmentNode: TypedDocumentNode, // doesn't work with strings yet + queryNode: TypedDocumentNode, + fragmentNode: TypedDocumentNode, data: TQuery ): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; - if (deferredFields) { - const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; - const fragName = fragDef?.name?.value; - const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => field in (data as any)); - } + if (!deferredFields) return true; + + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; - return true; + const fields = fragName ? deferredFields[fragName] : []; + return fields.length > 0 && fields.some(field => data && field in (data as any)); } diff --git a/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts b/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts index 0c6a1633db1..1b09672fd35 100644 --- a/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts +++ b/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts @@ -1,5 +1,5 @@ import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; -import { FragmentDefinitionNode } from 'graphql'; +import { TypedDocumentString } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -47,21 +47,17 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } - export function isFragmentReady( - queryNode: DocumentTypeDecoration, // works with strings - fragmentNode: TypedDocumentNode, // doesn't work with strings yet + queryNode: TypedDocumentString, + fragmentNode: TypedDocumentString, data: TQuery ): data is FragmentType { - const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ - ?.deferredFields; - if (deferredFields) { - const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; - const fragName = fragDef?.name?.value; - const fields = fragName ? deferredFields[fragName] : []; + const deferredFields = queryNode.__meta__?.deferredFields as { [fragName: string]: string[] }; + + if (!deferredFields) return true; - return fields.length > 0 && fields.some(field => field in (data as any)); - } + const fragName = fragmentNode.match(/fragments+(w+)Fragments+ons+w+/)?.[1]; - return true; + const fields = fragName ? deferredFields[fragName] : []; + return fields.length > 0 && fields.some(field => data && field in (data as any)); } diff --git a/examples/persisted-documents-string-mode/src/gql/graphql.ts b/examples/persisted-documents-string-mode/src/gql/graphql.ts index de9dfa4bd63..fbc95a503a3 100644 --- a/examples/persisted-documents-string-mode/src/gql/graphql.ts +++ b/examples/persisted-documents-string-mode/src/gql/graphql.ts @@ -40,7 +40,7 @@ export class TypedDocumentString { __apiType?: DocumentTypeDecoration['__apiType']; - constructor(private value: string, public __meta__?: { hash: string }) { + constructor(private value: string, public __meta__?: Record) { super(value); } diff --git a/examples/persisted-documents/src/gql/fragment-masking.ts b/examples/persisted-documents/src/gql/fragment-masking.ts index 0c6a1633db1..529cf3dddf2 100644 --- a/examples/persisted-documents/src/gql/fragment-masking.ts +++ b/examples/persisted-documents/src/gql/fragment-masking.ts @@ -47,21 +47,19 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } - export function isFragmentReady( - queryNode: DocumentTypeDecoration, // works with strings - fragmentNode: TypedDocumentNode, // doesn't work with strings yet + queryNode: TypedDocumentNode, + fragmentNode: TypedDocumentNode, data: TQuery ): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; - if (deferredFields) { - const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; - const fragName = fragDef?.name?.value; - const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => field in (data as any)); - } + if (!deferredFields) return true; + + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; - return true; + const fields = fragName ? deferredFields[fragName] : []; + return fields.length > 0 && fields.some(field => data && field in (data as any)); } diff --git a/examples/react/apollo-client-defer/src/gql/fragment-masking.ts b/examples/react/apollo-client-defer/src/gql/fragment-masking.ts index 0c6a1633db1..529cf3dddf2 100644 --- a/examples/react/apollo-client-defer/src/gql/fragment-masking.ts +++ b/examples/react/apollo-client-defer/src/gql/fragment-masking.ts @@ -47,21 +47,19 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } - export function isFragmentReady( - queryNode: DocumentTypeDecoration, // works with strings - fragmentNode: TypedDocumentNode, // doesn't work with strings yet + queryNode: TypedDocumentNode, + fragmentNode: TypedDocumentNode, data: TQuery ): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; - if (deferredFields) { - const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; - const fragName = fragDef?.name?.value; - const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => field in (data as any)); - } + if (!deferredFields) return true; + + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; - return true; + const fields = fragName ? deferredFields[fragName] : []; + return fields.length > 0 && fields.some(field => data && field in (data as any)); } diff --git a/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts b/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts index 0c6a1633db1..529cf3dddf2 100644 --- a/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts +++ b/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts @@ -47,21 +47,19 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } - export function isFragmentReady( - queryNode: DocumentTypeDecoration, // works with strings - fragmentNode: TypedDocumentNode, // doesn't work with strings yet + queryNode: TypedDocumentNode, + fragmentNode: TypedDocumentNode, data: TQuery ): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; - if (deferredFields) { - const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; - const fragName = fragDef?.name?.value; - const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => field in (data as any)); - } + if (!deferredFields) return true; + + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; - return true; + const fields = fragName ? deferredFields[fragName] : []; + return fields.length > 0 && fields.some(field => data && field in (data as any)); } diff --git a/examples/react/apollo-client/src/gql/fragment-masking.ts b/examples/react/apollo-client/src/gql/fragment-masking.ts index 0c6a1633db1..529cf3dddf2 100644 --- a/examples/react/apollo-client/src/gql/fragment-masking.ts +++ b/examples/react/apollo-client/src/gql/fragment-masking.ts @@ -47,21 +47,19 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } - export function isFragmentReady( - queryNode: DocumentTypeDecoration, // works with strings - fragmentNode: TypedDocumentNode, // doesn't work with strings yet + queryNode: TypedDocumentNode, + fragmentNode: TypedDocumentNode, data: TQuery ): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; - if (deferredFields) { - const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; - const fragName = fragDef?.name?.value; - const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => field in (data as any)); - } + if (!deferredFields) return true; + + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; - return true; + const fields = fragName ? deferredFields[fragName] : []; + return fields.length > 0 && fields.some(field => data && field in (data as any)); } diff --git a/examples/react/http-executor/src/gql/fragment-masking.ts b/examples/react/http-executor/src/gql/fragment-masking.ts index 0c6a1633db1..529cf3dddf2 100644 --- a/examples/react/http-executor/src/gql/fragment-masking.ts +++ b/examples/react/http-executor/src/gql/fragment-masking.ts @@ -47,21 +47,19 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } - export function isFragmentReady( - queryNode: DocumentTypeDecoration, // works with strings - fragmentNode: TypedDocumentNode, // doesn't work with strings yet + queryNode: TypedDocumentNode, + fragmentNode: TypedDocumentNode, data: TQuery ): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; - if (deferredFields) { - const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; - const fragName = fragDef?.name?.value; - const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => field in (data as any)); - } + if (!deferredFields) return true; + + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; - return true; + const fields = fragName ? deferredFields[fragName] : []; + return fields.length > 0 && fields.some(field => data && field in (data as any)); } diff --git a/examples/react/nextjs-swr/gql/fragment-masking.ts b/examples/react/nextjs-swr/gql/fragment-masking.ts index 0c6a1633db1..529cf3dddf2 100644 --- a/examples/react/nextjs-swr/gql/fragment-masking.ts +++ b/examples/react/nextjs-swr/gql/fragment-masking.ts @@ -47,21 +47,19 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } - export function isFragmentReady( - queryNode: DocumentTypeDecoration, // works with strings - fragmentNode: TypedDocumentNode, // doesn't work with strings yet + queryNode: TypedDocumentNode, + fragmentNode: TypedDocumentNode, data: TQuery ): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; - if (deferredFields) { - const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; - const fragName = fragDef?.name?.value; - const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => field in (data as any)); - } + if (!deferredFields) return true; + + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; - return true; + const fields = fragName ? deferredFields[fragName] : []; + return fields.length > 0 && fields.some(field => data && field in (data as any)); } diff --git a/examples/react/tanstack-react-query/src/gql/fragment-masking.ts b/examples/react/tanstack-react-query/src/gql/fragment-masking.ts index 0c6a1633db1..1b09672fd35 100644 --- a/examples/react/tanstack-react-query/src/gql/fragment-masking.ts +++ b/examples/react/tanstack-react-query/src/gql/fragment-masking.ts @@ -1,5 +1,5 @@ import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; -import { FragmentDefinitionNode } from 'graphql'; +import { TypedDocumentString } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -47,21 +47,17 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } - export function isFragmentReady( - queryNode: DocumentTypeDecoration, // works with strings - fragmentNode: TypedDocumentNode, // doesn't work with strings yet + queryNode: TypedDocumentString, + fragmentNode: TypedDocumentString, data: TQuery ): data is FragmentType { - const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ - ?.deferredFields; - if (deferredFields) { - const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; - const fragName = fragDef?.name?.value; - const fields = fragName ? deferredFields[fragName] : []; + const deferredFields = queryNode.__meta__?.deferredFields as { [fragName: string]: string[] }; + + if (!deferredFields) return true; - return fields.length > 0 && fields.some(field => field in (data as any)); - } + const fragName = fragmentNode.match(/fragments+(w+)Fragments+ons+w+/)?.[1]; - return true; + const fields = fragName ? deferredFields[fragName] : []; + return fields.length > 0 && fields.some(field => data && field in (data as any)); } diff --git a/examples/react/tanstack-react-query/src/gql/graphql.ts b/examples/react/tanstack-react-query/src/gql/graphql.ts index 3764967a2c0..15028fe108a 100644 --- a/examples/react/tanstack-react-query/src/gql/graphql.ts +++ b/examples/react/tanstack-react-query/src/gql/graphql.ts @@ -1304,7 +1304,7 @@ export class TypedDocumentString { __apiType?: DocumentTypeDecoration['__apiType']; - constructor(private value: string, public __meta__?: { hash: string }) { + constructor(private value: string, public __meta__?: Record) { super(value); } diff --git a/examples/react/urql/src/gql/fragment-masking.ts b/examples/react/urql/src/gql/fragment-masking.ts index 0c6a1633db1..1b09672fd35 100644 --- a/examples/react/urql/src/gql/fragment-masking.ts +++ b/examples/react/urql/src/gql/fragment-masking.ts @@ -1,5 +1,5 @@ import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; -import { FragmentDefinitionNode } from 'graphql'; +import { TypedDocumentString } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -47,21 +47,17 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } - export function isFragmentReady( - queryNode: DocumentTypeDecoration, // works with strings - fragmentNode: TypedDocumentNode, // doesn't work with strings yet + queryNode: TypedDocumentString, + fragmentNode: TypedDocumentString, data: TQuery ): data is FragmentType { - const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ - ?.deferredFields; - if (deferredFields) { - const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; - const fragName = fragDef?.name?.value; - const fields = fragName ? deferredFields[fragName] : []; + const deferredFields = queryNode.__meta__?.deferredFields as { [fragName: string]: string[] }; + + if (!deferredFields) return true; - return fields.length > 0 && fields.some(field => field in (data as any)); - } + const fragName = fragmentNode.match(/fragments+(w+)Fragments+ons+w+/)?.[1]; - return true; + const fields = fragName ? deferredFields[fragName] : []; + return fields.length > 0 && fields.some(field => data && field in (data as any)); } diff --git a/examples/react/urql/src/gql/graphql.ts b/examples/react/urql/src/gql/graphql.ts index 19de2965607..07159a3427f 100644 --- a/examples/react/urql/src/gql/graphql.ts +++ b/examples/react/urql/src/gql/graphql.ts @@ -1304,7 +1304,7 @@ export class TypedDocumentString { __apiType?: DocumentTypeDecoration['__apiType']; - constructor(private value: string, public __meta__?: { hash: string }) { + constructor(private value: string, public __meta__?: Record) { super(value); } diff --git a/examples/typescript-esm/src/gql/fragment-masking.ts b/examples/typescript-esm/src/gql/fragment-masking.ts index 0c6a1633db1..529cf3dddf2 100644 --- a/examples/typescript-esm/src/gql/fragment-masking.ts +++ b/examples/typescript-esm/src/gql/fragment-masking.ts @@ -47,21 +47,19 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } - export function isFragmentReady( - queryNode: DocumentTypeDecoration, // works with strings - fragmentNode: TypedDocumentNode, // doesn't work with strings yet + queryNode: TypedDocumentNode, + fragmentNode: TypedDocumentNode, data: TQuery ): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; - if (deferredFields) { - const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; - const fragName = fragDef?.name?.value; - const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => field in (data as any)); - } + if (!deferredFields) return true; + + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; - return true; + const fields = fragName ? deferredFields[fragName] : []; + return fields.length > 0 && fields.some(field => data && field in (data as any)); } diff --git a/examples/typescript-graphql-request/src/gql/fragment-masking.ts b/examples/typescript-graphql-request/src/gql/fragment-masking.ts index 0c6a1633db1..1b09672fd35 100644 --- a/examples/typescript-graphql-request/src/gql/fragment-masking.ts +++ b/examples/typescript-graphql-request/src/gql/fragment-masking.ts @@ -1,5 +1,5 @@ import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; -import { FragmentDefinitionNode } from 'graphql'; +import { TypedDocumentString } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration @@ -47,21 +47,17 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } - export function isFragmentReady( - queryNode: DocumentTypeDecoration, // works with strings - fragmentNode: TypedDocumentNode, // doesn't work with strings yet + queryNode: TypedDocumentString, + fragmentNode: TypedDocumentString, data: TQuery ): data is FragmentType { - const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ - ?.deferredFields; - if (deferredFields) { - const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; - const fragName = fragDef?.name?.value; - const fields = fragName ? deferredFields[fragName] : []; + const deferredFields = queryNode.__meta__?.deferredFields as { [fragName: string]: string[] }; + + if (!deferredFields) return true; - return fields.length > 0 && fields.some(field => field in (data as any)); - } + const fragName = fragmentNode.match(/fragments+(w+)Fragments+ons+w+/)?.[1]; - return true; + const fields = fragName ? deferredFields[fragName] : []; + return fields.length > 0 && fields.some(field => data && field in (data as any)); } diff --git a/examples/typescript-graphql-request/src/gql/graphql.ts b/examples/typescript-graphql-request/src/gql/graphql.ts index aa739dbb581..e191fe97021 100644 --- a/examples/typescript-graphql-request/src/gql/graphql.ts +++ b/examples/typescript-graphql-request/src/gql/graphql.ts @@ -1317,7 +1317,7 @@ export class TypedDocumentString { __apiType?: DocumentTypeDecoration['__apiType']; - constructor(private value: string, public __meta__?: { hash: string }) { + constructor(private value: string, public __meta__?: Record) { super(value); } diff --git a/examples/vite/vite-react-cts/src/gql/fragment-masking.ts b/examples/vite/vite-react-cts/src/gql/fragment-masking.ts index 0c6a1633db1..529cf3dddf2 100644 --- a/examples/vite/vite-react-cts/src/gql/fragment-masking.ts +++ b/examples/vite/vite-react-cts/src/gql/fragment-masking.ts @@ -47,21 +47,19 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } - export function isFragmentReady( - queryNode: DocumentTypeDecoration, // works with strings - fragmentNode: TypedDocumentNode, // doesn't work with strings yet + queryNode: TypedDocumentNode, + fragmentNode: TypedDocumentNode, data: TQuery ): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; - if (deferredFields) { - const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; - const fragName = fragDef?.name?.value; - const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => field in (data as any)); - } + if (!deferredFields) return true; + + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; - return true; + const fields = fragName ? deferredFields[fragName] : []; + return fields.length > 0 && fields.some(field => data && field in (data as any)); } diff --git a/examples/vite/vite-react-mts/src/gql/fragment-masking.ts b/examples/vite/vite-react-mts/src/gql/fragment-masking.ts index 0c6a1633db1..529cf3dddf2 100644 --- a/examples/vite/vite-react-mts/src/gql/fragment-masking.ts +++ b/examples/vite/vite-react-mts/src/gql/fragment-masking.ts @@ -47,21 +47,19 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } - export function isFragmentReady( - queryNode: DocumentTypeDecoration, // works with strings - fragmentNode: TypedDocumentNode, // doesn't work with strings yet + queryNode: TypedDocumentNode, + fragmentNode: TypedDocumentNode, data: TQuery ): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; - if (deferredFields) { - const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; - const fragName = fragDef?.name?.value; - const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => field in (data as any)); - } + if (!deferredFields) return true; + + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; - return true; + const fields = fragName ? deferredFields[fragName] : []; + return fields.length > 0 && fields.some(field => data && field in (data as any)); } diff --git a/examples/vite/vite-react-ts/src/gql/fragment-masking.ts b/examples/vite/vite-react-ts/src/gql/fragment-masking.ts index 0c6a1633db1..529cf3dddf2 100644 --- a/examples/vite/vite-react-ts/src/gql/fragment-masking.ts +++ b/examples/vite/vite-react-ts/src/gql/fragment-masking.ts @@ -47,21 +47,19 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } - export function isFragmentReady( - queryNode: DocumentTypeDecoration, // works with strings - fragmentNode: TypedDocumentNode, // doesn't work with strings yet + queryNode: TypedDocumentNode, + fragmentNode: TypedDocumentNode, data: TQuery ): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; - if (deferredFields) { - const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; - const fragName = fragDef?.name?.value; - const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => field in (data as any)); - } + if (!deferredFields) return true; + + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; - return true; + const fields = fragName ? deferredFields[fragName] : []; + return fields.length > 0 && fields.some(field => data && field in (data as any)); } diff --git a/examples/vue/apollo-composable/src/gql/fragment-masking.ts b/examples/vue/apollo-composable/src/gql/fragment-masking.ts index dc0e9fbc362..da049d3e4ef 100644 --- a/examples/vue/apollo-composable/src/gql/fragment-masking.ts +++ b/examples/vue/apollo-composable/src/gql/fragment-masking.ts @@ -47,21 +47,19 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } - export function isFragmentReady( - queryNode: DocumentTypeDecoration, // works with strings - fragmentNode: TypedDocumentNode, // doesn't work with strings yet + queryNode: TypedDocumentNode, + fragmentNode: TypedDocumentNode, data: TQuery ): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; - if (deferredFields) { - const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; - const fragName = fragDef?.name?.value; - const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => field in (data as any)); - } + if (!deferredFields) return true; + + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; - return true; + const fields = fragName ? deferredFields[fragName] : []; + return fields.length > 0 && fields.some(field => data && field in (data as any)); } diff --git a/examples/vue/urql/src/gql/fragment-masking.ts b/examples/vue/urql/src/gql/fragment-masking.ts index dc0e9fbc362..da049d3e4ef 100644 --- a/examples/vue/urql/src/gql/fragment-masking.ts +++ b/examples/vue/urql/src/gql/fragment-masking.ts @@ -47,21 +47,19 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } - export function isFragmentReady( - queryNode: DocumentTypeDecoration, // works with strings - fragmentNode: TypedDocumentNode, // doesn't work with strings yet + queryNode: TypedDocumentNode, + fragmentNode: TypedDocumentNode, data: TQuery ): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; - if (deferredFields) { - const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; - const fragName = fragDef?.name?.value; - const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => field in (data as any)); - } + if (!deferredFields) return true; + + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; - return true; + const fields = fragName ? deferredFields[fragName] : []; + return fields.length > 0 && fields.some(field => data && field in (data as any)); } diff --git a/examples/vue/villus/src/gql/fragment-masking.ts b/examples/vue/villus/src/gql/fragment-masking.ts index dc0e9fbc362..da049d3e4ef 100644 --- a/examples/vue/villus/src/gql/fragment-masking.ts +++ b/examples/vue/villus/src/gql/fragment-masking.ts @@ -47,21 +47,19 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } - export function isFragmentReady( - queryNode: DocumentTypeDecoration, // works with strings - fragmentNode: TypedDocumentNode, // doesn't work with strings yet + queryNode: TypedDocumentNode, + fragmentNode: TypedDocumentNode, data: TQuery ): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; - if (deferredFields) { - const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; - const fragName = fragDef?.name?.value; - const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => field in (data as any)); - } + if (!deferredFields) return true; + + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; - return true; + const fields = fragName ? deferredFields[fragName] : []; + return fields.length > 0 && fields.some(field => data && field in (data as any)); } diff --git a/examples/yoga-tests/src/gql/fragment-masking.ts b/examples/yoga-tests/src/gql/fragment-masking.ts index 0c6a1633db1..529cf3dddf2 100644 --- a/examples/yoga-tests/src/gql/fragment-masking.ts +++ b/examples/yoga-tests/src/gql/fragment-masking.ts @@ -47,21 +47,19 @@ export function makeFragmentData, FT ): FragmentType { return data as FragmentType; } - export function isFragmentReady( - queryNode: DocumentTypeDecoration, // works with strings - fragmentNode: TypedDocumentNode, // doesn't work with strings yet + queryNode: TypedDocumentNode, + fragmentNode: TypedDocumentNode, data: TQuery ): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; - if (deferredFields) { - const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; - const fragName = fragDef?.name?.value; - const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => field in (data as any)); - } + if (!deferredFields) return true; + + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; - return true; + const fields = fragName ? deferredFields[fragName] : []; + return fields.length > 0 && fields.some(field => data && field in (data as any)); } diff --git a/packages/plugins/typescript/typed-document-node/src/index.ts b/packages/plugins/typescript/typed-document-node/src/index.ts index 4602a2e2e45..b17f7a63e47 100644 --- a/packages/plugins/typescript/typed-document-node/src/index.ts +++ b/packages/plugins/typescript/typed-document-node/src/index.ts @@ -43,7 +43,7 @@ export class TypedDocumentString { __apiType?: DocumentTypeDecoration['__apiType']; - constructor(private value: string, public __meta__?: { hash: string }) { + constructor(private value: string, public __meta__?: Record) { super(value); } diff --git a/packages/presets/client/src/fragment-masking-plugin.ts b/packages/presets/client/src/fragment-masking-plugin.ts index 9ad8ac0d645..40646088ea1 100644 --- a/packages/presets/client/src/fragment-masking-plugin.ts +++ b/packages/presets/client/src/fragment-masking-plugin.ts @@ -72,24 +72,44 @@ ${createUnmaskFunctionTypeDefinitions(unmaskFunctionName) } `; -const isFragmentReadyFunction = ` +const isFragmentReadyFunction = (isStringDocumentMode: boolean) => { + if (isStringDocumentMode) { + return `\ export function isFragmentReady( - queryNode: DocumentTypeDecoration, // works with strings - fragmentNode: TypedDocumentNode, // doesn't work with strings yet + queryNode: TypedDocumentString, + fragmentNode: TypedDocumentString, data: TQuery ): data is FragmentType { - const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__?.deferredFields; - if (deferredFields) { - const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; - const fragName = fragDef?.name?.value; - const fields = fragName ? deferredFields[fragName] : []; + const deferredFields = queryNode.__meta__?.deferredFields as { [fragName: string]: string[] }; - return fields.length > 0 && fields.some(field => field in (data as any)); + if (!deferredFields) return true; + + const fragName = fragmentNode.match(/fragments+(w+)Fragments+ons+w+/)?.[1]; + + const fields = fragName ? deferredFields[fragName] : []; + return fields.length > 0 && fields.some(field => data && field in (data as any)); +} +`; } + return `\ +export function isFragmentReady( + queryNode: TypedDocumentNode, + fragmentNode: TypedDocumentNode, + data: TQuery +): data is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + ?.deferredFields; + + if (!deferredFields) return true; + + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; - return true; + const fields = fragName ? deferredFields[fragName] : []; + return fields.length > 0 && fields.some(field => data && field in (data as any)); } `; +}; /** * Plugin for generating fragment masking helper functions. @@ -98,19 +118,28 @@ export const plugin: PluginFunction<{ useTypeImports?: boolean; augmentedModuleName?: string; unmaskFunctionName?: string; -}> = (_, __, { useTypeImports, augmentedModuleName, unmaskFunctionName }, _info) => { + emitLegacyCommonJSImports?: boolean; + isStringDocumentMode?: boolean; +}> = ( + _, + __, + { useTypeImports, augmentedModuleName, unmaskFunctionName, emitLegacyCommonJSImports, isStringDocumentMode }, + _info +) => { const documentNodeImport = `${ useTypeImports ? 'import type' : 'import' } { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core';\n`; - const fragmentDefinitionNodeImport = `${ - useTypeImports ? 'import type' : 'import' - } { FragmentDefinitionNode } from 'graphql';\n`; + const deferFragmentHelperImports = isStringDocumentMode + ? `${useTypeImports ? 'import type' : 'import'} { TypedDocumentString } from './graphql${ + emitLegacyCommonJSImports ? '' : '.js' + }';\n` + : `${useTypeImports ? 'import type' : 'import'} { FragmentDefinitionNode } from 'graphql';\n`; if (augmentedModuleName == null) { return [ documentNodeImport, - fragmentDefinitionNodeImport, + deferFragmentHelperImports, `\n`, fragmentTypeHelper, `\n`, @@ -118,7 +147,7 @@ export const plugin: PluginFunction<{ `\n`, makeFragmentDataHelper, `\n`, - isFragmentReadyFunction, + isFragmentReadyFunction(isStringDocumentMode), ].join(``); } diff --git a/packages/presets/client/src/index.ts b/packages/presets/client/src/index.ts index 6d72fe591f0..68b47d657b0 100644 --- a/packages/presets/client/src/index.ts +++ b/packages/presets/client/src/index.ts @@ -4,7 +4,7 @@ import type { PluginFunction, Types } from '@graphql-codegen/plugin-helpers'; import * as typedDocumentNodePlugin from '@graphql-codegen/typed-document-node'; import * as typescriptPlugin from '@graphql-codegen/typescript'; import * as typescriptOperationPlugin from '@graphql-codegen/typescript-operations'; -import { ClientSideBaseVisitor } from '@graphql-codegen/visitor-plugin-common'; +import { ClientSideBaseVisitor, DocumentMode } from '@graphql-codegen/visitor-plugin-common'; import { DocumentNode } from 'graphql'; import * as fragmentMaskingPlugin from './fragment-masking-plugin.js'; import { generateDocumentHash, normalizeAndPrintDocumentNode } from './persisted-documents.js'; @@ -240,6 +240,7 @@ export const preset: Types.OutputPreset = { useTypeImports: options.config.useTypeImports, unmaskFunctionName: fragmentMaskingConfig.unmaskFunctionName, emitLegacyCommonJSImports: options.config.emitLegacyCommonJSImports, + isStringDocumentMode: options.config.documentMode === DocumentMode.string, }, documents: [], documentTransforms: options.documentTransforms, diff --git a/packages/presets/client/tests/client-preset.spec.ts b/packages/presets/client/tests/client-preset.spec.ts index 1f86faadb82..2139451d95f 100644 --- a/packages/presets/client/tests/client-preset.spec.ts +++ b/packages/presets/client/tests/client-preset.spec.ts @@ -803,22 +803,21 @@ export * from "./gql";`); >(data: FT, _fragment: F): FragmentType { return data as FragmentType; } - export function isFragmentReady( - queryNode: DocumentTypeDecoration, // works with strings - fragmentNode: TypedDocumentNode, // doesn't work with strings yet + queryNode: TypedDocumentNode, + fragmentNode: TypedDocumentNode, data: TQuery ): data is FragmentType { - const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__?.deferredFields; - if (deferredFields) { - const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; - const fragName = fragDef?.name?.value; - const fields = fragName ? deferredFields[fragName] : []; + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + ?.deferredFields; - return fields.length > 0 && fields.some(field => field in (data as any)); - } + if (!deferredFields) return true; + + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; - return true; + const fields = fragName ? deferredFields[fragName] : []; + return fields.length > 0 && fields.some(field => data && field in (data as any)); } " `); @@ -1869,7 +1868,7 @@ export * from "./gql.js";`); `); }); - it.only('works with documentMode: string', async () => { + it('works with documentMode: string', async () => { const result = await executeCodegen({ schema: [ /* GraphQL */ ` @@ -1949,7 +1948,7 @@ export * from "./gql.js";`); { __apiType?: DocumentTypeDecoration['__apiType']; - constructor(private value: string, public __meta__?: { hash: string }) { + constructor(private value: string, public __meta__?: Record) { super(value); } @@ -2066,7 +2065,7 @@ export * from "./gql.js";`); { __apiType?: DocumentTypeDecoration['__apiType']; - constructor(private value: string, public __meta__?: { hash: string }) { + constructor(private value: string, public __meta__?: Record) { super(value); } @@ -2087,7 +2086,7 @@ export * from "./gql.js";`); } fragment Foo on Foo { value - }\`, {"hash":"39c47d2da0fb0e6867abbe2ec942d9858f2d76c7","deferredFields":{"Foo":["value"]}}}) as unknown as TypedDocumentString; + }\`, {"hash":"39c47d2da0fb0e6867abbe2ec942d9858f2d76c7","deferredFields":{"Foo":["value"]}}) as unknown as TypedDocumentString; export const FoosDocument = new TypedDocumentString(\` query Foos { foos { @@ -2096,7 +2095,7 @@ export * from "./gql.js";`); } fragment Foo on Foo { value - }\`, {"hash":"8aba765173b2302b9857334e9959d97a2168dbc8","deferredFields":{"Foo":["value"]}}}) as unknown as TypedDocumentString;" + }\`, {"hash":"8aba765173b2302b9857334e9959d97a2168dbc8","deferredFields":{"Foo":["value"]}}) as unknown as TypedDocumentString;" `); }); }); @@ -2182,7 +2181,7 @@ export * from "./gql.js";`); { __apiType?: DocumentTypeDecoration['__apiType']; - constructor(private value: string, public __meta__?: { hash: string }) { + constructor(private value: string, public __meta__?: Record) { super(value); } From 4497d45d022092750015c06cfe96ad65badac124 Mon Sep 17 00:00:00 2001 From: beerose Date: Tue, 28 Mar 2023 16:31:08 +0200 Subject: [PATCH 29/47] Don't import TypedDocumentNode in string mode --- .../src/gql/fragment-masking.ts | 2 +- .../react/tanstack-react-query/src/gql/fragment-masking.ts | 2 +- examples/react/urql/src/gql/fragment-masking.ts | 2 +- .../typescript-graphql-request/src/gql/fragment-masking.ts | 2 +- packages/presets/client/src/fragment-masking-plugin.ts | 6 +++--- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts b/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts index 1b09672fd35..32987c7866f 100644 --- a/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts +++ b/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts @@ -1,4 +1,4 @@ -import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; +import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; import { TypedDocumentString } from './graphql'; export type FragmentType> = diff --git a/examples/react/tanstack-react-query/src/gql/fragment-masking.ts b/examples/react/tanstack-react-query/src/gql/fragment-masking.ts index 1b09672fd35..32987c7866f 100644 --- a/examples/react/tanstack-react-query/src/gql/fragment-masking.ts +++ b/examples/react/tanstack-react-query/src/gql/fragment-masking.ts @@ -1,4 +1,4 @@ -import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; +import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; import { TypedDocumentString } from './graphql'; export type FragmentType> = diff --git a/examples/react/urql/src/gql/fragment-masking.ts b/examples/react/urql/src/gql/fragment-masking.ts index 1b09672fd35..32987c7866f 100644 --- a/examples/react/urql/src/gql/fragment-masking.ts +++ b/examples/react/urql/src/gql/fragment-masking.ts @@ -1,4 +1,4 @@ -import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; +import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; import { TypedDocumentString } from './graphql'; export type FragmentType> = diff --git a/examples/typescript-graphql-request/src/gql/fragment-masking.ts b/examples/typescript-graphql-request/src/gql/fragment-masking.ts index 1b09672fd35..32987c7866f 100644 --- a/examples/typescript-graphql-request/src/gql/fragment-masking.ts +++ b/examples/typescript-graphql-request/src/gql/fragment-masking.ts @@ -1,4 +1,4 @@ -import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; +import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; import { TypedDocumentString } from './graphql'; export type FragmentType> = diff --git a/packages/presets/client/src/fragment-masking-plugin.ts b/packages/presets/client/src/fragment-masking-plugin.ts index 40646088ea1..37bdfd03e4d 100644 --- a/packages/presets/client/src/fragment-masking-plugin.ts +++ b/packages/presets/client/src/fragment-masking-plugin.ts @@ -126,9 +126,9 @@ export const plugin: PluginFunction<{ { useTypeImports, augmentedModuleName, unmaskFunctionName, emitLegacyCommonJSImports, isStringDocumentMode }, _info ) => { - const documentNodeImport = `${ - useTypeImports ? 'import type' : 'import' - } { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core';\n`; + const documentNodeImport = `${useTypeImports ? 'import type' : 'import'} { ResultOf, DocumentTypeDecoration${ + isStringDocumentMode ? '' : ', TypedDocumentNode' + } } from '@graphql-typed-document-node/core';\n`; const deferFragmentHelperImports = isStringDocumentMode ? `${useTypeImports ? 'import type' : 'import'} { TypedDocumentString } from './graphql${ From d0b7a19336c5b0c2f9325fdc3995beb9650b7cea Mon Sep 17 00:00:00 2001 From: beerose Date: Tue, 28 Mar 2023 16:58:50 +0200 Subject: [PATCH 30/47] Fix typo --- .../visitor-plugin-common/src/selection-set-to-object.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/plugins/other/visitor-plugin-common/src/selection-set-to-object.ts b/packages/plugins/other/visitor-plugin-common/src/selection-set-to-object.ts index 361ef527064..3ec5bd632ec 100644 --- a/packages/plugins/other/visitor-plugin-common/src/selection-set-to-object.ts +++ b/packages/plugins/other/visitor-plugin-common/src/selection-set-to-object.ts @@ -60,7 +60,7 @@ type FragmentSpreadUsage = { }; type CollectedFragmentNode = (SelectionNode | FragmentSpreadUsage | DirectiveNode) & FragmentDirectives; -type GroupedStringifedTypes = Record>; +type GroupedStringifiedTypes = Record>; function isMetadataFieldName(name: string) { return ['__schema', '__type'].includes(name); @@ -326,7 +326,7 @@ export class SelectionSetToObject((prev, type) => { + const grouped = possibleTypes.reduce((prev, type) => { const typeName = type.name; const schemaType = this._schema.getType(typeName); From 0e4fb55d13c791a3252907c40763fab7ed4ebaeb Mon Sep 17 00:00:00 2001 From: beerose Date: Tue, 28 Mar 2023 18:03:49 +0200 Subject: [PATCH 31/47] Minor changes to the helper function --- dev-test/gql-tag-operations-masking/gql/fragment-masking.ts | 4 ++-- dev-test/gql-tag-operations-urql/gql/fragment-masking.ts | 4 ++-- dev-test/gql-tag-operations/gql/fragment-masking.ts | 4 ++-- dev-test/gql-tag-operations/graphql/fragment-masking.ts | 4 ++-- .../src/gql/fragment-masking.ts | 2 +- examples/persisted-documents/src/gql/fragment-masking.ts | 4 ++-- .../react/apollo-client-defer/src/gql/fragment-masking.ts | 4 ++-- .../apollo-client-swc-plugin/src/gql/fragment-masking.ts | 4 ++-- examples/react/apollo-client/src/gql/fragment-masking.ts | 4 ++-- examples/react/http-executor/src/gql/fragment-masking.ts | 4 ++-- examples/react/nextjs-swr/gql/fragment-masking.ts | 4 ++-- .../react/tanstack-react-query/src/gql/fragment-masking.ts | 2 +- examples/react/urql/src/gql/fragment-masking.ts | 2 +- examples/typescript-esm/src/gql/fragment-masking.ts | 4 ++-- .../typescript-graphql-request/src/gql/fragment-masking.ts | 2 +- examples/vite/vite-react-cts/src/gql/fragment-masking.ts | 4 ++-- examples/vite/vite-react-mts/src/gql/fragment-masking.ts | 4 ++-- examples/vite/vite-react-ts/src/gql/fragment-masking.ts | 4 ++-- examples/vue/apollo-composable/src/gql/fragment-masking.ts | 4 ++-- examples/vue/urql/src/gql/fragment-masking.ts | 4 ++-- examples/vue/villus/src/gql/fragment-masking.ts | 4 ++-- examples/yoga-tests/src/gql/fragment-masking.ts | 4 ++-- packages/presets/client/src/fragment-masking-plugin.ts | 6 +++--- packages/presets/client/tests/client-preset.spec.ts | 4 ++-- 24 files changed, 45 insertions(+), 45 deletions(-) diff --git a/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts b/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts index 529cf3dddf2..377bffeeb6c 100644 --- a/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts +++ b/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts @@ -48,9 +48,9 @@ export function makeFragmentData, FT return data as FragmentType; } export function isFragmentReady( - queryNode: TypedDocumentNode, + queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - data: TQuery + data: Record ): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; diff --git a/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts b/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts index 529cf3dddf2..377bffeeb6c 100644 --- a/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts +++ b/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts @@ -48,9 +48,9 @@ export function makeFragmentData, FT return data as FragmentType; } export function isFragmentReady( - queryNode: TypedDocumentNode, + queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - data: TQuery + data: Record ): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; diff --git a/dev-test/gql-tag-operations/gql/fragment-masking.ts b/dev-test/gql-tag-operations/gql/fragment-masking.ts index 529cf3dddf2..377bffeeb6c 100644 --- a/dev-test/gql-tag-operations/gql/fragment-masking.ts +++ b/dev-test/gql-tag-operations/gql/fragment-masking.ts @@ -48,9 +48,9 @@ export function makeFragmentData, FT return data as FragmentType; } export function isFragmentReady( - queryNode: TypedDocumentNode, + queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - data: TQuery + data: Record ): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; diff --git a/dev-test/gql-tag-operations/graphql/fragment-masking.ts b/dev-test/gql-tag-operations/graphql/fragment-masking.ts index 529cf3dddf2..377bffeeb6c 100644 --- a/dev-test/gql-tag-operations/graphql/fragment-masking.ts +++ b/dev-test/gql-tag-operations/graphql/fragment-masking.ts @@ -48,9 +48,9 @@ export function makeFragmentData, FT return data as FragmentType; } export function isFragmentReady( - queryNode: TypedDocumentNode, + queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - data: TQuery + data: Record ): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; diff --git a/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts b/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts index 32987c7866f..27fd34b4266 100644 --- a/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts +++ b/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts @@ -50,7 +50,7 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: TypedDocumentString, fragmentNode: TypedDocumentString, - data: TQuery + data: Record ): data is FragmentType { const deferredFields = queryNode.__meta__?.deferredFields as { [fragName: string]: string[] }; diff --git a/examples/persisted-documents/src/gql/fragment-masking.ts b/examples/persisted-documents/src/gql/fragment-masking.ts index 529cf3dddf2..377bffeeb6c 100644 --- a/examples/persisted-documents/src/gql/fragment-masking.ts +++ b/examples/persisted-documents/src/gql/fragment-masking.ts @@ -48,9 +48,9 @@ export function makeFragmentData, FT return data as FragmentType; } export function isFragmentReady( - queryNode: TypedDocumentNode, + queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - data: TQuery + data: Record ): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; diff --git a/examples/react/apollo-client-defer/src/gql/fragment-masking.ts b/examples/react/apollo-client-defer/src/gql/fragment-masking.ts index 529cf3dddf2..377bffeeb6c 100644 --- a/examples/react/apollo-client-defer/src/gql/fragment-masking.ts +++ b/examples/react/apollo-client-defer/src/gql/fragment-masking.ts @@ -48,9 +48,9 @@ export function makeFragmentData, FT return data as FragmentType; } export function isFragmentReady( - queryNode: TypedDocumentNode, + queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - data: TQuery + data: Record ): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; diff --git a/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts b/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts index 529cf3dddf2..377bffeeb6c 100644 --- a/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts +++ b/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts @@ -48,9 +48,9 @@ export function makeFragmentData, FT return data as FragmentType; } export function isFragmentReady( - queryNode: TypedDocumentNode, + queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - data: TQuery + data: Record ): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; diff --git a/examples/react/apollo-client/src/gql/fragment-masking.ts b/examples/react/apollo-client/src/gql/fragment-masking.ts index 529cf3dddf2..377bffeeb6c 100644 --- a/examples/react/apollo-client/src/gql/fragment-masking.ts +++ b/examples/react/apollo-client/src/gql/fragment-masking.ts @@ -48,9 +48,9 @@ export function makeFragmentData, FT return data as FragmentType; } export function isFragmentReady( - queryNode: TypedDocumentNode, + queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - data: TQuery + data: Record ): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; diff --git a/examples/react/http-executor/src/gql/fragment-masking.ts b/examples/react/http-executor/src/gql/fragment-masking.ts index 529cf3dddf2..377bffeeb6c 100644 --- a/examples/react/http-executor/src/gql/fragment-masking.ts +++ b/examples/react/http-executor/src/gql/fragment-masking.ts @@ -48,9 +48,9 @@ export function makeFragmentData, FT return data as FragmentType; } export function isFragmentReady( - queryNode: TypedDocumentNode, + queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - data: TQuery + data: Record ): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; diff --git a/examples/react/nextjs-swr/gql/fragment-masking.ts b/examples/react/nextjs-swr/gql/fragment-masking.ts index 529cf3dddf2..377bffeeb6c 100644 --- a/examples/react/nextjs-swr/gql/fragment-masking.ts +++ b/examples/react/nextjs-swr/gql/fragment-masking.ts @@ -48,9 +48,9 @@ export function makeFragmentData, FT return data as FragmentType; } export function isFragmentReady( - queryNode: TypedDocumentNode, + queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - data: TQuery + data: Record ): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; diff --git a/examples/react/tanstack-react-query/src/gql/fragment-masking.ts b/examples/react/tanstack-react-query/src/gql/fragment-masking.ts index 32987c7866f..27fd34b4266 100644 --- a/examples/react/tanstack-react-query/src/gql/fragment-masking.ts +++ b/examples/react/tanstack-react-query/src/gql/fragment-masking.ts @@ -50,7 +50,7 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: TypedDocumentString, fragmentNode: TypedDocumentString, - data: TQuery + data: Record ): data is FragmentType { const deferredFields = queryNode.__meta__?.deferredFields as { [fragName: string]: string[] }; diff --git a/examples/react/urql/src/gql/fragment-masking.ts b/examples/react/urql/src/gql/fragment-masking.ts index 32987c7866f..27fd34b4266 100644 --- a/examples/react/urql/src/gql/fragment-masking.ts +++ b/examples/react/urql/src/gql/fragment-masking.ts @@ -50,7 +50,7 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: TypedDocumentString, fragmentNode: TypedDocumentString, - data: TQuery + data: Record ): data is FragmentType { const deferredFields = queryNode.__meta__?.deferredFields as { [fragName: string]: string[] }; diff --git a/examples/typescript-esm/src/gql/fragment-masking.ts b/examples/typescript-esm/src/gql/fragment-masking.ts index 529cf3dddf2..377bffeeb6c 100644 --- a/examples/typescript-esm/src/gql/fragment-masking.ts +++ b/examples/typescript-esm/src/gql/fragment-masking.ts @@ -48,9 +48,9 @@ export function makeFragmentData, FT return data as FragmentType; } export function isFragmentReady( - queryNode: TypedDocumentNode, + queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - data: TQuery + data: Record ): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; diff --git a/examples/typescript-graphql-request/src/gql/fragment-masking.ts b/examples/typescript-graphql-request/src/gql/fragment-masking.ts index 32987c7866f..27fd34b4266 100644 --- a/examples/typescript-graphql-request/src/gql/fragment-masking.ts +++ b/examples/typescript-graphql-request/src/gql/fragment-masking.ts @@ -50,7 +50,7 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: TypedDocumentString, fragmentNode: TypedDocumentString, - data: TQuery + data: Record ): data is FragmentType { const deferredFields = queryNode.__meta__?.deferredFields as { [fragName: string]: string[] }; diff --git a/examples/vite/vite-react-cts/src/gql/fragment-masking.ts b/examples/vite/vite-react-cts/src/gql/fragment-masking.ts index 529cf3dddf2..377bffeeb6c 100644 --- a/examples/vite/vite-react-cts/src/gql/fragment-masking.ts +++ b/examples/vite/vite-react-cts/src/gql/fragment-masking.ts @@ -48,9 +48,9 @@ export function makeFragmentData, FT return data as FragmentType; } export function isFragmentReady( - queryNode: TypedDocumentNode, + queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - data: TQuery + data: Record ): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; diff --git a/examples/vite/vite-react-mts/src/gql/fragment-masking.ts b/examples/vite/vite-react-mts/src/gql/fragment-masking.ts index 529cf3dddf2..377bffeeb6c 100644 --- a/examples/vite/vite-react-mts/src/gql/fragment-masking.ts +++ b/examples/vite/vite-react-mts/src/gql/fragment-masking.ts @@ -48,9 +48,9 @@ export function makeFragmentData, FT return data as FragmentType; } export function isFragmentReady( - queryNode: TypedDocumentNode, + queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - data: TQuery + data: Record ): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; diff --git a/examples/vite/vite-react-ts/src/gql/fragment-masking.ts b/examples/vite/vite-react-ts/src/gql/fragment-masking.ts index 529cf3dddf2..377bffeeb6c 100644 --- a/examples/vite/vite-react-ts/src/gql/fragment-masking.ts +++ b/examples/vite/vite-react-ts/src/gql/fragment-masking.ts @@ -48,9 +48,9 @@ export function makeFragmentData, FT return data as FragmentType; } export function isFragmentReady( - queryNode: TypedDocumentNode, + queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - data: TQuery + data: Record ): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; diff --git a/examples/vue/apollo-composable/src/gql/fragment-masking.ts b/examples/vue/apollo-composable/src/gql/fragment-masking.ts index da049d3e4ef..5cefe862b9a 100644 --- a/examples/vue/apollo-composable/src/gql/fragment-masking.ts +++ b/examples/vue/apollo-composable/src/gql/fragment-masking.ts @@ -48,9 +48,9 @@ export function makeFragmentData, FT return data as FragmentType; } export function isFragmentReady( - queryNode: TypedDocumentNode, + queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - data: TQuery + data: Record ): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; diff --git a/examples/vue/urql/src/gql/fragment-masking.ts b/examples/vue/urql/src/gql/fragment-masking.ts index da049d3e4ef..5cefe862b9a 100644 --- a/examples/vue/urql/src/gql/fragment-masking.ts +++ b/examples/vue/urql/src/gql/fragment-masking.ts @@ -48,9 +48,9 @@ export function makeFragmentData, FT return data as FragmentType; } export function isFragmentReady( - queryNode: TypedDocumentNode, + queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - data: TQuery + data: Record ): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; diff --git a/examples/vue/villus/src/gql/fragment-masking.ts b/examples/vue/villus/src/gql/fragment-masking.ts index da049d3e4ef..5cefe862b9a 100644 --- a/examples/vue/villus/src/gql/fragment-masking.ts +++ b/examples/vue/villus/src/gql/fragment-masking.ts @@ -48,9 +48,9 @@ export function makeFragmentData, FT return data as FragmentType; } export function isFragmentReady( - queryNode: TypedDocumentNode, + queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - data: TQuery + data: Record ): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; diff --git a/examples/yoga-tests/src/gql/fragment-masking.ts b/examples/yoga-tests/src/gql/fragment-masking.ts index 529cf3dddf2..377bffeeb6c 100644 --- a/examples/yoga-tests/src/gql/fragment-masking.ts +++ b/examples/yoga-tests/src/gql/fragment-masking.ts @@ -48,9 +48,9 @@ export function makeFragmentData, FT return data as FragmentType; } export function isFragmentReady( - queryNode: TypedDocumentNode, + queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - data: TQuery + data: Record ): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; diff --git a/packages/presets/client/src/fragment-masking-plugin.ts b/packages/presets/client/src/fragment-masking-plugin.ts index 37bdfd03e4d..bb1f6d28a09 100644 --- a/packages/presets/client/src/fragment-masking-plugin.ts +++ b/packages/presets/client/src/fragment-masking-plugin.ts @@ -78,7 +78,7 @@ const isFragmentReadyFunction = (isStringDocumentMode: boolean) => { export function isFragmentReady( queryNode: TypedDocumentString, fragmentNode: TypedDocumentString, - data: TQuery + data: Record ): data is FragmentType { const deferredFields = queryNode.__meta__?.deferredFields as { [fragName: string]: string[] }; @@ -93,9 +93,9 @@ export function isFragmentReady( } return `\ export function isFragmentReady( - queryNode: TypedDocumentNode, + queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - data: TQuery + data: Record ): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; diff --git a/packages/presets/client/tests/client-preset.spec.ts b/packages/presets/client/tests/client-preset.spec.ts index 2139451d95f..a4de9edcb19 100644 --- a/packages/presets/client/tests/client-preset.spec.ts +++ b/packages/presets/client/tests/client-preset.spec.ts @@ -804,9 +804,9 @@ export * from "./gql";`); return data as FragmentType; } export function isFragmentReady( - queryNode: TypedDocumentNode, + queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - data: TQuery + data: Record ): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; From 6ca5515fcec051928e2d38b292a8ab079c2b8a7a Mon Sep 17 00:00:00 2001 From: beerose Date: Wed, 29 Mar 2023 11:26:33 +0200 Subject: [PATCH 32/47] Fix typos --- .../presets/client/tests/fixtures/with-deferred-fragment.ts | 2 +- packages/presets/client/tests/fixtures/with-fragment.ts | 2 +- yarn.lock | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/presets/client/tests/fixtures/with-deferred-fragment.ts b/packages/presets/client/tests/fixtures/with-deferred-fragment.ts index 9c6421077ea..fcb19040c67 100644 --- a/packages/presets/client/tests/fixtures/with-deferred-fragment.ts +++ b/packages/presets/client/tests/fixtures/with-deferred-fragment.ts @@ -10,7 +10,7 @@ const Query = gql(/* GraphQL */ ` `); //@ts-ignore -const LsitQuery = gql(/* GraphQL */ ` +const ListQuery = gql(/* GraphQL */ ` query Foos { foos { ...Foo @defer diff --git a/packages/presets/client/tests/fixtures/with-fragment.ts b/packages/presets/client/tests/fixtures/with-fragment.ts index 38738d5c16c..2097beed972 100644 --- a/packages/presets/client/tests/fixtures/with-fragment.ts +++ b/packages/presets/client/tests/fixtures/with-fragment.ts @@ -10,7 +10,7 @@ const Query = gql(/* GraphQL */ ` `); //@ts-ignore -const LsitQuery = gql(/* GraphQL */ ` +const ListQuery = gql(/* GraphQL */ ` query Foos { foos { ...Foo diff --git a/yarn.lock b/yarn.lock index 6f9c4457d22..4be37d77cef 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13861,7 +13861,7 @@ typescript-json-schema@0.55.0: typescript "~4.8.2" yargs "^17.1.1" -typescript@5.0.2, typescript@^5.0.0, typescript@~4.8.2: +typescript@4.9.5, typescript@5.0.2, typescript@^5.0.0, typescript@~4.8.2: version "5.0.2" resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.2.tgz#891e1a90c5189d8506af64b9ef929fca99ba1ee5" integrity sha512-wVORMBGO/FAs/++blGNeAVdbNKtIh1rbBL2EyQ1+J9lClJ93KiiKe8PmFIVdXhHcyv44SL9oglmfeSsndo0jRw== From e8e2561d7a4a89ab74e783dc604704eea71c4124 Mon Sep 17 00:00:00 2001 From: beerose Date: Wed, 29 Mar 2023 12:03:39 +0200 Subject: [PATCH 33/47] Update cypress version in new example --- .../react/apollo-client-defer/package.json | 2 +- yarn.lock | 1995 +++++++---------- 2 files changed, 845 insertions(+), 1152 deletions(-) diff --git a/examples/react/apollo-client-defer/package.json b/examples/react/apollo-client-defer/package.json index 771f3e5bb94..0d4b75f699b 100644 --- a/examples/react/apollo-client-defer/package.json +++ b/examples/react/apollo-client-defer/package.json @@ -18,7 +18,7 @@ "@types/react": "^18.0.15", "@types/react-dom": "^18.0.10", "@vitejs/plugin-react": "^3.1.0", - "cypress": "12.8.1", + "cypress": "12.9.0", "serve": "14.2.0", "start-server-and-test": "2.0.0", "typescript": "4.9.5", diff --git a/yarn.lock b/yarn.lock index 644d8ed34ef..f5c456df8a9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -62,23 +62,11 @@ dependencies: "@algolia/cache-common" "4.15.0" -"@algolia/cache-browser-local-storage@4.16.0": - version "4.16.0" - resolved "https://registry.yarnpkg.com/@algolia/cache-browser-local-storage/-/cache-browser-local-storage-4.16.0.tgz#ccd31ab9df10781a69a653e9d994d0be974952ba" - integrity sha512-jVrk0YB3tjOhD5/lhBtYCVCeLjZmVpf2kdi4puApofytf/R0scjWz0GdozlW4HhU+Prxmt/c9ge4QFjtv5OAzQ== - dependencies: - "@algolia/cache-common" "4.16.0" - "@algolia/cache-common@4.15.0": version "4.15.0" resolved "https://registry.yarnpkg.com/@algolia/cache-common/-/cache-common-4.15.0.tgz#a198098c4b8fa6ef661879ec22d2a2d1ad77d2bb" integrity sha512-Me3PbI4QurAM+3D+htIE0l1xt6+bl/18SG6Wc7bPQEZAtN7DTGz22HqhKNyLF2lR/cOfpaH7umXZlZEhIHf7gQ== -"@algolia/cache-common@4.16.0": - version "4.16.0" - resolved "https://registry.yarnpkg.com/@algolia/cache-common/-/cache-common-4.16.0.tgz#0ef4726653d3891805c3348153067b292df1d68d" - integrity sha512-4iHjkSYQYw46pITrNQgXXhvUmcekI8INz1m+SzmqLX8jexSSy4Ky4zfGhZzhhhLHXUP3+x/PK/c0qPjxEvRwKQ== - "@algolia/cache-in-memory@4.15.0": version "4.15.0" resolved "https://registry.yarnpkg.com/@algolia/cache-in-memory/-/cache-in-memory-4.15.0.tgz#77cac4db36a0aa0837f7a7ceb760188191e35268" @@ -86,13 +74,6 @@ dependencies: "@algolia/cache-common" "4.15.0" -"@algolia/cache-in-memory@4.16.0": - version "4.16.0" - resolved "https://registry.yarnpkg.com/@algolia/cache-in-memory/-/cache-in-memory-4.16.0.tgz#b9aecfc4054f2307caeea255aace65061040f680" - integrity sha512-p7RYykvA6Ip6QENxrh99nOD77otVh1sJRivcgcVpnjoZb5sIN3t33eUY1DpB9QSBizcrW+qk19rNkdnZ43a+PQ== - dependencies: - "@algolia/cache-common" "4.16.0" - "@algolia/client-account@4.15.0": version "4.15.0" resolved "https://registry.yarnpkg.com/@algolia/client-account/-/client-account-4.15.0.tgz#8e0723052169665b4449dc2f8bcf3075feb6a424" @@ -102,15 +83,6 @@ "@algolia/client-search" "4.15.0" "@algolia/transporter" "4.15.0" -"@algolia/client-account@4.16.0": - version "4.16.0" - resolved "https://registry.yarnpkg.com/@algolia/client-account/-/client-account-4.16.0.tgz#3164e28df1b6428a60f43b8a97ea669d6bbbce9e" - integrity sha512-eydcfpdIyuWoKgUSz5iZ/L0wE/Wl7958kACkvTHLDNXvK/b8Z1zypoJavh6/km1ZNQmFpeYS2jrmq0kUSFn02w== - dependencies: - "@algolia/client-common" "4.16.0" - "@algolia/client-search" "4.16.0" - "@algolia/transporter" "4.16.0" - "@algolia/client-analytics@4.15.0": version "4.15.0" resolved "https://registry.yarnpkg.com/@algolia/client-analytics/-/client-analytics-4.15.0.tgz#6b8fe450e1bba114b0d0598cbf9acac482798a36" @@ -121,16 +93,6 @@ "@algolia/requester-common" "4.15.0" "@algolia/transporter" "4.15.0" -"@algolia/client-analytics@4.16.0": - version "4.16.0" - resolved "https://registry.yarnpkg.com/@algolia/client-analytics/-/client-analytics-4.16.0.tgz#afa72be54a28fdfe00505d6ab3c179ef2c9bc796" - integrity sha512-cONWXH3BfilgdlCofUm492bJRWtpBLVW/hsUlfoFtiX1u05xoBP7qeiDwh9RR+4pSLHLodYkHAf5U4honQ55Qg== - dependencies: - "@algolia/client-common" "4.16.0" - "@algolia/client-search" "4.16.0" - "@algolia/requester-common" "4.16.0" - "@algolia/transporter" "4.16.0" - "@algolia/client-common@4.15.0": version "4.15.0" resolved "https://registry.yarnpkg.com/@algolia/client-common/-/client-common-4.15.0.tgz#27dd9441aedf481736696d519e55ea8e2f5a4432" @@ -139,14 +101,6 @@ "@algolia/requester-common" "4.15.0" "@algolia/transporter" "4.15.0" -"@algolia/client-common@4.16.0": - version "4.16.0" - resolved "https://registry.yarnpkg.com/@algolia/client-common/-/client-common-4.16.0.tgz#670f4b2286755090a6389c55d79402716e4556ac" - integrity sha512-QVdR4019ukBH6f5lFr27W60trRxQF1SfS1qo0IP6gjsKhXhUVJuHxOCA6ArF87jrNkeuHEoRoDU+GlvaecNo8g== - dependencies: - "@algolia/requester-common" "4.16.0" - "@algolia/transporter" "4.16.0" - "@algolia/client-personalization@4.15.0": version "4.15.0" resolved "https://registry.yarnpkg.com/@algolia/client-personalization/-/client-personalization-4.15.0.tgz#6f10eda827d2607ab6c2341464cd35107bf8cf99" @@ -156,15 +110,6 @@ "@algolia/requester-common" "4.15.0" "@algolia/transporter" "4.15.0" -"@algolia/client-personalization@4.16.0": - version "4.16.0" - resolved "https://registry.yarnpkg.com/@algolia/client-personalization/-/client-personalization-4.16.0.tgz#927728c069b42f39fc83ce61a1fdcc79cd38b842" - integrity sha512-irtLafssDGPuhYqIwxqOxiWlVYvrsBD+EMA1P9VJtkKi3vSNBxiWeQ0f0Tn53cUNdSRNEssfoEH84JL97SV2SQ== - dependencies: - "@algolia/client-common" "4.16.0" - "@algolia/requester-common" "4.16.0" - "@algolia/transporter" "4.16.0" - "@algolia/client-search@4.15.0": version "4.15.0" resolved "https://registry.yarnpkg.com/@algolia/client-search/-/client-search-4.15.0.tgz#2d849faae7943fcc983ac923eac767666a9e6a9a" @@ -174,15 +119,6 @@ "@algolia/requester-common" "4.15.0" "@algolia/transporter" "4.15.0" -"@algolia/client-search@4.16.0": - version "4.16.0" - resolved "https://registry.yarnpkg.com/@algolia/client-search/-/client-search-4.16.0.tgz#19a76bc6cfa495aa9011b32dd85305baa2579589" - integrity sha512-xsfrAE1jO/JDh1wFrRz+alVyW+aA6qnkzmbWWWZWEgVF3EaFqzIf9r1l/aDtDdBtNTNhX9H3Lg31+BRtd5izQA== - dependencies: - "@algolia/client-common" "4.16.0" - "@algolia/requester-common" "4.16.0" - "@algolia/transporter" "4.16.0" - "@algolia/events@^4.0.1": version "4.0.1" resolved "https://registry.yarnpkg.com/@algolia/events/-/events-4.0.1.tgz#fd39e7477e7bc703d7f893b556f676c032af3950" @@ -193,11 +129,6 @@ resolved "https://registry.yarnpkg.com/@algolia/logger-common/-/logger-common-4.15.0.tgz#a2cf3d3abbdd00594006164302600ba46d75059f" integrity sha512-D8OFwn/HpvQz66goIcjxOKsYBMuxiruxJ3cA/bnc0EiDvSA2P2z6bNQWgS5gbstuTZIJmbhr+53NyOxFkmMNAA== -"@algolia/logger-common@4.16.0": - version "4.16.0" - resolved "https://registry.yarnpkg.com/@algolia/logger-common/-/logger-common-4.16.0.tgz#8d83ebe5d798b84cf0026ae68d47b6dc8f542b61" - integrity sha512-U9H8uCzSDuePJmbnjjTX21aPDRU6x74Tdq3dJmdYu2+pISx02UeBJm4kSgc9RW5jcR5j35G9gnjHY9Q3ngWbyQ== - "@algolia/logger-console@4.15.0": version "4.15.0" resolved "https://registry.yarnpkg.com/@algolia/logger-console/-/logger-console-4.15.0.tgz#8a0948b0c16ad546af9dd14b9021f21f42737c97" @@ -205,13 +136,6 @@ dependencies: "@algolia/logger-common" "4.15.0" -"@algolia/logger-console@4.16.0": - version "4.16.0" - resolved "https://registry.yarnpkg.com/@algolia/logger-console/-/logger-console-4.16.0.tgz#e125d63268a6cab64c625e867596a8c8201850d2" - integrity sha512-+qymusiM+lPZKrkf0tDjCQA158eEJO2IU+Nr/sJ9TFyI/xkFPjNPzw/Qbc8Iy/xcOXGlc6eMgmyjtVQqAWq6UA== - dependencies: - "@algolia/logger-common" "4.16.0" - "@algolia/requester-browser-xhr@4.15.0": version "4.15.0" resolved "https://registry.yarnpkg.com/@algolia/requester-browser-xhr/-/requester-browser-xhr-4.15.0.tgz#38b5956d01408ad4291d89915df921ff8534cca6" @@ -219,23 +143,11 @@ dependencies: "@algolia/requester-common" "4.15.0" -"@algolia/requester-browser-xhr@4.16.0": - version "4.16.0" - resolved "https://registry.yarnpkg.com/@algolia/requester-browser-xhr/-/requester-browser-xhr-4.16.0.tgz#742090e53301889ae01581eedcc5bfc2c6dd7660" - integrity sha512-gK+kvs6LHl/PaOJfDuwjkopNbG1djzFLsVBklGBsSU6h6VjFkxIpo6Qq80IK14p9cplYZfhfaL12va6Q9p3KVQ== - dependencies: - "@algolia/requester-common" "4.16.0" - "@algolia/requester-common@4.15.0": version "4.15.0" resolved "https://registry.yarnpkg.com/@algolia/requester-common/-/requester-common-4.15.0.tgz#c68ad3dccc1de71b5be9b08a07e2baf58ec49d82" integrity sha512-w0UUzxElbo4hrKg4QP/jiXDNbIJuAthxdlkos9nS8KAPK2XI3R9BlUjLz/ZVs4F9TDGI0mhjrNHhZ12KXcoyhg== -"@algolia/requester-common@4.16.0": - version "4.16.0" - resolved "https://registry.yarnpkg.com/@algolia/requester-common/-/requester-common-4.16.0.tgz#a24eb9fc9062f76c2e06599c678542e78c8bce1c" - integrity sha512-3Zmcs/iMubcm4zqZ3vZG6Zum8t+hMWxGMzo0/uY2BD8o9q5vMxIYI0c4ocdgQjkXcix189WtZNkgjSOBzSbkdw== - "@algolia/requester-node-http@4.15.0": version "4.15.0" resolved "https://registry.yarnpkg.com/@algolia/requester-node-http/-/requester-node-http-4.15.0.tgz#02f841586e620c7b4e4e555f315cd52dd815f330" @@ -243,13 +155,6 @@ dependencies: "@algolia/requester-common" "4.15.0" -"@algolia/requester-node-http@4.16.0": - version "4.16.0" - resolved "https://registry.yarnpkg.com/@algolia/requester-node-http/-/requester-node-http-4.16.0.tgz#0723929863c201d12888c2751043b872a04bb6d9" - integrity sha512-L8JxM2VwZzh8LJ1Zb8TFS6G3icYsCKZsdWW+ahcEs1rGWmyk9SybsOe1MLnjonGBaqPWJkn9NjS7mRdjEmBtKA== - dependencies: - "@algolia/requester-common" "4.16.0" - "@algolia/transporter@4.15.0": version "4.15.0" resolved "https://registry.yarnpkg.com/@algolia/transporter/-/transporter-4.15.0.tgz#c65c512206c66aadc2897337220ae5454001967e" @@ -259,15 +164,6 @@ "@algolia/logger-common" "4.15.0" "@algolia/requester-common" "4.15.0" -"@algolia/transporter@4.16.0": - version "4.16.0" - resolved "https://registry.yarnpkg.com/@algolia/transporter/-/transporter-4.16.0.tgz#5e6ca73c8a72d91b7dd75b00b5e45e8538bad8b6" - integrity sha512-H9BVB2EAjT65w7XGBNf5drpsW39x2aSZ942j4boSAAJPPlLmjtj5IpAP7UAtsV8g9Beslonh0bLa1XGmE/P0BA== - dependencies: - "@algolia/cache-common" "4.16.0" - "@algolia/logger-common" "4.16.0" - "@algolia/requester-common" "4.16.0" - "@ampproject/remapping@^2.2.0": version "2.2.0" resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.2.0.tgz#56c133824780de3174aed5ab6834f3026790154d" @@ -333,9 +229,9 @@ "@babel/highlight" "^7.18.6" "@babel/compat-data@^7.17.7", "@babel/compat-data@^7.20.1", "@babel/compat-data@^7.20.5": - version "7.21.0" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.21.0.tgz#c241dc454e5b5917e40d37e525e2f4530c399298" - integrity sha512-gMuZsmsgxk/ENC3O/fRw5QY8A9/uxQbbCEypnLIiYYc/qVJtEV7ouxC3EllIIwNzMqAQee5tanFabWsUOutS7g== + version "7.20.14" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.20.14.tgz#4106fc8b755f3e3ee0a0a7c27dde5de1d2b2baf8" + integrity sha512-0YpKHD6ImkWMEINCyDAD0HLLUH/lPCefG8ld9it8DJB2wnApraKuhgYTvTY1z7UFIfBTGy5LwncZ+5HWWGbhFw== "@babel/core@7.21.3", "@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.14.0", "@babel/core@^7.20.12": version "7.21.3" @@ -394,7 +290,7 @@ lru-cache "^5.1.1" semver "^6.3.0" -"@babel/helper-create-class-features-plugin@^7.18.6", "@babel/helper-create-class-features-plugin@^7.21.0": +"@babel/helper-create-class-features-plugin@^7.18.6", "@babel/helper-create-class-features-plugin@^7.20.5", "@babel/helper-create-class-features-plugin@^7.20.7", "@babel/helper-create-class-features-plugin@^7.21.0": version "7.21.0" resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.21.0.tgz#64f49ecb0020532f19b1d014b03bccaa1ab85fb9" integrity sha512-Q8wNiMIdwsv5la5SPxNYzzkPnjgC0Sy0i7jLkVOCdllu/xcVNkr3TeZzbHBJrj+XXRqzX5uCyCoV9eu6xUG7KQ== @@ -409,12 +305,12 @@ "@babel/helper-split-export-declaration" "^7.18.6" "@babel/helper-create-regexp-features-plugin@^7.18.6", "@babel/helper-create-regexp-features-plugin@^7.20.5": - version "7.21.0" - resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.21.0.tgz#53ff78472e5ce10a52664272a239787107603ebb" - integrity sha512-N+LaFW/auRSWdx7SHD/HiARwXQju1vXTW4fKr4u5SgBUTm51OKEjKgj+cs00ggW3kEvNqwErnlwuq7Y3xBe4eg== + version "7.20.5" + resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.20.5.tgz#5ea79b59962a09ec2acf20a963a01ab4d076ccca" + integrity sha512-m68B1lkg3XDGX5yCvGO0kPx3v9WIYLnzjKfPcQiwntEQa5ZeRkPmo2X/ISJc8qxWGfwUr+kvZAeEzAwLec2r2w== dependencies: "@babel/helper-annotate-as-pure" "^7.18.6" - regexpu-core "^5.3.1" + regexpu-core "^5.2.1" "@babel/helper-define-polyfill-provider@^0.3.3": version "0.3.3" @@ -621,11 +517,11 @@ "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-proposal-class-static-block@^7.18.6": - version "7.21.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-static-block/-/plugin-proposal-class-static-block-7.21.0.tgz#77bdd66fb7b605f3a61302d224bdfacf5547977d" - integrity sha512-XP5G9MWNUskFuP30IfFSEFB0Z6HzLIUcjYM4bYOPHXl7eiJ9HFv8tWj6TXTN5QODiEhDZAeI4hLok2iHFFV4hw== + version "7.20.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-static-block/-/plugin-proposal-class-static-block-7.20.7.tgz#92592e9029b13b15be0f7ce6a7aedc2879ca45a7" + integrity sha512-AveGOoi9DAjUYYuUAG//Ig69GlazLnoyzMw68VCDux+c1tsnnH/OkYcpz/5xzMkEFC6UxjR5Gw1c+iY2wOGVeQ== dependencies: - "@babel/helper-create-class-features-plugin" "^7.21.0" + "@babel/helper-create-class-features-plugin" "^7.20.7" "@babel/helper-plugin-utils" "^7.20.2" "@babel/plugin-syntax-class-static-block" "^7.14.5" @@ -697,9 +593,9 @@ "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" "@babel/plugin-proposal-optional-chaining@^7.18.9", "@babel/plugin-proposal-optional-chaining@^7.20.7": - version "7.21.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.21.0.tgz#886f5c8978deb7d30f678b2e24346b287234d3ea" - integrity sha512-p4zeefM72gpmEe2fkUr/OnOXpWEf8nAgk7ZYVqqfFiyIG7oFfVZcCrU64hWn5xp4tQ9LkV4bTIa5rD0KANpKNA== + version "7.20.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.20.7.tgz#49f2b372519ab31728cc14115bb0998b15bfda55" + integrity sha512-T+A7b1kfjtRM51ssoOfS1+wbyCVqorfyZhT99TvxxLMirPShD8CzKMRepMlCBGM5RpHMbn8s+5MMHnPstJH6mQ== dependencies: "@babel/helper-plugin-utils" "^7.20.2" "@babel/helper-skip-transparent-expression-wrappers" "^7.20.0" @@ -714,12 +610,12 @@ "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-proposal-private-property-in-object@^7.18.6": - version "7.21.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.21.0.tgz#19496bd9883dd83c23c7d7fc45dcd9ad02dfa1dc" - integrity sha512-ha4zfehbJjc5MmXBlHec1igel5TJXXLDDRbuJ4+XT2TJcyD9/V1919BA8gMvsdHcNMBy4WBUBiRb3nw/EQUtBw== + version "7.20.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.20.5.tgz#309c7668f2263f1c711aa399b5a9a6291eef6135" + integrity sha512-Vq7b9dUA12ByzB4EjQTPo25sFhY+08pQDBSZRtUAkj7lb7jahaHR5igera16QZ+3my1nYR4dKsNdYj5IjPHilQ== dependencies: "@babel/helper-annotate-as-pure" "^7.18.6" - "@babel/helper-create-class-features-plugin" "^7.21.0" + "@babel/helper-create-class-features-plugin" "^7.20.5" "@babel/helper-plugin-utils" "^7.20.2" "@babel/plugin-syntax-private-property-in-object" "^7.14.5" @@ -801,7 +697,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-syntax-jsx@^7.0.0", "@babel/plugin-syntax-jsx@^7.18.6": +"@babel/plugin-syntax-jsx@^7.0.0", "@babel/plugin-syntax-jsx@^7.17.12", "@babel/plugin-syntax-jsx@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.18.6.tgz#a8feef63b010150abd97f1649ec296e849943ca0" integrity sha512-6mmljtAedFGTWu2p/8WIORGwy+61PLgOMPOdazc7YoJ9ZCWUyFy3A6CpPkRKLKD1ToAesxX8KGEViAiLo9N+7Q== @@ -895,21 +791,21 @@ "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-transform-block-scoping@^7.0.0", "@babel/plugin-transform-block-scoping@^7.20.2": - version "7.21.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.21.0.tgz#e737b91037e5186ee16b76e7ae093358a5634f02" - integrity sha512-Mdrbunoh9SxwFZapeHVrwFmri16+oYotcZysSzhNIVDwIAb1UV+kvnxULSYq9J3/q5MDG+4X6w8QVgD1zhBXNQ== + version "7.20.15" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.20.15.tgz#3e1b2aa9cbbe1eb8d644c823141a9c5c2a22392d" + integrity sha512-Vv4DMZ6MiNOhu/LdaZsT/bsLRxgL94d269Mv4R/9sp6+Mp++X/JqypZYypJXLlM4mlL352/Egzbzr98iABH1CA== dependencies: "@babel/helper-plugin-utils" "^7.20.2" "@babel/plugin-transform-classes@^7.0.0", "@babel/plugin-transform-classes@^7.20.2": - version "7.21.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.21.0.tgz#f469d0b07a4c5a7dbb21afad9e27e57b47031665" - integrity sha512-RZhbYTCEUAe6ntPehC4hlslPWosNHDox+vAs4On/mCLRLfoDVHf6hVEd7kuxr1RnHwJmxFfUM3cZiZRmPxJPXQ== + version "7.20.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.20.7.tgz#f438216f094f6bb31dc266ebfab8ff05aecad073" + integrity sha512-LWYbsiXTPKl+oBlXUGlwNlJZetXD5Am+CyBdqhPsDVjM9Jc8jwBJFrKhHf900Kfk2eZG1y9MAG3UNajol7A4VQ== dependencies: "@babel/helper-annotate-as-pure" "^7.18.6" "@babel/helper-compilation-targets" "^7.20.7" "@babel/helper-environment-visitor" "^7.18.9" - "@babel/helper-function-name" "^7.21.0" + "@babel/helper-function-name" "^7.19.0" "@babel/helper-optimise-call-expression" "^7.18.6" "@babel/helper-plugin-utils" "^7.20.2" "@babel/helper-replace-supers" "^7.20.7" @@ -925,9 +821,9 @@ "@babel/template" "^7.20.7" "@babel/plugin-transform-destructuring@^7.0.0", "@babel/plugin-transform-destructuring@^7.20.2": - version "7.21.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.21.3.tgz#73b46d0fd11cd6ef57dea8a381b1215f4959d401" - integrity sha512-bp6hwMFzuiE4HqYEyoGJ/V2LeIWn+hLVKc4pnj++E5XQptwhtcGmSayM029d/j2X1bPKGTlsyPwAubuU22KhMA== + version "7.20.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.20.7.tgz#8bda578f71620c7de7c93af590154ba331415454" + integrity sha512-Xwg403sRrZb81IVB79ZPqNQME23yhugYVqgTxAhT99h485F4f+GMELFhhOsscDUB7HCswepKeCKLn/GZvUKoBA== dependencies: "@babel/helper-plugin-utils" "^7.20.2" @@ -955,19 +851,19 @@ "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-transform-flow-strip-types@^7.0.0": - version "7.21.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.21.0.tgz#6aeca0adcb81dc627c8986e770bfaa4d9812aff5" - integrity sha512-FlFA2Mj87a6sDkW4gfGrQQqwY/dLlBAyJa2dJEZ+FHXUVHBflO2wyKvg+OOEzXfrKYIa4HWl0mgmbCzt0cMb7w== + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.19.0.tgz#e9e8606633287488216028719638cbbb2f2dde8f" + integrity sha512-sgeMlNaQVbCSpgLSKP4ZZKfsJVnFnNQlUSk6gPYzR/q7tzCgQF2t8RBKAP6cKJeZdveei7Q7Jm527xepI8lNLg== dependencies: - "@babel/helper-plugin-utils" "^7.20.2" + "@babel/helper-plugin-utils" "^7.19.0" "@babel/plugin-syntax-flow" "^7.18.6" "@babel/plugin-transform-for-of@^7.0.0", "@babel/plugin-transform-for-of@^7.18.8": - version "7.21.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.21.0.tgz#964108c9988de1a60b4be2354a7d7e245f36e86e" - integrity sha512-LlUYlydgDkKpIY7mcBWvyPPmMcOphEyYA27Ef4xpbh1IiDNLr0kZsos2nf92vz3IccvJI25QUwp86Eo5s6HmBQ== + version "7.18.8" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.18.8.tgz#6ef8a50b244eb6a0bdbad0c7c61877e4e30097c1" + integrity sha512-yEfTRnjuskWYo0k1mHUqrVWaZwrdq8AYbfrpqULOJOaucGSp4mNMVps+YtA8byoevxS/urwU75vyhQIxcCgiBQ== dependencies: - "@babel/helper-plugin-utils" "^7.20.2" + "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-transform-function-name@^7.0.0", "@babel/plugin-transform-function-name@^7.18.9": version "7.18.9" @@ -1001,11 +897,11 @@ "@babel/helper-plugin-utils" "^7.20.2" "@babel/plugin-transform-modules-commonjs@^7.0.0", "@babel/plugin-transform-modules-commonjs@^7.19.6": - version "7.21.2" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.21.2.tgz#6ff5070e71e3192ef2b7e39820a06fb78e3058e7" - integrity sha512-Cln+Yy04Gxua7iPdj6nOV96smLGjpElir5YwzF0LBPKoPlLDNJePNlrGGaybAJkd0zKRnOVXOgizSqPYMNYkzA== + version "7.20.11" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.20.11.tgz#8cb23010869bf7669fd4b3098598b6b2be6dc607" + integrity sha512-S8e1f7WQ7cimJQ51JkAaDrEtohVEitXjgCGAS2N8S31Y42E+kWwfSz83LYz57QdBm7q9diARVqanIaH2oVgQnw== dependencies: - "@babel/helper-module-transforms" "^7.21.2" + "@babel/helper-module-transforms" "^7.20.11" "@babel/helper-plugin-utils" "^7.20.2" "@babel/helper-simple-access" "^7.20.2" @@ -1051,9 +947,9 @@ "@babel/helper-replace-supers" "^7.18.6" "@babel/plugin-transform-parameters@^7.0.0", "@babel/plugin-transform-parameters@^7.20.1", "@babel/plugin-transform-parameters@^7.20.7": - version "7.21.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.21.3.tgz#18fc4e797cf6d6d972cb8c411dbe8a809fa157db" - integrity sha512-Wxc+TvppQG9xWFYatvCGPvZ6+SIUxQ2ZdiBP+PHYMIjnPXD+uThCshaz4NZOnODAtBjjcVQQ/3OKs9LW28purQ== + version "7.20.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.20.7.tgz#0ee349e9d1bc96e78e3b37a7af423a4078a7083f" + integrity sha512-WiWBIkeHKVOSYPO0pWkxGPfKeWrCJyD3NJ53+Lrp/QMSZbsVPovrVl2aWZ19D/LTVnaDv5Ap7GJ/B2CTOZdrfA== dependencies: "@babel/helper-plugin-utils" "^7.20.2" @@ -1086,15 +982,15 @@ "@babel/helper-plugin-utils" "^7.19.0" "@babel/plugin-transform-react-jsx@^7.0.0": - version "7.21.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.21.0.tgz#656b42c2fdea0a6d8762075d58ef9d4e3c4ab8a2" - integrity sha512-6OAWljMvQrZjR2DaNhVfRz6dkCAVV+ymcLUmaf8bccGOHn2v5rHJK3tTpij0BuhdYWP4LLaqj5lwcdlpAAPuvg== + version "7.20.13" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.20.13.tgz#f950f0b0c36377503d29a712f16287cedf886cbb" + integrity sha512-MmTZx/bkUrfJhhYAYt3Urjm+h8DQGrPrnKQ94jLo7NLuOU+T89a7IByhKmrb8SKhrIYIQ0FN0CHMbnFRen4qNw== dependencies: "@babel/helper-annotate-as-pure" "^7.18.6" "@babel/helper-module-imports" "^7.18.6" "@babel/helper-plugin-utils" "^7.20.2" "@babel/plugin-syntax-jsx" "^7.18.6" - "@babel/types" "^7.21.0" + "@babel/types" "^7.20.7" "@babel/plugin-transform-regenerator@^7.18.6": version "7.20.5" @@ -1148,11 +1044,10 @@ "@babel/helper-plugin-utils" "^7.18.9" "@babel/plugin-transform-typescript@^7.21.0": - version "7.21.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.21.3.tgz#316c5be579856ea890a57ebc5116c5d064658f2b" - integrity sha512-RQxPz6Iqt8T0uw/WsJNReuBpWpBqs/n7mNo18sKLoTbMp+UrEekhH+pKSVC7gWz+DNjo9gryfV8YzCiT45RgMw== + version "7.21.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.21.0.tgz#f0956a153679e3b377ae5b7f0143427151e4c848" + integrity sha512-xo///XTPp3mDzTtrqXoBlK9eiAYW3wv9JXglcn/u1bi60RW11dEUxIgA8cbnDhutS1zacjMRmAwxE0gMklLnZg== dependencies: - "@babel/helper-annotate-as-pure" "^7.18.6" "@babel/helper-create-class-features-plugin" "^7.21.0" "@babel/helper-plugin-utils" "^7.20.2" "@babel/plugin-syntax-typescript" "^7.20.0" @@ -1279,9 +1174,9 @@ integrity sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA== "@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.12.0", "@babel/runtime@^7.12.5", "@babel/runtime@^7.13.10", "@babel/runtime@^7.18.3", "@babel/runtime@^7.20.1", "@babel/runtime@^7.20.7", "@babel/runtime@^7.5.5", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7": - version "7.21.0" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.21.0.tgz#5b55c9d394e5fcf304909a8b00c07dc217b56673" - integrity sha512-xwII0//EObnq89Ji5AKYQaRYiW/nZ3llSv29d49IuxPhKbtJoLP+9QUUZ4nVragQVtaVGeZrpB+ZtG/Pdy/POw== + version "7.20.13" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.20.13.tgz#7055ab8a7cff2b8f6058bf6ae45ff84ad2aded4b" + integrity sha512-gt3PKXs0DBoL9xCvOIIZ2NEqAGZqHjAnmVbfQtB620V0uReIQutpel14KcneZuer7UioY8ALKZ7iocavvzTNFA== dependencies: regenerator-runtime "^0.13.11" @@ -1595,12 +1490,13 @@ debug "^3.1.0" lodash.once "^4.1.1" -"@emotion/babel-plugin@^11.10.6": - version "11.10.6" - resolved "https://registry.yarnpkg.com/@emotion/babel-plugin/-/babel-plugin-11.10.6.tgz#a68ee4b019d661d6f37dec4b8903255766925ead" - integrity sha512-p2dAqtVrkhSa7xz1u/m9eHYdLi+en8NowrmXeF/dKtJpU8lCWli8RUAati7NcSl0afsBott48pdnANuD0wh9QQ== +"@emotion/babel-plugin@^11.10.5": + version "11.10.5" + resolved "https://registry.yarnpkg.com/@emotion/babel-plugin/-/babel-plugin-11.10.5.tgz#65fa6e1790ddc9e23cc22658a4c5dea423c55c3c" + integrity sha512-xE7/hyLHJac7D2Ve9dKroBBZqBT7WuPQmWcq7HSGb84sUuP4mlOWoB8dvVfD9yk5DHkU1m6RW7xSoDtnQHNQeA== dependencies: "@babel/helper-module-imports" "^7.16.7" + "@babel/plugin-syntax-jsx" "^7.17.12" "@babel/runtime" "^7.18.3" "@emotion/hash" "^0.9.0" "@emotion/memoize" "^0.8.0" @@ -1634,12 +1530,12 @@ integrity sha512-G/YwXTkv7Den9mXDO7AhLWkE3q+I92B+VqAE+dYG4NGPaHZGvt3G8Q0p9vmE+sq7rTGphUbAvmQ9YpbfMQGGlA== "@emotion/react@^11.8.1": - version "11.10.6" - resolved "https://registry.yarnpkg.com/@emotion/react/-/react-11.10.6.tgz#dbe5e650ab0f3b1d2e592e6ab1e006e75fd9ac11" - integrity sha512-6HT8jBmcSkfzO7mc+N1L9uwvOnlcGoix8Zn7srt+9ga0MjREo6lRpuVX0kzo6Jp6oTqDhREOFsygN6Ew4fEQbw== + version "11.10.5" + resolved "https://registry.yarnpkg.com/@emotion/react/-/react-11.10.5.tgz#95fff612a5de1efa9c0d535384d3cfa115fe175d" + integrity sha512-TZs6235tCJ/7iF6/rvTaOH4oxQg2gMAcdHemjwLKIjKz4rRuYe1HJ2TQJKnAcRAfOUDdU8XoDadCe1rl72iv8A== dependencies: "@babel/runtime" "^7.18.3" - "@emotion/babel-plugin" "^11.10.6" + "@emotion/babel-plugin" "^11.10.5" "@emotion/cache" "^11.10.5" "@emotion/serialize" "^1.1.1" "@emotion/use-insertion-effect-with-fallbacks" "^1.0.0" @@ -1732,136 +1628,136 @@ "@esbuild-kit/core-utils" "^3.0.0" get-tsconfig "^4.4.0" -"@esbuild/android-arm64@0.17.14": - version "0.17.14" - resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.17.14.tgz#4624cea3c8941c91f9e9c1228f550d23f1cef037" - integrity sha512-eLOpPO1RvtsP71afiFTvS7tVFShJBCT0txiv/xjFBo5a7R7Gjw7X0IgIaFoLKhqXYAXhahoXm7qAmRXhY4guJg== - -"@esbuild/android-arm@0.17.14": - version "0.17.14" - resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.17.14.tgz#74fae60fcab34c3f0e15cb56473a6091ba2b53a6" - integrity sha512-0CnlwnjDU8cks0yJLXfkaU/uoLyRf9VZJs4p1PskBr2AlAHeEsFEwJEo0of/Z3g+ilw5mpyDwThlxzNEIxOE4g== - -"@esbuild/android-x64@0.17.14": - version "0.17.14" - resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.17.14.tgz#f002fbc08d5e939d8314bd23bcfb1e95d029491f" - integrity sha512-nrfQYWBfLGfSGLvRVlt6xi63B5IbfHm3tZCdu/82zuFPQ7zez4XjmRtF/wIRYbJQ/DsZrxJdEvYFE67avYXyng== - -"@esbuild/darwin-arm64@0.17.14": - version "0.17.14" - resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.17.14.tgz#b8dcd79a1dd19564950b4ca51d62999011e2e168" - integrity sha512-eoSjEuDsU1ROwgBH/c+fZzuSyJUVXQTOIN9xuLs9dE/9HbV/A5IqdXHU1p2OfIMwBwOYJ9SFVGGldxeRCUJFyw== - -"@esbuild/darwin-x64@0.17.14": - version "0.17.14" - resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.17.14.tgz#4b49f195d9473625efc3c773fc757018f2c0d979" - integrity sha512-zN0U8RWfrDttdFNkHqFYZtOH8hdi22z0pFm0aIJPsNC4QQZv7je8DWCX5iA4Zx6tRhS0CCc0XC2m7wKsbWEo5g== - -"@esbuild/freebsd-arm64@0.17.14": - version "0.17.14" - resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.14.tgz#480923fd38f644c6342c55e916cc7c231a85eeb7" - integrity sha512-z0VcD4ibeZWVQCW1O7szaLxGsx54gcCnajEJMdYoYjLiq4g1jrP2lMq6pk71dbS5+7op/L2Aod+erw+EUr28/A== - -"@esbuild/freebsd-x64@0.17.14": - version "0.17.14" - resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.17.14.tgz#a6b6b01954ad8562461cb8a5e40e8a860af69cbe" - integrity sha512-hd9mPcxfTgJlolrPlcXkQk9BMwNBvNBsVaUe5eNUqXut6weDQH8whcNaKNF2RO8NbpT6GY8rHOK2A9y++s+ehw== - -"@esbuild/linux-arm64@0.17.14": - version "0.17.14" - resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.17.14.tgz#1fe2f39f78183b59f75a4ad9c48d079916d92418" - integrity sha512-FhAMNYOq3Iblcj9i+K0l1Fp/MHt+zBeRu/Qkf0LtrcFu3T45jcwB6A1iMsemQ42vR3GBhjNZJZTaCe3VFPbn9g== - -"@esbuild/linux-arm@0.17.14": - version "0.17.14" - resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.17.14.tgz#18d594a49b64e4a3a05022c005cb384a58056a2a" - integrity sha512-BNTl+wSJ1omsH8s3TkQmIIIQHwvwJrU9u1ggb9XU2KTVM4TmthRIVyxSp2qxROJHhZuW/r8fht46/QE8hU8Qvg== - -"@esbuild/linux-ia32@0.17.14": - version "0.17.14" - resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.17.14.tgz#f7f0182a9cfc0159e0922ed66c805c9c6ef1b654" - integrity sha512-91OK/lQ5y2v7AsmnFT+0EyxdPTNhov3y2CWMdizyMfxSxRqHazXdzgBKtlmkU2KYIc+9ZK3Vwp2KyXogEATYxQ== - -"@esbuild/linux-loong64@0.17.14": - version "0.17.14" - resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.17.14.tgz#5f5305fdffe2d71dd9a97aa77d0c99c99409066f" - integrity sha512-vp15H+5NR6hubNgMluqqKza85HcGJgq7t6rMH7O3Y6ApiOWPkvW2AJfNojUQimfTp6OUrACUXfR4hmpcENXoMQ== - -"@esbuild/linux-mips64el@0.17.14": - version "0.17.14" - resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.17.14.tgz#a602e85c51b2f71d2aedfe7f4143b2f92f97f3f5" - integrity sha512-90TOdFV7N+fgi6c2+GO9ochEkmm9kBAKnuD5e08GQMgMINOdOFHuYLPQ91RYVrnWwQ5683sJKuLi9l4SsbJ7Hg== - -"@esbuild/linux-ppc64@0.17.14": - version "0.17.14" - resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.17.14.tgz#32d918d782105cbd9345dbfba14ee018b9c7afdf" - integrity sha512-NnBGeoqKkTugpBOBZZoktQQ1Yqb7aHKmHxsw43NddPB2YWLAlpb7THZIzsRsTr0Xw3nqiPxbA1H31ZMOG+VVPQ== - -"@esbuild/linux-riscv64@0.17.14": - version "0.17.14" - resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.17.14.tgz#38612e7b6c037dff7022c33f49ca17f85c5dec58" - integrity sha512-0qdlKScLXA8MGVy21JUKvMzCYWovctuP8KKqhtE5A6IVPq4onxXhSuhwDd2g5sRCzNDlDjitc5sX31BzDoL5Fw== - -"@esbuild/linux-s390x@0.17.14": - version "0.17.14" - resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.17.14.tgz#4397dff354f899e72fd035d72af59a700c465ccb" - integrity sha512-Hdm2Jo1yaaOro4v3+6/zJk6ygCqIZuSDJHdHaf8nVH/tfOuoEX5Riv03Ka15LmQBYJObUTNS1UdyoMk0WUn9Ww== - -"@esbuild/linux-x64@0.17.14": - version "0.17.14" - resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.17.14.tgz#6c5cb99891b6c3e0c08369da3ef465e8038ad9c2" - integrity sha512-8KHF17OstlK4DuzeF/KmSgzrTWQrkWj5boluiiq7kvJCiQVzUrmSkaBvcLB2UgHpKENO2i6BthPkmUhNDaJsVw== - -"@esbuild/netbsd-x64@0.17.14": - version "0.17.14" - resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.17.14.tgz#5fa5255a64e9bf3947c1b3bef5e458b50b211994" - integrity sha512-nVwpqvb3yyXztxIT2+VsxJhB5GCgzPdk1n0HHSnchRAcxqKO6ghXwHhJnr0j/B+5FSyEqSxF4q03rbA2fKXtUQ== - -"@esbuild/openbsd-x64@0.17.14": - version "0.17.14" - resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.17.14.tgz#74d14c79dcb6faf446878cc64284aa4e02f5ca6f" - integrity sha512-1RZ7uQQ9zcy/GSAJL1xPdN7NDdOOtNEGiJalg/MOzeakZeTrgH/DoCkbq7TaPDiPhWqnDF+4bnydxRqQD7il6g== - -"@esbuild/sunos-x64@0.17.14": - version "0.17.14" - resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.17.14.tgz#5c7d1c7203781d86c2a9b2ff77bd2f8036d24cfa" - integrity sha512-nqMjDsFwv7vp7msrwWRysnM38Sd44PKmW8EzV01YzDBTcTWUpczQg6mGao9VLicXSgW/iookNK6AxeogNVNDZA== - -"@esbuild/win32-arm64@0.17.14": - version "0.17.14" - resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.17.14.tgz#dc36ed84f1390e73b6019ccf0566c80045e5ca3d" - integrity sha512-xrD0mccTKRBBIotrITV7WVQAwNJ5+1va6L0H9zN92v2yEdjfAN7864cUaZwJS7JPEs53bDTzKFbfqVlG2HhyKQ== - -"@esbuild/win32-ia32@0.17.14": - version "0.17.14" - resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.17.14.tgz#0802a107afa9193c13e35de15a94fe347c588767" - integrity sha512-nXpkz9bbJrLLyUTYtRotSS3t5b+FOuljg8LgLdINWFs3FfqZMtbnBCZFUmBzQPyxqU87F8Av+3Nco/M3hEcu1w== - -"@esbuild/win32-x64@0.17.14": - version "0.17.14" - resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.17.14.tgz#e81fb49de05fed91bf74251c9ca0343f4fc77d31" - integrity sha512-gPQmsi2DKTaEgG14hc3CHXHp62k8g6qr0Pas+I4lUxRMugGSATh/Bi8Dgusoz9IQ0IfdrvLpco6kujEIBoaogA== +"@esbuild/android-arm64@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.17.12.tgz#15a8e2b407d03989b899e325151dc2e96d19c620" + integrity sha512-WQ9p5oiXXYJ33F2EkE3r0FRDFVpEdcDiwNX3u7Xaibxfx6vQE0Sb8ytrfQsA5WO6kDn6mDfKLh6KrPBjvkk7xA== + +"@esbuild/android-arm@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.17.12.tgz#677a09297e1f4f37aba7b4fc4f31088b00484985" + integrity sha512-E/sgkvwoIfj4aMAPL2e35VnUJspzVYl7+M1B2cqeubdBhADV4uPon0KCc8p2G+LqSJ6i8ocYPCqY3A4GGq0zkQ== + +"@esbuild/android-x64@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.17.12.tgz#b292729eef4e0060ae1941f6a021c4d2542a3521" + integrity sha512-m4OsaCr5gT+se25rFPHKQXARMyAehHTQAz4XX1Vk3d27VtqiX0ALMBPoXZsGaB6JYryCLfgGwUslMqTfqeLU0w== + +"@esbuild/darwin-arm64@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.17.12.tgz#efa35318df931da05825894e1787b976d55adbe3" + integrity sha512-O3GCZghRIx+RAN0NDPhyyhRgwa19MoKlzGonIb5hgTj78krqp9XZbYCvFr9N1eUxg0ZQEpiiZ4QvsOQwBpP+lg== + +"@esbuild/darwin-x64@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.17.12.tgz#e7b54bb3f6dc81aadfd0485cd1623c648157e64d" + integrity sha512-5D48jM3tW27h1qjaD9UNRuN+4v0zvksqZSPZqeSWggfMlsVdAhH3pwSfQIFJwcs9QJ9BRibPS4ViZgs3d2wsCA== + +"@esbuild/freebsd-arm64@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.12.tgz#99a18a8579d6299c449566fe91d9b6a54cf2a591" + integrity sha512-OWvHzmLNTdF1erSvrfoEBGlN94IE6vCEaGEkEH29uo/VoONqPnoDFfShi41Ew+yKimx4vrmmAJEGNoyyP+OgOQ== + +"@esbuild/freebsd-x64@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.17.12.tgz#0e090190fede307fb4022f671791a50dd5121abd" + integrity sha512-A0Xg5CZv8MU9xh4a+7NUpi5VHBKh1RaGJKqjxe4KG87X+mTjDE6ZvlJqpWoeJxgfXHT7IMP9tDFu7IZ03OtJAw== + +"@esbuild/linux-arm64@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.17.12.tgz#7fe2a69f8a1a7153fa2b0f44aabcadb59475c7e0" + integrity sha512-cK3AjkEc+8v8YG02hYLQIQlOznW+v9N+OI9BAFuyqkfQFR+DnDLhEM5N8QRxAUz99cJTo1rLNXqRrvY15gbQUg== + +"@esbuild/linux-arm@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.17.12.tgz#b87c76ebf1fe03e01fd6bb5cfc2f3c5becd5ee93" + integrity sha512-WsHyJ7b7vzHdJ1fv67Yf++2dz3D726oO3QCu8iNYik4fb5YuuReOI9OtA+n7Mk0xyQivNTPbl181s+5oZ38gyA== + +"@esbuild/linux-ia32@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.17.12.tgz#9e9357090254524d32e6708883a47328f3037858" + integrity sha512-jdOBXJqcgHlah/nYHnj3Hrnl9l63RjtQ4vn9+bohjQPI2QafASB5MtHAoEv0JQHVb/xYQTFOeuHnNYE1zF7tYw== + +"@esbuild/linux-loong64@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.17.12.tgz#9deb605f9e2c82f59412ddfefb4b6b96d54b5b5b" + integrity sha512-GTOEtj8h9qPKXCyiBBnHconSCV9LwFyx/gv3Phw0pa25qPYjVuuGZ4Dk14bGCfGX3qKF0+ceeQvwmtI+aYBbVA== + +"@esbuild/linux-mips64el@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.17.12.tgz#6ef170b974ddf5e6acdfa5b05f22b6e9dfd2b003" + integrity sha512-o8CIhfBwKcxmEENOH9RwmUejs5jFiNoDw7YgS0EJTF6kgPgcqLFjgoc5kDey5cMHRVCIWc6kK2ShUePOcc7RbA== + +"@esbuild/linux-ppc64@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.17.12.tgz#1638d3d4acf1d34aaf37cf8908c2e1cefed16204" + integrity sha512-biMLH6NR/GR4z+ap0oJYb877LdBpGac8KfZoEnDiBKd7MD/xt8eaw1SFfYRUeMVx519kVkAOL2GExdFmYnZx3A== + +"@esbuild/linux-riscv64@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.17.12.tgz#135b6e9270a8e2de2b9094bb21a287517df520ef" + integrity sha512-jkphYUiO38wZGeWlfIBMB72auOllNA2sLfiZPGDtOBb1ELN8lmqBrlMiucgL8awBw1zBXN69PmZM6g4yTX84TA== + +"@esbuild/linux-s390x@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.17.12.tgz#21e40830770c5d08368e300842bde382ce97d615" + integrity sha512-j3ucLdeY9HBcvODhCY4b+Ds3hWGO8t+SAidtmWu/ukfLLG/oYDMaA+dnugTVAg5fnUOGNbIYL9TOjhWgQB8W5g== + +"@esbuild/linux-x64@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.17.12.tgz#76c1c199871d48e1aaa47a762fb9e0dca52e1f7a" + integrity sha512-uo5JL3cgaEGotaqSaJdRfFNSCUJOIliKLnDGWaVCgIKkHxwhYMm95pfMbWZ9l7GeW9kDg0tSxcy9NYdEtjwwmA== + +"@esbuild/netbsd-x64@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.17.12.tgz#c7c3b3017a4b938c76c35f66af529baf62eac527" + integrity sha512-DNdoRg8JX+gGsbqt2gPgkgb00mqOgOO27KnrWZtdABl6yWTST30aibGJ6geBq3WM2TIeW6COs5AScnC7GwtGPg== + +"@esbuild/openbsd-x64@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.17.12.tgz#05d04217d980e049001afdbeacbb58d31bb5cefb" + integrity sha512-aVsENlr7B64w8I1lhHShND5o8cW6sB9n9MUtLumFlPhG3elhNWtE7M1TFpj3m7lT3sKQUMkGFjTQBrvDDO1YWA== + +"@esbuild/sunos-x64@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.17.12.tgz#cf3862521600e4eb6c440ec3bad31ed40fb87ef3" + integrity sha512-qbHGVQdKSwi0JQJuZznS4SyY27tYXYF0mrgthbxXrZI3AHKuRvU+Eqbg/F0rmLDpW/jkIZBlCO1XfHUBMNJ1pg== + +"@esbuild/win32-arm64@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.17.12.tgz#43dd7fb5be77bf12a1550355ab2b123efd60868e" + integrity sha512-zsCp8Ql+96xXTVTmm6ffvoTSZSV2B/LzzkUXAY33F/76EajNw1m+jZ9zPfNJlJ3Rh4EzOszNDHsmG/fZOhtqDg== + +"@esbuild/win32-ia32@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.17.12.tgz#9940963d0bff4ea3035a84e2b4c6e41c5e6296eb" + integrity sha512-FfrFjR4id7wcFYOdqbDfDET3tjxCozUgbqdkOABsSFzoZGFC92UK7mg4JKRc/B3NNEf1s2WHxJ7VfTdVDPN3ng== + +"@esbuild/win32-x64@0.17.12": + version "0.17.12" + resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.17.12.tgz#3a11d13e9a5b0c05db88991b234d8baba1f96487" + integrity sha512-JOOxw49BVZx2/5tW3FqkdjSD/5gXYeVGPDcB0lvap0gLQshkh1Nyel1QazC+wNxus3xPlsYAgqU1BUmrmCvWtw== "@eslint-community/eslint-utils@^4.1.2", "@eslint-community/eslint-utils@^4.2.0": - version "4.4.0" - resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" - integrity sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA== + version "4.2.0" + resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.2.0.tgz#a831e6e468b4b2b5ae42bf658bea015bf10bc518" + integrity sha512-gB8T4H4DEfX2IV9zGDJPOBgP1e/DbfCPDTtEqUMckpvzS1OYtva8JdFYBqMwYk7xAQ429WGF/UPqn8uQ//h2vQ== dependencies: eslint-visitor-keys "^3.3.0" "@eslint-community/regexpp@^4.4.0": - version "4.5.0" - resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.5.0.tgz#f6f729b02feee2c749f57e334b7a1b5f40a81724" - integrity sha512-vITaYzIcNmjn5tF5uxcZ/ft7/RXGrMUIS9HalWckEOF6ESiwXKoMzAQf2UW0aVd6rnOeExTJVd5hmWXucBKGXQ== + version "4.4.0" + resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.4.0.tgz#3e61c564fcd6b921cb789838631c5ee44df09403" + integrity sha512-A9983Q0LnDGdLPjxyXQ00sbV+K+O+ko2Dr+CZigbHWtX9pNfxlaBkMR8X1CztI73zuEyEBXTVjx7CE+/VSwDiQ== -"@eslint/eslintrc@^2.0.1", "@eslint/eslintrc@^2.0.2": - version "2.0.2" - resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.0.2.tgz#01575e38707add677cf73ca1589abba8da899a02" - integrity sha512-3W4f5tDUra+pA+FzgugqL2pRimUTDJWKr7BINqOpkZrC0uYI0NIc0/JFgBROCU07HR6GieA5m3/rsPIhDmCXTQ== +"@eslint/eslintrc@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.0.1.tgz#7888fe7ec8f21bc26d646dbd2c11cd776e21192d" + integrity sha512-eFRmABvW2E5Ho6f5fHLqgena46rOj7r7OKHYfLElqcBfGFHHpjBhivyi5+jOEQuSpdc/1phIZJlbC2te+tZNIw== dependencies: ajv "^6.12.4" debug "^4.3.2" - espree "^9.5.1" + espree "^9.5.0" globals "^13.19.0" ignore "^5.2.0" import-fresh "^3.2.1" @@ -1874,22 +1770,17 @@ resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.36.0.tgz#9837f768c03a1e4a30bd304a64fb8844f0e72efe" integrity sha512-lxJ9R5ygVm8ZWgYdUweoq5ownDlJ4upvoWmO4eLxBYHdMo+vZ/Rx0EN6MbKWDJOSUGrqJy2Gt+Dyv/VKml0fjg== -"@eslint/js@8.37.0": - version "8.37.0" - resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.37.0.tgz#cf1b5fa24217fe007f6487a26d765274925efa7d" - integrity sha512-x5vzdtOOGgFVDCUs81QRB2+liax8rFg3+7hqM+QhBG0/G3F1ZsoYl97UrqgHgQ9KKT7G6c4V+aTUCgu/n22v1A== - -"@floating-ui/core@^1.2.4": - version "1.2.5" - resolved "https://registry.yarnpkg.com/@floating-ui/core/-/core-1.2.5.tgz#612f0d203e6f647490d572c7b798eebac9e3cf54" - integrity sha512-qrcbyfnRVziRlB6IYwjCopYhO7Vud750JlJyuljruIXcPxr22y8zdckcJGsuOdnQ639uVD1tTXddrcH3t3QYIQ== +"@floating-ui/core@^1.2.1": + version "1.2.1" + resolved "https://registry.yarnpkg.com/@floating-ui/core/-/core-1.2.1.tgz#074182a1d277f94569c50a6b456e62585d463c8e" + integrity sha512-LSqwPZkK3rYfD7GKoIeExXOyYx6Q1O4iqZWwIehDNuv3Dv425FIAE8PRwtAx1imEolFTHgBEcoFHm9MDnYgPCg== "@floating-ui/dom@^1.0.1": - version "1.2.5" - resolved "https://registry.yarnpkg.com/@floating-ui/dom/-/dom-1.2.5.tgz#c9ec259a24ce0958b1ea29674df4eee4455361a9" - integrity sha512-+sAUfpQ3Frz+VCbPCqj+cZzvEESy3fjSeT/pDWkYCWOBXYNNKZfuVsHuv8/JO2zze8+Eb/Q7a6hZVgzS81fLbQ== + version "1.2.1" + resolved "https://registry.yarnpkg.com/@floating-ui/dom/-/dom-1.2.1.tgz#8f93906e1a3b9f606ce78afb058e874344dcbe07" + integrity sha512-Rt45SmRiV8eU+xXSB9t0uMYiQ/ZWGE/jumse2o3i5RGlyvcbqOF4q+1qBnzLE2kZ5JGhq0iMkcGXUKbFe7MpTA== dependencies: - "@floating-ui/core" "^1.2.4" + "@floating-ui/core" "^1.2.1" "@giscus/react@2.2.8": version "2.2.8" @@ -2389,7 +2280,7 @@ "@whatwg-node/fetch" "^0.8.0" tslib "^2.4.0" -"@graphql-tools/batch-execute@^8.5.18": +"@graphql-tools/batch-execute@8.5.18": version "8.5.18" resolved "https://registry.yarnpkg.com/@graphql-tools/batch-execute/-/batch-execute-8.5.18.tgz#2f0e91cc12e8eed32f14bc814f27c6a498b75e17" integrity sha512-mNv5bpZMLLwhkmPA6+RP81A6u3KF4CSKLf3VX9hbomOkQR4db8pNs8BOvpZU54wKsUzMzdlws/2g/Dabyb2Vsg== @@ -2410,18 +2301,18 @@ tslib "^2.4.0" unixify "^1.0.0" -"@graphql-tools/delegate@9.0.28", "@graphql-tools/delegate@^9.0.27": - version "9.0.28" - resolved "https://registry.yarnpkg.com/@graphql-tools/delegate/-/delegate-9.0.28.tgz#026275094b2ff3f4cbbe99caff2d48775aeb67d6" - integrity sha512-8j23JCs2mgXqnp+5K0v4J3QBQU/5sXd9miaLvMfRf/6963DznOXTECyS9Gcvj1VEeR5CXIw6+aX/BvRDKDdN1g== +"@graphql-tools/delegate@9.0.27", "@graphql-tools/delegate@^9.0.27": + version "9.0.27" + resolved "https://registry.yarnpkg.com/@graphql-tools/delegate/-/delegate-9.0.27.tgz#e500554bace46cc7ededd48a0c28079f747c9f49" + integrity sha512-goYewiPls/RDXiRTl1S2tRPlsyDQCxlDWqd0uEIzQZ6aWSyiutfwQnTzdbZPXK0qOblEVMIqFhSGrB6fp0OkBA== dependencies: - "@graphql-tools/batch-execute" "^8.5.18" - "@graphql-tools/executor" "^0.0.15" - "@graphql-tools/schema" "^9.0.16" - "@graphql-tools/utils" "^9.2.1" - dataloader "^2.2.2" - tslib "^2.5.0" - value-or-promise "^1.0.12" + "@graphql-tools/batch-execute" "8.5.18" + "@graphql-tools/executor" "0.0.14" + "@graphql-tools/schema" "9.0.16" + "@graphql-tools/utils" "9.2.1" + dataloader "2.2.2" + tslib "~2.5.0" + value-or-promise "1.0.12" "@graphql-tools/documents@^0.1.0": version "0.1.0" @@ -2431,23 +2322,23 @@ lodash.sortby "^4.7.0" tslib "^2.4.0" -"@graphql-tools/executor-graphql-ws@^0.0.12": - version "0.0.12" - resolved "https://registry.yarnpkg.com/@graphql-tools/executor-graphql-ws/-/executor-graphql-ws-0.0.12.tgz#dde0d1f5beeceff209df44e30b45388b0afaff95" - integrity sha512-aFD79i9l282Ob5dOZ7JsyhhXXP1o8eQh0prYkSSVo/OU2ndzWigfANz4DJgWgS3LwBjLDlMcmaXPZZeXt3m4Tg== +"@graphql-tools/executor-graphql-ws@^0.0.11": + version "0.0.11" + resolved "https://registry.yarnpkg.com/@graphql-tools/executor-graphql-ws/-/executor-graphql-ws-0.0.11.tgz#c6536aa862f76a9c7ac83e7e07fe8d5119e6de38" + integrity sha512-muRj6j897ks2iKqe3HchWFFzd+jFInSRuLPvHJ7e4WPrejFvaZx3BQ9gndfJvVkfYUZIFm13stCGXaJJTbVM0Q== dependencies: "@graphql-tools/utils" "9.2.1" "@repeaterjs/repeater" "3.0.4" "@types/ws" "^8.0.0" - graphql-ws "5.12.0" + graphql-ws "5.11.3" isomorphic-ws "5.0.0" tslib "^2.4.0" ws "8.12.1" "@graphql-tools/executor-http@^0.1.7", "@graphql-tools/executor-http@^0.1.8": - version "0.1.9" - resolved "https://registry.yarnpkg.com/@graphql-tools/executor-http/-/executor-http-0.1.9.tgz#ddd74ef376b4a2ed59c622acbcca068890854a30" - integrity sha512-tNzMt5qc1ptlHKfpSv9wVBVKCZ7gks6Yb/JcYJluxZIT4qRV+TtOFjpptfBU63usgrGVOVcGjzWc/mt7KhmmpQ== + version "0.1.8" + resolved "https://registry.yarnpkg.com/@graphql-tools/executor-http/-/executor-http-0.1.8.tgz#129fc3095370ecd39cad68103d97ad8aa767e334" + integrity sha512-L3tldMlL760Bkdl6zdearvxqCA8cRmTWvd8SyZ0i/EpBWFkU1XcUF2/wqNt7URdNAE6+pO6wCgI4BEsKOgL7Qg== dependencies: "@graphql-tools/utils" "^9.2.1" "@repeaterjs/repeater" "^3.0.4" @@ -2469,6 +2360,17 @@ tslib "^2.4.0" ws "8.12.1" +"@graphql-tools/executor@0.0.14": + version "0.0.14" + resolved "https://registry.yarnpkg.com/@graphql-tools/executor/-/executor-0.0.14.tgz#7c6073d75c77dd6e7fab0c835761ed09c85a3bc6" + integrity sha512-YiBbN9NT0FgqPJ35+Eg0ty1s5scOZTgiPf+6hLVJBd5zHEURwojEMCTKJ9e0RNZHETp2lN+YaTFGTSoRk0t4Sw== + dependencies: + "@graphql-tools/utils" "9.2.1" + "@graphql-typed-document-node/core" "3.1.1" + "@repeaterjs/repeater" "3.0.4" + tslib "^2.4.0" + value-or-promise "1.0.12" + "@graphql-tools/executor@^0.0.15": version "0.0.15" resolved "https://registry.yarnpkg.com/@graphql-tools/executor/-/executor-0.0.15.tgz#cbd29af2ec54213a52f6c516a7792b3e626a4c49" @@ -2555,6 +2457,14 @@ p-limit "3.1.0" tslib "^2.4.0" +"@graphql-tools/merge@8.3.18": + version "8.3.18" + resolved "https://registry.yarnpkg.com/@graphql-tools/merge/-/merge-8.3.18.tgz#bfbb517c68598a885809f16ce5c3bb1ebb8f04a2" + integrity sha512-R8nBglvRWPAyLpZL/f3lxsY7wjnAeE0l056zHhcO/CgpvK76KYUt9oEkR05i8Hmt8DLRycBN0FiotJ0yDQWTVA== + dependencies: + "@graphql-tools/utils" "9.2.1" + tslib "^2.4.0" + "@graphql-tools/merge@8.4.0", "@graphql-tools/merge@^8.2.6": version "8.4.0" resolved "https://registry.yarnpkg.com/@graphql-tools/merge/-/merge-8.4.0.tgz#47fbe5c4b6764276dc35bd19c4e7d3c46d3dc0fc" @@ -2571,24 +2481,25 @@ tslib "^2.4.0" "@graphql-tools/prisma-loader@^7.2.49": - version "7.2.66" - resolved "https://registry.yarnpkg.com/@graphql-tools/prisma-loader/-/prisma-loader-7.2.66.tgz#b00667c292d88d38aaa3f2ae69ab0212e08464c4" - integrity sha512-20YuvZbVMD3ZFjE4fkmLIiNy4Py7L5NALRB2LNl6lAfX6+2tTfItbVrs4kRzxDviT+3e4FfexLCZIBPD3Sp9kg== + version "7.2.64" + resolved "https://registry.yarnpkg.com/@graphql-tools/prisma-loader/-/prisma-loader-7.2.64.tgz#e9fc85054b15a22a16c8e69ad4f9543da30c0164" + integrity sha512-W8GfzfBKiBSIEgw+/nJk6zUlF6k/jterlNoFhM27mBsbeMtWxKnm1+gEU6KA0N1PNEdq2RIa2W4AfVfVBl2GgQ== dependencies: - "@graphql-tools/url-loader" "7.17.14" + "@graphql-tools/url-loader" "7.17.13" "@graphql-tools/utils" "9.2.1" "@types/js-yaml" "^4.0.0" "@types/json-stable-stringify" "^1.0.32" - "@whatwg-node/fetch" "^0.8.2" + "@types/jsonwebtoken" "^9.0.0" chalk "^4.1.0" debug "^4.3.1" dotenv "^16.0.0" graphql-request "^5.0.0" http-proxy-agent "^5.0.0" https-proxy-agent "^5.0.0" - jose "^4.11.4" + isomorphic-fetch "^3.0.0" js-yaml "^4.0.0" json-stable-stringify "^1.0.1" + jsonwebtoken "^9.0.0" lodash "^4.17.20" scuid "^1.1.0" tslib "^2.4.0" @@ -2603,7 +2514,17 @@ "@graphql-tools/utils" "9.2.1" tslib "^2.4.0" -"@graphql-tools/schema@9.0.17", "@graphql-tools/schema@^9.0.0", "@graphql-tools/schema@^9.0.16": +"@graphql-tools/schema@9.0.16": + version "9.0.16" + resolved "https://registry.yarnpkg.com/@graphql-tools/schema/-/schema-9.0.16.tgz#7d340d69e6094dc01a2b9e625c7bb4fff89ea521" + integrity sha512-kF+tbYPPf/6K2aHG3e1SWIbapDLQaqnIHVRG6ow3onkFoowwtKszvUyOASL6Krcv2x9bIMvd1UkvRf9OaoROQQ== + dependencies: + "@graphql-tools/merge" "8.3.18" + "@graphql-tools/utils" "9.2.1" + tslib "^2.4.0" + value-or-promise "1.0.12" + +"@graphql-tools/schema@9.0.17", "@graphql-tools/schema@^9.0.0": version "9.0.17" resolved "https://registry.yarnpkg.com/@graphql-tools/schema/-/schema-9.0.17.tgz#d731e9899465f88d5b9bf69e607ec465bb88b062" integrity sha512-HVLq0ecbkuXhJlpZ50IHP5nlISqH2GbNgjBJhhRzHeXhfwlUOT4ISXGquWTmuq61K0xSaO0aCjMpxe4QYbKTng== @@ -2613,18 +2534,18 @@ tslib "^2.4.0" value-or-promise "1.0.12" -"@graphql-tools/url-loader@7.17.14", "@graphql-tools/url-loader@^7.13.2", "@graphql-tools/url-loader@^7.9.7": - version "7.17.14" - resolved "https://registry.yarnpkg.com/@graphql-tools/url-loader/-/url-loader-7.17.14.tgz#a08618aa275b4cd8a214a7646a0ca74795e36192" - integrity sha512-7boEmrZlbViqQSSvu2VFCGi9YAY7E0BCVObiv1sLYbFR+62mo825As0haU5l7wlx1zCDyUlOleNz+X2jVvBbSQ== +"@graphql-tools/url-loader@7.17.13", "@graphql-tools/url-loader@^7.13.2", "@graphql-tools/url-loader@^7.9.7": + version "7.17.13" + resolved "https://registry.yarnpkg.com/@graphql-tools/url-loader/-/url-loader-7.17.13.tgz#d4ee8193792ab1c42db2fbdf5f6ca75fa819ac40" + integrity sha512-FEmbvw68kxeZLn4VYGAl+NuBPk09ZnxymjW07A6mCtiDayFgYfHdWeRzXn/iM5PzsEuCD73R1sExtNQ/ISiajg== dependencies: "@ardatan/sync-fetch" "^0.0.1" "@graphql-tools/delegate" "^9.0.27" - "@graphql-tools/executor-graphql-ws" "^0.0.12" + "@graphql-tools/executor-graphql-ws" "^0.0.11" "@graphql-tools/executor-http" "^0.1.7" "@graphql-tools/executor-legacy-ws" "^0.0.9" "@graphql-tools/utils" "^9.2.1" - "@graphql-tools/wrap" "^9.3.8" + "@graphql-tools/wrap" "^9.3.6" "@types/ws" "^8.0.0" "@whatwg-node/fetch" "^0.8.0" isomorphic-ws "^5.0.0" @@ -2641,23 +2562,28 @@ tslib "^2.4.0" "@graphql-tools/utils@^8.8.0": - version "8.13.1" - resolved "https://registry.yarnpkg.com/@graphql-tools/utils/-/utils-8.13.1.tgz#b247607e400365c2cd87ff54654d4ad25a7ac491" - integrity sha512-qIh9yYpdUFmctVqovwMdheVNJqFh+DQNWIhX87FJStfXYnmweBUDATok9fWPleKeFwxnW8IapKmY8m8toJEkAw== + version "8.9.0" + resolved "https://registry.yarnpkg.com/@graphql-tools/utils/-/utils-8.9.0.tgz#c6aa5f651c9c99e1aca55510af21b56ec296cdb7" + integrity sha512-pjJIWH0XOVnYGXCqej8g/u/tsfV4LvLlj0eATKQu5zwnxd/TiTHq7Cg313qUPTFFHZ3PP5wJ15chYVtLDwaymg== dependencies: tslib "^2.4.0" -"@graphql-tools/wrap@^9.3.8": - version "9.3.8" - resolved "https://registry.yarnpkg.com/@graphql-tools/wrap/-/wrap-9.3.8.tgz#c6f53b7bc98cf3fa3d91e41be3b99254ae99b409" - integrity sha512-MGsExYPiILMw4Qff7HcvE9MMSYdjb/tr5IQYJbxJIU4/TrBHox1/smne8HG+Bd7kmDlTTj7nU/Z8sxmoRd0hOQ== +"@graphql-tools/wrap@^9.3.6": + version "9.3.6" + resolved "https://registry.yarnpkg.com/@graphql-tools/wrap/-/wrap-9.3.6.tgz#23beaf9c3713160adda511c6a498d1c7077c2848" + integrity sha512-HtQIYoPz48bzpMYZzoeMmzIIYuVxcaUuLD7dH7GtIhwe2f4hpPDE+JLUPxpYiaXdY10l7kP9wycK+FtRfCsFlw== dependencies: - "@graphql-tools/delegate" "9.0.28" - "@graphql-tools/schema" "9.0.17" + "@graphql-tools/delegate" "9.0.27" + "@graphql-tools/schema" "9.0.16" "@graphql-tools/utils" "9.2.1" tslib "^2.4.0" value-or-promise "1.0.12" +"@graphql-typed-document-node/core@3.1.1": + version "3.1.1" + resolved "https://registry.yarnpkg.com/@graphql-typed-document-node/core/-/core-3.1.1.tgz#076d78ce99822258cf813ecc1e7fa460fa74d052" + integrity sha512-NQ17ii0rK1b34VZonlmT2QMJFI70m0TRwbknO/ihlbatXyaktDhN/98vBiUU6kNBPljqGqyIrl2T4nY2RpFANg== + "@graphql-typed-document-node/core@3.1.2": version "3.1.2" resolved "https://registry.yarnpkg.com/@graphql-typed-document-node/core/-/core-3.1.2.tgz#6fc464307cbe3c8ca5064549b806360d84457b04" @@ -2718,9 +2644,9 @@ "@hapi/hoek" "^9.0.0" "@headlessui/react@^1.7.10": - version "1.7.13" - resolved "https://registry.yarnpkg.com/@headlessui/react/-/react-1.7.13.tgz#fd150b394954e9f1d86ed2340cffd1217d6e7628" - integrity sha512-9n+EQKRtD9266xIHXdY5MfiXPDfYwl7zBM7KOx2Ae3Gdgxy8QML1FkCMjq6AsOf0l6N9uvI4HcFtuFlenaldKg== + version "1.7.12" + resolved "https://registry.yarnpkg.com/@headlessui/react/-/react-1.7.12.tgz#9ab2baa3c4f632782631e00937f9531a34033619" + integrity sha512-FhSx5V+Qp0GvbTpaxyS+ymGDDNntCacClWsk/d8Upbr19g3AsPbjfPk4+m2CgJGcuCB5Dz7LpUIOAbvQTyjL2g== dependencies: client-only "^0.0.1" @@ -3000,10 +2926,10 @@ "@jridgewell/resolve-uri" "3.1.0" "@jridgewell/sourcemap-codec" "1.4.14" -"@lit-labs/ssr-dom-shim@^1.0.0", "@lit-labs/ssr-dom-shim@^1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@lit-labs/ssr-dom-shim/-/ssr-dom-shim-1.1.0.tgz#3361d6b8c4cb2ac426d5794ac7cd9776cd2f0814" - integrity sha512-92uQ5ARf7UXYrzaFcAX3T2rTvaS9Z1//ukV+DqjACM4c8s0ZBQd7ayJU5Dh2AFLD/Ayuyz4uMmxQec8q3U4Ong== +"@lit-labs/ssr-dom-shim@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@lit-labs/ssr-dom-shim/-/ssr-dom-shim-1.0.0.tgz#427e19a2765681fd83411cd72c55ba80a01e0523" + integrity sha512-ic93MBXfApIFTrup4a70M/+ddD8xdt2zxxj9sRwHQzhS9ag/syqkD8JPdTXsc1gUy2K8TTirhlCqyTEM/sifNw== "@lit/reactive-element@^1.3.0", "@lit/reactive-element@^1.6.0": version "1.6.1" @@ -3164,15 +3090,10 @@ resolved "https://registry.yarnpkg.com/@next/env/-/env-13.2.3.tgz#77ca49edb3c1d7c5263bb8f2ebe686080e98279e" integrity sha512-FN50r/E+b8wuqyRjmGaqvqNDuWBWYWQiigfZ50KnSFH0f+AMQQyaZl+Zm2+CIpKk0fL9QxhLxOpTVA3xFHgFow== -"@next/env@13.2.4": - version "13.2.4" - resolved "https://registry.yarnpkg.com/@next/env/-/env-13.2.4.tgz#8b763700262b2445140a44a8c8d088cef676dbae" - integrity sha512-+Mq3TtpkeeKFZanPturjcXt+KHfKYnLlX6jMLyCrmpq6OOs4i1GqBOAauSkii9QeKCMTYzGppar21JU57b/GEA== - -"@next/eslint-plugin-next@13.2.4": - version "13.2.4" - resolved "https://registry.yarnpkg.com/@next/eslint-plugin-next/-/eslint-plugin-next-13.2.4.tgz#3e124cd10ce24dab5d3448ce04104b4f1f4c6ca7" - integrity sha512-ck1lI+7r1mMJpqLNa3LJ5pxCfOB1lfJncKmRJeJxcJqcngaFwylreLP7da6Rrjr6u2gVRTfmnkSkjc80IiQCwQ== +"@next/eslint-plugin-next@13.1.6": + version "13.1.6" + resolved "https://registry.yarnpkg.com/@next/eslint-plugin-next/-/eslint-plugin-next-13.1.6.tgz#ad8be22dd3d8aee9a9bd9a2507e2c55a2f7ebdd9" + integrity sha512-o7cauUYsXjzSJkay8wKjpKJf2uLzlggCsGUkPu3lP09Pv97jYlekTC20KJrjQKmSv5DXV0R/uks2ZXhqjNkqAw== dependencies: glob "7.1.7" @@ -3181,131 +3102,66 @@ resolved "https://registry.yarnpkg.com/@next/swc-android-arm-eabi/-/swc-android-arm-eabi-13.2.3.tgz#85eed560c87c7996558c868a117be9780778f192" integrity sha512-mykdVaAXX/gm+eFO2kPeVjnOCKwanJ9mV2U0lsUGLrEdMUifPUjiXKc6qFAIs08PvmTMOLMNnUxqhGsJlWGKSw== -"@next/swc-android-arm-eabi@13.2.4": - version "13.2.4" - resolved "https://registry.yarnpkg.com/@next/swc-android-arm-eabi/-/swc-android-arm-eabi-13.2.4.tgz#758d0403771e549f9cee71cbabc0cb16a6c947c0" - integrity sha512-DWlalTSkLjDU11MY11jg17O1gGQzpRccM9Oes2yTqj2DpHndajrXHGxj9HGtJ+idq2k7ImUdJVWS2h2l/EDJOw== - "@next/swc-android-arm64@13.2.3": version "13.2.3" resolved "https://registry.yarnpkg.com/@next/swc-android-arm64/-/swc-android-arm64-13.2.3.tgz#8ac54ca9795a48afc4631b4823a4864bd5db0129" integrity sha512-8XwHPpA12gdIFtope+n9xCtJZM3U4gH4vVTpUwJ2w1kfxFmCpwQ4xmeGSkR67uOg80yRMuF0h9V1ueo05sws5w== -"@next/swc-android-arm64@13.2.4": - version "13.2.4" - resolved "https://registry.yarnpkg.com/@next/swc-android-arm64/-/swc-android-arm64-13.2.4.tgz#834d586523045110d5602e0c8aae9028835ac427" - integrity sha512-sRavmUImUCf332Gy+PjIfLkMhiRX1Ez4SI+3vFDRs1N5eXp+uNzjFUK/oLMMOzk6KFSkbiK/3Wt8+dHQR/flNg== - "@next/swc-darwin-arm64@13.2.3": version "13.2.3" resolved "https://registry.yarnpkg.com/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.2.3.tgz#f674e3c65aec505b6d218a662ade3fe248ccdbda" integrity sha512-TXOubiFdLpMfMtaRu1K5d1I9ipKbW5iS2BNbu8zJhoqrhk3Kp7aRKTxqFfWrbliAHhWVE/3fQZUYZOWSXVQi1w== -"@next/swc-darwin-arm64@13.2.4": - version "13.2.4" - resolved "https://registry.yarnpkg.com/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.2.4.tgz#5006fca179a36ef3a24d293abadec7438dbb48c6" - integrity sha512-S6vBl+OrInP47TM3LlYx65betocKUUlTZDDKzTiRDbsRESeyIkBtZ6Qi5uT2zQs4imqllJznVjFd1bXLx3Aa6A== - "@next/swc-darwin-x64@13.2.3": version "13.2.3" resolved "https://registry.yarnpkg.com/@next/swc-darwin-x64/-/swc-darwin-x64-13.2.3.tgz#a15ea7fb4c46034a8f5e387906d0cad08387075a" integrity sha512-GZctkN6bJbpjlFiS5pylgB2pifHvgkqLAPumJzxnxkf7kqNm6rOGuNjsROvOWVWXmKhrzQkREO/WPS2aWsr/yw== -"@next/swc-darwin-x64@13.2.4": - version "13.2.4" - resolved "https://registry.yarnpkg.com/@next/swc-darwin-x64/-/swc-darwin-x64-13.2.4.tgz#6549c7c04322766acc3264ccdb3e1b43fcaf7946" - integrity sha512-a6LBuoYGcFOPGd4o8TPo7wmv5FnMr+Prz+vYHopEDuhDoMSHOnC+v+Ab4D7F0NMZkvQjEJQdJS3rqgFhlZmKlw== - "@next/swc-freebsd-x64@13.2.3": version "13.2.3" resolved "https://registry.yarnpkg.com/@next/swc-freebsd-x64/-/swc-freebsd-x64-13.2.3.tgz#f7ac6ae4f7d706ff2431f33e40230a554c8c2cbc" integrity sha512-rK6GpmMt/mU6MPuav0/M7hJ/3t8HbKPCELw/Uqhi4732xoq2hJ2zbo2FkYs56y6w0KiXrIp4IOwNB9K8L/q62g== -"@next/swc-freebsd-x64@13.2.4": - version "13.2.4" - resolved "https://registry.yarnpkg.com/@next/swc-freebsd-x64/-/swc-freebsd-x64-13.2.4.tgz#0bbe28979e3e868debc2cc06e45e186ce195b7f4" - integrity sha512-kkbzKVZGPaXRBPisoAQkh3xh22r+TD+5HwoC5bOkALraJ0dsOQgSMAvzMXKsN3tMzJUPS0tjtRf1cTzrQ0I5vQ== - "@next/swc-linux-arm-gnueabihf@13.2.3": version "13.2.3" resolved "https://registry.yarnpkg.com/@next/swc-linux-arm-gnueabihf/-/swc-linux-arm-gnueabihf-13.2.3.tgz#84ad9e9679d55542a23b590ad9f2e1e9b2df62f7" integrity sha512-yeiCp/Odt1UJ4KUE89XkeaaboIDiVFqKP4esvoLKGJ0fcqJXMofj4ad3tuQxAMs3F+qqrz9MclqhAHkex1aPZA== -"@next/swc-linux-arm-gnueabihf@13.2.4": - version "13.2.4" - resolved "https://registry.yarnpkg.com/@next/swc-linux-arm-gnueabihf/-/swc-linux-arm-gnueabihf-13.2.4.tgz#1d28d2203f5a7427d6e7119d7bcb5fc40959fb3e" - integrity sha512-7qA1++UY0fjprqtjBZaOA6cas/7GekpjVsZn/0uHvquuITFCdKGFCsKNBx3S0Rpxmx6WYo0GcmhNRM9ru08BGg== - "@next/swc-linux-arm64-gnu@13.2.3": version "13.2.3" resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.2.3.tgz#56f9175bc632d647c60b9e8bedc0875edf92d8b7" integrity sha512-/miIopDOUsuNlvjBjTipvoyjjaxgkOuvlz+cIbbPcm1eFvzX2ltSfgMgty15GuOiR8Hub4FeTSiq3g2dmCkzGA== -"@next/swc-linux-arm64-gnu@13.2.4": - version "13.2.4" - resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.2.4.tgz#eb26448190948cdf4c44b8f34110a3ecea32f1d0" - integrity sha512-xzYZdAeq883MwXgcwc72hqo/F/dwUxCukpDOkx/j1HTq/J0wJthMGjinN9wH5bPR98Mfeh1MZJ91WWPnZOedOg== - "@next/swc-linux-arm64-musl@13.2.3": version "13.2.3" resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.2.3.tgz#7d4cf00e8f1729a3de464da0624773f5d0d14888" integrity sha512-sujxFDhMMDjqhruup8LLGV/y+nCPi6nm5DlFoThMJFvaaKr/imhkXuk8uCTq4YJDbtRxnjydFv2y8laBSJVC2g== -"@next/swc-linux-arm64-musl@13.2.4": - version "13.2.4" - resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.2.4.tgz#c4227c0acd94a420bb14924820710e6284d234d3" - integrity sha512-8rXr3WfmqSiYkb71qzuDP6I6R2T2tpkmf83elDN8z783N9nvTJf2E7eLx86wu2OJCi4T05nuxCsh4IOU3LQ5xw== - "@next/swc-linux-x64-gnu@13.2.3": version "13.2.3" resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.2.3.tgz#17de404910c4ebf7a1d366b19334d7e27e126ab0" integrity sha512-w5MyxPknVvC9LVnMenAYMXMx4KxPwXuJRMQFvY71uXg68n7cvcas85U5zkdrbmuZ+JvsO5SIG8k36/6X3nUhmQ== -"@next/swc-linux-x64-gnu@13.2.4": - version "13.2.4" - resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.2.4.tgz#6bcb540944ee9b0209b33bfc23b240c2044dfc3e" - integrity sha512-Ngxh51zGSlYJ4EfpKG4LI6WfquulNdtmHg1yuOYlaAr33KyPJp4HeN/tivBnAHcZkoNy0hh/SbwDyCnz5PFJQQ== - "@next/swc-linux-x64-musl@13.2.3": version "13.2.3" resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.2.3.tgz#07cb7b7f3a3a98034e2533f82638a9b099ba4ab1" integrity sha512-CTeelh8OzSOVqpzMFMFnVRJIFAFQoTsI9RmVJWW/92S4xfECGcOzgsX37CZ8K982WHRzKU7exeh7vYdG/Eh4CA== -"@next/swc-linux-x64-musl@13.2.4": - version "13.2.4" - resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.2.4.tgz#ce21e43251eaf09a09df39372b2c3e38028c30ff" - integrity sha512-gOvwIYoSxd+j14LOcvJr+ekd9fwYT1RyMAHOp7znA10+l40wkFiMONPLWiZuHxfRk+Dy7YdNdDh3ImumvL6VwA== - "@next/swc-win32-arm64-msvc@13.2.3": version "13.2.3" resolved "https://registry.yarnpkg.com/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.2.3.tgz#b9ac98c954c71ec9de45d3497a8585096b873152" integrity sha512-7N1KBQP5mo4xf52cFCHgMjzbc9jizIlkTepe9tMa2WFvEIlKDfdt38QYcr9mbtny17yuaIw02FXOVEytGzqdOQ== -"@next/swc-win32-arm64-msvc@13.2.4": - version "13.2.4" - resolved "https://registry.yarnpkg.com/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.2.4.tgz#68220063d8e5e082f5465498675640dedb670ff1" - integrity sha512-q3NJzcfClgBm4HvdcnoEncmztxrA5GXqKeiZ/hADvC56pwNALt3ngDC6t6qr1YW9V/EPDxCYeaX4zYxHciW4Dw== - "@next/swc-win32-ia32-msvc@13.2.3": version "13.2.3" resolved "https://registry.yarnpkg.com/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.2.3.tgz#5ec48653a48fd664e940c69c96bba698fdae92eb" integrity sha512-LzWD5pTSipUXTEMRjtxES/NBYktuZdo7xExJqGDMnZU8WOI+v9mQzsmQgZS/q02eIv78JOCSemqVVKZBGCgUvA== -"@next/swc-win32-ia32-msvc@13.2.4": - version "13.2.4" - resolved "https://registry.yarnpkg.com/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.2.4.tgz#7c120ab54a081be9566df310bed834f168252990" - integrity sha512-/eZ5ncmHUYtD2fc6EUmAIZlAJnVT2YmxDsKs1Ourx0ttTtvtma/WKlMV5NoUsyOez0f9ExLyOpeCoz5aj+MPXw== - "@next/swc-win32-x64-msvc@13.2.3": version "13.2.3" resolved "https://registry.yarnpkg.com/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.2.3.tgz#cd432f280beb8d8de5b7cd2501e9f502e9f3dd72" integrity sha512-aLG2MaFs4y7IwaMTosz2r4mVbqRyCnMoFqOcmfTi7/mAS+G4IMH0vJp4oLdbshqiVoiVuKrAfqtXj55/m7Qu1Q== -"@next/swc-win32-x64-msvc@13.2.4": - version "13.2.4" - resolved "https://registry.yarnpkg.com/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.2.4.tgz#5abda92fe12b9829bf7951c4a221282c56041144" - integrity sha512-0MffFmyv7tBLlji01qc0IaPP/LVExzvj7/R5x1Jph1bTAIj4Vu81yFQWHHQAP6r4ff9Ukj1mBK6MDNVXm7Tcvw== - "@nodelib/fs.scandir@2.1.5": version "2.1.5" resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" @@ -3337,10 +3193,10 @@ node-addon-api "^3.2.1" node-gyp-build "^4.3.0" -"@peculiar/asn1-schema@^2.3.6": - version "2.3.6" - resolved "https://registry.yarnpkg.com/@peculiar/asn1-schema/-/asn1-schema-2.3.6.tgz#3dd3c2ade7f702a9a94dfb395c192f5fa5d6b922" - integrity sha512-izNRxPoaeJeg/AyH8hER6s+H7p4itk+03QCa4sbxI3lNdseQYCuxzgsuNK8bTXChtLTjpJz6NmXKA73qLa3rCA== +"@peculiar/asn1-schema@^2.1.6", "@peculiar/asn1-schema@^2.3.0": + version "2.3.3" + resolved "https://registry.yarnpkg.com/@peculiar/asn1-schema/-/asn1-schema-2.3.3.tgz#21418e1f3819e0b353ceff0c2dad8ccb61acd777" + integrity sha512-6GptMYDMyWBHTUKndHaDsRZUO/XMSgIns2krxcm2L7SEExRHwawFvSwNBhqNPR9HJwv3MruAiF1bhN0we6j6GQ== dependencies: asn1js "^3.0.5" pvtsutils "^1.3.2" @@ -3354,15 +3210,15 @@ tslib "^2.0.0" "@peculiar/webcrypto@^1.4.0": - version "1.4.3" - resolved "https://registry.yarnpkg.com/@peculiar/webcrypto/-/webcrypto-1.4.3.tgz#078b3e8f598e847b78683dc3ba65feb5029b93a7" - integrity sha512-VtaY4spKTdN5LjJ04im/d/joXuvLbQdgy5Z4DXF4MFZhQ+MTrejbNMkfZBp1Bs3O5+bFqnJgyGdPuZQflvIa5A== + version "1.4.1" + resolved "https://registry.yarnpkg.com/@peculiar/webcrypto/-/webcrypto-1.4.1.tgz#821493bd5ad0f05939bd5f53b28536f68158360a" + integrity sha512-eK4C6WTNYxoI7JOabMoZICiyqRRtJB220bh0Mbj5RwRycleZf9BPyZoxsTvpP0FpmVS2aS13NKOuh5/tN3sIRw== dependencies: - "@peculiar/asn1-schema" "^2.3.6" + "@peculiar/asn1-schema" "^2.3.0" "@peculiar/json-schema" "^1.1.12" pvtsutils "^1.3.2" - tslib "^2.5.0" - webcrypto-core "^1.7.7" + tslib "^2.4.1" + webcrypto-core "^1.7.4" "@pkgr/utils@^2.3.1": version "2.3.1" @@ -3382,9 +3238,9 @@ integrity sha512-a5Sab1C4/icpTZVzZc5Ghpz88yQtGOyNqYXcZgOssB2uuAr+wF/MvN6bgtW32q7HHrvBki+BsZ0OuNv6EV3K9g== "@popperjs/core@^2.11.6": - version "2.11.7" - resolved "https://registry.yarnpkg.com/@popperjs/core/-/core-2.11.7.tgz#ccab5c8f7dc557a52ca3288c10075c9ccd37fff7" - integrity sha512-Cr4OjIkipTtcXKjAsm8agyleBuDHvxzeBoa1v543lbv1YaIwQjESsVcmjiWiPEbC1FIeHOG/Op9kdCmAmiS3Kw== + version "2.11.6" + resolved "https://registry.yarnpkg.com/@popperjs/core/-/core-2.11.6.tgz#cee20bd55e68a1720bdab363ecf0c821ded4cd45" + integrity sha512-50/17A98tWUfQ176raKiOGXuYpLyyVMkxxG6oylzL3BPOlA6ADGdK7EYunSa4I064xerltq9TGXs8HmOk5E+vw== "@radix-ui/primitive@1.0.0": version "1.0.0" @@ -3618,71 +3474,71 @@ dependencies: "@sinonjs/commons" "^1.7.0" -"@swc/core-darwin-arm64@1.3.42": - version "1.3.42" - resolved "https://registry.yarnpkg.com/@swc/core-darwin-arm64/-/core-darwin-arm64-1.3.42.tgz#fabb645b288199b730d846e3eda370b77f5ebe9f" - integrity sha512-hM6RrZFyoCM9mX3cj/zM5oXwhAqjUdOCLXJx7KTQps7NIkv/Qjvobgvyf2gAb89j3ARNo9NdIoLjTjJ6oALtiA== - -"@swc/core-darwin-x64@1.3.42": - version "1.3.42" - resolved "https://registry.yarnpkg.com/@swc/core-darwin-x64/-/core-darwin-x64-1.3.42.tgz#dcd434ec8dda6f2178a10da0def036a071a6e008" - integrity sha512-bjsWtHMb6wJK1+RGlBs2USvgZ0txlMk11y0qBLKo32gLKTqzUwRw0Fmfzuf6Ue2a/w//7eqMlPFEre4LvJajGw== - -"@swc/core-linux-arm-gnueabihf@1.3.42": - version "1.3.42" - resolved "https://registry.yarnpkg.com/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.3.42.tgz#59c57b15113d316e8a4a6d690a6c09429483d201" - integrity sha512-Oe0ggMz3MyqXNfeVmY+bBTL0hFSNY3bx8dhcqsh4vXk/ZVGse94QoC4dd92LuPHmKT0x6nsUzB86x2jU9QHW5g== - -"@swc/core-linux-arm64-gnu@1.3.42": - version "1.3.42" - resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.3.42.tgz#50d026b9f4d7a5f25deacc8c8dd45fc12be70a95" - integrity sha512-ZJsa8NIW1RLmmHGTJCbM7OPSbBZ9rOMrLqDtUOGrT0uoJXZnnQqolflamB5wviW0X6h3Z3/PSTNGNDCJ3u3Lqg== - -"@swc/core-linux-arm64-musl@1.3.42": - version "1.3.42" - resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.3.42.tgz#3c0e51b0709dcf06289949803c9a36a46a97827c" - integrity sha512-YpZwlFAfOp5vkm/uVUJX1O7N3yJDO1fDQRWqsOPPNyIJkI2ydlRQtgN6ZylC159Qv+TimfXnGTlNr7o3iBAqjg== - -"@swc/core-linux-x64-gnu@1.3.42": - version "1.3.42" - resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.3.42.tgz#059ac0acddebd0360851871929a14dbacf74f865" - integrity sha512-0ccpKnsZbyHBzaQFdP8U9i29nvOfKitm6oJfdJzlqsY/jCqwvD8kv2CAKSK8WhJz//ExI2LqNrDI0yazx5j7+A== - -"@swc/core-linux-x64-musl@1.3.42": - version "1.3.42" - resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.3.42.tgz#7a61093d93a3abc2f893b7d31fd6c22c4cab2212" - integrity sha512-7eckRRuTZ6+3K21uyfXXgc2ZCg0mSWRRNwNT3wap2bYkKPeqTgb8pm8xYSZNEiMuDonHEat6XCCV36lFY6kOdQ== - -"@swc/core-win32-arm64-msvc@1.3.42": - version "1.3.42" - resolved "https://registry.yarnpkg.com/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.3.42.tgz#12f92c960ea801aa26ffa5b91d369ac24c2a3cca" - integrity sha512-t27dJkdw0GWANdN4TV0lY/V5vTYSx5SRjyzzZolep358ueCGuN1XFf1R0JcCbd1ojosnkQg2L7A7991UjXingg== - -"@swc/core-win32-ia32-msvc@1.3.42": - version "1.3.42" - resolved "https://registry.yarnpkg.com/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.3.42.tgz#be022aff03838515fa5506be300f0ea15f3fb476" - integrity sha512-xfpc/Zt/aMILX4IX0e3loZaFyrae37u3MJCv1gJxgqrpeLi7efIQr3AmERkTK3mxTO6R5urSliWw2W3FyZ7D3Q== - -"@swc/core-win32-x64-msvc@1.3.42": - version "1.3.42" - resolved "https://registry.yarnpkg.com/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.3.42.tgz#fccac26974f03234e502276389f4330e2696887f" - integrity sha512-ra2K4Tu++EJLPhzZ6L8hWUsk94TdK/2UKhL9dzCBhtzKUixsGCEqhtqH1zISXNvW8qaVLFIMUP37ULe80/IJaA== +"@swc/core-darwin-arm64@1.3.37": + version "1.3.37" + resolved "https://registry.yarnpkg.com/@swc/core-darwin-arm64/-/core-darwin-arm64-1.3.37.tgz#a92e075ae35f18a64aaf3823ea175f03564f8da1" + integrity sha512-iIyVqqioUpVeT/hbBVfkrsjfCyL4idNH+LVKGmoTAWaTTSB0+UNhNuA7Wh2CqIHWh1Mv7IlumitWPcqsVDdoEw== + +"@swc/core-darwin-x64@1.3.37": + version "1.3.37" + resolved "https://registry.yarnpkg.com/@swc/core-darwin-x64/-/core-darwin-x64-1.3.37.tgz#a3cc06c87140a2ca0b8e7ef1f3d5cc34dd080429" + integrity sha512-dao5nXPWKxtaxqak4ZkRyBoApNIelW/glantQhPhj0FjMjuIQc+v03ldJ8XDByWOG+6xuVUTheANCtEccxoQBw== + +"@swc/core-linux-arm-gnueabihf@1.3.37": + version "1.3.37" + resolved "https://registry.yarnpkg.com/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.3.37.tgz#f7d8f8523830c6be653f608839d4bd5598457f1f" + integrity sha512-/mVrc8H/f062CUkqKGmBiil2VIYu4mKawHxERfeP1y38X5K/OwjG5s9MgO9TVxy+Ly6vejwj70kRhSa3hVp1Bw== + +"@swc/core-linux-arm64-gnu@1.3.37": + version "1.3.37" + resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.3.37.tgz#b162febd9de14fb08000c722b063be2bb5aefa6b" + integrity sha512-eRQ3KaZI0j5LidTfOIi/kUVOOMuVmw1HCdt/Z1TAUKoHMLVxY8xcJ3pEE3/+ednI60EmHpwpJRs6LelXyL6uzQ== + +"@swc/core-linux-arm64-musl@1.3.37": + version "1.3.37" + resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.3.37.tgz#3b1a628e880fbb1a5e2a7a46d42e8aa878c6bfdd" + integrity sha512-w2BRLODyxNQY2rfHZMZ5ir6QrrnGBPlnIslTrgKmVbn1OjZoxUCtuqhrYnCmybaAc4DOkeH02TqynEFXrm+EMw== + +"@swc/core-linux-x64-gnu@1.3.37": + version "1.3.37" + resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.3.37.tgz#ed443ad77dc90e415267d02a38e4113047b2d3d8" + integrity sha512-CfoH8EsZJZ9kunjMUjBNYD5fFuO86zw+K/o4wEw72Yg6ZEiqPmeIlCKU8tpTv4sK+CbhUXrmVzMB5tqsb2jALQ== + +"@swc/core-linux-x64-musl@1.3.37": + version "1.3.37" + resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.3.37.tgz#de607a4985458bd6e8b0e40f0d62d0e26bd8df1e" + integrity sha512-9YPrHYNdoG7PK11gV51GfL45biI2dic+YTqHUDKyykemsD7Ot1zUFX7Ty//pdvpKcKSff6SrHbfFACD5ziNirA== + +"@swc/core-win32-arm64-msvc@1.3.37": + version "1.3.37" + resolved "https://registry.yarnpkg.com/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.3.37.tgz#d5851a47d7df183929b9746d56f76c282f940e6a" + integrity sha512-h17Ek8/wCDje6BrXOvCXBM80oBRmTSMMdLyt87whTl5xqYlWYYs9oQIzZndNRTlNpTgjGO8Ns2eo4kwVxIkBIA== + +"@swc/core-win32-ia32-msvc@1.3.37": + version "1.3.37" + resolved "https://registry.yarnpkg.com/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.3.37.tgz#06ad7016f61b56aec4abf60eab3a91b786f9e294" + integrity sha512-1BR175E1olGy/zdt94cgdb6ps/lBNissAOaxyBk8taFpcjy3zpdP30yAoH0GIsC6isnZ5JfArbOJNRXXO5tE0Q== + +"@swc/core-win32-x64-msvc@1.3.37": + version "1.3.37" + resolved "https://registry.yarnpkg.com/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.3.37.tgz#60139a7089003a7447a4efef9704ae8fde21995e" + integrity sha512-1siDQ7dccQ1pesJmgAL3BUBbRPtfbNInOWnZOkiie/DfFqGQ117QKnCVyjUvwFKfTQx1+3UUTDmMSlRd00SlXg== "@swc/core@^1.3.35": - version "1.3.42" - resolved "https://registry.yarnpkg.com/@swc/core/-/core-1.3.42.tgz#7067c4fd9a02536f9ca7b54ed8ebc45e2df810cf" - integrity sha512-nVFUd5+7tGniM2cT3LXaqnu3735Cu4az8A9gAKK+8sdpASI52SWuqfDBmjFCK9xG90MiVDVp2PTZr0BWqCIzpw== + version "1.3.37" + resolved "https://registry.yarnpkg.com/@swc/core/-/core-1.3.37.tgz#644653fa7deb20c7c342e7fd019c7abc44ecf1bf" + integrity sha512-VOFlEQ1pReOM73N9A7R8rt561GU8Rxsq833jiimWDUB2sXEN3V6n6wFTgYmZuMz2T4/R0cQA1nV48KkaT4gkFw== optionalDependencies: - "@swc/core-darwin-arm64" "1.3.42" - "@swc/core-darwin-x64" "1.3.42" - "@swc/core-linux-arm-gnueabihf" "1.3.42" - "@swc/core-linux-arm64-gnu" "1.3.42" - "@swc/core-linux-arm64-musl" "1.3.42" - "@swc/core-linux-x64-gnu" "1.3.42" - "@swc/core-linux-x64-musl" "1.3.42" - "@swc/core-win32-arm64-msvc" "1.3.42" - "@swc/core-win32-ia32-msvc" "1.3.42" - "@swc/core-win32-x64-msvc" "1.3.42" + "@swc/core-darwin-arm64" "1.3.37" + "@swc/core-darwin-x64" "1.3.37" + "@swc/core-linux-arm-gnueabihf" "1.3.37" + "@swc/core-linux-arm64-gnu" "1.3.37" + "@swc/core-linux-arm64-musl" "1.3.37" + "@swc/core-linux-x64-gnu" "1.3.37" + "@swc/core-linux-x64-musl" "1.3.37" + "@swc/core-win32-arm64-msvc" "1.3.37" + "@swc/core-win32-ia32-msvc" "1.3.37" + "@swc/core-win32-x64-msvc" "1.3.37" "@swc/helpers@0.4.14": version "0.4.14" @@ -3976,16 +3832,11 @@ resolved "https://registry.yarnpkg.com/@types/js-yaml/-/js-yaml-4.0.5.tgz#738dd390a6ecc5442f35e7f03fa1431353f7e138" integrity sha512-FhpRzf927MNQdRZP0J5DLIdTXhjLYzeUTmLAu69mnVksLH9CJY3IuSeEgbKUki7GQZm0WqDkGzyxju2EZGD2wA== -"@types/json-schema@7.0.9": +"@types/json-schema@7.0.9", "@types/json-schema@^7.0.4", "@types/json-schema@^7.0.9": version "7.0.9" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.9.tgz#97edc9037ea0c38585320b28964dde3b39e4660d" integrity sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ== -"@types/json-schema@^7.0.5", "@types/json-schema@^7.0.9": - version "7.0.11" - resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3" - integrity sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ== - "@types/json-stable-stringify@^1.0.32": version "1.0.34" resolved "https://registry.yarnpkg.com/@types/json-stable-stringify/-/json-stable-stringify-1.0.34.tgz#c0fb25e4d957e0ee2e497c1f553d7f8bb668fd75" @@ -4001,6 +3852,13 @@ resolved "https://registry.yarnpkg.com/@types/jsonpath/-/jsonpath-0.2.0.tgz#13c62db22a34d9c411364fac79fd374d63445aa1" integrity sha512-v7qlPA0VpKUlEdhghbDqRoKMxFB3h3Ch688TApBJ6v+XLDdvWCGLJIYiPKGZnS6MAOie+IorCfNYVHOPIHSWwQ== +"@types/jsonwebtoken@^9.0.0": + version "9.0.1" + resolved "https://registry.yarnpkg.com/@types/jsonwebtoken/-/jsonwebtoken-9.0.1.tgz#29b1369c4774200d6d6f63135bf3d1ba3ef997a4" + integrity sha512-c5ltxazpWabia/4UzhIoaDcIza4KViOQhdbjRlfcIGVnsE3c3brkz9Z+F/EeJIECOQP7W7US2hNE930cWWkPiw== + dependencies: + "@types/node" "*" + "@types/katex@^0.11.0": version "0.11.1" resolved "https://registry.yarnpkg.com/@types/katex/-/katex-0.11.1.tgz#34de04477dcf79e2ef6c8d23b41a3d81f9ebeaf5" @@ -4012,16 +3870,16 @@ integrity sha512-j6G1e8DULJx3ONf6NdR5JiR2ZY3K3PaaqiEuKYkLQO0Czfi1AzrtjfnfCROyWGeDd5IVMKCwsgSmMip9OWijow== "@types/mdast@^3.0.0": - version "3.0.11" - resolved "https://registry.yarnpkg.com/@types/mdast/-/mdast-3.0.11.tgz#dc130f7e7d9306124286f6d6cee40cf4d14a3dc0" - integrity sha512-Y/uImid8aAwrEA24/1tcRZwpxX3pIFTSilcNDKSPn+Y2iDywSEachzRuvgAYYLR3wpGXAsMbv5lvKLDZLeYPAw== + version "3.0.10" + resolved "https://registry.yarnpkg.com/@types/mdast/-/mdast-3.0.10.tgz#4724244a82a4598884cbbe9bcfd73dff927ee8af" + integrity sha512-W864tg/Osz1+9f4lrGTZpCSO5/z4608eUp19tbozkq2HJK6i3z1kT0H9tlADXuYIb1YYOBByU4Jsqkk75q48qA== dependencies: "@types/unist" "*" "@types/mdx@^2.0.0": - version "2.0.4" - resolved "https://registry.yarnpkg.com/@types/mdx/-/mdx-2.0.4.tgz#d1cad61ccc803b3c248c3d9990a2a6880bef537f" - integrity sha512-qCYrNdpKwN6YO6FVnx+ulfqifKlE3lQGsNhvDaW9Oxzyob/cRLBJWow8GHBBD4NxQ7BVvtsATgLsX0vZAWmtrg== + version "2.0.3" + resolved "https://registry.yarnpkg.com/@types/mdx/-/mdx-2.0.3.tgz#43fd32414f17fcbeced3578109a6edd877a2d96e" + integrity sha512-IgHxcT3RC8LzFLhKwP3gbMPeaK7BM9eBH46OdapPA7yvuIUJ8H6zHZV53J8hGZcTSnt95jANt+rTBNUUc22ACQ== "@types/micromatch@^4.0.2": version "4.0.2" @@ -4047,12 +3905,7 @@ resolved "https://registry.yarnpkg.com/@types/ms/-/ms-0.7.31.tgz#31b7ca6407128a3d2bbc27fe2d21b345397f6197" integrity sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA== -"@types/node@*", "@types/node@^18.11.18": - version "18.15.11" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.15.11.tgz#b3b790f09cb1696cffcec605de025b088fa4225f" - integrity sha512-E5Kwq2n4SbMzQOn6wnmBjuK9ouqlURrcZDVfbo9ftDDTFt3nk7ZKK4GMOzoYgnpQJKcxwQw+lGaBvvlMo0qN/Q== - -"@types/node@18.15.1": +"@types/node@*", "@types/node@18.15.1", "@types/node@^18.11.18": version "18.15.1" resolved "https://registry.yarnpkg.com/@types/node/-/node-18.15.1.tgz#41dc2bf78e8085a250d4670d95edb7fba621dd29" integrity sha512-U2TWca8AeHSmbpi314QBESRk7oPjSZjDsR+c+H4ECC1l+kFgpZf8Ydhv3SJpPy51VyZHHqxlb6mTTqYNNRVAIw== @@ -4063,14 +3916,14 @@ integrity sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ== "@types/node@^14.14.31": - version "14.18.42" - resolved "https://registry.yarnpkg.com/@types/node/-/node-14.18.42.tgz#fa39b2dc8e0eba61bdf51c66502f84e23b66e114" - integrity sha512-xefu+RBie4xWlK8hwAzGh3npDz/4VhF6icY/shU+zv/1fNn+ZVG7T7CRwe9LId9sAYRPxI+59QBPuKL3WpyGRg== + version "14.18.36" + resolved "https://registry.yarnpkg.com/@types/node/-/node-14.18.36.tgz#c414052cb9d43fab67d679d5f3c641be911f5835" + integrity sha512-FXKWbsJ6a1hIrRxv+FoukuHnGTgEzKYGi7kilfMae96AL9UNkPFNWJEEYWzdRI9ooIkbr4AKldyuSTLql06vLQ== "@types/node@^16.9.2": - version "16.18.22" - resolved "https://registry.yarnpkg.com/@types/node/-/node-16.18.22.tgz#a6505a5da1387aae03fddfb93591118f27b4c0ea" - integrity sha512-LJSIirgASa1LicFGTUFwDY7BfKDtLIbijqDLkH47LxEo/jtdrtiZ4/kLPD99bEQhTcPcuh6KhDllHqRxygJD2w== + version "16.18.12" + resolved "https://registry.yarnpkg.com/@types/node/-/node-16.18.12.tgz#e3bfea80e31523fde4292a6118f19ffa24fd6f65" + integrity sha512-vzLe5NaNMjIE3mcddFVGlAXN1LEWueUsMsOJWaT6wWMJGyljHAWHznqfnKUQWGzu7TLPrGvWdNAsvQYW+C0xtw== "@types/normalize-package-data@^2.4.0": version "2.4.1" @@ -4111,16 +3964,7 @@ dependencies: "@types/react" "*" -"@types/react@*", "@types/react@>=16", "@types/react@^18.0.15", "@types/react@^18.0.17", "@types/react@^18.0.27": - version "18.0.31" - resolved "https://registry.yarnpkg.com/@types/react/-/react-18.0.31.tgz#a69ef8dd7bfa849734d258c793a8fe343a338205" - integrity sha512-EEG67of7DsvRDU6BLLI0p+k1GojDLz9+lZsnCpCRTa/lOokvyPBvp8S5x+A24hME3yyQuIipcP70KJ6H7Qupww== - dependencies: - "@types/prop-types" "*" - "@types/scheduler" "*" - csstype "^3.0.2" - -"@types/react@18.0.30": +"@types/react@*", "@types/react@18.0.30", "@types/react@>=16", "@types/react@^18.0.15", "@types/react@^18.0.17", "@types/react@^18.0.27": version "18.0.30" resolved "https://registry.yarnpkg.com/@types/react/-/react-18.0.30.tgz#83944e679fc7aeab3f042b76d63c4d755b56b7c4" integrity sha512-AnME2cHDH11Pxt/yYX6r0w448BfTwQOLEhQEjCdwB7QskEI7EKtxhGUsExTQe/MsY3D9D5rMtu62WRocw9A8FA== @@ -4137,9 +3981,9 @@ "@types/node" "*" "@types/scheduler@*": - version "0.16.3" - resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.3.tgz#cef09e3ec9af1d63d2a6cc5b383a737e24e6dcf5" - integrity sha512-5cJ8CB4yAx7BH1oMvdU0Jh9lrEXyPkar6F9G/ERswkCuvP4KQZfZkSjcMbAICCpQTN4OuZn8tz0HiKv9TGZgrQ== + version "0.16.2" + resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.2.tgz#1a62f89525723dde24ba1b01b092bf5df8ad4d39" + integrity sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew== "@types/semver@^6.0.0": version "6.2.3" @@ -4179,9 +4023,9 @@ "@types/node" "*" "@types/trusted-types@^2.0.2": - version "2.0.3" - resolved "https://registry.yarnpkg.com/@types/trusted-types/-/trusted-types-2.0.3.tgz#a136f83b0758698df454e328759dbd3d44555311" - integrity sha512-NfQ4gyz38SL8sDNrSixxU2Os1a5xcdFxipAFxYEuLUlvU2uDwS4NUpsImcf1//SlWItCVMMLiylsxbmNMToV/g== + version "2.0.2" + resolved "https://registry.yarnpkg.com/@types/trusted-types/-/trusted-types-2.0.2.tgz#fc25ad9943bcac11cceb8168db4f275e0e72e756" + integrity sha512-F5DIZ36YVLE+PN+Zwws4kJogq47hNgX3Nx6WyDJ3kcplxyke3XIzB8uK5n/Lpm1HBsbGzd6nmGehL8cPekP+Tg== "@types/unist@*", "@types/unist@^2.0.0", "@types/unist@^2.0.2": version "2.0.6" @@ -4201,9 +4045,9 @@ integrity sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA== "@types/yargs@^17.0.8": - version "17.0.24" - resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.24.tgz#b3ef8d50ad4aa6aecf6ddc97c580a00f5aa11902" - integrity sha512-6i0aC7jV6QzQB8ne1joVZ0eSFIstHsCrobmOtghM11yGlH0j43FKL2UhWdELkyps0zuf7qVTUVCCR+tgSlyLLw== + version "17.0.22" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.22.tgz#7dd37697691b5f17d020f3c63e7a45971ff71e9a" + integrity sha512-pet5WJ9U8yPVRhkwuEIp5ktAeAqRZOq4UdAyWLWzxbtpyXnzbtLdKiXAjJzi/KLmPGS9wk86lUFWZFN6sISo4g== dependencies: "@types/yargs-parser" "*" @@ -4215,90 +4059,90 @@ "@types/node" "*" "@typescript-eslint/eslint-plugin@^5.48.1": - version "5.57.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.57.0.tgz#52c8a7a4512f10e7249ca1e2e61f81c62c34365c" - integrity sha512-itag0qpN6q2UMM6Xgk6xoHa0D0/P+M17THnr4SVgqn9Rgam5k/He33MA7/D7QoJcdMxHFyX7U9imaBonAX/6qA== + version "5.52.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.52.0.tgz#5fb0d43574c2411f16ea80f5fc335b8eaa7b28a8" + integrity sha512-lHazYdvYVsBokwCdKOppvYJKaJ4S41CgKBcPvyd0xjZNbvQdhn/pnJlGtQksQ/NhInzdaeaSarlBjDXHuclEbg== dependencies: - "@eslint-community/regexpp" "^4.4.0" - "@typescript-eslint/scope-manager" "5.57.0" - "@typescript-eslint/type-utils" "5.57.0" - "@typescript-eslint/utils" "5.57.0" + "@typescript-eslint/scope-manager" "5.52.0" + "@typescript-eslint/type-utils" "5.52.0" + "@typescript-eslint/utils" "5.52.0" debug "^4.3.4" grapheme-splitter "^1.0.4" ignore "^5.2.0" natural-compare-lite "^1.4.0" + regexpp "^3.2.0" semver "^7.3.7" tsutils "^3.21.0" "@typescript-eslint/parser@^5.42.0", "@typescript-eslint/parser@^5.48.1": - version "5.57.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.57.0.tgz#f675bf2cd1a838949fd0de5683834417b757e4fa" - integrity sha512-orrduvpWYkgLCyAdNtR1QIWovcNZlEm6yL8nwH/eTxWLd8gsP+25pdLHYzL2QdkqrieaDwLpytHqycncv0woUQ== + version "5.52.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.52.0.tgz#73c136df6c0133f1d7870de7131ccf356f5be5a4" + integrity sha512-e2KiLQOZRo4Y0D/b+3y08i3jsekoSkOYStROYmPUnGMEoA0h+k2qOH5H6tcjIc68WDvGwH+PaOrP1XRzLJ6QlA== dependencies: - "@typescript-eslint/scope-manager" "5.57.0" - "@typescript-eslint/types" "5.57.0" - "@typescript-eslint/typescript-estree" "5.57.0" + "@typescript-eslint/scope-manager" "5.52.0" + "@typescript-eslint/types" "5.52.0" + "@typescript-eslint/typescript-estree" "5.52.0" debug "^4.3.4" -"@typescript-eslint/scope-manager@5.57.0": - version "5.57.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.57.0.tgz#79ccd3fa7bde0758059172d44239e871e087ea36" - integrity sha512-NANBNOQvllPlizl9LatX8+MHi7bx7WGIWYjPHDmQe5Si/0YEYfxSljJpoTyTWFTgRy3X8gLYSE4xQ2U+aCozSw== +"@typescript-eslint/scope-manager@5.52.0": + version "5.52.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.52.0.tgz#a993d89a0556ea16811db48eabd7c5b72dcb83d1" + integrity sha512-AR7sxxfBKiNV0FWBSARxM8DmNxrwgnYMPwmpkC1Pl1n+eT8/I2NAUPuwDy/FmDcC6F8pBfmOcaxcxRHspgOBMw== dependencies: - "@typescript-eslint/types" "5.57.0" - "@typescript-eslint/visitor-keys" "5.57.0" + "@typescript-eslint/types" "5.52.0" + "@typescript-eslint/visitor-keys" "5.52.0" -"@typescript-eslint/type-utils@5.57.0": - version "5.57.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.57.0.tgz#98e7531c4e927855d45bd362de922a619b4319f2" - integrity sha512-kxXoq9zOTbvqzLbdNKy1yFrxLC6GDJFE2Yuo3KqSwTmDOFjUGeWSakgoXT864WcK5/NAJkkONCiKb1ddsqhLXQ== +"@typescript-eslint/type-utils@5.52.0": + version "5.52.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.52.0.tgz#9fd28cd02e6f21f5109e35496df41893f33167aa" + integrity sha512-tEKuUHfDOv852QGlpPtB3lHOoig5pyFQN/cUiZtpw99D93nEBjexRLre5sQZlkMoHry/lZr8qDAt2oAHLKA6Jw== dependencies: - "@typescript-eslint/typescript-estree" "5.57.0" - "@typescript-eslint/utils" "5.57.0" + "@typescript-eslint/typescript-estree" "5.52.0" + "@typescript-eslint/utils" "5.52.0" debug "^4.3.4" tsutils "^3.21.0" -"@typescript-eslint/types@5.57.0": - version "5.57.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.57.0.tgz#727bfa2b64c73a4376264379cf1f447998eaa132" - integrity sha512-mxsod+aZRSyLT+jiqHw1KK6xrANm19/+VFALVFP5qa/aiJnlP38qpyaTd0fEKhWvQk6YeNZ5LGwI1pDpBRBhtQ== +"@typescript-eslint/types@5.52.0": + version "5.52.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.52.0.tgz#19e9abc6afb5bd37a1a9bea877a1a836c0b3241b" + integrity sha512-oV7XU4CHYfBhk78fS7tkum+/Dpgsfi91IIDy7fjCyq2k6KB63M6gMC0YIvy+iABzmXThCRI6xpCEyVObBdWSDQ== -"@typescript-eslint/typescript-estree@5.57.0": - version "5.57.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.57.0.tgz#ebcd0ee3e1d6230e888d88cddf654252d41e2e40" - integrity sha512-LTzQ23TV82KpO8HPnWuxM2V7ieXW8O142I7hQTxWIHDcCEIjtkat6H96PFkYBQqGFLW/G/eVVOB9Z8rcvdY/Vw== +"@typescript-eslint/typescript-estree@5.52.0": + version "5.52.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.52.0.tgz#6408cb3c2ccc01c03c278cb201cf07e73347dfca" + integrity sha512-WeWnjanyEwt6+fVrSR0MYgEpUAuROxuAH516WPjUblIrClzYJj0kBbjdnbQXLpgAN8qbEuGywiQsXUVDiAoEuQ== dependencies: - "@typescript-eslint/types" "5.57.0" - "@typescript-eslint/visitor-keys" "5.57.0" + "@typescript-eslint/types" "5.52.0" + "@typescript-eslint/visitor-keys" "5.52.0" debug "^4.3.4" globby "^11.1.0" is-glob "^4.0.3" semver "^7.3.7" tsutils "^3.21.0" -"@typescript-eslint/utils@5.57.0": - version "5.57.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.57.0.tgz#eab8f6563a2ac31f60f3e7024b91bf75f43ecef6" - integrity sha512-ps/4WohXV7C+LTSgAL5CApxvxbMkl9B9AUZRtnEFonpIxZDIT7wC1xfvuJONMidrkB9scs4zhtRyIwHh4+18kw== +"@typescript-eslint/utils@5.52.0": + version "5.52.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.52.0.tgz#b260bb5a8f6b00a0ed51db66bdba4ed5e4845a72" + integrity sha512-As3lChhrbwWQLNk2HC8Ree96hldKIqk98EYvypd3It8Q1f8d5zWyIoaZEp2va5667M4ZyE7X8UUR+azXrFl+NA== dependencies: - "@eslint-community/eslint-utils" "^4.2.0" "@types/json-schema" "^7.0.9" "@types/semver" "^7.3.12" - "@typescript-eslint/scope-manager" "5.57.0" - "@typescript-eslint/types" "5.57.0" - "@typescript-eslint/typescript-estree" "5.57.0" + "@typescript-eslint/scope-manager" "5.52.0" + "@typescript-eslint/types" "5.52.0" + "@typescript-eslint/typescript-estree" "5.52.0" eslint-scope "^5.1.1" + eslint-utils "^3.0.0" semver "^7.3.7" -"@typescript-eslint/visitor-keys@5.57.0": - version "5.57.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.57.0.tgz#e2b2f4174aff1d15eef887ce3d019ecc2d7a8ac1" - integrity sha512-ery2g3k0hv5BLiKpPuwYt9KBkAp2ugT6VvyShXdLOkax895EC55sP0Tx5L0fZaQueiK3fBLvHVvEl3jFS5ia+g== +"@typescript-eslint/visitor-keys@5.52.0": + version "5.52.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.52.0.tgz#e38c971259f44f80cfe49d97dbffa38e3e75030f" + integrity sha512-qMwpw6SU5VHCPr99y274xhbm+PRViK/NATY6qzt+Et7+mThGuFSl/ompj2/hrBlRP/kq+BFdgagnOSgw9TB0eA== dependencies: - "@typescript-eslint/types" "5.57.0" + "@typescript-eslint/types" "5.52.0" eslint-visitor-keys "^3.3.0" -"@urql/core@^3.2.0": +"@urql/core@^3.0.3", "@urql/core@^3.2.0": version "3.2.2" resolved "https://registry.yarnpkg.com/@urql/core/-/core-3.2.2.tgz#2a44015b536d72981822f715c96393d8e0ddc576" integrity sha512-i046Cz8cZ4xIzGMTyHZrbdgzcFMcKD7+yhCAH5FwWBRjcKrc+RjEOuR9X5AMuBvr8c6IAaE92xAqa4wmlGfWTQ== @@ -4499,7 +4343,7 @@ resolved "https://registry.yarnpkg.com/@whatwg-node/events/-/events-0.0.2.tgz#7b7107268d2982fc7b7aff5ee6803c64018f84dd" integrity sha512-WKj/lI4QjnLuPrim0cfO7i+HsDSXHxNv1y0CrJhdntuO3hxWZmnXCwNDnwOvry11OjRin6cgWNF+j/9Pn8TN4w== -"@whatwg-node/fetch@^0.8.0", "@whatwg-node/fetch@^0.8.1", "@whatwg-node/fetch@^0.8.2", "@whatwg-node/fetch@^0.8.3", "@whatwg-node/fetch@^0.8.4": +"@whatwg-node/fetch@^0.8.0", "@whatwg-node/fetch@^0.8.1", "@whatwg-node/fetch@^0.8.2", "@whatwg-node/fetch@^0.8.4": version "0.8.4" resolved "https://registry.yarnpkg.com/@whatwg-node/fetch/-/fetch-0.8.4.tgz#ae1c306d1e4f5ba5cf9badf070de259f04c2cda8" integrity sha512-xK0NGWt49P+JmsdfN+8zmHzZoscENrV0KL1SyyncvWkc6vbFmSqGSpvItEBuhj1PAfTGFEUpyiRMCsut2hLy/Q== @@ -4522,11 +4366,11 @@ tslib "^2.3.1" "@whatwg-node/server@^0.7.3": - version "0.7.5" - resolved "https://registry.yarnpkg.com/@whatwg-node/server/-/server-0.7.5.tgz#5945275861b465f080480c324d802b763e6cfa27" - integrity sha512-xTDJdPqr/wULxW3mGXQXD92SRXUm6jwQxqIvyHG17dykRTd21HuCaS2ggBn5lSAM/sYjjrT+OYv3fXbtS4+Mjw== + version "0.7.4" + resolved "https://registry.yarnpkg.com/@whatwg-node/server/-/server-0.7.4.tgz#b8cce364461bbb489302d1d2a2692db96be20646" + integrity sha512-0+c3Y1tmMTIz3+cM8GCOXZuJclHlOZrq2uWb9WVnv1sd98pcFQBW9163nmN7cUTyD84c/yMJmEW3F+Ka6zRZgQ== dependencies: - "@whatwg-node/fetch" "^0.8.3" + "@whatwg-node/fetch" "^0.8.2" tslib "^2.3.1" "@wry/context@^0.7.0": @@ -4573,11 +4417,30 @@ acorn-jsx@^5.0.0, acorn-jsx@^5.3.2: resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== +acorn-node@^1.8.2: + version "1.8.2" + resolved "https://registry.yarnpkg.com/acorn-node/-/acorn-node-1.8.2.tgz#114c95d64539e53dede23de8b9d96df7c7ae2af8" + integrity sha512-8mt+fslDufLYntIoPAaIMUe/lrbrehIiwmR3t2k9LljIzoigEPF27eLk2hy8zSGzmR/ogr7zbRKINMo1u0yh5A== + dependencies: + acorn "^7.0.0" + acorn-walk "^7.0.0" + xtend "^4.0.2" + +acorn-walk@^7.0.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-7.2.0.tgz#0de889a601203909b0fbe07b8938dc21d2e967bc" + integrity sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA== + acorn-walk@^8.0.0, acorn-walk@^8.1.1: version "8.2.0" resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1" integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA== +acorn@^7.0.0: + version "7.4.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" + integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== + acorn@^8.0.0, acorn@^8.0.4, acorn@^8.4.1, acorn@^8.5.0, acorn@^8.8.0: version "8.8.2" resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.2.tgz#1b2f25db02af965399b9776b0c2c391276d37c4a" @@ -4598,7 +4461,7 @@ aggregate-error@^3.0.0: clean-stack "^2.0.0" indent-string "^4.0.0" -ajv-keywords@^3.5.2: +ajv-keywords@^3.4.1: version "3.5.2" resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.5.2.tgz#31f29da5ab6e00d1c2d329acf7b5929614d5014d" integrity sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ== @@ -4613,7 +4476,7 @@ ajv@8.11.0: require-from-string "^2.0.2" uri-js "^4.2.2" -ajv@^6.10.0, ajv@^6.12.4: +ajv@^6.10.0, ajv@^6.12.2, ajv@^6.12.4: version "6.12.6" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== @@ -4624,13 +4487,13 @@ ajv@^6.10.0, ajv@^6.12.4: uri-js "^4.2.2" algoliasearch-helper@^3.11.3: - version "3.12.0" - resolved "https://registry.yarnpkg.com/algoliasearch-helper/-/algoliasearch-helper-3.12.0.tgz#0fe39d49b0290e4aa5e1fe733bd24d857d258e94" - integrity sha512-/j1U3PEwdan0n6P/QqSnSpNSLC5+cEMvyljd5CnmNmUjDlGrys+vFEOwjVEnqELIiAGMHEA/Nl3CiKVFBUYqyQ== + version "3.11.3" + resolved "https://registry.yarnpkg.com/algoliasearch-helper/-/algoliasearch-helper-3.11.3.tgz#6e7af8afe6f9a9e55186abffb7b6cf7ca8de3301" + integrity sha512-TbaEvLwiuGygHQIB8y+OsJKQQ40+JKUua5B91X66tMUHyyhbNHvqyr0lqd3wCoyKx7WybyQrC0WJvzoIeh24Aw== dependencies: "@algolia/events" "^4.0.1" -algoliasearch@4.15.0: +algoliasearch@4.15.0, algoliasearch@^4.14.3: version "4.15.0" resolved "https://registry.yarnpkg.com/algoliasearch/-/algoliasearch-4.15.0.tgz#8279576f06667a1d0705e8c22a17daa8e707b469" integrity sha512-+vgKQF5944dYsz9zhKk07JbOYeNdKisoD5GeG0woBL3nLzbn2a+nGwki60DXg7CXvaFXBcTXyJG4C+VaBVd44g== @@ -4650,26 +4513,6 @@ algoliasearch@4.15.0: "@algolia/requester-node-http" "4.15.0" "@algolia/transporter" "4.15.0" -algoliasearch@^4.14.3: - version "4.16.0" - resolved "https://registry.yarnpkg.com/algoliasearch/-/algoliasearch-4.16.0.tgz#2807f1aee8a574fa8480f39a09b16e407d4cc1a6" - integrity sha512-HAjKJ6bBblaXqO4dYygF4qx251GuJ6zCZt+qbJ+kU7sOC+yc84pawEjVpJByh+cGP2APFCsao2Giz50cDlKNPA== - dependencies: - "@algolia/cache-browser-local-storage" "4.16.0" - "@algolia/cache-common" "4.16.0" - "@algolia/cache-in-memory" "4.16.0" - "@algolia/client-account" "4.16.0" - "@algolia/client-analytics" "4.16.0" - "@algolia/client-common" "4.16.0" - "@algolia/client-personalization" "4.16.0" - "@algolia/client-search" "4.16.0" - "@algolia/logger-common" "4.16.0" - "@algolia/logger-console" "4.16.0" - "@algolia/requester-browser-xhr" "4.16.0" - "@algolia/requester-common" "4.16.0" - "@algolia/requester-node-http" "4.16.0" - "@algolia/transporter" "4.16.0" - ansi-align@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/ansi-align/-/ansi-align-3.0.1.tgz#0cdf12e111ace773a86e9a1fad1225c43cb19a59" @@ -4704,7 +4547,7 @@ ansi-sequence-parser@^1.1.0: resolved "https://registry.yarnpkg.com/ansi-sequence-parser/-/ansi-sequence-parser-1.1.0.tgz#4d790f31236ac20366b23b3916b789e1bde39aed" integrity sha512-lEm8mt52to2fT8GhciPCGeCXACSz2UwIN4X2e2LJSnZ5uAbn2/dsYdOmUXq0AtWS5cpAupysIneExOgH0Vd2TQ== -ansi-styles@^3.1.0, ansi-styles@^3.2.1: +ansi-styles@^3.1.0: version "3.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== @@ -4780,14 +4623,6 @@ aria-query@^5.1.3: dependencies: deep-equal "^2.0.5" -array-buffer-byte-length@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/array-buffer-byte-length/-/array-buffer-byte-length-1.0.0.tgz#fabe8bc193fea865f317fe7807085ee0dee5aead" - integrity sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A== - dependencies: - call-bind "^1.0.2" - is-array-buffer "^3.0.1" - array-includes@^3.1.5, array-includes@^3.1.6: version "3.1.6" resolved "https://registry.yarnpkg.com/array-includes/-/array-includes-3.1.6.tgz#9e9e720e194f198266ba9e18c29e6a9b0e4b225f" @@ -4902,12 +4737,12 @@ auto-bind@~4.0.0: integrity sha512-Hdw8qdNiqdJ8LqT0iK0sVzkFbzg6fhnQqqfWhBDxcHZvU75+B+ayzTy8x+k5Ix0Y92XOhOUlx74ps+bA6BeYMQ== autoprefixer@^10.4.12: - version "10.4.14" - resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-10.4.14.tgz#e28d49902f8e759dd25b153264e862df2705f79d" - integrity sha512-FQzyfOsTlwVzjHxKEqRIAdJx9niO6VCBCoEwax/VLSoQF29ggECcPuBqUMZ+u8jCZOPSy8b8/8KnuFbp0SaFZQ== + version "10.4.13" + resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-10.4.13.tgz#b5136b59930209a321e9fa3dca2e7c4d223e83a8" + integrity sha512-49vKpMqcZYsJjwotvt4+h/BCjJVnhGwcLpDt5xkcaOG3eLrG/HUYLagrihYsQ+qrIBgIzX1Rw7a6L8I/ZA1Atg== dependencies: - browserslist "^4.21.5" - caniuse-lite "^1.0.30001464" + browserslist "^4.21.4" + caniuse-lite "^1.0.30001426" fraction.js "^4.2.0" normalize-range "^0.1.2" picocolors "^1.0.0" @@ -5220,7 +5055,7 @@ breakword@^1.0.5: dependencies: wcwidth "^1.0.1" -browserslist@^4.0.0, browserslist@^4.21.3, browserslist@^4.21.4, browserslist@^4.21.5: +browserslist@^4.0.0, browserslist@^4.16.6, browserslist@^4.21.3, browserslist@^4.21.4, browserslist@^4.21.5: version "4.21.5" resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.21.5.tgz#75c5dae60063ee641f977e00edd3cfb2fb7af6a7" integrity sha512-tUkiguQGW7S3IhB7N+c2MV/HZPSCPAAiYBZXLsBhFB/PCy6ZKKsZrmBayHV9fdGV/ARIfJ14NkxKzRDjvp7L6w== @@ -5249,6 +5084,11 @@ buffer-crc32@~0.2.3: resolved "https://registry.yarnpkg.com/buffer-crc32/-/buffer-crc32-0.2.13.tgz#0d333e3f00eac50aa1454abd30ef8c2a5d9a7242" integrity sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ== +buffer-equal-constant-time@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz#f8e71132f7ffe6e01a5c9697a4c6f3e48d5cc819" + integrity sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA== + buffer-from@^1.0.0: version "1.1.2" resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" @@ -5363,10 +5203,10 @@ caniuse-api@^3.0.0: lodash.memoize "^4.1.2" lodash.uniq "^4.5.0" -caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001406, caniuse-lite@^1.0.30001449, caniuse-lite@^1.0.30001464: - version "1.0.30001472" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001472.tgz#3f484885f2a2986c019dc416e65d9d62798cdd64" - integrity sha512-xWC/0+hHHQgj3/vrKYY0AAzeIUgr7L9wlELIcAvZdDUHlhL/kNxMdnQLOSOQfP8R51ZzPhmHdyMkI0MMpmxCfg== +caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001406, caniuse-lite@^1.0.30001426, caniuse-lite@^1.0.30001449: + version "1.0.30001452" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001452.tgz#dff7b8bb834b3a91808f0a9ff0453abb1fbba02a" + integrity sha512-Lkp0vFjMkBB3GTpLR8zk4NwW5EdRdnitwYJHDOOKIU85x4ckYCPQ+9WlVvSVClHxVReefkUMtWZH2l9KGlD51w== capital-case@^1.0.4: version "1.0.4" @@ -5394,7 +5234,7 @@ chalk-template@0.4.0: dependencies: chalk "^4.1.2" -chalk@2.3.0: +chalk@2.3.0, chalk@^2.0.0, chalk@^2.1.0: version "2.3.0" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.3.0.tgz#b5ea48efc9c1793dccc9b4767c93914d3f2d52ba" integrity sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q== @@ -5413,15 +5253,6 @@ chalk@5.2.0, chalk@^5.0.1: resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.2.0.tgz#249623b7d66869c673699fb66d65723e54dfcfb3" integrity sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA== -chalk@^2.0.0, chalk@^2.1.0: - version "2.4.2" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" - integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== - dependencies: - ansi-styles "^3.2.1" - escape-string-regexp "^1.0.5" - supports-color "^5.3.0" - chalk@^4.0.0, chalk@^4.1.0, chalk@^4.1.1, chalk@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" @@ -5785,10 +5616,10 @@ compression@1.7.4: safe-buffer "5.1.2" vary "~1.1.2" -compute-scroll-into-view@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/compute-scroll-into-view/-/compute-scroll-into-view-3.0.0.tgz#95d2f2f4653e7edda74dd1e38edaaa897918e0f0" - integrity sha512-Yk1An4qzo5++Cu6peT9PsmRKIU8tALpmdoE09n//AfGQFcPfx21/tMGMsmKYmLJWaBJrGOJ5Jz5hoU+7cZZUWQ== +compute-scroll-into-view@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/compute-scroll-into-view/-/compute-scroll-into-view-2.0.4.tgz#2b444b2b9e4724819d2531efacb7ac094155fdf6" + integrity sha512-y/ZA3BGnxoM/QHHQ2Uy49CLtnWPbt4tTPpEEZiEmmiWBFKjej7nEyH8Ryz54jH0MLXflUYA3Er2zUxPSJu5R+g== concat-map@0.0.1: version "0.0.1" @@ -5820,9 +5651,9 @@ convert-source-map@^1.4.0, convert-source-map@^1.5.0, convert-source-map@^1.6.0, integrity sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A== core-js-compat@^3.25.1: - version "3.29.1" - resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.29.1.tgz#15c0fb812ea27c973c18d425099afa50b934b41b" - integrity sha512-QmchCua884D8wWskMX8tW5ydINzd8oSJVx38lx/pVkFGqztxt73GYre3pm/hyYq8bPf+MW5In4I/uRShFDsbrA== + version "3.28.0" + resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.28.0.tgz#c08456d854608a7264530a2afa281fadf20ecee6" + integrity sha512-myzPgE7QodMg4nnd3K1TDoES/nADRStM8Gpz0D6nhkwbmwEnE0ZGJgoWsvQ722FR8D7xS0n0LV556RcEicjTyg== dependencies: browserslist "^4.21.5" @@ -5908,9 +5739,9 @@ cross-spawn@^7.0.0, cross-spawn@^7.0.2, cross-spawn@^7.0.3: which "^2.0.1" css-declaration-sorter@^6.3.1: - version "6.4.0" - resolved "https://registry.yarnpkg.com/css-declaration-sorter/-/css-declaration-sorter-6.4.0.tgz#630618adc21724484b3e9505bce812def44000ad" - integrity sha512-jDfsatwWMWN0MODAFuHszfjphEXfNw9JUAhmY4pLu3TyTU+ohUpsbVtbU+1MZn4a47D9kqh03i4eyOm+74+zew== + version "6.3.1" + resolved "https://registry.yarnpkg.com/css-declaration-sorter/-/css-declaration-sorter-6.3.1.tgz#be5e1d71b7a992433fb1c542c7a1b835e45682ec" + integrity sha512-fBffmak0bPAnyqc/HO8C3n2sHrp9wcqQz6ES9koRF2/mLOVAx9zIQ3Y7R29sYCteTPqMCwns4WYQoCX91Xl3+w== css-select@^4.1.3: version "4.3.0" @@ -5941,22 +5772,22 @@ cssesc@^3.0.0: resolved "https://registry.yarnpkg.com/cssesc/-/cssesc-3.0.0.tgz#37741919903b868565e1c09ea747445cd18983ee" integrity sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg== -cssnano-preset-default@^5.2.14: - version "5.2.14" - resolved "https://registry.yarnpkg.com/cssnano-preset-default/-/cssnano-preset-default-5.2.14.tgz#309def4f7b7e16d71ab2438052093330d9ab45d8" - integrity sha512-t0SFesj/ZV2OTylqQVOrFgEh5uanxbO6ZAdeCrNsUQ6fVuXwYTxJPNAGvGTxHbD68ldIJNec7PyYZDBrfDQ+6A== +cssnano-preset-default@^5.2.13: + version "5.2.13" + resolved "https://registry.yarnpkg.com/cssnano-preset-default/-/cssnano-preset-default-5.2.13.tgz#e7353b0c57975d1bdd97ac96e68e5c1b8c68e990" + integrity sha512-PX7sQ4Pb+UtOWuz8A1d+Rbi+WimBIxJTRyBdgGp1J75VU0r/HFQeLnMYgHiCAp6AR4rqrc7Y4R+1Rjk3KJz6DQ== dependencies: css-declaration-sorter "^6.3.1" cssnano-utils "^3.1.0" postcss-calc "^8.2.3" - postcss-colormin "^5.3.1" + postcss-colormin "^5.3.0" postcss-convert-values "^5.1.3" postcss-discard-comments "^5.1.2" postcss-discard-duplicates "^5.1.0" postcss-discard-empty "^5.1.1" postcss-discard-overridden "^5.1.0" postcss-merge-longhand "^5.1.7" - postcss-merge-rules "^5.1.4" + postcss-merge-rules "^5.1.3" postcss-minify-font-values "^5.1.0" postcss-minify-gradients "^5.1.1" postcss-minify-params "^5.1.4" @@ -5971,7 +5802,7 @@ cssnano-preset-default@^5.2.14: postcss-normalize-url "^5.1.0" postcss-normalize-whitespace "^5.1.1" postcss-ordered-values "^5.1.3" - postcss-reduce-initial "^5.1.2" + postcss-reduce-initial "^5.1.1" postcss-reduce-transforms "^5.1.0" postcss-svgo "^5.1.0" postcss-unique-selectors "^5.1.1" @@ -5982,11 +5813,11 @@ cssnano-utils@^3.1.0: integrity sha512-JQNR19/YZhz4psLX/rQ9M83e3z2Wf/HdJbryzte4a3NSuafyp9w/I4U+hx5C2S9g41qlstH7DEWnZaaj83OuEA== cssnano@^5.1.13: - version "5.1.15" - resolved "https://registry.yarnpkg.com/cssnano/-/cssnano-5.1.15.tgz#ded66b5480d5127fcb44dac12ea5a983755136bf" - integrity sha512-j+BKgDcLDQA+eDifLx0EO4XSA56b7uut3BQFH+wbSaSTuGLuiyTa/wbRYthUXX8LC9mLg+WWKe8h+qJuwTAbHw== + version "5.1.14" + resolved "https://registry.yarnpkg.com/cssnano/-/cssnano-5.1.14.tgz#07b0af6da73641276fe5a6d45757702ebae2eb05" + integrity sha512-Oou7ihiTocbKqi0J1bB+TRJIQX5RMR3JghA8hcWSw9mjBLQ5Y3RWqEDoYG3sRNlAbCIXpqMoZGbq5KDR3vdzgw== dependencies: - cssnano-preset-default "^5.2.14" + cssnano-preset-default "^5.2.13" lilconfig "^2.0.3" yaml "^1.10.2" @@ -6022,7 +5853,7 @@ csv-stringify@^5.6.5: resolved "https://registry.yarnpkg.com/csv-stringify/-/csv-stringify-5.6.5.tgz#c6d74badda4b49a79bf4e72f91cce1e33b94de00" integrity sha512-PjiQ659aQ+fUTQqSrd1XEDnOr52jh30RBurfzkscaE2tPaFsDH5wOAHJiw8XAHphRknCwMUE9KRayc4K/NbO8A== -csv@^5.5.3: +csv@^5.5.0: version "5.5.3" resolved "https://registry.yarnpkg.com/csv/-/csv-5.5.3.tgz#cd26c1e45eae00ce6a9b7b27dcb94955ec95207d" integrity sha512-QTaY0XjjhTQOdguARF0lGKm5/mEq9PD9/VhZZegHDIBq2tQwgNpHc3dneD4mGo2iJs+fTKv5Bp0fZ+BRuY3Z0g== @@ -6032,54 +5863,6 @@ csv@^5.5.3: csv-stringify "^5.6.5" stream-transform "^2.1.3" -cypress@12.8.1: - version "12.8.1" - resolved "https://registry.yarnpkg.com/cypress/-/cypress-12.8.1.tgz#0c6e67f34554d553138697aaf349b637d80004eb" - integrity sha512-lIFbKdaSYAOarNLHNFa2aPZu6YSF+8UY4VRXMxJrFUnk6RvfG0AWsZ7/qle/aIz30TNUD4aOihz2ZgS4vuQVSA== - dependencies: - "@cypress/request" "^2.88.10" - "@cypress/xvfb" "^1.2.4" - "@types/node" "^14.14.31" - "@types/sinonjs__fake-timers" "8.1.1" - "@types/sizzle" "^2.3.2" - arch "^2.2.0" - blob-util "^2.0.2" - bluebird "^3.7.2" - buffer "^5.6.0" - cachedir "^2.3.0" - chalk "^4.1.0" - check-more-types "^2.24.0" - cli-cursor "^3.1.0" - cli-table3 "~0.6.1" - commander "^5.1.0" - common-tags "^1.8.0" - dayjs "^1.10.4" - debug "^4.3.4" - enquirer "^2.3.6" - eventemitter2 "6.4.7" - execa "4.1.0" - executable "^4.1.1" - extract-zip "2.0.1" - figures "^3.2.0" - fs-extra "^9.1.0" - getos "^3.2.1" - is-ci "^3.0.0" - is-installed-globally "~0.4.0" - lazy-ass "^1.6.0" - listr2 "^3.8.3" - lodash "^4.17.21" - log-symbols "^4.0.0" - minimist "^1.2.6" - ospath "^1.2.2" - pretty-bytes "^5.6.0" - proxy-from-env "1.0.0" - request-progress "^3.0.0" - semver "^7.3.2" - supports-color "^8.1.1" - tmp "~0.2.1" - untildify "^4.0.0" - yauzl "^2.10.0" - cypress@12.9.0: version "12.9.0" resolved "https://registry.yarnpkg.com/cypress/-/cypress-12.9.0.tgz#e6ab43cf329fd7c821ef7645517649d72ccf0a12" @@ -6151,9 +5934,9 @@ cytoscape@^3.23.0: lodash "^4.17.21" "d3-array@2 - 3", "d3-array@2.10.0 - 3", "d3-array@2.5.0 - 3", d3-array@3, d3-array@^3.2.0: - version "3.2.3" - resolved "https://registry.yarnpkg.com/d3-array/-/d3-array-3.2.3.tgz#39f1f4954e4a09ff69ac597c2d61906b04e84740" - integrity sha512-JRHwbQQ84XuAESWhvIPaUV4/1UYTBOLiOPGWqgFDHZS1D5QN9c57FbH3QpEnQMYiOXNzKUQyGTZf+EVO7RT5TQ== + version "3.2.2" + resolved "https://registry.yarnpkg.com/d3-array/-/d3-array-3.2.2.tgz#f8ac4705c5b06914a7e0025bbf8d5f1513f6a86e" + integrity sha512-yEEyEAbDrF8C6Ob2myOBLjwBLck1Z89jMGFee0oPsn95GqjerpaOA4ch+vc2l0FNFFwMD5N7OCSEN5eAlsUbgQ== dependencies: internmap "1 - 2" @@ -6193,9 +5976,9 @@ d3-contour@4: d3-array "^3.2.0" d3-delaunay@6: - version "6.0.3" - resolved "https://registry.yarnpkg.com/d3-delaunay/-/d3-delaunay-6.0.3.tgz#d0824ba2012a5f6cd17d035653d0515d1c098257" - integrity sha512-1gPbiMuikAgU/rFcT6WMu17zx0aelw9Hh80go7/TwZQ+/uq8DqqmiNYy+EqPEvTSp/BkJFIpQxjac4Gk/w0zOg== + version "6.0.2" + resolved "https://registry.yarnpkg.com/d3-delaunay/-/d3-delaunay-6.0.2.tgz#7fd3717ad0eade2fc9939f4260acfb503f984e92" + integrity sha512-IMLNldruDQScrcfT+MWnazhHbDJhcRJyOEBAJfwQnHle1RPh6WDuLvxNArUju2VSMSUuKlY5BGHRJ2cYyoFLQQ== dependencies: delaunator "5" @@ -6359,9 +6142,9 @@ d3-zoom@3: d3-transition "2 - 3" d3@^7.4.0, d3@^7.8.2: - version "7.8.3" - resolved "https://registry.yarnpkg.com/d3/-/d3-7.8.3.tgz#b6c862d16368e15bf764c89e248a300a56f2ab40" - integrity sha512-cAa866AkPXtt4IzRx6nzGf50uerq6VYks7p/tTH94be4QfhUkyTfJfaxXGPOB5ZRVUZmUV1wcM1dism/Ua0lCw== + version "7.8.2" + resolved "https://registry.yarnpkg.com/d3/-/d3-7.8.2.tgz#2bdb3c178d095ae03b107a18837ae049838e372d" + integrity sha512-WXty7qOGSHb7HR7CfOzwN1Gw04MUOzN8qh9ZUsvwycIMb4DYMpY9xczZ6jUorGtO6bR9BPMPaueIKwiDxu9uiQ== dependencies: d3-array "3" d3-axis "3" @@ -6414,7 +6197,7 @@ dashdash@^1.12.0: dependencies: assert-plus "^1.0.0" -dataloader@2.2.2, dataloader@^2.2.2: +dataloader@2.2.2: version "2.2.2" resolved "https://registry.yarnpkg.com/dataloader/-/dataloader-2.2.2.tgz#216dc509b5abe39d43a9b9d97e6e5e473dfbe3e0" integrity sha512-8YnDaaf7N3k/q5HnTJVuzSyLETjoZjVmHc4AeKAzOvKHEFQKcn64OKBfzHYtE9zGjctNM7V9I0MfnUVLpi7M5g== @@ -6524,9 +6307,9 @@ deep-is@^0.1.3, deep-is@~0.1.3: integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== deepmerge@^4.0.0, deepmerge@^4.2.2: - version "4.3.1" - resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.3.1.tgz#44b5f2147cd3b00d4b56137685966f26fd25dd4a" - integrity sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A== + version "4.3.0" + resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.3.0.tgz#65491893ec47756d44719ae520e0e2609233b59b" + integrity sha512-z2wJZXrmeHdvYJp/Ux55wIjqo81G5Bp4c+oELTW+7ar6SogWHajt5a9gO3s3IDaGSAXjDk0vlQKN3rms8ab3og== defaults@^1.0.3: version "1.0.4" @@ -6548,6 +6331,11 @@ define-properties@^1.1.3, define-properties@^1.1.4: has-property-descriptors "^1.0.0" object-keys "^1.1.1" +defined@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/defined/-/defined-1.0.1.tgz#c0b9db27bfaffd95d6f61399419b893df0f91ebf" + integrity sha512-hsBd2qSVCRE+5PmNdHt1uzyrFu5d3RwmFDKzyNZMFq/EwDNJF7Ee5+D5oEKF0hU6LhtoUF1macFvOe4AskQC1Q== + delaunator@5: version "5.0.0" resolved "https://registry.yarnpkg.com/delaunator/-/delaunator-5.0.0.tgz#60f052b28bd91c9b4566850ebf7756efe821d81b" @@ -6585,6 +6373,15 @@ detect-newline@^3.0.0: resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" integrity sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA== +detective@^5.2.1: + version "5.2.1" + resolved "https://registry.yarnpkg.com/detective/-/detective-5.2.1.tgz#6af01eeda11015acb0e73f933242b70f24f91034" + integrity sha512-v9XE1zRnz1wRtgurGu0Bs8uHKFSTdteYZNbIPFVhUZ39L/S79ppMpdmVOZAnoz1jfEFodc48n6MX483Xo3t1yw== + dependencies: + acorn-node "^1.8.2" + defined "^1.0.0" + minimist "^1.2.6" + didyoumean@^1.2.2: version "1.2.2" resolved "https://registry.yarnpkg.com/didyoumean/-/didyoumean-1.2.2.tgz#989346ffe9e839b4555ecf5666edea0d3e8ad037" @@ -6720,10 +6517,17 @@ ecc-jsbn@~0.1.1: jsbn "~0.1.0" safer-buffer "^2.1.0" +ecdsa-sig-formatter@1.0.11: + version "1.0.11" + resolved "https://registry.yarnpkg.com/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz#ae0f0fa2d85045ef14a817daa3ce9acd0489e5bf" + integrity sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ== + dependencies: + safe-buffer "^5.0.1" + electron-to-chromium@^1.4.284: - version "1.4.342" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.342.tgz#3c7e199c3aa89c993df4b6f5223d6d26988f58e6" - integrity sha512-dTei3VResi5bINDENswBxhL+N0Mw5YnfWyTqO75KGsVldurEkhC9+CelJVAse8jycWyP8pv3VSj4BSyP8wTWJA== + version "1.4.295" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.295.tgz#911d5df67542bf7554336142eb302c5ec90bba66" + integrity sha512-lEO94zqf1bDA3aepxwnWoHUjA8sZ+2owgcSZjYQy0+uOSEclJX0VieZC+r+wLpSxUHRd6gG32znTWmr+5iGzFw== elkjs@^0.8.2: version "0.8.2" @@ -6785,17 +6589,17 @@ error-ex@^1.3.1: is-arrayish "^0.2.1" es-abstract@^1.19.0, es-abstract@^1.20.4: - version "1.21.2" - resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.21.2.tgz#a56b9695322c8a185dc25975aa3b8ec31d0e7eff" - integrity sha512-y/B5POM2iBnIxCiernH1G7rC9qQoM77lLIMQLuob0zhp8C56Po81+2Nj0WFKnd0pNReDTnkYryc+zhOzpEIROg== + version "1.21.1" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.21.1.tgz#e6105a099967c08377830a0c9cb589d570dd86c6" + integrity sha512-QudMsPOz86xYz/1dG1OuGBKOELjCh99IIWHLzy5znUB6j8xG2yMA7bfTV86VSqKF+Y/H08vQPR+9jyXpuC6hfg== dependencies: - array-buffer-byte-length "^1.0.0" available-typed-arrays "^1.0.5" call-bind "^1.0.2" es-set-tostringtag "^2.0.1" es-to-primitive "^1.2.1" + function-bind "^1.1.1" function.prototype.name "^1.1.5" - get-intrinsic "^1.2.0" + get-intrinsic "^1.1.3" get-symbol-description "^1.0.0" globalthis "^1.0.3" gopd "^1.0.1" @@ -6803,8 +6607,8 @@ es-abstract@^1.19.0, es-abstract@^1.20.4: has-property-descriptors "^1.0.0" has-proto "^1.0.1" has-symbols "^1.0.3" - internal-slot "^1.0.5" - is-array-buffer "^3.0.2" + internal-slot "^1.0.4" + is-array-buffer "^3.0.1" is-callable "^1.2.7" is-negative-zero "^2.0.2" is-regex "^1.1.4" @@ -6812,12 +6616,11 @@ es-abstract@^1.19.0, es-abstract@^1.20.4: is-string "^1.0.7" is-typed-array "^1.1.10" is-weakref "^1.0.2" - object-inspect "^1.12.3" + object-inspect "^1.12.2" object-keys "^1.1.1" object.assign "^4.1.4" regexp.prototype.flags "^1.4.3" safe-regex-test "^1.0.0" - string.prototype.trim "^1.2.7" string.prototype.trimend "^1.0.6" string.prototype.trimstart "^1.0.6" typed-array-length "^1.0.4" @@ -6865,32 +6668,32 @@ es-to-primitive@^1.2.1: is-symbol "^1.0.2" esbuild@^0.17.5, esbuild@^0.17.6, esbuild@~0.17.6: - version "0.17.14" - resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.17.14.tgz#d61a22de751a3133f3c6c7f9c1c3e231e91a3245" - integrity sha512-vOO5XhmVj/1XQR9NQ1UPq6qvMYL7QFJU57J5fKBKBKxp17uDt5PgxFDb4A2nEiXhr1qQs4x0F5+66hVVw4ruNw== + version "0.17.12" + resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.17.12.tgz#2ad7523bf1bc01881e9d904bc04e693bd3bdcf2f" + integrity sha512-bX/zHl7Gn2CpQwcMtRogTTBf9l1nl+H6R8nUbjk+RuKqAE3+8FDulLA+pHvX7aA7Xe07Iwa+CWvy9I8Y2qqPKQ== optionalDependencies: - "@esbuild/android-arm" "0.17.14" - "@esbuild/android-arm64" "0.17.14" - "@esbuild/android-x64" "0.17.14" - "@esbuild/darwin-arm64" "0.17.14" - "@esbuild/darwin-x64" "0.17.14" - "@esbuild/freebsd-arm64" "0.17.14" - "@esbuild/freebsd-x64" "0.17.14" - "@esbuild/linux-arm" "0.17.14" - "@esbuild/linux-arm64" "0.17.14" - "@esbuild/linux-ia32" "0.17.14" - "@esbuild/linux-loong64" "0.17.14" - "@esbuild/linux-mips64el" "0.17.14" - "@esbuild/linux-ppc64" "0.17.14" - "@esbuild/linux-riscv64" "0.17.14" - "@esbuild/linux-s390x" "0.17.14" - "@esbuild/linux-x64" "0.17.14" - "@esbuild/netbsd-x64" "0.17.14" - "@esbuild/openbsd-x64" "0.17.14" - "@esbuild/sunos-x64" "0.17.14" - "@esbuild/win32-arm64" "0.17.14" - "@esbuild/win32-ia32" "0.17.14" - "@esbuild/win32-x64" "0.17.14" + "@esbuild/android-arm" "0.17.12" + "@esbuild/android-arm64" "0.17.12" + "@esbuild/android-x64" "0.17.12" + "@esbuild/darwin-arm64" "0.17.12" + "@esbuild/darwin-x64" "0.17.12" + "@esbuild/freebsd-arm64" "0.17.12" + "@esbuild/freebsd-x64" "0.17.12" + "@esbuild/linux-arm" "0.17.12" + "@esbuild/linux-arm64" "0.17.12" + "@esbuild/linux-ia32" "0.17.12" + "@esbuild/linux-loong64" "0.17.12" + "@esbuild/linux-mips64el" "0.17.12" + "@esbuild/linux-ppc64" "0.17.12" + "@esbuild/linux-riscv64" "0.17.12" + "@esbuild/linux-s390x" "0.17.12" + "@esbuild/linux-x64" "0.17.12" + "@esbuild/netbsd-x64" "0.17.12" + "@esbuild/openbsd-x64" "0.17.12" + "@esbuild/sunos-x64" "0.17.12" + "@esbuild/win32-arm64" "0.17.12" + "@esbuild/win32-ia32" "0.17.12" + "@esbuild/win32-x64" "0.17.12" escalade@^3.1.1: version "3.1.1" @@ -6930,11 +6733,11 @@ escodegen@^1.8.1: source-map "~0.6.1" eslint-config-next@^13.0.0: - version "13.2.4" - resolved "https://registry.yarnpkg.com/eslint-config-next/-/eslint-config-next-13.2.4.tgz#8aa4d42da3a575a814634ba9c88c8d25266c5fdd" - integrity sha512-lunIBhsoeqw6/Lfkd6zPt25w1bn0znLA/JCL+au1HoEpSb4/PpsOYsYtgV/q+YPsoKIOzFyU5xnb04iZnXjUvg== + version "13.1.6" + resolved "https://registry.yarnpkg.com/eslint-config-next/-/eslint-config-next-13.1.6.tgz#ab6894fe5b80080f1e9b9306d1c4b0003230620e" + integrity sha512-0cg7h5wztg/SoLAlxljZ0ZPUQ7i6QKqRiP4M2+MgTZtxWwNKb2JSwNc18nJ6/kXBI6xYvPraTbQSIhAuVw6czw== dependencies: - "@next/eslint-plugin-next" "13.2.4" + "@next/eslint-plugin-next" "13.1.6" "@rushstack/eslint-patch" "^1.1.3" "@typescript-eslint/parser" "^5.42.0" eslint-import-resolver-node "^0.3.6" @@ -6945,9 +6748,9 @@ eslint-config-next@^13.0.0: eslint-plugin-react-hooks "^4.5.0" eslint-config-prettier@^8.6.0: - version "8.8.0" - resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.8.0.tgz#bfda738d412adc917fd7b038857110efe98c9348" - integrity sha512-wLbQiFre3tdGgpDv67NQKnJuTlcUVYHas3k+DZCc2U2BadthoEY4B7hLPvAxaqdyOGCzuLfii2fqGph10va7oA== + version "8.6.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.6.0.tgz#dec1d29ab728f4fa63061774e1672ac4e363d207" + integrity sha512-bAF0eLpLVqP5oEVUFKpMA+NnRFICwn9X8B5jrR9FcqnYBuPbqWEjTEspPWMj5ye6czoSLDweCzSo3Ko7gGrZaA== eslint-import-resolver-node@^0.3.6, eslint-import-resolver-node@^0.3.7: version "0.3.7" @@ -7028,11 +6831,11 @@ eslint-plugin-import@^2.26.0, eslint-plugin-import@^2.27.0: tsconfig-paths "^3.14.1" eslint-plugin-jsonc@^2.6.0: - version "2.7.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-jsonc/-/eslint-plugin-jsonc-2.7.0.tgz#ffce6c670f76aeb74765ac2f0fd97071d791d188" - integrity sha512-DZgC71h/hZ9t5k/OGAKOMdJCleg2neZLL7No+YYi2ZMroCN4X5huZdrLf1USbrc6UTHwYujd1EDwXHg1qJ6CYw== + version "2.6.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-jsonc/-/eslint-plugin-jsonc-2.6.0.tgz#5a439ec15b4930c022bf157264a3d4f4712b982c" + integrity sha512-4bA9YTx58QaWalua1Q1b82zt7eZMB7i+ed8q8cKkbKP75ofOA2SXbtFyCSok7RY6jIXeCqQnKjN9If8zCgv6PA== dependencies: - "@eslint-community/eslint-utils" "^4.2.0" + eslint-utils "^3.0.0" jsonc-eslint-parser "^2.0.4" natural-compare "^1.4.0" @@ -7080,9 +6883,9 @@ eslint-plugin-mdx@^2.0.5: vfile "^5.3.4" eslint-plugin-n@^15.6.1: - version "15.7.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-n/-/eslint-plugin-n-15.7.0.tgz#e29221d8f5174f84d18f2eb94765f2eeea033b90" - integrity sha512-jDex9s7D/Qial8AGVIHq4W7NswpUD5DPDL2RH8Lzd9EloWUuvUkHfv4FRLMipH5q2UtyurorBkPeNi1wVWNh3Q== + version "15.6.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-n/-/eslint-plugin-n-15.6.1.tgz#f7e77f24abb92a550115cf11e29695da122c398c" + integrity sha512-R9xw9OtCRxxaxaszTQmQAlPgM+RdGjaL1akWuY/Fv9fRAi8Wj4CUKc6iYVG8QNRjRuo8/BqVYIpfqberJUEacA== dependencies: builtins "^5.0.1" eslint-plugin-es "^4.1.0" @@ -7201,12 +7004,12 @@ eslint-visitor-keys@^2.0.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303" integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw== -eslint-visitor-keys@^3.0.0, eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.0: - version "3.4.0" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.0.tgz#c7f0f956124ce677047ddbc192a68f999454dedc" - integrity sha512-HPpKPUBQcAsZOsHAFwTtIKcYlCje62XB7SEAcxjtmW6TD1WVpkS6i6/hOVtTZIl4zGj/mBqpFVGvaDneik+VoQ== +eslint-visitor-keys@^3.0.0, eslint-visitor-keys@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz#f6480fa6b1f30efe2d1968aa8ac745b862469826" + integrity sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA== -eslint@8.36.0: +eslint@8.36.0, eslint@^8.21.0: version "8.36.0" resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.36.0.tgz#1bd72202200a5492f91803b113fb8a83b11285cf" integrity sha512-Y956lmS7vDqomxlaaQAHVmeb4tNMp2FWIvU/RnU5BD3IKMD/MJPr76xdyr68P8tV1iNMvN2mRK0yy3c+UjL+bw== @@ -7252,60 +7055,14 @@ eslint@8.36.0: strip-json-comments "^3.1.0" text-table "^0.2.0" -eslint@^8.21.0: - version "8.37.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.37.0.tgz#1f660ef2ce49a0bfdec0b0d698e0b8b627287412" - integrity sha512-NU3Ps9nI05GUoVMxcZx1J8CNR6xOvUT4jAUMH5+z8lpp3aEdPVCImKw6PWG4PY+Vfkpr+jvMpxs/qoE7wq0sPw== - dependencies: - "@eslint-community/eslint-utils" "^4.2.0" - "@eslint-community/regexpp" "^4.4.0" - "@eslint/eslintrc" "^2.0.2" - "@eslint/js" "8.37.0" - "@humanwhocodes/config-array" "^0.11.8" - "@humanwhocodes/module-importer" "^1.0.1" - "@nodelib/fs.walk" "^1.2.8" - ajv "^6.10.0" - chalk "^4.0.0" - cross-spawn "^7.0.2" - debug "^4.3.2" - doctrine "^3.0.0" - escape-string-regexp "^4.0.0" - eslint-scope "^7.1.1" - eslint-visitor-keys "^3.4.0" - espree "^9.5.1" - esquery "^1.4.2" - esutils "^2.0.2" - fast-deep-equal "^3.1.3" - file-entry-cache "^6.0.1" - find-up "^5.0.0" - glob-parent "^6.0.2" - globals "^13.19.0" - grapheme-splitter "^1.0.4" - ignore "^5.2.0" - import-fresh "^3.0.0" - imurmurhash "^0.1.4" - is-glob "^4.0.0" - is-path-inside "^3.0.3" - js-sdsl "^4.1.4" - js-yaml "^4.1.0" - json-stable-stringify-without-jsonify "^1.0.1" - levn "^0.4.1" - lodash.merge "^4.6.2" - minimatch "^3.1.2" - natural-compare "^1.4.0" - optionator "^0.9.1" - strip-ansi "^6.0.1" - strip-json-comments "^3.1.0" - text-table "^0.2.0" - -espree@^9.0.0, espree@^9.4.0, espree@^9.5.0, espree@^9.5.1: - version "9.5.1" - resolved "https://registry.yarnpkg.com/espree/-/espree-9.5.1.tgz#4f26a4d5f18905bf4f2e0bd99002aab807e96dd4" - integrity sha512-5yxtHSZXRSW5pvv3hAlXM5+/Oswi1AUFqBmbibKb5s6bp3rGIDkyXU6xCoyuuLhijr4SFwPrXRoZjz0AZDN9tg== +espree@^9.0.0, espree@^9.4.0, espree@^9.5.0: + version "9.5.0" + resolved "https://registry.yarnpkg.com/espree/-/espree-9.5.0.tgz#3646d4e3f58907464edba852fa047e6a27bdf113" + integrity sha512-JPbJGhKc47++oo4JkEoTe2wjy4fmMwvFpgJT9cQzmfXKp22Dr6Hf1tdCteLz1h0P3t+mGvWZ+4Uankvh8+c6zw== dependencies: acorn "^8.8.0" acorn-jsx "^5.3.2" - eslint-visitor-keys "^3.4.0" + eslint-visitor-keys "^3.3.0" esprima@1.2.2: version "1.2.2" @@ -7318,9 +7075,9 @@ esprima@^4.0.0, esprima@^4.0.1: integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== esquery@^1.4.0, esquery@^1.4.2: - version "1.5.0" - resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.5.0.tgz#6ce17738de8577694edd7361c57182ac8cb0db0b" - integrity sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg== + version "1.4.2" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.4.2.tgz#c6d3fee05dd665808e2ad870631f221f5617b1d1" + integrity sha512-JVSoLdTlTDkmjFmab7H/9SL9qGSyjElT3myyKp7krqjVFQCDLmj1QFaCLRFBszBKI0XVZaiiXvuPIX3ZwHe1Ng== dependencies: estraverse "^5.1.0" @@ -7470,9 +7227,9 @@ execa@^0.8.0: strip-eof "^1.0.0" execa@^7.0.0: - version "7.1.1" - resolved "https://registry.yarnpkg.com/execa/-/execa-7.1.1.tgz#3eb3c83d239488e7b409d48e8813b76bb55c9c43" - integrity sha512-wH0eMf/UXckdUYnO21+HDztteVv05rq2GXksxT4fCGeHkBhw1DROXh40wcjMcRqDOWE7iPJ4n3M7e2+YFP+76Q== + version "7.0.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-7.0.0.tgz#2a44e20e73797f6c2df23889927972386157d7e4" + integrity sha512-tQbH0pH/8LHTnwTrsKWideqi6rFB/QNUawEwrn+WHyz7PX1Tuz2u7wfTvbaNBdP5JD5LVWxNo8/A8CHNZ3bV6g== dependencies: cross-spawn "^7.0.3" get-stream "^6.0.1" @@ -7554,16 +7311,11 @@ extract-zip@2.0.1: optionalDependencies: "@types/yauzl" "^2.9.1" -extsprintf@1.3.0: +extsprintf@1.3.0, extsprintf@^1.2.0: version "1.3.0" resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" integrity sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g== -extsprintf@^1.2.0: - version "1.4.1" - resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.1.tgz#8d172c064867f235c0c84a596806d279bf4bcc07" - integrity sha512-Wrk35e8ydCKDj/ArClo1VrPVmN8zph5V4AtHwIuHhvMXsKf73UT3BOD+azBIW+3wOJ4FhEH7zyaJCFvChjYvMA== - fast-decode-uri-component@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/fast-decode-uri-component/-/fast-decode-uri-component-1.0.1.tgz#46f8b6c22b30ff7a81357d4f59abfae938202543" @@ -7756,9 +7508,9 @@ focus-trap-react@10.1.0: tabbable "^6.1.1" focus-trap@^7.3.1: - version "7.4.0" - resolved "https://registry.yarnpkg.com/focus-trap/-/focus-trap-7.4.0.tgz#20f760a497f593b01d2e446168009c1f12ab0385" - integrity sha512-yI7FwUqU4TVb+7t6PaQ3spT/42r/KLEi8mtdGoQo2li/kFzmu9URmalTvw7xCCJtSOyhBxscvEAmvjeN9iHARg== + version "7.3.1" + resolved "https://registry.yarnpkg.com/focus-trap/-/focus-trap-7.3.1.tgz#417c98e5f1ab94e717d31f1bafa2da45dabcd65f" + integrity sha512-bX/u4FJ+F0Pp6b/8Q9W8Br/JaLJ7rrhOJAzai9JU8bh4BPdOjEATy4pxHcbBBxFjPN4d1oHy7/KqknEdOetm9w== dependencies: tabbable "^6.1.1" @@ -7943,9 +7695,9 @@ get-symbol-description@^1.0.0: get-intrinsic "^1.1.1" get-tsconfig@^4.2.0, get-tsconfig@^4.4.0: - version "4.5.0" - resolved "https://registry.yarnpkg.com/get-tsconfig/-/get-tsconfig-4.5.0.tgz#6d52d1c7b299bd3ee9cd7638561653399ac77b0f" - integrity sha512-MjhiaIWCJ1sAU4pIQ5i5OfOuHHxVo1oYeNsWTON7jxYkod8pHocXeh+SSbmu5OZZZK73B6cbJ2XADzXehLyovQ== + version "4.4.0" + resolved "https://registry.yarnpkg.com/get-tsconfig/-/get-tsconfig-4.4.0.tgz#64eee64596668a81b8fce18403f94f245ee0d4e5" + integrity sha512-0Gdjo/9+FzsYhXCEFueo2aY1z1tpXrxWZzP7k8ul9qt1U5o8rYJwTJYmaeHdrVosYIVYkOy2iwCJ9FdpocJhPQ== getos@^3.2.1: version "3.2.1" @@ -8014,7 +7766,7 @@ glob@7.1.6: once "^1.3.0" path-is-absolute "^1.0.0" -glob@7.1.7: +glob@7.1.7, glob@^7.1.1, glob@^7.1.3, glob@^7.1.4, glob@^7.1.7: version "7.1.7" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.7.tgz#3b193e9233f01d42d0b3f78294bbeeb418f94a90" integrity sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ== @@ -8026,22 +7778,10 @@ glob@7.1.7: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.1.1, glob@^7.1.3, glob@^7.1.4, glob@^7.1.7: - version "7.2.3" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" - integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.1.1" - once "^1.3.0" - path-is-absolute "^1.0.0" - glob@^9.2.0: - version "9.3.2" - resolved "https://registry.yarnpkg.com/glob/-/glob-9.3.2.tgz#8528522e003819e63d11c979b30896e0eaf52eda" - integrity sha512-BTv/JhKXFEHsErMte/AnfiSv8yYOLLiyH2lTg8vn02O21zWFgHPTfxtgn1QRe7NRgggUhC8hacR2Re94svHqeA== + version "9.2.1" + resolved "https://registry.yarnpkg.com/glob/-/glob-9.2.1.tgz#f47e34e1119e7d4f93a546e75851ba1f1e68de50" + integrity sha512-Pxxgq3W0HyA3XUvSXcFhRSs+43Jsx0ddxcFrbjxNGkL2Ak5BAUBxLqI5G6ADDeCHLfzzXFhe0b1yYcctGmytMA== dependencies: fs.realpath "^1.0.0" minimatch "^7.4.1" @@ -8115,9 +7855,9 @@ gopd@^1.0.1: get-intrinsic "^1.1.3" graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.5, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.10, graceful-fs@^4.2.4, graceful-fs@^4.2.9: - version "4.2.11" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" - integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== + version "4.2.10" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c" + integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA== grapheme-splitter@^1.0.4: version "1.0.4" @@ -8181,7 +7921,7 @@ graphql-language-service-utils@^2.7.1: graphql-language-service-types "^1.8.7" nullthrows "^1.0.0" -graphql-request@5.1.0: +graphql-request@5.1.0, graphql-request@^5.0.0: version "5.1.0" resolved "https://registry.yarnpkg.com/graphql-request/-/graphql-request-5.1.0.tgz#dbc8feee27d21b993cd5da2d3af67821827b240a" integrity sha512-0OeRVYigVwIiXhNmqnPDt+JhMzsjinxHE7TVy3Lm6jUzav0guVcL0lfSbi6jVTRAxcbwgyr6yrZioSHxf9gHzw== @@ -8191,16 +7931,6 @@ graphql-request@5.1.0: extract-files "^9.0.0" form-data "^3.0.0" -graphql-request@^5.0.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/graphql-request/-/graphql-request-5.2.0.tgz#a05fb54a517d91bb2d7aefa17ade4523dc5ebdca" - integrity sha512-pLhKIvnMyBERL0dtFI3medKqWOz/RhHdcgbZ+hMMIb32mEPa5MJSzS4AuXxfI4sRAu6JVVk5tvXuGfCWl9JYWQ== - dependencies: - "@graphql-typed-document-node/core" "^3.1.1" - cross-fetch "^3.1.5" - extract-files "^9.0.0" - form-data "^3.0.0" - graphql-subscriptions@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/graphql-subscriptions/-/graphql-subscriptions-2.0.0.tgz#11ec181d475852d8aec879183e8e1eb94f2eb79a" @@ -8215,10 +7945,10 @@ graphql-tag@2.12.6, graphql-tag@^2.11.0, graphql-tag@^2.12.6: dependencies: tslib "^2.1.0" -graphql-ws@5.12.0: - version "5.12.0" - resolved "https://registry.yarnpkg.com/graphql-ws/-/graphql-ws-5.12.0.tgz#d06fe38916334b4a4c827f73268cbf4359a32ed7" - integrity sha512-PA3ImUp8utrpEjoxBMhvxsjkStvFEdU0E1gEBREt8HZIWkxOUymwJBhFnBL7t/iHhUq1GVPeZevPinkZFENxTw== +graphql-ws@5.11.3: + version "5.11.3" + resolved "https://registry.yarnpkg.com/graphql-ws/-/graphql-ws-5.11.3.tgz#eaf8e6baf669d167975cff13ad86abca4ecfe82f" + integrity sha512-fU8zwSgAX2noXAsuFiCZ8BtXeXZOzXyK5u1LloCdacsVth4skdBMPO74EG51lBoWSIZ8beUocdpV8+cQHBODnQ== graphql-yoga@3.7.3: version "3.7.3" @@ -8293,11 +8023,6 @@ has-flag@^2.0.0: resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51" integrity sha512-P+1n3MnwjR/Epg9BBo1KT8qbye2g2Ou4sFumihwt6I4tsUX7jnLcX4BTOSKg/B1ZrIYMN9FcEnG4x5a7NB8Eng== -has-flag@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" - integrity sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw== - has-flag@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" @@ -8344,9 +8069,9 @@ hash-obj@^4.0.0: type-fest "^1.0.2" hast-util-from-parse5@^7.0.0: - version "7.1.2" - resolved "https://registry.yarnpkg.com/hast-util-from-parse5/-/hast-util-from-parse5-7.1.2.tgz#aecfef73e3ceafdfa4550716443e4eb7b02e22b0" - integrity sha512-Nz7FfPBuljzsN3tCQ4kCBKqdNhQE2l0Tn+X1ubgKBPRoiDIu1mL08Cfw4k7q71+Duyaw7DXDN+VTAp4Vh3oCOw== + version "7.1.1" + resolved "https://registry.yarnpkg.com/hast-util-from-parse5/-/hast-util-from-parse5-7.1.1.tgz#1887b4dd4e19f29d9c48c2e1c8bfeaac13a1f3a0" + integrity sha512-R6PoNcUs89ZxLJmMWsVbwSWuz95/9OriyQZ3e2ybwqGsRXzhA6gv49rgGmQvLbZuSNDv9fCg7vV7gXUsvtUFaA== dependencies: "@types/hast" "^2.0.0" "@types/unist" "^2.0.0" @@ -8500,9 +8225,9 @@ human-signals@^2.1.0: integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== human-signals@^4.3.0: - version "4.3.1" - resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-4.3.1.tgz#ab7f811e851fca97ffbd2c1fe9a958964de321b2" - integrity sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ== + version "4.3.0" + resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-4.3.0.tgz#2095c3cd5afae40049403d4b811235b03879db50" + integrity sha512-zyzVyMjpGBX2+6cDVZeFPCdtOtdsxOeseRhB9tkQ6xXmGUNrcnBzdEKPy3VPNYz+4gy1oukVOXcrJCunSyc6QQ== husky@8.0.3: version "8.0.3" @@ -8618,7 +8343,7 @@ inquirer@^8.0.0: through "^2.3.6" wrap-ansi "^7.0.0" -internal-slot@^1.0.3, internal-slot@^1.0.4, internal-slot@^1.0.5: +internal-slot@^1.0.3, internal-slot@^1.0.4: version "1.0.5" resolved "https://registry.yarnpkg.com/internal-slot/-/internal-slot-1.0.5.tgz#f2a2ee21f668f8627a4667f309dc0f4fb6674986" integrity sha512-Y+R5hJrzs52QCG2laLn4udYVnxsfny9CpOhNhUvk/SSSVyF6T27FzRbF0sroPidSu3X8oEAkOn2K804mjpt6UQ== @@ -8686,13 +8411,13 @@ is-arguments@^1.1.1: call-bind "^1.0.2" has-tostringtag "^1.0.0" -is-array-buffer@^3.0.1, is-array-buffer@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/is-array-buffer/-/is-array-buffer-3.0.2.tgz#f2653ced8412081638ecb0ebbd0c41c6e0aecbbe" - integrity sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w== +is-array-buffer@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/is-array-buffer/-/is-array-buffer-3.0.1.tgz#deb1db4fcae48308d54ef2442706c0393997052a" + integrity sha512-ASfLknmY8Xa2XtB4wmbz13Wu202baeA18cJBCeCy0wXUHZF0IPyVEXqKEcd+t2fNSLLL1vC6k7lxZEojNbISXQ== dependencies: call-bind "^1.0.2" - get-intrinsic "^1.2.0" + get-intrinsic "^1.1.3" is-typed-array "^1.1.10" is-arrayish@^0.2.1: @@ -9055,6 +8780,14 @@ isexe@^2.0.0: resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== +isomorphic-fetch@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-3.0.0.tgz#0267b005049046d2421207215d45d6a262b8b8b4" + integrity sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA== + dependencies: + node-fetch "^2.6.1" + whatwg-fetch "^3.4.1" + isomorphic-ws@5.0.0, isomorphic-ws@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/isomorphic-ws/-/isomorphic-ws-5.0.0.tgz#e5529148912ecb9b451b46ed44d53dae1ce04bbf" @@ -9505,20 +9238,15 @@ jest@28.1.3: import-local "^3.0.2" jest-cli "^28.1.3" -jiti@1.17.1: +jiti@1.17.1, jiti@^1.17.1: version "1.17.1" resolved "https://registry.yarnpkg.com/jiti/-/jiti-1.17.1.tgz#264daa43ee89a03e8be28c3d712ccc4eb9f1e8ed" integrity sha512-NZIITw8uZQFuzQimqjUxIrIcEdxYDFIe/0xYfIlVXTkiBjjyBEvgasj5bb0/cHtPRD/NziPbT312sFrkI5ALpw== -jiti@^1.17.1, jiti@^1.17.2: - version "1.18.2" - resolved "https://registry.yarnpkg.com/jiti/-/jiti-1.18.2.tgz#80c3ef3d486ebf2450d9335122b32d121f2a83cd" - integrity sha512-QAdOptna2NYiSSpv0O/BwoHBSmz4YhpzJHyi+fnMRTXFjp7B8i/YG5Z8IfusxB1ufjcD2Sre1F3R+nX3fvy7gg== - joi@^17.7.0: - version "17.9.1" - resolved "https://registry.yarnpkg.com/joi/-/joi-17.9.1.tgz#74899b9fa3646904afa984a11df648eca66c9018" - integrity sha512-FariIi9j6QODKATGBrEX7HZcja8Bsh3rfdGYy/Sb65sGlZWK/QWesU1ghk7aJWDj95knjXlQfSmzFSPPkLVsfw== + version "17.7.1" + resolved "https://registry.yarnpkg.com/joi/-/joi-17.7.1.tgz#854fc85c7fa3cfc47c91124d30bffdbb58e06cec" + integrity sha512-teoLhIvWE298R6AeJywcjR4sX2hHjB3/xJX4qPjg+gTg+c0mzUDsziYlqPmLomq9gVsfaMcgPaGc7VxtD/9StA== dependencies: "@hapi/hoek" "^9.0.0" "@hapi/topo" "^5.0.0" @@ -9526,20 +9254,15 @@ joi@^17.7.0: "@sideway/formula" "^3.0.1" "@sideway/pinpoint" "^2.0.0" -jose@^4.11.4: - version "4.13.1" - resolved "https://registry.yarnpkg.com/jose/-/jose-4.13.1.tgz#449111bb5ab171db85c03f1bd2cb1647ca06db1c" - integrity sha512-MSJQC5vXco5Br38mzaQKiq9mwt7lwj2eXpgpRyQYNHYt2lq1PjkWa7DLXX0WVcQLE9HhMh3jPiufS7fhJf+CLQ== - joycon@^3.0.1: version "3.1.1" resolved "https://registry.yarnpkg.com/joycon/-/joycon-3.1.1.tgz#bce8596d6ae808f8b68168f5fc69280996894f03" integrity sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw== js-sdsl@^4.1.4: - version "4.4.0" - resolved "https://registry.yarnpkg.com/js-sdsl/-/js-sdsl-4.4.0.tgz#8b437dbe642daa95760400b602378ed8ffea8430" - integrity sha512-FfVSdx6pJ41Oa+CF7RDaFmTnCaFhua+SNYQX74riGOpl96x+2jQCqEfQ2bnXu/5DPCqlRuiqyvTJM0Qjz26IVg== + version "4.3.0" + resolved "https://registry.yarnpkg.com/js-sdsl/-/js-sdsl-4.3.0.tgz#aeefe32a451f7af88425b11fdb5f58c90ae1d711" + integrity sha512-mifzlm2+5nZ+lEcLJMoBK0/IH/bDg8XnJfd/Wq6IP+xoCjLZsTOnV2QpxlVbX9bMnkl5PdEjNtBJ9Cj1NjifhQ== "js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: version "4.0.0" @@ -9626,7 +9349,7 @@ json-to-pretty-yaml@^1.2.2: remedial "^1.0.7" remove-trailing-spaces "^1.0.6" -json5@^1.0.1, json5@^1.0.2: +json5@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.2.tgz#63d98d60f21b313b77c4d6da18bfa69d80e1d593" integrity sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA== @@ -9639,9 +9362,9 @@ json5@^2.2.1, json5@^2.2.2: integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== jsonc-eslint-parser@^2.0.4: - version "2.2.0" - resolved "https://registry.yarnpkg.com/jsonc-eslint-parser/-/jsonc-eslint-parser-2.2.0.tgz#01ec9933dc3cc8302abb0c29884bf854c4f627e4" - integrity sha512-x5QjzBOORd+T2EjErIxJnkOEbLVEdD1ILEeBbIJt8Eq/zUn7P7M8qdnWiNVBK5f8oxnJpc6SBHOeeIEl/swPjg== + version "2.1.0" + resolved "https://registry.yarnpkg.com/jsonc-eslint-parser/-/jsonc-eslint-parser-2.1.0.tgz#4c126b530aa583d85308d0b3041ff81ce402bbb2" + integrity sha512-qCRJWlbP2v6HbmKW7R3lFbeiVWHo+oMJ0j+MizwvauqnCV/EvtAeEeuCgoc/ErtsuoKgYB8U4Ih8AxJbXoE6/g== dependencies: acorn "^8.5.0" eslint-visitor-keys "^3.0.0" @@ -9683,6 +9406,16 @@ jsonpath@1.1.1: static-eval "2.0.2" underscore "1.12.1" +jsonwebtoken@^9.0.0: + version "9.0.0" + resolved "https://registry.yarnpkg.com/jsonwebtoken/-/jsonwebtoken-9.0.0.tgz#d0faf9ba1cc3a56255fe49c0961a67e520c1926d" + integrity sha512-tuGfYXxkQGDPnLJ7SibiQgVgeDgfbPq2k2ICcbgqW8WxWLBAxKQM/ZCu/IT8SOSwmaYl4dpTFCW5xZv7YbbWUw== + dependencies: + jws "^3.2.2" + lodash "^4.17.21" + ms "^2.1.1" + semver "^7.3.8" + jsprim@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-2.0.2.tgz#77ca23dbcd4135cd364800d22ff82c2185803d4d" @@ -9701,6 +9434,23 @@ jsprim@^2.0.2: array-includes "^3.1.5" object.assign "^4.1.3" +jwa@^1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/jwa/-/jwa-1.4.1.tgz#743c32985cb9e98655530d53641b66c8645b039a" + integrity sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA== + dependencies: + buffer-equal-constant-time "1.0.1" + ecdsa-sig-formatter "1.0.11" + safe-buffer "^5.0.1" + +jws@^3.2.2: + version "3.2.2" + resolved "https://registry.yarnpkg.com/jws/-/jws-3.2.2.tgz#001099f3639468c9414000e99995fa52fb478304" + integrity sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA== + dependencies: + jwa "^1.4.1" + safe-buffer "^5.0.1" + katex@^0.13.0: version "0.13.24" resolved "https://registry.yarnpkg.com/katex/-/katex-0.13.24.tgz#fe55455eb455698cb24b911a353d16a3c855d905" @@ -9744,7 +9494,7 @@ kleur@^3.0.3: resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w== -kleur@^4.0.3, kleur@^4.1.5: +kleur@^4.0.3, kleur@^4.1.4: version "4.1.5" resolved "https://registry.yarnpkg.com/kleur/-/kleur-4.1.5.tgz#95106101795f7050c6c650f350c683febddb1780" integrity sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ== @@ -9855,9 +9605,9 @@ listr2@^4.0.5: wrap-ansi "^7.0.0" listr2@^5.0.7: - version "5.0.8" - resolved "https://registry.yarnpkg.com/listr2/-/listr2-5.0.8.tgz#a9379ffeb4bd83a68931a65fb223a11510d6ba23" - integrity sha512-mC73LitKHj9w6v30nLNGPetZIlfpUniNSsxxrbaPcWOjDb92SHPzJPi/t+v1YC/lxKz/AJ9egOjww0qUuFxBpA== + version "5.0.7" + resolved "https://registry.yarnpkg.com/listr2/-/listr2-5.0.7.tgz#de69ccc4caf6bea7da03c74f7a2ffecf3904bd53" + integrity sha512-MD+qXHPmtivrHIDRwPYdfNkrzqDiuaKU/rfBcec3WMyMF3xylQj3jMq344OtvQxz7zaCFViRAeqlr2AFhPvXHw== dependencies: cli-truncate "^2.1.0" colorette "^2.0.19" @@ -9868,30 +9618,29 @@ listr2@^5.0.7: through "^2.3.8" wrap-ansi "^7.0.0" -lit-element@^3.3.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/lit-element/-/lit-element-3.3.0.tgz#a8e0b9ca5239faf721d9af4460f106cf7f03533b" - integrity sha512-M3OIoblNS7LZdRxOIk8g0wyLEA/lRw/UGJ1TX+767OpkuDsRdSoxBIvewpWqCo7sMd9xt1XedUNZIr9jUO1X3g== +lit-element@^3.2.0: + version "3.2.2" + resolved "https://registry.yarnpkg.com/lit-element/-/lit-element-3.2.2.tgz#d148ab6bf4c53a33f707a5168e087725499e5f2b" + integrity sha512-6ZgxBR9KNroqKb6+htkyBwD90XGRiqKDHVrW/Eh0EZ+l+iC+u+v+w3/BA5NGi4nizAVHGYvQBHUDuSmLjPp7NQ== dependencies: - "@lit-labs/ssr-dom-shim" "^1.1.0" "@lit/reactive-element" "^1.3.0" - lit-html "^2.7.0" + lit-html "^2.2.0" -lit-html@^2.7.0: - version "2.7.0" - resolved "https://registry.yarnpkg.com/lit-html/-/lit-html-2.7.0.tgz#b244457d0f8c4782a50e83b2c6f3611347ef775d" - integrity sha512-/zPOl8EfeB3HHpTzINSpnWgvgQ8N07g/j272EOAIyB0Ys2RzBqTVT23i+JZuUlNbB2WHHeSsTCFi92NtWrtpqQ== +lit-html@^2.2.0, lit-html@^2.6.0: + version "2.6.1" + resolved "https://registry.yarnpkg.com/lit-html/-/lit-html-2.6.1.tgz#eb29f0b0c2ab54ea77379db11fc011b0c71f1cda" + integrity sha512-Z3iw+E+3KKFn9t2YKNjsXNEu/LRLI98mtH/C6lnFg7kvaqPIzPn124Yd4eT/43lyqrejpc5Wb6BHq3fdv4S8Rw== dependencies: "@types/trusted-types" "^2.0.2" lit@^2.6.1: - version "2.7.0" - resolved "https://registry.yarnpkg.com/lit/-/lit-2.7.0.tgz#94242caa20f7b9e60d49cc0b843e4a694c4af3bb" - integrity sha512-qSy2BAVA+OiWtNptP404egcC/izDdNRw6iHGIbUmkZtbMJvPKfNsaoKrNs8Zmsbjmv5ZX2tur1l9TfzkSWWT4g== + version "2.6.1" + resolved "https://registry.yarnpkg.com/lit/-/lit-2.6.1.tgz#5951a2098b9bde5b328c73b55c15fdc0eefd96d7" + integrity sha512-DT87LD64f8acR7uVp7kZfhLRrHkfC/N4BVzAtnw9Yg8087mbBJ//qedwdwX0kzDbxgPccWRW6mFwGbRQIxy0pw== dependencies: "@lit/reactive-element" "^1.6.0" - lit-element "^3.3.0" - lit-html "^2.7.0" + lit-element "^3.2.0" + lit-html "^2.6.0" load-script@^1.0.0: version "1.0.0" @@ -9899,9 +9648,9 @@ load-script@^1.0.0: integrity sha512-kPEjMFtZvwL9TaZo0uZ2ml+Ye9HUMmPwbYRJ324qF9tqMejwykJ5ggTyvzmrbBeapCAbk98BSbTeovHEEP1uCA== load-tsconfig@^0.2.3: - version "0.2.5" - resolved "https://registry.yarnpkg.com/load-tsconfig/-/load-tsconfig-0.2.5.tgz#453b8cd8961bfb912dea77eb6c168fe8cca3d3a1" - integrity sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg== + version "0.2.3" + resolved "https://registry.yarnpkg.com/load-tsconfig/-/load-tsconfig-0.2.3.tgz#08af3e7744943caab0c75f8af7f1703639c3ef1f" + integrity sha512-iyT2MXws+dc2Wi6o3grCFtGXpeMvHmJqS27sMPGtV2eUu4PeFnG+33I8BlFK1t1NWMjOpcx9bridn5yxLDX2gQ== load-yaml-file@^0.2.0: version "0.2.0" @@ -10053,9 +9802,9 @@ lru-cache@^6.0.0: yallist "^4.0.0" lru-cache@^7.14.1: - version "7.18.3" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-7.18.3.tgz#f793896e0fd0e954a59dfdd82f0773808df6aa89" - integrity sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA== + version "7.16.1" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-7.16.1.tgz#7acea16fecd9ed11430e78443c2bb81a06d3dea9" + integrity sha512-9kkuMZHnLH/8qXARvYSjNvq8S1GYFFzynQTAfKeaJ0sIrR3PUPuu37Z+EiIANiZBvpfTf2B5y8ecDLSMWlLv+w== lru-cache@^8.0.0: version "8.0.4" @@ -10862,7 +10611,7 @@ min-indent@1.0.1, min-indent@^1.0.0: resolved "https://registry.yarnpkg.com/min-indent/-/min-indent-1.0.1.tgz#a63f681673b30571fbe8bc25686ae746eefa9869" integrity sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg== -minimatch@3.1.2, minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: +minimatch@3.1.2, minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== @@ -10891,9 +10640,9 @@ minimatch@^6.1.6: brace-expansion "^2.0.1" minimatch@^7.4.1: - version "7.4.3" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-7.4.3.tgz#012cbf110a65134bb354ae9773b55256cdb045a2" - integrity sha512-5UB4yYusDtkRPbRiy1cqZ1IpGNcJCGlEMG17RKzPddpyiPKoCdwohbED8g4QXT0ewCt8LTkQXuljsUfQ3FKM4A== + version "7.4.2" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-7.4.2.tgz#157e847d79ca671054253b840656720cb733f10f" + integrity sha512-xy4q7wou3vUoC9k1xGTXc+awNdGaGVHtFUaey8tiX4H1QRc04DZ/rmDFwNm2EBsuYEhAZ6SgMmYf3InGY6OauA== dependencies: brace-expansion "^2.0.1" @@ -10912,14 +10661,14 @@ minimist@^1.2.0, minimist@^1.2.6, minimist@^1.2.7, minimist@^1.2.8: integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== minipass@^4.0.2, minipass@^4.2.4: - version "4.2.5" - resolved "https://registry.yarnpkg.com/minipass/-/minipass-4.2.5.tgz#9e0e5256f1e3513f8c34691dd68549e85b2c8ceb" - integrity sha512-+yQl7SX3bIT83Lhb4BVorMAHVuqsskxRdlmO9kTpyukp8vsm2Sn/fUOV9xlnG8/a5JsypJzap21lz/y3FBMJ8Q== + version "4.2.4" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-4.2.4.tgz#7d0d97434b6a19f59c5c3221698b48bbf3b2cd06" + integrity sha512-lwycX3cBMTvcejsHITUgYj6Gy6A7Nh4Q6h9NP4sTHY1ccJlC7yKzDmiShEHsJ16Jf1nKGDEaiHxiltsJEvk0nQ== mixme@^0.5.1: - version "0.5.9" - resolved "https://registry.yarnpkg.com/mixme/-/mixme-0.5.9.tgz#a5a58e17354632179ff3ce5b0fc130899c8ba81c" - integrity sha512-VC5fg6ySUscaWUpI4gxCBTQMH2RdUpNrk+MsbpCYtIvf9SBJdiUey4qE7BXviJsJR4nDQxCZ+3yaYNW3guz/Pw== + version "0.5.5" + resolved "https://registry.yarnpkg.com/mixme/-/mixme-0.5.5.tgz#bf8f67d8caf10fdb49fd23198fd1fa6d8e406627" + integrity sha512-/6IupbRx32s7jjEwHcycXikJwFD5UujbVNuJFkeKLYje+92OvtuPniF6JhnFm5JCTDUhS+kYK3W/4BWYQYXz7w== mkdirp@^1.0.4: version "1.0.4" @@ -10951,16 +10700,11 @@ ms@2.0.0: resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" integrity sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A== -ms@2.1.2: +ms@2.1.2, ms@^2.1.1: version "2.1.2" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -ms@^2.1.1: - version "2.1.3" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" - integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== - muggle-string@^0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/muggle-string/-/muggle-string-0.2.2.tgz#786aa53fea1652c61c6a59e1f839292b262bc72a" @@ -10986,9 +10730,9 @@ mz@^2.7.0: thenify-all "^1.0.0" nanoid@^3.3.4: - version "3.3.6" - resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.6.tgz#443380c856d6e9f9824267d960b4236ad583ea4c" - integrity sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA== + version "3.3.4" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.4.tgz#730b67e3cd09e2deacf03c027c81c9d9dbc5e8ab" + integrity sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw== natural-compare-lite@^1.4.0: version "1.4.0" @@ -11040,7 +10784,7 @@ next-videos@1.5.0: dependencies: file-loader "^4.2.0" -next@13.2.3: +next@13.2.3, next@^13.0.0: version "13.2.3" resolved "https://registry.yarnpkg.com/next/-/next-13.2.3.tgz#92d170e7aca421321f230ff80c35c4751035f42e" integrity sha512-nKFJC6upCPN7DWRx4+0S/1PIOT7vNlCT157w9AzbXEgKy6zkiPKEt5YyRUsRZkmpEqBVrGgOqNfwecTociyg+w== @@ -11065,31 +10809,6 @@ next@13.2.3: "@next/swc-win32-ia32-msvc" "13.2.3" "@next/swc-win32-x64-msvc" "13.2.3" -next@^13.0.0: - version "13.2.4" - resolved "https://registry.yarnpkg.com/next/-/next-13.2.4.tgz#2363330392b0f7da02ab41301f60857ffa7f67d6" - integrity sha512-g1I30317cThkEpvzfXujf0O4wtaQHtDCLhlivwlTJ885Ld+eOgcz7r3TGQzeU+cSRoNHtD8tsJgzxVdYojFssw== - dependencies: - "@next/env" "13.2.4" - "@swc/helpers" "0.4.14" - caniuse-lite "^1.0.30001406" - postcss "8.4.14" - styled-jsx "5.1.1" - optionalDependencies: - "@next/swc-android-arm-eabi" "13.2.4" - "@next/swc-android-arm64" "13.2.4" - "@next/swc-darwin-arm64" "13.2.4" - "@next/swc-darwin-x64" "13.2.4" - "@next/swc-freebsd-x64" "13.2.4" - "@next/swc-linux-arm-gnueabihf" "13.2.4" - "@next/swc-linux-arm64-gnu" "13.2.4" - "@next/swc-linux-arm64-musl" "13.2.4" - "@next/swc-linux-x64-gnu" "13.2.4" - "@next/swc-linux-x64-musl" "13.2.4" - "@next/swc-win32-arm64-msvc" "13.2.4" - "@next/swc-win32-ia32-msvc" "13.2.4" - "@next/swc-win32-x64-msvc" "13.2.4" - nextra-theme-docs@2.2.18: version "2.2.18" resolved "https://registry.yarnpkg.com/nextra-theme-docs/-/nextra-theme-docs-2.2.18.tgz#492d01d6fd9f387a5c065389437264003eb81502" @@ -11162,20 +10881,13 @@ node-addon-api@^3.2.1: resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-3.2.1.tgz#81325e0a2117789c0128dab65e7e38f07ceba161" integrity sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A== -node-fetch@2.6.7: +node-fetch@2.6.7, node-fetch@^2.5.0, node-fetch@^2.6.1: version "2.6.7" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad" integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ== dependencies: whatwg-url "^5.0.0" -node-fetch@^2.5.0, node-fetch@^2.6.1: - version "2.6.9" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.9.tgz#7c7f744b5cc6eb5fd404e0c7a9fec630a55657e6" - integrity sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg== - dependencies: - whatwg-url "^5.0.0" - node-gyp-build@^4.3.0: version "4.6.0" resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.6.0.tgz#0c52e4cbf54bbd28b709820ef7b6a3c2d6209055" @@ -11271,7 +10983,7 @@ object-hash@^3.0.0: resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-3.0.0.tgz#73f97f753e7baffc0e2cc9d6e079079744ac82e9" integrity sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw== -object-inspect@^1.12.3, object-inspect@^1.9.0: +object-inspect@^1.12.2, object-inspect@^1.12.3, object-inspect@^1.9.0: version "1.12.3" resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.12.3.tgz#ba62dffd67ee256c8c086dfae69e016cd1f198b9" integrity sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g== @@ -11369,9 +11081,9 @@ open@^7.4.2: is-wsl "^2.1.1" open@^8.4.0: - version "8.4.2" - resolved "https://registry.yarnpkg.com/open/-/open-8.4.2.tgz#5b5ffe2a8f793dcd2aad73e550cb87b59cb084f9" - integrity sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ== + version "8.4.1" + resolved "https://registry.yarnpkg.com/open/-/open-8.4.1.tgz#2ab3754c07f5d1f99a7a8d6a82737c95e3101cff" + integrity sha512-/4b7qZNhv6Uhd7jjnREh1NjnPxlTq+XNWPG88Ydkj5AILcA5m3ajvcg57pB24EQjKv0dK62XnDqk9c/hkIG5Kg== dependencies: define-lazy-prop "^2.0.0" is-docker "^2.1.1" @@ -11674,9 +11386,9 @@ path-root@^0.1.1: path-root-regex "^0.1.0" path-scurry@^1.6.1: - version "1.6.3" - resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-1.6.3.tgz#4eba7183d64ef88b63c7d330bddc3ba279dc6c40" - integrity sha512-RAmB+n30SlN+HnNx6EbcpoDy9nwdpcGPnEKrJnu6GZoDWBdIjo1UQMVtW2ybtC7LC2oKLcMq8y5g8WnKLiod9g== + version "1.6.1" + resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-1.6.1.tgz#dab45f7bb1d3f45a0e271ab258999f4ab7e23132" + integrity sha512-OW+5s+7cw6253Q4E+8qQ/u1fVvcJQCJo/VFD8pje+dbJCF1n5ZRMV2AEHbGp+5Q7jxQIYJxkHopnj6nzdGeZLA== dependencies: lru-cache "^7.14.1" minipass "^4.0.2" @@ -11767,12 +11479,12 @@ postcss-calc@^8.2.3: postcss-selector-parser "^6.0.9" postcss-value-parser "^4.2.0" -postcss-colormin@^5.3.1: - version "5.3.1" - resolved "https://registry.yarnpkg.com/postcss-colormin/-/postcss-colormin-5.3.1.tgz#86c27c26ed6ba00d96c79e08f3ffb418d1d1988f" - integrity sha512-UsWQG0AqTFQmpBegeLLc1+c3jIqBNB0zlDGRWR+dQ3pRKJL1oeMzyqmH3o2PIfn9MBdNrVPWhDbT769LxCTLJQ== +postcss-colormin@^5.3.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/postcss-colormin/-/postcss-colormin-5.3.0.tgz#3cee9e5ca62b2c27e84fce63affc0cfb5901956a" + integrity sha512-WdDO4gOFG2Z8n4P8TWBpshnL3JpmNmJwdnfP2gbk2qBA8PWwOYcmjmI/t3CmMeL72a7Hkd+x/Mg9O2/0rD54Pg== dependencies: - browserslist "^4.21.4" + browserslist "^4.16.6" caniuse-api "^3.0.0" colord "^2.9.1" postcss-value-parser "^4.2.0" @@ -11846,10 +11558,10 @@ postcss-merge-longhand@^5.1.7: postcss-value-parser "^4.2.0" stylehacks "^5.1.1" -postcss-merge-rules@^5.1.4: - version "5.1.4" - resolved "https://registry.yarnpkg.com/postcss-merge-rules/-/postcss-merge-rules-5.1.4.tgz#2f26fa5cacb75b1402e213789f6766ae5e40313c" - integrity sha512-0R2IuYpgU93y9lhVbO/OylTtKMVcHb67zjWIfCiKR9rWL3GUk1677LAqD/BcHizukdZEjT8Ru3oHRoAYoJy44g== +postcss-merge-rules@^5.1.3: + version "5.1.3" + resolved "https://registry.yarnpkg.com/postcss-merge-rules/-/postcss-merge-rules-5.1.3.tgz#8f97679e67cc8d08677a6519afca41edf2220894" + integrity sha512-LbLd7uFC00vpOuMvyZop8+vvhnfRGpp2S+IMQKeuOZZapPRY4SMq5ErjQeHbHsjCUgJkRNrlU+LmxsKIqPKQlA== dependencies: browserslist "^4.21.4" caniuse-api "^3.0.0" @@ -11966,10 +11678,10 @@ postcss-ordered-values@^5.1.3: cssnano-utils "^3.1.0" postcss-value-parser "^4.2.0" -postcss-reduce-initial@^5.1.2: - version "5.1.2" - resolved "https://registry.yarnpkg.com/postcss-reduce-initial/-/postcss-reduce-initial-5.1.2.tgz#798cd77b3e033eae7105c18c9d371d989e1382d6" - integrity sha512-dE/y2XRaqAi6OvjzD22pjTUQ8eOfc6m/natGHgKFBK9DxFmIm69YmaRVQrGgFlEfc1HePIurY0TmDeROK05rIg== +postcss-reduce-initial@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/postcss-reduce-initial/-/postcss-reduce-initial-5.1.1.tgz#c18b7dfb88aee24b1f8e4936541c29adbd35224e" + integrity sha512-//jeDqWcHPuXGZLoolFrUXBDyuEGbr9S2rMo19bkTIjBQ4PqkaO+oI8wua5BOUxpfi97i3PCoInsiFIEBfkm9w== dependencies: browserslist "^4.21.4" caniuse-api "^3.0.0" @@ -12028,9 +11740,9 @@ postcss@^8.0.9, postcss@^8.1.10, postcss@^8.4.16, postcss@^8.4.21: source-map-js "^1.0.2" preact@^10.0.0: - version "10.13.2" - resolved "https://registry.yarnpkg.com/preact/-/preact-10.13.2.tgz#2c40c73d57248b57234c4ae6cd9ab9d8186ebc0a" - integrity sha512-q44QFLhOhty2Bd0Y46fnYW0gD/cbVM9dUVtNTDKPcdXSMA7jfY+Jpd6rk3GB0lcQss0z5s/6CmVP0Z/hV+g6pw== + version "10.12.1" + resolved "https://registry.yarnpkg.com/preact/-/preact-10.12.1.tgz#8f9cb5442f560e532729b7d23d42fd1161354a21" + integrity sha512-l8386ixSsBdbreOAkqtrwqHwdvR35ID8c3rKPa8lCWuO86dBi32QWHV4vfsZK1utLLFMvw+Z5Ad4XLkZzchscg== preferred-pm@^3.0.0: version "3.0.3" @@ -12237,9 +11949,9 @@ react-dom@18.2.0, react-dom@^18.2.0: scheduler "^0.23.0" react-fast-compare@^3.0.0, react-fast-compare@^3.0.1: - version "3.2.1" - resolved "https://registry.yarnpkg.com/react-fast-compare/-/react-fast-compare-3.2.1.tgz#53933d9e14f364281d6cba24bfed7a4afb808b5f" - integrity sha512-xTYf9zFim2pEif/Fw16dBiXpe0hoy5PxcD8+OwBnTtNLfIm3g6WxhKNurY+6OmdH1u6Ta/W/Vl6vjbYP1MFnDg== + version "3.2.0" + resolved "https://registry.yarnpkg.com/react-fast-compare/-/react-fast-compare-3.2.0.tgz#641a9da81b6a6320f270e89724fb45a0b39e43bb" + integrity sha512-rtGImPZ0YyLrscKI9xTpV8psd6I8VAtjKCzQDlzyDvqJA8XOW78TXYQwNRNd8g8JZnDu8q9Fu/1v4HPAVwVdHA== react-instantsearch-core@6.39.0: version "6.39.0" @@ -12391,9 +12103,9 @@ read-yaml-file@^1.1.0: strip-bom "^3.0.0" readable-stream@^3.4.0: - version "3.6.2" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967" - integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA== + version "3.6.0" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" + integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== dependencies: inherits "^2.0.3" string_decoder "^1.1.1" @@ -12457,15 +12169,15 @@ regexp.prototype.flags@^1.4.3: define-properties "^1.1.3" functions-have-names "^1.2.2" -regexpp@^3.0.0: +regexpp@^3.0.0, regexpp@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.2.0.tgz#0425a2768d8f23bad70ca4b90461fa2f1213e1b2" integrity sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg== -regexpu-core@^5.3.1: - version "5.3.2" - resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-5.3.2.tgz#11a2b06884f3527aec3e93dbbf4a3b958a95546b" - integrity sha512-RAM5FlZz+Lhmo7db9L298p2vHP5ZywrVXmVXpmAD9GuL5MPH6t9ROw1iA/wfHkQ76Qe7AaPF0nGuim96/IrQMQ== +regexpu-core@^5.2.1: + version "5.3.0" + resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-5.3.0.tgz#4d0d044b76fedbad6238703ae84bfdedee2cf074" + integrity sha512-ZdhUQlng0RoscyW7jADnUZ25F5eVtHdMyXSb2PiwafvteRAOJUjFoUPEYZSIfP99fBIs3maLIRfpEddT78wAAQ== dependencies: "@babel/regjsgen" "^0.8.0" regenerate "^1.4.2" @@ -12774,9 +12486,9 @@ rollup@^2.75.6: fsevents "~2.3.2" rollup@^3.18.0, rollup@^3.2.5: - version "3.20.2" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-3.20.2.tgz#f798c600317f216de2e4ad9f4d9ab30a89b690ff" - integrity sha512-3zwkBQl7Ai7MFYQE0y1MeQ15+9jsi7XxfrqwTb/9EK8D9C9+//EBR4M+CuA1KODRaNbFez/lWxA5vhEGZp4MUg== + version "3.20.0" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-3.20.0.tgz#ce7bd88449a776b9f75bf4e35959e25fbd3f51b1" + integrity sha512-YsIfrk80NqUDrxrjWPXUa7PWvAfegZEXHuPsEZg58fGCdjL1I9C1i/NaG+L+27kxxwkrG/QEDEQc8s/ynXWWGQ== optionalDependencies: fsevents "~2.3.2" @@ -12811,16 +12523,11 @@ sade@^1.7.3: dependencies: mri "^1.1.0" -safe-buffer@5.1.2: +safe-buffer@5.1.2, safe-buffer@^5.0.1, safe-buffer@^5.1.2, safe-buffer@~5.1.0: version "5.1.2" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== -safe-buffer@^5.0.1, safe-buffer@^5.1.2, safe-buffer@~5.2.0: - version "5.2.1" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" - integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== - safe-regex-test@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/safe-regex-test/-/safe-regex-test-1.0.0.tgz#793b874d524eb3640d1873aad03596db2d4f2295" @@ -12838,9 +12545,9 @@ safe-regex@^2.1.1: regexp-tree "~0.1.1" safe-stable-stringify@^2.2.0: - version "2.4.3" - resolved "https://registry.yarnpkg.com/safe-stable-stringify/-/safe-stable-stringify-2.4.3.tgz#138c84b6f6edb3db5f8ef3ef7115b8f55ccbf886" - integrity sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g== + version "2.4.2" + resolved "https://registry.yarnpkg.com/safe-stable-stringify/-/safe-stable-stringify-2.4.2.tgz#ec7b037768098bf65310d1d64370de0dc02353aa" + integrity sha512-gMxvPJYhP0O9n2pvcfYfIuYgbledAOJFcqRThtPRmjscaipiwcwPPKLytpVzMkG2HAN87Qmo2d4PtGiri1dSLA== "safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0", safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: version "2.1.2" @@ -12855,20 +12562,20 @@ scheduler@^0.23.0: loose-envify "^1.1.0" schema-utils@^2.5.0: - version "2.7.1" - resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-2.7.1.tgz#1ca4f32d1b24c590c203b8e7a50bf0ea4cd394d7" - integrity sha512-SHiNtMOUGWBQJwzISiVYKu82GiV4QYGePp3odlY1tuKO7gPtphAT5R/py0fA6xtbgLL/RvtJZnU9b8s0F1q0Xg== + version "2.7.0" + resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-2.7.0.tgz#17151f76d8eae67fbbf77960c33c676ad9f4efc7" + integrity sha512-0ilKFI6QQF5nxDZLFn2dMjvc4hjg/Wkg7rHd3jK6/A4a1Hl9VFdQWvgB1UMGoU94pad1P/8N7fMcEnLnSiju8A== dependencies: - "@types/json-schema" "^7.0.5" - ajv "^6.12.4" - ajv-keywords "^3.5.2" + "@types/json-schema" "^7.0.4" + ajv "^6.12.2" + ajv-keywords "^3.4.1" scroll-into-view-if-needed@^3.0.0: - version "3.0.6" - resolved "https://registry.yarnpkg.com/scroll-into-view-if-needed/-/scroll-into-view-if-needed-3.0.6.tgz#2c803a509c1036bc4a9c009fecc5c145f87e47cf" - integrity sha512-x+CW0kOzlFNOnseF0DBr0AJ5m+TgGmSOdEZwyiZW0gV87XBvxQKw5A8DvFFgabznA68XqLgVX+PwPX8OzsFvRA== + version "3.0.4" + resolved "https://registry.yarnpkg.com/scroll-into-view-if-needed/-/scroll-into-view-if-needed-3.0.4.tgz#4b3101712f0ac8ec982c0a7ab4d071e393241e21" + integrity sha512-s+/F50jwTOUt+u5oEIAzum9MN2lUQNvWBe/zfEsVQcbaERjGkKLq1s+2wCHkahMLC8nMLbzMVKivx9JhunXaZg== dependencies: - compute-scroll-into-view "^3.0.0" + compute-scroll-into-view "^2.0.4" scuid@^1.1.0: version "1.1.0" @@ -13176,9 +12883,9 @@ spawndamnit@^2.0.0: signal-exit "^3.0.2" spdx-correct@^3.0.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.2.0.tgz#4f5ab0668f0059e34f9c00dce331784a12de4e9c" - integrity sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA== + version "3.1.1" + resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.1.1.tgz#dece81ac9c1e6713e5f7d1b6f17d468fa53d89a9" + integrity sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w== dependencies: spdx-expression-parse "^3.0.0" spdx-license-ids "^3.0.0" @@ -13197,9 +12904,9 @@ spdx-expression-parse@^3.0.0: spdx-license-ids "^3.0.0" spdx-license-ids@^3.0.0: - version "3.0.13" - resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.13.tgz#7189a474c46f8d47c7b0da4b987bb45e908bd2d5" - integrity sha512-XkD+zwiqXHikFZm4AX/7JSCXA98U5Db4AFd5XUg/+9UNtnH75+Z9KxtpYiJZx36mUDVOwH83pl7yvCer6ewM3w== + version "3.0.12" + resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.12.tgz#69077835abe2710b65f03969898b6637b505a779" + integrity sha512-rr+VVSXtRhO4OHbXUiAF7xW3Bo9DuuF6C5jH+q/x15j2jniycgKbxU09Hr0WqlSLUs4i4ltHGXqTe7VHclYWyA== split@0.3: version "0.3.3" @@ -13349,15 +13056,6 @@ string.prototype.matchall@^4.0.8: regexp.prototype.flags "^1.4.3" side-channel "^1.0.4" -string.prototype.trim@^1.2.7: - version "1.2.7" - resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.2.7.tgz#a68352740859f6893f14ce3ef1bb3037f7a90533" - integrity sha512-p6TmeT1T3411M8Cgg9wBTMRtY2q9+PNy9EV1i2lIXUN/btt763oIfxwN3RR8VU6wHX8j/1CFy0L+YuThm6bgOg== - dependencies: - call-bind "^1.0.2" - define-properties "^1.1.4" - es-abstract "^1.20.4" - string.prototype.trimend@^1.0.6: version "1.0.6" resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.6.tgz#c4a27fa026d979d79c04f17397f250a462944533" @@ -13377,11 +13075,11 @@ string.prototype.trimstart@^1.0.6: es-abstract "^1.20.4" string_decoder@^1.1.1: - version "1.3.0" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" - integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== + version "1.1.1" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" + integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== dependencies: - safe-buffer "~5.2.0" + safe-buffer "~5.1.0" stringify-entities@^4.0.0: version "4.0.3" @@ -13484,10 +13182,10 @@ stylis@4.1.3, stylis@^4.1.2: resolved "https://registry.yarnpkg.com/stylis/-/stylis-4.1.3.tgz#fd2fbe79f5fed17c55269e16ed8da14c84d069f7" integrity sha512-GP6WDNWf+o403jrEp9c5jibKavrtLW+/qYGhFxFrG8maXhwTBI7gLLhiBb0o7uFccWN+EOS9aMO6cGHWAO07OA== -sucrase@^3.20.3, sucrase@^3.29.0: - version "3.31.0" - resolved "https://registry.yarnpkg.com/sucrase/-/sucrase-3.31.0.tgz#daae4fd458167c5d4ba1cce6aef57b988b417b33" - integrity sha512-6QsHnkqyVEzYcaiHsOKkzOtOgdJcb8i54x6AV2hDwyZcY9ZyykGZVw6L/YN98xC0evwTP6utsWWrKRaa8QlfEQ== +sucrase@^3.20.3: + version "3.29.0" + resolved "https://registry.yarnpkg.com/sucrase/-/sucrase-3.29.0.tgz#3207c5bc1b980fdae1e539df3f8a8a518236da7d" + integrity sha512-bZPAuGA5SdFHuzqIhTAqt9fvNEo9rESqXIG3oiKdF8K4UmkQxC4KlNL3lVyAErXp+mPvUqZ5l13qx6TrDIGf3A== dependencies: commander "^4.0.0" glob "7.1.6" @@ -13503,13 +13201,6 @@ supports-color@^4.0.0: dependencies: has-flag "^2.0.0" -supports-color@^5.3.0: - version "5.5.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" - integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== - dependencies: - has-flag "^3.0.0" - supports-color@^7.0.0, supports-color@^7.1.0: version "7.2.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" @@ -13581,19 +13272,19 @@ tabbable@^6.1.1: integrity sha512-4kl5w+nCB44EVRdO0g/UGoOp3vlwgycUVtkk/7DPyeLZUCuNFFKCFG6/t/DgHLrUPHjrZg6s5tNm+56Q2B0xyg== tailwindcss@^3.1.8: - version "3.3.0" - resolved "https://registry.yarnpkg.com/tailwindcss/-/tailwindcss-3.3.0.tgz#8cab40e5a10a10648118c0859ba8bfbc744a761e" - integrity sha512-hOXlFx+YcklJ8kXiCAfk/FMyr4Pm9ck477G0m/us2344Vuj355IpoEDB5UmGAsSpTBmr+4ZhjzW04JuFXkb/fw== + version "3.2.7" + resolved "https://registry.yarnpkg.com/tailwindcss/-/tailwindcss-3.2.7.tgz#5936dd08c250b05180f0944500c01dce19188c07" + integrity sha512-B6DLqJzc21x7wntlH/GsZwEXTBttVSl1FtCzC8WP4oBc/NKef7kaax5jeihkkCEWc831/5NDJ9gRNDK6NEioQQ== dependencies: arg "^5.0.2" chokidar "^3.5.3" color-name "^1.1.4" + detective "^5.2.1" didyoumean "^1.2.2" dlv "^1.1.3" fast-glob "^3.2.12" glob-parent "^6.0.2" is-glob "^4.0.3" - jiti "^1.17.2" lilconfig "^2.0.6" micromatch "^4.0.5" normalize-path "^3.0.0" @@ -13608,7 +13299,6 @@ tailwindcss@^3.1.8: postcss-value-parser "^4.2.0" quick-lru "^5.1.1" resolve "^1.22.1" - sucrase "^3.29.0" tapable@^2.2.0: version "2.2.1" @@ -13783,9 +13473,9 @@ ts-dedent@^2.2.0: integrity sha512-q5W7tVM71e2xjHZTlgfTDoPF/SmqKG5hddq9SzR49CH2hayqRKJtQ4mtRlSxKaJlR/+9rEM+mnBHf7I2/BQcpQ== ts-essentials@^9.1.2: - version "9.3.1" - resolved "https://registry.yarnpkg.com/ts-essentials/-/ts-essentials-9.3.1.tgz#f2d1e1584ef53c0251012258338421d7cf78a4d0" - integrity sha512-9CChSvQMyVRo29Vb1A2jbs+LKo3d/bAf+ndSaX0T8cEiy/HChVaRN/HY5DqUryZ8hZ6uol9bEgCnGmnDbwBR9Q== + version "9.3.0" + resolved "https://registry.yarnpkg.com/ts-essentials/-/ts-essentials-9.3.0.tgz#7e639c1a76b1805c3c60d6e1b5178da2e70aea02" + integrity sha512-XeiCboEyBG8UqXZtXl59bWEi4ZgOqRsogFDI6WDGIF1LmzbYiAkIwjkXN6zZWWl4re/lsOqMlYfe8KA0XiiEPw== ts-interface-checker@^0.1.9: version "0.1.13" @@ -13838,16 +13528,16 @@ ts-node@10.9.1, ts-node@^10.9.1: yn "3.1.1" tsconfig-paths@^3.14.1: - version "3.14.2" - resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz#6e32f1f79412decd261f92d633a9dc1cfa99f088" - integrity sha512-o/9iXgCYc5L/JxCHPe3Hvh8Q/2xm5Z+p18PESBU6Ff33695QnCHBEjcytY2q19ua7Mbl/DavtBOLq+oG0RCL+g== + version "3.14.1" + resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.14.1.tgz#ba0734599e8ea36c862798e920bcf163277b137a" + integrity sha512-fxDhWnFSLt3VuTwtvJt5fpwxBHg5AdKWMsgcPOOIilyjymcYVZoCQF8fvFRezCNfblEXmi+PcM1eYHeOAgXCOQ== dependencies: "@types/json5" "^0.0.29" - json5 "^1.0.2" + json5 "^1.0.1" minimist "^1.2.6" strip-bom "^3.0.0" -tslib@2.5.0, tslib@^2.0.0, tslib@^2.0.3, tslib@^2.1.0, tslib@^2.3.0, tslib@^2.3.1, tslib@^2.4.0, tslib@^2.5.0, tslib@~2.5.0: +tslib@2.5.0, tslib@^2.0.0, tslib@^2.0.3, tslib@^2.1.0, tslib@^2.3.0, tslib@^2.3.1, tslib@^2.4.0, tslib@^2.4.1, tslib@^2.5.0, tslib@~2.5.0: version "2.5.0" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.5.0.tgz#42bfed86f5787aeb41d031866c8f402429e0fddf" integrity sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg== @@ -13901,17 +13591,17 @@ tsx@3.12.6: fsevents "~2.3.2" tty-table@^4.1.5: - version "4.2.1" - resolved "https://registry.yarnpkg.com/tty-table/-/tty-table-4.2.1.tgz#c06cd76c54542acf4e2b4a0e9a5802984b65cba6" - integrity sha512-xz0uKo+KakCQ+Dxj1D/tKn2FSyreSYWzdkL/BYhgN6oMW808g8QRMuh1atAV9fjTPbWBjfbkKQpI/5rEcnAc7g== + version "4.1.6" + resolved "https://registry.yarnpkg.com/tty-table/-/tty-table-4.1.6.tgz#6bd58338f36c94cce478c3337934d8a65ab40a73" + integrity sha512-kRj5CBzOrakV4VRRY5kUWbNYvo/FpOsz65DzI5op9P+cHov3+IqPbo1JE1ZnQGkHdZgNFDsrEjrfqqy/Ply9fw== dependencies: chalk "^4.1.2" - csv "^5.5.3" - kleur "^4.1.5" + csv "^5.5.0" + kleur "^4.1.4" smartwrap "^2.0.2" - strip-ansi "^6.0.1" + strip-ansi "^6.0.0" wcwidth "^1.0.1" - yargs "^17.7.1" + yargs "^17.1.1" tunnel-agent@^0.6.0: version "0.6.0" @@ -14013,9 +13703,9 @@ typescript@4.9.5, typescript@5.0.2, typescript@^5.0.0, typescript@~4.8.2: integrity sha512-wVORMBGO/FAs/++blGNeAVdbNKtIh1rbBL2EyQ1+J9lClJ93KiiKe8PmFIVdXhHcyv44SL9oglmfeSsndo0jRw== ua-parser-js@^0.7.30: - version "0.7.34" - resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.34.tgz#afb439e2e3e394bdc90080acb661a39c685b67d7" - integrity sha512-cJMeh/eOILyGu0ejgTKB95yKT3zOenSe9UGE3vj6WfiOwgGYnmATUsnDixMFvdU+rNMvWih83hrUP8VwhF9yXQ== + version "0.7.33" + resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.33.tgz#1d04acb4ccef9293df6f70f2c3d22f3030d8b532" + integrity sha512-s8ax/CeZdK9R/56Sui0WM6y9OFREJarMRHqLB2EwkovemBxNQ+Bqu8GAsUnVcXKgphb++ghr/B2BZx4mahujPw== unbox-primitive@^1.0.2: version "1.0.2" @@ -14087,11 +13777,9 @@ unist-util-generated@^2.0.0: integrity sha512-qF72kLmPxAw0oN2fwpWIqbXAVyEqUzDHMsbtPvOudIlUzXYFIeQIuxXQCRCFh22B7cixvU0MG7m3MW8FTq/S+A== unist-util-is@^5.0.0: - version "5.2.1" - resolved "https://registry.yarnpkg.com/unist-util-is/-/unist-util-is-5.2.1.tgz#b74960e145c18dcb6226bc57933597f5486deae9" - integrity sha512-u9njyyfEh43npf1M+yGKDGVPbY/JWEemg5nH05ncKPfi+kBbKBJoTdsogMu33uhytuLlv9y0O7GH7fEdwLdLQw== - dependencies: - "@types/unist" "^2.0.0" + version "5.2.0" + resolved "https://registry.yarnpkg.com/unist-util-is/-/unist-util-is-5.2.0.tgz#37eed0617b76c114fd34d44c201aa96fd928b309" + integrity sha512-Glt17jWwZeyqrFqOK0pF1Ded5U3yzJnFr8CG1GMjCWTp9zDo2p+cmD6pWbZU8AgM5WU3IzRv6+rBwhzsGh6hBQ== unist-util-position-from-estree@^1.0.0, unist-util-position-from-estree@^1.1.0: version "1.1.2" @@ -14239,11 +13927,11 @@ urlpattern-polyfill@^6.0.2: braces "^3.0.2" urql@^3.0.0: - version "3.0.4" - resolved "https://registry.yarnpkg.com/urql/-/urql-3.0.4.tgz#f73dbd2e5b134b7328c14d5b8ab1f93f93db8990" - integrity sha512-okmQKQ9pF4t8O8iCC5gH9acqfFji5lkhW3nLBjx8WKDd2zZG7PXoUpUK19VQEMK87L6VFBOO/XZ52MMKFEI0AA== + version "3.0.3" + resolved "https://registry.yarnpkg.com/urql/-/urql-3.0.3.tgz#275631f487558354e090d9ffc4ea2030bd56c34a" + integrity sha512-aVUAMRLdc5AOk239DxgXt6ZxTl/fEmjr7oyU5OGo8uvpqu42FkeJErzd2qBzhAQ3DyusoZIbqbBLPlnKo/yy2A== dependencies: - "@urql/core" "^3.2.0" + "@urql/core" "^3.0.3" wonka "^6.0.0" use-debounce@9.0.3: @@ -14292,9 +13980,9 @@ v8-compile-cache-lib@^3.0.1: integrity sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg== v8-to-istanbul@^9.0.1: - version "9.1.0" - resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-9.1.0.tgz#1b83ed4e397f58c85c266a570fc2558b5feb9265" - integrity sha512-6z3GW9x8G1gd+JIIgQQQxXuiJtCXeAjp6RaPEPLv62mH3iPHPxV6W3robxtCzNErRo6ZwTmzWhsbNvjyEBKzKA== + version "9.0.1" + resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-9.0.1.tgz#b6f994b0b5d4ef255e17a0d17dc444a9f5132fa4" + integrity sha512-74Y4LqY74kLE6IFyIjPtkSTWzUZmj8tdHT9Ii/26dvQ6K9Dl2NbEfj0XgU2sHCtKgt5VupqhlO/5aWuqS+IY1w== dependencies: "@jridgewell/trace-mapping" "^0.3.12" "@types/istanbul-lib-coverage" "^2.0.1" @@ -14466,12 +14154,12 @@ web-worker@^1.2.0: resolved "https://registry.yarnpkg.com/web-worker/-/web-worker-1.2.0.tgz#5d85a04a7fbc1e7db58f66595d7a3ac7c9c180da" integrity sha512-PgF341avzqyx60neE9DD+XS26MMNMoUQRz9NOZwW32nPQrF6p77f1htcnjBSEV8BGMKZ16choqUG4hyI0Hx7mA== -webcrypto-core@^1.7.7: - version "1.7.7" - resolved "https://registry.yarnpkg.com/webcrypto-core/-/webcrypto-core-1.7.7.tgz#06f24b3498463e570fed64d7cab149e5437b162c" - integrity sha512-7FjigXNsBfopEj+5DV2nhNpfic2vumtjjgPmeDKk45z+MJwXKKfhPB7118Pfzrmh4jqOMST6Ch37iPAHoImg5g== +webcrypto-core@^1.7.4: + version "1.7.6" + resolved "https://registry.yarnpkg.com/webcrypto-core/-/webcrypto-core-1.7.6.tgz#e32c4a12a13de4251f8f9ef336a6cba7cdec9b55" + integrity sha512-TBPiewB4Buw+HI3EQW+Bexm19/W4cP/qZG/02QJCXN+iN+T5sl074vZ3rJcle/ZtDBQSgjkbsQO/1eFcxnSBUA== dependencies: - "@peculiar/asn1-schema" "^2.3.6" + "@peculiar/asn1-schema" "^2.1.6" "@peculiar/json-schema" "^1.1.12" asn1js "^3.0.1" pvtsutils "^1.3.2" @@ -14502,6 +14190,11 @@ webpack-bundle-analyzer@4.7.0: sirv "^1.0.7" ws "^7.3.1" +whatwg-fetch@^3.4.1: + version "3.6.2" + resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.6.2.tgz#dced24f37f2624ed0281725d51d0e2e3fe677f8c" + integrity sha512-bJlen0FcuU/0EMLrdbJ7zOnW6ITZLrZMIarMUVmdKtsGvZna8vxKYaexICWPfZ8qwf9fzNq+UEIZrnSaApt6RA== + whatwg-url@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" @@ -14587,9 +14280,9 @@ widest-line@^4.0.1: string-width "^5.0.1" wonka@^6.0.0, wonka@^6.1.2: - version "6.3.1" - resolved "https://registry.yarnpkg.com/wonka/-/wonka-6.3.1.tgz#315b2a91e134c4032980836e6d97e13d0927634d" - integrity sha512-nJyGPcjuBiaLFn8QAlrHd+QjV9AlPO7snOWAhgx6aX0nQLMV6Wi0nqfrkmsXIH0efngbDOroOz2QyLnZMF16Hw== + version "6.2.3" + resolved "https://registry.yarnpkg.com/wonka/-/wonka-6.2.3.tgz#88f7852a23a3d53bca7411c70d66e9ce8f93a366" + integrity sha512-EFOYiqDeYLXSzGYt2X3aVe9Hq1XJG+Hz/HjTRRT4dZE9q95khHl5+7pzUSXI19dbMO1/2UMrTf7JT7/7JrSQSQ== word-wrap@^1.2.3, word-wrap@~1.2.3: version "1.2.3" @@ -14666,7 +14359,7 @@ write-pkg@^4.0.0: type-fest "^0.4.1" write-json-file "^3.2.0" -ws@8.12.1: +ws@8.12.1, ws@^8.12.0: version "8.12.1" resolved "https://registry.yarnpkg.com/ws/-/ws-8.12.1.tgz#c51e583d79140b5e42e39be48c934131942d4a8f" integrity sha512-1qo+M9Ba+xNhPB+YTWUlK6M17brTut5EXbcBaMRN5pH5dFrXz7lzz1ChFSUq3bOUl8yEvSenhHmYUNJxFzdJew== @@ -14676,16 +14369,16 @@ ws@^7.3.1: resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.9.tgz#54fa7db29f4c7cec68b1ddd3a89de099942bb591" integrity sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q== -ws@^8.12.0: - version "8.13.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.13.0.tgz#9a9fb92f93cf41512a0735c8f4dd09b8a1211cd0" - integrity sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA== - xml@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/xml/-/xml-1.0.1.tgz#78ba72020029c5bc87b8a81a3cfcd74b4a2fc1e5" integrity sha512-huCv9IH9Tcf95zuYCsQraZtWnJvBtLVE0QHMOs8bWyZAFZNDcYjsPq1nEx8jKA9y+Beo9v+7OBPRisQTjinQMw== +xtend@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" + integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== + y18n@^4.0.0: version "4.0.3" resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.3.tgz#b5f259c82cd6e336921efd7bfd8bf560de9eeedf" @@ -14717,9 +14410,9 @@ yaml-ast-parser@^0.0.43: integrity sha512-2PTINUwsRqSd+s8XxKaJWQlUuEMHJQyEuh2edBbW8KNJz0SJPwUSD2zRWqezFEdN7IzAgeuYHFUCF7o8zRdZ0A== yaml-eslint-parser@^1.1.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/yaml-eslint-parser/-/yaml-eslint-parser-1.2.0.tgz#b1a6ce4bd5111596f57a9213ec9c0dd1d0ac7e61" - integrity sha512-OmuvQd5lyIJWfFALc39K5fGqp0aWNc+EtyhVgcQIPZaUKMnTb7An3RMp+QJizJ/x0F4kpgTNe6BL/ctdvoIwIg== + version "1.1.0" + resolved "https://registry.yarnpkg.com/yaml-eslint-parser/-/yaml-eslint-parser-1.1.0.tgz#62703e2f4afbe5a17d3fe297882740bf89504e78" + integrity sha512-b464Q1fYiX1oYx2kE8k4mEp6S9Prk+tfDsY/IPxQ0FCjEuj3AKko5Skf3/yQJeYTTDyjDE+aWIJemnv29HvEWQ== dependencies: eslint-visitor-keys "^3.0.0" lodash "^4.17.21" @@ -14765,7 +14458,7 @@ yargs@^15.1.0, yargs@^15.3.1: y18n "^4.0.0" yargs-parser "^18.1.2" -yargs@^17.0.0, yargs@^17.1.1, yargs@^17.3.1, yargs@^17.5.1, yargs@^17.7.1: +yargs@^17.0.0, yargs@^17.1.1, yargs@^17.3.1, yargs@^17.5.1: version "17.7.1" resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.1.tgz#34a77645201d1a8fc5213ace787c220eabbd0967" integrity sha512-cwiTb08Xuv5fqF4AovYacTFNxk62th7LKJ6BL9IGUpTJrWoU7/7WdQGTP2SjKf1dUNBGzDd28p/Yfs/GI6JrLw== @@ -14809,9 +14502,9 @@ zen-observable@0.8.15: integrity sha512-PQ2PC7R9rslx84ndNBZB/Dkv8V8fZEpk83RLgXtYd0fwUgEjseMn1Dgajh2x6S8QbZAFa9p2qVCEuYZNgve0dQ== zod@^3.17.3, zod@^3.20.2: - version "3.21.4" - resolved "https://registry.yarnpkg.com/zod/-/zod-3.21.4.tgz#10882231d992519f0a10b5dd58a38c9dabbb64db" - integrity sha512-m46AKbrzKVzOzs/DZgVnG5H55N1sv1M8qZU3A8RIKbs3mrACDNeIOeilDymVb2HdmP8uwshOCF4uJ8uM9rCqJw== + version "3.20.6" + resolved "https://registry.yarnpkg.com/zod/-/zod-3.20.6.tgz#2f2f08ff81291d47d99e86140fedb4e0db08361a" + integrity sha512-oyu0m54SGCtzh6EClBVqDDlAYRz4jrVtKwQ7ZnsEmMI9HnzuZFj8QFwAY1M5uniIYACdGvv0PBWPF2kO0aNofA== zwitch@^2.0.0: version "2.0.4" From 0376bf8a4509a9417e4b6d8f96720c7ef19650e8 Mon Sep 17 00:00:00 2001 From: beerose Date: Wed, 29 Mar 2023 19:22:11 +0200 Subject: [PATCH 34/47] Add fragment name to __meta__ in string mode --- .../src/gql/fragment-masking.ts | 2 +- .../react/tanstack-react-query/src/gql/fragment-masking.ts | 2 +- examples/react/tanstack-react-query/src/gql/graphql.ts | 7 +++++-- examples/react/urql/src/gql/fragment-masking.ts | 2 +- examples/react/urql/src/gql/graphql.ts | 7 +++++-- .../typescript-graphql-request/src/gql/fragment-masking.ts | 2 +- .../visitor-plugin-common/src/client-side-base-visitor.ts | 4 ++++ packages/presets/client/src/fragment-masking-plugin.ts | 2 +- 8 files changed, 19 insertions(+), 9 deletions(-) diff --git a/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts b/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts index 27fd34b4266..5629241c751 100644 --- a/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts +++ b/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts @@ -56,7 +56,7 @@ export function isFragmentReady( if (!deferredFields) return true; - const fragName = fragmentNode.match(/fragments+(w+)Fragments+ons+w+/)?.[1]; + const fragName = fragmentNode.__meta__?.fragmentName; const fields = fragName ? deferredFields[fragName] : []; return fields.length > 0 && fields.some(field => data && field in (data as any)); diff --git a/examples/react/tanstack-react-query/src/gql/fragment-masking.ts b/examples/react/tanstack-react-query/src/gql/fragment-masking.ts index 27fd34b4266..5629241c751 100644 --- a/examples/react/tanstack-react-query/src/gql/fragment-masking.ts +++ b/examples/react/tanstack-react-query/src/gql/fragment-masking.ts @@ -56,7 +56,7 @@ export function isFragmentReady( if (!deferredFields) return true; - const fragName = fragmentNode.match(/fragments+(w+)Fragments+ons+w+/)?.[1]; + const fragName = fragmentNode.__meta__?.fragmentName; const fields = fragName ? deferredFields[fragName] : []; return fields.length > 0 && fields.some(field => data && field in (data as any)); diff --git a/examples/react/tanstack-react-query/src/gql/graphql.ts b/examples/react/tanstack-react-query/src/gql/graphql.ts index 15028fe108a..ed57b0866f2 100644 --- a/examples/react/tanstack-react-query/src/gql/graphql.ts +++ b/examples/react/tanstack-react-query/src/gql/graphql.ts @@ -1312,14 +1312,17 @@ export class TypedDocumentString return this.value; } } -export const FilmItemFragmentDoc = new TypedDocumentString(` +export const FilmItemFragmentDoc = new TypedDocumentString( + ` fragment FilmItem on Film { id title releaseDate producers } - `) as unknown as TypedDocumentString; + `, + { fragmentName: 'FilmItem' } +) as unknown as TypedDocumentString; export const AllFilmsWithVariablesQueryDocument = new TypedDocumentString(` query allFilmsWithVariablesQuery($first: Int!) { allFilms(first: $first) { diff --git a/examples/react/urql/src/gql/fragment-masking.ts b/examples/react/urql/src/gql/fragment-masking.ts index 27fd34b4266..5629241c751 100644 --- a/examples/react/urql/src/gql/fragment-masking.ts +++ b/examples/react/urql/src/gql/fragment-masking.ts @@ -56,7 +56,7 @@ export function isFragmentReady( if (!deferredFields) return true; - const fragName = fragmentNode.match(/fragments+(w+)Fragments+ons+w+/)?.[1]; + const fragName = fragmentNode.__meta__?.fragmentName; const fields = fragName ? deferredFields[fragName] : []; return fields.length > 0 && fields.some(field => data && field in (data as any)); diff --git a/examples/react/urql/src/gql/graphql.ts b/examples/react/urql/src/gql/graphql.ts index 07159a3427f..8a320883fd1 100644 --- a/examples/react/urql/src/gql/graphql.ts +++ b/examples/react/urql/src/gql/graphql.ts @@ -1312,14 +1312,17 @@ export class TypedDocumentString return this.value; } } -export const FilmItemFragmentDoc = new TypedDocumentString(` +export const FilmItemFragmentDoc = new TypedDocumentString( + ` fragment FilmItem on Film { id title releaseDate producers } - `) as unknown as TypedDocumentString; + `, + { fragmentName: 'FilmItem' } +) as unknown as TypedDocumentString; export const AllFilmsWithVariablesQuery199Document = new TypedDocumentString(` query allFilmsWithVariablesQuery199($first: Int!) { allFilms(first: $first) { diff --git a/examples/typescript-graphql-request/src/gql/fragment-masking.ts b/examples/typescript-graphql-request/src/gql/fragment-masking.ts index 27fd34b4266..5629241c751 100644 --- a/examples/typescript-graphql-request/src/gql/fragment-masking.ts +++ b/examples/typescript-graphql-request/src/gql/fragment-masking.ts @@ -56,7 +56,7 @@ export function isFragmentReady( if (!deferredFields) return true; - const fragName = fragmentNode.match(/fragments+(w+)Fragments+ons+w+/)?.[1]; + const fragName = fragmentNode.__meta__?.fragmentName; const fields = fragName ? deferredFields[fragName] : []; return fields.length > 0 && fields.some(field => data && field in (data as any)); diff --git a/packages/plugins/other/visitor-plugin-common/src/client-side-base-visitor.ts b/packages/plugins/other/visitor-plugin-common/src/client-side-base-visitor.ts index c943d33996b..1f61f12a933 100644 --- a/packages/plugins/other/visitor-plugin-common/src/client-side-base-visitor.ts +++ b/packages/plugins/other/visitor-plugin-common/src/client-side-base-visitor.ts @@ -426,6 +426,10 @@ export class ClientSideBaseVisitor< } if (this.config.documentMode === DocumentMode.string) { + if (node.kind === Kind.FRAGMENT_DEFINITION) { + return `new TypedDocumentString(\`${doc}\`, ${JSON.stringify({ fragmentName: node.name.value })})`; + } + if (this._onExecutableDocumentNode && node.kind === Kind.OPERATION_DEFINITION) { const meta = this._getGraphQLCodegenMetadata(node, gqlTag([doc]).definitions); diff --git a/packages/presets/client/src/fragment-masking-plugin.ts b/packages/presets/client/src/fragment-masking-plugin.ts index bb1f6d28a09..c989c0cccde 100644 --- a/packages/presets/client/src/fragment-masking-plugin.ts +++ b/packages/presets/client/src/fragment-masking-plugin.ts @@ -84,7 +84,7 @@ export function isFragmentReady( if (!deferredFields) return true; - const fragName = fragmentNode.match(/fragments+(w+)Fragments+ons+w+/)?.[1]; + const fragName = fragmentNode.__meta__?.fragmentName; const fields = fragName ? deferredFields[fragName] : []; return fields.length > 0 && fields.some(field => data && field in (data as any)); From dda4daf8ffdd364cb90e82bb0b93c843e5d43002 Mon Sep 17 00:00:00 2001 From: beerose Date: Wed, 29 Mar 2023 20:31:25 +0200 Subject: [PATCH 35/47] Update test --- packages/presets/client/tests/client-preset.spec.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/presets/client/tests/client-preset.spec.ts b/packages/presets/client/tests/client-preset.spec.ts index a4de9edcb19..b2496350774 100644 --- a/packages/presets/client/tests/client-preset.spec.ts +++ b/packages/presets/client/tests/client-preset.spec.ts @@ -1960,7 +1960,7 @@ export * from "./gql.js";`); fragment Foo on Foo { value } - \`) as unknown as TypedDocumentString; + \`, {"fragmentName":"Foo"}) as unknown as TypedDocumentString; export const FooDocument = new TypedDocumentString(\` query Foo { foo { @@ -2077,7 +2077,7 @@ export * from "./gql.js";`); fragment Foo on Foo { value } - \`) as unknown as TypedDocumentString; + \`, {"fragmentName":"Foo"}) as unknown as TypedDocumentString; export const FooDocument = new TypedDocumentString(\` query Foo { foo { @@ -2193,7 +2193,7 @@ export * from "./gql.js";`); fragment Foo on Foo { value } - \`) as unknown as TypedDocumentString; + \`, {"fragmentName":"Foo"}) as unknown as TypedDocumentString; export const FooDocument = new TypedDocumentString(\` query Foo { foo { From 71cfe278834a4d79dd185ac50da10011c905b206 Mon Sep 17 00:00:00 2001 From: beerose Date: Mon, 3 Apr 2023 17:31:19 +0200 Subject: [PATCH 36/47] Improve isFragmentReady typings --- .../gql/fragment-masking.ts | 8 ++++---- .../gql/fragment-masking.ts | 8 ++++---- .../gql-tag-operations/gql/fragment-masking.ts | 8 ++++---- .../graphql/fragment-masking.ts | 8 ++++---- .../src/gql/fragment-masking.ts | 8 ++++---- .../src/gql/fragment-masking.ts | 8 ++++---- .../src/gql/fragment-masking.ts | 8 ++++---- .../src/gql/fragment-masking.ts | 8 ++++---- .../apollo-client/src/gql/fragment-masking.ts | 8 ++++---- .../http-executor/src/gql/fragment-masking.ts | 8 ++++---- .../react/nextjs-swr/gql/fragment-masking.ts | 8 ++++---- .../src/gql/fragment-masking.ts | 8 ++++---- examples/react/urql/src/gql/fragment-masking.ts | 8 ++++---- .../typescript-esm/src/gql/fragment-masking.ts | 8 ++++---- .../src/gql/fragment-masking.ts | 8 ++++---- .../vite-react-cts/src/gql/fragment-masking.ts | 8 ++++---- .../vite-react-mts/src/gql/fragment-masking.ts | 8 ++++---- .../vite-react-ts/src/gql/fragment-masking.ts | 8 ++++---- .../src/gql/fragment-masking.ts | 8 ++++---- examples/vue/urql/src/gql/fragment-masking.ts | 8 ++++---- examples/vue/villus/src/gql/fragment-masking.ts | 8 ++++---- examples/yoga-tests/src/gql/fragment-masking.ts | 8 ++++---- .../client/src/fragment-masking-plugin.ts | 16 ++++++++-------- .../presets/client/tests/client-preset.spec.ts | 8 ++++---- 24 files changed, 100 insertions(+), 100 deletions(-) diff --git a/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts b/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts index 377bffeeb6c..49f6d4a5da7 100644 --- a/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts +++ b/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts @@ -50,9 +50,9 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - data: Record -): data is FragmentType { - const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + fragment: Partial +): fragment is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; if (!deferredFields) return true; @@ -61,5 +61,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in (data as any)); + return fields.length > 0 && fields.some(field => fragment && field in fragment); } diff --git a/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts b/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts index 377bffeeb6c..49f6d4a5da7 100644 --- a/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts +++ b/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts @@ -50,9 +50,9 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - data: Record -): data is FragmentType { - const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + fragment: Partial +): fragment is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; if (!deferredFields) return true; @@ -61,5 +61,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in (data as any)); + return fields.length > 0 && fields.some(field => fragment && field in fragment); } diff --git a/dev-test/gql-tag-operations/gql/fragment-masking.ts b/dev-test/gql-tag-operations/gql/fragment-masking.ts index 377bffeeb6c..49f6d4a5da7 100644 --- a/dev-test/gql-tag-operations/gql/fragment-masking.ts +++ b/dev-test/gql-tag-operations/gql/fragment-masking.ts @@ -50,9 +50,9 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - data: Record -): data is FragmentType { - const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + fragment: Partial +): fragment is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; if (!deferredFields) return true; @@ -61,5 +61,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in (data as any)); + return fields.length > 0 && fields.some(field => fragment && field in fragment); } diff --git a/dev-test/gql-tag-operations/graphql/fragment-masking.ts b/dev-test/gql-tag-operations/graphql/fragment-masking.ts index 377bffeeb6c..49f6d4a5da7 100644 --- a/dev-test/gql-tag-operations/graphql/fragment-masking.ts +++ b/dev-test/gql-tag-operations/graphql/fragment-masking.ts @@ -50,9 +50,9 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - data: Record -): data is FragmentType { - const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + fragment: Partial +): fragment is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; if (!deferredFields) return true; @@ -61,5 +61,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in (data as any)); + return fields.length > 0 && fields.some(field => fragment && field in fragment); } diff --git a/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts b/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts index 5629241c751..a47ee0591f8 100644 --- a/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts +++ b/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts @@ -50,14 +50,14 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: TypedDocumentString, fragmentNode: TypedDocumentString, - data: Record -): data is FragmentType { - const deferredFields = queryNode.__meta__?.deferredFields as { [fragName: string]: string[] }; + fragment: Partial +): fragment is FragmentType { + const deferredFields = queryNode.__meta__?.deferredFields as Record; if (!deferredFields) return true; const fragName = fragmentNode.__meta__?.fragmentName; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in (data as any)); + return fields.length > 0 && fields.some(field => fragment && field in fragment); } diff --git a/examples/persisted-documents/src/gql/fragment-masking.ts b/examples/persisted-documents/src/gql/fragment-masking.ts index 377bffeeb6c..49f6d4a5da7 100644 --- a/examples/persisted-documents/src/gql/fragment-masking.ts +++ b/examples/persisted-documents/src/gql/fragment-masking.ts @@ -50,9 +50,9 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - data: Record -): data is FragmentType { - const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + fragment: Partial +): fragment is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; if (!deferredFields) return true; @@ -61,5 +61,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in (data as any)); + return fields.length > 0 && fields.some(field => fragment && field in fragment); } diff --git a/examples/react/apollo-client-defer/src/gql/fragment-masking.ts b/examples/react/apollo-client-defer/src/gql/fragment-masking.ts index 377bffeeb6c..49f6d4a5da7 100644 --- a/examples/react/apollo-client-defer/src/gql/fragment-masking.ts +++ b/examples/react/apollo-client-defer/src/gql/fragment-masking.ts @@ -50,9 +50,9 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - data: Record -): data is FragmentType { - const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + fragment: Partial +): fragment is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; if (!deferredFields) return true; @@ -61,5 +61,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in (data as any)); + return fields.length > 0 && fields.some(field => fragment && field in fragment); } diff --git a/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts b/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts index 377bffeeb6c..49f6d4a5da7 100644 --- a/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts +++ b/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts @@ -50,9 +50,9 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - data: Record -): data is FragmentType { - const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + fragment: Partial +): fragment is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; if (!deferredFields) return true; @@ -61,5 +61,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in (data as any)); + return fields.length > 0 && fields.some(field => fragment && field in fragment); } diff --git a/examples/react/apollo-client/src/gql/fragment-masking.ts b/examples/react/apollo-client/src/gql/fragment-masking.ts index 377bffeeb6c..49f6d4a5da7 100644 --- a/examples/react/apollo-client/src/gql/fragment-masking.ts +++ b/examples/react/apollo-client/src/gql/fragment-masking.ts @@ -50,9 +50,9 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - data: Record -): data is FragmentType { - const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + fragment: Partial +): fragment is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; if (!deferredFields) return true; @@ -61,5 +61,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in (data as any)); + return fields.length > 0 && fields.some(field => fragment && field in fragment); } diff --git a/examples/react/http-executor/src/gql/fragment-masking.ts b/examples/react/http-executor/src/gql/fragment-masking.ts index 377bffeeb6c..49f6d4a5da7 100644 --- a/examples/react/http-executor/src/gql/fragment-masking.ts +++ b/examples/react/http-executor/src/gql/fragment-masking.ts @@ -50,9 +50,9 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - data: Record -): data is FragmentType { - const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + fragment: Partial +): fragment is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; if (!deferredFields) return true; @@ -61,5 +61,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in (data as any)); + return fields.length > 0 && fields.some(field => fragment && field in fragment); } diff --git a/examples/react/nextjs-swr/gql/fragment-masking.ts b/examples/react/nextjs-swr/gql/fragment-masking.ts index 377bffeeb6c..49f6d4a5da7 100644 --- a/examples/react/nextjs-swr/gql/fragment-masking.ts +++ b/examples/react/nextjs-swr/gql/fragment-masking.ts @@ -50,9 +50,9 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - data: Record -): data is FragmentType { - const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + fragment: Partial +): fragment is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; if (!deferredFields) return true; @@ -61,5 +61,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in (data as any)); + return fields.length > 0 && fields.some(field => fragment && field in fragment); } diff --git a/examples/react/tanstack-react-query/src/gql/fragment-masking.ts b/examples/react/tanstack-react-query/src/gql/fragment-masking.ts index 5629241c751..a47ee0591f8 100644 --- a/examples/react/tanstack-react-query/src/gql/fragment-masking.ts +++ b/examples/react/tanstack-react-query/src/gql/fragment-masking.ts @@ -50,14 +50,14 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: TypedDocumentString, fragmentNode: TypedDocumentString, - data: Record -): data is FragmentType { - const deferredFields = queryNode.__meta__?.deferredFields as { [fragName: string]: string[] }; + fragment: Partial +): fragment is FragmentType { + const deferredFields = queryNode.__meta__?.deferredFields as Record; if (!deferredFields) return true; const fragName = fragmentNode.__meta__?.fragmentName; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in (data as any)); + return fields.length > 0 && fields.some(field => fragment && field in fragment); } diff --git a/examples/react/urql/src/gql/fragment-masking.ts b/examples/react/urql/src/gql/fragment-masking.ts index 5629241c751..a47ee0591f8 100644 --- a/examples/react/urql/src/gql/fragment-masking.ts +++ b/examples/react/urql/src/gql/fragment-masking.ts @@ -50,14 +50,14 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: TypedDocumentString, fragmentNode: TypedDocumentString, - data: Record -): data is FragmentType { - const deferredFields = queryNode.__meta__?.deferredFields as { [fragName: string]: string[] }; + fragment: Partial +): fragment is FragmentType { + const deferredFields = queryNode.__meta__?.deferredFields as Record; if (!deferredFields) return true; const fragName = fragmentNode.__meta__?.fragmentName; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in (data as any)); + return fields.length > 0 && fields.some(field => fragment && field in fragment); } diff --git a/examples/typescript-esm/src/gql/fragment-masking.ts b/examples/typescript-esm/src/gql/fragment-masking.ts index 377bffeeb6c..49f6d4a5da7 100644 --- a/examples/typescript-esm/src/gql/fragment-masking.ts +++ b/examples/typescript-esm/src/gql/fragment-masking.ts @@ -50,9 +50,9 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - data: Record -): data is FragmentType { - const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + fragment: Partial +): fragment is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; if (!deferredFields) return true; @@ -61,5 +61,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in (data as any)); + return fields.length > 0 && fields.some(field => fragment && field in fragment); } diff --git a/examples/typescript-graphql-request/src/gql/fragment-masking.ts b/examples/typescript-graphql-request/src/gql/fragment-masking.ts index 5629241c751..a47ee0591f8 100644 --- a/examples/typescript-graphql-request/src/gql/fragment-masking.ts +++ b/examples/typescript-graphql-request/src/gql/fragment-masking.ts @@ -50,14 +50,14 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: TypedDocumentString, fragmentNode: TypedDocumentString, - data: Record -): data is FragmentType { - const deferredFields = queryNode.__meta__?.deferredFields as { [fragName: string]: string[] }; + fragment: Partial +): fragment is FragmentType { + const deferredFields = queryNode.__meta__?.deferredFields as Record; if (!deferredFields) return true; const fragName = fragmentNode.__meta__?.fragmentName; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in (data as any)); + return fields.length > 0 && fields.some(field => fragment && field in fragment); } diff --git a/examples/vite/vite-react-cts/src/gql/fragment-masking.ts b/examples/vite/vite-react-cts/src/gql/fragment-masking.ts index 377bffeeb6c..49f6d4a5da7 100644 --- a/examples/vite/vite-react-cts/src/gql/fragment-masking.ts +++ b/examples/vite/vite-react-cts/src/gql/fragment-masking.ts @@ -50,9 +50,9 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - data: Record -): data is FragmentType { - const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + fragment: Partial +): fragment is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; if (!deferredFields) return true; @@ -61,5 +61,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in (data as any)); + return fields.length > 0 && fields.some(field => fragment && field in fragment); } diff --git a/examples/vite/vite-react-mts/src/gql/fragment-masking.ts b/examples/vite/vite-react-mts/src/gql/fragment-masking.ts index 377bffeeb6c..49f6d4a5da7 100644 --- a/examples/vite/vite-react-mts/src/gql/fragment-masking.ts +++ b/examples/vite/vite-react-mts/src/gql/fragment-masking.ts @@ -50,9 +50,9 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - data: Record -): data is FragmentType { - const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + fragment: Partial +): fragment is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; if (!deferredFields) return true; @@ -61,5 +61,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in (data as any)); + return fields.length > 0 && fields.some(field => fragment && field in fragment); } diff --git a/examples/vite/vite-react-ts/src/gql/fragment-masking.ts b/examples/vite/vite-react-ts/src/gql/fragment-masking.ts index 377bffeeb6c..49f6d4a5da7 100644 --- a/examples/vite/vite-react-ts/src/gql/fragment-masking.ts +++ b/examples/vite/vite-react-ts/src/gql/fragment-masking.ts @@ -50,9 +50,9 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - data: Record -): data is FragmentType { - const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + fragment: Partial +): fragment is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; if (!deferredFields) return true; @@ -61,5 +61,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in (data as any)); + return fields.length > 0 && fields.some(field => fragment && field in fragment); } diff --git a/examples/vue/apollo-composable/src/gql/fragment-masking.ts b/examples/vue/apollo-composable/src/gql/fragment-masking.ts index 5cefe862b9a..8016e13bdf1 100644 --- a/examples/vue/apollo-composable/src/gql/fragment-masking.ts +++ b/examples/vue/apollo-composable/src/gql/fragment-masking.ts @@ -50,9 +50,9 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - data: Record -): data is FragmentType { - const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + fragment: Partial +): fragment is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; if (!deferredFields) return true; @@ -61,5 +61,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in (data as any)); + return fields.length > 0 && fields.some(field => fragment && field in fragment); } diff --git a/examples/vue/urql/src/gql/fragment-masking.ts b/examples/vue/urql/src/gql/fragment-masking.ts index 5cefe862b9a..8016e13bdf1 100644 --- a/examples/vue/urql/src/gql/fragment-masking.ts +++ b/examples/vue/urql/src/gql/fragment-masking.ts @@ -50,9 +50,9 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - data: Record -): data is FragmentType { - const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + fragment: Partial +): fragment is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; if (!deferredFields) return true; @@ -61,5 +61,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in (data as any)); + return fields.length > 0 && fields.some(field => fragment && field in fragment); } diff --git a/examples/vue/villus/src/gql/fragment-masking.ts b/examples/vue/villus/src/gql/fragment-masking.ts index 5cefe862b9a..8016e13bdf1 100644 --- a/examples/vue/villus/src/gql/fragment-masking.ts +++ b/examples/vue/villus/src/gql/fragment-masking.ts @@ -50,9 +50,9 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - data: Record -): data is FragmentType { - const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + fragment: Partial +): fragment is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; if (!deferredFields) return true; @@ -61,5 +61,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in (data as any)); + return fields.length > 0 && fields.some(field => fragment && field in fragment); } diff --git a/examples/yoga-tests/src/gql/fragment-masking.ts b/examples/yoga-tests/src/gql/fragment-masking.ts index 377bffeeb6c..49f6d4a5da7 100644 --- a/examples/yoga-tests/src/gql/fragment-masking.ts +++ b/examples/yoga-tests/src/gql/fragment-masking.ts @@ -50,9 +50,9 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - data: Record -): data is FragmentType { - const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + fragment: Partial +): fragment is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; if (!deferredFields) return true; @@ -61,5 +61,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in (data as any)); + return fields.length > 0 && fields.some(field => fragment && field in fragment); } diff --git a/packages/presets/client/src/fragment-masking-plugin.ts b/packages/presets/client/src/fragment-masking-plugin.ts index c989c0cccde..e53cf217dca 100644 --- a/packages/presets/client/src/fragment-masking-plugin.ts +++ b/packages/presets/client/src/fragment-masking-plugin.ts @@ -78,16 +78,16 @@ const isFragmentReadyFunction = (isStringDocumentMode: boolean) => { export function isFragmentReady( queryNode: TypedDocumentString, fragmentNode: TypedDocumentString, - data: Record -): data is FragmentType { - const deferredFields = queryNode.__meta__?.deferredFields as { [fragName: string]: string[] }; + fragment: Partial +): fragment is FragmentType { + const deferredFields = queryNode.__meta__?.deferredFields as Record; if (!deferredFields) return true; const fragName = fragmentNode.__meta__?.fragmentName; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in (data as any)); + return fields.length > 0 && fields.some(field => fragment && field in fragment); } `; } @@ -95,9 +95,9 @@ export function isFragmentReady( export function isFragmentReady( queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - data: Record -): data is FragmentType { - const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + fragment: Partial +): fragment is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; if (!deferredFields) return true; @@ -106,7 +106,7 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in (data as any)); + return fields.length > 0 && fields.some(field => fragment && field in fragment); } `; }; diff --git a/packages/presets/client/tests/client-preset.spec.ts b/packages/presets/client/tests/client-preset.spec.ts index b2496350774..97d09c9bfcc 100644 --- a/packages/presets/client/tests/client-preset.spec.ts +++ b/packages/presets/client/tests/client-preset.spec.ts @@ -806,9 +806,9 @@ export * from "./gql";`); export function isFragmentReady( queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - data: Record - ): data is FragmentType { - const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + fragment: Partial + ): fragment is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; if (!deferredFields) return true; @@ -817,7 +817,7 @@ export * from "./gql";`); const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in (data as any)); + return fields.length > 0 && fields.some(field => fragment && field in fragment); } " `); From 166708d3c2c506edd4b1effaa8e8f8bbb15b36a1 Mon Sep 17 00:00:00 2001 From: beerose Date: Tue, 4 Apr 2023 11:14:55 +0200 Subject: [PATCH 37/47] Use DocumentType in example --- examples/react/apollo-client-defer/src/App.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/examples/react/apollo-client-defer/src/App.tsx b/examples/react/apollo-client-defer/src/App.tsx index 97f5fc4ff8c..e836b55fa9a 100644 --- a/examples/react/apollo-client-defer/src/App.tsx +++ b/examples/react/apollo-client-defer/src/App.tsx @@ -1,7 +1,6 @@ import { useQuery } from '@apollo/client'; -import { useFragment, graphql, FragmentType, isFragmentReady } from './gql'; -import { SlowAndFastFieldWithDeferQuery } from './gql/graphql'; +import { useFragment, graphql, FragmentType, isFragmentReady, DocumentType } from './gql'; export const slowFieldFragment = graphql(/* GraphQL */ ` fragment SlowFieldFragment on Query { @@ -25,7 +24,7 @@ const SlowDataField = (props: { data: FragmentType }) return

{data.slowField}

; }; -const InlinedSlowDataField = (props: { data: SlowAndFastFieldWithDeferQuery }) => { +const InlinedSlowDataField = (props: { data: DocumentType }) => { try { // @ts-expect-error - this field should be either undefined or a string const _ = props.data.inlinedSlowField.toLowerCase(); From c13d5890dddded4bd40f4636c25750be97616499 Mon Sep 17 00:00:00 2001 From: beerose Date: Tue, 4 Apr 2023 11:57:47 +0200 Subject: [PATCH 38/47] Renegrate example after merging master --- .../src/gql/fragment-masking.ts | 59 +++++++------------ .../apollo-client-defer/src/gql/graphql.ts | 1 - 2 files changed, 22 insertions(+), 38 deletions(-) diff --git a/examples/react/apollo-client-defer/src/gql/fragment-masking.ts b/examples/react/apollo-client-defer/src/gql/fragment-masking.ts index 49f6d4a5da7..195a11ebd3e 100644 --- a/examples/react/apollo-client-defer/src/gql/fragment-masking.ts +++ b/examples/react/apollo-client-defer/src/gql/fragment-masking.ts @@ -1,65 +1,50 @@ -import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; -import { FragmentDefinitionNode } from 'graphql'; +import { ResultOf, TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core'; -export type FragmentType> = - TDocumentType extends DocumentTypeDecoration - ? TType extends { ' $fragmentName'?: infer TKey } - ? TKey extends string - ? { ' $fragmentRefs'?: { [key in TKey]: TType } } - : never +export type FragmentType> = TDocumentType extends DocumentNode< + infer TType, + any +> + ? TType extends { ' $fragmentName'?: infer TKey } + ? TKey extends string + ? { ' $fragmentRefs'?: { [key in TKey]: TType } } : never - : never; + : never + : never; // return non-nullable if `fragmentType` is non-nullable export function useFragment( - _documentNode: DocumentTypeDecoration, - fragmentType: FragmentType> + _documentNode: DocumentNode, + fragmentType: FragmentType> ): TType; // return nullable if `fragmentType` is nullable export function useFragment( - _documentNode: DocumentTypeDecoration, - fragmentType: FragmentType> | null | undefined + _documentNode: DocumentNode, + fragmentType: FragmentType> | null | undefined ): TType | null | undefined; // return array of non-nullable if `fragmentType` is array of non-nullable export function useFragment( - _documentNode: DocumentTypeDecoration, - fragmentType: ReadonlyArray>> + _documentNode: DocumentNode, + fragmentType: ReadonlyArray>> ): ReadonlyArray; // return array of nullable if `fragmentType` is array of nullable export function useFragment( - _documentNode: DocumentTypeDecoration, - fragmentType: ReadonlyArray>> | null | undefined + _documentNode: DocumentNode, + fragmentType: ReadonlyArray>> | null | undefined ): ReadonlyArray | null | undefined; export function useFragment( - _documentNode: DocumentTypeDecoration, + _documentNode: DocumentNode, fragmentType: - | FragmentType> - | ReadonlyArray>> + | FragmentType> + | ReadonlyArray>> | null | undefined ): TType | ReadonlyArray | null | undefined { return fragmentType as any; } -export function makeFragmentData, FT extends ResultOf>( +export function makeFragmentData>( data: FT, _fragment: F ): FragmentType { return data as FragmentType; } -export function isFragmentReady( - queryNode: DocumentTypeDecoration, - fragmentNode: TypedDocumentNode, - fragment: Partial -): fragment is FragmentType { - const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ - ?.deferredFields; - - if (!deferredFields) return true; - - const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; - const fragName = fragDef?.name?.value; - - const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => fragment && field in fragment); -} diff --git a/examples/react/apollo-client-defer/src/gql/graphql.ts b/examples/react/apollo-client-defer/src/gql/graphql.ts index 1befb086a8b..721dc956556 100644 --- a/examples/react/apollo-client-defer/src/gql/graphql.ts +++ b/examples/react/apollo-client-defer/src/gql/graphql.ts @@ -73,7 +73,6 @@ export const SlowFieldFragmentFragmentDoc = { ], } as unknown as DocumentNode; export const SlowAndFastFieldWithDeferDocument = { - __meta__: { deferredFields: { SlowFieldFragment: ['slowField'] } }, kind: 'Document', definitions: [ { From e530d34644f4b00bda3f96dc67f80d82fa600fa3 Mon Sep 17 00:00:00 2001 From: beerose Date: Tue, 4 Apr 2023 12:42:48 +0200 Subject: [PATCH 39/47] Update deps in new example --- .../react/apollo-client-defer/package.json | 4 +- .../src/gql/fragment-masking.ts | 59 ++++++++++++------- .../apollo-client-defer/src/gql/graphql.ts | 1 + yarn.lock | 57 ------------------ 4 files changed, 40 insertions(+), 81 deletions(-) diff --git a/examples/react/apollo-client-defer/package.json b/examples/react/apollo-client-defer/package.json index 0d4b75f699b..3bf156bd1eb 100644 --- a/examples/react/apollo-client-defer/package.json +++ b/examples/react/apollo-client-defer/package.json @@ -11,8 +11,8 @@ "graphql-yoga": "3.7.3" }, "devDependencies": { - "@graphql-codegen/cli": "^3.2.2", - "@graphql-codegen/client-preset": "^2.1.1", + "@graphql-codegen/cli": "^3.3.0", + "@graphql-codegen/client-preset": "^3.0.0", "@types/jest": "^27.5.2", "@types/node": "^18.11.18", "@types/react": "^18.0.15", diff --git a/examples/react/apollo-client-defer/src/gql/fragment-masking.ts b/examples/react/apollo-client-defer/src/gql/fragment-masking.ts index 195a11ebd3e..49f6d4a5da7 100644 --- a/examples/react/apollo-client-defer/src/gql/fragment-masking.ts +++ b/examples/react/apollo-client-defer/src/gql/fragment-masking.ts @@ -1,50 +1,65 @@ -import { ResultOf, TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core'; +import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; +import { FragmentDefinitionNode } from 'graphql'; -export type FragmentType> = TDocumentType extends DocumentNode< - infer TType, - any -> - ? TType extends { ' $fragmentName'?: infer TKey } - ? TKey extends string - ? { ' $fragmentRefs'?: { [key in TKey]: TType } } +export type FragmentType> = + TDocumentType extends DocumentTypeDecoration + ? TType extends { ' $fragmentName'?: infer TKey } + ? TKey extends string + ? { ' $fragmentRefs'?: { [key in TKey]: TType } } + : never : never - : never - : never; + : never; // return non-nullable if `fragmentType` is non-nullable export function useFragment( - _documentNode: DocumentNode, - fragmentType: FragmentType> + _documentNode: DocumentTypeDecoration, + fragmentType: FragmentType> ): TType; // return nullable if `fragmentType` is nullable export function useFragment( - _documentNode: DocumentNode, - fragmentType: FragmentType> | null | undefined + _documentNode: DocumentTypeDecoration, + fragmentType: FragmentType> | null | undefined ): TType | null | undefined; // return array of non-nullable if `fragmentType` is array of non-nullable export function useFragment( - _documentNode: DocumentNode, - fragmentType: ReadonlyArray>> + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray>> ): ReadonlyArray; // return array of nullable if `fragmentType` is array of nullable export function useFragment( - _documentNode: DocumentNode, - fragmentType: ReadonlyArray>> | null | undefined + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray>> | null | undefined ): ReadonlyArray | null | undefined; export function useFragment( - _documentNode: DocumentNode, + _documentNode: DocumentTypeDecoration, fragmentType: - | FragmentType> - | ReadonlyArray>> + | FragmentType> + | ReadonlyArray>> | null | undefined ): TType | ReadonlyArray | null | undefined { return fragmentType as any; } -export function makeFragmentData>( +export function makeFragmentData, FT extends ResultOf>( data: FT, _fragment: F ): FragmentType { return data as FragmentType; } +export function isFragmentReady( + queryNode: DocumentTypeDecoration, + fragmentNode: TypedDocumentNode, + fragment: Partial +): fragment is FragmentType { + const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ + ?.deferredFields; + + if (!deferredFields) return true; + + const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined; + const fragName = fragDef?.name?.value; + + const fields = fragName ? deferredFields[fragName] : []; + return fields.length > 0 && fields.some(field => fragment && field in fragment); +} diff --git a/examples/react/apollo-client-defer/src/gql/graphql.ts b/examples/react/apollo-client-defer/src/gql/graphql.ts index 721dc956556..1befb086a8b 100644 --- a/examples/react/apollo-client-defer/src/gql/graphql.ts +++ b/examples/react/apollo-client-defer/src/gql/graphql.ts @@ -73,6 +73,7 @@ export const SlowFieldFragmentFragmentDoc = { ], } as unknown as DocumentNode; export const SlowAndFastFieldWithDeferDocument = { + __meta__: { deferredFields: { SlowFieldFragment: ['slowField'] } }, kind: 'Document', definitions: [ { diff --git a/yarn.lock b/yarn.lock index 2838e3ae2b0..18d81f6c021 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1840,25 +1840,6 @@ resolved "https://registry.yarnpkg.com/@graphql-codegen/client-preset-swc-plugin/-/client-preset-swc-plugin-0.1.1.tgz#2724432d9a83b68c8d1d177386a286b11caa6d2d" integrity sha512-FYdw7x562VqhavXWm5V/Oho8wtBsNbUfxlPsfjQaRpC1sBOrKJJxOvw/Bb5qW+Mqf3Uepbe5dN+cZaKn15ybWg== -"@graphql-codegen/client-preset@^2.1.1": - version "2.1.1" - resolved "https://registry.yarnpkg.com/@graphql-codegen/client-preset/-/client-preset-2.1.1.tgz#acf065d9520cde7e34ad0a9adada615e7502b884" - integrity sha512-yDFiO2CimwjkH/YE5nwRcLkXoAVz31NC+WWvFQdyrR1UKQqe2tqV/bKLUifnSbBGS238ajHJ6AEzVlzIvI8OYQ== - dependencies: - "@babel/helper-plugin-utils" "^7.20.2" - "@babel/template" "^7.20.7" - "@graphql-codegen/add" "^4.0.1" - "@graphql-codegen/gql-tag-operations" "2.0.2" - "@graphql-codegen/plugin-helpers" "^4.1.0" - "@graphql-codegen/typed-document-node" "^3.0.2" - "@graphql-codegen/typescript" "^3.0.2" - "@graphql-codegen/typescript-operations" "^3.0.2" - "@graphql-codegen/visitor-plugin-common" "^3.0.2" - "@graphql-tools/documents" "^0.1.0" - "@graphql-tools/utils" "^9.0.0" - "@graphql-typed-document-node/core" "3.1.2" - tslib "~2.5.0" - "@graphql-codegen/flow-operations@2.3.6": version "2.3.6" resolved "https://registry.yarnpkg.com/@graphql-codegen/flow-operations/-/flow-operations-2.3.6.tgz#324f15d96f38c18272678a86e30b678bc4480cb6" @@ -1904,17 +1885,6 @@ change-case-all "1.0.15" tslib "~2.4.0" -"@graphql-codegen/gql-tag-operations@2.0.2": - version "2.0.2" - resolved "https://registry.yarnpkg.com/@graphql-codegen/gql-tag-operations/-/gql-tag-operations-2.0.2.tgz#6fb693ede76d9ac67c1d7755aa0fc01c42b2be82" - integrity sha512-FB4/Q0xP/lIjwnlxdeGAfGFAiL7AhzIJB9keNrosd4Xe9r8V8NuZ0+0/hGc7KdzHhojYF/ycmJD7V2JLWaf23Q== - dependencies: - "@graphql-codegen/plugin-helpers" "^4.1.0" - "@graphql-codegen/visitor-plugin-common" "3.0.2" - "@graphql-tools/utils" "^9.0.0" - auto-bind "~4.0.0" - tslib "~2.5.0" - "@graphql-codegen/hasura-allow-list@2.0.0": version "2.0.0" resolved "https://registry.yarnpkg.com/@graphql-codegen/hasura-allow-list/-/hasura-allow-list-2.0.0.tgz#1e927868fcca01cd34b2d39ddc3e6b0279b06b00" @@ -2052,17 +2022,6 @@ "@graphql-tools/utils" "^9.0.0" tslib "~2.4.0" -"@graphql-codegen/typed-document-node@^3.0.2": - version "3.0.2" - resolved "https://registry.yarnpkg.com/@graphql-codegen/typed-document-node/-/typed-document-node-3.0.2.tgz#afdf039c38f1b02a946854b6f487af764429eec8" - integrity sha512-RqX46y0GoMAcCfXjkUabOWpeSQ7tazpS5WyzWJNakpzXxNACx8NACaghU8zTEM+gjqtIp6YbFY/S92HQ34HbRQ== - dependencies: - "@graphql-codegen/plugin-helpers" "^4.1.0" - "@graphql-codegen/visitor-plugin-common" "3.0.2" - auto-bind "~4.0.0" - change-case-all "1.0.15" - tslib "~2.5.0" - "@graphql-codegen/typescript-apollo-angular@3.5.6": version "3.5.6" resolved "https://registry.yarnpkg.com/@graphql-codegen/typescript-apollo-angular/-/typescript-apollo-angular-3.5.6.tgz#0e84eb4b4160baf944b03f00e655e4c05f44d1af" @@ -2314,22 +2273,6 @@ parse-filepath "^1.0.2" tslib "~2.4.0" -"@graphql-codegen/visitor-plugin-common@3.0.2": - version "3.0.2" - resolved "https://registry.yarnpkg.com/@graphql-codegen/visitor-plugin-common/-/visitor-plugin-common-3.0.2.tgz#784c0faaa7e0773072ea5de464fdcae8d7765564" - integrity sha512-dKblRFrB0Fdl3+nPlzlLBka+TN/EGwr/q09mwry0H58z3j6gXkMbsdPr+dc8MhgOV7w/8egRvSPIvd7m6eFCnw== - dependencies: - "@graphql-codegen/plugin-helpers" "^4.1.0" - "@graphql-tools/optimize" "^1.3.0" - "@graphql-tools/relay-operation-optimizer" "^6.5.0" - "@graphql-tools/utils" "^9.0.0" - auto-bind "~4.0.0" - change-case-all "1.0.15" - dependency-graph "^0.11.0" - graphql-tag "^2.11.0" - parse-filepath "^1.0.2" - tslib "~2.5.0" - "@graphql-tools/apollo-engine-loader@7.3.26", "@graphql-tools/apollo-engine-loader@^7.3.6": version "7.3.26" resolved "https://registry.yarnpkg.com/@graphql-tools/apollo-engine-loader/-/apollo-engine-loader-7.3.26.tgz#91e54460d5579933e42a2010b8688c3459c245d8" From b435f6d48189275610a0c7ccc4ec26e96a035a65 Mon Sep 17 00:00:00 2001 From: beerose Date: Thu, 6 Apr 2023 16:20:02 +0200 Subject: [PATCH 40/47] Minor changes to defer related types --- dev-test/githunt/typed-document-nodes.ts | 2 +- dev-test/githunt/types.avoidOptionals.ts | 2 +- dev-test/githunt/types.d.ts | 2 +- dev-test/githunt/types.enumsAsTypes.ts | 2 +- .../githunt/types.flatten.preResolveTypes.ts | 2 +- dev-test/githunt/types.immutableTypes.ts | 2 +- ...ypes.preResolveTypes.onlyOperationTypes.ts | 2 +- dev-test/githunt/types.preResolveTypes.ts | 2 +- dev-test/githunt/types.ts | 2 +- .../gql/fragment-masking.ts | 8 ++--- .../gql-tag-operations-masking/gql/graphql.ts | 2 +- .../gql/fragment-masking.ts | 8 ++--- .../gql-tag-operations-urql/gql/graphql.ts | 2 +- .../gql/fragment-masking.ts | 8 ++--- dev-test/gql-tag-operations/gql/graphql.ts | 2 +- .../graphql/fragment-masking.ts | 8 ++--- .../gql-tag-operations/graphql/graphql.ts | 2 +- dev-test/modules/types.ts | 2 +- dev-test/star-wars/types.avoidOptionals.ts | 2 +- dev-test/star-wars/types.d.ts | 2 +- .../star-wars/types.globallyAvailable.d.ts | 2 +- dev-test/star-wars/types.immutableTypes.ts | 2 +- ...ypes.preResolveTypes.onlyOperationTypes.ts | 2 +- dev-test/star-wars/types.preResolveTypes.ts | 2 +- dev-test/star-wars/types.skipSchema.ts | 2 +- dev-test/star-wars/types.ts | 2 +- dev-test/test-schema/env.types.ts | 2 +- dev-test/test-schema/resolvers-federation.ts | 2 +- dev-test/test-schema/resolvers-root.ts | 2 +- dev-test/test-schema/resolvers-stitching.ts | 2 +- dev-test/test-schema/resolvers-types.ts | 2 +- ...ypes.preResolveTypes.onlyOperationTypes.ts | 2 +- dev-test/test-schema/types.preResolveTypes.ts | 2 +- .../test-schema/typings.avoidOptionals.ts | 2 +- dev-test/test-schema/typings.enum.ts | 2 +- .../test-schema/typings.immutableTypes.ts | 2 +- dev-test/test-schema/typings.ts | 2 +- dev-test/test-schema/typings.wrapped.ts | 2 +- .../src/gql/fragment-masking.ts | 8 ++--- .../src/gql/graphql.ts | 2 +- .../src/gql/fragment-masking.ts | 8 ++--- .../persisted-documents/src/gql/graphql.ts | 2 +- .../src/gql/fragment-masking.ts | 8 ++--- .../apollo-client-defer/src/gql/graphql.ts | 2 +- .../src/gql/fragment-masking.ts | 8 ++--- .../src/gql/graphql.ts | 2 +- .../apollo-client/src/gql/fragment-masking.ts | 8 ++--- .../react/apollo-client/src/gql/graphql.ts | 2 +- .../http-executor/src/gql/fragment-masking.ts | 8 ++--- .../react/http-executor/src/gql/graphql.ts | 2 +- .../react/nextjs-swr/gql/fragment-masking.ts | 8 ++--- examples/react/nextjs-swr/gql/graphql.ts | 2 +- .../src/gql/fragment-masking.ts | 8 ++--- .../tanstack-react-query/src/gql/graphql.ts | 2 +- .../react/urql/src/gql/fragment-masking.ts | 8 ++--- examples/react/urql/src/gql/graphql.ts | 2 +- .../src/gql/fragment-masking.ts | 8 ++--- examples/typescript-esm/src/gql/graphql.ts | 2 +- .../src/gql/fragment-masking.ts | 8 ++--- .../src/gql/graphql.ts | 2 +- .../typescript-resolvers/src/type-defs.d.ts | 2 +- .../src/gql/fragment-masking.ts | 8 ++--- .../vite/vite-react-cts/src/gql/graphql.ts | 2 +- .../src/gql/fragment-masking.ts | 8 ++--- .../vite/vite-react-mts/src/gql/graphql.ts | 2 +- .../vite-react-ts/src/gql/fragment-masking.ts | 8 ++--- .../vite/vite-react-ts/src/gql/graphql.ts | 2 +- .../src/gql/fragment-masking.ts | 8 ++--- .../vue/apollo-composable/src/gql/graphql.ts | 2 +- examples/vue/urql/src/gql/fragment-masking.ts | 8 ++--- examples/vue/urql/src/gql/graphql.ts | 2 +- .../vue/villus/src/gql/fragment-masking.ts | 8 ++--- examples/vue/villus/src/gql/graphql.ts | 2 +- .../yoga-tests/src/gql/fragment-masking.ts | 8 ++--- examples/yoga-tests/src/gql/graphql.ts | 2 +- .../__snapshots__/ts-documents.spec.ts.snap | 8 ++--- .../operations/tests/ts-documents.spec.ts | 6 ++-- .../__snapshots__/ts-resolvers.spec.ts.snap | 4 +-- .../typescript/typescript/src/visitor.ts | 2 +- .../client/src/fragment-masking-plugin.ts | 14 ++++---- .../client/tests/client-preset.spec.ts | 36 +++++++++---------- 81 files changed, 176 insertions(+), 176 deletions(-) diff --git a/dev-test/githunt/typed-document-nodes.ts b/dev-test/githunt/typed-document-nodes.ts index c1869979b18..8024a2d04e0 100644 --- a/dev-test/githunt/typed-document-nodes.ts +++ b/dev-test/githunt/typed-document-nodes.ts @@ -5,7 +5,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/githunt/types.avoidOptionals.ts b/dev-test/githunt/types.avoidOptionals.ts index c0776da450e..87fd3a832b0 100644 --- a/dev-test/githunt/types.avoidOptionals.ts +++ b/dev-test/githunt/types.avoidOptionals.ts @@ -4,7 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/githunt/types.d.ts b/dev-test/githunt/types.d.ts index 49dd9885cae..918c2881788 100644 --- a/dev-test/githunt/types.d.ts +++ b/dev-test/githunt/types.d.ts @@ -4,7 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/githunt/types.enumsAsTypes.ts b/dev-test/githunt/types.enumsAsTypes.ts index 49dd9885cae..918c2881788 100644 --- a/dev-test/githunt/types.enumsAsTypes.ts +++ b/dev-test/githunt/types.enumsAsTypes.ts @@ -4,7 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/githunt/types.flatten.preResolveTypes.ts b/dev-test/githunt/types.flatten.preResolveTypes.ts index 7d9dbeb58ba..60c6c2c8a2c 100644 --- a/dev-test/githunt/types.flatten.preResolveTypes.ts +++ b/dev-test/githunt/types.flatten.preResolveTypes.ts @@ -4,7 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/githunt/types.immutableTypes.ts b/dev-test/githunt/types.immutableTypes.ts index 62a3bdf71e6..a138437caad 100644 --- a/dev-test/githunt/types.immutableTypes.ts +++ b/dev-test/githunt/types.immutableTypes.ts @@ -4,7 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/githunt/types.preResolveTypes.onlyOperationTypes.ts b/dev-test/githunt/types.preResolveTypes.onlyOperationTypes.ts index 71b26f44e87..ad963fff007 100644 --- a/dev-test/githunt/types.preResolveTypes.onlyOperationTypes.ts +++ b/dev-test/githunt/types.preResolveTypes.onlyOperationTypes.ts @@ -4,7 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/githunt/types.preResolveTypes.ts b/dev-test/githunt/types.preResolveTypes.ts index 48a6d7ca4a7..9196055488c 100644 --- a/dev-test/githunt/types.preResolveTypes.ts +++ b/dev-test/githunt/types.preResolveTypes.ts @@ -4,7 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/githunt/types.ts b/dev-test/githunt/types.ts index 48a6d7ca4a7..9196055488c 100644 --- a/dev-test/githunt/types.ts +++ b/dev-test/githunt/types.ts @@ -4,7 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts b/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts index 49f6d4a5da7..0a94bd999f9 100644 --- a/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts +++ b/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts @@ -3,7 +3,7 @@ import { FragmentDefinitionNode } from 'graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration - ? TType extends { ' $fragmentName'?: infer TKey } + ? [TType] extends [{ ' $fragmentName'?: infer TKey }] ? TKey extends string ? { ' $fragmentRefs'?: { [key in TKey]: TType } } : never @@ -50,8 +50,8 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - fragment: Partial -): fragment is FragmentType { + data: FragmentType, any>> | null | undefined +): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; @@ -61,5 +61,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => fragment && field in fragment); + return fields.length > 0 && fields.some(field => data && field in data); } diff --git a/dev-test/gql-tag-operations-masking/gql/graphql.ts b/dev-test/gql-tag-operations-masking/gql/graphql.ts index 72a9c35e3f1..20b8154dd3d 100644 --- a/dev-test/gql-tag-operations-masking/gql/graphql.ts +++ b/dev-test/gql-tag-operations-masking/gql/graphql.ts @@ -6,7 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts b/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts index 49f6d4a5da7..0a94bd999f9 100644 --- a/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts +++ b/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts @@ -3,7 +3,7 @@ import { FragmentDefinitionNode } from 'graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration - ? TType extends { ' $fragmentName'?: infer TKey } + ? [TType] extends [{ ' $fragmentName'?: infer TKey }] ? TKey extends string ? { ' $fragmentRefs'?: { [key in TKey]: TType } } : never @@ -50,8 +50,8 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - fragment: Partial -): fragment is FragmentType { + data: FragmentType, any>> | null | undefined +): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; @@ -61,5 +61,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => fragment && field in fragment); + return fields.length > 0 && fields.some(field => data && field in data); } diff --git a/dev-test/gql-tag-operations-urql/gql/graphql.ts b/dev-test/gql-tag-operations-urql/gql/graphql.ts index 70a0bcd01aa..6992bb76696 100644 --- a/dev-test/gql-tag-operations-urql/gql/graphql.ts +++ b/dev-test/gql-tag-operations-urql/gql/graphql.ts @@ -6,7 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/gql-tag-operations/gql/fragment-masking.ts b/dev-test/gql-tag-operations/gql/fragment-masking.ts index 49f6d4a5da7..0a94bd999f9 100644 --- a/dev-test/gql-tag-operations/gql/fragment-masking.ts +++ b/dev-test/gql-tag-operations/gql/fragment-masking.ts @@ -3,7 +3,7 @@ import { FragmentDefinitionNode } from 'graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration - ? TType extends { ' $fragmentName'?: infer TKey } + ? [TType] extends [{ ' $fragmentName'?: infer TKey }] ? TKey extends string ? { ' $fragmentRefs'?: { [key in TKey]: TType } } : never @@ -50,8 +50,8 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - fragment: Partial -): fragment is FragmentType { + data: FragmentType, any>> | null | undefined +): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; @@ -61,5 +61,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => fragment && field in fragment); + return fields.length > 0 && fields.some(field => data && field in data); } diff --git a/dev-test/gql-tag-operations/gql/graphql.ts b/dev-test/gql-tag-operations/gql/graphql.ts index 70a0bcd01aa..6992bb76696 100644 --- a/dev-test/gql-tag-operations/gql/graphql.ts +++ b/dev-test/gql-tag-operations/gql/graphql.ts @@ -6,7 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/gql-tag-operations/graphql/fragment-masking.ts b/dev-test/gql-tag-operations/graphql/fragment-masking.ts index 49f6d4a5da7..0a94bd999f9 100644 --- a/dev-test/gql-tag-operations/graphql/fragment-masking.ts +++ b/dev-test/gql-tag-operations/graphql/fragment-masking.ts @@ -3,7 +3,7 @@ import { FragmentDefinitionNode } from 'graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration - ? TType extends { ' $fragmentName'?: infer TKey } + ? [TType] extends [{ ' $fragmentName'?: infer TKey }] ? TKey extends string ? { ' $fragmentRefs'?: { [key in TKey]: TType } } : never @@ -50,8 +50,8 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - fragment: Partial -): fragment is FragmentType { + data: FragmentType, any>> | null | undefined +): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; @@ -61,5 +61,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => fragment && field in fragment); + return fields.length > 0 && fields.some(field => data && field in data); } diff --git a/dev-test/gql-tag-operations/graphql/graphql.ts b/dev-test/gql-tag-operations/graphql/graphql.ts index 70a0bcd01aa..6992bb76696 100644 --- a/dev-test/gql-tag-operations/graphql/graphql.ts +++ b/dev-test/gql-tag-operations/graphql/graphql.ts @@ -6,7 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/modules/types.ts b/dev-test/modules/types.ts index e7fa2e3ca70..50b65c87db3 100644 --- a/dev-test/modules/types.ts +++ b/dev-test/modules/types.ts @@ -5,7 +5,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; export type Omit = Pick>; export type RequireFields = Omit & { [P in K]-?: NonNullable }; /** All built-in and custom scalars, mapped to their actual values */ diff --git a/dev-test/star-wars/types.avoidOptionals.ts b/dev-test/star-wars/types.avoidOptionals.ts index 7257d9a5497..354473aa3b5 100644 --- a/dev-test/star-wars/types.avoidOptionals.ts +++ b/dev-test/star-wars/types.avoidOptionals.ts @@ -4,7 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/star-wars/types.d.ts b/dev-test/star-wars/types.d.ts index de45370b95b..8242f8b5c3b 100644 --- a/dev-test/star-wars/types.d.ts +++ b/dev-test/star-wars/types.d.ts @@ -4,7 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/star-wars/types.globallyAvailable.d.ts b/dev-test/star-wars/types.globallyAvailable.d.ts index d65de5b4cab..a3feed5792c 100644 --- a/dev-test/star-wars/types.globallyAvailable.d.ts +++ b/dev-test/star-wars/types.globallyAvailable.d.ts @@ -4,7 +4,7 @@ type Exact = { [K in keyof T]: T[K] }; type MakeOptional = Omit & { [SubKey in K]?: Maybe }; type MakeMaybe = Omit & { [SubKey in K]: Maybe }; type MakeEmpty = { [_ in K]?: never }; -type Incremental = T | { [P in keyof T]?: never }; +type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ type Scalars = { ID: string; diff --git a/dev-test/star-wars/types.immutableTypes.ts b/dev-test/star-wars/types.immutableTypes.ts index 1ca1a172a81..aebbd6f24c4 100644 --- a/dev-test/star-wars/types.immutableTypes.ts +++ b/dev-test/star-wars/types.immutableTypes.ts @@ -4,7 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/star-wars/types.preResolveTypes.onlyOperationTypes.ts b/dev-test/star-wars/types.preResolveTypes.onlyOperationTypes.ts index 7662ccecc4e..4fddfe57b71 100644 --- a/dev-test/star-wars/types.preResolveTypes.onlyOperationTypes.ts +++ b/dev-test/star-wars/types.preResolveTypes.onlyOperationTypes.ts @@ -4,7 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/star-wars/types.preResolveTypes.ts b/dev-test/star-wars/types.preResolveTypes.ts index edc205c0a74..894ebd04e37 100644 --- a/dev-test/star-wars/types.preResolveTypes.ts +++ b/dev-test/star-wars/types.preResolveTypes.ts @@ -4,7 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/star-wars/types.skipSchema.ts b/dev-test/star-wars/types.skipSchema.ts index edc205c0a74..894ebd04e37 100644 --- a/dev-test/star-wars/types.skipSchema.ts +++ b/dev-test/star-wars/types.skipSchema.ts @@ -4,7 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/star-wars/types.ts b/dev-test/star-wars/types.ts index edc205c0a74..894ebd04e37 100644 --- a/dev-test/star-wars/types.ts +++ b/dev-test/star-wars/types.ts @@ -4,7 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/test-schema/env.types.ts b/dev-test/test-schema/env.types.ts index 865579cf417..d10823f189d 100644 --- a/dev-test/test-schema/env.types.ts +++ b/dev-test/test-schema/env.types.ts @@ -4,7 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/test-schema/resolvers-federation.ts b/dev-test/test-schema/resolvers-federation.ts index efc51522202..256d3146f9d 100644 --- a/dev-test/test-schema/resolvers-federation.ts +++ b/dev-test/test-schema/resolvers-federation.ts @@ -5,7 +5,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/test-schema/resolvers-root.ts b/dev-test/test-schema/resolvers-root.ts index e6e409c81c5..6d0f385db1d 100644 --- a/dev-test/test-schema/resolvers-root.ts +++ b/dev-test/test-schema/resolvers-root.ts @@ -5,7 +5,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; export type RequireFields = Omit & { [P in K]-?: NonNullable }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { diff --git a/dev-test/test-schema/resolvers-stitching.ts b/dev-test/test-schema/resolvers-stitching.ts index 66b12f03804..fd588e89449 100644 --- a/dev-test/test-schema/resolvers-stitching.ts +++ b/dev-test/test-schema/resolvers-stitching.ts @@ -5,7 +5,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; export type RequireFields = Omit & { [P in K]-?: NonNullable }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { diff --git a/dev-test/test-schema/resolvers-types.ts b/dev-test/test-schema/resolvers-types.ts index 79975cd3322..4e1754d6976 100644 --- a/dev-test/test-schema/resolvers-types.ts +++ b/dev-test/test-schema/resolvers-types.ts @@ -5,7 +5,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; export type RequireFields = Omit & { [P in K]-?: NonNullable }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { diff --git a/dev-test/test-schema/types.preResolveTypes.onlyOperationTypes.ts b/dev-test/test-schema/types.preResolveTypes.onlyOperationTypes.ts index 788bcca1855..e8f4b62fbb0 100644 --- a/dev-test/test-schema/types.preResolveTypes.onlyOperationTypes.ts +++ b/dev-test/test-schema/types.preResolveTypes.onlyOperationTypes.ts @@ -4,7 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/test-schema/types.preResolveTypes.ts b/dev-test/test-schema/types.preResolveTypes.ts index ac27c41eeeb..78e0a4e4705 100644 --- a/dev-test/test-schema/types.preResolveTypes.ts +++ b/dev-test/test-schema/types.preResolveTypes.ts @@ -4,7 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/test-schema/typings.avoidOptionals.ts b/dev-test/test-schema/typings.avoidOptionals.ts index 27b38757995..39eb13a5346 100644 --- a/dev-test/test-schema/typings.avoidOptionals.ts +++ b/dev-test/test-schema/typings.avoidOptionals.ts @@ -4,7 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/test-schema/typings.enum.ts b/dev-test/test-schema/typings.enum.ts index 42874c1883a..c4f33e44bcb 100644 --- a/dev-test/test-schema/typings.enum.ts +++ b/dev-test/test-schema/typings.enum.ts @@ -4,7 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/test-schema/typings.immutableTypes.ts b/dev-test/test-schema/typings.immutableTypes.ts index 136fc2fb0fa..68de80f79df 100644 --- a/dev-test/test-schema/typings.immutableTypes.ts +++ b/dev-test/test-schema/typings.immutableTypes.ts @@ -4,7 +4,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/dev-test/test-schema/typings.ts b/dev-test/test-schema/typings.ts index 463811cd291..6f5eed9dc47 100644 --- a/dev-test/test-schema/typings.ts +++ b/dev-test/test-schema/typings.ts @@ -5,7 +5,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; export type RequireFields = Omit & { [P in K]-?: NonNullable }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { diff --git a/dev-test/test-schema/typings.wrapped.ts b/dev-test/test-schema/typings.wrapped.ts index 77ea912dca5..67ef1c7b161 100644 --- a/dev-test/test-schema/typings.wrapped.ts +++ b/dev-test/test-schema/typings.wrapped.ts @@ -5,7 +5,7 @@ declare namespace GraphQL { export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = T | { [P in keyof T]?: never }; + export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts b/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts index a47ee0591f8..804c024e33c 100644 --- a/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts +++ b/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts @@ -3,7 +3,7 @@ import { TypedDocumentString } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration - ? TType extends { ' $fragmentName'?: infer TKey } + ? [TType] extends [{ ' $fragmentName'?: infer TKey }] ? TKey extends string ? { ' $fragmentRefs'?: { [key in TKey]: TType } } : never @@ -50,8 +50,8 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: TypedDocumentString, fragmentNode: TypedDocumentString, - fragment: Partial -): fragment is FragmentType { + data: FragmentType, any>> | null | undefined +): data is FragmentType { const deferredFields = queryNode.__meta__?.deferredFields as Record; if (!deferredFields) return true; @@ -59,5 +59,5 @@ export function isFragmentReady( const fragName = fragmentNode.__meta__?.fragmentName; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => fragment && field in fragment); + return fields.length > 0 && fields.some(field => data && field in data); } diff --git a/examples/persisted-documents-string-mode/src/gql/graphql.ts b/examples/persisted-documents-string-mode/src/gql/graphql.ts index fbc95a503a3..89fb697c109 100644 --- a/examples/persisted-documents-string-mode/src/gql/graphql.ts +++ b/examples/persisted-documents-string-mode/src/gql/graphql.ts @@ -6,7 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/persisted-documents/src/gql/fragment-masking.ts b/examples/persisted-documents/src/gql/fragment-masking.ts index 49f6d4a5da7..0a94bd999f9 100644 --- a/examples/persisted-documents/src/gql/fragment-masking.ts +++ b/examples/persisted-documents/src/gql/fragment-masking.ts @@ -3,7 +3,7 @@ import { FragmentDefinitionNode } from 'graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration - ? TType extends { ' $fragmentName'?: infer TKey } + ? [TType] extends [{ ' $fragmentName'?: infer TKey }] ? TKey extends string ? { ' $fragmentRefs'?: { [key in TKey]: TType } } : never @@ -50,8 +50,8 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - fragment: Partial -): fragment is FragmentType { + data: FragmentType, any>> | null | undefined +): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; @@ -61,5 +61,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => fragment && field in fragment); + return fields.length > 0 && fields.some(field => data && field in data); } diff --git a/examples/persisted-documents/src/gql/graphql.ts b/examples/persisted-documents/src/gql/graphql.ts index aac2babde26..0f99afca549 100644 --- a/examples/persisted-documents/src/gql/graphql.ts +++ b/examples/persisted-documents/src/gql/graphql.ts @@ -6,7 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/react/apollo-client-defer/src/gql/fragment-masking.ts b/examples/react/apollo-client-defer/src/gql/fragment-masking.ts index 49f6d4a5da7..0a94bd999f9 100644 --- a/examples/react/apollo-client-defer/src/gql/fragment-masking.ts +++ b/examples/react/apollo-client-defer/src/gql/fragment-masking.ts @@ -3,7 +3,7 @@ import { FragmentDefinitionNode } from 'graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration - ? TType extends { ' $fragmentName'?: infer TKey } + ? [TType] extends [{ ' $fragmentName'?: infer TKey }] ? TKey extends string ? { ' $fragmentRefs'?: { [key in TKey]: TType } } : never @@ -50,8 +50,8 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - fragment: Partial -): fragment is FragmentType { + data: FragmentType, any>> | null | undefined +): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; @@ -61,5 +61,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => fragment && field in fragment); + return fields.length > 0 && fields.some(field => data && field in data); } diff --git a/examples/react/apollo-client-defer/src/gql/graphql.ts b/examples/react/apollo-client-defer/src/gql/graphql.ts index 1befb086a8b..fd16b6a7dd4 100644 --- a/examples/react/apollo-client-defer/src/gql/graphql.ts +++ b/examples/react/apollo-client-defer/src/gql/graphql.ts @@ -6,7 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts b/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts index 49f6d4a5da7..0a94bd999f9 100644 --- a/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts +++ b/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts @@ -3,7 +3,7 @@ import { FragmentDefinitionNode } from 'graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration - ? TType extends { ' $fragmentName'?: infer TKey } + ? [TType] extends [{ ' $fragmentName'?: infer TKey }] ? TKey extends string ? { ' $fragmentRefs'?: { [key in TKey]: TType } } : never @@ -50,8 +50,8 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - fragment: Partial -): fragment is FragmentType { + data: FragmentType, any>> | null | undefined +): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; @@ -61,5 +61,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => fragment && field in fragment); + return fields.length > 0 && fields.some(field => data && field in data); } diff --git a/examples/react/apollo-client-swc-plugin/src/gql/graphql.ts b/examples/react/apollo-client-swc-plugin/src/gql/graphql.ts index 70076f3c2a2..100bcd7ccd7 100644 --- a/examples/react/apollo-client-swc-plugin/src/gql/graphql.ts +++ b/examples/react/apollo-client-swc-plugin/src/gql/graphql.ts @@ -6,7 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/react/apollo-client/src/gql/fragment-masking.ts b/examples/react/apollo-client/src/gql/fragment-masking.ts index 49f6d4a5da7..0a94bd999f9 100644 --- a/examples/react/apollo-client/src/gql/fragment-masking.ts +++ b/examples/react/apollo-client/src/gql/fragment-masking.ts @@ -3,7 +3,7 @@ import { FragmentDefinitionNode } from 'graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration - ? TType extends { ' $fragmentName'?: infer TKey } + ? [TType] extends [{ ' $fragmentName'?: infer TKey }] ? TKey extends string ? { ' $fragmentRefs'?: { [key in TKey]: TType } } : never @@ -50,8 +50,8 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - fragment: Partial -): fragment is FragmentType { + data: FragmentType, any>> | null | undefined +): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; @@ -61,5 +61,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => fragment && field in fragment); + return fields.length > 0 && fields.some(field => data && field in data); } diff --git a/examples/react/apollo-client/src/gql/graphql.ts b/examples/react/apollo-client/src/gql/graphql.ts index 70076f3c2a2..100bcd7ccd7 100644 --- a/examples/react/apollo-client/src/gql/graphql.ts +++ b/examples/react/apollo-client/src/gql/graphql.ts @@ -6,7 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/react/http-executor/src/gql/fragment-masking.ts b/examples/react/http-executor/src/gql/fragment-masking.ts index 49f6d4a5da7..0a94bd999f9 100644 --- a/examples/react/http-executor/src/gql/fragment-masking.ts +++ b/examples/react/http-executor/src/gql/fragment-masking.ts @@ -3,7 +3,7 @@ import { FragmentDefinitionNode } from 'graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration - ? TType extends { ' $fragmentName'?: infer TKey } + ? [TType] extends [{ ' $fragmentName'?: infer TKey }] ? TKey extends string ? { ' $fragmentRefs'?: { [key in TKey]: TType } } : never @@ -50,8 +50,8 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - fragment: Partial -): fragment is FragmentType { + data: FragmentType, any>> | null | undefined +): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; @@ -61,5 +61,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => fragment && field in fragment); + return fields.length > 0 && fields.some(field => data && field in data); } diff --git a/examples/react/http-executor/src/gql/graphql.ts b/examples/react/http-executor/src/gql/graphql.ts index 70076f3c2a2..100bcd7ccd7 100644 --- a/examples/react/http-executor/src/gql/graphql.ts +++ b/examples/react/http-executor/src/gql/graphql.ts @@ -6,7 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/react/nextjs-swr/gql/fragment-masking.ts b/examples/react/nextjs-swr/gql/fragment-masking.ts index 49f6d4a5da7..0a94bd999f9 100644 --- a/examples/react/nextjs-swr/gql/fragment-masking.ts +++ b/examples/react/nextjs-swr/gql/fragment-masking.ts @@ -3,7 +3,7 @@ import { FragmentDefinitionNode } from 'graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration - ? TType extends { ' $fragmentName'?: infer TKey } + ? [TType] extends [{ ' $fragmentName'?: infer TKey }] ? TKey extends string ? { ' $fragmentRefs'?: { [key in TKey]: TType } } : never @@ -50,8 +50,8 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - fragment: Partial -): fragment is FragmentType { + data: FragmentType, any>> | null | undefined +): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; @@ -61,5 +61,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => fragment && field in fragment); + return fields.length > 0 && fields.some(field => data && field in data); } diff --git a/examples/react/nextjs-swr/gql/graphql.ts b/examples/react/nextjs-swr/gql/graphql.ts index e6bec1f6171..5b8106ff6f1 100644 --- a/examples/react/nextjs-swr/gql/graphql.ts +++ b/examples/react/nextjs-swr/gql/graphql.ts @@ -6,7 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/react/tanstack-react-query/src/gql/fragment-masking.ts b/examples/react/tanstack-react-query/src/gql/fragment-masking.ts index a47ee0591f8..804c024e33c 100644 --- a/examples/react/tanstack-react-query/src/gql/fragment-masking.ts +++ b/examples/react/tanstack-react-query/src/gql/fragment-masking.ts @@ -3,7 +3,7 @@ import { TypedDocumentString } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration - ? TType extends { ' $fragmentName'?: infer TKey } + ? [TType] extends [{ ' $fragmentName'?: infer TKey }] ? TKey extends string ? { ' $fragmentRefs'?: { [key in TKey]: TType } } : never @@ -50,8 +50,8 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: TypedDocumentString, fragmentNode: TypedDocumentString, - fragment: Partial -): fragment is FragmentType { + data: FragmentType, any>> | null | undefined +): data is FragmentType { const deferredFields = queryNode.__meta__?.deferredFields as Record; if (!deferredFields) return true; @@ -59,5 +59,5 @@ export function isFragmentReady( const fragName = fragmentNode.__meta__?.fragmentName; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => fragment && field in fragment); + return fields.length > 0 && fields.some(field => data && field in data); } diff --git a/examples/react/tanstack-react-query/src/gql/graphql.ts b/examples/react/tanstack-react-query/src/gql/graphql.ts index ed57b0866f2..b5e81ccaa97 100644 --- a/examples/react/tanstack-react-query/src/gql/graphql.ts +++ b/examples/react/tanstack-react-query/src/gql/graphql.ts @@ -6,7 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/react/urql/src/gql/fragment-masking.ts b/examples/react/urql/src/gql/fragment-masking.ts index a47ee0591f8..804c024e33c 100644 --- a/examples/react/urql/src/gql/fragment-masking.ts +++ b/examples/react/urql/src/gql/fragment-masking.ts @@ -3,7 +3,7 @@ import { TypedDocumentString } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration - ? TType extends { ' $fragmentName'?: infer TKey } + ? [TType] extends [{ ' $fragmentName'?: infer TKey }] ? TKey extends string ? { ' $fragmentRefs'?: { [key in TKey]: TType } } : never @@ -50,8 +50,8 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: TypedDocumentString, fragmentNode: TypedDocumentString, - fragment: Partial -): fragment is FragmentType { + data: FragmentType, any>> | null | undefined +): data is FragmentType { const deferredFields = queryNode.__meta__?.deferredFields as Record; if (!deferredFields) return true; @@ -59,5 +59,5 @@ export function isFragmentReady( const fragName = fragmentNode.__meta__?.fragmentName; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => fragment && field in fragment); + return fields.length > 0 && fields.some(field => data && field in data); } diff --git a/examples/react/urql/src/gql/graphql.ts b/examples/react/urql/src/gql/graphql.ts index 8a320883fd1..ee56c52ce1b 100644 --- a/examples/react/urql/src/gql/graphql.ts +++ b/examples/react/urql/src/gql/graphql.ts @@ -6,7 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/typescript-esm/src/gql/fragment-masking.ts b/examples/typescript-esm/src/gql/fragment-masking.ts index 49f6d4a5da7..0a94bd999f9 100644 --- a/examples/typescript-esm/src/gql/fragment-masking.ts +++ b/examples/typescript-esm/src/gql/fragment-masking.ts @@ -3,7 +3,7 @@ import { FragmentDefinitionNode } from 'graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration - ? TType extends { ' $fragmentName'?: infer TKey } + ? [TType] extends [{ ' $fragmentName'?: infer TKey }] ? TKey extends string ? { ' $fragmentRefs'?: { [key in TKey]: TType } } : never @@ -50,8 +50,8 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - fragment: Partial -): fragment is FragmentType { + data: FragmentType, any>> | null | undefined +): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; @@ -61,5 +61,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => fragment && field in fragment); + return fields.length > 0 && fields.some(field => data && field in data); } diff --git a/examples/typescript-esm/src/gql/graphql.ts b/examples/typescript-esm/src/gql/graphql.ts index eb327a88572..24283c0e2d9 100644 --- a/examples/typescript-esm/src/gql/graphql.ts +++ b/examples/typescript-esm/src/gql/graphql.ts @@ -6,7 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/typescript-graphql-request/src/gql/fragment-masking.ts b/examples/typescript-graphql-request/src/gql/fragment-masking.ts index a47ee0591f8..804c024e33c 100644 --- a/examples/typescript-graphql-request/src/gql/fragment-masking.ts +++ b/examples/typescript-graphql-request/src/gql/fragment-masking.ts @@ -3,7 +3,7 @@ import { TypedDocumentString } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration - ? TType extends { ' $fragmentName'?: infer TKey } + ? [TType] extends [{ ' $fragmentName'?: infer TKey }] ? TKey extends string ? { ' $fragmentRefs'?: { [key in TKey]: TType } } : never @@ -50,8 +50,8 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: TypedDocumentString, fragmentNode: TypedDocumentString, - fragment: Partial -): fragment is FragmentType { + data: FragmentType, any>> | null | undefined +): data is FragmentType { const deferredFields = queryNode.__meta__?.deferredFields as Record; if (!deferredFields) return true; @@ -59,5 +59,5 @@ export function isFragmentReady( const fragName = fragmentNode.__meta__?.fragmentName; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => fragment && field in fragment); + return fields.length > 0 && fields.some(field => data && field in data); } diff --git a/examples/typescript-graphql-request/src/gql/graphql.ts b/examples/typescript-graphql-request/src/gql/graphql.ts index e191fe97021..a849c32238d 100644 --- a/examples/typescript-graphql-request/src/gql/graphql.ts +++ b/examples/typescript-graphql-request/src/gql/graphql.ts @@ -6,7 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/typescript-resolvers/src/type-defs.d.ts b/examples/typescript-resolvers/src/type-defs.d.ts index 7e62e1ebcb2..3efc5d2730b 100644 --- a/examples/typescript-resolvers/src/type-defs.d.ts +++ b/examples/typescript-resolvers/src/type-defs.d.ts @@ -5,7 +5,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; export type RequireFields = Omit & { [P in K]-?: NonNullable }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { diff --git a/examples/vite/vite-react-cts/src/gql/fragment-masking.ts b/examples/vite/vite-react-cts/src/gql/fragment-masking.ts index 49f6d4a5da7..0a94bd999f9 100644 --- a/examples/vite/vite-react-cts/src/gql/fragment-masking.ts +++ b/examples/vite/vite-react-cts/src/gql/fragment-masking.ts @@ -3,7 +3,7 @@ import { FragmentDefinitionNode } from 'graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration - ? TType extends { ' $fragmentName'?: infer TKey } + ? [TType] extends [{ ' $fragmentName'?: infer TKey }] ? TKey extends string ? { ' $fragmentRefs'?: { [key in TKey]: TType } } : never @@ -50,8 +50,8 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - fragment: Partial -): fragment is FragmentType { + data: FragmentType, any>> | null | undefined +): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; @@ -61,5 +61,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => fragment && field in fragment); + return fields.length > 0 && fields.some(field => data && field in data); } diff --git a/examples/vite/vite-react-cts/src/gql/graphql.ts b/examples/vite/vite-react-cts/src/gql/graphql.ts index e6bec1f6171..5b8106ff6f1 100644 --- a/examples/vite/vite-react-cts/src/gql/graphql.ts +++ b/examples/vite/vite-react-cts/src/gql/graphql.ts @@ -6,7 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/vite/vite-react-mts/src/gql/fragment-masking.ts b/examples/vite/vite-react-mts/src/gql/fragment-masking.ts index 49f6d4a5da7..0a94bd999f9 100644 --- a/examples/vite/vite-react-mts/src/gql/fragment-masking.ts +++ b/examples/vite/vite-react-mts/src/gql/fragment-masking.ts @@ -3,7 +3,7 @@ import { FragmentDefinitionNode } from 'graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration - ? TType extends { ' $fragmentName'?: infer TKey } + ? [TType] extends [{ ' $fragmentName'?: infer TKey }] ? TKey extends string ? { ' $fragmentRefs'?: { [key in TKey]: TType } } : never @@ -50,8 +50,8 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - fragment: Partial -): fragment is FragmentType { + data: FragmentType, any>> | null | undefined +): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; @@ -61,5 +61,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => fragment && field in fragment); + return fields.length > 0 && fields.some(field => data && field in data); } diff --git a/examples/vite/vite-react-mts/src/gql/graphql.ts b/examples/vite/vite-react-mts/src/gql/graphql.ts index e6bec1f6171..5b8106ff6f1 100644 --- a/examples/vite/vite-react-mts/src/gql/graphql.ts +++ b/examples/vite/vite-react-mts/src/gql/graphql.ts @@ -6,7 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/vite/vite-react-ts/src/gql/fragment-masking.ts b/examples/vite/vite-react-ts/src/gql/fragment-masking.ts index 49f6d4a5da7..0a94bd999f9 100644 --- a/examples/vite/vite-react-ts/src/gql/fragment-masking.ts +++ b/examples/vite/vite-react-ts/src/gql/fragment-masking.ts @@ -3,7 +3,7 @@ import { FragmentDefinitionNode } from 'graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration - ? TType extends { ' $fragmentName'?: infer TKey } + ? [TType] extends [{ ' $fragmentName'?: infer TKey }] ? TKey extends string ? { ' $fragmentRefs'?: { [key in TKey]: TType } } : never @@ -50,8 +50,8 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - fragment: Partial -): fragment is FragmentType { + data: FragmentType, any>> | null | undefined +): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; @@ -61,5 +61,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => fragment && field in fragment); + return fields.length > 0 && fields.some(field => data && field in data); } diff --git a/examples/vite/vite-react-ts/src/gql/graphql.ts b/examples/vite/vite-react-ts/src/gql/graphql.ts index e6bec1f6171..5b8106ff6f1 100644 --- a/examples/vite/vite-react-ts/src/gql/graphql.ts +++ b/examples/vite/vite-react-ts/src/gql/graphql.ts @@ -6,7 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/vue/apollo-composable/src/gql/fragment-masking.ts b/examples/vue/apollo-composable/src/gql/fragment-masking.ts index 8016e13bdf1..845d65fc8ab 100644 --- a/examples/vue/apollo-composable/src/gql/fragment-masking.ts +++ b/examples/vue/apollo-composable/src/gql/fragment-masking.ts @@ -3,7 +3,7 @@ import type { FragmentDefinitionNode } from 'graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration - ? TType extends { ' $fragmentName'?: infer TKey } + ? [TType] extends [{ ' $fragmentName'?: infer TKey }] ? TKey extends string ? { ' $fragmentRefs'?: { [key in TKey]: TType } } : never @@ -50,8 +50,8 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - fragment: Partial -): fragment is FragmentType { + data: FragmentType, any>> | null | undefined +): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; @@ -61,5 +61,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => fragment && field in fragment); + return fields.length > 0 && fields.some(field => data && field in data); } diff --git a/examples/vue/apollo-composable/src/gql/graphql.ts b/examples/vue/apollo-composable/src/gql/graphql.ts index 565d8430272..a70aaf50ae7 100644 --- a/examples/vue/apollo-composable/src/gql/graphql.ts +++ b/examples/vue/apollo-composable/src/gql/graphql.ts @@ -6,7 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/vue/urql/src/gql/fragment-masking.ts b/examples/vue/urql/src/gql/fragment-masking.ts index 8016e13bdf1..845d65fc8ab 100644 --- a/examples/vue/urql/src/gql/fragment-masking.ts +++ b/examples/vue/urql/src/gql/fragment-masking.ts @@ -3,7 +3,7 @@ import type { FragmentDefinitionNode } from 'graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration - ? TType extends { ' $fragmentName'?: infer TKey } + ? [TType] extends [{ ' $fragmentName'?: infer TKey }] ? TKey extends string ? { ' $fragmentRefs'?: { [key in TKey]: TType } } : never @@ -50,8 +50,8 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - fragment: Partial -): fragment is FragmentType { + data: FragmentType, any>> | null | undefined +): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; @@ -61,5 +61,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => fragment && field in fragment); + return fields.length > 0 && fields.some(field => data && field in data); } diff --git a/examples/vue/urql/src/gql/graphql.ts b/examples/vue/urql/src/gql/graphql.ts index 565d8430272..a70aaf50ae7 100644 --- a/examples/vue/urql/src/gql/graphql.ts +++ b/examples/vue/urql/src/gql/graphql.ts @@ -6,7 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/vue/villus/src/gql/fragment-masking.ts b/examples/vue/villus/src/gql/fragment-masking.ts index 8016e13bdf1..845d65fc8ab 100644 --- a/examples/vue/villus/src/gql/fragment-masking.ts +++ b/examples/vue/villus/src/gql/fragment-masking.ts @@ -3,7 +3,7 @@ import type { FragmentDefinitionNode } from 'graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration - ? TType extends { ' $fragmentName'?: infer TKey } + ? [TType] extends [{ ' $fragmentName'?: infer TKey }] ? TKey extends string ? { ' $fragmentRefs'?: { [key in TKey]: TType } } : never @@ -50,8 +50,8 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - fragment: Partial -): fragment is FragmentType { + data: FragmentType, any>> | null | undefined +): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; @@ -61,5 +61,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => fragment && field in fragment); + return fields.length > 0 && fields.some(field => data && field in data); } diff --git a/examples/vue/villus/src/gql/graphql.ts b/examples/vue/villus/src/gql/graphql.ts index 565d8430272..a70aaf50ae7 100644 --- a/examples/vue/villus/src/gql/graphql.ts +++ b/examples/vue/villus/src/gql/graphql.ts @@ -6,7 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/examples/yoga-tests/src/gql/fragment-masking.ts b/examples/yoga-tests/src/gql/fragment-masking.ts index 49f6d4a5da7..0a94bd999f9 100644 --- a/examples/yoga-tests/src/gql/fragment-masking.ts +++ b/examples/yoga-tests/src/gql/fragment-masking.ts @@ -3,7 +3,7 @@ import { FragmentDefinitionNode } from 'graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration - ? TType extends { ' $fragmentName'?: infer TKey } + ? [TType] extends [{ ' $fragmentName'?: infer TKey }] ? TKey extends string ? { ' $fragmentRefs'?: { [key in TKey]: TType } } : never @@ -50,8 +50,8 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - fragment: Partial -): fragment is FragmentType { + data: FragmentType, any>> | null | undefined +): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; @@ -61,5 +61,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => fragment && field in fragment); + return fields.length > 0 && fields.some(field => data && field in data); } diff --git a/examples/yoga-tests/src/gql/graphql.ts b/examples/yoga-tests/src/gql/graphql.ts index 0c75ab686bc..cea15891bec 100644 --- a/examples/yoga-tests/src/gql/graphql.ts +++ b/examples/yoga-tests/src/gql/graphql.ts @@ -6,7 +6,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/packages/plugins/typescript/operations/tests/__snapshots__/ts-documents.spec.ts.snap b/packages/plugins/typescript/operations/tests/__snapshots__/ts-documents.spec.ts.snap index bf869b9fcdf..024e0bd3138 100644 --- a/packages/plugins/typescript/operations/tests/__snapshots__/ts-documents.spec.ts.snap +++ b/packages/plugins/typescript/operations/tests/__snapshots__/ts-documents.spec.ts.snap @@ -70,7 +70,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -361,7 +361,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -479,7 +479,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -574,7 +574,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/packages/plugins/typescript/operations/tests/ts-documents.spec.ts b/packages/plugins/typescript/operations/tests/ts-documents.spec.ts index 148787b59c6..7447163c474 100644 --- a/packages/plugins/typescript/operations/tests/ts-documents.spec.ts +++ b/packages/plugins/typescript/operations/tests/ts-documents.spec.ts @@ -4050,7 +4050,7 @@ describe('TypeScript Operations Plugin', () => { export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = T | { [P in keyof T]?: never }; + export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -4160,7 +4160,7 @@ describe('TypeScript Operations Plugin', () => { export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = T | { [P in keyof T]?: never }; + export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -4248,7 +4248,7 @@ describe('TypeScript Operations Plugin', () => { export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = T | { [P in keyof T]?: never }; + export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; diff --git a/packages/plugins/typescript/resolvers/tests/__snapshots__/ts-resolvers.spec.ts.snap b/packages/plugins/typescript/resolvers/tests/__snapshots__/ts-resolvers.spec.ts.snap index 46e3c8685e9..2085e5f1527 100644 --- a/packages/plugins/typescript/resolvers/tests/__snapshots__/ts-resolvers.spec.ts.snap +++ b/packages/plugins/typescript/resolvers/tests/__snapshots__/ts-resolvers.spec.ts.snap @@ -7,7 +7,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; import { GraphQLResolveInfo, GraphQLScalarType, GraphQLScalarTypeConfig } from 'graphql'; export type Omit = Pick>; export type RequireFields = Omit & { [P in K]-?: NonNullable }; @@ -607,7 +607,7 @@ export type Exact = { [K in keyof T]: T[K] export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; import { GraphQLResolveInfo, GraphQLScalarType, GraphQLScalarTypeConfig } from 'graphql'; export type Omit = Pick>; export type RequireFields = Omit & { [P in K]-?: NonNullable }; diff --git a/packages/plugins/typescript/typescript/src/visitor.ts b/packages/plugins/typescript/typescript/src/visitor.ts index 810a1182e39..cb8d08b81df 100644 --- a/packages/plugins/typescript/typescript/src/visitor.ts +++ b/packages/plugins/typescript/typescript/src/visitor.ts @@ -50,7 +50,7 @@ export const EXACT_SIGNATURE = `type Exact export const MAKE_OPTIONAL_SIGNATURE = `type MakeOptional = Omit & { [SubKey in K]?: Maybe };`; export const MAKE_MAYBE_SIGNATURE = `type MakeMaybe = Omit & { [SubKey in K]: Maybe };`; export const MAKE_EMPTY_SIGNATURE = `type MakeEmpty = { [_ in K]?: never };`; -export const MAKE_INCREMENTAL_SIGNATURE = `type Incremental = T | { [P in keyof T]?: never };`; +export const MAKE_INCREMENTAL_SIGNATURE = `type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };`; export class TsVisitor< TRawConfig extends TypeScriptPluginConfig = TypeScriptPluginConfig, diff --git a/packages/presets/client/src/fragment-masking-plugin.ts b/packages/presets/client/src/fragment-masking-plugin.ts index e53cf217dca..01c7b2d05fa 100644 --- a/packages/presets/client/src/fragment-masking-plugin.ts +++ b/packages/presets/client/src/fragment-masking-plugin.ts @@ -5,7 +5,7 @@ export type FragmentType> infer TType, any > - ? TType extends { ' $fragmentName'?: infer TKey } + ? [TType] extends [{ ' $fragmentName'?: infer TKey }] ? TKey extends string ? { ' $fragmentRefs'?: { [key in TKey]: TType } } : never @@ -78,8 +78,8 @@ const isFragmentReadyFunction = (isStringDocumentMode: boolean) => { export function isFragmentReady( queryNode: TypedDocumentString, fragmentNode: TypedDocumentString, - fragment: Partial -): fragment is FragmentType { + data: FragmentType, any>> | null | undefined +): data is FragmentType { const deferredFields = queryNode.__meta__?.deferredFields as Record; if (!deferredFields) return true; @@ -87,7 +87,7 @@ export function isFragmentReady( const fragName = fragmentNode.__meta__?.fragmentName; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => fragment && field in fragment); + return fields.length > 0 && fields.some(field => data && field in data); } `; } @@ -95,8 +95,8 @@ export function isFragmentReady( export function isFragmentReady( queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - fragment: Partial -): fragment is FragmentType { + data: FragmentType, any>> | null | undefined +): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; @@ -106,7 +106,7 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => fragment && field in fragment); + return fields.length > 0 && fields.some(field => data && field in data); } `; }; diff --git a/packages/presets/client/tests/client-preset.spec.ts b/packages/presets/client/tests/client-preset.spec.ts index 97d09c9bfcc..698252f6687 100644 --- a/packages/presets/client/tests/client-preset.spec.ts +++ b/packages/presets/client/tests/client-preset.spec.ts @@ -344,7 +344,7 @@ export * from "./gql";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = T | { [P in keyof T]?: never }; + export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -474,7 +474,7 @@ export * from "./gql";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = T | { [P in keyof T]?: never }; + export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -587,7 +587,7 @@ export * from "./gql";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = T | { [P in keyof T]?: never }; + export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -762,7 +762,7 @@ export * from "./gql";`); infer TType, any > - ? TType extends { ' $fragmentName'?: infer TKey } + ? [TType] extends [{ ' $fragmentName'?: infer TKey }] ? TKey extends string ? { ' $fragmentRefs'?: { [key in TKey]: TType } } : never @@ -806,8 +806,8 @@ export * from "./gql";`); export function isFragmentReady( queryNode: DocumentTypeDecoration, fragmentNode: TypedDocumentNode, - fragment: Partial - ): fragment is FragmentType { + data: FragmentType, any>> | null | undefined + ): data is FragmentType { const deferredFields = (queryNode as { __meta__?: { deferredFields: Record } }).__meta__ ?.deferredFields; @@ -817,7 +817,7 @@ export * from "./gql";`); const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => fragment && field in fragment); + return fields.length > 0 && fields.some(field => data && field in data); } " `); @@ -1252,7 +1252,7 @@ export * from "./gql.js";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = T | { [P in keyof T]?: never }; + export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -1330,7 +1330,7 @@ export * from "./gql.js";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = T | { [P in keyof T]?: never }; + export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -1411,7 +1411,7 @@ export * from "./gql.js";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = T | { [P in keyof T]?: never }; + export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -1492,7 +1492,7 @@ export * from "./gql.js";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = T | { [P in keyof T]?: never }; + export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -1575,7 +1575,7 @@ export * from "./gql.js";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = T | { [P in keyof T]?: never }; + export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -1665,7 +1665,7 @@ export * from "./gql.js";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = T | { [P in keyof T]?: never }; + export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -1743,7 +1743,7 @@ export * from "./gql.js";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = T | { [P in keyof T]?: never }; + export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -1823,7 +1823,7 @@ export * from "./gql.js";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = T | { [P in keyof T]?: never }; + export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -1903,7 +1903,7 @@ export * from "./gql.js";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = T | { [P in keyof T]?: never }; + export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -2020,7 +2020,7 @@ export * from "./gql.js";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = T | { [P in keyof T]?: never }; + export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; @@ -2136,7 +2136,7 @@ export * from "./gql.js";`); export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; export type MakeEmpty = { [_ in K]?: never }; - export type Incremental = T | { [P in keyof T]?: never }; + export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; From 2cbe236873b2b07aedff10e23ecc412635cbd9ce Mon Sep 17 00:00:00 2001 From: beerose Date: Thu, 6 Apr 2023 16:35:13 +0200 Subject: [PATCH 41/47] Add missing import --- .../gql/fragment-masking.ts | 1 + .../gql-tag-operations-urql/gql/fragment-masking.ts | 1 + dev-test/gql-tag-operations/gql/fragment-masking.ts | 1 + .../gql-tag-operations/graphql/fragment-masking.ts | 1 + .../src/gql/fragment-masking.ts | 2 +- .../persisted-documents/src/gql/fragment-masking.ts | 1 + .../apollo-client-defer/src/gql/fragment-masking.ts | 1 + .../src/gql/fragment-masking.ts | 1 + .../react/apollo-client/src/gql/fragment-masking.ts | 1 + .../react/http-executor/src/gql/fragment-masking.ts | 1 + examples/react/nextjs-swr/gql/fragment-masking.ts | 1 + .../tanstack-react-query/src/gql/fragment-masking.ts | 2 +- examples/react/urql/src/gql/fragment-masking.ts | 2 +- examples/typescript-esm/src/gql/fragment-masking.ts | 1 + .../src/gql/fragment-masking.ts | 2 +- .../vite/vite-react-cts/src/gql/fragment-masking.ts | 1 + .../vite/vite-react-mts/src/gql/fragment-masking.ts | 1 + .../vite/vite-react-ts/src/gql/fragment-masking.ts | 1 + .../vue/apollo-composable/src/gql/fragment-masking.ts | 1 + examples/vue/urql/src/gql/fragment-masking.ts | 1 + examples/vue/villus/src/gql/fragment-masking.ts | 1 + examples/yoga-tests/src/gql/fragment-masking.ts | 1 + .../presets/client/src/fragment-masking-plugin.ts | 11 +++++++---- packages/presets/client/tests/client-preset.spec.ts | 1 + 24 files changed, 30 insertions(+), 8 deletions(-) diff --git a/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts b/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts index 0a94bd999f9..0763aa9d853 100644 --- a/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts +++ b/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts @@ -1,5 +1,6 @@ import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; import { FragmentDefinitionNode } from 'graphql'; +import { Incremental } from './graphql.js'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts b/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts index 0a94bd999f9..0763aa9d853 100644 --- a/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts +++ b/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts @@ -1,5 +1,6 @@ import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; import { FragmentDefinitionNode } from 'graphql'; +import { Incremental } from './graphql.js'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/dev-test/gql-tag-operations/gql/fragment-masking.ts b/dev-test/gql-tag-operations/gql/fragment-masking.ts index 0a94bd999f9..0763aa9d853 100644 --- a/dev-test/gql-tag-operations/gql/fragment-masking.ts +++ b/dev-test/gql-tag-operations/gql/fragment-masking.ts @@ -1,5 +1,6 @@ import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; import { FragmentDefinitionNode } from 'graphql'; +import { Incremental } from './graphql.js'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/dev-test/gql-tag-operations/graphql/fragment-masking.ts b/dev-test/gql-tag-operations/graphql/fragment-masking.ts index 0a94bd999f9..0763aa9d853 100644 --- a/dev-test/gql-tag-operations/graphql/fragment-masking.ts +++ b/dev-test/gql-tag-operations/graphql/fragment-masking.ts @@ -1,5 +1,6 @@ import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; import { FragmentDefinitionNode } from 'graphql'; +import { Incremental } from './graphql.js'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts b/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts index 804c024e33c..a5aeadf3e07 100644 --- a/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts +++ b/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts @@ -1,5 +1,5 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { TypedDocumentString } from './graphql'; +import { Incremental, TypedDocumentString } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/examples/persisted-documents/src/gql/fragment-masking.ts b/examples/persisted-documents/src/gql/fragment-masking.ts index 0a94bd999f9..e20750b362f 100644 --- a/examples/persisted-documents/src/gql/fragment-masking.ts +++ b/examples/persisted-documents/src/gql/fragment-masking.ts @@ -1,5 +1,6 @@ import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; import { FragmentDefinitionNode } from 'graphql'; +import { Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/examples/react/apollo-client-defer/src/gql/fragment-masking.ts b/examples/react/apollo-client-defer/src/gql/fragment-masking.ts index 0a94bd999f9..e20750b362f 100644 --- a/examples/react/apollo-client-defer/src/gql/fragment-masking.ts +++ b/examples/react/apollo-client-defer/src/gql/fragment-masking.ts @@ -1,5 +1,6 @@ import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; import { FragmentDefinitionNode } from 'graphql'; +import { Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts b/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts index 0a94bd999f9..e20750b362f 100644 --- a/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts +++ b/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts @@ -1,5 +1,6 @@ import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; import { FragmentDefinitionNode } from 'graphql'; +import { Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/examples/react/apollo-client/src/gql/fragment-masking.ts b/examples/react/apollo-client/src/gql/fragment-masking.ts index 0a94bd999f9..e20750b362f 100644 --- a/examples/react/apollo-client/src/gql/fragment-masking.ts +++ b/examples/react/apollo-client/src/gql/fragment-masking.ts @@ -1,5 +1,6 @@ import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; import { FragmentDefinitionNode } from 'graphql'; +import { Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/examples/react/http-executor/src/gql/fragment-masking.ts b/examples/react/http-executor/src/gql/fragment-masking.ts index 0a94bd999f9..e20750b362f 100644 --- a/examples/react/http-executor/src/gql/fragment-masking.ts +++ b/examples/react/http-executor/src/gql/fragment-masking.ts @@ -1,5 +1,6 @@ import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; import { FragmentDefinitionNode } from 'graphql'; +import { Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/examples/react/nextjs-swr/gql/fragment-masking.ts b/examples/react/nextjs-swr/gql/fragment-masking.ts index 0a94bd999f9..e20750b362f 100644 --- a/examples/react/nextjs-swr/gql/fragment-masking.ts +++ b/examples/react/nextjs-swr/gql/fragment-masking.ts @@ -1,5 +1,6 @@ import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; import { FragmentDefinitionNode } from 'graphql'; +import { Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/examples/react/tanstack-react-query/src/gql/fragment-masking.ts b/examples/react/tanstack-react-query/src/gql/fragment-masking.ts index 804c024e33c..a5aeadf3e07 100644 --- a/examples/react/tanstack-react-query/src/gql/fragment-masking.ts +++ b/examples/react/tanstack-react-query/src/gql/fragment-masking.ts @@ -1,5 +1,5 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { TypedDocumentString } from './graphql'; +import { Incremental, TypedDocumentString } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/examples/react/urql/src/gql/fragment-masking.ts b/examples/react/urql/src/gql/fragment-masking.ts index 804c024e33c..a5aeadf3e07 100644 --- a/examples/react/urql/src/gql/fragment-masking.ts +++ b/examples/react/urql/src/gql/fragment-masking.ts @@ -1,5 +1,5 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { TypedDocumentString } from './graphql'; +import { Incremental, TypedDocumentString } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/examples/typescript-esm/src/gql/fragment-masking.ts b/examples/typescript-esm/src/gql/fragment-masking.ts index 0a94bd999f9..0763aa9d853 100644 --- a/examples/typescript-esm/src/gql/fragment-masking.ts +++ b/examples/typescript-esm/src/gql/fragment-masking.ts @@ -1,5 +1,6 @@ import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; import { FragmentDefinitionNode } from 'graphql'; +import { Incremental } from './graphql.js'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/examples/typescript-graphql-request/src/gql/fragment-masking.ts b/examples/typescript-graphql-request/src/gql/fragment-masking.ts index 804c024e33c..a5aeadf3e07 100644 --- a/examples/typescript-graphql-request/src/gql/fragment-masking.ts +++ b/examples/typescript-graphql-request/src/gql/fragment-masking.ts @@ -1,5 +1,5 @@ import { ResultOf, DocumentTypeDecoration } from '@graphql-typed-document-node/core'; -import { TypedDocumentString } from './graphql'; +import { Incremental, TypedDocumentString } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/examples/vite/vite-react-cts/src/gql/fragment-masking.ts b/examples/vite/vite-react-cts/src/gql/fragment-masking.ts index 0a94bd999f9..e20750b362f 100644 --- a/examples/vite/vite-react-cts/src/gql/fragment-masking.ts +++ b/examples/vite/vite-react-cts/src/gql/fragment-masking.ts @@ -1,5 +1,6 @@ import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; import { FragmentDefinitionNode } from 'graphql'; +import { Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/examples/vite/vite-react-mts/src/gql/fragment-masking.ts b/examples/vite/vite-react-mts/src/gql/fragment-masking.ts index 0a94bd999f9..e20750b362f 100644 --- a/examples/vite/vite-react-mts/src/gql/fragment-masking.ts +++ b/examples/vite/vite-react-mts/src/gql/fragment-masking.ts @@ -1,5 +1,6 @@ import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; import { FragmentDefinitionNode } from 'graphql'; +import { Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/examples/vite/vite-react-ts/src/gql/fragment-masking.ts b/examples/vite/vite-react-ts/src/gql/fragment-masking.ts index 0a94bd999f9..e20750b362f 100644 --- a/examples/vite/vite-react-ts/src/gql/fragment-masking.ts +++ b/examples/vite/vite-react-ts/src/gql/fragment-masking.ts @@ -1,5 +1,6 @@ import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; import { FragmentDefinitionNode } from 'graphql'; +import { Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/examples/vue/apollo-composable/src/gql/fragment-masking.ts b/examples/vue/apollo-composable/src/gql/fragment-masking.ts index 845d65fc8ab..56d922edcb4 100644 --- a/examples/vue/apollo-composable/src/gql/fragment-masking.ts +++ b/examples/vue/apollo-composable/src/gql/fragment-masking.ts @@ -1,5 +1,6 @@ import type { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; import type { FragmentDefinitionNode } from 'graphql'; +import type { Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/examples/vue/urql/src/gql/fragment-masking.ts b/examples/vue/urql/src/gql/fragment-masking.ts index 845d65fc8ab..56d922edcb4 100644 --- a/examples/vue/urql/src/gql/fragment-masking.ts +++ b/examples/vue/urql/src/gql/fragment-masking.ts @@ -1,5 +1,6 @@ import type { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; import type { FragmentDefinitionNode } from 'graphql'; +import type { Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/examples/vue/villus/src/gql/fragment-masking.ts b/examples/vue/villus/src/gql/fragment-masking.ts index 845d65fc8ab..56d922edcb4 100644 --- a/examples/vue/villus/src/gql/fragment-masking.ts +++ b/examples/vue/villus/src/gql/fragment-masking.ts @@ -1,5 +1,6 @@ import type { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; import type { FragmentDefinitionNode } from 'graphql'; +import type { Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/examples/yoga-tests/src/gql/fragment-masking.ts b/examples/yoga-tests/src/gql/fragment-masking.ts index 0a94bd999f9..e20750b362f 100644 --- a/examples/yoga-tests/src/gql/fragment-masking.ts +++ b/examples/yoga-tests/src/gql/fragment-masking.ts @@ -1,5 +1,6 @@ import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; import { FragmentDefinitionNode } from 'graphql'; +import { Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration diff --git a/packages/presets/client/src/fragment-masking-plugin.ts b/packages/presets/client/src/fragment-masking-plugin.ts index 01c7b2d05fa..83114be76ed 100644 --- a/packages/presets/client/src/fragment-masking-plugin.ts +++ b/packages/presets/client/src/fragment-masking-plugin.ts @@ -130,15 +130,18 @@ export const plugin: PluginFunction<{ isStringDocumentMode ? '' : ', TypedDocumentNode' } } from '@graphql-typed-document-node/core';\n`; - const deferFragmentHelperImports = isStringDocumentMode - ? `${useTypeImports ? 'import type' : 'import'} { TypedDocumentString } from './graphql${ - emitLegacyCommonJSImports ? '' : '.js' - }';\n` + const deferFragmentHelperImports = `${useTypeImports ? 'import type' : 'import'} { Incremental${ + isStringDocumentMode ? ', TypedDocumentString' : '' + } } from './graphql${emitLegacyCommonJSImports ? '' : '.js'}';\n`; + + const fragmentDefinitionNodeImport = isStringDocumentMode + ? '' : `${useTypeImports ? 'import type' : 'import'} { FragmentDefinitionNode } from 'graphql';\n`; if (augmentedModuleName == null) { return [ documentNodeImport, + fragmentDefinitionNodeImport, deferFragmentHelperImports, `\n`, fragmentTypeHelper, diff --git a/packages/presets/client/tests/client-preset.spec.ts b/packages/presets/client/tests/client-preset.spec.ts index 698252f6687..d7067ae39a1 100644 --- a/packages/presets/client/tests/client-preset.spec.ts +++ b/packages/presets/client/tests/client-preset.spec.ts @@ -756,6 +756,7 @@ export * from "./gql";`); expect(gqlFile.content).toMatchInlineSnapshot(` "import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core'; import { FragmentDefinitionNode } from 'graphql'; + import { Incremental } from './graphql'; export type FragmentType> = TDocumentType extends DocumentTypeDecoration< From c5d0247c8deaa17e4395171c93ac573356da08a1 Mon Sep 17 00:00:00 2001 From: beerose Date: Thu, 6 Apr 2023 16:44:39 +0200 Subject: [PATCH 42/47] Fix type --- packages/presets/client/src/fragment-masking-plugin.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/presets/client/src/fragment-masking-plugin.ts b/packages/presets/client/src/fragment-masking-plugin.ts index 83114be76ed..a429fd1df1e 100644 --- a/packages/presets/client/src/fragment-masking-plugin.ts +++ b/packages/presets/client/src/fragment-masking-plugin.ts @@ -78,7 +78,7 @@ const isFragmentReadyFunction = (isStringDocumentMode: boolean) => { export function isFragmentReady( queryNode: TypedDocumentString, fragmentNode: TypedDocumentString, - data: FragmentType, any>> | null | undefined + data: FragmentType, any>> | null | undefined ): data is FragmentType { const deferredFields = queryNode.__meta__?.deferredFields as Record; From bd970736c3824bb14940a3ba142bab01edb4b76e Mon Sep 17 00:00:00 2001 From: beerose Date: Thu, 6 Apr 2023 16:49:45 +0200 Subject: [PATCH 43/47] Update examples --- .../persisted-documents-string-mode/src/gql/fragment-masking.ts | 2 +- examples/react/tanstack-react-query/src/gql/fragment-masking.ts | 2 +- examples/react/urql/src/gql/fragment-masking.ts | 2 +- examples/typescript-graphql-request/src/gql/fragment-masking.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts b/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts index a5aeadf3e07..f4d67554283 100644 --- a/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts +++ b/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts @@ -50,7 +50,7 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: TypedDocumentString, fragmentNode: TypedDocumentString, - data: FragmentType, any>> | null | undefined + data: FragmentType, any>> | null | undefined ): data is FragmentType { const deferredFields = queryNode.__meta__?.deferredFields as Record; diff --git a/examples/react/tanstack-react-query/src/gql/fragment-masking.ts b/examples/react/tanstack-react-query/src/gql/fragment-masking.ts index a5aeadf3e07..f4d67554283 100644 --- a/examples/react/tanstack-react-query/src/gql/fragment-masking.ts +++ b/examples/react/tanstack-react-query/src/gql/fragment-masking.ts @@ -50,7 +50,7 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: TypedDocumentString, fragmentNode: TypedDocumentString, - data: FragmentType, any>> | null | undefined + data: FragmentType, any>> | null | undefined ): data is FragmentType { const deferredFields = queryNode.__meta__?.deferredFields as Record; diff --git a/examples/react/urql/src/gql/fragment-masking.ts b/examples/react/urql/src/gql/fragment-masking.ts index a5aeadf3e07..f4d67554283 100644 --- a/examples/react/urql/src/gql/fragment-masking.ts +++ b/examples/react/urql/src/gql/fragment-masking.ts @@ -50,7 +50,7 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: TypedDocumentString, fragmentNode: TypedDocumentString, - data: FragmentType, any>> | null | undefined + data: FragmentType, any>> | null | undefined ): data is FragmentType { const deferredFields = queryNode.__meta__?.deferredFields as Record; diff --git a/examples/typescript-graphql-request/src/gql/fragment-masking.ts b/examples/typescript-graphql-request/src/gql/fragment-masking.ts index a5aeadf3e07..f4d67554283 100644 --- a/examples/typescript-graphql-request/src/gql/fragment-masking.ts +++ b/examples/typescript-graphql-request/src/gql/fragment-masking.ts @@ -50,7 +50,7 @@ export function makeFragmentData, FT export function isFragmentReady( queryNode: TypedDocumentString, fragmentNode: TypedDocumentString, - data: FragmentType, any>> | null | undefined + data: FragmentType, any>> | null | undefined ): data is FragmentType { const deferredFields = queryNode.__meta__?.deferredFields as Record; From 1d451a88c46c2af1b6fef615654d57e406d407ca Mon Sep 17 00:00:00 2001 From: beerose Date: Thu, 6 Apr 2023 18:47:52 +0200 Subject: [PATCH 44/47] Change isFragmentReady condition --- dev-test/gql-tag-operations-masking/gql/fragment-masking.ts | 2 +- dev-test/gql-tag-operations-urql/gql/fragment-masking.ts | 2 +- dev-test/gql-tag-operations/gql/fragment-masking.ts | 2 +- dev-test/gql-tag-operations/graphql/fragment-masking.ts | 2 +- examples/persisted-documents-string-mode/package.json | 4 ++-- .../src/gql/fragment-masking.ts | 2 +- examples/persisted-documents/package.json | 2 +- examples/persisted-documents/src/gql/fragment-masking.ts | 2 +- .../react/apollo-client-defer/src/gql/fragment-masking.ts | 2 +- .../apollo-client-swc-plugin/src/gql/fragment-masking.ts | 2 +- examples/react/apollo-client/src/gql/fragment-masking.ts | 2 +- examples/react/http-executor/src/gql/fragment-masking.ts | 2 +- examples/react/nextjs-swr/gql/fragment-masking.ts | 2 +- .../react/tanstack-react-query/src/gql/fragment-masking.ts | 2 +- examples/react/urql/src/gql/fragment-masking.ts | 2 +- examples/typescript-esm/package.json | 4 ++-- examples/typescript-esm/src/gql/fragment-masking.ts | 2 +- examples/typescript-graphql-request/package.json | 4 ++-- .../typescript-graphql-request/src/gql/fragment-masking.ts | 2 +- examples/vite/vite-react-cts/package.json | 4 ++-- examples/vite/vite-react-cts/src/gql/fragment-masking.ts | 2 +- examples/vite/vite-react-mts/package.json | 4 ++-- examples/vite/vite-react-mts/src/gql/fragment-masking.ts | 2 +- examples/vite/vite-react-ts/package.json | 4 ++-- examples/vite/vite-react-ts/src/gql/fragment-masking.ts | 2 +- examples/vue/apollo-composable/src/gql/fragment-masking.ts | 2 +- examples/vue/urql/src/gql/fragment-masking.ts | 2 +- examples/vue/villus/src/gql/fragment-masking.ts | 2 +- examples/yoga-tests/src/gql/fragment-masking.ts | 2 +- packages/presets/client/src/fragment-masking-plugin.ts | 4 ++-- packages/presets/client/tests/client-preset.spec.ts | 2 +- 31 files changed, 38 insertions(+), 38 deletions(-) diff --git a/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts b/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts index 0763aa9d853..0cedfd53e94 100644 --- a/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts +++ b/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts @@ -62,5 +62,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in data); + return fields.length > 0 && fields.every(field => data && field in data); } diff --git a/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts b/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts index 0763aa9d853..0cedfd53e94 100644 --- a/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts +++ b/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts @@ -62,5 +62,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in data); + return fields.length > 0 && fields.every(field => data && field in data); } diff --git a/dev-test/gql-tag-operations/gql/fragment-masking.ts b/dev-test/gql-tag-operations/gql/fragment-masking.ts index 0763aa9d853..0cedfd53e94 100644 --- a/dev-test/gql-tag-operations/gql/fragment-masking.ts +++ b/dev-test/gql-tag-operations/gql/fragment-masking.ts @@ -62,5 +62,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in data); + return fields.length > 0 && fields.every(field => data && field in data); } diff --git a/dev-test/gql-tag-operations/graphql/fragment-masking.ts b/dev-test/gql-tag-operations/graphql/fragment-masking.ts index 0763aa9d853..0cedfd53e94 100644 --- a/dev-test/gql-tag-operations/graphql/fragment-masking.ts +++ b/dev-test/gql-tag-operations/graphql/fragment-masking.ts @@ -62,5 +62,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in data); + return fields.length > 0 && fields.every(field => data && field in data); } diff --git a/examples/persisted-documents-string-mode/package.json b/examples/persisted-documents-string-mode/package.json index d9b2740a79a..a18e033b96a 100644 --- a/examples/persisted-documents-string-mode/package.json +++ b/examples/persisted-documents-string-mode/package.json @@ -10,8 +10,8 @@ "@graphql-typed-document-node/core": "3.2.0", "jest": "28.1.3", "babel-jest": "28.1.3", - "@graphql-codegen/cli": "3.3.0", - "@graphql-codegen/client-preset": "3.0.0", + "@graphql-codegen/cli": "^3.3.0", + "@graphql-codegen/client-preset": "^3.0.0", "@babel/core": "7.21.4", "@babel/preset-env": "7.21.4", "@babel/preset-typescript": "7.21.4" diff --git a/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts b/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts index f4d67554283..f86d241c2c2 100644 --- a/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts +++ b/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts @@ -59,5 +59,5 @@ export function isFragmentReady( const fragName = fragmentNode.__meta__?.fragmentName; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in data); + return fields.length > 0 && fields.every(field => data && field in data); } diff --git a/examples/persisted-documents/package.json b/examples/persisted-documents/package.json index 8b3e2dbb727..b81b99709f1 100644 --- a/examples/persisted-documents/package.json +++ b/examples/persisted-documents/package.json @@ -11,7 +11,7 @@ "jest": "28.1.3", "babel-jest": "28.1.3", "@graphql-codegen/cli": "3.3.0", - "@graphql-codegen/client-preset": "3.0.0", + "@graphql-codegen/client-preset": "^3.0.0", "@babel/core": "7.21.4", "@babel/preset-env": "7.21.4", "@babel/preset-typescript": "7.21.4" diff --git a/examples/persisted-documents/src/gql/fragment-masking.ts b/examples/persisted-documents/src/gql/fragment-masking.ts index e20750b362f..f895cdecd67 100644 --- a/examples/persisted-documents/src/gql/fragment-masking.ts +++ b/examples/persisted-documents/src/gql/fragment-masking.ts @@ -62,5 +62,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in data); + return fields.length > 0 && fields.every(field => data && field in data); } diff --git a/examples/react/apollo-client-defer/src/gql/fragment-masking.ts b/examples/react/apollo-client-defer/src/gql/fragment-masking.ts index e20750b362f..f895cdecd67 100644 --- a/examples/react/apollo-client-defer/src/gql/fragment-masking.ts +++ b/examples/react/apollo-client-defer/src/gql/fragment-masking.ts @@ -62,5 +62,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in data); + return fields.length > 0 && fields.every(field => data && field in data); } diff --git a/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts b/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts index e20750b362f..f895cdecd67 100644 --- a/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts +++ b/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts @@ -62,5 +62,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in data); + return fields.length > 0 && fields.every(field => data && field in data); } diff --git a/examples/react/apollo-client/src/gql/fragment-masking.ts b/examples/react/apollo-client/src/gql/fragment-masking.ts index e20750b362f..f895cdecd67 100644 --- a/examples/react/apollo-client/src/gql/fragment-masking.ts +++ b/examples/react/apollo-client/src/gql/fragment-masking.ts @@ -62,5 +62,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in data); + return fields.length > 0 && fields.every(field => data && field in data); } diff --git a/examples/react/http-executor/src/gql/fragment-masking.ts b/examples/react/http-executor/src/gql/fragment-masking.ts index e20750b362f..f895cdecd67 100644 --- a/examples/react/http-executor/src/gql/fragment-masking.ts +++ b/examples/react/http-executor/src/gql/fragment-masking.ts @@ -62,5 +62,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in data); + return fields.length > 0 && fields.every(field => data && field in data); } diff --git a/examples/react/nextjs-swr/gql/fragment-masking.ts b/examples/react/nextjs-swr/gql/fragment-masking.ts index e20750b362f..f895cdecd67 100644 --- a/examples/react/nextjs-swr/gql/fragment-masking.ts +++ b/examples/react/nextjs-swr/gql/fragment-masking.ts @@ -62,5 +62,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in data); + return fields.length > 0 && fields.every(field => data && field in data); } diff --git a/examples/react/tanstack-react-query/src/gql/fragment-masking.ts b/examples/react/tanstack-react-query/src/gql/fragment-masking.ts index f4d67554283..f86d241c2c2 100644 --- a/examples/react/tanstack-react-query/src/gql/fragment-masking.ts +++ b/examples/react/tanstack-react-query/src/gql/fragment-masking.ts @@ -59,5 +59,5 @@ export function isFragmentReady( const fragName = fragmentNode.__meta__?.fragmentName; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in data); + return fields.length > 0 && fields.every(field => data && field in data); } diff --git a/examples/react/urql/src/gql/fragment-masking.ts b/examples/react/urql/src/gql/fragment-masking.ts index f4d67554283..f86d241c2c2 100644 --- a/examples/react/urql/src/gql/fragment-masking.ts +++ b/examples/react/urql/src/gql/fragment-masking.ts @@ -59,5 +59,5 @@ export function isFragmentReady( const fragName = fragmentNode.__meta__?.fragmentName; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in data); + return fields.length > 0 && fields.every(field => data && field in data); } diff --git a/examples/typescript-esm/package.json b/examples/typescript-esm/package.json index 0ae3ff92252..2eafa756e91 100644 --- a/examples/typescript-esm/package.json +++ b/examples/typescript-esm/package.json @@ -3,8 +3,8 @@ "version": "0.0.0", "private": true, "devDependencies": { - "@graphql-codegen/cli": "3.3.0", - "@graphql-codegen/client-preset": "3.0.0" + "@graphql-codegen/cli": "^3.3.0", + "@graphql-codegen/client-preset": "^3.0.0" }, "dependencies": { "@graphql-typed-document-node/core": "3.2.0", diff --git a/examples/typescript-esm/src/gql/fragment-masking.ts b/examples/typescript-esm/src/gql/fragment-masking.ts index 0763aa9d853..0cedfd53e94 100644 --- a/examples/typescript-esm/src/gql/fragment-masking.ts +++ b/examples/typescript-esm/src/gql/fragment-masking.ts @@ -62,5 +62,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in data); + return fields.length > 0 && fields.every(field => data && field in data); } diff --git a/examples/typescript-graphql-request/package.json b/examples/typescript-graphql-request/package.json index 6d6c5538285..8aad4cad10f 100644 --- a/examples/typescript-graphql-request/package.json +++ b/examples/typescript-graphql-request/package.json @@ -3,8 +3,8 @@ "version": "0.0.0", "private": true, "devDependencies": { - "@graphql-codegen/cli": "3.3.0", - "@graphql-codegen/client-preset": "3.0.0", + "@graphql-codegen/cli": "^3.3.0", + "@graphql-codegen/client-preset": "^3.0.0", "babel-jest": "28.1.3", "jest": "28.1.3" }, diff --git a/examples/typescript-graphql-request/src/gql/fragment-masking.ts b/examples/typescript-graphql-request/src/gql/fragment-masking.ts index f4d67554283..f86d241c2c2 100644 --- a/examples/typescript-graphql-request/src/gql/fragment-masking.ts +++ b/examples/typescript-graphql-request/src/gql/fragment-masking.ts @@ -59,5 +59,5 @@ export function isFragmentReady( const fragName = fragmentNode.__meta__?.fragmentName; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in data); + return fields.length > 0 && fields.every(field => data && field in data); } diff --git a/examples/vite/vite-react-cts/package.json b/examples/vite/vite-react-cts/package.json index b0880be926a..69845ab48fa 100644 --- a/examples/vite/vite-react-cts/package.json +++ b/examples/vite/vite-react-cts/package.json @@ -21,8 +21,8 @@ "vite": "^4.1.0" }, "devDependencies": { - "@graphql-codegen/cli": "3.3.0", - "@graphql-codegen/client-preset": "3.0.0", + "@graphql-codegen/cli": "^3.3.0", + "@graphql-codegen/client-preset": "^3.0.0", "@types/react": "^18.0.27", "@types/react-dom": "^18.0.10", "cypress": "12.9.0", diff --git a/examples/vite/vite-react-cts/src/gql/fragment-masking.ts b/examples/vite/vite-react-cts/src/gql/fragment-masking.ts index e20750b362f..f895cdecd67 100644 --- a/examples/vite/vite-react-cts/src/gql/fragment-masking.ts +++ b/examples/vite/vite-react-cts/src/gql/fragment-masking.ts @@ -62,5 +62,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in data); + return fields.length > 0 && fields.every(field => data && field in data); } diff --git a/examples/vite/vite-react-mts/package.json b/examples/vite/vite-react-mts/package.json index 2fe5c0de95b..f2a2016e5c3 100644 --- a/examples/vite/vite-react-mts/package.json +++ b/examples/vite/vite-react-mts/package.json @@ -21,8 +21,8 @@ "vite": "^4.1.0" }, "devDependencies": { - "@graphql-codegen/cli": "3.3.0", - "@graphql-codegen/client-preset": "3.0.0", + "@graphql-codegen/cli": "^3.3.0", + "@graphql-codegen/client-preset": "^3.0.0", "@types/react": "^18.0.27", "@types/react-dom": "^18.0.10", "cypress": "12.9.0", diff --git a/examples/vite/vite-react-mts/src/gql/fragment-masking.ts b/examples/vite/vite-react-mts/src/gql/fragment-masking.ts index e20750b362f..f895cdecd67 100644 --- a/examples/vite/vite-react-mts/src/gql/fragment-masking.ts +++ b/examples/vite/vite-react-mts/src/gql/fragment-masking.ts @@ -62,5 +62,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in data); + return fields.length > 0 && fields.every(field => data && field in data); } diff --git a/examples/vite/vite-react-ts/package.json b/examples/vite/vite-react-ts/package.json index d6c1f57e933..3264c50072b 100644 --- a/examples/vite/vite-react-ts/package.json +++ b/examples/vite/vite-react-ts/package.json @@ -21,8 +21,8 @@ "vite": "^4.1.0" }, "devDependencies": { - "@graphql-codegen/cli": "3.3.0", - "@graphql-codegen/client-preset": "3.0.0", + "@graphql-codegen/cli": "^3.3.0", + "@graphql-codegen/client-preset": "^3.0.0", "@types/react": "^18.0.27", "@types/react-dom": "^18.0.10", "cypress": "12.9.0", diff --git a/examples/vite/vite-react-ts/src/gql/fragment-masking.ts b/examples/vite/vite-react-ts/src/gql/fragment-masking.ts index e20750b362f..f895cdecd67 100644 --- a/examples/vite/vite-react-ts/src/gql/fragment-masking.ts +++ b/examples/vite/vite-react-ts/src/gql/fragment-masking.ts @@ -62,5 +62,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in data); + return fields.length > 0 && fields.every(field => data && field in data); } diff --git a/examples/vue/apollo-composable/src/gql/fragment-masking.ts b/examples/vue/apollo-composable/src/gql/fragment-masking.ts index 56d922edcb4..7fdcdff8304 100644 --- a/examples/vue/apollo-composable/src/gql/fragment-masking.ts +++ b/examples/vue/apollo-composable/src/gql/fragment-masking.ts @@ -62,5 +62,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in data); + return fields.length > 0 && fields.every(field => data && field in data); } diff --git a/examples/vue/urql/src/gql/fragment-masking.ts b/examples/vue/urql/src/gql/fragment-masking.ts index 56d922edcb4..7fdcdff8304 100644 --- a/examples/vue/urql/src/gql/fragment-masking.ts +++ b/examples/vue/urql/src/gql/fragment-masking.ts @@ -62,5 +62,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in data); + return fields.length > 0 && fields.every(field => data && field in data); } diff --git a/examples/vue/villus/src/gql/fragment-masking.ts b/examples/vue/villus/src/gql/fragment-masking.ts index 56d922edcb4..7fdcdff8304 100644 --- a/examples/vue/villus/src/gql/fragment-masking.ts +++ b/examples/vue/villus/src/gql/fragment-masking.ts @@ -62,5 +62,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in data); + return fields.length > 0 && fields.every(field => data && field in data); } diff --git a/examples/yoga-tests/src/gql/fragment-masking.ts b/examples/yoga-tests/src/gql/fragment-masking.ts index e20750b362f..f895cdecd67 100644 --- a/examples/yoga-tests/src/gql/fragment-masking.ts +++ b/examples/yoga-tests/src/gql/fragment-masking.ts @@ -62,5 +62,5 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in data); + return fields.length > 0 && fields.every(field => data && field in data); } diff --git a/packages/presets/client/src/fragment-masking-plugin.ts b/packages/presets/client/src/fragment-masking-plugin.ts index a429fd1df1e..66cbdd1fe89 100644 --- a/packages/presets/client/src/fragment-masking-plugin.ts +++ b/packages/presets/client/src/fragment-masking-plugin.ts @@ -87,7 +87,7 @@ export function isFragmentReady( const fragName = fragmentNode.__meta__?.fragmentName; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in data); + return fields.length > 0 && fields.every(field => data && field in data); } `; } @@ -106,7 +106,7 @@ export function isFragmentReady( const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in data); + return fields.length > 0 && fields.every(field => data && field in data); } `; }; diff --git a/packages/presets/client/tests/client-preset.spec.ts b/packages/presets/client/tests/client-preset.spec.ts index d7067ae39a1..4e012a0f23f 100644 --- a/packages/presets/client/tests/client-preset.spec.ts +++ b/packages/presets/client/tests/client-preset.spec.ts @@ -818,7 +818,7 @@ export * from "./gql";`); const fragName = fragDef?.name?.value; const fields = fragName ? deferredFields[fragName] : []; - return fields.length > 0 && fields.some(field => data && field in data); + return fields.length > 0 && fields.every(field => data && field in data); } " `); From 7af1241fd704249d20533e74fb2d3fd37bb2373d Mon Sep 17 00:00:00 2001 From: beerose Date: Mon, 1 May 2023 13:07:17 +0200 Subject: [PATCH 45/47] Changeset --- .changeset/calm-oranges-speak.md | 6 ------ .changeset/eleven-news-lay.md | 10 ++++++++++ 2 files changed, 10 insertions(+), 6 deletions(-) delete mode 100644 .changeset/calm-oranges-speak.md create mode 100644 .changeset/eleven-news-lay.md diff --git a/.changeset/calm-oranges-speak.md b/.changeset/calm-oranges-speak.md deleted file mode 100644 index 35a4cabe907..00000000000 --- a/.changeset/calm-oranges-speak.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@graphql-codegen/visitor-plugin-common': minor -'@graphql-codegen/typescript-operations': minor ---- - -Add typescript codegen `@defer` support diff --git a/.changeset/eleven-news-lay.md b/.changeset/eleven-news-lay.md new file mode 100644 index 00000000000..90faab5de99 --- /dev/null +++ b/.changeset/eleven-news-lay.md @@ -0,0 +1,10 @@ +--- +'@graphql-codegen/typed-document-node': minor +'@graphql-codegen/visitor-plugin-common': minor +'@graphql-codegen/typescript-operations': minor +'@graphql-codegen/typescript': minor +'@graphql-codegen/typescript-resolvers': minor +'@graphql-codegen/client-preset': minor +--- + +Add `@defer` directive support From ccdac2a9c3b612cb79fbe3e5abbdac19eb57d100 Mon Sep 17 00:00:00 2001 From: beerose Date: Mon, 1 May 2023 13:34:12 +0200 Subject: [PATCH 46/47] changeset 2 --- .changeset/modern-clouds-prove.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/modern-clouds-prove.md diff --git a/.changeset/modern-clouds-prove.md b/.changeset/modern-clouds-prove.md new file mode 100644 index 00000000000..b4dfdd864fd --- /dev/null +++ b/.changeset/modern-clouds-prove.md @@ -0,0 +1,5 @@ +--- +'@graphql-codegen/client-preset': patch +--- + +Pass `emitLegacyCommonJSImports` and `isStringDocumentMode` to the client preset config From 7ad08f56be5ff8d0ee7c93250c5988cb3fed2ea4 Mon Sep 17 00:00:00 2001 From: beerose Date: Mon, 1 May 2023 13:47:48 +0200 Subject: [PATCH 47/47] Add docs --- .../pages/plugins/presets/preset-client.mdx | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/website/src/pages/plugins/presets/preset-client.mdx b/website/src/pages/plugins/presets/preset-client.mdx index 1868816dcce..4eae1bee83d 100644 --- a/website/src/pages/plugins/presets/preset-client.mdx +++ b/website/src/pages/plugins/presets/preset-client.mdx @@ -252,6 +252,61 @@ When dealing with nested Fragments, the `useFragment()` should also be used in a You can find a complete working example here: [Nested Fragment example on GitHub](https://github.com/charlypoly/codegen-repros/blob/master/client-preset-nested-fragments-interface/src/App.tsx). +### Fragment Masking with @defer directive + +If you use the `@defer` directive and have a Fragment Masking setup, you can use an `isFragmentReady` helper to check if the deferred fragment data is already resolved. +The `isFragmentReady` function takes three arguments: the query document, the fragment definition, and the data returned by the +query. You can use it to conditionally render components based on whether the data for a deferred +fragment is available, as shown in the example below: + +```jsx +// index.tsx +import { useQuery } from '@apollo/client'; +import { useFragment, graphql, FragmentType, isFragmentReady } from './gql'; + +const OrdersFragment = graphql(` + fragment OrdersFragment on User { + orders { + id + total + } + } +`) +const GetUserQueryWithDefer = graphql(` + query GetUser($id: ID!) { + user(id: $id) { + id + name + ...OrdersFragment @defer + } + } +`) + +const OrdersList = (props: { data: FragmentType }) => { + const data = useFragment(OrdersFragment, props.data); + return ( + // render orders list + ) +}; + +function App() { + const { data } = useQuery(GetUserQueryWithDefer); + return ( +
+ {data && ( + <> + Name: {data.name} + Id: {data.name} + {isFragmentReady(GetUserQueryWithDefer, OrdersFragment, data) // <- HERE + && } + + )} +
+ ); +} +export default App; +``` + ### Fragment Masking and testing A React component that relies on Fragment Masking won't accept "plain object" as follows: