Explorar o código

refactor: Configure shared path alias, move codegen into shared

Also remove the TypeScript LanguageCode enum since it is generated based on the gql schema, therefore redundant. The plan is to move as much as possible into codegen and therefore reduce maintenance of things like DTO interfaces and reduce duplication in the mock data script etc.
Michael Bromley %!s(int64=7) %!d(string=hai) anos
pai
achega
cd2b01c7ce
Modificáronse 65 ficheiros con 2771 adicións e 416 borrados
  1. 0 2
      admin-ui/package.json
  2. 2 2
      admin-ui/src/app/app.config.ts
  3. 1 1
      admin-ui/src/app/catalog/components/apply-facet-dialog/apply-facet-dialog.component.ts
  4. 1 1
      admin-ui/src/app/catalog/components/create-option-group-dialog/create-option-group-dialog.component.ts
  5. 5 5
      admin-ui/src/app/catalog/components/create-option-group-form/create-option-group-form.component.ts
  6. 7 7
      admin-ui/src/app/catalog/components/facet-detail/facet-detail.component.ts
  7. 1 1
      admin-ui/src/app/catalog/components/facet-list/facet-list.component.ts
  8. 1 1
      admin-ui/src/app/catalog/components/facet-value-selector/facet-value-selector.component.ts
  9. 1 1
      admin-ui/src/app/catalog/components/generate-product-variants/generate-product-variants.component.ts
  10. 7 7
      admin-ui/src/app/catalog/components/product-detail/product-detail.component.ts
  11. 1 1
      admin-ui/src/app/catalog/components/product-list/product-list.component.ts
  12. 1 1
      admin-ui/src/app/catalog/components/product-variants-list/product-variants-list.component.ts
  13. 1 1
      admin-ui/src/app/catalog/components/product-variants-wizard/product-variants-wizard.component.ts
  14. 1 4
      admin-ui/src/app/catalog/components/select-option-group-dialog/select-option-group-dialog.component.ts
  15. 4 4
      admin-ui/src/app/catalog/components/select-option-group/select-option-group.component.ts
  16. 1 1
      admin-ui/src/app/catalog/providers/routing/facet-resolver.ts
  17. 1 1
      admin-ui/src/app/catalog/providers/routing/product-resolver.ts
  18. 2 1
      admin-ui/src/app/common/utilities/create-updated-translatable.spec.ts
  19. 2 1
      admin-ui/src/app/common/utilities/create-updated-translatable.ts
  20. 2 1
      admin-ui/src/app/common/utilities/get-default-language.ts
  21. 1 1
      admin-ui/src/app/core/components/ui-language-switcher/ui-language-switcher.component.ts
  22. 1 1
      admin-ui/src/app/core/providers/auth/auth.service.ts
  23. 2 1
      admin-ui/src/app/core/providers/i18n/i18n.service.mock.ts
  24. 1 1
      admin-ui/src/app/core/providers/i18n/i18n.service.ts
  25. 2 1
      admin-ui/src/app/data/client-state/client-defaults.ts
  26. 3 3
      admin-ui/src/app/data/client-state/client-resolvers.ts
  27. 10 10
      admin-ui/src/app/data/providers/client-data.service.ts
  28. 12 12
      admin-ui/src/app/data/providers/facet-data.service.ts
  29. 20 20
      admin-ui/src/app/data/providers/product-data.service.ts
  30. 1 1
      admin-ui/src/app/shared/components/language-selector/language-selector.component.ts
  31. 5 1
      admin-ui/tsconfig.json
  32. 10 6
      generate-graphql-types.ts
  33. 7 1
      package.json
  34. 12 0
      server/mock-data/gql-request.ts
  35. 44 36
      server/mock-data/mock-data-client.service.ts
  36. 2 2
      server/mock-data/populate.ts
  37. 1 1
      server/nodemon-debug.json
  38. 5 1
      server/package.json
  39. 2 2
      server/src/common/constants.ts
  40. 0 3
      server/src/config/merge-config.spec.ts
  41. 2 2
      server/src/config/vendure-config.ts
  42. 1 1
      server/src/entity/facet-value/facet-value-translation.entity.ts
  43. 1 1
      server/src/entity/facet/facet-translation.entity.ts
  44. 1 1
      server/src/entity/product-option-group/product-option-group-translation.entity.ts
  45. 1 1
      server/src/entity/product-option/product-option-translation.entity.ts
  46. 1 1
      server/src/entity/product-variant/product-variant-translation.entity.ts
  47. 1 1
      server/src/entity/product/product-translation.entity.ts
  48. 0 189
      server/src/locale/language-code.ts
  49. 2 1
      server/src/locale/locale-types.ts
  50. 23 22
      server/src/locale/translate-entity.spec.ts
  51. 2 1
      server/src/locale/translate-entity.ts
  52. 10 9
      server/src/locale/translation-updater.spec.ts
  53. 1 1
      server/src/service/config.service.ts
  54. 1 1
      server/src/service/facet-value.service.ts
  55. 1 1
      server/src/service/facet.service.ts
  56. 1 1
      server/src/service/product-option-group.service.ts
  57. 1 1
      server/src/service/product-option.service.ts
  58. 11 11
      server/src/service/product-variant.service.spec.ts
  59. 16 16
      server/src/service/product.service.spec.ts
  60. 1 1
      server/src/service/product.service.ts
  61. 5 2
      server/tsconfig.json
  62. 4 0
      server/yarn.lock
  63. 1651 0
      shared/generated-types.ts
  64. 15 0
      tsconfig.json
  65. 835 3
      yarn.lock

+ 0 - 2
admin-ui/package.json

@@ -8,8 +8,6 @@
     "test": "ng test",
     "lint": "tslint --fix",
     "e2e": "ng e2e",
-    "apollo": "apollo",
-    "generate-gql-types": "ts-node generate-graphql-types.ts",
     "extract-translations": "ngx-translate-extract --input ./src --output ./src/i18n-messages/en.json --clean --sort --format namespaced-json --format-indentation \"  \" -m _"
   },
   "private": true,

+ 2 - 2
admin-ui/src/app/app.config.ts

@@ -1,6 +1,6 @@
-import { API_PORT } from '../../../shared/shared-constants';
+import { LanguageCode } from 'shared/generated-types';
 
-import { LanguageCode } from './data/types/gql-generated-types';
+import { API_PORT } from '../../../shared/shared-constants';
 
 export const API_URL = `http://localhost:${API_PORT}`;
 export const DEFAULT_LANGUAGE: LanguageCode = LanguageCode.en;

+ 1 - 1
admin-ui/src/app/catalog/components/apply-facet-dialog/apply-facet-dialog.component.ts

@@ -1,6 +1,6 @@
 import { ChangeDetectionStrategy, Component } from '@angular/core';
+import { FacetValue, ProductOptionGroup } from 'shared/generated-types';
 
-import { FacetValue, ProductOptionGroup } from '../../../data/types/gql-generated-types';
 import { Dialog } from '../../../shared/providers/modal/modal.service';
 
 @Component({

+ 1 - 1
admin-ui/src/app/catalog/components/create-option-group-dialog/create-option-group-dialog.component.ts

@@ -1,6 +1,6 @@
 import { ChangeDetectionStrategy, Component, ViewChild } from '@angular/core';
+import { CreateProductOptionGroup } from 'shared/generated-types';
 
-import { CreateProductOptionGroup } from '../../../data/types/gql-generated-types';
 import { Dialog } from '../../../shared/providers/modal/modal.service';
 import { CreateOptionGroupFormComponent } from '../create-option-group-form/create-option-group-form.component';
 

+ 5 - 5
admin-ui/src/app/catalog/components/create-option-group-form/create-option-group-form.component.ts

@@ -1,15 +1,15 @@
 import { Component, Input, OnInit } from '@angular/core';
 import { FormBuilder, FormGroup } from '@angular/forms';
 import { Observable } from 'rxjs';
-
-import { getDefaultLanguage } from '../../../common/utilities/get-default-language';
-import { normalizeString } from '../../../common/utilities/normalize-string';
-import { DataService } from '../../../data/providers/data.service';
 import {
     CreateProductOptionGroup,
     CreateProductOptionGroupInput,
     CreateProductOptionInput,
-} from '../../../data/types/gql-generated-types';
+} from 'shared/generated-types';
+
+import { getDefaultLanguage } from '../../../common/utilities/get-default-language';
+import { normalizeString } from '../../../common/utilities/normalize-string';
+import { DataService } from '../../../data/providers/data.service';
 
 @Component({
     selector: 'vdr-create-option-group-form',

+ 7 - 7
admin-ui/src/app/catalog/components/facet-detail/facet-detail.component.ts

@@ -3,6 +3,13 @@ import { FormArray, FormBuilder, FormControl, FormGroup, Validators } from '@ang
 import { ActivatedRoute, Router } from '@angular/router';
 import { combineLatest, forkJoin, Observable, Subject } from 'rxjs';
 import { map, mergeMap, switchMap, take, takeUntil } from 'rxjs/operators';
+import {
+    CreateFacetValueInput,
+    FacetWithValues,
+    FacetWithValues_values,
+    LanguageCode,
+    UpdateFacetValueInput,
+} from 'shared/generated-types';
 
 import { CustomFieldConfig } from '../../../../../../shared/shared-types';
 import { notNullOrUndefined } from '../../../../../../shared/shared-utils';
@@ -13,13 +20,6 @@ import { _ } from '../../../core/providers/i18n/mark-for-extraction';
 import { NotificationService } from '../../../core/providers/notification/notification.service';
 import { DataService } from '../../../data/providers/data.service';
 import { getServerConfig } from '../../../data/server-config';
-import {
-    CreateFacetValueInput,
-    FacetWithValues,
-    FacetWithValues_values,
-    LanguageCode,
-    UpdateFacetValueInput,
-} from '../../../data/types/gql-generated-types';
 
 @Component({
     selector: 'vdr-facet-detail',

+ 1 - 1
admin-ui/src/app/catalog/components/facet-list/facet-list.component.ts

@@ -2,9 +2,9 @@ import { Component, OnDestroy, OnInit } from '@angular/core';
 import { ActivatedRoute, Router } from '@angular/router';
 import { combineLatest, Observable, Subject } from 'rxjs';
 import { map, takeUntil } from 'rxjs/operators';
+import { GetFacetList_facets_items } from 'shared/generated-types';
 
 import { DataService } from '../../../data/providers/data.service';
-import { GetFacetList_facets_items } from '../../../data/types/gql-generated-types';
 
 @Component({
     selector: 'vdr-facet-list',

+ 1 - 1
admin-ui/src/app/catalog/components/facet-value-selector/facet-value-selector.component.ts

@@ -1,8 +1,8 @@
 import { ChangeDetectionStrategy, Component, EventEmitter, OnInit, Output } from '@angular/core';
 import { Observable } from 'rxjs';
+import { FacetValue } from 'shared/generated-types';
 
 import { DataService } from '../../../data/providers/data.service';
-import { FacetValue } from '../../../data/types/gql-generated-types';
 
 export type FacetValueSeletorItem = { name: string; facetName: string; id: string; value: FacetValue };
 

+ 1 - 1
admin-ui/src/app/catalog/components/generate-product-variants/generate-product-variants.component.ts

@@ -1,7 +1,7 @@
 import { Component, Input, ViewChild } from '@angular/core';
+import { ProductWithVariants } from 'shared/generated-types';
 
 import { DataService } from '../../../data/providers/data.service';
-import { ProductWithVariants } from '../../../data/types/gql-generated-types';
 import { ProductVariantsWizardComponent } from '../product-variants-wizard/product-variants-wizard.component';
 
 @Component({

+ 7 - 7
admin-ui/src/app/catalog/components/product-detail/product-detail.component.ts

@@ -3,6 +3,13 @@ import { FormArray, FormBuilder, FormGroup, Validators } from '@angular/forms';
 import { ActivatedRoute, Router } from '@angular/router';
 import { combineLatest, EMPTY, forkJoin, Observable, Subject } from 'rxjs';
 import { map, mergeMap, switchMap, take, takeUntil } from 'rxjs/operators';
+import {
+    LanguageCode,
+    ProductWithVariants,
+    ProductWithVariants_variants,
+    UpdateProductInput,
+    UpdateProductVariantInput,
+} from 'shared/generated-types';
 
 import { CustomFieldConfig } from '../../../../../../shared/shared-types';
 import { notNullOrUndefined } from '../../../../../../shared/shared-utils';
@@ -13,13 +20,6 @@ import { _ } from '../../../core/providers/i18n/mark-for-extraction';
 import { NotificationService } from '../../../core/providers/notification/notification.service';
 import { DataService } from '../../../data/providers/data.service';
 import { getServerConfig } from '../../../data/server-config';
-import {
-    LanguageCode,
-    ProductWithVariants,
-    ProductWithVariants_variants,
-    UpdateProductInput,
-    UpdateProductVariantInput,
-} from '../../../data/types/gql-generated-types';
 import { ModalService } from '../../../shared/providers/modal/modal.service';
 import { ApplyFacetDialogComponent } from '../apply-facet-dialog/apply-facet-dialog.component';
 

+ 1 - 1
admin-ui/src/app/catalog/components/product-list/product-list.component.ts

@@ -2,9 +2,9 @@ import { Component, OnDestroy, OnInit } from '@angular/core';
 import { ActivatedRoute, Router } from '@angular/router';
 import { combineLatest, Observable, Subject } from 'rxjs';
 import { map, takeUntil } from 'rxjs/operators';
+import { GetProductList_products_items } from 'shared/generated-types';
 
 import { DataService } from '../../../data/providers/data.service';
-import { GetProductList_products_items } from '../../../data/types/gql-generated-types';
 
 @Component({
     selector: 'vdr-products-list',

+ 1 - 1
admin-ui/src/app/catalog/components/product-variants-list/product-variants-list.component.ts

@@ -1,7 +1,7 @@
 import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
 import { FormArray } from '@angular/forms';
 
-import { ProductWithVariants_variants } from '../../../data/types/gql-generated-types';
+import { ProductWithVariants_variants } from 'shared/generated-types';
 
 @Component({
     selector: 'vdr-product-variants-list',

+ 1 - 1
admin-ui/src/app/catalog/components/product-variants-wizard/product-variants-wizard.component.ts

@@ -2,12 +2,12 @@ import { Component, Input, OnChanges, ViewChild } from '@angular/core';
 import { ClrWizard } from '@clr/angular';
 import { forkJoin, Observable } from 'rxjs';
 import { map, mergeMap, take, takeUntil } from 'rxjs/operators';
+import { ProductOptionGroup, ProductWithVariants } from 'shared/generated-types';
 
 import { generateAllCombinations } from '../../../../../../shared/shared-utils';
 import { _ } from '../../../core/providers/i18n/mark-for-extraction';
 import { NotificationService } from '../../../core/providers/notification/notification.service';
 import { DataService } from '../../../data/providers/data.service';
-import { ProductOptionGroup, ProductWithVariants } from '../../../data/types/gql-generated-types';
 import { CreateOptionGroupFormComponent } from '../create-option-group-form/create-option-group-form.component';
 import { SelectOptionGroupComponent } from '../select-option-group/select-option-group.component';
 

+ 1 - 4
admin-ui/src/app/catalog/components/select-option-group-dialog/select-option-group-dialog.component.ts

@@ -1,9 +1,6 @@
 import { ChangeDetectionStrategy, Component } from '@angular/core';
+import { GetProductOptionGroups_productOptionGroups, ProductOptionGroup } from 'shared/generated-types';
 
-import {
-    GetProductOptionGroups_productOptionGroups,
-    ProductOptionGroup,
-} from '../../../data/types/gql-generated-types';
 import { Dialog } from '../../../shared/providers/modal/modal.service';
 
 @Component({

+ 4 - 4
admin-ui/src/app/catalog/components/select-option-group/select-option-group.component.ts

@@ -11,14 +11,14 @@ import {
 import { FormControl } from '@angular/forms';
 import { Observable, Subject } from 'rxjs';
 import { debounceTime, map, takeUntil } from 'rxjs/operators';
-
-import { DeepPartial } from '../../../../../../shared/shared-types';
-import { DataService } from '../../../data/providers/data.service';
 import {
     GetProductOptionGroups,
     GetProductOptionGroupsVariables,
     ProductOptionGroup,
-} from '../../../data/types/gql-generated-types';
+} from 'shared/generated-types';
+
+import { DeepPartial } from '../../../../../../shared/shared-types';
+import { DataService } from '../../../data/providers/data.service';
 import { QueryResult } from '../../../data/types/query-result';
 
 @Component({

+ 1 - 1
admin-ui/src/app/catalog/providers/routing/facet-resolver.ts

@@ -2,11 +2,11 @@ import { Injectable } from '@angular/core';
 import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot } from '@angular/router';
 import { Observable, of } from 'rxjs';
 import { filter, map, take } from 'rxjs/operators';
+import { FacetWithValues } from 'shared/generated-types';
 
 import { notNullOrUndefined } from '../../../../../../shared/shared-utils';
 import { getDefaultLanguage } from '../../../common/utilities/get-default-language';
 import { DataService } from '../../../data/providers/data.service';
-import { FacetWithValues } from '../../../data/types/gql-generated-types';
 
 /**
  * Resolves the id from the path into a Customer entity.

+ 1 - 1
admin-ui/src/app/catalog/providers/routing/product-resolver.ts

@@ -2,11 +2,11 @@ import { Injectable } from '@angular/core';
 import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot } from '@angular/router';
 import { Observable, of } from 'rxjs';
 import { filter, map, take } from 'rxjs/operators';
+import { ProductWithVariants } from 'shared/generated-types';
 
 import { notNullOrUndefined } from '../../../../../../shared/shared-utils';
 import { getDefaultLanguage } from '../../../common/utilities/get-default-language';
 import { DataService } from '../../../data/providers/data.service';
-import { ProductWithVariants } from '../../../data/types/gql-generated-types';
 
 /**
  * Resolves the id from the path into a Customer entity.

+ 2 - 1
admin-ui/src/app/common/utilities/create-updated-translatable.spec.ts

@@ -1,5 +1,6 @@
+import { LanguageCode, ProductWithVariants } from 'shared/generated-types';
+
 import { CustomFieldConfig } from '../../../../../shared/shared-types';
-import { LanguageCode, ProductWithVariants } from '../../data/types/gql-generated-types';
 
 import { createUpdatedTranslatable } from './create-updated-translatable';
 

+ 2 - 1
admin-ui/src/app/common/utilities/create-updated-translatable.ts

@@ -1,9 +1,10 @@
+import { LanguageCode } from 'shared/generated-types';
+
 import {
     CustomFieldConfig,
     CustomFieldsObject,
     MayHaveCustomFields,
 } from '../../../../../shared/shared-types';
-import { LanguageCode } from '../../data/types/gql-generated-types';
 
 /**
  * When updating an entity which has translations, the value from the form will pertain to the current

+ 2 - 1
admin-ui/src/app/common/utilities/get-default-language.ts

@@ -1,5 +1,6 @@
+import { LanguageCode } from 'shared/generated-types';
+
 import { DEFAULT_LANGUAGE } from '../../app.config';
-import { LanguageCode } from '../../data/types/gql-generated-types';
 
 export function getDefaultLanguage(): LanguageCode {
     return DEFAULT_LANGUAGE;

+ 1 - 1
admin-ui/src/app/core/components/ui-language-switcher/ui-language-switcher.component.ts

@@ -1,9 +1,9 @@
 import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
 import { Observable } from 'rxjs';
 import { map, tap } from 'rxjs/operators';
+import { LanguageCode } from 'shared/generated-types';
 
 import { DataService } from '../../../data/providers/data.service';
-import { LanguageCode } from '../../../data/types/gql-generated-types';
 import { I18nService } from '../../providers/i18n/i18n.service';
 
 @Component({

+ 1 - 1
admin-ui/src/app/core/providers/auth/auth.service.ts

@@ -1,9 +1,9 @@
 import { Injectable } from '@angular/core';
 import { Observable, of } from 'rxjs';
 import { catchError, map, mergeMap, switchMap } from 'rxjs/operators';
+import { LogIn } from 'shared/generated-types';
 
 import { DataService } from '../../../data/providers/data.service';
-import { LogIn } from '../../../data/types/gql-generated-types';
 import { LocalStorageService } from '../local-storage/local-storage.service';
 
 /**

+ 2 - 1
admin-ui/src/app/core/providers/i18n/i18n.service.mock.ts

@@ -1,5 +1,6 @@
+import { LanguageCode } from 'shared/generated-types';
+
 import { MockOf } from '../../../../testing/testing-types';
-import { LanguageCode } from '../../../data/types/gql-generated-types';
 
 import { I18nService } from './i18n.service';
 

+ 1 - 1
admin-ui/src/app/core/providers/i18n/i18n.service.ts

@@ -1,8 +1,8 @@
 import { Injectable } from '@angular/core';
 import { TranslateService } from '@ngx-translate/core';
+import { LanguageCode } from 'shared/generated-types';
 
 import { getDefaultLanguage } from '../../../common/utilities/get-default-language';
-import { LanguageCode } from '../../../data/types/gql-generated-types';
 
 @Injectable()
 export class I18nService {

+ 2 - 1
admin-ui/src/app/data/client-state/client-defaults.ts

@@ -1,5 +1,6 @@
+import { GetNetworkStatus, GetUiState, GetUserStatus, LanguageCode } from 'shared/generated-types';
+
 import { getDefaultLanguage } from '../../common/utilities/get-default-language';
-import { GetNetworkStatus, GetUiState, GetUserStatus, LanguageCode } from '../types/gql-generated-types';
 
 export const clientDefaults: GetNetworkStatus & GetUserStatus & GetUiState = {
     networkStatus: {

+ 3 - 3
admin-ui/src/app/data/client-state/client-resolvers.ts

@@ -1,7 +1,5 @@
 import { InMemoryCache } from 'apollo-cache-inmemory';
 import { GraphQLFieldResolver } from 'graphql';
-
-import { GET_NEWTORK_STATUS } from '../queries/local-queries';
 import {
     GetNetworkStatus,
     GetUiState,
@@ -10,7 +8,9 @@ import {
     LanguageCode,
     LogInVariables,
     SetUiLanguageVariables,
-} from '../types/gql-generated-types';
+} from 'shared/generated-types';
+
+import { GET_NEWTORK_STATUS } from '../queries/local-queries';
 
 export type ResolverContext = {
     cache: InMemoryCache;

+ 10 - 10
admin-ui/src/app/data/providers/client-data.service.ts

@@ -1,13 +1,4 @@
 import { Observable } from 'rxjs';
-
-import {
-    LOG_IN,
-    LOG_OUT,
-    REQUEST_COMPLETED,
-    REQUEST_STARTED,
-    SET_UI_LANGUAGE,
-} from '../mutations/local-mutations';
-import { GET_NEWTORK_STATUS, GET_UI_STATE, GET_USER_STATUS } from '../queries/local-queries';
 import {
     GetNetworkStatus,
     GetUiState,
@@ -20,7 +11,16 @@ import {
     RequestStarted,
     SetUiLanguage,
     SetUiLanguageVariables,
-} from '../types/gql-generated-types';
+} from 'shared/generated-types';
+
+import {
+    LOG_IN,
+    LOG_OUT,
+    REQUEST_COMPLETED,
+    REQUEST_STARTED,
+    SET_UI_LANGUAGE,
+} from '../mutations/local-mutations';
+import { GET_NEWTORK_STATUS, GET_UI_STATE, GET_USER_STATUS } from '../queries/local-queries';
 import { QueryResult } from '../types/query-result';
 
 import { BaseDataService } from './base-data.service';

+ 12 - 12
admin-ui/src/app/data/providers/facet-data.service.ts

@@ -1,15 +1,4 @@
 import { Observable } from 'rxjs';
-
-import { getDefaultLanguage } from '../../common/utilities/get-default-language';
-import { pick } from '../../common/utilities/pick';
-import { addCustomFields } from '../add-custom-fields';
-import {
-    CREATE_FACET,
-    CREATE_FACET_VALUES,
-    UPDATE_FACET,
-    UPDATE_FACET_VALUES,
-} from '../mutations/facet-mutations';
-import { GET_FACET_LIST, GET_FACET_WITH_VALUES } from '../queries/facet-queries';
 import {
     CreateFacet,
     CreateFacetInput,
@@ -27,7 +16,18 @@ import {
     UpdateFacetValues,
     UpdateFacetValuesVariables,
     UpdateFacetVariables,
-} from '../types/gql-generated-types';
+} from 'shared/generated-types';
+
+import { getDefaultLanguage } from '../../common/utilities/get-default-language';
+import { pick } from '../../common/utilities/pick';
+import { addCustomFields } from '../add-custom-fields';
+import {
+    CREATE_FACET,
+    CREATE_FACET_VALUES,
+    UPDATE_FACET,
+    UPDATE_FACET_VALUES,
+} from '../mutations/facet-mutations';
+import { GET_FACET_LIST, GET_FACET_WITH_VALUES } from '../queries/facet-queries';
 import { QueryResult } from '../types/query-result';
 
 import { BaseDataService } from './base-data.service';

+ 20 - 20
admin-ui/src/app/data/providers/product-data.service.ts

@@ -1,23 +1,4 @@
 import { Observable } from 'rxjs';
-
-import { getDefaultLanguage } from '../../common/utilities/get-default-language';
-import { pick } from '../../common/utilities/pick';
-import { addCustomFields } from '../add-custom-fields';
-import {
-    ADD_OPTION_GROUP_TO_PRODUCT,
-    APPLY_FACET_VALUE_TO_PRODUCT_VARIANTS,
-    CREATE_PRODUCT,
-    CREATE_PRODUCT_OPTION_GROUP,
-    GENERATE_PRODUCT_VARIANTS,
-    REMOVE_OPTION_GROUP_FROM_PRODUCT,
-    UPDATE_PRODUCT,
-    UPDATE_PRODUCT_VARIANTS,
-} from '../mutations/product-mutations';
-import {
-    GET_PRODUCT_LIST,
-    GET_PRODUCT_OPTION_GROUPS,
-    GET_PRODUCT_WITH_VARIANTS,
-} from '../queries/product-queries';
 import {
     AddOptionGroupToProduct,
     AddOptionGroupToProductVariables,
@@ -45,7 +26,26 @@ import {
     UpdateProductVariantInput,
     UpdateProductVariants,
     UpdateProductVariantsVariables,
-} from '../types/gql-generated-types';
+} from 'shared/generated-types';
+
+import { getDefaultLanguage } from '../../common/utilities/get-default-language';
+import { pick } from '../../common/utilities/pick';
+import { addCustomFields } from '../add-custom-fields';
+import {
+    ADD_OPTION_GROUP_TO_PRODUCT,
+    APPLY_FACET_VALUE_TO_PRODUCT_VARIANTS,
+    CREATE_PRODUCT,
+    CREATE_PRODUCT_OPTION_GROUP,
+    GENERATE_PRODUCT_VARIANTS,
+    REMOVE_OPTION_GROUP_FROM_PRODUCT,
+    UPDATE_PRODUCT,
+    UPDATE_PRODUCT_VARIANTS,
+} from '../mutations/product-mutations';
+import {
+    GET_PRODUCT_LIST,
+    GET_PRODUCT_OPTION_GROUPS,
+    GET_PRODUCT_WITH_VARIANTS,
+} from '../queries/product-queries';
 import { QueryResult } from '../types/query-result';
 
 import { BaseDataService } from './base-data.service';

+ 1 - 1
admin-ui/src/app/shared/components/language-selector/language-selector.component.ts

@@ -1,6 +1,6 @@
 import { Component, EventEmitter, Input, Output } from '@angular/core';
 
-import { LanguageCode } from '../../../data/types/gql-generated-types';
+import { LanguageCode } from 'shared/generated-types';
 
 @Component({
     selector: 'vdr-language-selector',

+ 5 - 1
admin-ui/tsconfig.json

@@ -9,6 +9,7 @@
     "emitDecoratorMetadata": true,
     "experimentalDecorators": true,
     "strict": true,
+    "noImplicitAny": false,
     "strictPropertyInitialization": false,
     "target": "es5",
     "skipLibCheck": true,
@@ -20,6 +21,9 @@
       "es2017",
       "dom",
       "esnext.asynciterable"
-    ]
+    ],
+    "paths": {
+      "shared/*": ["../shared/*"]
+    }
   }
 }

+ 10 - 6
admin-ui/generate-graphql-types.ts → generate-graphql-types.ts

@@ -1,14 +1,14 @@
 import { spawn } from 'child_process';
 import * as fs from 'fs';
 
-import { API_PATH, API_PORT } from '../shared/shared-constants';
+import { API_PATH, API_PORT } from './shared/shared-constants';
 
 // tslint:disable:no-console
 const API_URL = `http://localhost:${API_PORT}/${API_PATH}`;
-const SCHEMA_JSON_FILE = '../schema.json';
-const CLIENT_SCHEMA_FILES = './src/app/data/types/client-types.graphql';
-const CLIENT_QUERY_FILES = '"./src/app/data/{queries,mutations,fragments}/**/*.ts"';
-const TYPESCRIPT_DEFINITIONS_FILE = './src/app/data/types/gql-generated-types.ts';
+const SCHEMA_JSON_FILE = './schema.json';
+const CLIENT_SCHEMA_FILES = './admin-ui/src/app/data/types/client-types.graphql';
+const CLIENT_QUERY_FILES = '"./admin-ui/src/app/data/{queries,mutations,fragments}/**/*.ts"';
+const TYPESCRIPT_DEFINITIONS_FILE = './shared/generated-types.ts';
 
 main().catch(e => {
     console.log('Could not generate types!', e);
@@ -21,7 +21,11 @@ main().catch(e => {
  * script "generate-gql-types".
  */
 async function main(): Promise<void> {
-    await downloadSchemaFromApi(API_URL, SCHEMA_JSON_FILE);
+    try {
+        await downloadSchemaFromApi(API_URL, SCHEMA_JSON_FILE);
+    } catch {
+        console.log('Could not connect to Vendure server. Attempting to build typed from existing schema.json');
+    }
     await generateTypeScriptTypesFromSchema(
         SCHEMA_JSON_FILE,
         CLIENT_SCHEMA_FILES,

+ 7 - 1
package.json

@@ -2,6 +2,8 @@
   "name": "vendure",
   "version": "0.1.0",
   "scripts": {
+    "apollo": "apollo",
+    "generate-gql-types": "ts-node generate-graphql-types.ts",
     "postinstall": "cd admin-ui && yarn && cd ../server && yarn",
     "test": "cd admin-ui && yarn test --watch=false --browsers=ChromeHeadlessCI --progress=false && cd ../server && yarn test",
     "format": "prettier --write",
@@ -12,8 +14,12 @@
     "prepush": "yarn test && cd admin-ui && yarn build --prod"
   },
   "devDependencies": {
+    "apollo": "^1.7.1",
     "husky": "^0.14.3",
     "lint-staged": "^7.2.0",
-    "prettier": "^1.13.7"
+    "prettier": "^1.13.7",
+    "ts-node": "^7.0.1",
+    "tslint": "^5.11.0",
+    "typescript": "2.9.1"
   }
 }

+ 12 - 0
server/mock-data/gql-request.ts

@@ -0,0 +1,12 @@
+import { DocumentNode } from 'graphql';
+import { request } from 'graphql-request';
+import { print } from 'graphql/language/printer';
+
+export class SimpleGraphQLClient {
+    constructor(private apiUrl: string) {}
+
+    request<T, V = Record<string, any>>(query: DocumentNode, variables: V): Promise<T> {
+        const queryString = print(query);
+        return request(this.apiUrl, queryString, variables);
+    }
+}

+ 44 - 36
server/mock-data/mock-data-client.service.ts

@@ -1,6 +1,13 @@
 import * as faker from 'faker/locale/en_GB';
 import { request } from 'graphql-request';
-
+import {
+    CreateProductOptionGroup,
+    CreateProductOptionGroupInput,
+    CreateProductOptionGroupVariables,
+} from 'shared/generated-types';
+import { LanguageCode } from 'shared/generated-types';
+
+import { CREATE_PRODUCT_OPTION_GROUP } from '../../admin-ui/src/app/data/mutations/product-mutations';
 import { ID } from '../../shared/shared-types';
 import { PasswordService } from '../src/auth/password.service';
 import { VendureConfig } from '../src/config/vendure-config';
@@ -8,59 +15,60 @@ import { CreateAddressDto } from '../src/entity/address/address.dto';
 import { CreateAdministratorDto } from '../src/entity/administrator/administrator.dto';
 import { CreateCustomerDto } from '../src/entity/customer/customer.dto';
 import { Customer } from '../src/entity/customer/customer.entity';
-import { CreateProductOptionGroupDto } from '../src/entity/product-option-group/product-option-group.dto';
 import { CreateProductDto } from '../src/entity/product/product.dto';
 import { Product } from '../src/entity/product/product.entity';
-import { LanguageCode } from '../src/locale/language-code';
 import { TranslationInput } from '../src/locale/locale-types';
 
+import { SimpleGraphQLClient } from './gql-request';
+
 // tslint:disable:no-console
 /**
  * A service for creating mock data via the GraphQL API.
  */
 export class MockDataClientService {
     apiUrl: string;
+    client: SimpleGraphQLClient;
 
     constructor(config: VendureConfig) {
-        this.apiUrl = `http://localhost:${config.port}/${config.apiPath}`;
+        this.client = new SimpleGraphQLClient(`http://localhost:${config.port}/${config.apiPath}`);
         // make the generated results deterministic
         faker.seed(1);
     }
 
     async populateOptions(): Promise<any> {
-        const query = `mutation($input: CreateProductOptionGroupInput) {
-                            createProductOptionGroup(input: $input) { id }
-                       }`;
-
-        const variables = {
-            input: {
-                code: 'size',
-                translations: [{ languageCode: 'en', name: 'Size' }, { languageCode: 'de', name: 'Größe' }],
-                options: [
-                    {
-                        code: 'small',
+        await this.client
+            .request<CreateProductOptionGroup, CreateProductOptionGroupVariables>(
+                CREATE_PRODUCT_OPTION_GROUP,
+                {
+                    input: {
+                        code: 'size',
                         translations: [
-                            { languageCode: 'en', name: 'Small' },
-                            { languageCode: 'de', name: 'Klein' },
+                            { languageCode: LanguageCode.en, name: 'Size' },
+                            { languageCode: LanguageCode.de, name: 'Größe' },
                         ],
-                    },
-                    {
-                        code: 'large',
-                        translations: [
-                            { languageCode: 'en', name: 'Large' },
-                            { languageCode: 'de', name: 'Groß' },
+                        options: [
+                            {
+                                code: 'small',
+                                translations: [
+                                    { languageCode: LanguageCode.en, name: 'Small' },
+                                    { languageCode: LanguageCode.de, name: 'Klein' },
+                                ],
+                            },
+                            {
+                                code: 'large',
+                                translations: [
+                                    { languageCode: LanguageCode.en, name: 'Large' },
+                                    { languageCode: LanguageCode.de, name: 'Groß' },
+                                ],
+                            },
                         ],
                     },
-                ],
-            } as CreateProductOptionGroupDto,
-        };
-
-        await request(this.apiUrl, query, variables).then(
-            data => console.log('Created Administrator:', data),
-            err => console.log(err),
-        );
-
-        console.log('created size options');
+                },
+            )
+            .then(
+                data => console.log('Created option group:', data.createProductOptionGroup.name),
+                err => console.log(err),
+            );
     }
 
     async populateAdmins(): Promise<any> {
@@ -149,7 +157,7 @@ export class MockDataClientService {
             const name = faker.commerce.productName();
             const slug = name.toLowerCase().replace(/\s+/g, '-');
             const description = faker.lorem.sentence();
-            const languageCodes = [LanguageCode.EN, LanguageCode.DE];
+            const languageCodes = [LanguageCode.en, LanguageCode.de];
 
             const variables = {
                 input: {
@@ -173,8 +181,8 @@ export class MockDataClientService {
             for (const variant of variants) {
                 const variantEN = variant.translations[0];
                 const variantDE = { ...variantEN };
-                variantDE.languageCode = LanguageCode.DE;
-                variantDE.name = variantDE.name.replace(LanguageCode.EN, LanguageCode.DE);
+                variantDE.languageCode = LanguageCode.de;
+                variantDE.name = variantDE.name.replace(LanguageCode.en, LanguageCode.de);
                 variantDE.id = undefined;
                 variant.translations.push(variantDE);
             }

+ 2 - 2
server/mock-data/populate.ts

@@ -22,8 +22,8 @@ async function populate() {
 
     const mockDataClientService = new MockDataClientService(devConfig);
     await mockDataClientService.populateOptions();
-    await mockDataClientService.populateProducts(200);
-    await mockDataClientService.populateCustomers(100);
+    await mockDataClientService.populateProducts(5);
+    await mockDataClientService.populateCustomers(5);
     await mockDataClientService.populateAdmins();
 }
 

+ 1 - 1
server/nodemon-debug.json

@@ -2,5 +2,5 @@
   "watch": ["src", "index-dev.ts"],
   "ext": "ts",
   "ignore": ["src/**/*.spec.ts", "mock-data/**/*"],
-  "exec": "node --inspect=5858 -r ts-node/register index-dev.ts"
+  "exec": "node --inspect=5858 -r ts-node/register -r tsconfig-paths/register index-dev.ts"
 }

+ 5 - 1
server/package.json

@@ -1,4 +1,4 @@
-{
+ {
   "name": "vendure",
   "version": "0.0.0",
   "description": "A modern, headless ecommerce framework",
@@ -31,6 +31,7 @@
     "body-parser": "^1.18.3",
     "graphql": "^14.0.0-rc.2",
     "graphql-iso-date": "^3.5.0",
+    "graphql-tag": "^2.9.2",
     "graphql-tools": "^3.1.1",
     "graphql-type-json": "^0.2.1",
     "i18next": "^11.6.0",
@@ -74,6 +75,9 @@
       "json",
       "ts"
     ],
+    "moduleNameMapper": {
+      "shared/(.*)": "<rootDir>/../shared/$1.ts"
+    },
     "roots": [
       "src",
       "../shared"

+ 2 - 2
server/src/common/constants.ts

@@ -1,3 +1,3 @@
-import { LanguageCode } from '../locale/language-code';
+import { LanguageCode } from 'shared/generated-types';
 
-export const DEFAULT_LANGUAGE_CODE = LanguageCode.EN;
+export const DEFAULT_LANGUAGE_CODE = LanguageCode.en;

+ 0 - 3
server/src/config/merge-config.spec.ts

@@ -1,7 +1,4 @@
-import { LanguageCode } from '../locale/language-code';
-
 import { mergeConfig } from './merge-config';
-import { VendureConfig } from './vendure-config';
 
 describe('mergeConfig()', () => {
     it('merges top-level properties', () => {

+ 2 - 2
server/src/config/vendure-config.ts

@@ -1,9 +1,9 @@
 import { CorsOptions } from '@nestjs/common/interfaces/external/cors-options.interface';
+import { LanguageCode } from 'shared/generated-types';
 import { ConnectionOptions } from 'typeorm';
 
 import { CustomFields, DeepPartial } from '../../../shared/shared-types';
 import { ReadOnlyRequired } from '../common/common-types';
-import { LanguageCode } from '../locale/language-code';
 
 import { AutoIncrementIdStrategy } from './entity-id-strategy/auto-increment-id-strategy';
 import { EntityIdStrategy } from './entity-id-strategy/entity-id-strategy';
@@ -52,7 +52,7 @@ export interface VendureConfig {
 }
 
 const defaultConfig: ReadOnlyRequired<VendureConfig> = {
-    defaultLanguageCode: LanguageCode.EN,
+    defaultLanguageCode: LanguageCode.en,
     port: 3000,
     cors: false,
     jwtSecret: 'secret',

+ 1 - 1
server/src/entity/facet-value/facet-value-translation.entity.ts

@@ -1,7 +1,7 @@
+import { LanguageCode } from 'shared/generated-types';
 import { Column, Entity, ManyToOne } from 'typeorm';
 
 import { DeepPartial } from '../../../../shared/shared-types';
-import { LanguageCode } from '../../locale/language-code';
 import { Translation } from '../../locale/locale-types';
 import { VendureEntity } from '../base/base.entity';
 import { CustomFacetValueFieldsTranslation } from '../custom-entity-fields';

+ 1 - 1
server/src/entity/facet/facet-translation.entity.ts

@@ -1,7 +1,7 @@
+import { LanguageCode } from 'shared/generated-types';
 import { Column, Entity, ManyToOne } from 'typeorm';
 
 import { DeepPartial, HasCustomFields } from '../../../../shared/shared-types';
-import { LanguageCode } from '../../locale/language-code';
 import { Translation } from '../../locale/locale-types';
 import { VendureEntity } from '../base/base.entity';
 import { CustomFacetFieldsTranslation } from '../custom-entity-fields';

+ 1 - 1
server/src/entity/product-option-group/product-option-group-translation.entity.ts

@@ -1,8 +1,8 @@
+import { LanguageCode } from 'shared/generated-types';
 import { Column, Entity, ManyToOne } from 'typeorm';
 
 import { DeepPartial } from '../../../../shared/shared-types';
 import { HasCustomFields } from '../../../../shared/shared-types';
-import { LanguageCode } from '../../locale/language-code';
 import { Translation } from '../../locale/locale-types';
 import { VendureEntity } from '../base/base.entity';
 import { CustomProductOptionGroupFieldsTranslation } from '../custom-entity-fields';

+ 1 - 1
server/src/entity/product-option/product-option-translation.entity.ts

@@ -1,8 +1,8 @@
+import { LanguageCode } from 'shared/generated-types';
 import { Column, Entity, ManyToOne } from 'typeorm';
 
 import { DeepPartial } from '../../../../shared/shared-types';
 import { HasCustomFields } from '../../../../shared/shared-types';
-import { LanguageCode } from '../../locale/language-code';
 import { Translation } from '../../locale/locale-types';
 import { VendureEntity } from '../base/base.entity';
 import { CustomProductOptionFieldsTranslation } from '../custom-entity-fields';

+ 1 - 1
server/src/entity/product-variant/product-variant-translation.entity.ts

@@ -1,8 +1,8 @@
+import { LanguageCode } from 'shared/generated-types';
 import { Column, Entity, ManyToOne } from 'typeorm';
 
 import { DeepPartial } from '../../../../shared/shared-types';
 import { HasCustomFields } from '../../../../shared/shared-types';
-import { LanguageCode } from '../../locale/language-code';
 import { Translation } from '../../locale/locale-types';
 import { VendureEntity } from '../base/base.entity';
 import { CustomProductVariantFieldsTranslation } from '../custom-entity-fields';

+ 1 - 1
server/src/entity/product/product-translation.entity.ts

@@ -1,8 +1,8 @@
+import { LanguageCode } from 'shared/generated-types';
 import { Column, Entity, ManyToOne } from 'typeorm';
 
 import { DeepPartial } from '../../../../shared/shared-types';
 import { HasCustomFields } from '../../../../shared/shared-types';
-import { LanguageCode } from '../../locale/language-code';
 import { Translation, TranslationInput } from '../../locale/locale-types';
 import { VendureEntity } from '../base/base.entity';
 import { CustomProductFieldsTranslation } from '../custom-entity-fields';

+ 0 - 189
server/src/locale/language-code.ts

@@ -1,189 +0,0 @@
-/**
- * ISO 639-1 language codes (https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes)
- */
-export enum LanguageCode {
-    AA = 'aa', // Afar
-    AB = 'ab', // Abkhazian
-    AF = 'af', // Afrikaans
-    AK = 'ak', // Akan
-    SQ = 'sq', // Albanian
-    AM = 'am', // Amharic
-    AR = 'ar', // Arabic
-    AN = 'an', // Aragonese
-    HY = 'hy', // Armenian
-    AS = 'as', // Assamese
-    AV = 'av', // Avaric
-    AE = 'ae', // Avestan
-    AY = 'ay', // Aymara
-    AZ = 'az', // Azerbaijani
-    BA = 'ba', // Bashkir
-    BM = 'bm', // Bambara
-    EU = 'eu', // Basque
-    BE = 'be', // Belarusian
-    BN = 'bn', // Bengali
-    BH = 'bh', // Bihari languages
-    BI = 'bi', // Bislama
-    BS = 'bs', // Bosnian
-    BR = 'br', // Breton
-    BG = 'bg', // Bulgarian
-    MY = 'my', // Burmese
-    CA = 'ca', // Catalan; Valencian
-    CH = 'ch', // Chamorro
-    CE = 'ce', // Chechen
-    ZH = 'zh', // Chinese
-    CU = 'cu', // Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic
-    CV = 'cv', // Chuvash
-    KW = 'kw', // Cornish
-    CO = 'co', // Corsican
-    CR = 'cr', // Cree
-    CS = 'cs', // Czech
-    DA = 'da', // Danish
-    DV = 'dv', // Divehi; Dhivehi; Maldivian
-    NL = 'nl', // Dutch; Flemish
-    DZ = 'dz', // Dzongkha
-    EN = 'en', // English
-    EO = 'eo', // Esperanto
-    ET = 'et', // Estonian
-    EE = 'ee', // Ewe
-    FO = 'fo', // Faroese
-    FJ = 'fj', // Fijian
-    FI = 'fi', // Finnish
-    FR = 'fr', // French
-    FY = 'fy', // Western Frisian
-    FF = 'ff', // Fulah
-    KA = 'ka', // Georgian
-    DE = 'de', // German
-    GD = 'gd', // Gaelic; Scottish Gaelic
-    GA = 'ga', // Irish
-    GL = 'gl', // Galician
-    GV = 'gv', // Manx
-    EL = 'el', // Greek, Modern (1453-)
-    GN = 'gn', // Guarani
-    GU = 'gu', // Gujarati
-    HT = 'ht', // Haitian; Haitian Creole
-    HA = 'ha', // Hausa
-    HE = 'he', // Hebrew
-    HZ = 'hz', // Herero
-    HI = 'hi', // Hindi
-    HO = 'ho', // Hiri Motu
-    HR = 'hr', // Croatian
-    HU = 'hu', // Hungarian
-    IG = 'ig', // Igbo
-    IS = 'is', // Icelandic
-    IO = 'io', // Ido
-    II = 'ii', // Sichuan Yi; Nuosu
-    IU = 'iu', // Inuktitut
-    IE = 'ie', // Interlingue; Occidental
-    IA = 'ia', // Interlingua (International Auxiliary Language Association)
-    ID = 'id', // Indonesian
-    IK = 'ik', // Inupiaq
-    IT = 'it', // Italian
-    JV = 'jv', // Javanese
-    JA = 'ja', // Japanese
-    KL = 'kl', // Kalaallisut; Greenlandic
-    KN = 'kn', // Kannada
-    KS = 'ks', // Kashmiri
-    KR = 'kr', // Kanuri
-    KK = 'kk', // Kazakh
-    KM = 'km', // Central Khmer
-    KI = 'ki', // Kikuyu; Gikuyu
-    RW = 'rw', // Kinyarwanda
-    KY = 'ky', // Kirghiz; Kyrgyz
-    KV = 'kv', // Komi
-    KG = 'kg', // Kongo
-    KO = 'ko', // Korean
-    KJ = 'kj', // Kuanyama; Kwanyama
-    KU = 'ku', // Kurdish
-    LO = 'lo', // Lao
-    LA = 'la', // Latin
-    LV = 'lv', // Latvian
-    LI = 'li', // Limburgan; Limburger; Limburgish
-    LN = 'ln', // Lingala
-    LT = 'lt', // Lithuanian
-    LB = 'lb', // Luxembourgish; Letzeburgesch
-    LU = 'lu', // Luba-Katanga
-    LG = 'lg', // Ganda
-    MK = 'mk', // Macedonian
-    MH = 'mh', // Marshallese
-    ML = 'ml', // Malayalam
-    MI = 'mi', // Maori
-    MR = 'mr', // Marathi
-    MS = 'ms', // Malay
-    MG = 'mg', // Malagasy
-    MT = 'mt', // Maltese
-    MN = 'mn', // Mongolian
-    NA = 'na', // Nauru
-    NV = 'nv', // Navajo; Navaho
-    NR = 'nr', // Ndebele, South; South Ndebele
-    ND = 'nd', // Ndebele, North; North Ndebele
-    NG = 'ng', // Ndonga
-    NE = 'ne', // Nepali
-    NN = 'nn', // Norwegian Nynorsk; Nynorsk, Norwegian
-    NB = 'nb', // Bokmål, Norwegian; Norwegian Bokmål
-    NO = 'no', // Norwegian
-    NY = 'ny', // Chichewa; Chewa; Nyanja
-    OC = 'oc', // Occitan (post 1500); Provençal
-    OJ = 'oj', // Ojibwa
-    OR = 'or', // Oriya
-    OM = 'om', // Oromo
-    OS = 'os', // Ossetian; Ossetic
-    PA = 'pa', // Panjabi; Punjabi
-    FA = 'fa', // Persian
-    PI = 'pi', // Pali
-    PL = 'pl', // Polish
-    PT = 'pt', // Portuguese
-    PS = 'ps', // Pushto; Pashto
-    QU = 'qu', // Quechua
-    RM = 'rm', // Romansh
-    RO = 'ro', // Romanian; Moldavian; Moldovan
-    RN = 'rn', // Rundi
-    RU = 'ru', // Russian
-    SG = 'sg', // Sango
-    SA = 'sa', // Sanskrit
-    SI = 'si', // Sinhala; Sinhalese
-    SK = 'sk', // Slovak
-    SL = 'sl', // Slovenian
-    SE = 'se', // Northern Sami
-    SM = 'sm', // Samoan
-    SN = 'sn', // Shona
-    SD = 'sd', // Sindhi
-    SO = 'so', // Somali
-    ST = 'st', // Sotho, Southern
-    ES = 'es', // Spanish; Castilian
-    SC = 'sc', // Sardinian
-    SR = 'sr', // Serbian
-    SS = 'ss', // Swati
-    SU = 'su', // Sundanese
-    SW = 'sw', // Swahili
-    SV = 'sv', // Swedish
-    TY = 'ty', // Tahitian
-    TA = 'ta', // Tamil
-    TT = 'tt', // Tatar
-    TE = 'te', // Telugu
-    TG = 'tg', // Tajik
-    TL = 'tl', // Tagalog
-    TH = 'th', // Thai
-    BO = 'bo', // Tibetan
-    TI = 'ti', // Tigrinya
-    TO = 'to', // Tonga (Tonga Islands)
-    TN = 'tn', // Tswana
-    TS = 'ts', // Tsonga
-    TK = 'tk', // Turkmen
-    TR = 'tr', // Turkish
-    TW = 'tw', // Twi
-    UG = 'ug', // Uighur; Uyghur
-    UK = 'uk', // Ukrainian
-    UR = 'ur', // Urdu
-    UZ = 'uz', // Uzbek
-    VE = 've', // Venda
-    VI = 'vi', // Vietnamese
-    VO = 'vo', // Volapük
-    CY = 'cy', // Welsh
-    WA = 'wa', // Walloon
-    WO = 'wo', // Wolof
-    XH = 'xh', // Xhosa
-    YI = 'yi', // Yiddish
-    YO = 'yo', // Yoruba
-    ZA = 'za', // Zhuang; Chuang
-    ZU = 'zu', // Zulu
-}

+ 2 - 1
server/src/locale/locale-types.ts

@@ -1,9 +1,10 @@
+import { LanguageCode } from 'shared/generated-types';
+
 import { ID } from '../../../shared/shared-types';
 import { CustomFieldsObject } from '../../../shared/shared-types';
 import { UnwrappedArray } from '../common/common-types';
 import { VendureEntity } from '../entity/base/base.entity';
 
-import { LanguageCode } from './language-code';
 import { TranslatableRelationsKeys } from './translate-entity';
 
 /**

+ 23 - 22
server/src/locale/translate-entity.spec.ts

@@ -1,3 +1,5 @@
+import { LanguageCode } from 'shared/generated-types';
+
 import { ProductOptionTranslation } from '../entity/product-option/product-option-translation.entity';
 import { ProductOption } from '../entity/product-option/product-option.entity';
 import { ProductVariantTranslation } from '../entity/product-variant/product-variant-translation.entity';
@@ -5,11 +7,10 @@ import { ProductVariant } from '../entity/product-variant/product-variant.entity
 import { ProductTranslation } from '../entity/product/product-translation.entity';
 import { Product } from '../entity/product/product.entity';
 
-import { LanguageCode } from './language-code';
 import { Translatable, Translation } from './locale-types';
 import { translateDeep, translateEntity } from './translate-entity';
 
-const LANGUAGE_CODE = LanguageCode.EN;
+const LANGUAGE_CODE = LanguageCode.en;
 const PRODUCT_NAME_EN = 'English Name';
 const VARIANT_NAME_EN = 'English Variant';
 const OPTION_NAME_EN = 'English Option';
@@ -25,7 +26,7 @@ describe('translateEntity()', () => {
     beforeEach(() => {
         productTranslationEN = new ProductTranslation({
             id: '2',
-            languageCode: LanguageCode.EN,
+            languageCode: LanguageCode.en,
             name: PRODUCT_NAME_EN,
             slug: '',
             description: '',
@@ -35,7 +36,7 @@ describe('translateEntity()', () => {
 
         productTranslationDE = new ProductTranslation({
             id: '3',
-            languageCode: LanguageCode.DE,
+            languageCode: LanguageCode.de,
             name: PRODUCT_NAME_DE,
             slug: '',
             description: '',
@@ -50,25 +51,25 @@ describe('translateEntity()', () => {
     });
 
     it('should unwrap the matching translation', () => {
-        const result = translateEntity(product, LanguageCode.EN);
+        const result = translateEntity(product, LanguageCode.en);
 
         expect(result).toHaveProperty('name', PRODUCT_NAME_EN);
     });
 
     it('should not overwrite translatable id with translation id', () => {
-        const result = translateEntity(product, LanguageCode.EN);
+        const result = translateEntity(product, LanguageCode.en);
 
         expect(result).toHaveProperty('id', '1');
     });
 
     it('should note transfer the base from the selected translation', () => {
-        const result = translateEntity(product, LanguageCode.EN);
+        const result = translateEntity(product, LanguageCode.en);
 
         expect(result).not.toHaveProperty('base');
     });
 
     it('should transfer the languageCode from the selected translation', () => {
-        const result = translateEntity(product, LanguageCode.EN);
+        const result = translateEntity(product, LanguageCode.en);
 
         expect(result).toHaveProperty('languageCode', 'en');
     });
@@ -79,7 +80,7 @@ describe('translateEntity()', () => {
                 aBooleanField: true,
             };
             product.customFields = customFields;
-            const result = translateEntity(product, LanguageCode.EN);
+            const result = translateEntity(product, LanguageCode.en);
 
             expect(result.customFields).toEqual(customFields);
         });
@@ -90,7 +91,7 @@ describe('translateEntity()', () => {
                 aLocaleString2: 'translated2',
             };
             product.translations[0].customFields = translatedCustomFields;
-            const result = translateEntity(product, LanguageCode.EN);
+            const result = translateEntity(product, LanguageCode.en);
 
             expect(result.customFields).toEqual(translatedCustomFields);
         });
@@ -106,7 +107,7 @@ describe('translateEntity()', () => {
             };
             product.customFields = productCustomFields;
             product.translations[0].customFields = translatedCustomFields;
-            const result = translateEntity(product, LanguageCode.EN);
+            const result = translateEntity(product, LanguageCode.en);
 
             expect(result.customFields).toEqual({ ...productCustomFields, ...translatedCustomFields });
         });
@@ -115,7 +116,7 @@ describe('translateEntity()', () => {
     it('throw if there are no translations available', () => {
         product.translations = [];
 
-        expect(() => translateEntity(product, LanguageCode.EN)).toThrow(
+        expect(() => translateEntity(product, LanguageCode.en)).toThrow(
             'error.entity-has-no-translation-in-language',
         );
     });
@@ -123,7 +124,7 @@ describe('translateEntity()', () => {
     it('throw if the desired translation is not available', () => {
         product.translations = [];
 
-        expect(() => translateEntity(product, LanguageCode.ZU)).toThrow(
+        expect(() => translateEntity(product, LanguageCode.zu)).toThrow(
             'error.entity-has-no-translation-in-language',
         );
     });
@@ -200,54 +201,54 @@ describe('translateDeep()', () => {
     });
 
     it('should translate the root entity', () => {
-        const result = translateDeep(product, LanguageCode.EN);
+        const result = translateDeep(product, LanguageCode.en);
 
         expect(result).toHaveProperty('name', PRODUCT_NAME_EN);
     });
 
     it('should not throw if root entity has no translations', () => {
-        expect(() => translateDeep(testProduct, LanguageCode.EN)).not.toThrow();
+        expect(() => translateDeep(testProduct, LanguageCode.en)).not.toThrow();
     });
 
     it('should not throw if first-level nested entity is not defined', () => {
         testProduct.singleRealVariant = undefined as any;
-        expect(() => translateDeep(testProduct, LanguageCode.EN, ['singleRealVariant'])).not.toThrow();
+        expect(() => translateDeep(testProduct, LanguageCode.en, ['singleRealVariant'])).not.toThrow();
     });
 
     it('should not throw if second-level nested entity is not defined', () => {
         testProduct.singleRealVariant.options = undefined as any;
         expect(() =>
-            translateDeep(testProduct, LanguageCode.EN, [['singleRealVariant', 'options']]),
+            translateDeep(testProduct, LanguageCode.en, [['singleRealVariant', 'options']]),
         ).not.toThrow();
     });
 
     it('should translate a first-level nested non-array entity', () => {
-        const result = translateDeep(testProduct, LanguageCode.EN, ['singleRealVariant']);
+        const result = translateDeep(testProduct, LanguageCode.en, ['singleRealVariant']);
 
         expect(result.singleRealVariant).toHaveProperty('name', VARIANT_NAME_EN);
     });
 
     it('should translate a first-level nested entity array', () => {
-        const result = translateDeep(product, LanguageCode.EN, ['variants']);
+        const result = translateDeep(product, LanguageCode.en, ['variants']);
 
         expect(result).toHaveProperty('name', PRODUCT_NAME_EN);
         expect(result.variants[0]).toHaveProperty('name', VARIANT_NAME_EN);
     });
 
     it('should translate a second-level nested non-array entity', () => {
-        const result = translateDeep(testProduct, LanguageCode.EN, [['singleTestVariant', 'singleOption']]);
+        const result = translateDeep(testProduct, LanguageCode.en, [['singleTestVariant', 'singleOption']]);
 
         expect(result.singleTestVariant.singleOption).toHaveProperty('name', OPTION_NAME_EN);
     });
 
     it('should translate a second-level nested entity array (first-level is not array)', () => {
-        const result = translateDeep(testProduct, LanguageCode.EN, [['singleRealVariant', 'options']]);
+        const result = translateDeep(testProduct, LanguageCode.en, [['singleRealVariant', 'options']]);
 
         expect(result.singleRealVariant.options[0]).toHaveProperty('name', OPTION_NAME_EN);
     });
 
     it('should translate a second-level nested entity array', () => {
-        const result = translateDeep(product, LanguageCode.EN, ['variants', ['variants', 'options']]);
+        const result = translateDeep(product, LanguageCode.en, ['variants', ['variants', 'options']]);
 
         expect(result).toHaveProperty('name', PRODUCT_NAME_EN);
         expect(result.variants[0]).toHaveProperty('name', VARIANT_NAME_EN);

+ 2 - 1
server/src/locale/translate-entity.ts

@@ -1,7 +1,8 @@
+import { LanguageCode } from 'shared/generated-types';
+
 import { UnwrappedArray } from '../common/common-types';
 import { I18nError } from '../i18n/i18n-error';
 
-import { LanguageCode } from './language-code';
 import { Translatable, Translated } from './locale-types';
 
 // prettier-ignore

+ 10 - 9
server/src/locale/translation-updater.spec.ts

@@ -1,8 +1,9 @@
+import { LanguageCode } from 'shared/generated-types';
+
 import { ProductTranslation } from '../entity/product/product-translation.entity';
 import { Product } from '../entity/product/product.entity';
 import { MockEntityManager } from '../testing/connection.mock';
 
-import { LanguageCode } from './language-code';
 import { TranslationInput } from './locale-types';
 import { TranslationUpdater } from './translation-updater';
 
@@ -11,14 +12,14 @@ describe('TranslationUpdater', () => {
         const existing: ProductTranslation[] = [
             new ProductTranslation({
                 id: '10',
-                languageCode: LanguageCode.EN,
+                languageCode: LanguageCode.en,
                 name: '',
                 slug: '',
                 description: '',
             }),
             new ProductTranslation({
                 id: '11',
-                languageCode: LanguageCode.DE,
+                languageCode: LanguageCode.de,
                 name: '',
                 slug: '',
                 description: '',
@@ -34,13 +35,13 @@ describe('TranslationUpdater', () => {
         it('correctly marks translations for update', async () => {
             const updated: Array<TranslationInput<Product>> = [
                 {
-                    languageCode: LanguageCode.EN,
+                    languageCode: LanguageCode.en,
                     name: '',
                     slug: '',
                     description: '',
                 },
                 {
-                    languageCode: LanguageCode.DE,
+                    languageCode: LanguageCode.de,
                     name: '',
                     slug: '',
                     description: '',
@@ -54,13 +55,13 @@ describe('TranslationUpdater', () => {
         it('correctly marks translations for addition', async () => {
             const updated: Array<TranslationInput<Product>> = [
                 {
-                    languageCode: LanguageCode.AA,
+                    languageCode: LanguageCode.aa,
                     name: '',
                     slug: '',
                     description: '',
                 },
                 {
-                    languageCode: LanguageCode.ZA,
+                    languageCode: LanguageCode.za,
                     name: '',
                     slug: '',
                     description: '',
@@ -80,13 +81,13 @@ describe('TranslationUpdater', () => {
         it('correctly marks languages for update, addition and deletion', async () => {
             const updated: Array<TranslationInput<Product>> = [
                 {
-                    languageCode: LanguageCode.EN,
+                    languageCode: LanguageCode.en,
                     name: '',
                     slug: '',
                     description: '',
                 },
                 {
-                    languageCode: LanguageCode.ZA,
+                    languageCode: LanguageCode.za,
                     name: '',
                     slug: '',
                     description: '',

+ 1 - 1
server/src/service/config.service.ts

@@ -1,12 +1,12 @@
 import { Injectable } from '@nestjs/common';
 import { CorsOptions } from '@nestjs/common/interfaces/external/cors-options.interface';
+import { LanguageCode } from 'shared/generated-types';
 import { ConnectionOptions } from 'typeorm';
 
 import { CustomFields } from '../../../shared/shared-types';
 import { ReadOnlyRequired } from '../common/common-types';
 import { EntityIdStrategy } from '../config/entity-id-strategy/entity-id-strategy';
 import { getConfig, VendureConfig } from '../config/vendure-config';
-import { LanguageCode } from '../locale/language-code';
 
 @Injectable()
 export class ConfigService implements VendureConfig {

+ 1 - 1
server/src/service/facet-value.service.ts

@@ -1,5 +1,6 @@
 import { Injectable } from '@nestjs/common';
 import { InjectConnection } from '@nestjs/typeorm';
+import { LanguageCode } from 'shared/generated-types';
 import { Connection } from 'typeorm';
 
 import { ID } from '../../../shared/shared-types';
@@ -11,7 +12,6 @@ import { FacetValueTranslation } from '../entity/facet-value/facet-value-transla
 import { CreateFacetValueDto, UpdateFacetValueDto } from '../entity/facet-value/facet-value.dto';
 import { FacetValue } from '../entity/facet-value/facet-value.entity';
 import { Facet } from '../entity/facet/facet.entity';
-import { LanguageCode } from '../locale/language-code';
 import { Translated } from '../locale/locale-types';
 import { translateDeep } from '../locale/translate-entity';
 import { TranslationUpdaterService } from '../locale/translation-updater.service';

+ 1 - 1
server/src/service/facet.service.ts

@@ -1,5 +1,6 @@
 import { Injectable } from '@nestjs/common';
 import { InjectConnection } from '@nestjs/typeorm';
+import { LanguageCode } from 'shared/generated-types';
 import { Connection } from 'typeorm';
 
 import { ID, PaginatedList } from '../../../shared/shared-types';
@@ -12,7 +13,6 @@ import { assertFound } from '../common/utils';
 import { FacetTranslation } from '../entity/facet/facet-translation.entity';
 import { CreateFacetDto, UpdateFacetDto } from '../entity/facet/facet.dto';
 import { Facet } from '../entity/facet/facet.entity';
-import { LanguageCode } from '../locale/language-code';
 import { Translated } from '../locale/locale-types';
 import { translateDeep } from '../locale/translate-entity';
 import { TranslationUpdaterService } from '../locale/translation-updater.service';

+ 1 - 1
server/src/service/product-option-group.service.ts

@@ -1,5 +1,6 @@
 import { Injectable } from '@nestjs/common';
 import { InjectConnection } from '@nestjs/typeorm';
+import { LanguageCode } from 'shared/generated-types';
 import { Connection, FindManyOptions, Like } from 'typeorm';
 
 import { ID } from '../../../shared/shared-types';
@@ -13,7 +14,6 @@ import {
     UpdateProductOptionGroupDto,
 } from '../entity/product-option-group/product-option-group.dto';
 import { ProductOptionGroup } from '../entity/product-option-group/product-option-group.entity';
-import { LanguageCode } from '../locale/language-code';
 import { Translated } from '../locale/locale-types';
 import { translateDeep } from '../locale/translate-entity';
 import { TranslationUpdaterService } from '../locale/translation-updater.service';

+ 1 - 1
server/src/service/product-option.service.ts

@@ -1,5 +1,6 @@
 import { Injectable } from '@nestjs/common';
 import { InjectConnection } from '@nestjs/typeorm';
+import { LanguageCode } from 'shared/generated-types';
 import { Connection } from 'typeorm';
 
 import { ID } from '../../../shared/shared-types';
@@ -10,7 +11,6 @@ import { ProductOptionGroup } from '../entity/product-option-group/product-optio
 import { ProductOptionTranslation } from '../entity/product-option/product-option-translation.entity';
 import { CreateProductOptionDto } from '../entity/product-option/product-option.dto';
 import { ProductOption } from '../entity/product-option/product-option.entity';
-import { LanguageCode } from '../locale/language-code';
 import { Translated } from '../locale/locale-types';
 import { translateDeep } from '../locale/translate-entity';
 

+ 11 - 11
server/src/service/product-variant.service.spec.ts

@@ -1,4 +1,5 @@
 import { Test } from '@nestjs/testing';
+import { LanguageCode } from 'shared/generated-types';
 import { Connection } from 'typeorm';
 
 import { DeepPartial } from '../../../shared/shared-types';
@@ -7,7 +8,6 @@ import { ProductOption } from '../entity/product-option/product-option.entity';
 import { ProductVariantTranslation } from '../entity/product-variant/product-variant-translation.entity';
 import { ProductVariant } from '../entity/product-variant/product-variant.entity';
 import { Product } from '../entity/product/product.entity';
-import { LanguageCode } from '../locale/language-code';
 import { MockTranslationUpdaterService } from '../locale/translation-updater.mock';
 import { TranslationUpdaterService } from '../locale/translation-updater.service';
 import { MockConnection } from '../testing/connection.mock';
@@ -39,12 +39,12 @@ describe('ProductVariantService', () => {
                 price: 123,
                 translations: [
                     {
-                        languageCode: LanguageCode.EN,
-                        name: 'Test EN',
+                        languageCode: LanguageCode.en,
+                        name: 'Test en',
                     },
                     {
-                        languageCode: LanguageCode.DE,
-                        name: 'Test DE',
+                        languageCode: LanguageCode.de,
+                        name: 'Test de',
                     },
                 ],
             });
@@ -61,12 +61,12 @@ describe('ProductVariantService', () => {
                 price: 123,
                 translations: [
                     {
-                        languageCode: LanguageCode.EN,
-                        name: 'Test EN',
+                        languageCode: LanguageCode.en,
+                        name: 'Test en',
                     },
                     {
-                        languageCode: LanguageCode.DE,
-                        name: 'Test DE',
+                        languageCode: LanguageCode.de,
+                        name: 'Test de',
                     },
                 ],
             });
@@ -91,8 +91,8 @@ describe('ProductVariantService', () => {
                 price: 123,
                 translations: [
                     {
-                        languageCode: LanguageCode.EN,
-                        name: 'Test EN',
+                        languageCode: LanguageCode.en,
+                        name: 'Test en',
                     },
                 ],
                 optionCodes: ['option2'],

+ 16 - 16
server/src/service/product.service.spec.ts

@@ -1,11 +1,11 @@
 import { Test } from '@nestjs/testing';
+import { LanguageCode } from 'shared/generated-types';
 import { Connection } from 'typeorm';
 
 import { ProductOptionGroup } from '../entity/product-option-group/product-option-group.entity';
 import { ProductTranslation } from '../entity/product/product-translation.entity';
 import { UpdateProductDto } from '../entity/product/product.dto';
 import { Product } from '../entity/product/product.entity';
-import { LanguageCode } from '../locale/language-code';
 import { MockTranslationUpdaterService } from '../locale/translation-updater.mock';
 import { TranslationUpdaterService } from '../locale/translation-updater.service';
 import { MockConnection } from '../testing/connection.mock';
@@ -41,16 +41,16 @@ describe('ProductService', () => {
             await productService.create({
                 translations: [
                     {
-                        languageCode: LanguageCode.EN,
-                        name: 'Test EN',
+                        languageCode: LanguageCode.en,
+                        name: 'Test en',
                         slug: 'test-en',
-                        description: 'Test description EN',
+                        description: 'Test description en',
                     },
                     {
-                        languageCode: LanguageCode.DE,
-                        name: 'Test DE',
+                        languageCode: LanguageCode.de,
+                        name: 'Test de',
                         slug: 'test-de',
-                        description: 'Test description DE',
+                        description: 'Test description de',
                     },
                 ],
             });
@@ -63,16 +63,16 @@ describe('ProductService', () => {
             await productService.create({
                 translations: [
                     {
-                        languageCode: LanguageCode.EN,
-                        name: 'Test EN',
+                        languageCode: LanguageCode.en,
+                        name: 'Test en',
                         slug: 'test-en',
-                        description: 'Test description EN',
+                        description: 'Test description en',
                     },
                     {
-                        languageCode: LanguageCode.DE,
-                        name: 'Test DE',
+                        languageCode: LanguageCode.de,
+                        name: 'Test de',
                         slug: 'test-de',
-                        description: 'Test description DE',
+                        description: 'Test description de',
                     },
                 ],
             });
@@ -96,10 +96,10 @@ describe('ProductService', () => {
             await productService.create({
                 translations: [
                     {
-                        languageCode: LanguageCode.EN,
-                        name: 'Test EN',
+                        languageCode: LanguageCode.en,
+                        name: 'Test en',
                         slug: 'test-en',
-                        description: 'Test description EN',
+                        description: 'Test description en',
                     },
                 ],
                 optionGroupCodes: ['optionGroup2'],

+ 1 - 1
server/src/service/product.service.ts

@@ -1,5 +1,6 @@
 import { Injectable } from '@nestjs/common';
 import { InjectConnection } from '@nestjs/typeorm';
+import { LanguageCode } from 'shared/generated-types';
 import { Connection } from 'typeorm';
 
 import { ID, PaginatedList } from '../../../shared/shared-types';
@@ -14,7 +15,6 @@ import { ProductTranslation } from '../entity/product/product-translation.entity
 import { CreateProductDto, UpdateProductDto } from '../entity/product/product.dto';
 import { Product } from '../entity/product/product.entity';
 import { I18nError } from '../i18n/i18n-error';
-import { LanguageCode } from '../locale/language-code';
 import { Translated } from '../locale/locale-types';
 import { translateDeep } from '../locale/translate-entity';
 import { TranslationUpdaterService } from '../locale/translation-updater.service';

+ 5 - 2
server/tsconfig.json

@@ -1,6 +1,6 @@
 {
+  "extends": "../tsconfig.json",
   "compilerOptions": {
-    "module": "commonjs",
     "declaration": true,
     "noImplicitAny": false,
     "removeComments": true,
@@ -14,6 +14,9 @@
     "strict": true,
     "strictPropertyInitialization": false,
     "sourceMap": true,
-    "baseUrl": "./src"
+    "baseUrl": "./src",
+    "paths": {
+      "shared/*": ["../../shared/*"]
+    }
   }
 }

+ 4 - 0
server/yarn.lock

@@ -2040,6 +2040,10 @@ graphql-request@^1.8.2:
   dependencies:
     cross-fetch "2.2.2"
 
+graphql-tag@^2.9.2:
+  version "2.9.2"
+  resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.9.2.tgz#2f60a5a981375f430bf1e6e95992427dc18af686"
+
 graphql-tools@^3.1.1:
   version "3.1.1"
   resolved "https://registry.yarnpkg.com/graphql-tools/-/graphql-tools-3.1.1.tgz#d593358f01e7c8b1671a17b70ddb034dea9dbc50"

+ 1651 - 0
shared/generated-types.ts

@@ -0,0 +1,1651 @@
+/* tslint:disable */
+// This file was automatically generated and should not be edited.
+
+// ====================================================
+// GraphQL mutation operation: CreateFacet
+// ====================================================
+
+export interface CreateFacet_createFacet_translations {
+  __typename: "FacetTranslation";
+  id: string;
+  languageCode: LanguageCode;
+  name: string;
+}
+
+export interface CreateFacet_createFacet_values_translations {
+  __typename: "FacetValueTranslation";
+  id: string;
+  languageCode: LanguageCode;
+  name: string;
+}
+
+export interface CreateFacet_createFacet_values {
+  __typename: "FacetValue";
+  id: string;
+  languageCode: LanguageCode | null;
+  code: string;
+  name: string;
+  translations: CreateFacet_createFacet_values_translations[];
+}
+
+export interface CreateFacet_createFacet {
+  __typename: "Facet";
+  id: string;
+  languageCode: LanguageCode;
+  code: string;
+  name: string;
+  translations: CreateFacet_createFacet_translations[];
+  values: CreateFacet_createFacet_values[];
+}
+
+export interface CreateFacet {
+  /**
+   * Create a new Facet
+   */
+  createFacet: CreateFacet_createFacet;
+}
+
+export interface CreateFacetVariables {
+  input: CreateFacetInput;
+}
+
+/* tslint:disable */
+// This file was automatically generated and should not be edited.
+
+// ====================================================
+// GraphQL mutation operation: UpdateFacet
+// ====================================================
+
+export interface UpdateFacet_updateFacet_translations {
+  __typename: "FacetTranslation";
+  id: string;
+  languageCode: LanguageCode;
+  name: string;
+}
+
+export interface UpdateFacet_updateFacet_values_translations {
+  __typename: "FacetValueTranslation";
+  id: string;
+  languageCode: LanguageCode;
+  name: string;
+}
+
+export interface UpdateFacet_updateFacet_values {
+  __typename: "FacetValue";
+  id: string;
+  languageCode: LanguageCode | null;
+  code: string;
+  name: string;
+  translations: UpdateFacet_updateFacet_values_translations[];
+}
+
+export interface UpdateFacet_updateFacet {
+  __typename: "Facet";
+  id: string;
+  languageCode: LanguageCode;
+  code: string;
+  name: string;
+  translations: UpdateFacet_updateFacet_translations[];
+  values: UpdateFacet_updateFacet_values[];
+}
+
+export interface UpdateFacet {
+  /**
+   * Update an existing Facet
+   */
+  updateFacet: UpdateFacet_updateFacet;
+}
+
+export interface UpdateFacetVariables {
+  input: UpdateFacetInput;
+}
+
+/* tslint:disable */
+// This file was automatically generated and should not be edited.
+
+// ====================================================
+// GraphQL mutation operation: CreateFacetValues
+// ====================================================
+
+export interface CreateFacetValues_createFacetValues_translations {
+  __typename: "FacetValueTranslation";
+  id: string;
+  languageCode: LanguageCode;
+  name: string;
+}
+
+export interface CreateFacetValues_createFacetValues {
+  __typename: "FacetValue";
+  id: string;
+  languageCode: LanguageCode | null;
+  code: string;
+  name: string;
+  translations: CreateFacetValues_createFacetValues_translations[];
+}
+
+export interface CreateFacetValues {
+  /**
+   * Create one or more FacetValues
+   */
+  createFacetValues: CreateFacetValues_createFacetValues[];
+}
+
+export interface CreateFacetValuesVariables {
+  input: CreateFacetValueInput[];
+}
+
+/* tslint:disable */
+// This file was automatically generated and should not be edited.
+
+// ====================================================
+// GraphQL mutation operation: UpdateFacetValues
+// ====================================================
+
+export interface UpdateFacetValues_updateFacetValues_translations {
+  __typename: "FacetValueTranslation";
+  id: string;
+  languageCode: LanguageCode;
+  name: string;
+}
+
+export interface UpdateFacetValues_updateFacetValues {
+  __typename: "FacetValue";
+  id: string;
+  languageCode: LanguageCode | null;
+  code: string;
+  name: string;
+  translations: UpdateFacetValues_updateFacetValues_translations[];
+}
+
+export interface UpdateFacetValues {
+  /**
+   * Update one or more FacetValues
+   */
+  updateFacetValues: UpdateFacetValues_updateFacetValues[];
+}
+
+export interface UpdateFacetValuesVariables {
+  input: UpdateFacetValueInput[];
+}
+
+/* tslint:disable */
+// This file was automatically generated and should not be edited.
+
+// ====================================================
+// GraphQL mutation operation: RequestStarted
+// ====================================================
+
+export interface RequestStarted {
+  requestStarted: number;
+}
+
+/* tslint:disable */
+// This file was automatically generated and should not be edited.
+
+// ====================================================
+// GraphQL mutation operation: RequestCompleted
+// ====================================================
+
+export interface RequestCompleted {
+  requestCompleted: number;
+}
+
+/* tslint:disable */
+// This file was automatically generated and should not be edited.
+
+// ====================================================
+// GraphQL mutation operation: LogIn
+// ====================================================
+
+export interface LogIn_logIn {
+  __typename: "UserStatus";
+  username: string;
+  isLoggedIn: boolean;
+  loginTime: string;
+}
+
+export interface LogIn {
+  logIn: LogIn_logIn | null;
+}
+
+export interface LogInVariables {
+  username: string;
+  loginTime: string;
+}
+
+/* tslint:disable */
+// This file was automatically generated and should not be edited.
+
+// ====================================================
+// GraphQL mutation operation: LogOut
+// ====================================================
+
+export interface LogOut_logOut {
+  __typename: "UserStatus";
+  username: string;
+  isLoggedIn: boolean;
+  loginTime: string;
+}
+
+export interface LogOut {
+  logOut: LogOut_logOut | null;
+}
+
+/* tslint:disable */
+// This file was automatically generated and should not be edited.
+
+// ====================================================
+// GraphQL mutation operation: SetUiLanguage
+// ====================================================
+
+export interface SetUiLanguage {
+  setUiLanguage: LanguageCode | null;
+}
+
+export interface SetUiLanguageVariables {
+  languageCode: LanguageCode;
+}
+
+/* tslint:disable */
+// This file was automatically generated and should not be edited.
+
+// ====================================================
+// GraphQL mutation operation: UpdateProduct
+// ====================================================
+
+export interface UpdateProduct_updateProduct_translations {
+  __typename: "ProductTranslation";
+  languageCode: LanguageCode;
+  name: string;
+  slug: string;
+  description: string | null;
+}
+
+export interface UpdateProduct_updateProduct_optionGroups {
+  __typename: "ProductOptionGroup";
+  id: string;
+  languageCode: LanguageCode;
+  code: string;
+  name: string;
+}
+
+export interface UpdateProduct_updateProduct_variants_options {
+  __typename: "ProductOption";
+  id: string;
+  code: string | null;
+  languageCode: LanguageCode | null;
+  name: string | null;
+}
+
+export interface UpdateProduct_updateProduct_variants_facetValues {
+  __typename: "FacetValue";
+  id: string;
+  code: string;
+  name: string;
+}
+
+export interface UpdateProduct_updateProduct_variants_translations {
+  __typename: "ProductVariantTranslation";
+  id: string;
+  languageCode: LanguageCode;
+  name: string;
+}
+
+export interface UpdateProduct_updateProduct_variants {
+  __typename: "ProductVariant";
+  id: string;
+  languageCode: LanguageCode;
+  name: string;
+  price: number;
+  sku: string;
+  image: string | null;
+  options: UpdateProduct_updateProduct_variants_options[];
+  facetValues: UpdateProduct_updateProduct_variants_facetValues[];
+  translations: UpdateProduct_updateProduct_variants_translations[];
+}
+
+export interface UpdateProduct_updateProduct {
+  __typename: "Product";
+  id: string;
+  languageCode: LanguageCode;
+  name: string;
+  slug: string;
+  image: string;
+  description: string;
+  translations: UpdateProduct_updateProduct_translations[];
+  optionGroups: UpdateProduct_updateProduct_optionGroups[];
+  variants: UpdateProduct_updateProduct_variants[];
+}
+
+export interface UpdateProduct {
+  /**
+   * Update an existing Product
+   */
+  updateProduct: UpdateProduct_updateProduct;
+}
+
+export interface UpdateProductVariables {
+  input: UpdateProductInput;
+}
+
+/* tslint:disable */
+// This file was automatically generated and should not be edited.
+
+// ====================================================
+// GraphQL mutation operation: CreateProduct
+// ====================================================
+
+export interface CreateProduct_createProduct_translations {
+  __typename: "ProductTranslation";
+  languageCode: LanguageCode;
+  name: string;
+  slug: string;
+  description: string | null;
+}
+
+export interface CreateProduct_createProduct_optionGroups {
+  __typename: "ProductOptionGroup";
+  id: string;
+  languageCode: LanguageCode;
+  code: string;
+  name: string;
+}
+
+export interface CreateProduct_createProduct_variants_options {
+  __typename: "ProductOption";
+  id: string;
+  code: string | null;
+  languageCode: LanguageCode | null;
+  name: string | null;
+}
+
+export interface CreateProduct_createProduct_variants_facetValues {
+  __typename: "FacetValue";
+  id: string;
+  code: string;
+  name: string;
+}
+
+export interface CreateProduct_createProduct_variants_translations {
+  __typename: "ProductVariantTranslation";
+  id: string;
+  languageCode: LanguageCode;
+  name: string;
+}
+
+export interface CreateProduct_createProduct_variants {
+  __typename: "ProductVariant";
+  id: string;
+  languageCode: LanguageCode;
+  name: string;
+  price: number;
+  sku: string;
+  image: string | null;
+  options: CreateProduct_createProduct_variants_options[];
+  facetValues: CreateProduct_createProduct_variants_facetValues[];
+  translations: CreateProduct_createProduct_variants_translations[];
+}
+
+export interface CreateProduct_createProduct {
+  __typename: "Product";
+  id: string;
+  languageCode: LanguageCode;
+  name: string;
+  slug: string;
+  image: string;
+  description: string;
+  translations: CreateProduct_createProduct_translations[];
+  optionGroups: CreateProduct_createProduct_optionGroups[];
+  variants: CreateProduct_createProduct_variants[];
+}
+
+export interface CreateProduct {
+  /**
+   * Create a new Product
+   */
+  createProduct: CreateProduct_createProduct;
+}
+
+export interface CreateProductVariables {
+  input: CreateProductInput;
+}
+
+/* tslint:disable */
+// This file was automatically generated and should not be edited.
+
+// ====================================================
+// GraphQL mutation operation: GenerateProductVariants
+// ====================================================
+
+export interface GenerateProductVariants_generateVariantsForProduct_translations {
+  __typename: "ProductTranslation";
+  languageCode: LanguageCode;
+  name: string;
+  slug: string;
+  description: string | null;
+}
+
+export interface GenerateProductVariants_generateVariantsForProduct_optionGroups {
+  __typename: "ProductOptionGroup";
+  id: string;
+  languageCode: LanguageCode;
+  code: string;
+  name: string;
+}
+
+export interface GenerateProductVariants_generateVariantsForProduct_variants_options {
+  __typename: "ProductOption";
+  id: string;
+  code: string | null;
+  languageCode: LanguageCode | null;
+  name: string | null;
+}
+
+export interface GenerateProductVariants_generateVariantsForProduct_variants_facetValues {
+  __typename: "FacetValue";
+  id: string;
+  code: string;
+  name: string;
+}
+
+export interface GenerateProductVariants_generateVariantsForProduct_variants_translations {
+  __typename: "ProductVariantTranslation";
+  id: string;
+  languageCode: LanguageCode;
+  name: string;
+}
+
+export interface GenerateProductVariants_generateVariantsForProduct_variants {
+  __typename: "ProductVariant";
+  id: string;
+  languageCode: LanguageCode;
+  name: string;
+  price: number;
+  sku: string;
+  image: string | null;
+  options: GenerateProductVariants_generateVariantsForProduct_variants_options[];
+  facetValues: GenerateProductVariants_generateVariantsForProduct_variants_facetValues[];
+  translations: GenerateProductVariants_generateVariantsForProduct_variants_translations[];
+}
+
+export interface GenerateProductVariants_generateVariantsForProduct {
+  __typename: "Product";
+  id: string;
+  languageCode: LanguageCode;
+  name: string;
+  slug: string;
+  image: string;
+  description: string;
+  translations: GenerateProductVariants_generateVariantsForProduct_translations[];
+  optionGroups: GenerateProductVariants_generateVariantsForProduct_optionGroups[];
+  variants: GenerateProductVariants_generateVariantsForProduct_variants[];
+}
+
+export interface GenerateProductVariants {
+  /**
+   * Create a set of ProductVariants based on the OptionGroups assigned to the given Product
+   */
+  generateVariantsForProduct: GenerateProductVariants_generateVariantsForProduct;
+}
+
+export interface GenerateProductVariantsVariables {
+  productId: string;
+  defaultPrice?: number | null;
+  defaultSku?: string | null;
+}
+
+/* tslint:disable */
+// This file was automatically generated and should not be edited.
+
+// ====================================================
+// GraphQL mutation operation: UpdateProductVariants
+// ====================================================
+
+export interface UpdateProductVariants_updateProductVariants_options {
+  __typename: "ProductOption";
+  id: string;
+  code: string | null;
+  languageCode: LanguageCode | null;
+  name: string | null;
+}
+
+export interface UpdateProductVariants_updateProductVariants_facetValues {
+  __typename: "FacetValue";
+  id: string;
+  code: string;
+  name: string;
+}
+
+export interface UpdateProductVariants_updateProductVariants_translations {
+  __typename: "ProductVariantTranslation";
+  id: string;
+  languageCode: LanguageCode;
+  name: string;
+}
+
+export interface UpdateProductVariants_updateProductVariants {
+  __typename: "ProductVariant";
+  id: string;
+  languageCode: LanguageCode;
+  name: string;
+  price: number;
+  sku: string;
+  image: string | null;
+  options: UpdateProductVariants_updateProductVariants_options[];
+  facetValues: UpdateProductVariants_updateProductVariants_facetValues[];
+  translations: UpdateProductVariants_updateProductVariants_translations[];
+}
+
+export interface UpdateProductVariants {
+  /**
+   * Update existing ProductVariants
+   */
+  updateProductVariants: (UpdateProductVariants_updateProductVariants | null)[];
+}
+
+export interface UpdateProductVariantsVariables {
+  input: UpdateProductVariantInput[];
+}
+
+/* tslint:disable */
+// This file was automatically generated and should not be edited.
+
+// ====================================================
+// GraphQL mutation operation: CreateProductOptionGroup
+// ====================================================
+
+export interface CreateProductOptionGroup_createProductOptionGroup_translations {
+  __typename: "ProductOptionGroupTranslation";
+  name: string;
+}
+
+export interface CreateProductOptionGroup_createProductOptionGroup_options_translations {
+  __typename: "ProductOptionTranslation";
+  name: string;
+}
+
+export interface CreateProductOptionGroup_createProductOptionGroup_options {
+  __typename: "ProductOption";
+  id: string;
+  languageCode: LanguageCode | null;
+  name: string | null;
+  code: string | null;
+  translations: CreateProductOptionGroup_createProductOptionGroup_options_translations[];
+}
+
+export interface CreateProductOptionGroup_createProductOptionGroup {
+  __typename: "ProductOptionGroup";
+  id: string;
+  languageCode: LanguageCode;
+  code: string;
+  name: string;
+  translations: CreateProductOptionGroup_createProductOptionGroup_translations[];
+  options: CreateProductOptionGroup_createProductOptionGroup_options[];
+}
+
+export interface CreateProductOptionGroup {
+  /**
+   * Create a new ProductOptionGroup
+   */
+  createProductOptionGroup: CreateProductOptionGroup_createProductOptionGroup;
+}
+
+export interface CreateProductOptionGroupVariables {
+  input: CreateProductOptionGroupInput;
+}
+
+/* tslint:disable */
+// This file was automatically generated and should not be edited.
+
+// ====================================================
+// GraphQL mutation operation: AddOptionGroupToProduct
+// ====================================================
+
+export interface AddOptionGroupToProduct_addOptionGroupToProduct_optionGroups_options {
+  __typename: "ProductOption";
+  id: string;
+  code: string | null;
+}
+
+export interface AddOptionGroupToProduct_addOptionGroupToProduct_optionGroups {
+  __typename: "ProductOptionGroup";
+  id: string;
+  code: string;
+  options: AddOptionGroupToProduct_addOptionGroupToProduct_optionGroups_options[];
+}
+
+export interface AddOptionGroupToProduct_addOptionGroupToProduct {
+  __typename: "Product";
+  id: string;
+  optionGroups: AddOptionGroupToProduct_addOptionGroupToProduct_optionGroups[];
+}
+
+export interface AddOptionGroupToProduct {
+  /**
+   * Add an OptionGroup to a Product
+   */
+  addOptionGroupToProduct: AddOptionGroupToProduct_addOptionGroupToProduct;
+}
+
+export interface AddOptionGroupToProductVariables {
+  productId: string;
+  optionGroupId: string;
+}
+
+/* tslint:disable */
+// This file was automatically generated and should not be edited.
+
+// ====================================================
+// GraphQL mutation operation: RemoveOptionGroupFromProduct
+// ====================================================
+
+export interface RemoveOptionGroupFromProduct_removeOptionGroupFromProduct_optionGroups_options {
+  __typename: "ProductOption";
+  id: string;
+  code: string | null;
+}
+
+export interface RemoveOptionGroupFromProduct_removeOptionGroupFromProduct_optionGroups {
+  __typename: "ProductOptionGroup";
+  id: string;
+  code: string;
+  options: RemoveOptionGroupFromProduct_removeOptionGroupFromProduct_optionGroups_options[];
+}
+
+export interface RemoveOptionGroupFromProduct_removeOptionGroupFromProduct {
+  __typename: "Product";
+  id: string;
+  optionGroups: RemoveOptionGroupFromProduct_removeOptionGroupFromProduct_optionGroups[];
+}
+
+export interface RemoveOptionGroupFromProduct {
+  /**
+   * Remove an OptionGroup from a Product
+   */
+  removeOptionGroupFromProduct: RemoveOptionGroupFromProduct_removeOptionGroupFromProduct;
+}
+
+export interface RemoveOptionGroupFromProductVariables {
+  productId: string;
+  optionGroupId: string;
+}
+
+/* tslint:disable */
+// This file was automatically generated and should not be edited.
+
+// ====================================================
+// GraphQL mutation operation: ApplyFacetValuesToProductVariants
+// ====================================================
+
+export interface ApplyFacetValuesToProductVariants_applyFacetValuesToProductVariants_options {
+  __typename: "ProductOption";
+  id: string;
+  code: string | null;
+  languageCode: LanguageCode | null;
+  name: string | null;
+}
+
+export interface ApplyFacetValuesToProductVariants_applyFacetValuesToProductVariants_facetValues {
+  __typename: "FacetValue";
+  id: string;
+  code: string;
+  name: string;
+}
+
+export interface ApplyFacetValuesToProductVariants_applyFacetValuesToProductVariants_translations {
+  __typename: "ProductVariantTranslation";
+  id: string;
+  languageCode: LanguageCode;
+  name: string;
+}
+
+export interface ApplyFacetValuesToProductVariants_applyFacetValuesToProductVariants {
+  __typename: "ProductVariant";
+  id: string;
+  languageCode: LanguageCode;
+  name: string;
+  price: number;
+  sku: string;
+  image: string | null;
+  options: ApplyFacetValuesToProductVariants_applyFacetValuesToProductVariants_options[];
+  facetValues: ApplyFacetValuesToProductVariants_applyFacetValuesToProductVariants_facetValues[];
+  translations: ApplyFacetValuesToProductVariants_applyFacetValuesToProductVariants_translations[];
+}
+
+export interface ApplyFacetValuesToProductVariants {
+  /**
+   * Applies a FacetValue to the given ProductVariants
+   */
+  applyFacetValuesToProductVariants: ApplyFacetValuesToProductVariants_applyFacetValuesToProductVariants[];
+}
+
+export interface ApplyFacetValuesToProductVariantsVariables {
+  facetValueIds: string[];
+  productVariantIds: string[];
+}
+
+/* tslint:disable */
+// This file was automatically generated and should not be edited.
+
+// ====================================================
+// GraphQL query operation: GetFacetList
+// ====================================================
+
+export interface GetFacetList_facets_items_translations {
+  __typename: "FacetTranslation";
+  id: string;
+  languageCode: LanguageCode;
+  name: string;
+}
+
+export interface GetFacetList_facets_items_values_translations {
+  __typename: "FacetValueTranslation";
+  id: string;
+  languageCode: LanguageCode;
+  name: string;
+}
+
+export interface GetFacetList_facets_items_values {
+  __typename: "FacetValue";
+  id: string;
+  languageCode: LanguageCode | null;
+  code: string;
+  name: string;
+  translations: GetFacetList_facets_items_values_translations[];
+}
+
+export interface GetFacetList_facets_items {
+  __typename: "Facet";
+  id: string;
+  languageCode: LanguageCode;
+  code: string;
+  name: string;
+  translations: GetFacetList_facets_items_translations[];
+  values: GetFacetList_facets_items_values[];
+}
+
+export interface GetFacetList_facets {
+  __typename: "FacetList";
+  items: GetFacetList_facets_items[];
+  totalItems: number;
+}
+
+export interface GetFacetList {
+  facets: GetFacetList_facets;
+}
+
+export interface GetFacetListVariables {
+  options?: FacetListOptions | null;
+  languageCode?: LanguageCode | null;
+}
+
+/* tslint:disable */
+// This file was automatically generated and should not be edited.
+
+// ====================================================
+// GraphQL query operation: GetFacetWithValues
+// ====================================================
+
+export interface GetFacetWithValues_facet_translations {
+  __typename: "FacetTranslation";
+  id: string;
+  languageCode: LanguageCode;
+  name: string;
+}
+
+export interface GetFacetWithValues_facet_values_translations {
+  __typename: "FacetValueTranslation";
+  id: string;
+  languageCode: LanguageCode;
+  name: string;
+}
+
+export interface GetFacetWithValues_facet_values {
+  __typename: "FacetValue";
+  id: string;
+  languageCode: LanguageCode | null;
+  code: string;
+  name: string;
+  translations: GetFacetWithValues_facet_values_translations[];
+}
+
+export interface GetFacetWithValues_facet {
+  __typename: "Facet";
+  id: string;
+  languageCode: LanguageCode;
+  code: string;
+  name: string;
+  translations: GetFacetWithValues_facet_translations[];
+  values: GetFacetWithValues_facet_values[];
+}
+
+export interface GetFacetWithValues {
+  facet: GetFacetWithValues_facet | null;
+}
+
+export interface GetFacetWithValuesVariables {
+  id: string;
+  languageCode?: LanguageCode | null;
+}
+
+/* tslint:disable */
+// This file was automatically generated and should not be edited.
+
+// ====================================================
+// GraphQL query operation: GetNetworkStatus
+// ====================================================
+
+export interface GetNetworkStatus_networkStatus {
+  __typename: "NetworkStatus";
+  inFlightRequests: number;
+}
+
+export interface GetNetworkStatus {
+  networkStatus: GetNetworkStatus_networkStatus;
+}
+
+/* tslint:disable */
+// This file was automatically generated and should not be edited.
+
+// ====================================================
+// GraphQL query operation: GetUserStatus
+// ====================================================
+
+export interface GetUserStatus_userStatus {
+  __typename: "UserStatus";
+  username: string;
+  isLoggedIn: boolean;
+  loginTime: string;
+}
+
+export interface GetUserStatus {
+  userStatus: GetUserStatus_userStatus;
+}
+
+/* tslint:disable */
+// This file was automatically generated and should not be edited.
+
+// ====================================================
+// GraphQL query operation: GetUiState
+// ====================================================
+
+export interface GetUiState_uiState {
+  __typename: "UiState";
+  language: LanguageCode;
+}
+
+export interface GetUiState {
+  uiState: GetUiState_uiState;
+}
+
+/* tslint:disable */
+// This file was automatically generated and should not be edited.
+
+// ====================================================
+// GraphQL query operation: GetProductWithVariants
+// ====================================================
+
+export interface GetProductWithVariants_product_translations {
+  __typename: "ProductTranslation";
+  languageCode: LanguageCode;
+  name: string;
+  slug: string;
+  description: string | null;
+}
+
+export interface GetProductWithVariants_product_optionGroups {
+  __typename: "ProductOptionGroup";
+  id: string;
+  languageCode: LanguageCode;
+  code: string;
+  name: string;
+}
+
+export interface GetProductWithVariants_product_variants_options {
+  __typename: "ProductOption";
+  id: string;
+  code: string | null;
+  languageCode: LanguageCode | null;
+  name: string | null;
+}
+
+export interface GetProductWithVariants_product_variants_facetValues {
+  __typename: "FacetValue";
+  id: string;
+  code: string;
+  name: string;
+}
+
+export interface GetProductWithVariants_product_variants_translations {
+  __typename: "ProductVariantTranslation";
+  id: string;
+  languageCode: LanguageCode;
+  name: string;
+}
+
+export interface GetProductWithVariants_product_variants {
+  __typename: "ProductVariant";
+  id: string;
+  languageCode: LanguageCode;
+  name: string;
+  price: number;
+  sku: string;
+  image: string | null;
+  options: GetProductWithVariants_product_variants_options[];
+  facetValues: GetProductWithVariants_product_variants_facetValues[];
+  translations: GetProductWithVariants_product_variants_translations[];
+}
+
+export interface GetProductWithVariants_product {
+  __typename: "Product";
+  id: string;
+  languageCode: LanguageCode;
+  name: string;
+  slug: string;
+  image: string;
+  description: string;
+  translations: GetProductWithVariants_product_translations[];
+  optionGroups: GetProductWithVariants_product_optionGroups[];
+  variants: GetProductWithVariants_product_variants[];
+}
+
+export interface GetProductWithVariants {
+  product: GetProductWithVariants_product | null;
+}
+
+export interface GetProductWithVariantsVariables {
+  id: string;
+  languageCode?: LanguageCode | null;
+}
+
+/* tslint:disable */
+// This file was automatically generated and should not be edited.
+
+// ====================================================
+// GraphQL query operation: GetProductList
+// ====================================================
+
+export interface GetProductList_products_items {
+  __typename: "Product";
+  id: string;
+  languageCode: LanguageCode;
+  name: string;
+  slug: string;
+  description: string;
+}
+
+export interface GetProductList_products {
+  __typename: "ProductList";
+  items: GetProductList_products_items[];
+  totalItems: number;
+}
+
+export interface GetProductList {
+  products: GetProductList_products;
+}
+
+export interface GetProductListVariables {
+  options?: ProductListOptions | null;
+  languageCode?: LanguageCode | null;
+}
+
+/* tslint:disable */
+// This file was automatically generated and should not be edited.
+
+// ====================================================
+// GraphQL query operation: GetProductOptionGroups
+// ====================================================
+
+export interface GetProductOptionGroups_productOptionGroups_options {
+  __typename: "ProductOption";
+  id: string;
+  languageCode: LanguageCode | null;
+  code: string | null;
+  name: string | null;
+}
+
+export interface GetProductOptionGroups_productOptionGroups {
+  __typename: "ProductOptionGroup";
+  id: string;
+  languageCode: LanguageCode;
+  code: string;
+  name: string;
+  options: GetProductOptionGroups_productOptionGroups_options[];
+}
+
+export interface GetProductOptionGroups {
+  productOptionGroups: GetProductOptionGroups_productOptionGroups[];
+}
+
+export interface GetProductOptionGroupsVariables {
+  filterTerm?: string | null;
+  languageCode?: LanguageCode | null;
+}
+
+/* tslint:disable */
+// This file was automatically generated and should not be edited.
+
+// ====================================================
+// GraphQL fragment: FacetValue
+// ====================================================
+
+export interface FacetValue_translations {
+  __typename: "FacetValueTranslation";
+  id: string;
+  languageCode: LanguageCode;
+  name: string;
+}
+
+export interface FacetValue {
+  __typename: "FacetValue";
+  id: string;
+  languageCode: LanguageCode | null;
+  code: string;
+  name: string;
+  translations: FacetValue_translations[];
+}
+
+/* tslint:disable */
+// This file was automatically generated and should not be edited.
+
+// ====================================================
+// GraphQL fragment: FacetWithValues
+// ====================================================
+
+export interface FacetWithValues_translations {
+  __typename: "FacetTranslation";
+  id: string;
+  languageCode: LanguageCode;
+  name: string;
+}
+
+export interface FacetWithValues_values_translations {
+  __typename: "FacetValueTranslation";
+  id: string;
+  languageCode: LanguageCode;
+  name: string;
+}
+
+export interface FacetWithValues_values {
+  __typename: "FacetValue";
+  id: string;
+  languageCode: LanguageCode | null;
+  code: string;
+  name: string;
+  translations: FacetWithValues_values_translations[];
+}
+
+export interface FacetWithValues {
+  __typename: "Facet";
+  id: string;
+  languageCode: LanguageCode;
+  code: string;
+  name: string;
+  translations: FacetWithValues_translations[];
+  values: FacetWithValues_values[];
+}
+
+/* tslint:disable */
+// This file was automatically generated and should not be edited.
+
+// ====================================================
+// GraphQL fragment: ProductVariant
+// ====================================================
+
+export interface ProductVariant_options {
+  __typename: "ProductOption";
+  id: string;
+  code: string | null;
+  languageCode: LanguageCode | null;
+  name: string | null;
+}
+
+export interface ProductVariant_facetValues {
+  __typename: "FacetValue";
+  id: string;
+  code: string;
+  name: string;
+}
+
+export interface ProductVariant_translations {
+  __typename: "ProductVariantTranslation";
+  id: string;
+  languageCode: LanguageCode;
+  name: string;
+}
+
+export interface ProductVariant {
+  __typename: "ProductVariant";
+  id: string;
+  languageCode: LanguageCode;
+  name: string;
+  price: number;
+  sku: string;
+  image: string | null;
+  options: ProductVariant_options[];
+  facetValues: ProductVariant_facetValues[];
+  translations: ProductVariant_translations[];
+}
+
+/* tslint:disable */
+// This file was automatically generated and should not be edited.
+
+// ====================================================
+// GraphQL fragment: ProductWithVariants
+// ====================================================
+
+export interface ProductWithVariants_translations {
+  __typename: "ProductTranslation";
+  languageCode: LanguageCode;
+  name: string;
+  slug: string;
+  description: string | null;
+}
+
+export interface ProductWithVariants_optionGroups {
+  __typename: "ProductOptionGroup";
+  id: string;
+  languageCode: LanguageCode;
+  code: string;
+  name: string;
+}
+
+export interface ProductWithVariants_variants_options {
+  __typename: "ProductOption";
+  id: string;
+  code: string | null;
+  languageCode: LanguageCode | null;
+  name: string | null;
+}
+
+export interface ProductWithVariants_variants_facetValues {
+  __typename: "FacetValue";
+  id: string;
+  code: string;
+  name: string;
+}
+
+export interface ProductWithVariants_variants_translations {
+  __typename: "ProductVariantTranslation";
+  id: string;
+  languageCode: LanguageCode;
+  name: string;
+}
+
+export interface ProductWithVariants_variants {
+  __typename: "ProductVariant";
+  id: string;
+  languageCode: LanguageCode;
+  name: string;
+  price: number;
+  sku: string;
+  image: string | null;
+  options: ProductWithVariants_variants_options[];
+  facetValues: ProductWithVariants_variants_facetValues[];
+  translations: ProductWithVariants_variants_translations[];
+}
+
+export interface ProductWithVariants {
+  __typename: "Product";
+  id: string;
+  languageCode: LanguageCode;
+  name: string;
+  slug: string;
+  image: string;
+  description: string;
+  translations: ProductWithVariants_translations[];
+  optionGroups: ProductWithVariants_optionGroups[];
+  variants: ProductWithVariants_variants[];
+}
+
+/* tslint:disable */
+// This file was automatically generated and should not be edited.
+
+// ====================================================
+// GraphQL fragment: ProductOptionGroup
+// ====================================================
+
+export interface ProductOptionGroup_translations {
+  __typename: "ProductOptionGroupTranslation";
+  name: string;
+}
+
+export interface ProductOptionGroup_options_translations {
+  __typename: "ProductOptionTranslation";
+  name: string;
+}
+
+export interface ProductOptionGroup_options {
+  __typename: "ProductOption";
+  id: string;
+  languageCode: LanguageCode | null;
+  name: string | null;
+  code: string | null;
+  translations: ProductOptionGroup_options_translations[];
+}
+
+export interface ProductOptionGroup {
+  __typename: "ProductOptionGroup";
+  id: string;
+  languageCode: LanguageCode;
+  code: string;
+  name: string;
+  translations: ProductOptionGroup_translations[];
+  options: ProductOptionGroup_options[];
+}
+
+/* tslint:disable */
+// This file was automatically generated and should not be edited.
+
+//==============================================================
+// START Enums and Input Objects
+//==============================================================
+
+/**
+ * ISO 639-1 language code
+ */
+export enum LanguageCode {
+  aa = "aa",
+  ab = "ab",
+  ae = "ae",
+  af = "af",
+  ak = "ak",
+  am = "am",
+  an = "an",
+  ar = "ar",
+  as = "as",
+  av = "av",
+  ay = "ay",
+  az = "az",
+  ba = "ba",
+  be = "be",
+  bg = "bg",
+  bh = "bh",
+  bi = "bi",
+  bm = "bm",
+  bn = "bn",
+  bo = "bo",
+  br = "br",
+  bs = "bs",
+  ca = "ca",
+  ce = "ce",
+  ch = "ch",
+  co = "co",
+  cr = "cr",
+  cs = "cs",
+  cu = "cu",
+  cv = "cv",
+  cy = "cy",
+  da = "da",
+  de = "de",
+  dv = "dv",
+  dz = "dz",
+  ee = "ee",
+  el = "el",
+  en = "en",
+  eo = "eo",
+  es = "es",
+  et = "et",
+  eu = "eu",
+  fa = "fa",
+  ff = "ff",
+  fi = "fi",
+  fj = "fj",
+  fo = "fo",
+  fr = "fr",
+  fy = "fy",
+  ga = "ga",
+  gd = "gd",
+  gl = "gl",
+  gn = "gn",
+  gu = "gu",
+  gv = "gv",
+  ha = "ha",
+  he = "he",
+  hi = "hi",
+  ho = "ho",
+  hr = "hr",
+  ht = "ht",
+  hu = "hu",
+  hy = "hy",
+  hz = "hz",
+  ia = "ia",
+  id = "id",
+  ie = "ie",
+  ig = "ig",
+  ii = "ii",
+  ik = "ik",
+  io = "io",
+  is = "is",
+  it = "it",
+  iu = "iu",
+  ja = "ja",
+  jv = "jv",
+  ka = "ka",
+  kg = "kg",
+  ki = "ki",
+  kj = "kj",
+  kk = "kk",
+  kl = "kl",
+  km = "km",
+  kn = "kn",
+  ko = "ko",
+  kr = "kr",
+  ks = "ks",
+  ku = "ku",
+  kv = "kv",
+  kw = "kw",
+  ky = "ky",
+  la = "la",
+  lb = "lb",
+  lg = "lg",
+  li = "li",
+  ln = "ln",
+  lo = "lo",
+  lt = "lt",
+  lu = "lu",
+  lv = "lv",
+  mg = "mg",
+  mh = "mh",
+  mi = "mi",
+  mk = "mk",
+  ml = "ml",
+  mn = "mn",
+  mr = "mr",
+  ms = "ms",
+  mt = "mt",
+  my = "my",
+  na = "na",
+  nb = "nb",
+  nd = "nd",
+  ne = "ne",
+  ng = "ng",
+  nl = "nl",
+  nn = "nn",
+  no = "no",
+  nr = "nr",
+  nv = "nv",
+  ny = "ny",
+  oc = "oc",
+  oj = "oj",
+  om = "om",
+  or = "or",
+  os = "os",
+  pa = "pa",
+  pi = "pi",
+  pl = "pl",
+  ps = "ps",
+  pt = "pt",
+  qu = "qu",
+  rm = "rm",
+  rn = "rn",
+  ro = "ro",
+  ru = "ru",
+  rw = "rw",
+  sa = "sa",
+  sc = "sc",
+  sd = "sd",
+  se = "se",
+  sg = "sg",
+  si = "si",
+  sk = "sk",
+  sl = "sl",
+  sm = "sm",
+  sn = "sn",
+  so = "so",
+  sq = "sq",
+  sr = "sr",
+  ss = "ss",
+  st = "st",
+  su = "su",
+  sv = "sv",
+  sw = "sw",
+  ta = "ta",
+  te = "te",
+  tg = "tg",
+  th = "th",
+  ti = "ti",
+  tk = "tk",
+  tl = "tl",
+  tn = "tn",
+  to = "to",
+  tr = "tr",
+  ts = "ts",
+  tt = "tt",
+  tw = "tw",
+  ty = "ty",
+  ug = "ug",
+  uk = "uk",
+  ur = "ur",
+  uz = "uz",
+  ve = "ve",
+  vi = "vi",
+  vo = "vo",
+  wa = "wa",
+  wo = "wo",
+  xh = "xh",
+  yi = "yi",
+  yo = "yo",
+  za = "za",
+  zh = "zh",
+  zu = "zu",
+}
+
+export enum SortOrder {
+  ASC = "ASC",
+  DESC = "DESC",
+}
+
+export interface BooleanOperators {
+  eq?: boolean | null;
+}
+
+export interface CreateFacetCustomFieldsInput {
+  searchable?: boolean | null;
+}
+
+export interface CreateFacetInput {
+  code: string;
+  translations: FacetTranslationInput[];
+  values?: CreateFacetValueInput[] | null;
+  customFields?: CreateFacetCustomFieldsInput | null;
+}
+
+export interface CreateFacetValueCustomFieldsInput {
+  link?: string | null;
+  available?: boolean | null;
+}
+
+export interface CreateFacetValueInput {
+  facetId: string;
+  code: string;
+  translations: FacetValueTranslationInput[];
+  customFields?: CreateFacetValueCustomFieldsInput | null;
+}
+
+export interface CreateProductCustomFieldsInput {
+  infoUrl?: string | null;
+  downloadable?: boolean | null;
+}
+
+export interface CreateProductInput {
+  image?: string | null;
+  translations: (ProductTranslationInput | null)[];
+  optionGroupCodes?: (string | null)[] | null;
+  customFields?: CreateProductCustomFieldsInput | null;
+}
+
+export interface CreateProductOptionGroupInput {
+  code: string;
+  translations: ProductOptionGroupTranslationInput[];
+  options: CreateProductOptionInput[];
+  customFields?: any | null;
+}
+
+export interface CreateProductOptionInput {
+  code: string;
+  translations: ProductOptionGroupTranslationInput[];
+  customFields?: any | null;
+}
+
+export interface DateOperators {
+  eq?: any | null;
+  before?: any | null;
+  after?: any | null;
+  between?: DateRange | null;
+}
+
+export interface DateRange {
+  start: any;
+  end: any;
+}
+
+export interface FacetFilterParameter {
+  name?: StringOperators | null;
+  code?: StringOperators | null;
+  createdAt?: DateOperators | null;
+  updatedAt?: DateOperators | null;
+  searchable?: BooleanOperators | null;
+}
+
+export interface FacetListOptions {
+  take?: number | null;
+  skip?: number | null;
+  sort?: FacetSortParameter | null;
+  filter?: FacetFilterParameter | null;
+}
+
+export interface FacetSortParameter {
+  id?: SortOrder | null;
+  createdAt?: SortOrder | null;
+  updatedAt?: SortOrder | null;
+  name?: SortOrder | null;
+  code?: SortOrder | null;
+  searchable?: SortOrder | null;
+}
+
+export interface FacetTranslationInput {
+  id?: string | null;
+  languageCode: LanguageCode;
+  name: string;
+  customFields?: any | null;
+}
+
+export interface FacetValueTranslationInput {
+  id?: string | null;
+  languageCode: LanguageCode;
+  name: string;
+  customFields?: any | null;
+}
+
+export interface ProductFilterParameter {
+  name?: StringOperators | null;
+  slug?: StringOperators | null;
+  description?: StringOperators | null;
+  createdAt?: DateOperators | null;
+  updatedAt?: DateOperators | null;
+  infoUrl?: StringOperators | null;
+  downloadable?: BooleanOperators | null;
+  nickname?: StringOperators | null;
+}
+
+export interface ProductListOptions {
+  take?: number | null;
+  skip?: number | null;
+  sort?: ProductSortParameter | null;
+  filter?: ProductFilterParameter | null;
+}
+
+export interface ProductOptionGroupTranslationInput {
+  id?: string | null;
+  languageCode: LanguageCode;
+  name: string;
+  customFields?: any | null;
+}
+
+export interface ProductSortParameter {
+  id?: SortOrder | null;
+  createdAt?: SortOrder | null;
+  updatedAt?: SortOrder | null;
+  name?: SortOrder | null;
+  slug?: SortOrder | null;
+  description?: SortOrder | null;
+  image?: SortOrder | null;
+  infoUrl?: SortOrder | null;
+  downloadable?: SortOrder | null;
+  nickname?: SortOrder | null;
+}
+
+export interface ProductTranslationCustomFieldsInput {
+  nickname?: string | null;
+}
+
+export interface ProductTranslationInput {
+  id?: string | null;
+  languageCode: LanguageCode;
+  name: string;
+  slug?: string | null;
+  description?: string | null;
+  customFields?: ProductTranslationCustomFieldsInput | null;
+}
+
+export interface ProductVariantTranslationInput {
+  id?: string | null;
+  languageCode: LanguageCode;
+  name: string;
+  customFields?: any | null;
+}
+
+export interface StringOperators {
+  eq?: string | null;
+  contains?: string | null;
+}
+
+export interface UpdateFacetCustomFieldsInput {
+  searchable?: boolean | null;
+}
+
+export interface UpdateFacetInput {
+  id: string;
+  code: string;
+  translations: FacetTranslationInput[];
+  customFields?: UpdateFacetCustomFieldsInput | null;
+}
+
+export interface UpdateFacetValueCustomFieldsInput {
+  link?: string | null;
+  available?: boolean | null;
+}
+
+export interface UpdateFacetValueInput {
+  id: string;
+  code: string;
+  translations: FacetValueTranslationInput[];
+  customFields?: UpdateFacetValueCustomFieldsInput | null;
+}
+
+export interface UpdateProductCustomFieldsInput {
+  infoUrl?: string | null;
+  downloadable?: boolean | null;
+}
+
+export interface UpdateProductInput {
+  id: string;
+  image?: string | null;
+  translations: (ProductTranslationInput | null)[];
+  optionGroupCodes?: (string | null)[] | null;
+  customFields?: UpdateProductCustomFieldsInput | null;
+}
+
+export interface UpdateProductVariantInput {
+  id: string;
+  translations: ProductVariantTranslationInput[];
+  sku: string;
+  image?: string | null;
+  price: number;
+  customFields?: any | null;
+}
+
+//==============================================================
+// END Enums and Input Objects
+//==============================================================

+ 15 - 0
tsconfig.json

@@ -0,0 +1,15 @@
+{
+  "compilerOptions": {
+    "module": "commonjs",
+    "noLib": false,
+    "skipLibCheck": true,
+    "lib": ["es2017"],
+    "allowSyntheticDefaultImports": true,
+    "emitDecoratorMetadata": true,
+    "experimentalDecorators": true,
+    "target": "es6",
+    "strict": true,
+    "strictPropertyInitialization": false,
+    "sourceMap": false
+  }
+}

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 835 - 3
yarn.lock


Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio