This repository has been archived by the owner on Apr 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 389
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1054 from Shopify/add_graphql_types
Add GQL types for Admin API
- Loading branch information
Showing
13 changed files
with
178 additions
and
75 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,6 @@ | ||
--- | ||
"@shopify/admin-api-client": minor | ||
"@shopify/graphql-client": minor | ||
--- | ||
|
||
Added the ability to automatically type GraphQL queries when the files created by @shopify/api-codegen-preset are loaded for the app. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export { createAdminApiClient } from "./admin-api-client"; | ||
export { AdminQueries, AdminMutations } from "./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
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
37 changes: 37 additions & 0 deletions
37
packages/graphql-client/src/api-client-utilities/operation-types.ts
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,37 @@ | ||
import { GraphQLClient } from "../graphql-client/types"; | ||
|
||
export type InputMaybe<_R = never> = never; | ||
|
||
export interface AllOperations { | ||
[key: string]: { variables: any; return: any }; | ||
} | ||
|
||
type UnpackedInput<InputType> = "input" extends keyof InputType | ||
? InputType["input"] | ||
: InputType; | ||
|
||
type UnpackedInputMaybe<InputType> = InputType extends InputMaybe<infer R> | ||
? InputMaybe<UnpackedInput<R>> | ||
: UnpackedInput<InputType>; | ||
|
||
export type OperationVariables< | ||
Operation extends keyof Operations, | ||
Operations extends AllOperations | ||
> = Operations[Operation]["variables"] extends { [key: string]: never } | ||
? { [key: string]: never } | ||
: { | ||
variables?: { | ||
[k in keyof Operations[Operation]["variables"]]: UnpackedInputMaybe< | ||
Operations[Operation]["variables"][k] | ||
>; | ||
}; | ||
}; | ||
|
||
export type ResponseWithType<T = any> = Omit<GraphQLClient["fetch"], "json"> & { | ||
json: () => Promise<T>; | ||
}; | ||
|
||
export type ReturnData< | ||
Operation extends keyof Operations, | ||
Operations extends AllOperations | ||
> = Operation extends keyof Operations ? Operations[Operation]["return"] : any; |
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