diff --git a/.eslintrc.cjs b/.eslintrc.cjs
index 88392edc27c..fe920d213b4 100644
--- a/.eslintrc.cjs
+++ b/.eslintrc.cjs
@@ -50,11 +50,19 @@ module.exports = {
'@typescript-eslint/no-unused-vars': 'off',
},
},
+ {
+ files: ['packages/**/*.{,c,m}ts{,x}'],
+ parserOptions: {
+ project: ['./tsconfig.json'],
+ },
+ },
],
ignorePatterns: [
'dev-test',
'website',
- 'examples/**/gql/**',
+ 'examples/**',
+ '**/tests/test-files/**',
+ '**/tests/test-documents/**',
'**/react-app-env.d.ts',
'packages/presets/swc-plugin/tests/fixtures/simple-uppercase-operation-name.js',
'packages/presets/swc-plugin/tests/fixtures/simple-uppercase-operation-name.other-dir.js',
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
deleted file mode 100644
index 2ec87519cac..00000000000
--- a/.github/FUNDING.yml
+++ /dev/null
@@ -1 +0,0 @@
-custom: https://www.buymeacoffee.com/JDnuAwr
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 2721f00e7a0..a04416028bb 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -110,7 +110,6 @@ jobs:
needs:
- lint
- prettier-check
- - dev-tests
- esm
strategy:
matrix:
diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml
index 69193f29098..fe1b13a0a90 100644
--- a/.github/workflows/pr.yml
+++ b/.github/workflows/pr.yml
@@ -11,14 +11,6 @@ jobs:
secrets:
githubToken: ${{ secrets.GUILD_BOT_TOKEN }}
- algolia:
- uses: the-guild-org/shared-config/.github/workflows/algolia-integrity.yml@main
- with:
- domain: https://www.the-guild.dev/graphql/codegen/
- source: 'Code Generator'
- secrets:
- githubToken: ${{ secrets.GITHUB_TOKEN }}
-
alpha:
uses: the-guild-org/shared-config/.github/workflows/release-snapshot.yml@main
if: ${{ github.event.pull_request.title != 'Upcoming Release Changes' }}
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 2cf04624a31..70e23a9037d 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -13,12 +13,3 @@ jobs:
secrets:
githubToken: ${{ secrets.GUILD_BOT_TOKEN }}
npmToken: ${{ secrets.NPM_TOKEN }}
-
- algolia:
- uses: the-guild-org/shared-config/.github/workflows/algolia-publish.yml@main
- secrets:
- githubToken: ${{ secrets.GITHUB_TOKEN }}
- algoliaAdminApiKey: ${{ secrets.ALGOLIA_ADMIN_API_KEY }}
- with:
- domain: https://www.the-guild.dev/graphql/codegen/
- source: 'Code Generator'
diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml
index e5edffce282..b4cdda3bc68 100644
--- a/.github/workflows/website.yml
+++ b/.github/workflows/website.yml
@@ -29,7 +29,6 @@ jobs:
env:
NEXT_BASE_PATH: ${{ github.ref == 'refs/heads/master' && '/graphql/codegen' || '' }}
SITE_URL: ${{ github.ref == 'refs/heads/master' && 'https://the-guild.dev/graphql/codegen' || '' }}
- NEXT_PUBLIC_MENDABLE_ANON_KEY: ${{ secrets.NEXT_PUBLIC_MENDABLE_ANON_KEY }}
with:
cloudflareApiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
cloudflareAccountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
diff --git a/.prettierignore b/.prettierignore
index 31ea07992d4..e265857872d 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -20,8 +20,6 @@ website/src/pages/docs/guides/react.mdx
website/src/pages/plugins/index.mdx
website/src/pages/plugins/presets/near-operation-file-preset.mdx
-website/algolia-lockfile.json
-
temp/
website/out
website/.next
diff --git a/README.md b/README.md
index 1fbe23e3301..823b7e7ece5 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,9 @@
-[](https://the-guild.dev/graphql/codegen)
+
[](https://badge.fury.io/js/%40graphql-codegen%2Fcli)
diff --git a/dev-test/codegen.ts b/dev-test/codegen.ts
index ba8afd46511..7c0b9838288 100644
--- a/dev-test/codegen.ts
+++ b/dev-test/codegen.ts
@@ -232,6 +232,17 @@ const config: CodegenConfig = {
mergeFragmentTypes: true,
},
},
+ './dev-test/subpath-import/result.d.ts': {
+ schema: './dev-test/subpath-import/schema.graphql',
+ plugins: ['typescript', 'typescript-resolvers'],
+ config: {
+ contextType: '\\#test-null-value/context#TestContext',
+ fieldContextTypes: ['mutation.createUser#\\#test/root#FiedContextType'],
+ enumValues: {
+ RoleStatus: '\\#changeName/server/drizzle/schema#RoleStatus',
+ },
+ },
+ },
},
};
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 a6fea3ebd2c..a6b3407f590 100644
--- a/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts
+++ b/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts
@@ -17,17 +17,37 @@ export function useFragment(
_documentNode: DocumentTypeDecoration,
fragmentType: FragmentType>
): TType;
+// return nullable if `fragmentType` is undefined
+export function useFragment(
+ _documentNode: DocumentTypeDecoration,
+ fragmentType: FragmentType> | undefined
+): TType | undefined;
// return nullable if `fragmentType` is nullable
+export function useFragment(
+ _documentNode: DocumentTypeDecoration,
+ fragmentType: FragmentType> | null
+): TType | null;
+// return nullable if `fragmentType` is nullable or undefined
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: Array>>
+): Array;
+// return array of nullable if `fragmentType` is array of nullable
+export function useFragment(
+ _documentNode: DocumentTypeDecoration,
+ fragmentType: Array>> | null | undefined
+): Array | null | undefined;
+// return readonly 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
+// return readonly array of nullable if `fragmentType` is array of nullable
export function useFragment(
_documentNode: DocumentTypeDecoration,
fragmentType: ReadonlyArray>> | null | undefined
@@ -36,10 +56,11 @@ export function useFragment(
_documentNode: DocumentTypeDecoration,
fragmentType:
| FragmentType>
+ | Array>>
| ReadonlyArray>>
| null
| undefined
-): TType | ReadonlyArray | null | undefined {
+): TType | Array | ReadonlyArray | null | undefined {
return fragmentType as any;
}
diff --git a/dev-test/gql-tag-operations-masking/src/index.tsx b/dev-test/gql-tag-operations-masking/src/index.tsx
index b74789db72d..69f4c2499f7 100644
--- a/dev-test/gql-tag-operations-masking/src/index.tsx
+++ b/dev-test/gql-tag-operations-masking/src/index.tsx
@@ -1,9 +1,9 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import React from 'react';
-import { gql, FragmentType, useFragment } from '../gql';
+import { graphql, FragmentType, useFragment } from '../gql';
import { useQuery } from 'urql';
-const TweetFragment = gql(/* GraphQL */ `
+const TweetFragment = graphql(/* GraphQL */ `
fragment TweetFragment on Tweet {
id
body
@@ -11,7 +11,7 @@ const TweetFragment = gql(/* GraphQL */ `
}
`);
-const TweetAuthorFragment = gql(/* GraphQL */ `
+const TweetAuthorFragment = graphql(/* GraphQL */ `
fragment TweetAuthorFragment on Tweet {
id
author {
@@ -21,7 +21,7 @@ const TweetAuthorFragment = gql(/* GraphQL */ `
}
`);
-const TweetsFragment = gql(/* GraphQL */ `
+const TweetsFragment = graphql(/* GraphQL */ `
fragment TweetsFragment on Query {
Tweets {
id
@@ -30,7 +30,7 @@ const TweetsFragment = gql(/* GraphQL */ `
}
`);
-const TweetAppQuery = gql(/* GraphQL */ `
+const TweetAppQuery = graphql(/* GraphQL */ `
query TweetAppQuery {
...TweetsFragment
}
@@ -53,7 +53,7 @@ const TweetAuthor = (props: { tweet: FragmentType })
return {tweet.author?.username}
;
};
-const Tweets = (props: { tweets: FragmentType | undefined }) => {
+const Tweets = (props: { tweets: FragmentType | null | undefined }) => {
const tweets = useFragment(TweetsFragment, props.tweets);
return {tweets?.Tweets?.map(tweet => ) ?? null}
;
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 a6fea3ebd2c..a6b3407f590 100644
--- a/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts
+++ b/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts
@@ -17,17 +17,37 @@ export function useFragment(
_documentNode: DocumentTypeDecoration,
fragmentType: FragmentType>
): TType;
+// return nullable if `fragmentType` is undefined
+export function useFragment(
+ _documentNode: DocumentTypeDecoration,
+ fragmentType: FragmentType> | undefined
+): TType | undefined;
// return nullable if `fragmentType` is nullable
+export function useFragment(
+ _documentNode: DocumentTypeDecoration,
+ fragmentType: FragmentType> | null
+): TType | null;
+// return nullable if `fragmentType` is nullable or undefined
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: Array>>
+): Array;
+// return array of nullable if `fragmentType` is array of nullable
+export function useFragment(
+ _documentNode: DocumentTypeDecoration,
+ fragmentType: Array>> | null | undefined
+): Array | null | undefined;
+// return readonly 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
+// return readonly array of nullable if `fragmentType` is array of nullable
export function useFragment(
_documentNode: DocumentTypeDecoration,
fragmentType: ReadonlyArray>> | null | undefined
@@ -36,10 +56,11 @@ export function useFragment(
_documentNode: DocumentTypeDecoration,
fragmentType:
| FragmentType>
+ | Array>>
| ReadonlyArray>>
| null
| undefined
-): TType | ReadonlyArray | null | undefined {
+): TType | Array | ReadonlyArray | null | undefined {
return fragmentType 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 a6fea3ebd2c..a6b3407f590 100644
--- a/dev-test/gql-tag-operations/gql/fragment-masking.ts
+++ b/dev-test/gql-tag-operations/gql/fragment-masking.ts
@@ -17,17 +17,37 @@ export function useFragment(
_documentNode: DocumentTypeDecoration,
fragmentType: FragmentType>
): TType;
+// return nullable if `fragmentType` is undefined
+export function useFragment(
+ _documentNode: DocumentTypeDecoration,
+ fragmentType: FragmentType> | undefined
+): TType | undefined;
// return nullable if `fragmentType` is nullable
+export function useFragment(
+ _documentNode: DocumentTypeDecoration,
+ fragmentType: FragmentType> | null
+): TType | null;
+// return nullable if `fragmentType` is nullable or undefined
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: Array>>
+): Array;
+// return array of nullable if `fragmentType` is array of nullable
+export function useFragment(
+ _documentNode: DocumentTypeDecoration,
+ fragmentType: Array>> | null | undefined
+): Array | null | undefined;
+// return readonly 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
+// return readonly array of nullable if `fragmentType` is array of nullable
export function useFragment(
_documentNode: DocumentTypeDecoration,
fragmentType: ReadonlyArray>> | null | undefined
@@ -36,10 +56,11 @@ export function useFragment(
_documentNode: DocumentTypeDecoration,
fragmentType:
| FragmentType>
+ | Array>>
| ReadonlyArray>>
| null
| undefined
-): TType | ReadonlyArray | null | undefined {
+): TType | Array | ReadonlyArray | null | undefined {
return fragmentType 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 a6fea3ebd2c..a6b3407f590 100644
--- a/dev-test/gql-tag-operations/graphql/fragment-masking.ts
+++ b/dev-test/gql-tag-operations/graphql/fragment-masking.ts
@@ -17,17 +17,37 @@ export function useFragment(
_documentNode: DocumentTypeDecoration,
fragmentType: FragmentType>
): TType;
+// return nullable if `fragmentType` is undefined
+export function useFragment(
+ _documentNode: DocumentTypeDecoration,
+ fragmentType: FragmentType> | undefined
+): TType | undefined;
// return nullable if `fragmentType` is nullable
+export function useFragment(
+ _documentNode: DocumentTypeDecoration,
+ fragmentType: FragmentType> | null
+): TType | null;
+// return nullable if `fragmentType` is nullable or undefined
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: Array>>
+): Array;
+// return array of nullable if `fragmentType` is array of nullable
+export function useFragment(
+ _documentNode: DocumentTypeDecoration,
+ fragmentType: Array>> | null | undefined
+): Array | null | undefined;
+// return readonly 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
+// return readonly array of nullable if `fragmentType` is array of nullable
export function useFragment(
_documentNode: DocumentTypeDecoration,
fragmentType: ReadonlyArray>> | null | undefined
@@ -36,10 +56,11 @@ export function useFragment(
_documentNode: DocumentTypeDecoration,
fragmentType:
| FragmentType>
+ | Array>>
| ReadonlyArray>>
| null
| undefined
-): TType | ReadonlyArray | null | undefined {
+): TType | Array | ReadonlyArray | null | undefined {
return fragmentType as any;
}
diff --git a/dev-test/gql-tag-operations/src/index.ts b/dev-test/gql-tag-operations/src/index.ts
index d5e147b7691..e491e7984a2 100644
--- a/dev-test/gql-tag-operations/src/index.ts
+++ b/dev-test/gql-tag-operations/src/index.ts
@@ -1,8 +1,8 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
-import { gql, DocumentType } from '../gql.js';
+import { graphql, DocumentType } from '../gql/gql.js';
-const FooQuery = gql(/* GraphQL */ `
+const FooQuery = graphql(/* GraphQL */ `
query Foo {
Tweets {
id
@@ -10,14 +10,14 @@ const FooQuery = gql(/* GraphQL */ `
}
`);
-const LelFragment = gql(/* GraphQL */ `
+const LelFragment = graphql(/* GraphQL */ `
fragment Lel on Tweet {
id
body
}
`);
-const BarQuery = gql(/* GraphQL */ `
+const BarQuery = graphql(/* GraphQL */ `
query Bar {
Tweets {
...Lel
diff --git a/dev-test/modules/types.ts b/dev-test/modules/types.ts
index 893f0c452f1..af996e8e275 100644
--- a/dev-test/modules/types.ts
+++ b/dev-test/modules/types.ts
@@ -165,7 +165,7 @@ export type DirectiveResolverFn TResult | Promise;
/** Mapping of union types */
-export type ResolversUnionTypes> = {
+export type ResolversUnionTypes<_RefType extends Record> = {
PaymentOption: CreditCard | Paypal;
};
diff --git a/dev-test/subpath-import/result.d.ts b/dev-test/subpath-import/result.d.ts
new file mode 100644
index 00000000000..f066002aea9
--- /dev/null
+++ b/dev-test/subpath-import/result.d.ts
@@ -0,0 +1,167 @@
+import { RoleStatus } from '#changeName/server/drizzle/schema';
+import { GraphQLResolveInfo } from 'graphql';
+import { TestContext } from '#test-null-value/context';
+import { FiedContextType } from '#test/root';
+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]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
+export type EnumResolverSignature = { [key in keyof T]?: AllowedValues };
+export type RequireFields = Omit & { [P in K]-?: NonNullable };
+/** All built-in and custom scalars, mapped to their actual values */
+export type Scalars = {
+ ID: { input: string; output: string };
+ String: { input: string; output: string };
+ Boolean: { input: boolean; output: boolean };
+ Int: { input: number; output: number };
+ Float: { input: number; output: number };
+};
+
+export { RoleStatus };
+
+export type User = {
+ __typename?: 'User';
+ createdAt: Scalars['String']['output'];
+ email: Scalars['String']['output'];
+ id: Scalars['ID']['output'];
+ name: Scalars['String']['output'];
+ password: Scalars['String']['output'];
+ updatedAt: Scalars['String']['output'];
+};
+
+export type Mutation = {
+ __typename?: 'mutation';
+ createUser: User;
+};
+
+export type MutationCreateUserArgs = {
+ email: Scalars['String']['input'];
+ name: Scalars['String']['input'];
+ password: Scalars['String']['input'];
+};
+
+export type ResolverTypeWrapper = Promise | T;
+
+export type ResolverWithResolve = {
+ resolve: ResolverFn;
+};
+export type Resolver =
+ | ResolverFn
+ | ResolverWithResolve;
+
+export type ResolverFn = (
+ parent: TParent,
+ args: TArgs,
+ context: TContext,
+ info: GraphQLResolveInfo
+) => Promise | TResult;
+
+export type SubscriptionSubscribeFn = (
+ parent: TParent,
+ args: TArgs,
+ context: TContext,
+ info: GraphQLResolveInfo
+) => AsyncIterable | Promise>;
+
+export type SubscriptionResolveFn = (
+ parent: TParent,
+ args: TArgs,
+ context: TContext,
+ info: GraphQLResolveInfo
+) => TResult | Promise;
+
+export interface SubscriptionSubscriberObject {
+ subscribe: SubscriptionSubscribeFn<{ [key in TKey]: TResult }, TParent, TContext, TArgs>;
+ resolve?: SubscriptionResolveFn;
+}
+
+export interface SubscriptionResolverObject {
+ subscribe: SubscriptionSubscribeFn;
+ resolve: SubscriptionResolveFn;
+}
+
+export type SubscriptionObject =
+ | SubscriptionSubscriberObject
+ | SubscriptionResolverObject;
+
+export type SubscriptionResolver =
+ | ((...args: any[]) => SubscriptionObject)
+ | SubscriptionObject;
+
+export type TypeResolveFn = (
+ parent: TParent,
+ context: TContext,
+ info: GraphQLResolveInfo
+) => Maybe | Promise>;
+
+export type IsTypeOfResolverFn = (
+ obj: T,
+ context: TContext,
+ info: GraphQLResolveInfo
+) => boolean | Promise;
+
+export type NextResolverFn = () => Promise;
+
+export type DirectiveResolverFn = (
+ next: NextResolverFn,
+ parent: TParent,
+ args: TArgs,
+ context: TContext,
+ info: GraphQLResolveInfo
+) => TResult | Promise;
+
+/** Mapping between all available schema types and the resolvers types */
+export type ResolversTypes = {
+ Boolean: ResolverTypeWrapper;
+ ID: ResolverTypeWrapper;
+ RoleStatus: RoleStatus;
+ String: ResolverTypeWrapper;
+ User: ResolverTypeWrapper;
+ mutation: ResolverTypeWrapper;
+};
+
+/** Mapping between all available schema types and the resolvers parents */
+export type ResolversParentTypes = {
+ Boolean: Scalars['Boolean']['output'];
+ ID: Scalars['ID']['output'];
+ String: Scalars['String']['output'];
+ User: User;
+ mutation: Mutation;
+};
+
+export type RoleStatusResolvers = EnumResolverSignature<{ ADMIN?: any; USER?: any }, ResolversTypes['RoleStatus']>;
+
+export type UserResolvers<
+ ContextType = TestContext,
+ ParentType extends ResolversParentTypes['User'] = ResolversParentTypes['User']
+> = {
+ createdAt?: Resolver;
+ email?: Resolver;
+ id?: Resolver;
+ name?: Resolver;
+ password?: Resolver;
+ updatedAt?: Resolver;
+ __isTypeOf?: IsTypeOfResolverFn;
+};
+
+export type MutationResolvers<
+ ContextType = TestContext,
+ ParentType extends ResolversParentTypes['mutation'] = ResolversParentTypes['mutation']
+> = {
+ createUser?: Resolver<
+ ResolversTypes['User'],
+ ParentType,
+ FiedContextType,
+ RequireFields
+ >;
+ __isTypeOf?: IsTypeOfResolverFn;
+};
+
+export type Resolvers = {
+ RoleStatus?: RoleStatusResolvers;
+ User?: UserResolvers;
+ mutation?: MutationResolvers;
+};
diff --git a/dev-test/subpath-import/schema.graphql b/dev-test/subpath-import/schema.graphql
new file mode 100644
index 00000000000..3010f2f4bc4
--- /dev/null
+++ b/dev-test/subpath-import/schema.graphql
@@ -0,0 +1,17 @@
+type User {
+ id: ID!
+ name: String!
+ email: String!
+ password: String!
+ createdAt: String!
+ updatedAt: String!
+}
+
+enum RoleStatus {
+ ADMIN
+ USER
+}
+
+type mutation {
+ createUser(name: String!, email: String!, password: String!): User!
+}
diff --git a/examples/persisted-documents-string-mode/package.json b/examples/persisted-documents-string-mode/package.json
index e6f71c7d7b4..eafc82be026 100644
--- a/examples/persisted-documents-string-mode/package.json
+++ b/examples/persisted-documents-string-mode/package.json
@@ -3,17 +3,17 @@
"version": "0.0.0",
"private": true,
"dependencies": {
- "graphql-yoga": "4.0.4",
- "@graphql-yoga/plugin-persisted-operations": "2.0.4"
+ "graphql-yoga": "5.3.1",
+ "@graphql-yoga/plugin-persisted-operations": "3.3.1"
},
"devDependencies": {
"@graphql-typed-document-node/core": "3.2.0",
"jest": "28.1.3",
"babel-jest": "29.6.4",
"@graphql-codegen/cli": "5.0.2",
- "@babel/core": "7.22.11",
- "@babel/preset-env": "7.22.10",
- "@babel/preset-typescript": "7.22.11"
+ "@babel/core": "7.24.5",
+ "@babel/preset-env": "7.24.5",
+ "@babel/preset-typescript": "7.24.1"
},
"scripts": {
"test": "jest",
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 c22b351be1a..dedac7e7f7e 100644
--- a/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts
+++ b/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts
@@ -16,17 +16,37 @@ export function useFragment(
_documentNode: DocumentTypeDecoration,
fragmentType: FragmentType>
): TType;
+// return nullable if `fragmentType` is undefined
+export function useFragment(
+ _documentNode: DocumentTypeDecoration,
+ fragmentType: FragmentType> | undefined
+): TType | undefined;
// return nullable if `fragmentType` is nullable
+export function useFragment(
+ _documentNode: DocumentTypeDecoration,
+ fragmentType: FragmentType> | null
+): TType | null;
+// return nullable if `fragmentType` is nullable or undefined
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: Array>>
+): Array;
+// return array of nullable if `fragmentType` is array of nullable
+export function useFragment(
+ _documentNode: DocumentTypeDecoration,
+ fragmentType: Array>> | null | undefined
+): Array | null | undefined;
+// return readonly 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
+// return readonly array of nullable if `fragmentType` is array of nullable
export function useFragment(
_documentNode: DocumentTypeDecoration,
fragmentType: ReadonlyArray>> | null | undefined
@@ -35,10 +55,11 @@ export function useFragment(
_documentNode: DocumentTypeDecoration,
fragmentType:
| FragmentType>
+ | Array>>
| ReadonlyArray>>
| null
| undefined
-): TType | ReadonlyArray | null | undefined {
+): TType | Array | ReadonlyArray | null | undefined {
return fragmentType as any;
}
diff --git a/examples/persisted-documents/package.json b/examples/persisted-documents/package.json
index 68c6e5dfe9d..65e51ccbd8c 100644
--- a/examples/persisted-documents/package.json
+++ b/examples/persisted-documents/package.json
@@ -3,17 +3,17 @@
"version": "0.0.0",
"private": true,
"dependencies": {
- "graphql-yoga": "4.0.4",
- "@graphql-yoga/plugin-persisted-operations": "2.0.4"
+ "graphql-yoga": "5.3.1",
+ "@graphql-yoga/plugin-persisted-operations": "3.3.1"
},
"devDependencies": {
"@graphql-typed-document-node/core": "3.2.0",
"jest": "28.1.3",
"babel-jest": "29.6.4",
"@graphql-codegen/cli": "5.0.2",
- "@babel/core": "7.22.11",
- "@babel/preset-env": "7.22.10",
- "@babel/preset-typescript": "7.22.11"
+ "@babel/core": "7.24.5",
+ "@babel/preset-env": "7.24.5",
+ "@babel/preset-typescript": "7.24.1"
},
"scripts": {
"test": "jest",
diff --git a/examples/persisted-documents/src/gql/fragment-masking.ts b/examples/persisted-documents/src/gql/fragment-masking.ts
index c00c8820b30..c469b9c617c 100644
--- a/examples/persisted-documents/src/gql/fragment-masking.ts
+++ b/examples/persisted-documents/src/gql/fragment-masking.ts
@@ -17,17 +17,37 @@ export function useFragment(
_documentNode: DocumentTypeDecoration,
fragmentType: FragmentType>
): TType;
+// return nullable if `fragmentType` is undefined
+export function useFragment