Update types

This commit is contained in:
dominik-zeglen 2020-03-10 14:33:43 +01:00
parent 20c4340b8f
commit 93ba9378ef
27 changed files with 189 additions and 122 deletions

View file

@ -1,5 +1,6 @@
import gql from "graphql-tag";
import { accountFragmentError } from "@saleor/customers/mutations";
import { TypedMutation } from "../mutations";
import {
RequestPasswordReset,
@ -64,11 +65,11 @@ export const TypedVerifyTokenMutation = TypedMutation<
>(tokenVerifyMutation);
export const requestPasswordReset = gql`
${accountFragmentError}
mutation RequestPasswordReset($email: String!, $redirectUrl: String!) {
requestPasswordReset(email: $email, redirectUrl: $redirectUrl) {
errors {
field
message
errors: accountErrors {
...AccountErrorFragment
}
}
}
@ -79,14 +80,14 @@ export const RequestPasswordResetMutation = TypedMutation<
>(requestPasswordReset);
export const setPassword = gql`
${accountFragmentError}
${fragmentUser}
mutation SetPassword($email: String!, $password: String!, $token: String!) {
setPassword(email: $email, password: $password, token: $token) {
token
errors {
field
message
errors: accountErrors {
...AccountErrorFragment
}
token
user {
...User
}

View file

@ -2,14 +2,16 @@
/* eslint-disable */
// This file was automatically generated and should not be edited.
import { AccountErrorCode } from "./../../types/globalTypes";
// ====================================================
// GraphQL mutation operation: RequestPasswordReset
// ====================================================
export interface RequestPasswordReset_requestPasswordReset_errors {
__typename: "Error";
__typename: "AccountError";
code: AccountErrorCode;
field: string | null;
message: string | null;
}
export interface RequestPasswordReset_requestPasswordReset {

View file

@ -2,16 +2,16 @@
/* eslint-disable */
// This file was automatically generated and should not be edited.
import { PermissionEnum } from "./../../types/globalTypes";
import { AccountErrorCode, PermissionEnum } from "./../../types/globalTypes";
// ====================================================
// GraphQL mutation operation: SetPassword
// ====================================================
export interface SetPassword_setPassword_errors {
__typename: "Error";
__typename: "AccountError";
code: AccountErrorCode;
field: string | null;
message: string | null;
}
export interface SetPassword_setPassword_user_permissions {
@ -37,8 +37,8 @@ export interface SetPassword_setPassword_user {
export interface SetPassword_setPassword {
__typename: "SetPassword";
errors: SetPassword_setPassword_errors[] | null;
token: string | null;
errors: (SetPassword_setPassword_errors | null)[];
user: SetPassword_setPassword_user | null;
}

View file

@ -36,13 +36,20 @@ import {
UpdateCustomerAddressVariables
} from "./types/UpdateCustomerAddress";
export const accountFragmentError = gql`
fragment AccountErrorFragment on AccountError {
code
field
}
`;
const updateCustomer = gql`
${accountFragmentError}
${customerDetailsFragment}
mutation UpdateCustomer($id: ID!, $input: CustomerInput!) {
customerUpdate(id: $id, input: $input) {
errors {
field
message
errors: accountErrors {
...AccountErrorFragment
}
user {
...CustomerDetailsFragment
@ -56,11 +63,11 @@ export const TypedUpdateCustomerMutation = TypedMutation<
>(updateCustomer);
const createCustomer = gql`
${accountFragmentError}
mutation CreateCustomer($input: UserCreateInput!) {
customerCreate(input: $input) {
errors {
field
message
errors: accountErrors {
...AccountErrorFragment
}
user {
id
@ -74,11 +81,11 @@ export const TypedCreateCustomerMutation = TypedMutation<
>(createCustomer);
const removeCustomer = gql`
${accountFragmentError}
mutation RemoveCustomer($id: ID!) {
customerDelete(id: $id) {
errors {
field
message
errors: accountErrors {
...AccountErrorFragment
}
}
}
@ -89,6 +96,7 @@ export const TypedRemoveCustomerMutation = TypedMutation<
>(removeCustomer);
const setCustomerDefaultAddress = gql`
${accountFragmentError}
${customerAddressesFragment}
mutation SetCustomerDefaultAddress(
$addressId: ID!
@ -96,9 +104,8 @@ const setCustomerDefaultAddress = gql`
$type: AddressTypeEnum!
) {
addressSetDefault(addressId: $addressId, userId: $userId, type: $type) {
errors {
field
message
errors: accountErrors {
...AccountErrorFragment
}
user {
...CustomerAddressesFragment
@ -112,13 +119,13 @@ export const TypedSetCustomerDefaultAddressMutation = TypedMutation<
>(setCustomerDefaultAddress);
const createCustomerAddress = gql`
${accountFragmentError}
${customerAddressesFragment}
${fragmentAddress}
mutation CreateCustomerAddress($id: ID!, $input: AddressInput!) {
addressCreate(userId: $id, input: $input) {
errors {
field
message
errors: accountErrors {
...AccountErrorFragment
}
address {
...AddressFragment
@ -135,12 +142,12 @@ export const TypedCreateCustomerAddressMutation = TypedMutation<
>(createCustomerAddress);
const updateCustomerAddress = gql`
${accountFragmentError}
${fragmentAddress}
mutation UpdateCustomerAddress($id: ID!, $input: AddressInput!) {
addressUpdate(id: $id, input: $input) {
errors {
field
message
errors: accountErrors {
...AccountErrorFragment
}
address {
...AddressFragment
@ -154,12 +161,12 @@ export const TypedUpdateCustomerAddressMutation = TypedMutation<
>(updateCustomerAddress);
const removeCustomerAddress = gql`
${accountFragmentError}
${customerAddressesFragment}
mutation RemoveCustomerAddress($id: ID!) {
addressDelete(id: $id) {
errors {
field
message
errors: accountErrors {
...AccountErrorFragment
}
user {
...CustomerAddressesFragment
@ -173,11 +180,11 @@ export const TypedRemoveCustomerAddressMutation = TypedMutation<
>(removeCustomerAddress);
export const bulkRemoveCustomers = gql`
${accountFragmentError}
mutation BulkRemoveCustomers($ids: [ID]!) {
customerBulkDelete(ids: $ids) {
errors {
field
message
errors: accountErrors {
...AccountErrorFragment
}
}
}

View file

@ -0,0 +1,15 @@
/* tslint:disable */
/* eslint-disable */
// This file was automatically generated and should not be edited.
import { AccountErrorCode } from "./../../types/globalTypes";
// ====================================================
// GraphQL fragment: AccountErrorFragment
// ====================================================
export interface AccountErrorFragment {
__typename: "AccountError";
code: AccountErrorCode;
field: string | null;
}

View file

@ -2,14 +2,16 @@
/* eslint-disable */
// This file was automatically generated and should not be edited.
import { AccountErrorCode } from "./../../types/globalTypes";
// ====================================================
// GraphQL mutation operation: BulkRemoveCustomers
// ====================================================
export interface BulkRemoveCustomers_customerBulkDelete_errors {
__typename: "Error";
__typename: "AccountError";
code: AccountErrorCode;
field: string | null;
message: string | null;
}
export interface BulkRemoveCustomers_customerBulkDelete {

View file

@ -2,16 +2,16 @@
/* eslint-disable */
// This file was automatically generated and should not be edited.
import { UserCreateInput } from "./../../types/globalTypes";
import { UserCreateInput, AccountErrorCode } from "./../../types/globalTypes";
// ====================================================
// GraphQL mutation operation: CreateCustomer
// ====================================================
export interface CreateCustomer_customerCreate_errors {
__typename: "Error";
__typename: "AccountError";
code: AccountErrorCode;
field: string | null;
message: string | null;
}
export interface CreateCustomer_customerCreate_user {

View file

@ -2,16 +2,16 @@
/* eslint-disable */
// This file was automatically generated and should not be edited.
import { AddressInput } from "./../../types/globalTypes";
import { AddressInput, AccountErrorCode } from "./../../types/globalTypes";
// ====================================================
// GraphQL mutation operation: CreateCustomerAddress
// ====================================================
export interface CreateCustomerAddress_addressCreate_errors {
__typename: "Error";
__typename: "AccountError";
code: AccountErrorCode;
field: string | null;
message: string | null;
}
export interface CreateCustomerAddress_addressCreate_address_country {

View file

@ -2,14 +2,16 @@
/* eslint-disable */
// This file was automatically generated and should not be edited.
import { AccountErrorCode } from "./../../types/globalTypes";
// ====================================================
// GraphQL mutation operation: RemoveCustomer
// ====================================================
export interface RemoveCustomer_customerDelete_errors {
__typename: "Error";
__typename: "AccountError";
code: AccountErrorCode;
field: string | null;
message: string | null;
}
export interface RemoveCustomer_customerDelete {

View file

@ -2,14 +2,16 @@
/* eslint-disable */
// This file was automatically generated and should not be edited.
import { AccountErrorCode } from "./../../types/globalTypes";
// ====================================================
// GraphQL mutation operation: RemoveCustomerAddress
// ====================================================
export interface RemoveCustomerAddress_addressDelete_errors {
__typename: "Error";
__typename: "AccountError";
code: AccountErrorCode;
field: string | null;
message: string | null;
}
export interface RemoveCustomerAddress_addressDelete_user_addresses_country {

View file

@ -2,16 +2,16 @@
/* eslint-disable */
// This file was automatically generated and should not be edited.
import { AddressTypeEnum } from "./../../types/globalTypes";
import { AddressTypeEnum, AccountErrorCode } from "./../../types/globalTypes";
// ====================================================
// GraphQL mutation operation: SetCustomerDefaultAddress
// ====================================================
export interface SetCustomerDefaultAddress_addressSetDefault_errors {
__typename: "Error";
__typename: "AccountError";
code: AccountErrorCode;
field: string | null;
message: string | null;
}
export interface SetCustomerDefaultAddress_addressSetDefault_user_addresses_country {

View file

@ -2,16 +2,16 @@
/* eslint-disable */
// This file was automatically generated and should not be edited.
import { CustomerInput } from "./../../types/globalTypes";
import { CustomerInput, AccountErrorCode } from "./../../types/globalTypes";
// ====================================================
// GraphQL mutation operation: UpdateCustomer
// ====================================================
export interface UpdateCustomer_customerUpdate_errors {
__typename: "Error";
__typename: "AccountError";
code: AccountErrorCode;
field: string | null;
message: string | null;
}
export interface UpdateCustomer_customerUpdate_user_defaultShippingAddress_country {

View file

@ -2,16 +2,16 @@
/* eslint-disable */
// This file was automatically generated and should not be edited.
import { AddressInput } from "./../../types/globalTypes";
import { AddressInput, AccountErrorCode } from "./../../types/globalTypes";
// ====================================================
// GraphQL mutation operation: UpdateCustomerAddress
// ====================================================
export interface UpdateCustomerAddress_addressUpdate_errors {
__typename: "Error";
__typename: "AccountError";
code: AccountErrorCode;
field: string | null;
message: string | null;
}
export interface UpdateCustomerAddress_addressUpdate_address_country {

View file

@ -1,5 +1,6 @@
import gql from "graphql-tag";
import { accountFragmentError } from "@saleor/customers/mutations";
import { TypedMutation } from "../mutations";
import { serviceDetailsFragment, serviceFragment } from "./queries";
import { ServiceCreate, ServiceCreateVariables } from "./types/ServiceCreate";
@ -15,14 +16,14 @@ import {
import { ServiceUpdate, ServiceUpdateVariables } from "./types/ServiceUpdate";
const serviceCreateMutation = gql`
${accountFragmentError}
${serviceFragment}
mutation ServiceCreate($input: ServiceAccountInput!) {
serviceAccountCreate(input: $input) {
errors {
field
message
}
authToken
errors: accountErrors {
...AccountErrorFragment
}
serviceAccount {
...ServiceFragment
}
@ -36,11 +37,11 @@ export const ServiceCreateMutation = TypedMutation<
>(serviceCreateMutation);
const serviceDeleteMutation = gql`
${accountFragmentError}
mutation ServiceDelete($id: ID!) {
serviceAccountDelete(id: $id) {
errors {
field
message
errors: accountErrors {
...AccountErrorFragment
}
}
}
@ -51,12 +52,12 @@ export const ServiceDeleteMutation = TypedMutation<
>(serviceDeleteMutation);
const serviceUpdateMutation = gql`
${accountFragmentError}
${serviceDetailsFragment}
mutation ServiceUpdate($id: ID!, $input: ServiceAccountInput!) {
serviceAccountUpdate(id: $id, input: $input) {
errors {
field
message
errors: accountErrors {
...AccountErrorFragment
}
serviceAccount {
...ServiceDetailsFragment
@ -71,13 +72,13 @@ export const ServiceUpdateMutation = TypedMutation<
>(serviceUpdateMutation);
const serviceTokenCreate = gql`
${accountFragmentError}
mutation ServiceTokenCreate($input: ServiceAccountTokenInput!) {
serviceAccountTokenCreate(input: $input) {
errors {
field
message
}
authToken
errors: accountErrors {
...AccountErrorFragment
}
}
}
`;
@ -87,11 +88,11 @@ export const ServiceTokenCreateMutation = TypedMutation<
>(serviceTokenCreate);
const serviceTokenDelete = gql`
${accountFragmentError}
mutation ServiceTokenDelete($id: ID!) {
serviceAccountTokenDelete(id: $id) {
errors {
field
message
errors: accountErrors {
...AccountErrorFragment
}
}
}

View file

@ -2,16 +2,16 @@
/* eslint-disable */
// This file was automatically generated and should not be edited.
import { ServiceAccountInput } from "./../../types/globalTypes";
import { ServiceAccountInput, AccountErrorCode } from "./../../types/globalTypes";
// ====================================================
// GraphQL mutation operation: ServiceCreate
// ====================================================
export interface ServiceCreate_serviceAccountCreate_errors {
__typename: "Error";
__typename: "AccountError";
code: AccountErrorCode;
field: string | null;
message: string | null;
}
export interface ServiceCreate_serviceAccountCreate_serviceAccount {
@ -23,8 +23,8 @@ export interface ServiceCreate_serviceAccountCreate_serviceAccount {
export interface ServiceCreate_serviceAccountCreate {
__typename: "ServiceAccountCreate";
errors: ServiceCreate_serviceAccountCreate_errors[];
authToken: string | null;
errors: ServiceCreate_serviceAccountCreate_errors[];
serviceAccount: ServiceCreate_serviceAccountCreate_serviceAccount | null;
}

View file

@ -2,14 +2,16 @@
/* eslint-disable */
// This file was automatically generated and should not be edited.
import { AccountErrorCode } from "./../../types/globalTypes";
// ====================================================
// GraphQL mutation operation: ServiceDelete
// ====================================================
export interface ServiceDelete_serviceAccountDelete_errors {
__typename: "Error";
__typename: "AccountError";
code: AccountErrorCode;
field: string | null;
message: string | null;
}
export interface ServiceDelete_serviceAccountDelete {

View file

@ -2,22 +2,22 @@
/* eslint-disable */
// This file was automatically generated and should not be edited.
import { ServiceAccountTokenInput } from "./../../types/globalTypes";
import { ServiceAccountTokenInput, AccountErrorCode } from "./../../types/globalTypes";
// ====================================================
// GraphQL mutation operation: ServiceTokenCreate
// ====================================================
export interface ServiceTokenCreate_serviceAccountTokenCreate_errors {
__typename: "Error";
__typename: "AccountError";
code: AccountErrorCode;
field: string | null;
message: string | null;
}
export interface ServiceTokenCreate_serviceAccountTokenCreate {
__typename: "ServiceAccountTokenCreate";
errors: ServiceTokenCreate_serviceAccountTokenCreate_errors[];
authToken: string | null;
errors: ServiceTokenCreate_serviceAccountTokenCreate_errors[];
}
export interface ServiceTokenCreate {

View file

@ -2,14 +2,16 @@
/* eslint-disable */
// This file was automatically generated and should not be edited.
import { AccountErrorCode } from "./../../types/globalTypes";
// ====================================================
// GraphQL mutation operation: ServiceTokenDelete
// ====================================================
export interface ServiceTokenDelete_serviceAccountTokenDelete_errors {
__typename: "Error";
__typename: "AccountError";
code: AccountErrorCode;
field: string | null;
message: string | null;
}
export interface ServiceTokenDelete_serviceAccountTokenDelete {

View file

@ -2,16 +2,16 @@
/* eslint-disable */
// This file was automatically generated and should not be edited.
import { ServiceAccountInput, PermissionEnum } from "./../../types/globalTypes";
import { ServiceAccountInput, AccountErrorCode, PermissionEnum } from "./../../types/globalTypes";
// ====================================================
// GraphQL mutation operation: ServiceUpdate
// ====================================================
export interface ServiceUpdate_serviceAccountUpdate_errors {
__typename: "Error";
__typename: "AccountError";
code: AccountErrorCode;
field: string | null;
message: string | null;
}
export interface ServiceUpdate_serviceAccountUpdate_serviceAccount_permissions {

View file

@ -1,6 +1,7 @@
import gql from "graphql-tag";
import makeMutation from "@saleor/hooks/makeMutation";
import { accountFragmentError } from "@saleor/customers/mutations";
import { TypedMutation } from "../mutations";
import { staffMemberDetailsFragment } from "./queries";
import { StaffAvatarDelete } from "./types/StaffAvatarDelete";
@ -26,12 +27,12 @@ import {
} from "./types/ChangeStaffPassword";
const staffMemberAddMutation = gql`
${accountFragmentError}
${staffMemberDetailsFragment}
mutation StaffMemberAdd($input: StaffCreateInput!) {
staffCreate(input: $input) {
errors {
field
message
errors: accountErrors {
...AccountErrorFragment
}
user {
...StaffMemberDetailsFragment
@ -45,12 +46,12 @@ export const TypedStaffMemberAddMutation = TypedMutation<
>(staffMemberAddMutation);
const staffMemberUpdateMutation = gql`
${accountFragmentError}
${staffMemberDetailsFragment}
mutation StaffMemberUpdate($id: ID!, $input: StaffInput!) {
staffUpdate(id: $id, input: $input) {
errors {
field
message
errors: accountErrors {
...AccountErrorFragment
}
user {
...StaffMemberDetailsFragment
@ -64,11 +65,11 @@ export const TypedStaffMemberUpdateMutation = TypedMutation<
>(staffMemberUpdateMutation);
const staffMemberDeleteMutation = gql`
${accountFragmentError}
mutation StaffMemberDelete($id: ID!) {
staffDelete(id: $id) {
errors {
field
message
errors: accountErrors {
...AccountErrorFragment
}
}
}
@ -79,11 +80,11 @@ export const TypedStaffMemberDeleteMutation = TypedMutation<
>(staffMemberDeleteMutation);
const staffAvatarUpdateMutation = gql`
${accountFragmentError}
mutation StaffAvatarUpdate($image: Upload!) {
userAvatarUpdate(image: $image) {
errors {
field
message
errors: accountErrors {
...AccountErrorFragment
}
user {
id
@ -100,11 +101,11 @@ export const TypedStaffAvatarUpdateMutation = TypedMutation<
>(staffAvatarUpdateMutation);
const staffAvatarDeleteMutation = gql`
${accountFragmentError}
mutation StaffAvatarDelete {
userAvatarDelete {
errors {
field
message
errors: accountErrors {
...AccountErrorFragment
}
user {
id
@ -121,11 +122,11 @@ export const TypedStaffAvatarDeleteMutation = TypedMutation<
>(staffAvatarDeleteMutation);
const changeStaffPassword = gql`
${accountFragmentError}
mutation ChangeStaffPassword($newPassword: String!, $oldPassword: String!) {
passwordChange(newPassword: $newPassword, oldPassword: $oldPassword) {
errors {
field
message
errors: accountErrors {
...AccountErrorFragment
}
}
}

View file

@ -2,14 +2,16 @@
/* eslint-disable */
// This file was automatically generated and should not be edited.
import { AccountErrorCode } from "./../../types/globalTypes";
// ====================================================
// GraphQL mutation operation: ChangeStaffPassword
// ====================================================
export interface ChangeStaffPassword_passwordChange_errors {
__typename: "Error";
__typename: "AccountError";
code: AccountErrorCode;
field: string | null;
message: string | null;
}
export interface ChangeStaffPassword_passwordChange {

View file

@ -2,14 +2,16 @@
/* eslint-disable */
// This file was automatically generated and should not be edited.
import { AccountErrorCode } from "./../../types/globalTypes";
// ====================================================
// GraphQL mutation operation: StaffAvatarDelete
// ====================================================
export interface StaffAvatarDelete_userAvatarDelete_errors {
__typename: "Error";
__typename: "AccountError";
code: AccountErrorCode;
field: string | null;
message: string | null;
}
export interface StaffAvatarDelete_userAvatarDelete_user_avatar {

View file

@ -2,14 +2,16 @@
/* eslint-disable */
// This file was automatically generated and should not be edited.
import { AccountErrorCode } from "./../../types/globalTypes";
// ====================================================
// GraphQL mutation operation: StaffAvatarUpdate
// ====================================================
export interface StaffAvatarUpdate_userAvatarUpdate_errors {
__typename: "Error";
__typename: "AccountError";
code: AccountErrorCode;
field: string | null;
message: string | null;
}
export interface StaffAvatarUpdate_userAvatarUpdate_user_avatar {

View file

@ -2,16 +2,16 @@
/* eslint-disable */
// This file was automatically generated and should not be edited.
import { StaffCreateInput, PermissionEnum } from "./../../types/globalTypes";
import { StaffCreateInput, AccountErrorCode, PermissionEnum } from "./../../types/globalTypes";
// ====================================================
// GraphQL mutation operation: StaffMemberAdd
// ====================================================
export interface StaffMemberAdd_staffCreate_errors {
__typename: "Error";
__typename: "AccountError";
code: AccountErrorCode;
field: string | null;
message: string | null;
}
export interface StaffMemberAdd_staffCreate_user_avatar {

View file

@ -2,14 +2,16 @@
/* eslint-disable */
// This file was automatically generated and should not be edited.
import { AccountErrorCode } from "./../../types/globalTypes";
// ====================================================
// GraphQL mutation operation: StaffMemberDelete
// ====================================================
export interface StaffMemberDelete_staffDelete_errors {
__typename: "Error";
__typename: "AccountError";
code: AccountErrorCode;
field: string | null;
message: string | null;
}
export interface StaffMemberDelete_staffDelete {

View file

@ -2,16 +2,16 @@
/* eslint-disable */
// This file was automatically generated and should not be edited.
import { StaffInput, PermissionEnum } from "./../../types/globalTypes";
import { StaffInput, AccountErrorCode, PermissionEnum } from "./../../types/globalTypes";
// ====================================================
// GraphQL mutation operation: StaffMemberUpdate
// ====================================================
export interface StaffMemberUpdate_staffUpdate_errors {
__typename: "Error";
__typename: "AccountError";
code: AccountErrorCode;
field: string | null;
message: string | null;
}
export interface StaffMemberUpdate_staffUpdate_user_avatar {

View file

@ -6,6 +6,28 @@
// START Enums and Input Objects
//==============================================================
export enum AccountErrorCode {
ACTIVATE_OWN_ACCOUNT = "ACTIVATE_OWN_ACCOUNT",
ACTIVATE_SUPERUSER_ACCOUNT = "ACTIVATE_SUPERUSER_ACCOUNT",
ASSIGN_NON_STAFF_MEMBER = "ASSIGN_NON_STAFF_MEMBER",
DEACTIVATE_OWN_ACCOUNT = "DEACTIVATE_OWN_ACCOUNT",
DEACTIVATE_SUPERUSER_ACCOUNT = "DEACTIVATE_SUPERUSER_ACCOUNT",
DELETE_NON_STAFF_USER = "DELETE_NON_STAFF_USER",
DELETE_OWN_ACCOUNT = "DELETE_OWN_ACCOUNT",
DELETE_STAFF_ACCOUNT = "DELETE_STAFF_ACCOUNT",
DELETE_SUPERUSER_ACCOUNT = "DELETE_SUPERUSER_ACCOUNT",
GRAPHQL_ERROR = "GRAPHQL_ERROR",
INVALID = "INVALID",
INVALID_PASSWORD = "INVALID_PASSWORD",
NOT_FOUND = "NOT_FOUND",
PASSWORD_ENTIRELY_NUMERIC = "PASSWORD_ENTIRELY_NUMERIC",
PASSWORD_TOO_COMMON = "PASSWORD_TOO_COMMON",
PASSWORD_TOO_SHORT = "PASSWORD_TOO_SHORT",
PASSWORD_TOO_SIMILAR = "PASSWORD_TOO_SIMILAR",
REQUIRED = "REQUIRED",
UNIQUE = "UNIQUE",
}
export enum AddressTypeEnum {
BILLING = "BILLING",
SHIPPING = "SHIPPING",