Преглед изворни кода

refactor(core): Rename error `code` to `errorCode`

Less ambiguous, no conflicts with other types (e.g. Order) which already have a `code` field.
Michael Bromley пре 5 година
родитељ
комит
ed0a516848
36 измењених фајлова са 417 додато и 409 уклоњено
  1. 24 23
      packages/asset-server-plugin/e2e/graphql/generated-e2e-asset-server-plugin-types.ts
  2. 23 23
      packages/common/src/generated-shop-types.ts
  3. 24 23
      packages/common/src/generated-types.ts
  4. 1 1
      packages/core/e2e/auth.e2e-spec.ts
  5. 2 2
      packages/core/e2e/authentication-strategy.e2e-spec.ts
  6. 2 2
      packages/core/e2e/customer.e2e-spec.ts
  7. 2 1
      packages/core/e2e/default-search-plugin.e2e-spec.ts
  8. 1 1
      packages/core/e2e/global-settings.e2e-spec.ts
  9. 57 59
      packages/core/e2e/graphql/generated-e2e-admin-types.ts
  10. 67 74
      packages/core/e2e/graphql/generated-e2e-shop-types.ts
  11. 8 8
      packages/core/e2e/graphql/shared-definitions.ts
  12. 17 17
      packages/core/e2e/graphql/shop-definitions.ts
  13. 17 17
      packages/core/e2e/order.e2e-spec.ts
  14. 2 2
      packages/core/e2e/product.e2e-spec.ts
  15. 3 3
      packages/core/e2e/promotion.e2e-spec.ts
  16. 2 1
      packages/core/e2e/role.e2e-spec.ts
  17. 16 14
      packages/core/e2e/shop-auth.e2e-spec.ts
  18. 1 1
      packages/core/e2e/shop-customer.e2e-spec.ts
  19. 1 1
      packages/core/src/api/resolvers/shop/shop-auth.resolver.ts
  20. 1 1
      packages/core/src/api/schema/admin-api/asset.api.graphql
  21. 1 1
      packages/core/src/api/schema/admin-api/channel.api.graphql
  22. 1 1
      packages/core/src/api/schema/admin-api/global-settings.api.graphql
  23. 13 13
      packages/core/src/api/schema/admin-api/order.api.graphql
  24. 1 1
      packages/core/src/api/schema/admin-api/product.api.graphql
  25. 1 1
      packages/core/src/api/schema/admin-api/promotion.api.graphql
  26. 5 5
      packages/core/src/api/schema/common/common-types.graphql
  27. 19 19
      packages/core/src/api/schema/shop-api/shop.api.graphql
  28. 9 2
      packages/core/src/common/error/error-result.ts
  29. 23 23
      packages/core/src/common/error/generated-graphql-admin-errors.ts
  30. 23 23
      packages/core/src/common/error/generated-graphql-shop-errors.ts
  31. 24 23
      packages/elasticsearch-plugin/e2e/graphql/generated-e2e-elasticsearch-plugin-types.ts
  32. 1 1
      packages/testing/src/simple-graphql-client.ts
  33. 0 0
      schema-admin.json
  34. 0 0
      schema-shop.json
  35. 21 18
      scripts/codegen/generate-graphql-types.ts
  36. 4 4
      scripts/codegen/plugins/graphql-errors-plugin.ts

+ 24 - 23
packages/asset-server-plugin/e2e/graphql/generated-e2e-asset-server-plugin-types.ts

@@ -109,7 +109,7 @@ export type AdministratorSortParameter = {
 
 /** Returned if an attempting to refund an OrderItem which has already been refunded */
 export type AlreadyRefundedError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     refundId: Scalars['ID'];
 };
@@ -208,7 +208,7 @@ export type BooleanOperators = {
 
 /** Returned if an attempting to cancel lines from an Order which is still active */
 export type CancelActiveOrderError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     orderState: Scalars['String'];
 };
@@ -258,7 +258,7 @@ export type Channel = Node & {
  * of the GlobalSettings
  */
 export type ChannelDefaultLanguageError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     language: Scalars['String'];
     channelCode: Scalars['String'];
@@ -1141,13 +1141,13 @@ export enum DeletionResult {
 
 /** Retured when attemting to create a Customer with an email address already registered to an existing User. */
 export type EmailAddressConflictError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
 /** Returned if no OrderLines have been specified for the operation */
 export type EmptyOrderLineSelectionError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -1178,7 +1178,7 @@ export enum ErrorCode {
 }
 
 export type ErrorResult = {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -1301,7 +1301,7 @@ export type Fulfillment = Node & {
 
 /** Returned when there is an error in transitioning the Fulfillment state */
 export type FulfillmentStateTransitionError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     transitionError: Scalars['String'];
     fromState: Scalars['String'];
@@ -1406,13 +1406,13 @@ export type IntCustomFieldConfig = CustomField & {
 
 /** Returned if the user authentication credentials are not valid */
 export type InvalidCredentialsError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
 /** Returned if the specified items are already part of a Fulfillment */
 export type ItemsAlreadyFulfilledError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -1809,8 +1809,9 @@ export enum LanguageCode {
     zu = 'zu',
 }
 
+/** Returned if attempting to set a Channel's defaultLanguageCode to a language which is not enabled in GlobalSettings */
 export type LanguageNotAvailableError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     languageCode: Scalars['String'];
 };
@@ -1838,7 +1839,7 @@ export enum LogicalOperator {
 }
 
 export type MimeTypeError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     fileName: Scalars['String'];
     mimeType: Scalars['String'];
@@ -1846,7 +1847,7 @@ export type MimeTypeError = ErrorResult & {
 
 /** Returned if a PromotionCondition has neither a couponCode nor any conditions set */
 export type MissingConditionsError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -1858,7 +1859,7 @@ export type MoveCollectionInput = {
 
 /** Returned if an operation has specified OrderLines from multiple Orders */
 export type MultipleOrderError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -2413,7 +2414,7 @@ export type NativeAuthInput = {
 
 /** Retured when attempting an operation that relies on the NativeAuthStrategy, if that strategy is not configured. */
 export type NativeAuthStrategyError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -2423,7 +2424,7 @@ export type Node = {
 
 /** Returned if an attempting to refund an Order but neither items nor shipping refund was specified */
 export type NothingToRefundError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -2575,7 +2576,7 @@ export type OrderSortParameter = {
 
 /** Returned if there is an error in transitioning the Order state */
 export type OrderStateTransitionError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     transitionError: Scalars['String'];
     fromState: Scalars['String'];
@@ -2638,13 +2639,13 @@ export type PaymentMethodSortParameter = {
 
 /** Returned if an attempting to refund a Payment against OrderLines from a different Order */
 export type PaymentOrderMismatchError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
 /** Returned when there is an error in transitioning the Payment state */
 export type PaymentStateTransitionError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     transitionError: Scalars['String'];
     fromState: Scalars['String'];
@@ -2783,7 +2784,7 @@ export type ProductOptionGroupTranslationInput = {
 };
 
 export type ProductOptionInUseError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     optionGroupCode: Scalars['String'];
     productVariantCount: Scalars['Int'];
@@ -2967,7 +2968,7 @@ export type PromotionSortParameter = {
 
 /** Returned if the specified quantity of an OrderLine is greater than the number of items in that line */
 export type QuantityTooGreatError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -3231,14 +3232,14 @@ export type RefundOrderResult =
 
 /** Returned if an attempting to refund an Order which is not in the expected state */
 export type RefundOrderStateError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     orderState: Scalars['String'];
 };
 
 /** Returned when there is an error in transitioning the Refund state */
 export type RefundStateTransitionError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     transitionError: Scalars['String'];
     fromState: Scalars['String'];
@@ -3383,7 +3384,7 @@ export type ServerConfig = {
 
 /** Returned if the Payment settlement fails */
 export type SettlePaymentError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     paymentErrorMessage: Scalars['String'];
 };

+ 23 - 23
packages/common/src/generated-shop-types.ts

@@ -80,7 +80,7 @@ export type AdministratorList = PaginatedList & {
 /** Retured when attemting to set the Customer for an Order when already logged in. */
 export type AlreadyLoggedInError = ErrorResult & {
     __typename?: 'AlreadyLoggedInError';
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -324,7 +324,7 @@ export type CountryTranslation = {
 /** Returned if the provided coupon code is invalid */
 export type CouponCodeExpiredError = ErrorResult & {
     __typename?: 'CouponCodeExpiredError';
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     couponCode: Scalars['String'];
 };
@@ -332,7 +332,7 @@ export type CouponCodeExpiredError = ErrorResult & {
 /** Returned if the provided coupon code is invalid */
 export type CouponCodeInvalidError = ErrorResult & {
     __typename?: 'CouponCodeInvalidError';
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     couponCode: Scalars['String'];
 };
@@ -340,7 +340,7 @@ export type CouponCodeInvalidError = ErrorResult & {
 /** Returned if the provided coupon code is invalid */
 export type CouponCodeLimitError = ErrorResult & {
     __typename?: 'CouponCodeLimitError';
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     couponCode: Scalars['String'];
     limit: Scalars['Int'];
@@ -857,7 +857,7 @@ export enum DeletionResult {
 /** Retured when attemting to create a Customer with an email address already registered to an existing User. */
 export type EmailAddressConflictError = ErrorResult & {
     __typename?: 'EmailAddressConflictError';
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -888,7 +888,7 @@ export enum ErrorCode {
 }
 
 export type ErrorResult = {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -1057,7 +1057,7 @@ export enum HistoryEntryType {
  */
 export type IdentifierChangeTokenExpiredError = ErrorResult & {
     __typename?: 'IdentifierChangeTokenExpiredError';
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -1067,7 +1067,7 @@ export type IdentifierChangeTokenExpiredError = ErrorResult & {
  */
 export type IdentifierChangeTokenInvalidError = ErrorResult & {
     __typename?: 'IdentifierChangeTokenInvalidError';
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -1095,7 +1095,7 @@ export type IntCustomFieldConfig = CustomField & {
 /** Returned if the user authentication credentials are not valid */
 export type InvalidCredentialsError = ErrorResult & {
     __typename?: 'InvalidCredentialsError';
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -1452,7 +1452,7 @@ export enum LogicalOperator {
 /** Retured when attemting to register or verify a customer account without a password, when one is required. */
 export type MissingPasswordError = ErrorResult & {
     __typename?: 'MissingPasswordError';
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -1685,14 +1685,14 @@ export type NativeAuthInput = {
 /** Retured when attempting an operation that relies on the NativeAuthStrategy, if that strategy is not configured. */
 export type NativeAuthStrategyError = ErrorResult & {
     __typename?: 'NativeAuthStrategyError';
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
 /** Retured when attemting to set a negative OrderLine quantity. */
 export type NegativeQuantityError = ErrorResult & {
     __typename?: 'NegativeQuantityError';
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -1799,7 +1799,7 @@ export type OrderItem = Node & {
 /** Retured when the maximum order size limit has been reached. */
 export type OrderLimitError = ErrorResult & {
     __typename?: 'OrderLimitError';
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     maxItems: Scalars['Int'];
 };
@@ -1837,14 +1837,14 @@ export type OrderListOptions = {
 /** Returned when attempting to modify the contents of an Order that is not in the `AddingItems` state. */
 export type OrderModificationError = ErrorResult & {
     __typename?: 'OrderModificationError';
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
 /** Returned when attempting to add a Payment to an Order that is not in the `ArrangingPayment` state. */
 export type OrderPaymentStateError = ErrorResult & {
     __typename?: 'OrderPaymentStateError';
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -1871,7 +1871,7 @@ export type OrderSortParameter = {
 /** Returned if there is an error in transitioning the Order state */
 export type OrderStateTransitionError = ErrorResult & {
     __typename?: 'OrderStateTransitionError';
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     transitionError: Scalars['String'];
     fromState: Scalars['String'];
@@ -1886,7 +1886,7 @@ export type PaginatedList = {
 /** Retured when attemting to verify a customer account with a password, when a password has already been set. */
 export type PasswordAlreadySetError = ErrorResult & {
     __typename?: 'PasswordAlreadySetError';
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -1896,7 +1896,7 @@ export type PasswordAlreadySetError = ErrorResult & {
  */
 export type PasswordResetTokenExpiredError = ErrorResult & {
     __typename?: 'PasswordResetTokenExpiredError';
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -1906,7 +1906,7 @@ export type PasswordResetTokenExpiredError = ErrorResult & {
  */
 export type PasswordResetTokenInvalidError = ErrorResult & {
     __typename?: 'PasswordResetTokenInvalidError';
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -1927,7 +1927,7 @@ export type Payment = Node & {
 /** Returned when a Payment is declined by the payment provider. */
 export type PaymentDeclinedError = ErrorResult & {
     __typename?: 'PaymentDeclinedError';
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     paymentErrorMessage: Scalars['String'];
 };
@@ -1935,7 +1935,7 @@ export type PaymentDeclinedError = ErrorResult & {
 /** Returned when a Payment fails due to an error. */
 export type PaymentFailedError = ErrorResult & {
     __typename?: 'PaymentFailedError';
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     paymentErrorMessage: Scalars['String'];
 };
@@ -2637,7 +2637,7 @@ export type User = Node & {
  */
 export type VerificationTokenExpiredError = ErrorResult & {
     __typename?: 'VerificationTokenExpiredError';
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -2647,7 +2647,7 @@ export type VerificationTokenExpiredError = ErrorResult & {
  */
 export type VerificationTokenInvalidError = ErrorResult & {
     __typename?: 'VerificationTokenInvalidError';
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 

+ 24 - 23
packages/common/src/generated-types.ts

@@ -111,7 +111,7 @@ export type AdministratorSortParameter = {
 /** Returned if an attempting to refund an OrderItem which has already been refunded */
 export type AlreadyRefundedError = ErrorResult & {
   __typename?: 'AlreadyRefundedError';
-  code: ErrorCode;
+  errorCode: ErrorCode;
   message: Scalars['String'];
   refundId: Scalars['ID'];
 };
@@ -215,7 +215,7 @@ export type BooleanOperators = {
 /** Returned if an attempting to cancel lines from an Order which is still active */
 export type CancelActiveOrderError = ErrorResult & {
   __typename?: 'CancelActiveOrderError';
-  code: ErrorCode;
+  errorCode: ErrorCode;
   message: Scalars['String'];
   orderState: Scalars['String'];
 };
@@ -261,7 +261,7 @@ export type Channel = Node & {
  */
 export type ChannelDefaultLanguageError = ErrorResult & {
   __typename?: 'ChannelDefaultLanguageError';
-  code: ErrorCode;
+  errorCode: ErrorCode;
   message: Scalars['String'];
   language: Scalars['String'];
   channelCode: Scalars['String'];
@@ -1165,14 +1165,14 @@ export enum DeletionResult {
 /** Retured when attemting to create a Customer with an email address already registered to an existing User. */
 export type EmailAddressConflictError = ErrorResult & {
   __typename?: 'EmailAddressConflictError';
-  code: ErrorCode;
+  errorCode: ErrorCode;
   message: Scalars['String'];
 };
 
 /** Returned if no OrderLines have been specified for the operation */
 export type EmptyOrderLineSelectionError = ErrorResult & {
   __typename?: 'EmptyOrderLineSelectionError';
-  code: ErrorCode;
+  errorCode: ErrorCode;
   message: Scalars['String'];
 };
 
@@ -1203,7 +1203,7 @@ export enum ErrorCode {
 }
 
 export type ErrorResult = {
-  code: ErrorCode;
+  errorCode: ErrorCode;
   message: Scalars['String'];
 };
 
@@ -1335,7 +1335,7 @@ export type Fulfillment = Node & {
 /** Returned when there is an error in transitioning the Fulfillment state */
 export type FulfillmentStateTransitionError = ErrorResult & {
   __typename?: 'FulfillmentStateTransitionError';
-  code: ErrorCode;
+  errorCode: ErrorCode;
   message: Scalars['String'];
   transitionError: Scalars['String'];
   fromState: Scalars['String'];
@@ -1446,14 +1446,14 @@ export type IntCustomFieldConfig = CustomField & {
 /** Returned if the user authentication credentials are not valid */
 export type InvalidCredentialsError = ErrorResult & {
   __typename?: 'InvalidCredentialsError';
-  code: ErrorCode;
+  errorCode: ErrorCode;
   message: Scalars['String'];
 };
 
 /** Returned if the specified items are already part of a Fulfillment */
 export type ItemsAlreadyFulfilledError = ErrorResult & {
   __typename?: 'ItemsAlreadyFulfilledError';
-  code: ErrorCode;
+  errorCode: ErrorCode;
   message: Scalars['String'];
 };
 
@@ -1854,9 +1854,10 @@ export enum LanguageCode {
   zu = 'zu'
 }
 
+/** Returned if attempting to set a Channel's defaultLanguageCode to a language which is not enabled in GlobalSettings */
 export type LanguageNotAvailableError = ErrorResult & {
   __typename?: 'LanguageNotAvailableError';
-  code: ErrorCode;
+  errorCode: ErrorCode;
   message: Scalars['String'];
   languageCode: Scalars['String'];
 };
@@ -1887,7 +1888,7 @@ export enum LogicalOperator {
 
 export type MimeTypeError = ErrorResult & {
   __typename?: 'MimeTypeError';
-  code: ErrorCode;
+  errorCode: ErrorCode;
   message: Scalars['String'];
   fileName: Scalars['String'];
   mimeType: Scalars['String'];
@@ -1896,7 +1897,7 @@ export type MimeTypeError = ErrorResult & {
 /** Returned if a PromotionCondition has neither a couponCode nor any conditions set */
 export type MissingConditionsError = ErrorResult & {
   __typename?: 'MissingConditionsError';
-  code: ErrorCode;
+  errorCode: ErrorCode;
   message: Scalars['String'];
 };
 
@@ -1909,7 +1910,7 @@ export type MoveCollectionInput = {
 /** Returned if an operation has specified OrderLines from multiple Orders */
 export type MultipleOrderError = ErrorResult & {
   __typename?: 'MultipleOrderError';
-  code: ErrorCode;
+  errorCode: ErrorCode;
   message: Scalars['String'];
 };
 
@@ -2555,7 +2556,7 @@ export type NativeAuthInput = {
 /** Retured when attempting an operation that relies on the NativeAuthStrategy, if that strategy is not configured. */
 export type NativeAuthStrategyError = ErrorResult & {
   __typename?: 'NativeAuthStrategyError';
-  code: ErrorCode;
+  errorCode: ErrorCode;
   message: Scalars['String'];
 };
 
@@ -2566,7 +2567,7 @@ export type Node = {
 /** Returned if an attempting to refund an Order but neither items nor shipping refund was specified */
 export type NothingToRefundError = ErrorResult & {
   __typename?: 'NothingToRefundError';
-  code: ErrorCode;
+  errorCode: ErrorCode;
   message: Scalars['String'];
 };
 
@@ -2726,7 +2727,7 @@ export type OrderSortParameter = {
 /** Returned if there is an error in transitioning the Order state */
 export type OrderStateTransitionError = ErrorResult & {
   __typename?: 'OrderStateTransitionError';
-  code: ErrorCode;
+  errorCode: ErrorCode;
   message: Scalars['String'];
   transitionError: Scalars['String'];
   fromState: Scalars['String'];
@@ -2793,14 +2794,14 @@ export type PaymentMethodSortParameter = {
 /** Returned if an attempting to refund a Payment against OrderLines from a different Order */
 export type PaymentOrderMismatchError = ErrorResult & {
   __typename?: 'PaymentOrderMismatchError';
-  code: ErrorCode;
+  errorCode: ErrorCode;
   message: Scalars['String'];
 };
 
 /** Returned when there is an error in transitioning the Payment state */
 export type PaymentStateTransitionError = ErrorResult & {
   __typename?: 'PaymentStateTransitionError';
-  code: ErrorCode;
+  errorCode: ErrorCode;
   message: Scalars['String'];
   transitionError: Scalars['String'];
   fromState: Scalars['String'];
@@ -2946,7 +2947,7 @@ export type ProductOptionGroupTranslationInput = {
 
 export type ProductOptionInUseError = ErrorResult & {
   __typename?: 'ProductOptionInUseError';
-  code: ErrorCode;
+  errorCode: ErrorCode;
   message: Scalars['String'];
   optionGroupCode: Scalars['String'];
   productVariantCount: Scalars['Int'];
@@ -3139,7 +3140,7 @@ export type PromotionSortParameter = {
 /** Returned if the specified quantity of an OrderLine is greater than the number of items in that line */
 export type QuantityTooGreatError = ErrorResult & {
   __typename?: 'QuantityTooGreatError';
-  code: ErrorCode;
+  errorCode: ErrorCode;
   message: Scalars['String'];
 };
 
@@ -3437,7 +3438,7 @@ export type RefundOrderResult = Refund | QuantityTooGreatError | NothingToRefund
 /** Returned if an attempting to refund an Order which is not in the expected state */
 export type RefundOrderStateError = ErrorResult & {
   __typename?: 'RefundOrderStateError';
-  code: ErrorCode;
+  errorCode: ErrorCode;
   message: Scalars['String'];
   orderState: Scalars['String'];
 };
@@ -3445,7 +3446,7 @@ export type RefundOrderStateError = ErrorResult & {
 /** Returned when there is an error in transitioning the Refund state */
 export type RefundStateTransitionError = ErrorResult & {
   __typename?: 'RefundStateTransitionError';
-  code: ErrorCode;
+  errorCode: ErrorCode;
   message: Scalars['String'];
   transitionError: Scalars['String'];
   fromState: Scalars['String'];
@@ -3598,7 +3599,7 @@ export type ServerConfig = {
 /** Returned if the Payment settlement fails */
 export type SettlePaymentError = ErrorResult & {
   __typename?: 'SettlePaymentError';
-  code: ErrorCode;
+  errorCode: ErrorCode;
   message: Scalars['String'];
   paymentErrorMessage: Scalars['String'];
 };

+ 1 - 1
packages/core/e2e/auth.e2e-spec.ts

@@ -80,7 +80,7 @@ describe('Authorization & permissions', () => {
             it('cannot login', async () => {
                 const result = await adminClient.asUserWithCredentials(customerEmailAddress, 'test');
 
-                expect(result.code).toBe(ErrorCode.INVALID_CREDENTIALS_ERROR);
+                expect(result.errorCode).toBe(ErrorCode.INVALID_CREDENTIALS_ERROR);
             });
         });
 

+ 2 - 2
packages/core/e2e/authentication-strategy.e2e-spec.ts

@@ -74,7 +74,7 @@ describe('AuthenticationStrategy', () => {
             });
 
             expect(authenticate.message).toBe('The provided credentials are invalid');
-            expect(authenticate.code).toBe(ErrorCode.INVALID_CREDENTIALS_ERROR);
+            expect(authenticate.errorCode).toBe(ErrorCode.INVALID_CREDENTIALS_ERROR);
         });
 
         it('creates a new Customer with valid token', async () => {
@@ -224,7 +224,7 @@ const AUTHENTICATE = gql`
         authenticate(input: $input) {
             ...CurrentUser
             ... on ErrorResult {
-                code
+                errorCode
                 message
             }
         }

+ 2 - 2
packages/core/e2e/customer.e2e-spec.ts

@@ -448,7 +448,7 @@ describe('Customer resolver', () => {
             customerErrorGuard.assertErrorResult(createCustomer);
 
             expect(createCustomer.message).toBe('The email address is not available.');
-            expect(createCustomer.code).toBe(ErrorCode.EMAIL_ADDRESS_CONFLICT_ERROR);
+            expect(createCustomer.errorCode).toBe(ErrorCode.EMAIL_ADDRESS_CONFLICT_ERROR);
         });
     });
 
@@ -466,7 +466,7 @@ describe('Customer resolver', () => {
             customerErrorGuard.assertErrorResult(updateCustomer);
 
             expect(updateCustomer.message).toBe('The email address is not available.');
-            expect(updateCustomer.code).toBe(ErrorCode.EMAIL_ADDRESS_CONFLICT_ERROR);
+            expect(updateCustomer.errorCode).toBe(ErrorCode.EMAIL_ADDRESS_CONFLICT_ERROR);
         });
 
         it('succeeds when emailAddress is available', async () => {

+ 2 - 1
packages/core/e2e/default-search-plugin.e2e-spec.ts

@@ -16,6 +16,7 @@ import { TEST_SETUP_TIMEOUT_MS, testConfig } from '../../../e2e-common/test-conf
 
 import {
     AssignProductsToChannel,
+    ChannelFragment,
     CreateChannel,
     CreateCollection,
     CreateFacet,
@@ -869,7 +870,7 @@ describe('Default search plugin', () => {
 
         describe('channel handling', () => {
             const SECOND_CHANNEL_TOKEN = 'second-channel-token';
-            let secondChannel: CreateChannel.CreateChannel;
+            let secondChannel: ChannelFragment;
 
             beforeAll(async () => {
                 const { createChannel } = await adminClient.query<

+ 1 - 1
packages/core/e2e/global-settings.e2e-spec.ts

@@ -140,7 +140,7 @@ const UPDATE_GLOBAL_SETTINGS = gql`
         updateGlobalSettings(input: $input) {
             ...GlobalSettings
             ... on ErrorResult {
-                code
+                errorCode
                 message
             }
         }

+ 57 - 59
packages/core/e2e/graphql/generated-e2e-admin-types.ts

@@ -109,7 +109,7 @@ export type AdministratorSortParameter = {
 
 /** Returned if an attempting to refund an OrderItem which has already been refunded */
 export type AlreadyRefundedError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     refundId: Scalars['ID'];
 };
@@ -208,7 +208,7 @@ export type BooleanOperators = {
 
 /** Returned if an attempting to cancel lines from an Order which is still active */
 export type CancelActiveOrderError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     orderState: Scalars['String'];
 };
@@ -258,7 +258,7 @@ export type Channel = Node & {
  * of the GlobalSettings
  */
 export type ChannelDefaultLanguageError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     language: Scalars['String'];
     channelCode: Scalars['String'];
@@ -1141,13 +1141,13 @@ export enum DeletionResult {
 
 /** Retured when attemting to create a Customer with an email address already registered to an existing User. */
 export type EmailAddressConflictError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
 /** Returned if no OrderLines have been specified for the operation */
 export type EmptyOrderLineSelectionError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -1178,7 +1178,7 @@ export enum ErrorCode {
 }
 
 export type ErrorResult = {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -1301,7 +1301,7 @@ export type Fulfillment = Node & {
 
 /** Returned when there is an error in transitioning the Fulfillment state */
 export type FulfillmentStateTransitionError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     transitionError: Scalars['String'];
     fromState: Scalars['String'];
@@ -1406,13 +1406,13 @@ export type IntCustomFieldConfig = CustomField & {
 
 /** Returned if the user authentication credentials are not valid */
 export type InvalidCredentialsError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
 /** Returned if the specified items are already part of a Fulfillment */
 export type ItemsAlreadyFulfilledError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -1809,8 +1809,9 @@ export enum LanguageCode {
     zu = 'zu',
 }
 
+/** Returned if attempting to set a Channel's defaultLanguageCode to a language which is not enabled in GlobalSettings */
 export type LanguageNotAvailableError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     languageCode: Scalars['String'];
 };
@@ -1838,7 +1839,7 @@ export enum LogicalOperator {
 }
 
 export type MimeTypeError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     fileName: Scalars['String'];
     mimeType: Scalars['String'];
@@ -1846,7 +1847,7 @@ export type MimeTypeError = ErrorResult & {
 
 /** Returned if a PromotionCondition has neither a couponCode nor any conditions set */
 export type MissingConditionsError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -1858,7 +1859,7 @@ export type MoveCollectionInput = {
 
 /** Returned if an operation has specified OrderLines from multiple Orders */
 export type MultipleOrderError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -2413,7 +2414,7 @@ export type NativeAuthInput = {
 
 /** Retured when attempting an operation that relies on the NativeAuthStrategy, if that strategy is not configured. */
 export type NativeAuthStrategyError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -2423,7 +2424,7 @@ export type Node = {
 
 /** Returned if an attempting to refund an Order but neither items nor shipping refund was specified */
 export type NothingToRefundError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -2575,7 +2576,7 @@ export type OrderSortParameter = {
 
 /** Returned if there is an error in transitioning the Order state */
 export type OrderStateTransitionError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     transitionError: Scalars['String'];
     fromState: Scalars['String'];
@@ -2638,13 +2639,13 @@ export type PaymentMethodSortParameter = {
 
 /** Returned if an attempting to refund a Payment against OrderLines from a different Order */
 export type PaymentOrderMismatchError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
 /** Returned when there is an error in transitioning the Payment state */
 export type PaymentStateTransitionError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     transitionError: Scalars['String'];
     fromState: Scalars['String'];
@@ -2783,7 +2784,7 @@ export type ProductOptionGroupTranslationInput = {
 };
 
 export type ProductOptionInUseError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     optionGroupCode: Scalars['String'];
     productVariantCount: Scalars['Int'];
@@ -2967,7 +2968,7 @@ export type PromotionSortParameter = {
 
 /** Returned if the specified quantity of an OrderLine is greater than the number of items in that line */
 export type QuantityTooGreatError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -3231,14 +3232,14 @@ export type RefundOrderResult =
 
 /** Returned if an attempting to refund an Order which is not in the expected state */
 export type RefundOrderStateError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     orderState: Scalars['String'];
 };
 
 /** Returned when there is an error in transitioning the Refund state */
 export type RefundStateTransitionError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     transitionError: Scalars['String'];
     fromState: Scalars['String'];
@@ -3383,7 +3384,7 @@ export type ServerConfig = {
 
 /** Returned if the Payment settlement fails */
 export type SettlePaymentError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     paymentErrorMessage: Scalars['String'];
 };
@@ -3924,7 +3925,7 @@ export type AuthenticateMutationVariables = Exact<{
 }>;
 
 export type AuthenticateMutation = {
-    authenticate: CurrentUserFragment | Pick<InvalidCredentialsError, 'code' | 'message'>;
+    authenticate: CurrentUserFragment | Pick<InvalidCredentialsError, 'errorCode' | 'message'>;
 };
 
 export type GetCustomersQueryVariables = Exact<{ [key: string]: never }>;
@@ -4329,7 +4330,7 @@ export type UpdateGlobalSettingsMutationVariables = Exact<{
 }>;
 
 export type UpdateGlobalSettingsMutation = {
-    updateGlobalSettings: GlobalSettingsFragment | Pick<ChannelDefaultLanguageError, 'code' | 'message'>;
+    updateGlobalSettings: GlobalSettingsFragment | Pick<ChannelDefaultLanguageError, 'errorCode' | 'message'>;
 };
 
 export type AdministratorFragment = Pick<Administrator, 'id' | 'firstName' | 'lastName' | 'emailAddress'> & {
@@ -4720,7 +4721,7 @@ export type CreatePromotionMutationVariables = Exact<{
 }>;
 
 export type CreatePromotionMutation = {
-    createPromotion: PromotionFragment | Pick<MissingConditionsError, 'code' | 'message'>;
+    createPromotion: PromotionFragment | Pick<MissingConditionsError, 'errorCode' | 'message'>;
 };
 
 export type MeQueryVariables = Exact<{ [key: string]: never }>;
@@ -4734,9 +4735,7 @@ export type CreateChannelMutationVariables = Exact<{
 export type CreateChannelMutation = {
     createChannel:
         | ChannelFragment
-        | (Pick<LanguageNotAvailableError, 'message' | 'languageCode'> & {
-              errorCode: LanguageNotAvailableError['code'];
-          });
+        | Pick<LanguageNotAvailableError, 'errorCode' | 'message' | 'languageCode'>;
 };
 
 export type DeleteProductVariantMutationVariables = Exact<{
@@ -4783,9 +4782,7 @@ export type UpdateChannelMutationVariables = Exact<{
 export type UpdateChannelMutation = {
     updateChannel:
         | ChannelFragment
-        | (Pick<LanguageNotAvailableError, 'message' | 'languageCode'> & {
-              errorCode: LanguageNotAvailableError['code'];
-          });
+        | Pick<LanguageNotAvailableError, 'errorCode' | 'message' | 'languageCode'>;
 };
 
 export type GetCustomerHistoryQueryVariables = Exact<{
@@ -4837,8 +4834,8 @@ export type CreateFulfillmentMutationVariables = Exact<{
 export type CreateFulfillmentMutation = {
     addFulfillmentToOrder:
         | FulfillmentFragment
-        | Pick<EmptyOrderLineSelectionError, 'code' | 'message'>
-        | Pick<ItemsAlreadyFulfilledError, 'code' | 'message'>;
+        | Pick<EmptyOrderLineSelectionError, 'errorCode' | 'message'>
+        | Pick<ItemsAlreadyFulfilledError, 'errorCode' | 'message'>;
 };
 
 export type TransitFulfillmentMutationVariables = Exact<{
@@ -4851,7 +4848,7 @@ export type TransitFulfillmentMutation = {
         | FulfillmentFragment
         | Pick<
               FulfillmentStateTransitionError,
-              'code' | 'message' | 'transitionError' | 'fromState' | 'toState'
+              'errorCode' | 'message' | 'transitionError' | 'fromState' | 'toState'
           >;
 };
 
@@ -4911,7 +4908,7 @@ export type CreateCustomerMutationVariables = Exact<{
 }>;
 
 export type CreateCustomerMutation = {
-    createCustomer: CustomerFragment | Pick<EmailAddressConflictError, 'code' | 'message'>;
+    createCustomer: CustomerFragment | Pick<EmailAddressConflictError, 'errorCode' | 'message'>;
 };
 
 export type UpdateCustomerMutationVariables = Exact<{
@@ -4919,7 +4916,7 @@ export type UpdateCustomerMutationVariables = Exact<{
 }>;
 
 export type UpdateCustomerMutation = {
-    updateCustomer: CustomerFragment | Pick<EmailAddressConflictError, 'code' | 'message'>;
+    updateCustomer: CustomerFragment | Pick<EmailAddressConflictError, 'errorCode' | 'message'>;
 };
 
 export type DeleteCustomerMutationVariables = Exact<{
@@ -5002,9 +4999,10 @@ export type AdminTransitionMutationVariables = Exact<{
 export type AdminTransitionMutation = {
     transitionOrderToState?: Maybe<
         | OrderFragment
-        | (Pick<OrderStateTransitionError, 'message' | 'transitionError' | 'fromState' | 'toState'> & {
-              errorCode: OrderStateTransitionError['code'];
-          })
+        | Pick<
+              OrderStateTransitionError,
+              'errorCode' | 'message' | 'transitionError' | 'fromState' | 'toState'
+          >
     >;
 };
 
@@ -5041,9 +5039,9 @@ export type SettlePaymentMutationVariables = Exact<{
 export type SettlePaymentMutation = {
     settlePayment:
         | PaymentFragment
-        | Pick<SettlePaymentError, 'code' | 'message' | 'paymentErrorMessage'>
-        | Pick<PaymentStateTransitionError, 'code' | 'message'>
-        | Pick<OrderStateTransitionError, 'code' | 'message'>;
+        | Pick<SettlePaymentError, 'errorCode' | 'message' | 'paymentErrorMessage'>
+        | Pick<PaymentStateTransitionError, 'errorCode' | 'message'>
+        | Pick<OrderStateTransitionError, 'errorCode' | 'message'>;
 };
 
 export type PaymentFragment = Pick<Payment, 'id' | 'state' | 'metadata'>;
@@ -5075,11 +5073,11 @@ export type CancelOrderMutationVariables = Exact<{
 export type CancelOrderMutation = {
     cancelOrder:
         | CanceledOrderFragment
-        | Pick<EmptyOrderLineSelectionError, 'code' | 'message'>
-        | Pick<QuantityTooGreatError, 'code' | 'message'>
-        | Pick<MultipleOrderError, 'code' | 'message'>
-        | Pick<CancelActiveOrderError, 'code' | 'message'>
-        | Pick<OrderStateTransitionError, 'code' | 'message'>;
+        | Pick<EmptyOrderLineSelectionError, 'errorCode' | 'message'>
+        | Pick<QuantityTooGreatError, 'errorCode' | 'message'>
+        | Pick<MultipleOrderError, 'errorCode' | 'message'>
+        | Pick<CancelActiveOrderError, 'errorCode' | 'message'>
+        | Pick<OrderStateTransitionError, 'errorCode' | 'message'>;
 };
 
 export type CanceledOrderFragment = Pick<Order, 'id'> & {
@@ -5098,14 +5096,14 @@ export type RefundOrderMutationVariables = Exact<{
 export type RefundOrderMutation = {
     refundOrder:
         | RefundFragment
-        | Pick<QuantityTooGreatError, 'code' | 'message'>
-        | Pick<NothingToRefundError, 'code' | 'message'>
-        | Pick<OrderStateTransitionError, 'code' | 'message'>
-        | Pick<MultipleOrderError, 'code' | 'message'>
-        | Pick<PaymentOrderMismatchError, 'code' | 'message'>
-        | Pick<RefundOrderStateError, 'code' | 'message'>
-        | Pick<AlreadyRefundedError, 'code' | 'message'>
-        | Pick<RefundStateTransitionError, 'code' | 'message'>;
+        | Pick<QuantityTooGreatError, 'errorCode' | 'message'>
+        | Pick<NothingToRefundError, 'errorCode' | 'message'>
+        | Pick<OrderStateTransitionError, 'errorCode' | 'message'>
+        | Pick<MultipleOrderError, 'errorCode' | 'message'>
+        | Pick<PaymentOrderMismatchError, 'errorCode' | 'message'>
+        | Pick<RefundOrderStateError, 'errorCode' | 'message'>
+        | Pick<AlreadyRefundedError, 'errorCode' | 'message'>
+        | Pick<RefundStateTransitionError, 'errorCode' | 'message'>;
 };
 
 export type SettleRefundMutationVariables = Exact<{
@@ -5113,7 +5111,7 @@ export type SettleRefundMutationVariables = Exact<{
 }>;
 
 export type SettleRefundMutation = {
-    settleRefund: RefundFragment | Pick<RefundStateTransitionError, 'code' | 'message'>;
+    settleRefund: RefundFragment | Pick<RefundStateTransitionError, 'errorCode' | 'message'>;
 };
 
 export type GetOrderHistoryQueryVariables = Exact<{
@@ -5209,7 +5207,7 @@ export type RemoveOptionGroupFromProductMutationVariables = Exact<{
 export type RemoveOptionGroupFromProductMutation = {
     removeOptionGroupFromProduct:
         | ProductWithOptionsFragment
-        | Pick<ProductOptionInUseError, 'code' | 'message' | 'optionGroupCode' | 'productVariantCount'>;
+        | Pick<ProductOptionInUseError, 'errorCode' | 'message' | 'optionGroupCode' | 'productVariantCount'>;
 };
 
 export type GetOptionGroupQueryVariables = Exact<{
@@ -5253,7 +5251,7 @@ export type UpdatePromotionMutationVariables = Exact<{
 }>;
 
 export type UpdatePromotionMutation = {
-    updatePromotion: PromotionFragment | Pick<MissingConditionsError, 'code' | 'message'>;
+    updatePromotion: PromotionFragment | Pick<MissingConditionsError, 'errorCode' | 'message'>;
 };
 
 export type ConfigurableOperationDefFragment = Pick<

+ 67 - 74
packages/core/e2e/graphql/generated-e2e-shop-types.ts

@@ -75,7 +75,7 @@ export type AdministratorList = PaginatedList & {
 
 /** Retured when attemting to set the Customer for an Order when already logged in. */
 export type AlreadyLoggedInError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -300,21 +300,21 @@ export type CountryTranslation = {
 
 /** Returned if the provided coupon code is invalid */
 export type CouponCodeExpiredError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     couponCode: Scalars['String'];
 };
 
 /** Returned if the provided coupon code is invalid */
 export type CouponCodeInvalidError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     couponCode: Scalars['String'];
 };
 
 /** Returned if the provided coupon code is invalid */
 export type CouponCodeLimitError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     couponCode: Scalars['String'];
     limit: Scalars['Int'];
@@ -822,7 +822,7 @@ export enum DeletionResult {
 
 /** Retured when attemting to create a Customer with an email address already registered to an existing User. */
 export type EmailAddressConflictError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -853,7 +853,7 @@ export enum ErrorCode {
 }
 
 export type ErrorResult = {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -1010,7 +1010,7 @@ export enum HistoryEntryType {
  * expired according to the `verificationTokenDuration` setting in the AuthOptions.
  */
 export type IdentifierChangeTokenExpiredError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -1019,7 +1019,7 @@ export type IdentifierChangeTokenExpiredError = ErrorResult & {
  * invalid or does not match any expected tokens.
  */
 export type IdentifierChangeTokenInvalidError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -1044,7 +1044,7 @@ export type IntCustomFieldConfig = CustomField & {
 
 /** Returned if the user authentication credentials are not valid */
 export type InvalidCredentialsError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -1398,7 +1398,7 @@ export enum LogicalOperator {
 
 /** Retured when attemting to register or verify a customer account without a password, when one is required. */
 export type MissingPasswordError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -1629,13 +1629,13 @@ export type NativeAuthInput = {
 
 /** Retured when attempting an operation that relies on the NativeAuthStrategy, if that strategy is not configured. */
 export type NativeAuthStrategyError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
 /** Retured when attemting to set a negative OrderLine quantity. */
 export type NegativeQuantityError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -1738,7 +1738,7 @@ export type OrderItem = Node & {
 
 /** Retured when the maximum order size limit has been reached. */
 export type OrderLimitError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     maxItems: Scalars['Int'];
 };
@@ -1773,13 +1773,13 @@ export type OrderListOptions = {
 
 /** Returned when attempting to modify the contents of an Order that is not in the `AddingItems` state. */
 export type OrderModificationError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
 /** Returned when attempting to add a Payment to an Order that is not in the `ArrangingPayment` state. */
 export type OrderPaymentStateError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -1804,7 +1804,7 @@ export type OrderSortParameter = {
 
 /** Returned if there is an error in transitioning the Order state */
 export type OrderStateTransitionError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     transitionError: Scalars['String'];
     fromState: Scalars['String'];
@@ -1818,7 +1818,7 @@ export type PaginatedList = {
 
 /** Retured when attemting to verify a customer account with a password, when a password has already been set. */
 export type PasswordAlreadySetError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -1827,7 +1827,7 @@ export type PasswordAlreadySetError = ErrorResult & {
  * expired according to the `verificationTokenDuration` setting in the AuthOptions.
  */
 export type PasswordResetTokenExpiredError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -1836,7 +1836,7 @@ export type PasswordResetTokenExpiredError = ErrorResult & {
  * invalid or does not match any expected tokens.
  */
 export type PasswordResetTokenInvalidError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -1855,14 +1855,14 @@ export type Payment = Node & {
 
 /** Returned when a Payment is declined by the payment provider. */
 export type PaymentDeclinedError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     paymentErrorMessage: Scalars['String'];
 };
 
 /** Returned when a Payment fails due to an error. */
 export type PaymentFailedError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     paymentErrorMessage: Scalars['String'];
 };
@@ -2525,7 +2525,7 @@ export type User = Node & {
  * expired according to the `verificationTokenDuration` setting in the AuthOptions.
  */
 export type VerificationTokenExpiredError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -2534,7 +2534,7 @@ export type VerificationTokenExpiredError = ErrorResult & {
  * invalid or does not match any expected tokens.
  */
 export type VerificationTokenInvalidError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -2588,9 +2588,9 @@ export type AddItemToOrderMutationVariables = Exact<{
 export type AddItemToOrderMutation = {
     addItemToOrder:
         | UpdatedOrderFragment
-        | (Pick<OrderModificationError, 'message'> & { errorCode: OrderModificationError['code'] })
-        | (Pick<OrderLimitError, 'message'> & { errorCode: OrderLimitError['code'] })
-        | (Pick<NegativeQuantityError, 'message'> & { errorCode: NegativeQuantityError['code'] });
+        | Pick<OrderModificationError, 'errorCode' | 'message'>
+        | Pick<OrderLimitError, 'errorCode' | 'message'>
+        | Pick<NegativeQuantityError, 'errorCode' | 'message'>;
 };
 
 export type SearchProductsShopQueryVariables = Exact<{
@@ -2622,8 +2622,8 @@ export type RegisterMutationVariables = Exact<{
 export type RegisterMutation = {
     registerCustomerAccount:
         | Pick<Success, 'success'>
-        | Pick<MissingPasswordError, 'code' | 'message'>
-        | Pick<NativeAuthStrategyError, 'code' | 'message'>;
+        | Pick<MissingPasswordError, 'errorCode' | 'message'>
+        | Pick<NativeAuthStrategyError, 'errorCode' | 'message'>;
 };
 
 export type CurrentUserShopFragment = Pick<CurrentUser, 'id' | 'identifier'> & {
@@ -2638,11 +2638,11 @@ export type VerifyMutationVariables = Exact<{
 export type VerifyMutation = {
     verifyCustomerAccount:
         | CurrentUserShopFragment
-        | Pick<VerificationTokenInvalidError, 'code' | 'message'>
-        | Pick<VerificationTokenExpiredError, 'code' | 'message'>
-        | Pick<MissingPasswordError, 'code' | 'message'>
-        | Pick<PasswordAlreadySetError, 'code' | 'message'>
-        | Pick<NativeAuthStrategyError, 'code' | 'message'>;
+        | Pick<VerificationTokenInvalidError, 'errorCode' | 'message'>
+        | Pick<VerificationTokenExpiredError, 'errorCode' | 'message'>
+        | Pick<MissingPasswordError, 'errorCode' | 'message'>
+        | Pick<PasswordAlreadySetError, 'errorCode' | 'message'>
+        | Pick<NativeAuthStrategyError, 'errorCode' | 'message'>;
 };
 
 export type RefreshTokenMutationVariables = Exact<{
@@ -2650,7 +2650,9 @@ export type RefreshTokenMutationVariables = Exact<{
 }>;
 
 export type RefreshTokenMutation = {
-    refreshCustomerVerification: Pick<Success, 'success'> | Pick<NativeAuthStrategyError, 'code' | 'message'>;
+    refreshCustomerVerification:
+        | Pick<Success, 'success'>
+        | Pick<NativeAuthStrategyError, 'errorCode' | 'message'>;
 };
 
 export type RequestPasswordResetMutationVariables = Exact<{
@@ -2659,7 +2661,7 @@ export type RequestPasswordResetMutationVariables = Exact<{
 
 export type RequestPasswordResetMutation = {
     requestPasswordReset?: Maybe<
-        Pick<Success, 'success'> | Pick<NativeAuthStrategyError, 'code' | 'message'>
+        Pick<Success, 'success'> | Pick<NativeAuthStrategyError, 'errorCode' | 'message'>
     >;
 };
 
@@ -2671,9 +2673,9 @@ export type ResetPasswordMutationVariables = Exact<{
 export type ResetPasswordMutation = {
     resetPassword:
         | CurrentUserShopFragment
-        | Pick<PasswordResetTokenInvalidError, 'code' | 'message'>
-        | Pick<PasswordResetTokenExpiredError, 'code' | 'message'>
-        | Pick<NativeAuthStrategyError, 'code' | 'message'>;
+        | Pick<PasswordResetTokenInvalidError, 'errorCode' | 'message'>
+        | Pick<PasswordResetTokenExpiredError, 'errorCode' | 'message'>
+        | Pick<NativeAuthStrategyError, 'errorCode' | 'message'>;
 };
 
 export type RequestUpdateEmailAddressMutationVariables = Exact<{
@@ -2684,9 +2686,9 @@ export type RequestUpdateEmailAddressMutationVariables = Exact<{
 export type RequestUpdateEmailAddressMutation = {
     requestUpdateCustomerEmailAddress:
         | Pick<Success, 'success'>
-        | Pick<InvalidCredentialsError, 'code' | 'message'>
-        | Pick<EmailAddressConflictError, 'code' | 'message'>
-        | Pick<NativeAuthStrategyError, 'code' | 'message'>;
+        | Pick<InvalidCredentialsError, 'errorCode' | 'message'>
+        | Pick<EmailAddressConflictError, 'errorCode' | 'message'>
+        | Pick<NativeAuthStrategyError, 'errorCode' | 'message'>;
 };
 
 export type UpdateEmailAddressMutationVariables = Exact<{
@@ -2696,9 +2698,9 @@ export type UpdateEmailAddressMutationVariables = Exact<{
 export type UpdateEmailAddressMutation = {
     updateCustomerEmailAddress:
         | Pick<Success, 'success'>
-        | Pick<IdentifierChangeTokenInvalidError, 'code' | 'message'>
-        | Pick<IdentifierChangeTokenExpiredError, 'code' | 'message'>
-        | Pick<NativeAuthStrategyError, 'code' | 'message'>;
+        | Pick<IdentifierChangeTokenInvalidError, 'errorCode' | 'message'>
+        | Pick<IdentifierChangeTokenExpiredError, 'errorCode' | 'message'>
+        | Pick<NativeAuthStrategyError, 'errorCode' | 'message'>;
 };
 
 export type GetActiveCustomerQueryVariables = Exact<{ [key: string]: never }>;
@@ -2741,8 +2743,8 @@ export type UpdatePasswordMutationVariables = Exact<{
 export type UpdatePasswordMutation = {
     updateCustomerPassword:
         | Pick<Success, 'success'>
-        | Pick<InvalidCredentialsError, 'code' | 'message'>
-        | Pick<NativeAuthStrategyError, 'code' | 'message'>;
+        | Pick<InvalidCredentialsError, 'errorCode' | 'message'>
+        | Pick<NativeAuthStrategyError, 'errorCode' | 'message'>;
 };
 
 export type GetActiveOrderQueryVariables = Exact<{ [key: string]: never }>;
@@ -2757,9 +2759,9 @@ export type AdjustItemQuantityMutationVariables = Exact<{
 export type AdjustItemQuantityMutation = {
     adjustOrderLine:
         | TestOrderFragmentFragment
-        | (Pick<OrderModificationError, 'message'> & { errorCode: OrderModificationError['code'] })
-        | (Pick<OrderLimitError, 'message'> & { errorCode: OrderLimitError['code'] })
-        | (Pick<NegativeQuantityError, 'message'> & { errorCode: NegativeQuantityError['code'] });
+        | Pick<OrderModificationError, 'errorCode' | 'message'>
+        | Pick<OrderLimitError, 'errorCode' | 'message'>
+        | Pick<NegativeQuantityError, 'errorCode' | 'message'>;
 };
 
 export type RemoveItemFromOrderMutationVariables = Exact<{
@@ -2767,9 +2769,7 @@ export type RemoveItemFromOrderMutationVariables = Exact<{
 }>;
 
 export type RemoveItemFromOrderMutation = {
-    removeOrderLine:
-        | TestOrderFragmentFragment
-        | (Pick<OrderModificationError, 'message'> & { errorCode: OrderModificationError['code'] });
+    removeOrderLine: TestOrderFragmentFragment | Pick<OrderModificationError, 'errorCode' | 'message'>;
 };
 
 export type GetShippingMethodsQueryVariables = Exact<{ [key: string]: never }>;
@@ -2783,9 +2783,7 @@ export type SetShippingMethodMutationVariables = Exact<{
 }>;
 
 export type SetShippingMethodMutation = {
-    setOrderShippingMethod:
-        | TestOrderFragmentFragment
-        | (Pick<OrderModificationError, 'message'> & { errorCode: OrderModificationError['code'] });
+    setOrderShippingMethod: TestOrderFragmentFragment | Pick<OrderModificationError, 'errorCode' | 'message'>;
 };
 
 export type ActiveOrderCustomerFragment = Pick<Order, 'id'> & {
@@ -2800,8 +2798,8 @@ export type SetCustomerForOrderMutationVariables = Exact<{
 export type SetCustomerForOrderMutation = {
     setCustomerForOrder?: Maybe<
         | ActiveOrderCustomerFragment
-        | (Pick<AlreadyLoggedInError, 'message'> & { errorCode: AlreadyLoggedInError['code'] })
-        | (Pick<EmailAddressConflictError, 'message'> & { errorCode: EmailAddressConflictError['code'] })
+        | Pick<AlreadyLoggedInError, 'errorCode' | 'message'>
+        | Pick<EmailAddressConflictError, 'errorCode' | 'message'>
     >;
 };
 
@@ -2830,9 +2828,10 @@ export type TransitionToStateMutationVariables = Exact<{
 export type TransitionToStateMutation = {
     transitionOrderToState?: Maybe<
         | TestOrderFragmentFragment
-        | (Pick<OrderStateTransitionError, 'message' | 'transitionError' | 'fromState' | 'toState'> & {
-              errorCode: OrderStateTransitionError['code'];
-          })
+        | Pick<
+              OrderStateTransitionError,
+              'errorCode' | 'message' | 'transitionError' | 'fromState' | 'toState'
+          >
     >;
 };
 
@@ -2899,14 +2898,10 @@ export type AddPaymentToOrderMutationVariables = Exact<{
 export type AddPaymentToOrderMutation = {
     addPaymentToOrder?: Maybe<
         | TestOrderWithPaymentsFragment
-        | (Pick<OrderPaymentStateError, 'message'> & { errorCode: OrderPaymentStateError['code'] })
-        | (Pick<PaymentFailedError, 'message' | 'paymentErrorMessage'> & {
-              errorCode: PaymentFailedError['code'];
-          })
-        | (Pick<PaymentDeclinedError, 'message' | 'paymentErrorMessage'> & {
-              errorCode: PaymentDeclinedError['code'];
-          })
-        | (Pick<OrderStateTransitionError, 'message'> & { errorCode: OrderStateTransitionError['code'] })
+        | Pick<OrderPaymentStateError, 'errorCode' | 'message'>
+        | Pick<PaymentFailedError, 'errorCode' | 'message' | 'paymentErrorMessage'>
+        | Pick<PaymentDeclinedError, 'errorCode' | 'message' | 'paymentErrorMessage'>
+        | Pick<OrderStateTransitionError, 'errorCode' | 'message'>
     >;
 };
 
@@ -2952,9 +2947,9 @@ export type ApplyCouponCodeMutationVariables = Exact<{
 export type ApplyCouponCodeMutation = {
     applyCouponCode:
         | TestOrderFragmentFragment
-        | (Pick<CouponCodeExpiredError, 'message'> & { errorCode: CouponCodeExpiredError['code'] })
-        | (Pick<CouponCodeInvalidError, 'message'> & { errorCode: CouponCodeInvalidError['code'] })
-        | (Pick<CouponCodeLimitError, 'message'> & { errorCode: CouponCodeLimitError['code'] });
+        | Pick<CouponCodeExpiredError, 'errorCode' | 'message'>
+        | Pick<CouponCodeInvalidError, 'errorCode' | 'message'>
+        | Pick<CouponCodeLimitError, 'errorCode' | 'message'>;
 };
 
 export type RemoveCouponCodeMutationVariables = Exact<{
@@ -2966,9 +2961,7 @@ export type RemoveCouponCodeMutation = { removeCouponCode?: Maybe<TestOrderFragm
 export type RemoveAllOrderLinesMutationVariables = Exact<{ [key: string]: never }>;
 
 export type RemoveAllOrderLinesMutation = {
-    removeAllOrderLines:
-        | TestOrderFragmentFragment
-        | (Pick<OrderModificationError, 'message'> & { errorCode: OrderModificationError['code'] });
+    removeAllOrderLines: TestOrderFragmentFragment | Pick<OrderModificationError, 'errorCode' | 'message'>;
 };
 
 type DiscriminateUnion<T, U> = T extends U ? T : never;

+ 8 - 8
packages/core/e2e/graphql/shared-definitions.ts

@@ -289,7 +289,7 @@ export const CREATE_PROMOTION = gql`
         createPromotion(input: $input) {
             ...Promotion
             ... on ErrorResult {
-                code
+                errorCode
                 message
             }
         }
@@ -310,7 +310,7 @@ export const CREATE_CHANNEL = gql`
         createChannel(input: $input) {
             ...Channel
             ... on LanguageNotAvailableError {
-                errorCode: code
+                errorCode
                 message
                 languageCode
             }
@@ -375,7 +375,7 @@ export const UPDATE_CHANNEL = gql`
         updateChannel(input: $input) {
             ...Channel
             ... on LanguageNotAvailableError {
-                errorCode: code
+                errorCode
                 message
                 languageCode
             }
@@ -448,7 +448,7 @@ export const CREATE_FULFILLMENT = gql`
         addFulfillmentToOrder(input: $input) {
             ...Fulfillment
             ... on ErrorResult {
-                code
+                errorCode
                 message
             }
         }
@@ -461,7 +461,7 @@ export const TRANSIT_FULFILLMENT = gql`
         transitionFulfillmentToState(id: $id, state: $state) {
             ...Fulfillment
             ... on FulfillmentStateTransitionError {
-                code
+                errorCode
                 message
                 transitionError
                 fromState
@@ -540,7 +540,7 @@ export const CREATE_CUSTOMER = gql`
         createCustomer(input: $input, password: $password) {
             ...Customer
             ... on ErrorResult {
-                code
+                errorCode
                 message
             }
         }
@@ -553,7 +553,7 @@ export const UPDATE_CUSTOMER = gql`
         updateCustomer(input: $input) {
             ...Customer
             ... on ErrorResult {
-                code
+                errorCode
                 message
             }
         }
@@ -659,7 +659,7 @@ export const ADMIN_TRANSITION_TO_STATE = gql`
         transitionOrderToState(id: $id, state: $state) {
             ...Order
             ... on OrderStateTransitionError {
-                errorCode: code
+                errorCode
                 message
                 transitionError
                 fromState

+ 17 - 17
packages/core/e2e/graphql/shop-definitions.ts

@@ -84,7 +84,7 @@ export const ADD_ITEM_TO_ORDER = gql`
         addItemToOrder(productVariantId: $productVariantId, quantity: $quantity) {
             ...UpdatedOrder
             ... on ErrorResult {
-                errorCode: code
+                errorCode
                 message
             }
         }
@@ -124,7 +124,7 @@ export const REGISTER_ACCOUNT = gql`
                 success
             }
             ... on ErrorResult {
-                code
+                errorCode
                 message
             }
         }
@@ -148,7 +148,7 @@ export const VERIFY_EMAIL = gql`
         verifyCustomerAccount(password: $password, token: $token) {
             ...CurrentUserShop
             ... on ErrorResult {
-                code
+                errorCode
                 message
             }
         }
@@ -163,7 +163,7 @@ export const REFRESH_TOKEN = gql`
                 success
             }
             ... on ErrorResult {
-                code
+                errorCode
                 message
             }
         }
@@ -176,7 +176,7 @@ export const REQUEST_PASSWORD_RESET = gql`
                 success
             }
             ... on ErrorResult {
-                code
+                errorCode
                 message
             }
         }
@@ -187,7 +187,7 @@ export const RESET_PASSWORD = gql`
         resetPassword(token: $token, password: $password) {
             ...CurrentUserShop
             ... on ErrorResult {
-                code
+                errorCode
                 message
             }
         }
@@ -201,7 +201,7 @@ export const REQUEST_UPDATE_EMAIL_ADDRESS = gql`
                 success
             }
             ... on ErrorResult {
-                code
+                errorCode
                 message
             }
         }
@@ -214,7 +214,7 @@ export const UPDATE_EMAIL_ADDRESS = gql`
                 success
             }
             ... on ErrorResult {
-                code
+                errorCode
                 message
             }
         }
@@ -274,7 +274,7 @@ export const UPDATE_PASSWORD = gql`
                 success
             }
             ... on ErrorResult {
-                code
+                errorCode
                 message
             }
         }
@@ -295,7 +295,7 @@ export const ADJUST_ITEM_QUANTITY = gql`
         adjustOrderLine(orderLineId: $orderLineId, quantity: $quantity) {
             ...TestOrderFragment
             ... on ErrorResult {
-                errorCode: code
+                errorCode
                 message
             }
         }
@@ -308,7 +308,7 @@ export const REMOVE_ITEM_FROM_ORDER = gql`
         removeOrderLine(orderLineId: $orderLineId) {
             ...TestOrderFragment
             ... on ErrorResult {
-                errorCode: code
+                errorCode
                 message
             }
         }
@@ -331,7 +331,7 @@ export const SET_SHIPPING_METHOD = gql`
         setOrderShippingMethod(shippingMethodId: $id) {
             ...TestOrderFragment
             ... on ErrorResult {
-                errorCode: code
+                errorCode
                 message
             }
         }
@@ -359,7 +359,7 @@ export const SET_CUSTOMER = gql`
         setCustomerForOrder(input: $input) {
             ...ActiveOrderCustomer
             ... on ErrorResult {
-                errorCode: code
+                errorCode
                 message
             }
         }
@@ -403,7 +403,7 @@ export const TRANSITION_TO_STATE = gql`
         transitionOrderToState(state: $state) {
             ...TestOrderFragment
             ... on OrderStateTransitionError {
-                errorCode: code
+                errorCode
                 message
                 transitionError
                 fromState
@@ -479,7 +479,7 @@ export const ADD_PAYMENT = gql`
         addPaymentToOrder(input: $input) {
             ...TestOrderWithPayments
             ... on ErrorResult {
-                errorCode: code
+                errorCode
                 message
             }
             ... on PaymentDeclinedError {
@@ -548,7 +548,7 @@ export const APPLY_COUPON_CODE = gql`
         applyCouponCode(couponCode: $couponCode) {
             ...TestOrderFragment
             ... on ErrorResult {
-                errorCode: code
+                errorCode
                 message
             }
         }
@@ -570,7 +570,7 @@ export const REMOVE_ALL_ORDER_LINES = gql`
         removeAllOrderLines {
             ...TestOrderFragment
             ... on ErrorResult {
-                errorCode: code
+                errorCode
                 message
             }
         }

+ 17 - 17
packages/core/e2e/order.e2e-spec.ts

@@ -177,7 +177,7 @@ describe('Orders resolver', () => {
             paymentGuard.assertErrorResult(settlePayment);
 
             expect(settlePayment.message).toBe('Settling the payment failed');
-            expect(settlePayment.code).toBe(ErrorCode.SETTLE_PAYMENT_ERROR);
+            expect(settlePayment.errorCode).toBe(ErrorCode.SETTLE_PAYMENT_ERROR);
             expect((settlePayment as any).paymentErrorMessage).toBe('Something went horribly wrong');
 
             const result = await adminClient.query<GetOrder.Query, GetOrder.Variables>(GET_ORDER, {
@@ -292,7 +292,7 @@ describe('Orders resolver', () => {
             fulfillmentGuard.assertErrorResult(addFulfillmentToOrder);
 
             expect(addFulfillmentToOrder.message).toBe('At least one OrderLine must be specified');
-            expect(addFulfillmentToOrder.code).toBe(ErrorCode.EMPTY_ORDER_LINE_SELECTION_ERROR);
+            expect(addFulfillmentToOrder.errorCode).toBe(ErrorCode.EMPTY_ORDER_LINE_SELECTION_ERROR);
         });
 
         it('returns error result if all quantities are zero', async () => {
@@ -312,7 +312,7 @@ describe('Orders resolver', () => {
             fulfillmentGuard.assertErrorResult(addFulfillmentToOrder);
 
             expect(addFulfillmentToOrder.message).toBe('At least one OrderLine must be specified');
-            expect(addFulfillmentToOrder.code).toBe(ErrorCode.EMPTY_ORDER_LINE_SELECTION_ERROR);
+            expect(addFulfillmentToOrder.errorCode).toBe(ErrorCode.EMPTY_ORDER_LINE_SELECTION_ERROR);
         });
 
         it('creates the first fulfillment', async () => {
@@ -408,7 +408,7 @@ describe('Orders resolver', () => {
             expect(addFulfillmentToOrder.message).toBe(
                 'One or more OrderItems are already part of a Fulfillment',
             );
-            expect(addFulfillmentToOrder.code).toBe(ErrorCode.ITEMS_ALREADY_FULFILLED_ERROR);
+            expect(addFulfillmentToOrder.errorCode).toBe(ErrorCode.ITEMS_ALREADY_FULFILLED_ERROR);
         });
 
         it('transits the first fulfillment from created to Shipped and automatically change the order state to PartiallyShipped', async () => {
@@ -787,7 +787,7 @@ describe('Orders resolver', () => {
             expect(cancelOrder.message).toBe(
                 'Cannot cancel OrderLines from an Order in the "AddingItems" state',
             );
-            expect(cancelOrder.code).toBe(ErrorCode.CANCEL_ACTIVE_ORDER_ERROR);
+            expect(cancelOrder.errorCode).toBe(ErrorCode.CANCEL_ACTIVE_ORDER_ERROR);
         });
 
         it('cannot cancel from ArrangingPayment state', async () => {
@@ -810,7 +810,7 @@ describe('Orders resolver', () => {
             expect(cancelOrder.message).toBe(
                 'Cannot cancel OrderLines from an Order in the "ArrangingPayment" state',
             );
-            expect(cancelOrder.code).toBe(ErrorCode.CANCEL_ACTIVE_ORDER_ERROR);
+            expect(cancelOrder.errorCode).toBe(ErrorCode.CANCEL_ACTIVE_ORDER_ERROR);
         });
 
         it('returns error result if lines are empty', async () => {
@@ -831,7 +831,7 @@ describe('Orders resolver', () => {
             orderGuard.assertErrorResult(cancelOrder);
 
             expect(cancelOrder.message).toBe('At least one OrderLine must be specified');
-            expect(cancelOrder.code).toBe(ErrorCode.EMPTY_ORDER_LINE_SELECTION_ERROR);
+            expect(cancelOrder.errorCode).toBe(ErrorCode.EMPTY_ORDER_LINE_SELECTION_ERROR);
         });
 
         it('returns error result if all quantities zero', async () => {
@@ -850,7 +850,7 @@ describe('Orders resolver', () => {
             orderGuard.assertErrorResult(cancelOrder);
 
             expect(cancelOrder.message).toBe('At least one OrderLine must be specified');
-            expect(cancelOrder.code).toBe(ErrorCode.EMPTY_ORDER_LINE_SELECTION_ERROR);
+            expect(cancelOrder.errorCode).toBe(ErrorCode.EMPTY_ORDER_LINE_SELECTION_ERROR);
         });
 
         it('partial cancellation', async () => {
@@ -935,7 +935,7 @@ describe('Orders resolver', () => {
             expect(cancelOrder.message).toBe(
                 'The specified quantity is greater than the available OrderItems',
             );
-            expect(cancelOrder.code).toBe(ErrorCode.QUANTITY_TOO_GREAT_ERROR);
+            expect(cancelOrder.errorCode).toBe(ErrorCode.QUANTITY_TOO_GREAT_ERROR);
         });
 
         it('complete cancellation', async () => {
@@ -1073,7 +1073,7 @@ describe('Orders resolver', () => {
             refundGuard.assertErrorResult(refundOrder);
 
             expect(refundOrder.message).toBe('Cannot refund an Order in the "PaymentAuthorized" state');
-            expect(refundOrder.code).toBe(ErrorCode.REFUND_ORDER_STATE_ERROR);
+            expect(refundOrder.errorCode).toBe(ErrorCode.REFUND_ORDER_STATE_ERROR);
         });
 
         it('returns error result if no lines and no shipping', async () => {
@@ -1104,7 +1104,7 @@ describe('Orders resolver', () => {
             refundGuard.assertErrorResult(refundOrder);
 
             expect(refundOrder.message).toBe('Nothing to refund');
-            expect(refundOrder.code).toBe(ErrorCode.NOTHING_TO_REFUND_ERROR);
+            expect(refundOrder.errorCode).toBe(ErrorCode.NOTHING_TO_REFUND_ERROR);
         });
 
         it(
@@ -1145,7 +1145,7 @@ describe('Orders resolver', () => {
             refundGuard.assertErrorResult(refundOrder);
 
             expect(refundOrder.message).toBe('The Payment and OrderLines do not belong to the same Order');
-            expect(refundOrder.code).toBe(ErrorCode.PAYMENT_ORDER_MISMATCH_ERROR);
+            expect(refundOrder.errorCode).toBe(ErrorCode.PAYMENT_ORDER_MISMATCH_ERROR);
         });
 
         it('creates a Refund to be manually settled', async () => {
@@ -1192,7 +1192,7 @@ describe('Orders resolver', () => {
             refundGuard.assertErrorResult(refundOrder);
 
             expect(refundOrder.message).toBe('Cannot refund an OrderItem which has already been refunded');
-            expect(refundOrder.code).toBe(ErrorCode.ALREADY_REFUNDED_ERROR);
+            expect(refundOrder.errorCode).toBe(ErrorCode.ALREADY_REFUNDED_ERROR);
         });
 
         it('manually settle a Refund', async () => {
@@ -1463,7 +1463,7 @@ export const SETTLE_PAYMENT = gql`
         settlePayment(id: $id) {
             ...Payment
             ... on ErrorResult {
-                code
+                errorCode
                 message
             }
             ... on SettlePaymentError {
@@ -1513,7 +1513,7 @@ export const CANCEL_ORDER = gql`
         cancelOrder(input: $input) {
             ...CanceledOrder
             ... on ErrorResult {
-                code
+                errorCode
                 message
             }
         }
@@ -1547,7 +1547,7 @@ export const REFUND_ORDER = gql`
         refundOrder(input: $input) {
             ...Refund
             ... on ErrorResult {
-                code
+                errorCode
                 message
             }
         }
@@ -1560,7 +1560,7 @@ export const SETTLE_REFUND = gql`
         settleRefund(input: $input) {
             ...Refund
             ... on ErrorResult {
-                code
+                errorCode
                 message
             }
         }

+ 2 - 2
packages/core/e2e/product.e2e-spec.ts

@@ -714,7 +714,7 @@ describe('Product resolver', () => {
             expect(removeOptionGroupFromProduct.message).toBe(
                 `Cannot remove ProductOptionGroup "curvy-monitor-monitor-size" as it is used by 2 ProductVariants`,
             );
-            expect(removeOptionGroupFromProduct.code).toBe(ErrorCode.PRODUCT_OPTION_IN_USE_ERROR);
+            expect(removeOptionGroupFromProduct.errorCode).toBe(ErrorCode.PRODUCT_OPTION_IN_USE_ERROR);
             expect(removeOptionGroupFromProduct.optionGroupCode).toBe('curvy-monitor-monitor-size');
             expect(removeOptionGroupFromProduct.productVariantCount).toBe(2);
         });
@@ -1196,7 +1196,7 @@ export const REMOVE_OPTION_GROUP_FROM_PRODUCT = gql`
         removeOptionGroupFromProduct(productId: $productId, optionGroupId: $optionGroupId) {
             ...ProductWithOptions
             ... on ProductOptionInUseError {
-                code
+                errorCode
                 message
                 optionGroupCode
                 productVariantCount

+ 3 - 3
packages/core/e2e/promotion.e2e-spec.ts

@@ -130,7 +130,7 @@ describe('Promotion resolver', () => {
         expect(createPromotion.message).toBe(
             'A Promotion must have either at least one condition or a coupon code set',
         );
-        expect(createPromotion.code).toBe(ErrorCode.MISSING_CONDITIONS_ERROR);
+        expect(createPromotion.errorCode).toBe(ErrorCode.MISSING_CONDITIONS_ERROR);
     });
 
     it('updatePromotion', async () => {
@@ -176,7 +176,7 @@ describe('Promotion resolver', () => {
         expect(updatePromotion.message).toBe(
             'A Promotion must have either at least one condition or a coupon code set',
         );
-        expect(updatePromotion.code).toBe(ErrorCode.MISSING_CONDITIONS_ERROR);
+        expect(updatePromotion.errorCode).toBe(ErrorCode.MISSING_CONDITIONS_ERROR);
     });
 
     it('promotion', async () => {
@@ -314,7 +314,7 @@ export const UPDATE_PROMOTION = gql`
         updatePromotion(input: $input) {
             ...Promotion
             ... on ErrorResult {
-                code
+                errorCode
                 message
             }
         }

+ 2 - 1
packages/core/e2e/role.e2e-spec.ts

@@ -13,6 +13,7 @@ import { TEST_SETUP_TIMEOUT_MS, testConfig } from '../../../e2e-common/test-conf
 
 import { ROLE_FRAGMENT } from './graphql/fragments';
 import {
+    ChannelFragment,
     CreateChannel,
     CreateRole,
     CurrencyCode,
@@ -280,7 +281,7 @@ describe('Role resolver', () => {
     });
 
     describe('multi-channel', () => {
-        let secondChannel: CreateChannel.CreateChannel;
+        let secondChannel: ChannelFragment;
         let multiChannelRole: CreateRole.CreateRole;
 
         beforeAll(async () => {

+ 16 - 14
packages/core/e2e/shop-auth.e2e-spec.ts

@@ -246,7 +246,7 @@ describe('Shop auth & accounts', () => {
 
         it('login fails before verification', async () => {
             const result = await shopClient.asUserWithCredentials(emailAddress, '');
-            expect(result.code).toBe(ErrorCode.INVALID_CREDENTIALS_ERROR);
+            expect(result.errorCode).toBe(ErrorCode.INVALID_CREDENTIALS_ERROR);
         });
 
         it('verification fails with wrong token', async () => {
@@ -260,7 +260,7 @@ describe('Shop auth & accounts', () => {
             currentUserErrorGuard.assertErrorResult(verifyCustomerAccount);
 
             expect(verifyCustomerAccount.message).toBe(`Verification token not recognized`);
-            expect(verifyCustomerAccount.code).toBe(ErrorCode.VERIFICATION_TOKEN_INVALID_ERROR);
+            expect(verifyCustomerAccount.errorCode).toBe(ErrorCode.VERIFICATION_TOKEN_INVALID_ERROR);
         });
 
         it('verification fails with no password', async () => {
@@ -273,7 +273,7 @@ describe('Shop auth & accounts', () => {
             currentUserErrorGuard.assertErrorResult(verifyCustomerAccount);
 
             expect(verifyCustomerAccount.message).toBe(`A password must be provided.`);
-            expect(verifyCustomerAccount.code).toBe(ErrorCode.MISSING_PASSWORD_ERROR);
+            expect(verifyCustomerAccount.errorCode).toBe(ErrorCode.MISSING_PASSWORD_ERROR);
         });
 
         it('verification succeeds with password and correct token', async () => {
@@ -321,7 +321,7 @@ describe('Shop auth & accounts', () => {
             currentUserErrorGuard.assertErrorResult(verifyCustomerAccount);
 
             expect(verifyCustomerAccount.message).toBe(`Verification token not recognized`);
-            expect(verifyCustomerAccount.code).toBe(ErrorCode.VERIFICATION_TOKEN_INVALID_ERROR);
+            expect(verifyCustomerAccount.errorCode).toBe(ErrorCode.VERIFICATION_TOKEN_INVALID_ERROR);
         });
 
         it('customer history contains entries for registration & verification', async () => {
@@ -413,7 +413,7 @@ describe('Shop auth & accounts', () => {
             currentUserErrorGuard.assertErrorResult(verifyCustomerAccount);
 
             expect(verifyCustomerAccount.message).toBe(`A password has already been set during registration`);
-            expect(verifyCustomerAccount.code).toBe(ErrorCode.PASSWORD_ALREADY_SET_ERROR);
+            expect(verifyCustomerAccount.errorCode).toBe(ErrorCode.PASSWORD_ALREADY_SET_ERROR);
         });
 
         it('verification succeeds with no password and correct token', async () => {
@@ -488,7 +488,7 @@ describe('Shop auth & accounts', () => {
             currentUserErrorGuard.assertErrorResult(resetPassword);
 
             expect(resetPassword.message).toBe(`Password reset token not recognized`);
-            expect(resetPassword.code).toBe(ErrorCode.PASSWORD_RESET_TOKEN_INVALID_ERROR);
+            expect(resetPassword.errorCode).toBe(ErrorCode.PASSWORD_RESET_TOKEN_INVALID_ERROR);
         });
 
         it('resetPassword works with valid token', async () => {
@@ -577,7 +577,7 @@ describe('Shop auth & accounts', () => {
             successErrorGuard.assertErrorResult(requestUpdateCustomerEmailAddress);
 
             expect(requestUpdateCustomerEmailAddress.message).toBe('The provided credentials are invalid');
-            expect(requestUpdateCustomerEmailAddress.code).toBe(ErrorCode.INVALID_CREDENTIALS_ERROR);
+            expect(requestUpdateCustomerEmailAddress.errorCode).toBe(ErrorCode.INVALID_CREDENTIALS_ERROR);
         });
 
         it('return error result email address already in use', async () => {
@@ -597,7 +597,7 @@ describe('Shop auth & accounts', () => {
             successErrorGuard.assertErrorResult(requestUpdateCustomerEmailAddress);
 
             expect(requestUpdateCustomerEmailAddress.message).toBe('The email address is not available.');
-            expect(requestUpdateCustomerEmailAddress.code).toBe(ErrorCode.EMAIL_ADDRESS_CONFLICT_ERROR);
+            expect(requestUpdateCustomerEmailAddress.errorCode).toBe(ErrorCode.EMAIL_ADDRESS_CONFLICT_ERROR);
         });
 
         it('triggers event with token', async () => {
@@ -622,7 +622,7 @@ describe('Shop auth & accounts', () => {
         it('cannot login with new email address before verification', async () => {
             const result = await shopClient.asUserWithCredentials(NEW_EMAIL_ADDRESS, PASSWORD);
 
-            expect(result.code).toBe(ErrorCode.INVALID_CREDENTIALS_ERROR);
+            expect(result.errorCode).toBe(ErrorCode.INVALID_CREDENTIALS_ERROR);
         });
 
         it('return error result for bad token', async () => {
@@ -633,7 +633,9 @@ describe('Shop auth & accounts', () => {
             successErrorGuard.assertErrorResult(updateCustomerEmailAddress);
 
             expect(updateCustomerEmailAddress.message).toBe('Identifier change token not recognized');
-            expect(updateCustomerEmailAddress.code).toBe(ErrorCode.IDENTIFIER_CHANGE_TOKEN_INVALID_ERROR);
+            expect(updateCustomerEmailAddress.errorCode).toBe(
+                ErrorCode.IDENTIFIER_CHANGE_TOKEN_INVALID_ERROR,
+            );
         });
 
         it('verify the new email address', async () => {
@@ -659,7 +661,7 @@ describe('Shop auth & accounts', () => {
         it('cannot login with old email address after verification', async () => {
             const result = await shopClient.asUserWithCredentials(customer.emailAddress, PASSWORD);
 
-            expect(result.code).toBe(ErrorCode.INVALID_CREDENTIALS_ERROR);
+            expect(result.errorCode).toBe(ErrorCode.INVALID_CREDENTIALS_ERROR);
         });
 
         it('customer history for email update', async () => {
@@ -826,7 +828,7 @@ describe('Expiring tokens', () => {
         expect(verifyCustomerAccount.message).toBe(
             `Verification token has expired. Use refreshCustomerVerification to send a new token.`,
         );
-        expect(verifyCustomerAccount.code).toBe(ErrorCode.VERIFICATION_TOKEN_EXPIRED_ERROR);
+        expect(verifyCustomerAccount.errorCode).toBe(ErrorCode.VERIFICATION_TOKEN_EXPIRED_ERROR);
     });
 
     it('attempting to reset password after token has expired returns error result', async () => {
@@ -862,7 +864,7 @@ describe('Expiring tokens', () => {
         currentUserErrorGuard.assertErrorResult(resetPassword);
 
         expect(resetPassword.message).toBe(`Password reset token has expired`);
-        expect(resetPassword.code).toBe(ErrorCode.PASSWORD_RESET_TOKEN_EXPIRED_ERROR);
+        expect(resetPassword.errorCode).toBe(ErrorCode.PASSWORD_RESET_TOKEN_EXPIRED_ERROR);
     });
 });
 
@@ -908,7 +910,7 @@ describe('Registration without email verification', () => {
         successErrorGuard.assertErrorResult(registerCustomerAccount);
 
         expect(registerCustomerAccount.message).toBe('A password must be provided.');
-        expect(registerCustomerAccount.code).toBe(ErrorCode.MISSING_PASSWORD_ERROR);
+        expect(registerCustomerAccount.errorCode).toBe(ErrorCode.MISSING_PASSWORD_ERROR);
     });
 
     it('register a new account with password', async () => {

+ 1 - 1
packages/core/e2e/shop-customer.e2e-spec.ts

@@ -302,7 +302,7 @@ describe('Shop customers', () => {
             successErrorGuard.assertErrorResult(updateCustomerPassword);
 
             expect(updateCustomerPassword.message).toBe('The provided credentials are invalid');
-            expect(updateCustomerPassword.code).toBe(ErrorCode.INVALID_CREDENTIALS_ERROR);
+            expect(updateCustomerPassword.errorCode).toBe(ErrorCode.INVALID_CREDENTIALS_ERROR);
         });
 
         it('updatePassword works', async () => {

+ 1 - 1
packages/core/src/api/resolvers/shop/shop-auth.resolver.ts

@@ -117,7 +117,7 @@ export class ShopAuthResolver extends BaseAuthResolver {
         }
         const result = await this.customerService.registerCustomerAccount(ctx, args.input);
         if (isGraphQlErrorResult(result)) {
-            if (result.code === ErrorCode.EMAIL_ADDRESS_CONFLICT_ERROR) {
+            if (result.errorCode === ErrorCode.EMAIL_ADDRESS_CONFLICT_ERROR) {
                 // We do not want to reveal the email address conflict,
                 // otherwise account enumeration attacks become possible.
                 return { success: true };

+ 1 - 1
packages/core/src/api/schema/admin-api/asset.api.graphql

@@ -17,7 +17,7 @@ type Mutation {
 }
 
 type MimeTypeError implements ErrorResult {
-    code: ErrorCode!
+    errorCode: ErrorCode!
     message: String!
     fileName: String!
     mimeType: String!

+ 1 - 1
packages/core/src/api/schema/admin-api/channel.api.graphql

@@ -38,7 +38,7 @@ input UpdateChannelInput {
 
 "Returned if attempting to set a Channel's defaultLanguageCode to a language which is not enabled in GlobalSettings"
 type LanguageNotAvailableError implements ErrorResult {
-    code: ErrorCode!
+    errorCode: ErrorCode!
     message: String!
     languageCode: String!
 }

+ 1 - 1
packages/core/src/api/schema/admin-api/global-settings.api.graphql

@@ -16,7 +16,7 @@ Returned when the default LanguageCode of a Channel is no longer found in the `a
 of the GlobalSettings
 """
 type ChannelDefaultLanguageError implements ErrorResult {
-    code: ErrorCode!
+    errorCode: ErrorCode!
     message: String!
     language: String!
     channelCode: String!

+ 13 - 13
packages/core/src/api/schema/admin-api/order.api.graphql

@@ -75,71 +75,71 @@ input UpdateOrderNoteInput {
 
 "Returned if the Payment settlement fails"
 type SettlePaymentError implements ErrorResult {
-    code: ErrorCode!
+    errorCode: ErrorCode!
     message: String!
     paymentErrorMessage: String!
 }
 
 "Returned if no OrderLines have been specified for the operation"
 type EmptyOrderLineSelectionError implements ErrorResult {
-    code: ErrorCode!
+    errorCode: ErrorCode!
     message: String!
 }
 
 "Returned if the specified items are already part of a Fulfillment"
 type ItemsAlreadyFulfilledError implements ErrorResult {
-    code: ErrorCode!
+    errorCode: ErrorCode!
     message: String!
 }
 
 "Returned if an operation has specified OrderLines from multiple Orders"
 type MultipleOrderError implements ErrorResult {
-    code: ErrorCode!
+    errorCode: ErrorCode!
     message: String!
 }
 
 "Returned if an attempting to cancel lines from an Order which is still active"
 type CancelActiveOrderError implements ErrorResult {
-    code: ErrorCode!
+    errorCode: ErrorCode!
     message: String!
     orderState: String!
 }
 
 "Returned if an attempting to refund a Payment against OrderLines from a different Order"
 type PaymentOrderMismatchError implements ErrorResult {
-    code: ErrorCode!
+    errorCode: ErrorCode!
     message: String!
 }
 
 "Returned if an attempting to refund an Order which is not in the expected state"
 type RefundOrderStateError implements ErrorResult {
-    code: ErrorCode!
+    errorCode: ErrorCode!
     message: String!
     orderState: String!
 }
 
 "Returned if an attempting to refund an Order but neither items nor shipping refund was specified"
 type NothingToRefundError implements ErrorResult {
-    code: ErrorCode!
+    errorCode: ErrorCode!
     message: String!
 }
 
 "Returned if an attempting to refund an OrderItem which has already been refunded"
 type AlreadyRefundedError implements ErrorResult {
-    code: ErrorCode!
+    errorCode: ErrorCode!
     message: String!
     refundId: ID!
 }
 
 "Returned if the specified quantity of an OrderLine is greater than the number of items in that line"
 type QuantityTooGreatError implements ErrorResult {
-    code: ErrorCode!
+    errorCode: ErrorCode!
     message: String!
 }
 
 "Returned when there is an error in transitioning the Refund state"
 type RefundStateTransitionError implements ErrorResult {
-    code: ErrorCode!
+    errorCode: ErrorCode!
     message: String!
     transitionError: String!
     fromState: String!
@@ -148,7 +148,7 @@ type RefundStateTransitionError implements ErrorResult {
 
 "Returned when there is an error in transitioning the Payment state"
 type PaymentStateTransitionError implements ErrorResult {
-    code: ErrorCode!
+    errorCode: ErrorCode!
     message: String!
     transitionError: String!
     fromState: String!
@@ -157,7 +157,7 @@ type PaymentStateTransitionError implements ErrorResult {
 
 "Returned when there is an error in transitioning the Fulfillment state"
 type FulfillmentStateTransitionError implements ErrorResult {
-    code: ErrorCode!
+    errorCode: ErrorCode!
     message: String!
     transitionError: String!
     fromState: String!

+ 1 - 1
packages/core/src/api/schema/admin-api/product.api.graphql

@@ -141,7 +141,7 @@ input RemoveProductsFromChannelInput {
 }
 
 type ProductOptionInUseError implements ErrorResult {
-    code: ErrorCode!
+    errorCode: ErrorCode!
     message: String!
     optionGroupCode: String!
     productVariantCount: Int!

+ 1 - 1
packages/core/src/api/schema/admin-api/promotion.api.graphql

@@ -39,7 +39,7 @@ input UpdatePromotionInput {
 
 "Returned if a PromotionCondition has neither a couponCode nor any conditions set"
 type MissingConditionsError implements ErrorResult {
-    code: ErrorCode!
+    errorCode: ErrorCode!
     message: String!
 }
 

+ 5 - 5
packages/core/src/api/schema/common/common-types.graphql

@@ -86,7 +86,7 @@ enum ErrorCode {
 }
 
 interface ErrorResult {
-    code: ErrorCode!
+    errorCode: ErrorCode!
     message: String!
 }
 
@@ -193,19 +193,19 @@ type Success {
 
 "Retured when attempting an operation that relies on the NativeAuthStrategy, if that strategy is not configured."
 type NativeAuthStrategyError implements ErrorResult {
-    code: ErrorCode!
+    errorCode: ErrorCode!
     message: String!
 }
 
 "Returned if the user authentication credentials are not valid"
 type InvalidCredentialsError implements ErrorResult {
-    code: ErrorCode!
+    errorCode: ErrorCode!
     message: String!
 }
 
 "Returned if there is an error in transitioning the Order state"
 type OrderStateTransitionError implements ErrorResult {
-    code: ErrorCode!
+    errorCode: ErrorCode!
     message: String!
     transitionError: String!
     fromState: String!
@@ -214,6 +214,6 @@ type OrderStateTransitionError implements ErrorResult {
 
 "Retured when attemting to create a Customer with an email address already registered to an existing User."
 type EmailAddressConflictError implements ErrorResult {
-    code: ErrorCode!
+    errorCode: ErrorCode!
     message: String!
 }

+ 19 - 19
packages/core/src/api/schema/shop-api/shop.api.graphql

@@ -180,67 +180,67 @@ input ProductListOptions
 
 "Returned when attempting to modify the contents of an Order that is not in the `AddingItems` state."
 type OrderModificationError implements ErrorResult {
-    code: ErrorCode!
+    errorCode: ErrorCode!
     message: String!
 }
 
 "Retured when the maximum order size limit has been reached."
 type OrderLimitError implements ErrorResult {
-    code: ErrorCode!
+    errorCode: ErrorCode!
     message: String!
     maxItems: Int!
 }
 
 "Retured when attemting to set a negative OrderLine quantity."
 type NegativeQuantityError implements ErrorResult {
-    code: ErrorCode!
+    errorCode: ErrorCode!
     message: String!
 }
 
 "Returned when attempting to add a Payment to an Order that is not in the `ArrangingPayment` state."
 type OrderPaymentStateError implements ErrorResult {
-    code: ErrorCode!
+    errorCode: ErrorCode!
     message: String!
 }
 
 "Returned when a Payment fails due to an error."
 type PaymentFailedError implements ErrorResult {
-    code: ErrorCode!
+    errorCode: ErrorCode!
     message: String!
     paymentErrorMessage: String!
 }
 
 "Returned when a Payment is declined by the payment provider."
 type PaymentDeclinedError implements ErrorResult {
-    code: ErrorCode!
+    errorCode: ErrorCode!
     message: String!
     paymentErrorMessage: String!
 }
 
 "Returned if the provided coupon code is invalid"
 type CouponCodeInvalidError implements ErrorResult {
-    code: ErrorCode!
+    errorCode: ErrorCode!
     message: String!
     couponCode: String!
 }
 
 "Returned if the provided coupon code is invalid"
 type CouponCodeInvalidError implements ErrorResult {
-    code: ErrorCode!
+    errorCode: ErrorCode!
     message: String!
     couponCode: String!
 }
 
 "Returned if the provided coupon code is invalid"
 type CouponCodeExpiredError implements ErrorResult {
-    code: ErrorCode!
+    errorCode: ErrorCode!
     message: String!
     couponCode: String!
 }
 
 "Returned if the provided coupon code is invalid"
 type CouponCodeLimitError implements ErrorResult {
-    code: ErrorCode!
+    errorCode: ErrorCode!
     message: String!
     couponCode: String!
     limit: Int!
@@ -248,19 +248,19 @@ type CouponCodeLimitError implements ErrorResult {
 
 "Retured when attemting to set the Customer for an Order when already logged in."
 type AlreadyLoggedInError implements ErrorResult {
-    code: ErrorCode!
+    errorCode: ErrorCode!
     message: String!
 }
 
 "Retured when attemting to register or verify a customer account without a password, when one is required."
 type MissingPasswordError implements ErrorResult {
-    code: ErrorCode!
+    errorCode: ErrorCode!
     message: String!
 }
 
 "Retured when attemting to verify a customer account with a password, when a password has already been set."
 type PasswordAlreadySetError implements ErrorResult {
-    code: ErrorCode!
+    errorCode: ErrorCode!
     message: String!
 }
 
@@ -269,7 +269,7 @@ Retured if the verification token (used to verify a Customer's email address) is
 invalid or does not match any expected tokens.
 """
 type VerificationTokenInvalidError implements ErrorResult {
-    code: ErrorCode!
+    errorCode: ErrorCode!
     message: String!
 }
 
@@ -278,7 +278,7 @@ Returned if the verification token (used to verify a Customer's email address) i
 expired according to the `verificationTokenDuration` setting in the AuthOptions.
 """
 type VerificationTokenExpiredError implements ErrorResult {
-    code: ErrorCode!
+    errorCode: ErrorCode!
     message: String!
 }
 
@@ -287,7 +287,7 @@ Retured if the token used to change a Customer's email address is either
 invalid or does not match any expected tokens.
 """
 type IdentifierChangeTokenInvalidError implements ErrorResult {
-    code: ErrorCode!
+    errorCode: ErrorCode!
     message: String!
 }
 
@@ -296,7 +296,7 @@ Retured if the token used to change a Customer's email address is valid, but has
 expired according to the `verificationTokenDuration` setting in the AuthOptions.
 """
 type IdentifierChangeTokenExpiredError implements ErrorResult {
-    code: ErrorCode!
+    errorCode: ErrorCode!
     message: String!
 }
 
@@ -305,7 +305,7 @@ Retured if the token used to reset a Customer's password is either
 invalid or does not match any expected tokens.
 """
 type PasswordResetTokenInvalidError implements ErrorResult {
-    code: ErrorCode!
+    errorCode: ErrorCode!
     message: String!
 }
 
@@ -314,7 +314,7 @@ Retured if the token used to reset a Customer's password is valid, but has
 expired according to the `verificationTokenDuration` setting in the AuthOptions.
 """
 type PasswordResetTokenExpiredError implements ErrorResult {
-    code: ErrorCode!
+    errorCode: ErrorCode!
     message: String!
 }
 

+ 9 - 2
packages/core/src/common/error/error-result.ts

@@ -1,5 +1,5 @@
 import { ErrorResult as GraphQLErrorResultShop } from '@vendure/common/lib/generated-shop-types';
-import { ErrorResult as GraphQLErrorResultAdmin } from '@vendure/common/lib/generated-types';
+import { ErrorResult, ErrorResult as GraphQLErrorResultAdmin } from '@vendure/common/lib/generated-types';
 
 import { VendureEntity } from '../../entity/base/base.entity';
 
@@ -52,5 +52,12 @@ export function isGraphQlErrorResult<T extends GraphQLErrorResult | U, U = any>(
 export function isGraphQlErrorResult<T, E extends VendureEntity>(
     input: ErrorResultUnion<T, E>,
 ): input is JustErrorResults<ErrorResultUnion<T, E>> {
-    return input && !!((input as any).code && (input as any).message != null) && (input as any).__typename;
+    return (
+        input &&
+        !!(
+            ((input as unknown) as GraphQLErrorResult).errorCode &&
+            ((input as unknown) as GraphQLErrorResult).message != null
+        ) &&
+        (input as any).__typename
+    );
 }

+ 23 - 23
packages/core/src/common/error/generated-graphql-admin-errors.ts

@@ -14,13 +14,13 @@ export type Scalars = {
 
 export class ErrorResult {
   readonly __typename: string;
-  readonly code: string;
+  readonly errorCode: string;
   message: Scalars['String'];
 }
 
 export class AlreadyRefundedError extends ErrorResult {
   readonly __typename = 'AlreadyRefundedError';
-  readonly code = 'ALREADY_REFUNDED_ERROR' as any;
+  readonly errorCode = 'ALREADY_REFUNDED_ERROR' as any;
   readonly message = 'ALREADY_REFUNDED_ERROR';
   constructor(
     public   refundId: Scalars['ID'],
@@ -31,7 +31,7 @@ export class AlreadyRefundedError extends ErrorResult {
 
 export class CancelActiveOrderError extends ErrorResult {
   readonly __typename = 'CancelActiveOrderError';
-  readonly code = 'CANCEL_ACTIVE_ORDER_ERROR' as any;
+  readonly errorCode = 'CANCEL_ACTIVE_ORDER_ERROR' as any;
   readonly message = 'CANCEL_ACTIVE_ORDER_ERROR';
   constructor(
     public   orderState: Scalars['String'],
@@ -42,7 +42,7 @@ export class CancelActiveOrderError extends ErrorResult {
 
 export class ChannelDefaultLanguageError extends ErrorResult {
   readonly __typename = 'ChannelDefaultLanguageError';
-  readonly code = 'CHANNEL_DEFAULT_LANGUAGE_ERROR' as any;
+  readonly errorCode = 'CHANNEL_DEFAULT_LANGUAGE_ERROR' as any;
   readonly message = 'CHANNEL_DEFAULT_LANGUAGE_ERROR';
   constructor(
     public   language: Scalars['String'],
@@ -54,7 +54,7 @@ export class ChannelDefaultLanguageError extends ErrorResult {
 
 export class EmailAddressConflictError extends ErrorResult {
   readonly __typename = 'EmailAddressConflictError';
-  readonly code = 'EMAIL_ADDRESS_CONFLICT_ERROR' as any;
+  readonly errorCode = 'EMAIL_ADDRESS_CONFLICT_ERROR' as any;
   readonly message = 'EMAIL_ADDRESS_CONFLICT_ERROR';
   constructor(
   ) {
@@ -64,7 +64,7 @@ export class EmailAddressConflictError extends ErrorResult {
 
 export class EmptyOrderLineSelectionError extends ErrorResult {
   readonly __typename = 'EmptyOrderLineSelectionError';
-  readonly code = 'EMPTY_ORDER_LINE_SELECTION_ERROR' as any;
+  readonly errorCode = 'EMPTY_ORDER_LINE_SELECTION_ERROR' as any;
   readonly message = 'EMPTY_ORDER_LINE_SELECTION_ERROR';
   constructor(
   ) {
@@ -74,7 +74,7 @@ export class EmptyOrderLineSelectionError extends ErrorResult {
 
 export class FulfillmentStateTransitionError extends ErrorResult {
   readonly __typename = 'FulfillmentStateTransitionError';
-  readonly code = 'FULFILLMENT_STATE_TRANSITION_ERROR' as any;
+  readonly errorCode = 'FULFILLMENT_STATE_TRANSITION_ERROR' as any;
   readonly message = 'FULFILLMENT_STATE_TRANSITION_ERROR';
   constructor(
     public   transitionError: Scalars['String'],
@@ -87,7 +87,7 @@ export class FulfillmentStateTransitionError extends ErrorResult {
 
 export class InvalidCredentialsError extends ErrorResult {
   readonly __typename = 'InvalidCredentialsError';
-  readonly code = 'INVALID_CREDENTIALS_ERROR' as any;
+  readonly errorCode = 'INVALID_CREDENTIALS_ERROR' as any;
   readonly message = 'INVALID_CREDENTIALS_ERROR';
   constructor(
   ) {
@@ -97,7 +97,7 @@ export class InvalidCredentialsError extends ErrorResult {
 
 export class ItemsAlreadyFulfilledError extends ErrorResult {
   readonly __typename = 'ItemsAlreadyFulfilledError';
-  readonly code = 'ITEMS_ALREADY_FULFILLED_ERROR' as any;
+  readonly errorCode = 'ITEMS_ALREADY_FULFILLED_ERROR' as any;
   readonly message = 'ITEMS_ALREADY_FULFILLED_ERROR';
   constructor(
   ) {
@@ -107,7 +107,7 @@ export class ItemsAlreadyFulfilledError extends ErrorResult {
 
 export class LanguageNotAvailableError extends ErrorResult {
   readonly __typename = 'LanguageNotAvailableError';
-  readonly code = 'LANGUAGE_NOT_AVAILABLE_ERROR' as any;
+  readonly errorCode = 'LANGUAGE_NOT_AVAILABLE_ERROR' as any;
   readonly message = 'LANGUAGE_NOT_AVAILABLE_ERROR';
   constructor(
     public   languageCode: Scalars['String'],
@@ -118,7 +118,7 @@ export class LanguageNotAvailableError extends ErrorResult {
 
 export class MimeTypeError extends ErrorResult {
   readonly __typename = 'MimeTypeError';
-  readonly code = 'MIME_TYPE_ERROR' as any;
+  readonly errorCode = 'MIME_TYPE_ERROR' as any;
   readonly message = 'MIME_TYPE_ERROR';
   constructor(
     public   fileName: Scalars['String'],
@@ -130,7 +130,7 @@ export class MimeTypeError extends ErrorResult {
 
 export class MissingConditionsError extends ErrorResult {
   readonly __typename = 'MissingConditionsError';
-  readonly code = 'MISSING_CONDITIONS_ERROR' as any;
+  readonly errorCode = 'MISSING_CONDITIONS_ERROR' as any;
   readonly message = 'MISSING_CONDITIONS_ERROR';
   constructor(
   ) {
@@ -140,7 +140,7 @@ export class MissingConditionsError extends ErrorResult {
 
 export class MultipleOrderError extends ErrorResult {
   readonly __typename = 'MultipleOrderError';
-  readonly code = 'MULTIPLE_ORDER_ERROR' as any;
+  readonly errorCode = 'MULTIPLE_ORDER_ERROR' as any;
   readonly message = 'MULTIPLE_ORDER_ERROR';
   constructor(
   ) {
@@ -150,7 +150,7 @@ export class MultipleOrderError extends ErrorResult {
 
 export class NativeAuthStrategyError extends ErrorResult {
   readonly __typename = 'NativeAuthStrategyError';
-  readonly code = 'NATIVE_AUTH_STRATEGY_ERROR' as any;
+  readonly errorCode = 'NATIVE_AUTH_STRATEGY_ERROR' as any;
   readonly message = 'NATIVE_AUTH_STRATEGY_ERROR';
   constructor(
   ) {
@@ -160,7 +160,7 @@ export class NativeAuthStrategyError extends ErrorResult {
 
 export class NothingToRefundError extends ErrorResult {
   readonly __typename = 'NothingToRefundError';
-  readonly code = 'NOTHING_TO_REFUND_ERROR' as any;
+  readonly errorCode = 'NOTHING_TO_REFUND_ERROR' as any;
   readonly message = 'NOTHING_TO_REFUND_ERROR';
   constructor(
   ) {
@@ -170,7 +170,7 @@ export class NothingToRefundError extends ErrorResult {
 
 export class OrderStateTransitionError extends ErrorResult {
   readonly __typename = 'OrderStateTransitionError';
-  readonly code = 'ORDER_STATE_TRANSITION_ERROR' as any;
+  readonly errorCode = 'ORDER_STATE_TRANSITION_ERROR' as any;
   readonly message = 'ORDER_STATE_TRANSITION_ERROR';
   constructor(
     public   transitionError: Scalars['String'],
@@ -183,7 +183,7 @@ export class OrderStateTransitionError extends ErrorResult {
 
 export class PaymentOrderMismatchError extends ErrorResult {
   readonly __typename = 'PaymentOrderMismatchError';
-  readonly code = 'PAYMENT_ORDER_MISMATCH_ERROR' as any;
+  readonly errorCode = 'PAYMENT_ORDER_MISMATCH_ERROR' as any;
   readonly message = 'PAYMENT_ORDER_MISMATCH_ERROR';
   constructor(
   ) {
@@ -193,7 +193,7 @@ export class PaymentOrderMismatchError extends ErrorResult {
 
 export class PaymentStateTransitionError extends ErrorResult {
   readonly __typename = 'PaymentStateTransitionError';
-  readonly code = 'PAYMENT_STATE_TRANSITION_ERROR' as any;
+  readonly errorCode = 'PAYMENT_STATE_TRANSITION_ERROR' as any;
   readonly message = 'PAYMENT_STATE_TRANSITION_ERROR';
   constructor(
     public   transitionError: Scalars['String'],
@@ -206,7 +206,7 @@ export class PaymentStateTransitionError extends ErrorResult {
 
 export class ProductOptionInUseError extends ErrorResult {
   readonly __typename = 'ProductOptionInUseError';
-  readonly code = 'PRODUCT_OPTION_IN_USE_ERROR' as any;
+  readonly errorCode = 'PRODUCT_OPTION_IN_USE_ERROR' as any;
   readonly message = 'PRODUCT_OPTION_IN_USE_ERROR';
   constructor(
     public   optionGroupCode: Scalars['String'],
@@ -218,7 +218,7 @@ export class ProductOptionInUseError extends ErrorResult {
 
 export class QuantityTooGreatError extends ErrorResult {
   readonly __typename = 'QuantityTooGreatError';
-  readonly code = 'QUANTITY_TOO_GREAT_ERROR' as any;
+  readonly errorCode = 'QUANTITY_TOO_GREAT_ERROR' as any;
   readonly message = 'QUANTITY_TOO_GREAT_ERROR';
   constructor(
   ) {
@@ -228,7 +228,7 @@ export class QuantityTooGreatError extends ErrorResult {
 
 export class RefundOrderStateError extends ErrorResult {
   readonly __typename = 'RefundOrderStateError';
-  readonly code = 'REFUND_ORDER_STATE_ERROR' as any;
+  readonly errorCode = 'REFUND_ORDER_STATE_ERROR' as any;
   readonly message = 'REFUND_ORDER_STATE_ERROR';
   constructor(
     public   orderState: Scalars['String'],
@@ -239,7 +239,7 @@ export class RefundOrderStateError extends ErrorResult {
 
 export class RefundStateTransitionError extends ErrorResult {
   readonly __typename = 'RefundStateTransitionError';
-  readonly code = 'REFUND_STATE_TRANSITION_ERROR' as any;
+  readonly errorCode = 'REFUND_STATE_TRANSITION_ERROR' as any;
   readonly message = 'REFUND_STATE_TRANSITION_ERROR';
   constructor(
     public   transitionError: Scalars['String'],
@@ -252,7 +252,7 @@ export class RefundStateTransitionError extends ErrorResult {
 
 export class SettlePaymentError extends ErrorResult {
   readonly __typename = 'SettlePaymentError';
-  readonly code = 'SETTLE_PAYMENT_ERROR' as any;
+  readonly errorCode = 'SETTLE_PAYMENT_ERROR' as any;
   readonly message = 'SETTLE_PAYMENT_ERROR';
   constructor(
     public   paymentErrorMessage: Scalars['String'],

+ 23 - 23
packages/core/src/common/error/generated-graphql-shop-errors.ts

@@ -14,13 +14,13 @@ export type Scalars = {
 
 export class ErrorResult {
   readonly __typename: string;
-  readonly code: string;
+  readonly errorCode: string;
   message: Scalars['String'];
 }
 
 export class AlreadyLoggedInError extends ErrorResult {
   readonly __typename = 'AlreadyLoggedInError';
-  readonly code = 'ALREADY_LOGGED_IN_ERROR' as any;
+  readonly errorCode = 'ALREADY_LOGGED_IN_ERROR' as any;
   readonly message = 'ALREADY_LOGGED_IN_ERROR';
   constructor(
   ) {
@@ -30,7 +30,7 @@ export class AlreadyLoggedInError extends ErrorResult {
 
 export class CouponCodeExpiredError extends ErrorResult {
   readonly __typename = 'CouponCodeExpiredError';
-  readonly code = 'COUPON_CODE_EXPIRED_ERROR' as any;
+  readonly errorCode = 'COUPON_CODE_EXPIRED_ERROR' as any;
   readonly message = 'COUPON_CODE_EXPIRED_ERROR';
   constructor(
     public   couponCode: Scalars['String'],
@@ -41,7 +41,7 @@ export class CouponCodeExpiredError extends ErrorResult {
 
 export class CouponCodeInvalidError extends ErrorResult {
   readonly __typename = 'CouponCodeInvalidError';
-  readonly code = 'COUPON_CODE_INVALID_ERROR' as any;
+  readonly errorCode = 'COUPON_CODE_INVALID_ERROR' as any;
   readonly message = 'COUPON_CODE_INVALID_ERROR';
   constructor(
     public   couponCode: Scalars['String'],
@@ -52,7 +52,7 @@ export class CouponCodeInvalidError extends ErrorResult {
 
 export class CouponCodeLimitError extends ErrorResult {
   readonly __typename = 'CouponCodeLimitError';
-  readonly code = 'COUPON_CODE_LIMIT_ERROR' as any;
+  readonly errorCode = 'COUPON_CODE_LIMIT_ERROR' as any;
   readonly message = 'COUPON_CODE_LIMIT_ERROR';
   constructor(
     public   couponCode: Scalars['String'],
@@ -64,7 +64,7 @@ export class CouponCodeLimitError extends ErrorResult {
 
 export class EmailAddressConflictError extends ErrorResult {
   readonly __typename = 'EmailAddressConflictError';
-  readonly code = 'EMAIL_ADDRESS_CONFLICT_ERROR' as any;
+  readonly errorCode = 'EMAIL_ADDRESS_CONFLICT_ERROR' as any;
   readonly message = 'EMAIL_ADDRESS_CONFLICT_ERROR';
   constructor(
   ) {
@@ -74,7 +74,7 @@ export class EmailAddressConflictError extends ErrorResult {
 
 export class IdentifierChangeTokenExpiredError extends ErrorResult {
   readonly __typename = 'IdentifierChangeTokenExpiredError';
-  readonly code = 'IDENTIFIER_CHANGE_TOKEN_EXPIRED_ERROR' as any;
+  readonly errorCode = 'IDENTIFIER_CHANGE_TOKEN_EXPIRED_ERROR' as any;
   readonly message = 'IDENTIFIER_CHANGE_TOKEN_EXPIRED_ERROR';
   constructor(
   ) {
@@ -84,7 +84,7 @@ export class IdentifierChangeTokenExpiredError extends ErrorResult {
 
 export class IdentifierChangeTokenInvalidError extends ErrorResult {
   readonly __typename = 'IdentifierChangeTokenInvalidError';
-  readonly code = 'IDENTIFIER_CHANGE_TOKEN_INVALID_ERROR' as any;
+  readonly errorCode = 'IDENTIFIER_CHANGE_TOKEN_INVALID_ERROR' as any;
   readonly message = 'IDENTIFIER_CHANGE_TOKEN_INVALID_ERROR';
   constructor(
   ) {
@@ -94,7 +94,7 @@ export class IdentifierChangeTokenInvalidError extends ErrorResult {
 
 export class InvalidCredentialsError extends ErrorResult {
   readonly __typename = 'InvalidCredentialsError';
-  readonly code = 'INVALID_CREDENTIALS_ERROR' as any;
+  readonly errorCode = 'INVALID_CREDENTIALS_ERROR' as any;
   readonly message = 'INVALID_CREDENTIALS_ERROR';
   constructor(
   ) {
@@ -104,7 +104,7 @@ export class InvalidCredentialsError extends ErrorResult {
 
 export class MissingPasswordError extends ErrorResult {
   readonly __typename = 'MissingPasswordError';
-  readonly code = 'MISSING_PASSWORD_ERROR' as any;
+  readonly errorCode = 'MISSING_PASSWORD_ERROR' as any;
   readonly message = 'MISSING_PASSWORD_ERROR';
   constructor(
   ) {
@@ -114,7 +114,7 @@ export class MissingPasswordError extends ErrorResult {
 
 export class NativeAuthStrategyError extends ErrorResult {
   readonly __typename = 'NativeAuthStrategyError';
-  readonly code = 'NATIVE_AUTH_STRATEGY_ERROR' as any;
+  readonly errorCode = 'NATIVE_AUTH_STRATEGY_ERROR' as any;
   readonly message = 'NATIVE_AUTH_STRATEGY_ERROR';
   constructor(
   ) {
@@ -124,7 +124,7 @@ export class NativeAuthStrategyError extends ErrorResult {
 
 export class NegativeQuantityError extends ErrorResult {
   readonly __typename = 'NegativeQuantityError';
-  readonly code = 'NEGATIVE_QUANTITY_ERROR' as any;
+  readonly errorCode = 'NEGATIVE_QUANTITY_ERROR' as any;
   readonly message = 'NEGATIVE_QUANTITY_ERROR';
   constructor(
   ) {
@@ -134,7 +134,7 @@ export class NegativeQuantityError extends ErrorResult {
 
 export class OrderLimitError extends ErrorResult {
   readonly __typename = 'OrderLimitError';
-  readonly code = 'ORDER_LIMIT_ERROR' as any;
+  readonly errorCode = 'ORDER_LIMIT_ERROR' as any;
   readonly message = 'ORDER_LIMIT_ERROR';
   constructor(
     public   maxItems: Scalars['Int'],
@@ -145,7 +145,7 @@ export class OrderLimitError extends ErrorResult {
 
 export class OrderModificationError extends ErrorResult {
   readonly __typename = 'OrderModificationError';
-  readonly code = 'ORDER_MODIFICATION_ERROR' as any;
+  readonly errorCode = 'ORDER_MODIFICATION_ERROR' as any;
   readonly message = 'ORDER_MODIFICATION_ERROR';
   constructor(
   ) {
@@ -155,7 +155,7 @@ export class OrderModificationError extends ErrorResult {
 
 export class OrderPaymentStateError extends ErrorResult {
   readonly __typename = 'OrderPaymentStateError';
-  readonly code = 'ORDER_PAYMENT_STATE_ERROR' as any;
+  readonly errorCode = 'ORDER_PAYMENT_STATE_ERROR' as any;
   readonly message = 'ORDER_PAYMENT_STATE_ERROR';
   constructor(
   ) {
@@ -165,7 +165,7 @@ export class OrderPaymentStateError extends ErrorResult {
 
 export class OrderStateTransitionError extends ErrorResult {
   readonly __typename = 'OrderStateTransitionError';
-  readonly code = 'ORDER_STATE_TRANSITION_ERROR' as any;
+  readonly errorCode = 'ORDER_STATE_TRANSITION_ERROR' as any;
   readonly message = 'ORDER_STATE_TRANSITION_ERROR';
   constructor(
     public   transitionError: Scalars['String'],
@@ -178,7 +178,7 @@ export class OrderStateTransitionError extends ErrorResult {
 
 export class PasswordAlreadySetError extends ErrorResult {
   readonly __typename = 'PasswordAlreadySetError';
-  readonly code = 'PASSWORD_ALREADY_SET_ERROR' as any;
+  readonly errorCode = 'PASSWORD_ALREADY_SET_ERROR' as any;
   readonly message = 'PASSWORD_ALREADY_SET_ERROR';
   constructor(
   ) {
@@ -188,7 +188,7 @@ export class PasswordAlreadySetError extends ErrorResult {
 
 export class PasswordResetTokenExpiredError extends ErrorResult {
   readonly __typename = 'PasswordResetTokenExpiredError';
-  readonly code = 'PASSWORD_RESET_TOKEN_EXPIRED_ERROR' as any;
+  readonly errorCode = 'PASSWORD_RESET_TOKEN_EXPIRED_ERROR' as any;
   readonly message = 'PASSWORD_RESET_TOKEN_EXPIRED_ERROR';
   constructor(
   ) {
@@ -198,7 +198,7 @@ export class PasswordResetTokenExpiredError extends ErrorResult {
 
 export class PasswordResetTokenInvalidError extends ErrorResult {
   readonly __typename = 'PasswordResetTokenInvalidError';
-  readonly code = 'PASSWORD_RESET_TOKEN_INVALID_ERROR' as any;
+  readonly errorCode = 'PASSWORD_RESET_TOKEN_INVALID_ERROR' as any;
   readonly message = 'PASSWORD_RESET_TOKEN_INVALID_ERROR';
   constructor(
   ) {
@@ -208,7 +208,7 @@ export class PasswordResetTokenInvalidError extends ErrorResult {
 
 export class PaymentDeclinedError extends ErrorResult {
   readonly __typename = 'PaymentDeclinedError';
-  readonly code = 'PAYMENT_DECLINED_ERROR' as any;
+  readonly errorCode = 'PAYMENT_DECLINED_ERROR' as any;
   readonly message = 'PAYMENT_DECLINED_ERROR';
   constructor(
     public   paymentErrorMessage: Scalars['String'],
@@ -219,7 +219,7 @@ export class PaymentDeclinedError extends ErrorResult {
 
 export class PaymentFailedError extends ErrorResult {
   readonly __typename = 'PaymentFailedError';
-  readonly code = 'PAYMENT_FAILED_ERROR' as any;
+  readonly errorCode = 'PAYMENT_FAILED_ERROR' as any;
   readonly message = 'PAYMENT_FAILED_ERROR';
   constructor(
     public   paymentErrorMessage: Scalars['String'],
@@ -230,7 +230,7 @@ export class PaymentFailedError extends ErrorResult {
 
 export class VerificationTokenExpiredError extends ErrorResult {
   readonly __typename = 'VerificationTokenExpiredError';
-  readonly code = 'VERIFICATION_TOKEN_EXPIRED_ERROR' as any;
+  readonly errorCode = 'VERIFICATION_TOKEN_EXPIRED_ERROR' as any;
   readonly message = 'VERIFICATION_TOKEN_EXPIRED_ERROR';
   constructor(
   ) {
@@ -240,7 +240,7 @@ export class VerificationTokenExpiredError extends ErrorResult {
 
 export class VerificationTokenInvalidError extends ErrorResult {
   readonly __typename = 'VerificationTokenInvalidError';
-  readonly code = 'VERIFICATION_TOKEN_INVALID_ERROR' as any;
+  readonly errorCode = 'VERIFICATION_TOKEN_INVALID_ERROR' as any;
   readonly message = 'VERIFICATION_TOKEN_INVALID_ERROR';
   constructor(
   ) {

+ 24 - 23
packages/elasticsearch-plugin/e2e/graphql/generated-e2e-elasticsearch-plugin-types.ts

@@ -109,7 +109,7 @@ export type AdministratorSortParameter = {
 
 /** Returned if an attempting to refund an OrderItem which has already been refunded */
 export type AlreadyRefundedError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     refundId: Scalars['ID'];
 };
@@ -208,7 +208,7 @@ export type BooleanOperators = {
 
 /** Returned if an attempting to cancel lines from an Order which is still active */
 export type CancelActiveOrderError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     orderState: Scalars['String'];
 };
@@ -258,7 +258,7 @@ export type Channel = Node & {
  * of the GlobalSettings
  */
 export type ChannelDefaultLanguageError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     language: Scalars['String'];
     channelCode: Scalars['String'];
@@ -1141,13 +1141,13 @@ export enum DeletionResult {
 
 /** Retured when attemting to create a Customer with an email address already registered to an existing User. */
 export type EmailAddressConflictError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
 /** Returned if no OrderLines have been specified for the operation */
 export type EmptyOrderLineSelectionError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -1178,7 +1178,7 @@ export enum ErrorCode {
 }
 
 export type ErrorResult = {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -1301,7 +1301,7 @@ export type Fulfillment = Node & {
 
 /** Returned when there is an error in transitioning the Fulfillment state */
 export type FulfillmentStateTransitionError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     transitionError: Scalars['String'];
     fromState: Scalars['String'];
@@ -1406,13 +1406,13 @@ export type IntCustomFieldConfig = CustomField & {
 
 /** Returned if the user authentication credentials are not valid */
 export type InvalidCredentialsError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
 /** Returned if the specified items are already part of a Fulfillment */
 export type ItemsAlreadyFulfilledError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -1809,8 +1809,9 @@ export enum LanguageCode {
     zu = 'zu',
 }
 
+/** Returned if attempting to set a Channel's defaultLanguageCode to a language which is not enabled in GlobalSettings */
 export type LanguageNotAvailableError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     languageCode: Scalars['String'];
 };
@@ -1838,7 +1839,7 @@ export enum LogicalOperator {
 }
 
 export type MimeTypeError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     fileName: Scalars['String'];
     mimeType: Scalars['String'];
@@ -1846,7 +1847,7 @@ export type MimeTypeError = ErrorResult & {
 
 /** Returned if a PromotionCondition has neither a couponCode nor any conditions set */
 export type MissingConditionsError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -1858,7 +1859,7 @@ export type MoveCollectionInput = {
 
 /** Returned if an operation has specified OrderLines from multiple Orders */
 export type MultipleOrderError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -2413,7 +2414,7 @@ export type NativeAuthInput = {
 
 /** Retured when attempting an operation that relies on the NativeAuthStrategy, if that strategy is not configured. */
 export type NativeAuthStrategyError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -2423,7 +2424,7 @@ export type Node = {
 
 /** Returned if an attempting to refund an Order but neither items nor shipping refund was specified */
 export type NothingToRefundError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -2575,7 +2576,7 @@ export type OrderSortParameter = {
 
 /** Returned if there is an error in transitioning the Order state */
 export type OrderStateTransitionError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     transitionError: Scalars['String'];
     fromState: Scalars['String'];
@@ -2638,13 +2639,13 @@ export type PaymentMethodSortParameter = {
 
 /** Returned if an attempting to refund a Payment against OrderLines from a different Order */
 export type PaymentOrderMismatchError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
 /** Returned when there is an error in transitioning the Payment state */
 export type PaymentStateTransitionError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     transitionError: Scalars['String'];
     fromState: Scalars['String'];
@@ -2783,7 +2784,7 @@ export type ProductOptionGroupTranslationInput = {
 };
 
 export type ProductOptionInUseError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     optionGroupCode: Scalars['String'];
     productVariantCount: Scalars['Int'];
@@ -2967,7 +2968,7 @@ export type PromotionSortParameter = {
 
 /** Returned if the specified quantity of an OrderLine is greater than the number of items in that line */
 export type QuantityTooGreatError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
 };
 
@@ -3231,14 +3232,14 @@ export type RefundOrderResult =
 
 /** Returned if an attempting to refund an Order which is not in the expected state */
 export type RefundOrderStateError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     orderState: Scalars['String'];
 };
 
 /** Returned when there is an error in transitioning the Refund state */
 export type RefundStateTransitionError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     transitionError: Scalars['String'];
     fromState: Scalars['String'];
@@ -3383,7 +3384,7 @@ export type ServerConfig = {
 
 /** Returned if the Payment settlement fails */
 export type SettlePaymentError = ErrorResult & {
-    code: ErrorCode;
+    errorCode: ErrorCode;
     message: Scalars['String'];
     paymentErrorMessage: Scalars['String'];
 };

+ 1 - 1
packages/testing/src/simple-graphql-client.ts

@@ -22,7 +22,7 @@ const LOGIN = gql`
                 }
             }
             ... on ErrorResult {
-                code
+                errorCode
                 message
             }
         }

Разлика између датотеке није приказан због своје велике величине
+ 0 - 0
schema-admin.json


Разлика између датотеке није приказан због своје велике величине
+ 0 - 0
schema-shop.json


+ 21 - 18
scripts/codegen/generate-graphql-types.ts

@@ -106,24 +106,27 @@ Promise.all([
                     plugins: clientPlugins,
                     config: e2eConfig,
                 },
-                // [path.join(
-                //     __dirname,
-                //     '../../packages/admin-ui/src/lib/core/src/common/generated-types.ts',
-                // )]: {
-                //     schema: [ADMIN_SCHEMA_OUTPUT_FILE, path.join(__dirname, 'client-schema.ts')],
-                //     documents: CLIENT_QUERY_FILES,
-                //     plugins: clientPlugins,
-                //     config,
-                // },
-                // [path.join(
-                //     __dirname,
-                //     '../../packages/admin-ui/src/lib/core/src/common/introspection-result.ts',
-                // )]: {
-                //     schema: [ADMIN_SCHEMA_OUTPUT_FILE, path.join(__dirname, 'client-schema.ts')],
-                //     documents: CLIENT_QUERY_FILES,
-                //     plugins: [disableTsLintPlugin, 'fragment-matcher'],
-                //     config,
-                // },
+                [path.join(
+                    __dirname,
+                    '../../packages/admin-ui/src/lib/core/src/common/generated-types.ts',
+                )]: {
+                    schema: [ADMIN_SCHEMA_OUTPUT_FILE, path.join(__dirname, 'client-schema.ts')],
+                    documents: CLIENT_QUERY_FILES,
+                    plugins: clientPlugins,
+                    config: {
+                        ...config,
+                        skipTypeNameForRoot: true,
+                    },
+                },
+                [path.join(
+                    __dirname,
+                    '../../packages/admin-ui/src/lib/core/src/common/introspection-result.ts',
+                )]: {
+                    schema: [ADMIN_SCHEMA_OUTPUT_FILE, path.join(__dirname, 'client-schema.ts')],
+                    documents: CLIENT_QUERY_FILES,
+                    plugins: [disableTsLintPlugin, 'fragment-matcher'],
+                    config,
+                },
                 [path.join(__dirname, '../../packages/common/src/generated-types.ts')]: {
                     schema: [ADMIN_SCHEMA_OUTPUT_FILE],
                     plugins: commonPlugins,

+ 4 - 4
scripts/codegen/plugins/graphql-errors-plugin.ts

@@ -56,8 +56,8 @@ const errorsVisitor: Visitor<any> = {
         return [
             `export class ${ERROR_INTERFACE_NAME} {`,
             `  readonly __typename: string;`,
-            `  readonly code: string;`,
-            ...node.fields.filter(f => !(f as any).includes('code:')).map(f => `${f};`),
+            `  readonly errorCode: string;`,
+            ...node.fields.filter(f => !(f as any).includes('errorCode:')).map(f => `${f};`),
             `}`,
         ].join('\n');
     },
@@ -78,11 +78,11 @@ const errorsVisitor: Visitor<any> = {
             // We cast this to "any" otherwise we need to specify it as type "ErrorCode",
             // which means shared ErrorResult classes e.g. OrderStateTransitionError
             // will not be compatible between the admin and shop variations.
-            `  readonly code = '${camelToUpperSnakeCase(node.name.value)}' as any;`,
+            `  readonly errorCode = '${camelToUpperSnakeCase(node.name.value)}' as any;`,
             `  readonly message = '${camelToUpperSnakeCase(node.name.value)}';`,
             `  constructor(`,
             ...node.fields
-                .filter(f => !(f as any).includes('code:') && !(f as any).includes('message:'))
+                .filter(f => !(f as any).includes('errorCode:') && !(f as any).includes('message:'))
                 .map(f => `    public ${f},`),
             `  ) {`,
             `    super();`,

Неке датотеке нису приказане због велике количине промена