-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into docs-enhance-error-message
- Loading branch information
Showing
213 changed files
with
8,132 additions
and
2,142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"@graphql-codegen/cli": patch | ||
--- | ||
dependencies updates: | ||
- Updated dependency [`@graphql-tools/github-loader@^7.3.28` ↗︎](https://www.npmjs.com/package/@graphql-tools/github-loader/v/7.3.28) (from `^7.3.20`, in `dependencies`) | ||
- Updated dependency [`@graphql-tools/prisma-loader@^7.2.69` ↗︎](https://www.npmjs.com/package/@graphql-tools/prisma-loader/v/7.2.69) (from `^7.2.49`, in `dependencies`) | ||
- Updated dependency [`@graphql-tools/url-loader@^7.17.17` ↗︎](https://www.npmjs.com/package/@graphql-tools/url-loader/v/7.17.17) (from `^7.13.2`, in `dependencies`) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@graphql-codegen/client-preset': patch | ||
--- | ||
|
||
Improve isFragmentReady utility function to work with noUncheckedIndexedAccess TSC setting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@graphql-codegen/plugin-helpers': patch | ||
--- | ||
|
||
Add handleAsSDL property to UrlSchemaOptions type |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
'@graphql-codegen/visitor-plugin-common': minor | ||
'@graphql-codegen/typescript-resolvers': minor | ||
--- | ||
|
||
Add excludeTypes config to resolversNonOptionalTypename | ||
|
||
This disables the adding of `__typename` in resolver types for any specified typename. This could be useful e.g. if you're wanting to enable this for all new types going forward but not do a big migration. | ||
|
||
Usage example: | ||
|
||
```typescript | ||
const config: CodegenConfig = { | ||
schema: 'src/schema/**/*.graphql', | ||
generates: { | ||
'src/schema/types.ts': { | ||
plugins: ['typescript', 'typescript-resolvers'], | ||
config: { | ||
resolversNonOptionalTypename: { | ||
unionMember: true, | ||
excludeTypes: ['MyType'], | ||
} | ||
} | ||
}, | ||
}, | ||
}; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
'@graphql-codegen/visitor-plugin-common': minor | ||
'@graphql-codegen/typescript-resolvers': minor | ||
--- | ||
|
||
Use generic to simplify ResolversUnionTypes | ||
|
||
This follows the `ResolversInterfaceTypes`'s approach where the `RefType` generic is used to refer back to `ResolversTypes` or `ResolversParentTypes` in cases of nested Union types |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@graphql-codegen/client-preset': patch | ||
--- | ||
|
||
Pass `emitLegacyCommonJSImports` and `isStringDocumentMode` to the client preset config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@graphql-codegen/client-preset': minor | ||
--- | ||
|
||
Implement the ability the specify the hash algorithm used for persisted documents via `persistedDocuments.hashAlgorithm` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@graphql-codegen/cli': patch | ||
--- | ||
|
||
Fixed option ignoreNoDocuments when using graphql configs |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@graphql-codegen/cli': patch | ||
--- | ||
|
||
Trigger rebuilds in watch mode while respecting rules of precedence and negation, both in terms of global (top-level) config vs. local (per-output target) config, and in terms of watch patterns (higher priority) vs. documents/schemas (lower priority). This fixes an issue with overly-aggressive rebuilds during watch mode. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@graphql-codegen/visitor-plugin-common': patch | ||
--- | ||
|
||
Output valid type names with mergeFragmentTypes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
--- | ||
'@graphql-codegen/visitor-plugin-common': minor | ||
'@graphql-codegen/typescript-resolvers': minor | ||
--- | ||
|
||
Extract interfaces to ResolversInterfaceTypes and add to resolversNonOptionalTypename | ||
|
||
1. `ResolversInterfaceTypes` is a new type that keeps track of a GraphQL interface and its implementing types. | ||
|
||
For example, consider this schema: | ||
|
||
```graphql | ||
extend type Query { | ||
character(id: ID!): CharacterNode | ||
} | ||
|
||
interface CharacterNode { | ||
id: ID! | ||
} | ||
|
||
type Wizard implements CharacterNode { | ||
id: ID! | ||
screenName: String! | ||
spells: [String!]! | ||
} | ||
|
||
type Fighter implements CharacterNode { | ||
id: ID! | ||
screenName: String! | ||
powerLevel: Int! | ||
} | ||
``` | ||
|
||
The generated types will look like this: | ||
|
||
```ts | ||
export type ResolversInterfaceTypes<RefType extends Record<string, unknown>> = { | ||
CharacterNode: Fighter | Wizard; | ||
}; | ||
|
||
export type ResolversTypes = { | ||
// other types... | ||
CharacterNode: ResolverTypeWrapper<ResolversInterfaceTypes<ResolversTypes>["CharacterNode"]>; | ||
Fighter: ResolverTypeWrapper<Fighter>; | ||
Wizard: ResolverTypeWrapper<Wizard>; | ||
// other types... | ||
}; | ||
|
||
export type ResolversParentTypes = { | ||
// other types... | ||
CharacterNode: ResolversInterfaceTypes<ResolversParentTypes>["CharacterNode"]; | ||
Fighter: Fighter; | ||
Wizard: Wizard; | ||
// other types... | ||
}; | ||
``` | ||
|
||
The `RefType` generic is used to reference back to `ResolversTypes` and `ResolversParentTypes` in some cases such as field returning a Union. | ||
|
||
2. `resolversNonOptionalTypename` also affects `ResolversInterfaceTypes` | ||
|
||
Using the schema above, if we use `resolversNonOptionalTypename` option: | ||
|
||
```typescript | ||
const config: CodegenConfig = { | ||
schema: 'src/schema/**/*.graphql', | ||
generates: { | ||
'src/schema/types.ts': { | ||
plugins: ['typescript', 'typescript-resolvers'], | ||
config: { | ||
resolversNonOptionalTypename: true // Or `resolversNonOptionalTypename: { interfaceImplementingType: true }` | ||
} | ||
}, | ||
}, | ||
}; | ||
``` | ||
|
||
Then, the generated type looks like this: | ||
|
||
```ts | ||
export type ResolversInterfaceTypes<RefType extends Record<string, unknown>> = { | ||
CharacterNode: (Fighter & { __typename: "Fighter" }) | (Wizard & { __typename: "Wizard" }); | ||
}; | ||
|
||
export type ResolversTypes = { | ||
// other types... | ||
CharacterNode: ResolverTypeWrapper<ResolversInterfaceTypes<ResolversTypes>["CharacterNode"]>; | ||
Fighter: ResolverTypeWrapper<Fighter>; | ||
Wizard: ResolverTypeWrapper<Wizard>; | ||
// other types... | ||
}; | ||
|
||
export type ResolversParentTypes = { | ||
// other types... | ||
CharacterNode: ResolversInterfaceTypes<ResolversParentTypes>["CharacterNode"]; | ||
Fighter: Fighter; | ||
Wizard: Wizard; | ||
// other types... | ||
}; | ||
``` |
9 changes: 9 additions & 0 deletions
9
dev-test-outer-dir/githunt/nothing-should-use-this-query.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# This file should be excluded by all dev-test/codegen.ts patterns that otherwise | ||
# include files from dev-test-outer-dir, so that when running `yarn watch:examples`, | ||
# updating this file should _never_ trigger rebuild | ||
query NothingShouldUseThisQuery { | ||
currentUser { | ||
login | ||
avatar_url | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.