Ver código fonte

feat(core): Update import CSV format to include stock fields

Relates to #81
Michael Bromley 6 anos atrás
pai
commit
3f732abcd1
24 arquivos alterados com 640 adições e 585 exclusões
  1. 62 0
      packages/core/e2e/__snapshots__/import.e2e-spec.ts.snap
  2. 22 22
      packages/core/e2e/fixtures/e2e-products-collections.csv
  3. 1 1
      packages/core/e2e/fixtures/e2e-products-empty.csv
  4. 35 35
      packages/core/e2e/fixtures/e2e-products-full.csv
  5. 5 5
      packages/core/e2e/fixtures/e2e-products-minimal.csv
  6. 7 0
      packages/core/e2e/fixtures/e2e-products-stock-control.csv
  7. 11 11
      packages/core/e2e/fixtures/product-import.csv
  8. 12 1
      packages/core/e2e/import.e2e-spec.ts
  9. 1 1
      packages/core/e2e/stock-control.e2e-spec.ts
  10. 40 40
      packages/core/mock-data/data-sources/products.csv
  11. 54 0
      packages/core/src/data-import/providers/import-parser/__snapshots__/import-parser.spec.ts.snap
  12. 2 2
      packages/core/src/data-import/providers/import-parser/import-parser.spec.ts
  13. 20 0
      packages/core/src/data-import/providers/import-parser/import-parser.ts
  14. 4 4
      packages/core/src/data-import/providers/import-parser/test-fixtures/custom-fields.csv
  15. 5 5
      packages/core/src/data-import/providers/import-parser/test-fixtures/invalid-option-values.csv
  16. 4 4
      packages/core/src/data-import/providers/import-parser/test-fixtures/invalid-row-length.csv
  17. 11 11
      packages/core/src/data-import/providers/import-parser/test-fixtures/multiple-products-multiple-variants.csv
  18. 4 4
      packages/core/src/data-import/providers/import-parser/test-fixtures/single-product-multiple-variants.csv
  19. 2 2
      packages/core/src/data-import/providers/import-parser/test-fixtures/single-product-single-variant.csv
  20. 2 0
      packages/core/src/data-import/providers/importer/importer.ts
  21. 6 2
      packages/core/src/service/services/product-variant.service.ts
  22. 4 4
      packages/core/src/service/services/stock-movement.service.ts
  23. 0 0
      schema-admin.json
  24. 326 431
      schema.json

+ 62 - 0
packages/core/e2e/__snapshots__/import.e2e-spec.ts.snap

@@ -63,10 +63,15 @@ Array [
         ],
         ],
         "price": 4530,
         "price": 4530,
         "sku": "PPS12",
         "sku": "PPS12",
+        "stockMovements": Object {
+          "items": Array [],
+        },
+        "stockOnHand": 0,
         "taxCategory": Object {
         "taxCategory": Object {
           "id": "T_1",
           "id": "T_1",
           "name": "Standard Tax",
           "name": "Standard Tax",
         },
         },
+        "trackInventory": false,
       },
       },
       Object {
       Object {
         "assets": Array [],
         "assets": Array [],
@@ -101,10 +106,15 @@ Array [
         ],
         ],
         "price": 3250,
         "price": 3250,
         "sku": "PPS14",
         "sku": "PPS14",
+        "stockMovements": Object {
+          "items": Array [],
+        },
+        "stockOnHand": 0,
         "taxCategory": Object {
         "taxCategory": Object {
           "id": "T_1",
           "id": "T_1",
           "name": "Standard Tax",
           "name": "Standard Tax",
         },
         },
+        "trackInventory": false,
       },
       },
       Object {
       Object {
         "assets": Array [],
         "assets": Array [],
@@ -139,10 +149,21 @@ Array [
         ],
         ],
         "price": 5950,
         "price": 5950,
         "sku": "PPSF",
         "sku": "PPSF",
+        "stockMovements": Object {
+          "items": Array [
+            Object {
+              "id": "T_1",
+              "quantity": -10,
+              "type": "ADJUSTMENT",
+            },
+          ],
+        },
+        "stockOnHand": -10,
         "taxCategory": Object {
         "taxCategory": Object {
           "id": "T_1",
           "id": "T_1",
           "name": "Standard Tax",
           "name": "Standard Tax",
         },
         },
+        "trackInventory": false,
       },
       },
     ],
     ],
   },
   },
@@ -184,10 +205,21 @@ Array [
         "options": Array [],
         "options": Array [],
         "price": 91070,
         "price": 91070,
         "sku": "M02",
         "sku": "M02",
+        "stockMovements": Object {
+          "items": Array [
+            Object {
+              "id": "T_2",
+              "quantity": 100,
+              "type": "ADJUSTMENT",
+            },
+          ],
+        },
+        "stockOnHand": 100,
         "taxCategory": Object {
         "taxCategory": Object {
           "id": "T_1",
           "id": "T_1",
           "name": "Standard Tax",
           "name": "Standard Tax",
         },
         },
+        "trackInventory": false,
       },
       },
     ],
     ],
   },
   },
@@ -239,10 +271,15 @@ Array [
         ],
         ],
         "price": 416,
         "price": 416,
         "sku": "225400",
         "sku": "225400",
+        "stockMovements": Object {
+          "items": Array [],
+        },
+        "stockOnHand": 0,
         "taxCategory": Object {
         "taxCategory": Object {
           "id": "T_1",
           "id": "T_1",
           "name": "Standard Tax",
           "name": "Standard Tax",
         },
         },
+        "trackInventory": false,
       },
       },
       Object {
       Object {
         "assets": Array [
         "assets": Array [
@@ -276,10 +313,15 @@ Array [
         ],
         ],
         "price": 624,
         "price": 624,
         "sku": "225600",
         "sku": "225600",
+        "stockMovements": Object {
+          "items": Array [],
+        },
+        "stockOnHand": 0,
         "taxCategory": Object {
         "taxCategory": Object {
           "id": "T_1",
           "id": "T_1",
           "name": "Standard Tax",
           "name": "Standard Tax",
         },
         },
+        "trackInventory": false,
       },
       },
     ],
     ],
   },
   },
@@ -339,10 +381,15 @@ Array [
         ],
         ],
         "price": 1199,
         "price": 1199,
         "sku": "10112",
         "sku": "10112",
+        "stockMovements": Object {
+          "items": Array [],
+        },
+        "stockOnHand": 0,
         "taxCategory": Object {
         "taxCategory": Object {
           "id": "T_2",
           "id": "T_2",
           "name": "Reduced Tax",
           "name": "Reduced Tax",
         },
         },
+        "trackInventory": false,
       },
       },
       Object {
       Object {
         "assets": Array [],
         "assets": Array [],
@@ -362,10 +409,15 @@ Array [
         ],
         ],
         "price": 1199,
         "price": 1199,
         "sku": "10113",
         "sku": "10113",
+        "stockMovements": Object {
+          "items": Array [],
+        },
+        "stockOnHand": 0,
         "taxCategory": Object {
         "taxCategory": Object {
           "id": "T_2",
           "id": "T_2",
           "name": "Reduced Tax",
           "name": "Reduced Tax",
         },
         },
+        "trackInventory": false,
       },
       },
       Object {
       Object {
         "assets": Array [],
         "assets": Array [],
@@ -385,10 +437,15 @@ Array [
         ],
         ],
         "price": 1199,
         "price": 1199,
         "sku": "10114",
         "sku": "10114",
+        "stockMovements": Object {
+          "items": Array [],
+        },
+        "stockOnHand": 0,
         "taxCategory": Object {
         "taxCategory": Object {
           "id": "T_2",
           "id": "T_2",
           "name": "Reduced Tax",
           "name": "Reduced Tax",
         },
         },
+        "trackInventory": false,
       },
       },
       Object {
       Object {
         "assets": Array [],
         "assets": Array [],
@@ -408,10 +465,15 @@ Array [
         ],
         ],
         "price": 1199,
         "price": 1199,
         "sku": "10115",
         "sku": "10115",
+        "stockMovements": Object {
+          "items": Array [],
+        },
+        "stockOnHand": 0,
         "taxCategory": Object {
         "taxCategory": Object {
           "id": "T_2",
           "id": "T_2",
           "name": "Reduced Tax",
           "name": "Reduced Tax",
         },
         },
+        "trackInventory": false,
       },
       },
     ],
     ],
   },
   },

+ 22 - 22
packages/core/e2e/fixtures/e2e-products-collections.csv

@@ -1,22 +1,22 @@
-name            , slug            , description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   , assets                             , facets                                             , optionGroups      , optionValues        , sku          , price   , taxCategory , variantAssets , variantFacets
-Laptop          , laptop          , "Now equipped with seventh-generation Intel Core processors, Laptop is snappier than ever. From daily tasks like launching apps and opening files to more advanced computing, you can power through your day thanks to faster SSDs and Turbo Boost processing up to 3.6GHz."                                                                                                                                                                                                                  , derick-david-409858-unsplash.jpg   , category:electronics|category:computers|brand:pear , "screen size|RAM" , "13 inch|8GB"       , L2201308     , 1299.00 , standard    ,               ,
-                ,                 ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                                    ,                   , "15 inch|8GB"       , L2201508     , 1399.00 , standard    ,               ,
-                ,                 ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                                    ,                   , "13 inch|16GB"      , L2201316     , 2199.00 , standard    ,               ,
-                ,                 ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                                    ,                   , "15 inch|16GB"      , L2201516     , 2299.00 , standard    ,               ,
-Curvy Monitor   , curvy-monitor   , "Discover a truly immersive viewing experience with this monitor curved more deeply than any other. Wrapping around your field of vision the 1,800 R screencreates a wider field of view, enhances depth perception, and minimises peripheral distractions to draw you deeper in to your content."                                                                                                                                                                                            , alexandru-acea-686569-unsplash.jpg , category:electronics|category:computers|brand:bell , monitor size      , 24 inch             , C24F390      , 143.74  , standard    ,               ,
-                ,                 ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                                    ,                   , 27 inch             , C27F390      , 169.94  , standard    ,               ,
-Gaming PC       , gaming-pc       , "This pc is optimised for gaming, and is also VR ready. The Intel Core-i7 CPU and High Performance GPU give the computer the raw power it needs to function at a high level."                                                                                                                                                                                                                                                                                                                 , florian-olivo-1166419-unsplash.jpg , category:electronics|category:computers            , "cpu|HDD"         , "i7-8700|240GB SSD" , CGS480VR1063 , 1087.20 , standard    ,               ,
-                ,                 ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                                    ,                   , "R7-2700|240GB SSD" , CGS480VR1064 , 1099.95 , standard    ,               ,
-                ,                 ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                                    ,                   , "i7-8700|120GB SSD" , CGS480VR1065 , 931.20  , standard    ,               ,
-                ,                 ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                                    ,                   , "R7-2700|120GB SSD" , CGS480VR1066 , 949.20  , standard    ,               ,
-Hard Drive      , hard-drive      , "Boost your PC storage with this internal hard drive, designed just for desktop and all-in-one PCs."                                                                                                                                                                                                                                                                                                                                                                                          , vincent-botta-736919-unsplash.jpg  , category:electronics|category:computers            , "HDD capacity"    , 1TB                 , IHD455T1     , 37.99   , standard    ,               ,
-                ,                 ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                                    ,                   , 2TB                 , IHD455T2     , 53.74   , standard    ,               ,
-                ,                 ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                                    ,                   , 3TB                 , IHD455T3     , 78.96   , standard    ,               ,
-                ,                 ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                                    ,                   , 4TB                 , IHD455T4     , 92.99   , standard    ,               ,
-                ,                 ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                                    ,                   , 6TB                 , IHD455T6     , 134.35  , standard    ,               ,
-Clacky Keyboard , clacky-keyboard , "Let all your colleagues know that you are typing on this exclusive, colorful klicky-klacky keyboard. Huge travel on each keypress ensures maximum klack on each and every keystroke."                                                                                                                                                                                                                                                                                                        ,                                    , category:electronics|category:computers            ,                   ,                     , A4TKLA45535  , 74.89   , standard    ,               ,
-USB Cable       , usb-cable       , "Solid conductors eliminate strand-interaction distortion and reduce jitter. As the surface is made of high-purity silver, the performance is very close to that of a solid silver cable, but priced much closer to solid copper cable."                                                                                                                                                                                                                                                      ,                                    , category:electronics|category:computers            ,                   ,                     , USBCIN01.5MI , 69.00   , standard    ,               ,
-Instant Camera  , instant-camera  , "With its nostalgic design and simple point-and-shoot functionality, the Instant Camera is the perfect pick to get started with instant photography."                                                                                                                                                                                                                                                                                                                                         ,                                    , category:electronics|category:photo                ,                   ,                     , IC22MWDD     , 174.99  , standard    ,               , brand:pear
-Camera Lens     , camera-lens     , "This lens is a Di type lens using an optical system with improved multi-coating designed to function with digital SLR cameras as well as film cameras."                                                                                                                                                                                                                                                                                                                                      ,                                    , category:electronics|category:photo                ,                   ,                     , B0012UUP02   , 104.00  , standard    ,               ,
-Tripod          , tripod          , "Capture vivid, professional-style photographs with help from this lightweight tripod. The adjustable-height tripod makes it easy to achieve reliable stability and score just the right angle when going after that award-winning shot."                                                                                                                                                                                                                                                     ,                                    , category:electronics|category:photo|brand:bell     ,                   ,                     , B00XI87KV8   , 14.98   , standard    ,               ,
-SLR Camera      , slr-camera      , "Retro styled, portable in size and built around a powerful 24-megapixel APS-C CMOS sensor, this digital camera is the ideal companion for creative everyday photography. Packed full of high spec features such as an advanced hybrid autofocus system able to keep pace with even the most active subjects, a speedy 6fps continuous-shooting mode, high-resolution electronic viewfinder and intuitive swivelling touchscreen, it brings professional image making into everyone’s grasp." ,                                    , category:electronics|category:photo|brand:bell     ,                   ,                     , B07D75V44S   , 521.00  , standard    ,               ,
+name            , slug            , description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   , assets                             , facets                                             , optionGroups      , optionValues        , sku          , price   , taxCategory , stockOnHand , trackInventory , variantAssets , variantFacets
+Laptop          , laptop          , "Now equipped with seventh-generation Intel Core processors, Laptop is snappier than ever. From daily tasks like launching apps and opening files to more advanced computing, you can power through your day thanks to faster SSDs and Turbo Boost processing up to 3.6GHz."                                                                                                                                                                                                                  , derick-david-409858-unsplash.jpg   , category:electronics|category:computers|brand:pear , "screen size|RAM" , "13 inch|8GB"       , L2201308     , 1299.00 , standard    , 0           , false          ,               ,
+                ,                 ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                                    ,                   , "15 inch|8GB"       , L2201508     , 1399.00 , standard    , 0           , false          ,               ,
+                ,                 ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                                    ,                   , "13 inch|16GB"      , L2201316     , 2199.00 , standard    , 0           , false          ,               ,
+                ,                 ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                                    ,                   , "15 inch|16GB"      , L2201516     , 2299.00 , standard    , 0           , false          ,               ,
+Curvy Monitor   , curvy-monitor   , "Discover a truly immersive viewing experience with this monitor curved more deeply than any other. Wrapping around your field of vision the 1,800 R screencreates a wider field of view, enhances depth perception, and minimises peripheral distractions to draw you deeper in to your content."                                                                                                                                                                                            , alexandru-acea-686569-unsplash.jpg , category:electronics|category:computers|brand:bell , monitor size      , 24 inch             , C24F390      , 143.74  , standard    , 0           , false          ,               ,
+                ,                 ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                                    ,                   , 27 inch             , C27F390      , 169.94  , standard    , 0           , false          ,               ,
+Gaming PC       , gaming-pc       , "This pc is optimised for gaming, and is also VR ready. The Intel Core-i7 CPU and High Performance GPU give the computer the raw power it needs to function at a high level."                                                                                                                                                                                                                                                                                                                 , florian-olivo-1166419-unsplash.jpg , category:electronics|category:computers            , "cpu|HDD"         , "i7-8700|240GB SSD" , CGS480VR1063 , 1087.20 , standard    , 0           , false          ,               ,
+                ,                 ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                                    ,                   , "R7-2700|240GB SSD" , CGS480VR1064 , 1099.95 , standard    , 0           , false          ,               ,
+                ,                 ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                                    ,                   , "i7-8700|120GB SSD" , CGS480VR1065 , 931.20  , standard    , 0           , false          ,               ,
+                ,                 ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                                    ,                   , "R7-2700|120GB SSD" , CGS480VR1066 , 949.20  , standard    , 0           , false          ,               ,
+Hard Drive      , hard-drive      , "Boost your PC storage with this internal hard drive, designed just for desktop and all-in-one PCs."                                                                                                                                                                                                                                                                                                                                                                                          , vincent-botta-736919-unsplash.jpg  , category:electronics|category:computers            , "HDD capacity"    , 1TB                 , IHD455T1     , 37.99   , standard    , 0           , false          ,               ,
+                ,                 ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                                    ,                   , 2TB                 , IHD455T2     , 53.74   , standard    , 0           , false          ,               ,
+                ,                 ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                                    ,                   , 3TB                 , IHD455T3     , 78.96   , standard    , 0           , false          ,               ,
+                ,                 ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                                    ,                   , 4TB                 , IHD455T4     , 92.99   , standard    , 0           , false          ,               ,
+                ,                 ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                                    ,                   , 6TB                 , IHD455T6     , 134.35  , standard    , 0           , false          ,               ,
+Clacky Keyboard , clacky-keyboard , "Let all your colleagues know that you are typing on this exclusive, colorful klicky-klacky keyboard. Huge travel on each keypress ensures maximum klack on each and every keystroke."                                                                                                                                                                                                                                                                                                        ,                                    , category:electronics|category:computers            ,                   ,                     , A4TKLA45535  , 74.89   , standard    , 0           , false          ,               ,
+USB Cable       , usb-cable       , "Solid conductors eliminate strand-interaction distortion and reduce jitter. As the surface is made of high-purity silver, the performance is very close to that of a solid silver cable, but priced much closer to solid copper cable."                                                                                                                                                                                                                                                      ,                                    , category:electronics|category:computers            ,                   ,                     , USBCIN01.5MI , 69.00   , standard    , 0           , false          ,               ,
+Instant Camera  , instant-camera  , "With its nostalgic design and simple point-and-shoot functionality, the Instant Camera is the perfect pick to get started with instant photography."                                                                                                                                                                                                                                                                                                                                         ,                                    , category:electronics|category:photo                ,                   ,                     , IC22MWDD     , 174.99  , standard    , 0           , false          ,               , brand:pear
+Camera Lens     , camera-lens     , "This lens is a Di type lens using an optical system with improved multi-coating designed to function with digital SLR cameras as well as film cameras."                                                                                                                                                                                                                                                                                                                                      ,                                    , category:electronics|category:photo                ,                   ,                     , B0012UUP02   , 104.00  , standard    , 0           , false          ,               ,
+Tripod          , tripod          , "Capture vivid, professional-style photographs with help from this lightweight tripod. The adjustable-height tripod makes it easy to achieve reliable stability and score just the right angle when going after that award-winning shot."                                                                                                                                                                                                                                                     ,                                    , category:electronics|category:photo|brand:bell     ,                   ,                     , B00XI87KV8   , 14.98   , standard    , 0           , false          ,               ,
+SLR Camera      , slr-camera      , "Retro styled, portable in size and built around a powerful 24-megapixel APS-C CMOS sensor, this digital camera is the ideal companion for creative everyday photography. Packed full of high spec features such as an advanced hybrid autofocus system able to keep pace with even the most active subjects, a speedy 6fps continuous-shooting mode, high-resolution electronic viewfinder and intuitive swivelling touchscreen, it brings professional image making into everyone’s grasp." ,                                    , category:electronics|category:photo|brand:bell     ,                   ,                     , B07D75V44S   , 521.00  , standard    , 0           , false          ,               ,

+ 1 - 1
packages/core/e2e/fixtures/e2e-products-empty.csv

@@ -1 +1 @@
-name                 , slug                 , description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   , assets                                      , facets                                    , optionGroups       , optionValues         , sku          , price   , taxCategory , variantAssets , variantFacets
+name , slug , description , assets , facets , optionGroups , optionValues , sku , price , taxCategory , stockOnHand, trackInventory, variantAssets , variantFacets

+ 35 - 35
packages/core/e2e/fixtures/e2e-products-full.csv

@@ -1,35 +1,35 @@
-name               , slug               , description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   , assets                             , facets                                  , optionGroups      , optionValues        , sku          , price   , taxCategory , variantAssets , variantFacets
-Laptop             , laptop             , "Now equipped with seventh-generation Intel Core processors, Laptop is snappier than ever. From daily tasks like launching apps and opening files to more advanced computing, you can power through your day thanks to faster SSDs and Turbo Boost processing up to 3.6GHz."                                                                                                                                                                                                                  , derick-david-409858-unsplash.jpg   , category:electronics|category:computers , "screen size|RAM" , "13 inch|8GB"       , L2201308     , 1299.00 , standard    ,               ,
-                   ,                    ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                         ,                   , "15 inch|8GB"       , L2201508     , 1399.00 , standard    ,               ,
-                   ,                    ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                         ,                   , "13 inch|16GB"      , L2201316     , 2199.00 , standard    ,               ,
-                   ,                    ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                         ,                   , "15 inch|16GB"      , L2201516     , 2299.00 , standard    ,               ,
-Curvy Monitor      , curvy-monitor      , "Discover a truly immersive viewing experience with this monitor curved more deeply than any other. Wrapping around your field of vision the 1,800 R screencreates a wider field of view, enhances depth perception, and minimises peripheral distractions to draw you deeper in to your content."                                                                                                                                                                                            , alexandru-acea-686569-unsplash.jpg , category:electronics|category:computers , monitor size      , 24 inch             , C24F390      , 143.74  , standard    ,               ,
-                   ,                    ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                         ,                   , 27 inch             , C27F390      , 169.94  , standard    ,               ,
-Gaming PC          , gaming-pc          , "This pc is optimised for gaming, and is also VR ready. The Intel Core-i7 CPU and High Performance GPU give the computer the raw power it needs to function at a high level."                                                                                                                                                                                                                                                                                                                 , florian-olivo-1166419-unsplash.jpg , category:electronics|category:computers , "cpu|HDD"         , "i7-8700|240GB SSD" , CGS480VR1063 , 1087.20 , standard    ,               ,
-                   ,                    ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                         ,                   , "R7-2700|240GB SSD" , CGS480VR1064 , 1099.95 , standard    ,               ,
-                   ,                    ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                         ,                   , "i7-8700|120GB SSD" , CGS480VR1065 , 931.20  , standard    ,               ,
-                   ,                    ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                         ,                   , "R7-2700|120GB SSD" , CGS480VR1066 , 949.20  , standard    ,               ,
-Hard Drive         , hard-drive         , "Boost your PC storage with this internal hard drive, designed just for desktop and all-in-one PCs."                                                                                                                                                                                                                                                                                                                                                                                          , vincent-botta-736919-unsplash.jpg  , category:electronics|category:computers , "HDD capacity"    , 1TB                 , IHD455T1     , 37.99   , standard    ,               ,
-                   ,                    ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                         ,                   , 2TB                 , IHD455T2     , 53.74   , standard    ,               ,
-                   ,                    ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                         ,                   , 3TB                 , IHD455T3     , 78.96   , standard    ,               ,
-                   ,                    ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                         ,                   , 4TB                 , IHD455T4     , 92.99   , standard    ,               ,
-                   ,                    ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                         ,                   , 6TB                 , IHD455T6     , 134.35  , standard    ,               ,
-Clacky Keyboard    , clacky-keyboard    , "Let all your colleagues know that you are typing on this exclusive, colorful klicky-klacky keyboard. Huge travel on each keypress ensures maximum klack on each and every keystroke."                                                                                                                                                                                                                                                                                                        ,                                    , category:electronics|category:computers ,                   ,                     , A4TKLA45535  , 74.89   , standard    ,               ,
-USB Cable          , usb-cable          , "Solid conductors eliminate strand-interaction distortion and reduce jitter. As the surface is made of high-purity silver, the performance is very close to that of a solid silver cable, but priced much closer to solid copper cable."                                                                                                                                                                                                                                                      ,                                    , category:electronics|category:computers ,                   ,                     , USBCIN01.5MI , 69.00   , standard    ,               ,
-Instant Camera     , instant-camera     , "With its nostalgic design and simple point-and-shoot functionality, the Instant Camera is the perfect pick to get started with instant photography."                                                                                                                                                                                                                                                                                                                                         ,                                    , category:electronics|category:photo     ,                   ,                     , IC22MWDD     , 174.99  , standard    ,               ,
-Camera Lens        , camera-lens        , "This lens is a Di type lens using an optical system with improved multi-coating designed to function with digital SLR cameras as well as film cameras."                                                                                                                                                                                                                                                                                                                                      ,                                    , category:electronics|category:photo     ,                   ,                     , B0012UUP02   , 104.00  , standard    ,               ,
-Tripod             , tripod             , "Capture vivid, professional-style photographs with help from this lightweight tripod. The adjustable-height tripod makes it easy to achieve reliable stability and score just the right angle when going after that award-winning shot."                                                                                                                                                                                                                                                     ,                                    , category:electronics|category:photo     ,                   ,                     , B00XI87KV8   , 14.98   , standard    ,               ,
-SLR Camera         , slr-camera         , "Retro styled, portable in size and built around a powerful 24-megapixel APS-C CMOS sensor, this digital camera is the ideal companion for creative everyday photography. Packed full of high spec features such as an advanced hybrid autofocus system able to keep pace with even the most active subjects, a speedy 6fps continuous-shooting mode, high-resolution electronic viewfinder and intuitive swivelling touchscreen, it brings professional image making into everyone’s grasp." ,                                    , category:electronics|category:photo     ,                   ,                     , B07D75V44S   , 521.00  , standard    ,               ,
-Road Bike          , road-bike          , "Featuring a full carbon chassis - complete with cyclocross-specific carbon fork - and a component setup geared for hard use on the race circuit, it's got the low weight, exceptional efficiency and brilliant handling you'll need to stay at the front of the pack."                                                                                                                                                                                                                       ,                                    , category:sports equipment               ,                   ,                     , RB000844334  , 2499.00 , standard    ,               ,
-Skipping Rope      , skipping-rope      , "When you're working out you need a quality rope that doesn't tangle at every couple of jumps and with this sipping rope you won't have this problem."                                                                                                                                                                                                                                                                                                                                        ,                                    , category:sports equipment               ,                   ,                     , B07CNGXVXT   , 7.99    , standard    ,               ,
-Boxing Gloves      , boxing-gloves      , "Training gloves designed for optimum training. Our gloves promote proper punching technique because they are conformed to the natural shape of your fist. Dense, innovative two-layer foam provides better shock absorbency and full padding on the front, back and wrist to promote proper punching technique."                                                                                                                                                                             ,                                    , category:sports equipment               ,                   ,                     , B000ZYLPPU   , 33.04   , standard    ,               ,
-Tent               , tent               , "With tons of space inside (for max. 4 persons), full head height throughout the entire tent and an unusual and striking shape, this tent offers you everything you need."                                                                                                                                                                                                                                                                                                                    ,                                    , category:sports equipment               ,                   ,                     , 2000023510   , 214.93  , standard    ,               ,
-Cruiser Skateboard , cruiser-skateboard , "Based on the 1970s iconic shape, but made to a larger 69cm size, with updated, quality component, these skateboards are great for beginners to learn the foot spacing required, and are perfect for all-day cruising."                                                                                                                                                                                                                                                                       ,                                    , category:sports equipment               ,                   ,                     , 799872520    , 24.99   , standard    ,               ,
-Football           , football           , "This football features high-contrast graphics for high-visibility during play, while its machine-stitched tpu casing offers consistent performance."                                                                                                                                                                                                                                                                                                                                         ,                                    , category:sports equipment               ,                   ,                     , SC3137-056   , 57.07   , standard    ,               ,
-Running Shoe       , running-shoe       , "With its ultra-light, uber-responsive magic foam and a carbon fiber plate that feels like it’s propelling you forward, the Running Shoe is ready to push you to victories both large and small"                                                                                                                                                                                                                                                                                              ,                                    , category:sports equipment               , shoe size         , Size 40             , RS0040       , 99.99   , standard    ,               ,
-                   ,                    ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                         ,                   , Size 42             , RS0042       , 99.99   , standard    ,               ,
-                   ,                    ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                         ,                   , Size 44             , RS0044       , 99.99   , standard    ,               ,
-                   ,                    ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                         ,                   , Size 46             , RS0046       , 99.99   , standard    ,               ,
-Spiky Cactus       , spiky-cactus       , "A spiky yet elegant house cactus - perfect for the home or office. Origin and habitat: Probably native only to the Andes of Peru"                                                                                                                                                                                                                                                                                                                                                            ,                                    , category:home & garden|category:plants  ,                   ,                     , SC011001     , 15.50   , standard    ,               ,
-Orchid             , orchid             , "Gloriously elegant. It can go along with any interior as it is a neutral color and the most popular Phalaenopsis overall. 2 to 3 foot stems host large white flowers that can last for over 2 months."                                                                                                                                                                                                                                                                                       ,                                    , category:home & garden|category:plants  ,                   ,                     , ROR00221     , 65.00   , standard    ,               ,
-Bonsai Tree        , bonsai-tree        , "Excellent semi-evergreen bonsai. Indoors or out but needs some winter protection. All trees sent will leave the nursery in excellent condition and will be of equal quality or better than the photograph shown."                                                                                                                                                                                                                                                                            ,                                    , category:home & garden|category:plants  ,                   ,                     , B01MXFLUSV   , 19.99   , standard    ,               ,
+name               , slug               , description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   , assets                             , facets                                  , optionGroups      , optionValues        , sku          , price   , taxCategory , stockOnHand , trackInventory , variantAssets , variantFacets
+Laptop             , laptop             , "Now equipped with seventh-generation Intel Core processors, Laptop is snappier than ever. From daily tasks like launching apps and opening files to more advanced computing, you can power through your day thanks to faster SSDs and Turbo Boost processing up to 3.6GHz."                                                                                                                                                                                                                  , derick-david-409858-unsplash.jpg   , category:electronics|category:computers , "screen size|RAM" , "13 inch|8GB"       , L2201308     , 1299.00 , standard    , 100         , false          ,               ,
+                   ,                    ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                         ,                   , "15 inch|8GB"       , L2201508     , 1399.00 , standard    , 100         , false          ,               ,
+                   ,                    ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                         ,                   , "13 inch|16GB"      , L2201316     , 2199.00 , standard    , 100         , false          ,               ,
+                   ,                    ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                         ,                   , "15 inch|16GB"      , L2201516     , 2299.00 , standard    , 100         , false          ,               ,
+Curvy Monitor      , curvy-monitor      , "Discover a truly immersive viewing experience with this monitor curved more deeply than any other. Wrapping around your field of vision the 1,800 R screencreates a wider field of view, enhances depth perception, and minimises peripheral distractions to draw you deeper in to your content."                                                                                                                                                                                            , alexandru-acea-686569-unsplash.jpg , category:electronics|category:computers , monitor size      , 24 inch             , C24F390      , 143.74  , standard    , 100         , false          ,               ,
+                   ,                    ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                         ,                   , 27 inch             , C27F390      , 169.94  , standard    , 100         , false          ,               ,
+Gaming PC          , gaming-pc          , "This pc is optimised for gaming, and is also VR ready. The Intel Core-i7 CPU and High Performance GPU give the computer the raw power it needs to function at a high level."                                                                                                                                                                                                                                                                                                                 , florian-olivo-1166419-unsplash.jpg , category:electronics|category:computers , "cpu|HDD"         , "i7-8700|240GB SSD" , CGS480VR1063 , 1087.20 , standard    , 100         , false          ,               ,
+                   ,                    ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                         ,                   , "R7-2700|240GB SSD" , CGS480VR1064 , 1099.95 , standard    , 100         , false          ,               ,
+                   ,                    ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                         ,                   , "i7-8700|120GB SSD" , CGS480VR1065 , 931.20  , standard    , 100         , false          ,               ,
+                   ,                    ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                         ,                   , "R7-2700|120GB SSD" , CGS480VR1066 , 949.20  , standard    , 100         , false          ,               ,
+Hard Drive         , hard-drive         , "Boost your PC storage with this internal hard drive, designed just for desktop and all-in-one PCs."                                                                                                                                                                                                                                                                                                                                                                                          , vincent-botta-736919-unsplash.jpg  , category:electronics|category:computers , "HDD capacity"    , 1TB                 , IHD455T1     , 37.99   , standard    , 100         , false          ,               ,
+                   ,                    ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                         ,                   , 2TB                 , IHD455T2     , 53.74   , standard    , 100         , false          ,               ,
+                   ,                    ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                         ,                   , 3TB                 , IHD455T3     , 78.96   , standard    , 100         , false          ,               ,
+                   ,                    ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                         ,                   , 4TB                 , IHD455T4     , 92.99   , standard    , 100         , false          ,               ,
+                   ,                    ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                         ,                   , 6TB                 , IHD455T6     , 134.35  , standard    , 100         , false          ,               ,
+Clacky Keyboard    , clacky-keyboard    , "Let all your colleagues know that you are typing on this exclusive, colorful klicky-klacky keyboard. Huge travel on each keypress ensures maximum klack on each and every keystroke."                                                                                                                                                                                                                                                                                                        ,                                    , category:electronics|category:computers ,                   ,                     , A4TKLA45535  , 74.89   , standard    , 100         , false          ,               ,
+USB Cable          , usb-cable          , "Solid conductors eliminate strand-interaction distortion and reduce jitter. As the surface is made of high-purity silver, the performance is very close to that of a solid silver cable, but priced much closer to solid copper cable."                                                                                                                                                                                                                                                      ,                                    , category:electronics|category:computers ,                   ,                     , USBCIN01.5MI , 69.00   , standard    , 100         , false          ,               ,
+Instant Camera     , instant-camera     , "With its nostalgic design and simple point-and-shoot functionality, the Instant Camera is the perfect pick to get started with instant photography."                                                                                                                                                                                                                                                                                                                                         ,                                    , category:electronics|category:photo     ,                   ,                     , IC22MWDD     , 174.99  , standard    , 100         , false          ,               ,
+Camera Lens        , camera-lens        , "This lens is a Di type lens using an optical system with improved multi-coating designed to function with digital SLR cameras as well as film cameras."                                                                                                                                                                                                                                                                                                                                      ,                                    , category:electronics|category:photo     ,                   ,                     , B0012UUP02   , 104.00  , standard    , 100         , false          ,               ,
+Tripod             , tripod             , "Capture vivid, professional-style photographs with help from this lightweight tripod. The adjustable-height tripod makes it easy to achieve reliable stability and score just the right angle when going after that award-winning shot."                                                                                                                                                                                                                                                     ,                                    , category:electronics|category:photo     ,                   ,                     , B00XI87KV8   , 14.98   , standard    , 100         , false          ,               ,
+SLR Camera         , slr-camera         , "Retro styled, portable in size and built around a powerful 24-megapixel APS-C CMOS sensor, this digital camera is the ideal companion for creative everyday photography. Packed full of high spec features such as an advanced hybrid autofocus system able to keep pace with even the most active subjects, a speedy 6fps continuous-shooting mode, high-resolution electronic viewfinder and intuitive swivelling touchscreen, it brings professional image making into everyone’s grasp." ,                                    , category:electronics|category:photo     ,                   ,                     , B07D75V44S   , 521.00  , standard    , 100         , false          ,               ,
+Road Bike          , road-bike          , "Featuring a full carbon chassis - complete with cyclocross-specific carbon fork - and a component setup geared for hard use on the race circuit, it's got the low weight, exceptional efficiency and brilliant handling you'll need to stay at the front of the pack."                                                                                                                                                                                                                       ,                                    , category:sports equipment               ,                   ,                     , RB000844334  , 2499.00 , standard    , 100         , false          ,               ,
+Skipping Rope      , skipping-rope      , "When you're working out you need a quality rope that doesn't tangle at every couple of jumps and with this sipping rope you won't have this problem."                                                                                                                                                                                                                                                                                                                                        ,                                    , category:sports equipment               ,                   ,                     , B07CNGXVXT   , 7.99    , standard    , 100         , false          ,               ,
+Boxing Gloves      , boxing-gloves      , "Training gloves designed for optimum training. Our gloves promote proper punching technique because they are conformed to the natural shape of your fist. Dense, innovative two-layer foam provides better shock absorbency and full padding on the front, back and wrist to promote proper punching technique."                                                                                                                                                                             ,                                    , category:sports equipment               ,                   ,                     , B000ZYLPPU   , 33.04   , standard    , 100         , false          ,               ,
+Tent               , tent               , "With tons of space inside (for max. 4 persons), full head height throughout the entire tent and an unusual and striking shape, this tent offers you everything you need."                                                                                                                                                                                                                                                                                                                    ,                                    , category:sports equipment               ,                   ,                     , 2000023510   , 214.93  , standard    , 100         , false          ,               ,
+Cruiser Skateboard , cruiser-skateboard , "Based on the 1970s iconic shape, but made to a larger 69cm size, with updated, quality component, these skateboards are great for beginners to learn the foot spacing required, and are perfect for all-day cruising."                                                                                                                                                                                                                                                                       ,                                    , category:sports equipment               ,                   ,                     , 799872520    , 24.99   , standard    , 100         , false          ,               ,
+Football           , football           , "This football features high-contrast graphics for high-visibility during play, while its machine-stitched tpu casing offers consistent performance."                                                                                                                                                                                                                                                                                                                                         ,                                    , category:sports equipment               ,                   ,                     , SC3137-056   , 57.07   , standard    , 100         , false          ,               ,
+Running Shoe       , running-shoe       , "With its ultra-light, uber-responsive magic foam and a carbon fiber plate that feels like it’s propelling you forward, the Running Shoe is ready to push you to victories both large and small"                                                                                                                                                                                                                                                                                              ,                                    , category:sports equipment               , shoe size         , Size 40             , RS0040       , 99.99   , standard    , 100         , false          ,               ,
+                   ,                    ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                         ,                   , Size 42             , RS0042       , 99.99   , standard    , 100         , false          ,               ,
+                   ,                    ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                         ,                   , Size 44             , RS0044       , 99.99   , standard    , 100         , false          ,               ,
+                   ,                    ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                    ,                                         ,                   , Size 46             , RS0046       , 99.99   , standard    , 100         , false          ,               ,
+Spiky Cactus       , spiky-cactus       , "A spiky yet elegant house cactus - perfect for the home or office. Origin and habitat: Probably native only to the Andes of Peru"                                                                                                                                                                                                                                                                                                                                                            ,                                    , category:home & garden|category:plants  ,                   ,                     , SC011001     , 15.50   , standard    , 100         , false          ,               ,
+Orchid             , orchid             , "Gloriously elegant. It can go along with any interior as it is a neutral color and the most popular Phalaenopsis overall. 2 to 3 foot stems host large white flowers that can last for over 2 months."                                                                                                                                                                                                                                                                                       ,                                    , category:home & garden|category:plants  ,                   ,                     , ROR00221     , 65.00   , standard    , 100         , false          ,               ,
+Bonsai Tree        , bonsai-tree        , "Excellent semi-evergreen bonsai. Indoors or out but needs some winter protection. All trees sent will leave the nursery in excellent condition and will be of equal quality or better than the photograph shown."                                                                                                                                                                                                                                                                            ,                                    , category:home & garden|category:plants  ,                   ,                     , B01MXFLUSV   , 19.99   , standard    , 100         , false          ,               ,

+ 5 - 5
packages/core/e2e/fixtures/e2e-products-minimal.csv

@@ -1,5 +1,5 @@
-name                 , slug                 , description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   , assets                                      , facets                                    , optionGroups       , optionValues         , sku          , price   , taxCategory , variantAssets , variantFacets
-Laptop               , laptop               , "Now equipped with seventh-generation Intel Core processors, Laptop is snappier than ever. From daily tasks like launching apps and opening files to more advanced computing, you can power through your day thanks to faster SSDs and Turbo Boost processing up to 3.6GHz."                                                                                                                                                                                                                  , derick-david-409858-unsplash.jpg            , category:electronics|category:computers   , "screen size, RAM" , "13 inch, 8GB"       , L2201308     , 1299.00 , standard    ,               ,
-                     ,                      ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                             ,                                           ,                    , "15 inch, 8GB"       , L2201508     , 1399.00 , standard    ,               ,
-                     ,                      ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                             ,                                           ,                    , "13 inch, 16GB"      , L2201316     , 2199.00 , standard    ,               ,
-                     ,                      ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                             ,                                           ,                    , "15 inch, 16GB"      , L2201516     , 2299.00 , standard    ,               ,
+name   , slug   , description                                                                                                                                                                                                                                                                  , assets                           , facets                                  , optionGroups       , optionValues    , sku      , price   , taxCategory , stockOnHand , trackInventory , variantAssets , variantFacets
+Laptop , laptop , "Now equipped with seventh-generation Intel Core processors, Laptop is snappier than ever. From daily tasks like launching apps and opening files to more advanced computing, you can power through your day thanks to faster SSDs and Turbo Boost processing up to 3.6GHz." , derick-david-409858-unsplash.jpg , category:electronics|category:computers , "screen size, RAM" , "13 inch, 8GB"  , L2201308 , 1299.00 , standard    , 100         , false          ,               ,
+       ,        ,                                                                                                                                                                                                                                                                              ,                                  ,                                         ,                    , "15 inch, 8GB"  , L2201508 , 1399.00 , standard    , 100         , false          ,               ,
+       ,        ,                                                                                                                                                                                                                                                                              ,                                  ,                                         ,                    , "13 inch, 16GB" , L2201316 , 2199.00 , standard    , 100         , false          ,               ,
+       ,        ,                                                                                                                                                                                                                                                                              ,                                  ,                                         ,                    , "15 inch, 16GB" , L2201516 , 2299.00 , standard    , 100         , false          ,               ,

+ 7 - 0
packages/core/e2e/fixtures/e2e-products-stock-control.csv

@@ -0,0 +1,7 @@
+name          , slug          , description                                                                                                                                                                                                                                                                                        , assets                             , facets                                  , optionGroups      , optionValues   , sku      , price   , taxCategory , stockOnHand , trackInventory , variantAssets , variantFacets
+Laptop        , laptop        , "Now equipped with seventh-generation Intel Core processors, Laptop is snappier than ever. From daily tasks like launching apps and opening files to more advanced computing, you can power through your day thanks to faster SSDs and Turbo Boost processing up to 3.6GHz."                       , derick-david-409858-unsplash.jpg   , category:electronics|category:computers , "screen size|RAM" , "13 inch|8GB"  , L2201308 , 1299.00 , standard    ,             , false          ,               ,
+              ,               ,                                                                                                                                                                                                                                                                                                    ,                                    ,                                         ,                   , "15 inch|8GB"  , L2201508 , 1399.00 , standard    ,             , false          ,               ,
+              ,               ,                                                                                                                                                                                                                                                                                                    ,                                    ,                                         ,                   , "13 inch|16GB" , L2201316 , 2199.00 , standard    ,             , false          ,               ,
+              ,               ,                                                                                                                                                                                                                                                                                                    ,                                    ,                                         ,                   , "15 inch|16GB" , L2201516 , 2299.00 , standard    ,             , false          ,               ,
+Curvy Monitor , curvy-monitor , "Discover a truly immersive viewing experience with this monitor curved more deeply than any other. Wrapping around your field of vision the 1,800 R screencreates a wider field of view, enhances depth perception, and minimises peripheral distractions to draw you deeper in to your content." , alexandru-acea-686569-unsplash.jpg , category:electronics|category:computers , monitor size      , 24 inch        , C24F390  , 143.74  , standard    ,             , false          ,               ,
+              ,               ,                                                                                                                                                                                                                                                                                                    ,                                    ,                                         ,                   , 27 inch        , C27F390  , 169.94  , standard    ,             , false          ,               ,

+ 11 - 11
packages/core/e2e/fixtures/product-import.csv

@@ -1,12 +1,12 @@
-name                    , slug                    , description                          , assets              , facets                            , optionGroups  , optionValues     , sku    , price , taxCategory , variantAssets   , variantFacets
-Perfect Paper Stretcher , perfect-paper-stretcher , A great device for stretching paper. , "pps1.jpg|pps2.jpg" ,                                   , size          , Half Imperial    , PPS12  , 45.3  , standard    ,                 , Brand:KB|Type:Accessory
-                        ,                         ,                                      ,                     ,                                   ,               , Quarter Imperial , PPS14  , 32.5  , standard    ,                 , Brand:KB|Type:Accessory
-                        ,                         ,                                      ,                     ,                                   ,               , Full Imperial    , PPSF   , 59.5  , standard    ,                 , Brand:KB|Type:Accessory
-Mabef M/02 Studio Easel ,                         , Mabef description                    ,                     ,                                   ,               ,                  , M02    , 910.7 , standard    ,                 , Brand:Mabef|Type:Easel
-Giotto Mega Pencils     ,                         , Really mega pencils                  ,                     ,                                   , box size      , Box of 8         , 225400 , 4.16  , standard    , "box-of-8.jpg"  , Collection:Xmas Sale
-                        ,                         ,                                      ,                     ,                                   ,               , Box of 12        , 225600 , 6.24  , standard    , "box-of-12.jpg" , Collection:Xmas Sale
+name                    , slug                    , description                          , assets              , facets                            , optionGroups  , optionValues     , sku    , price , taxCategory , stockOnHand , trackInventory , variantAssets   , variantFacets
+Perfect Paper Stretcher , perfect-paper-stretcher , A great device for stretching paper. , "pps1.jpg|pps2.jpg" ,                                   , size          , Half Imperial    , PPS12  , 45.3  , standard    , 0           , false          ,                 , Brand:KB|Type:Accessory
+                        ,                         ,                                      ,                     ,                                   ,               , Quarter Imperial , PPS14  , 32.5  , standard    , 0           , false          ,                 , Brand:KB|Type:Accessory
+                        ,                         ,                                      ,                     ,                                   ,               , Full Imperial    , PPSF   , 59.5  , standard    , -10         , false          ,                 , Brand:KB|Type:Accessory
+Mabef M/02 Studio Easel ,                         , Mabef description                    ,                     ,                                   ,               ,                  , M02    , 910.7 , standard    , 100         , false          ,                 , Brand:Mabef|Type:Easel
+Giotto Mega Pencils     ,                         , Really mega pencils                  ,                     ,                                   , box size      , Box of 8         , 225400 , 4.16  , standard    ,             , false          , "box-of-8.jpg"  , Collection:Xmas Sale
+                        ,                         ,                                      ,                     ,                                   ,               , Box of 12        , 225600 , 6.24  , standard    ,             , false          , "box-of-12.jpg" , Collection:Xmas Sale
 
 
-Artists Smock           ,                         , Keeps the paint off the clothes      ,                     , Material:Denim|Collection:clothes , "size|colour" , "small|beige"    , 10112  , 11.99 , reduced     ,                 ,
-                        ,                         ,                                      ,                     ,                                   ,               , "large|beige"    , 10113  , 11.99 , reduced     ,                 ,
-                        ,                         ,                                      ,                     ,                                   ,               , "small|navy"     , 10114  , 11.99 , reduced     ,                 ,
-                        ,                         ,                                      ,                     ,                                   ,               , "large|navy"     , 10115  , 11.99 , reduced     ,                 ,
+Artists Smock           ,                         , Keeps the paint off the clothes      ,                     , Material:Denim|Collection:clothes , "size|colour" , "small|beige"    , 10112  , 11.99 , reduced     ,             , false          ,                 ,
+                        ,                         ,                                      ,                     ,                                   ,               , "large|beige"    , 10113  , 11.99 , reduced     ,             , false          ,                 ,
+                        ,                         ,                                      ,                     ,                                   ,               , "small|navy"     , 10114  , 11.99 , reduced     ,             , false          ,                 ,
+                        ,                         ,                                      ,                     ,                                   ,               , "large|navy"     , 10115  , 11.99 , reduced     ,             , false          ,                 ,

+ 12 - 1
packages/core/e2e/import.e2e-spec.ts

@@ -39,7 +39,7 @@ describe('Import resolver', () => {
         const result = await client.importProducts(csvFile);
         const result = await client.importProducts(csvFile);
 
 
         expect(result.importProducts.errors).toEqual([
         expect(result.importProducts.errors).toEqual([
-            'Invalid Record Length: header length is 12, got 1 on line 8',
+            'Invalid Record Length: header length is 14, got 1 on line 8',
         ]);
         ]);
         expect(result.importProducts.imported).toBe(4);
         expect(result.importProducts.imported).toBe(4);
         expect(result.importProducts.processed).toBe(4);
         expect(result.importProducts.processed).toBe(4);
@@ -105,6 +105,17 @@ describe('Import resolver', () => {
                                         name
                                         name
                                     }
                                     }
                                 }
                                 }
+                                stockOnHand
+                                trackInventory
+                                stockMovements {
+                                    items {
+                                        ...on StockMovement {
+                                            id
+                                            type
+                                            quantity
+                                        }
+                                    }
+                                }
                             }
                             }
                         }
                         }
                     }
                     }

+ 1 - 1
packages/core/e2e/stock-control.e2e-spec.ts

@@ -21,7 +21,7 @@ describe('Stock control', () => {
     beforeAll(async () => {
     beforeAll(async () => {
         const token = await server.init(
         const token = await server.init(
             {
             {
-                productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-full.csv'),
+                productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-stock-control.csv'),
                 customerCount: 2,
                 customerCount: 2,
             },
             },
             {
             {

+ 40 - 40
packages/core/mock-data/data-sources/products.csv

@@ -1,40 +1,40 @@
-name                 , slug                 , description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   , assets                                      , facets                                    , optionGroups      , optionValues        , sku          , price   , taxCategory , variantAssets , variantFacets
-Laptop               , laptop               , "Now equipped with seventh-generation Intel Core processors, Laptop is snappier than ever. From daily tasks like launching apps and opening files to more advanced computing, you can power through your day thanks to faster SSDs and Turbo Boost processing up to 3.6GHz."                                                                                                                                                                                                                  , derick-david-409858-unsplash.jpg            , category:electronics|category:computers   , "screen size|RAM" , "13 inch|8GB"       , L2201308     , 1299.00 , standard    ,               ,
-                     ,                      ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                             ,                                           ,                   , "15 inch|8GB"       , L2201508     , 1399.00 , standard    ,               ,
-                     ,                      ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                             ,                                           ,                   , "13 inch|16GB"      , L2201316     , 2199.00 , standard    ,               ,
-                     ,                      ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                             ,                                           ,                   , "15 inch|16GB"      , L2201516     , 2299.00 , standard    ,               ,
-Curvy Monitor        , curvy-monitor        , "Discover a truly immersive viewing experience with this monitor curved more deeply than any other. Wrapping around your field of vision the 1,800 R screencreates a wider field of view, enhances depth perception, and minimises peripheral distractions to draw you deeper in to your content."                                                                                                                                                                                            , alexandru-acea-686569-unsplash.jpg          , category:electronics|category:computers   , monitor size      , 24 inch             , C24F390      , 143.74  , standard    ,               ,
-                     ,                      ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                             ,                                           ,                   , 27 inch             , C27F390      , 169.94  , standard    ,               ,
-Gaming PC            , gaming-pc            , "This pc is optimised for gaming, and is also VR ready. The Intel Core-i7 CPU and High Performance GPU give the computer the raw power it needs to function at a high level."                                                                                                                                                                                                                                                                                                                 , florian-olivo-1166419-unsplash.jpg          , category:electronics|category:computers   , "cpu|HDD"         , "i7-8700|240GB SSD" , CGS480VR1063 , 1087.20 , standard    ,               ,
-                     ,                      ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                             ,                                           ,                   , "R7-2700|240GB SSD" , CGS480VR1064 , 1099.95 , standard    ,               ,
-                     ,                      ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                             ,                                           ,                   , "i7-8700|120GB SSD" , CGS480VR1065 , 931.20  , standard    ,               ,
-                     ,                      ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                             ,                                           ,                   , "R7-2700|120GB SSD" , CGS480VR1066 , 949.20  , standard    ,               ,
-Hard Drive           , hard-drive           , "Boost your PC storage with this internal hard drive, designed just for desktop and all-in-one PCs."                                                                                                                                                                                                                                                                                                                                                                                          , vincent-botta-736919-unsplash.jpg           , category:electronics|category:computers   , "HDD"             , 1TB                 , IHD455T1     , 37.99   , standard    ,               ,
-                     ,                      ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                             ,                                           ,                   , 2TB                 , IHD455T2     , 53.74   , standard    ,               ,
-                     ,                      ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                             ,                                           ,                   , 3TB                 , IHD455T3     , 78.96   , standard    ,               ,
-                     ,                      ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                             ,                                           ,                   , 4TB                 , IHD455T4     , 92.99   , standard    ,               ,
-                     ,                      ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                             ,                                           ,                   , 6TB                 , IHD455T6     , 134.35  , standard    ,               ,
-Clacky Keyboard      , clacky-keyboard      , "Let all your colleagues know that you are typing on this exclusive, colorful klicky-klacky keyboard. Huge travel on each keypress ensures maximum klack on each and every keystroke."                                                                                                                                                                                                                                                                                                        , juan-gomez-674574-unsplash.jpg              , category:electronics|category:computers   ,                   ,                     , A4TKLA45535  , 74.89   , standard    ,               ,
-USB Cable            , usb-cable            , "Solid conductors eliminate strand-interaction distortion and reduce jitter. As the surface is made of high-purity silver, the performance is very close to that of a solid silver cable, but priced much closer to solid copper cable."                                                                                                                                                                                                                                                      , adam-birkett-239153-unsplash.jpg            , category:electronics|category:computers   ,                   ,                     , USBCIN01.5MI , 69.00   , standard    ,               ,
-Instant Camera       , instant-camera       , "With its nostalgic design and simple point-and-shoot functionality, the Instant Camera is the perfect pick to get started with instant photography."                                                                                                                                                                                                                                                                                                                                         , eniko-kis-663725-unsplash.jpg               , category:electronics|category:photo       ,                   ,                     , IC22MWDD     , 174.99  , standard    ,               ,
-Camera Lens          , camera-lens          , "This lens is a Di type lens using an optical system with improved multi-coating designed to function with digital SLR cameras as well as film cameras."                                                                                                                                                                                                                                                                                                                                      , brandi-redd-104140-unsplash.jpg             , category:electronics|category:photo       ,                   ,                     , B0012UUP02   , 104.00  , standard    ,               ,
-Tripod               , tripod               , "Capture vivid, professional-style photographs with help from this lightweight tripod. The adjustable-height tripod makes it easy to achieve reliable stability and score just the right angle when going after that award-winning shot."                                                                                                                                                                                                                                                     , zoltan-tasi-423051-unsplash.jpg             , category:electronics|category:photo       ,                   ,                     , B00XI87KV8   , 14.98   , standard    ,               ,
-SLR Camera           , slr-camera           , "Retro styled, portable in size and built around a powerful 24-megapixel APS-C CMOS sensor, this digital camera is the ideal companion for creative everyday photography. Packed full of high spec features such as an advanced hybrid autofocus system able to keep pace with even the most active subjects, a speedy 6fps continuous-shooting mode, high-resolution electronic viewfinder and intuitive swivelling touchscreen, it brings professional image making into everyone’s grasp." , robert-shunev-528016-unsplash.jpg           , category:electronics|category:photo       ,                   ,                     , B07D75V44S   , 521.00  , standard    ,               ,
-Road Bike            , road-bike            , "Featuring a full carbon chassis - complete with cyclocross-specific carbon fork - and a component setup geared for hard use on the race circuit, it's got the low weight, exceptional efficiency and brilliant handling you'll need to stay at the front of the pack."                                                                                                                                                                                                                       , mikkel-bech-748940-unsplash.jpg             , category:sports equipment                 ,                   ,                     , RB000844334  , 2499.00 , standard    ,               ,
-Skipping Rope        , skipping-rope        , "When you're working out you need a quality rope that doesn't tangle at every couple of jumps and with this sipping rope you won't have this problem."                                                                                                                                                                                                                                                                                                                                        , stoica-ionela-530966-unsplash.jpg           , category:sports equipment                 ,                   ,                     , B07CNGXVXT   , 7.99    , standard    ,               ,
-Boxing Gloves        , boxing-gloves        , "Training gloves designed for optimum training. Our gloves promote proper punching technique because they are conformed to the natural shape of your fist. Dense, innovative two-layer foam provides better shock absorbency and full padding on the front, back and wrist to promote proper punching technique."                                                                                                                                                                             , neonbrand-428982-unsplash.jpg               , category:sports equipment                 ,                   ,                     , B000ZYLPPU   , 33.04   , standard    ,               ,
-Tent                 , tent                 , "With tons of space inside (for max. 4 persons), full head height throughout the entire tent and an unusual and striking shape, this tent offers you everything you need."                                                                                                                                                                                                                                                                                                                    , michael-guite-571169-unsplash.jpg           , category:sports equipment                 ,                   ,                     , 2000023510   , 214.93  , standard    ,               ,
-Cruiser Skateboard   , cruiser-skateboard   , "Based on the 1970s iconic shape, but made to a larger 69cm size, with updated, quality component, these skateboards are great for beginners to learn the foot spacing required, and are perfect for all-day cruising."                                                                                                                                                                                                                                                                       , max-tarkhov-737999-unsplash.jpg             , category:sports equipment                 ,                   ,                     , 799872520    , 24.99   , standard    ,               ,
-Football             , football             , "This football features high-contrast graphics for high-visibility during play, while its machine-stitched tpu casing offers consistent performance."                                                                                                                                                                                                                                                                                                                                         , nik-shuliahin-619349-unsplash.jpg           , category:sports equipment                 ,                   ,                     , SC3137-056   , 57.07   , standard    ,               ,
-Running Shoe         , running-shoe         , "With its ultra-light, uber-responsive magic foam and a carbon fiber plate that feels like it’s propelling you forward, the Running Shoe is ready to push you to victories both large and small"                                                                                                                                                                                                                                                                                              , chuttersnap-584518-unsplash.jpg             , category:sports equipment                 , size              , Size 40             , RS0040       , 99.99   , standard    ,               ,
-                     ,                      ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                             ,                                           ,                   , Size 42             , RS0042       , 99.99   , standard    ,               ,
-                     ,                      ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                             ,                                           ,                   , Size 44             , RS0044       , 99.99   , standard    ,               ,
-                     ,                      ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                             ,                                           ,                   , Size 46             , RS0046       , 99.99   , standard    ,               ,
-Spiky Cactus         , spiky-cactus         , "A spiky yet elegant house cactus - perfect for the home or office. Origin and habitat: Probably native only to the Andes of Peru"                                                                                                                                                                                                                                                                                                                                                            , charles-deluvio-695736-unsplash.jpg         , category:home & garden|category:plants    ,                   ,                     , SC011001     , 15.50   , standard    ,               ,
-Orchid               , orchid               , "Gloriously elegant. It can go along with any interior as it is a neutral color and the most popular Phalaenopsis overall. 2 to 3 foot stems host large white flowers that can last for over 2 months."                                                                                                                                                                                                                                                                                       , zoltan-kovacs-642412-unsplash.jpg           , category:home & garden|category:plants    ,                   ,                     , ROR00221     , 65.00   , standard    ,               ,
-Bonsai Tree          , bonsai-tree          , "Excellent semi-evergreen bonsai. Indoors or out but needs some winter protection. All trees sent will leave the nursery in excellent condition and will be of equal quality or better than the photograph shown."                                                                                                                                                                                                                                                                            , mark-tegethoff-667351-unsplash.jpg          , category:home & garden|category:plants    ,                   ,                     , B01MXFLUSV   , 19.99   , standard    ,               ,
-Guardian Lion Statue , guardian-lion-statue , "Placing it at home or office can bring you fortune and prosperity, guard your house and ward off ill fortune."                                                                                                                                                                                                                                                                                                                                                                               , vincent-liu-525429-unsplash.jpg             , category:home & garden                    ,                   ,                     , GL34LLW11    , 188.53  , standard    ,               ,
-Hand Trowel          , hand-trowel          , "Hand trowel for garden cultivating hammer finish epoxy-coated head for improved resistance to rust, scratches, humidity and alkalines in the soil."                                                                                                                                                                                                                                                                                                                                          , neslihan-gunaydin-3493-unsplash.jpg         , category:home & garden                    ,                   ,                     , 4058NB/09    , 4.99    , standard    ,               ,
-Balloon Chair        , balloon-chair        , "A charming vintage white wooden chair featuring an extremely spherical pink balloon. The balloon may be detached and used for other purposes, for example as a party decoration."                                                                                                                                                                                                                                                                                                            , florian-klauer-14840-unsplash.jpg           , category:home & garden|category:furniture ,                   ,                     , 34-BC82444   , 65.00   , standard    ,               ,
-Leather Sofa         , leather-sofa         , "This premium, tan-brown bonded leather seat is part of the 'chill' sofa range. The lever activated recline feature makes it easy to adjust to any position. This smart, bustle back design with rounded tight padded arms has been designed with your comfort in mind. This well-padded chair has foam pocket sprung seat cushions and fibre-filled back cushions."                                                                                                                          , paul-weaver-1120584-unsplash.jpg            , category:home & garden|category:furniture ,                   ,                     , CH00001-02   , 1245.00 , standard    ,               ,
-Light Shade          , light-shade          , "Modern tapered white polycotton pendant shade with a metallic silver chrome interior finish for maximum light reflection. Reversible gimble so it can be used as a ceiling shade or as a lamp shade."                                                                                                                                                                                                                                                                                        , pierre-chatel-innocenti-483198-unsplash.jpg , category:home & garden|category:furniture ,                   ,                     , B45809LSW    , 28.45   , standard    ,               ,
+name                 , slug                 , description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   , assets                                      , facets                                    , optionGroups      , optionValues        , sku          , price   , taxCategory , stockOnHand , trackInventory , variantAssets , variantFacets
+Laptop               , laptop               , "Now equipped with seventh-generation Intel Core processors, Laptop is snappier than ever. From daily tasks like launching apps and opening files to more advanced computing, you can power through your day thanks to faster SSDs and Turbo Boost processing up to 3.6GHz."                                                                                                                                                                                                                  , derick-david-409858-unsplash.jpg            , category:electronics|category:computers   , "screen size|RAM" , "13 inch|8GB"       , L2201308     , 1299.00 , standard    , 100         , true           ,               ,
+                     ,                      ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                             ,                                           ,                   , "15 inch|8GB"       , L2201508     , 1399.00 , standard    , 100         , true           ,               ,
+                     ,                      ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                             ,                                           ,                   , "13 inch|16GB"      , L2201316     , 2199.00 , standard    , 100         , true           ,               ,
+                     ,                      ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                             ,                                           ,                   , "15 inch|16GB"      , L2201516     , 2299.00 , standard    , 100         , true           ,               ,
+Curvy Monitor        , curvy-monitor        , "Discover a truly immersive viewing experience with this monitor curved more deeply than any other. Wrapping around your field of vision the 1,800 R screencreates a wider field of view, enhances depth perception, and minimises peripheral distractions to draw you deeper in to your content."                                                                                                                                                                                            , alexandru-acea-686569-unsplash.jpg          , category:electronics|category:computers   , monitor size      , 24 inch             , C24F390      , 143.74  , standard    , 100         , true           ,               ,
+                     ,                      ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                             ,                                           ,                   , 27 inch             , C27F390      , 169.94  , standard    , 100         , true           ,               ,
+Gaming PC            , gaming-pc            , "This pc is optimised for gaming, and is also VR ready. The Intel Core-i7 CPU and High Performance GPU give the computer the raw power it needs to function at a high level."                                                                                                                                                                                                                                                                                                                 , florian-olivo-1166419-unsplash.jpg          , category:electronics|category:computers   , "cpu|HDD"         , "i7-8700|240GB SSD" , CGS480VR1063 , 1087.20 , standard    , 100         , true           ,               ,
+                     ,                      ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                             ,                                           ,                   , "R7-2700|240GB SSD" , CGS480VR1064 , 1099.95 , standard    , 100         , true           ,               ,
+                     ,                      ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                             ,                                           ,                   , "i7-8700|120GB SSD" , CGS480VR1065 , 931.20  , standard    , 100         , true           ,               ,
+                     ,                      ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                             ,                                           ,                   , "R7-2700|120GB SSD" , CGS480VR1066 , 949.20  , standard    , 100         , true           ,               ,
+Hard Drive           , hard-drive           , "Boost your PC storage with this internal hard drive, designed just for desktop and all-in-one PCs."                                                                                                                                                                                                                                                                                                                                                                                          , vincent-botta-736919-unsplash.jpg           , category:electronics|category:computers   , "HDD"             , 1TB                 , IHD455T1     , 37.99   , standard    , 100         , true           ,               ,
+                     ,                      ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                             ,                                           ,                   , 2TB                 , IHD455T2     , 53.74   , standard    , 100         , true           ,               ,
+                     ,                      ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                             ,                                           ,                   , 3TB                 , IHD455T3     , 78.96   , standard    , 100         , true           ,               ,
+                     ,                      ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                             ,                                           ,                   , 4TB                 , IHD455T4     , 92.99   , standard    , 100         , true           ,               ,
+                     ,                      ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                             ,                                           ,                   , 6TB                 , IHD455T6     , 134.35  , standard    , 100         , true           ,               ,
+Clacky Keyboard      , clacky-keyboard      , "Let all your colleagues know that you are typing on this exclusive, colorful klicky-klacky keyboard. Huge travel on each keypress ensures maximum klack on each and every keystroke."                                                                                                                                                                                                                                                                                                        , juan-gomez-674574-unsplash.jpg              , category:electronics|category:computers   ,                   ,                     , A4TKLA45535  , 74.89   , standard    , 100         , true           ,               ,
+USB Cable            , usb-cable            , "Solid conductors eliminate strand-interaction distortion and reduce jitter. As the surface is made of high-purity silver, the performance is very close to that of a solid silver cable, but priced much closer to solid copper cable."                                                                                                                                                                                                                                                      , adam-birkett-239153-unsplash.jpg            , category:electronics|category:computers   ,                   ,                     , USBCIN01.5MI , 69.00   , standard    , 100         , true           ,               ,
+Instant Camera       , instant-camera       , "With its nostalgic design and simple point-and-shoot functionality, the Instant Camera is the perfect pick to get started with instant photography."                                                                                                                                                                                                                                                                                                                                         , eniko-kis-663725-unsplash.jpg               , category:electronics|category:photo       ,                   ,                     , IC22MWDD     , 174.99  , standard    , 100         , true           ,               ,
+Camera Lens          , camera-lens          , "This lens is a Di type lens using an optical system with improved multi-coating designed to function with digital SLR cameras as well as film cameras."                                                                                                                                                                                                                                                                                                                                      , brandi-redd-104140-unsplash.jpg             , category:electronics|category:photo       ,                   ,                     , B0012UUP02   , 104.00  , standard    , 100         , true           ,               ,
+Tripod               , tripod               , "Capture vivid, professional-style photographs with help from this lightweight tripod. The adjustable-height tripod makes it easy to achieve reliable stability and score just the right angle when going after that award-winning shot."                                                                                                                                                                                                                                                     , zoltan-tasi-423051-unsplash.jpg             , category:electronics|category:photo       ,                   ,                     , B00XI87KV8   , 14.98   , standard    , 100         , true           ,               ,
+SLR Camera           , slr-camera           , "Retro styled, portable in size and built around a powerful 24-megapixel APS-C CMOS sensor, this digital camera is the ideal companion for creative everyday photography. Packed full of high spec features such as an advanced hybrid autofocus system able to keep pace with even the most active subjects, a speedy 6fps continuous-shooting mode, high-resolution electronic viewfinder and intuitive swivelling touchscreen, it brings professional image making into everyone’s grasp." , robert-shunev-528016-unsplash.jpg           , category:electronics|category:photo       ,                   ,                     , B07D75V44S   , 521.00  , standard    , 100         , true           ,               ,
+Road Bike            , road-bike            , "Featuring a full carbon chassis - complete with cyclocross-specific carbon fork - and a component setup geared for hard use on the race circuit, it's got the low weight, exceptional efficiency and brilliant handling you'll need to stay at the front of the pack."                                                                                                                                                                                                                       , mikkel-bech-748940-unsplash.jpg             , category:sports equipment                 ,                   ,                     , RB000844334  , 2499.00 , standard    , 100         , true           ,               ,
+Skipping Rope        , skipping-rope        , "When you're working out you need a quality rope that doesn't tangle at every couple of jumps and with this sipping rope you won't have this problem."                                                                                                                                                                                                                                                                                                                                        , stoica-ionela-530966-unsplash.jpg           , category:sports equipment                 ,                   ,                     , B07CNGXVXT   , 7.99    , standard    , 100         , true           ,               ,
+Boxing Gloves        , boxing-gloves        , "Training gloves designed for optimum training. Our gloves promote proper punching technique because they are conformed to the natural shape of your fist. Dense, innovative two-layer foam provides better shock absorbency and full padding on the front, back and wrist to promote proper punching technique."                                                                                                                                                                             , neonbrand-428982-unsplash.jpg               , category:sports equipment                 ,                   ,                     , B000ZYLPPU   , 33.04   , standard    , 100         , true           ,               ,
+Tent                 , tent                 , "With tons of space inside (for max. 4 persons), full head height throughout the entire tent and an unusual and striking shape, this tent offers you everything you need."                                                                                                                                                                                                                                                                                                                    , michael-guite-571169-unsplash.jpg           , category:sports equipment                 ,                   ,                     , 2000023510   , 214.93  , standard    , 100         , true           ,               ,
+Cruiser Skateboard   , cruiser-skateboard   , "Based on the 1970s iconic shape, but made to a larger 69cm size, with updated, quality component, these skateboards are great for beginners to learn the foot spacing required, and are perfect for all-day cruising."                                                                                                                                                                                                                                                                       , max-tarkhov-737999-unsplash.jpg             , category:sports equipment                 ,                   ,                     , 799872520    , 24.99   , standard    , 100         , true           ,               ,
+Football             , football             , "This football features high-contrast graphics for high-visibility during play, while its machine-stitched tpu casing offers consistent performance."                                                                                                                                                                                                                                                                                                                                         , nik-shuliahin-619349-unsplash.jpg           , category:sports equipment                 ,                   ,                     , SC3137-056   , 57.07   , standard    , 100         , true           ,               ,
+Running Shoe         , running-shoe         , "With its ultra-light, uber-responsive magic foam and a carbon fiber plate that feels like it’s propelling you forward, the Running Shoe is ready to push you to victories both large and small"                                                                                                                                                                                                                                                                                              , chuttersnap-584518-unsplash.jpg             , category:sports equipment                 , size              , Size 40             , RS0040       , 99.99   , standard    , 100         , true           ,               ,
+                     ,                      ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                             ,                                           ,                   , Size 42             , RS0042       , 99.99   , standard    , 100         , true           ,               ,
+                     ,                      ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                             ,                                           ,                   , Size 44             , RS0044       , 99.99   , standard    , 100         , true           ,               ,
+                     ,                      ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ,                                             ,                                           ,                   , Size 46             , RS0046       , 99.99   , standard    , 100         , true           ,               ,
+Spiky Cactus         , spiky-cactus         , "A spiky yet elegant house cactus - perfect for the home or office. Origin and habitat: Probably native only to the Andes of Peru"                                                                                                                                                                                                                                                                                                                                                            , charles-deluvio-695736-unsplash.jpg         , category:home & garden|category:plants    ,                   ,                     , SC011001     , 15.50   , standard    , 100         , true           ,               ,
+Orchid               , orchid               , "Gloriously elegant. It can go along with any interior as it is a neutral color and the most popular Phalaenopsis overall. 2 to 3 foot stems host large white flowers that can last for over 2 months."                                                                                                                                                                                                                                                                                       , zoltan-kovacs-642412-unsplash.jpg           , category:home & garden|category:plants    ,                   ,                     , ROR00221     , 65.00   , standard    , 100         , true           ,               ,
+Bonsai Tree          , bonsai-tree          , "Excellent semi-evergreen bonsai. Indoors or out but needs some winter protection. All trees sent will leave the nursery in excellent condition and will be of equal quality or better than the photograph shown."                                                                                                                                                                                                                                                                            , mark-tegethoff-667351-unsplash.jpg          , category:home & garden|category:plants    ,                   ,                     , B01MXFLUSV   , 19.99   , standard    , 100         , true           ,               ,
+Guardian Lion Statue , guardian-lion-statue , "Placing it at home or office can bring you fortune and prosperity, guard your house and ward off ill fortune."                                                                                                                                                                                                                                                                                                                                                                               , vincent-liu-525429-unsplash.jpg             , category:home & garden                    ,                   ,                     , GL34LLW11    , 188.53  , standard    , 100         , true           ,               ,
+Hand Trowel          , hand-trowel          , "Hand trowel for garden cultivating hammer finish epoxy-coated head for improved resistance to rust, scratches, humidity and alkalines in the soil."                                                                                                                                                                                                                                                                                                                                          , neslihan-gunaydin-3493-unsplash.jpg         , category:home & garden                    ,                   ,                     , 4058NB/09    , 4.99    , standard    , 100         , true           ,               ,
+Balloon Chair        , balloon-chair        , "A charming vintage white wooden chair featuring an extremely spherical pink balloon. The balloon may be detached and used for other purposes, for example as a party decoration."                                                                                                                                                                                                                                                                                                            , florian-klauer-14840-unsplash.jpg           , category:home & garden|category:furniture ,                   ,                     , 34-BC82444   , 65.00   , standard    , 100         , true           ,               ,
+Leather Sofa         , leather-sofa         , "This premium, tan-brown bonded leather seat is part of the 'chill' sofa range. The lever activated recline feature makes it easy to adjust to any position. This smart, bustle back design with rounded tight padded arms has been designed with your comfort in mind. This well-padded chair has foam pocket sprung seat cushions and fibre-filled back cushions."                                                                                                                          , paul-weaver-1120584-unsplash.jpg            , category:home & garden|category:furniture ,                   ,                     , CH00001-02   , 1245.00 , standard    , 100         , true           ,               ,
+Light Shade          , light-shade          , "Modern tapered white polycotton pendant shade with a metallic silver chrome interior finish for maximum light reflection. Reversible gimble so it can be used as a ceiling shade or as a lamp shade."                                                                                                                                                                                                                                                                                        , pierre-chatel-innocenti-483198-unsplash.jpg , category:home & garden|category:furniture ,                   ,                     , B45809LSW    , 28.45   , standard    , 100         , true           ,               ,

+ 54 - 0
packages/core/src/data-import/providers/import-parser/__snapshots__/import-parser.spec.ts.snap

@@ -36,7 +36,9 @@ Array [
         ],
         ],
         "price": 45.3,
         "price": 45.3,
         "sku": "PPS12",
         "sku": "PPS12",
+        "stockOnHand": 10,
         "taxCategory": "standard",
         "taxCategory": "standard",
+        "trackInventory": false,
       },
       },
       Object {
       Object {
         "assetPaths": Array [],
         "assetPaths": Array [],
@@ -49,7 +51,9 @@ Array [
         ],
         ],
         "price": 32.5,
         "price": 32.5,
         "sku": "PPS14",
         "sku": "PPS14",
+        "stockOnHand": 10,
         "taxCategory": "standard",
         "taxCategory": "standard",
+        "trackInventory": false,
       },
       },
       Object {
       Object {
         "assetPaths": Array [],
         "assetPaths": Array [],
@@ -62,7 +66,9 @@ Array [
         ],
         ],
         "price": 59.5,
         "price": 59.5,
         "sku": "PPSF",
         "sku": "PPSF",
+        "stockOnHand": 10,
         "taxCategory": "standard",
         "taxCategory": "standard",
+        "trackInventory": false,
       },
       },
     ],
     ],
   },
   },
@@ -100,7 +106,9 @@ Array [
         ],
         ],
         "price": 45.3,
         "price": 45.3,
         "sku": "PPS12",
         "sku": "PPS12",
+        "stockOnHand": 10,
         "taxCategory": "standard",
         "taxCategory": "standard",
+        "trackInventory": false,
       },
       },
       Object {
       Object {
         "assetPaths": Array [],
         "assetPaths": Array [],
@@ -111,7 +119,9 @@ Array [
         ],
         ],
         "price": 32.5,
         "price": 32.5,
         "sku": "PPS14",
         "sku": "PPS14",
+        "stockOnHand": 11,
         "taxCategory": "standard",
         "taxCategory": "standard",
+        "trackInventory": true,
       },
       },
       Object {
       Object {
         "assetPaths": Array [],
         "assetPaths": Array [],
@@ -122,7 +132,9 @@ Array [
         ],
         ],
         "price": 59.5,
         "price": 59.5,
         "sku": "PPSF",
         "sku": "PPSF",
+        "stockOnHand": 12,
         "taxCategory": "standard",
         "taxCategory": "standard",
+        "trackInventory": false,
       },
       },
     ],
     ],
   },
   },
@@ -144,7 +156,9 @@ Array [
         "optionValues": Array [],
         "optionValues": Array [],
         "price": 910.7,
         "price": 910.7,
         "sku": "M02",
         "sku": "M02",
+        "stockOnHand": 13,
         "taxCategory": "standard",
         "taxCategory": "standard",
+        "trackInventory": true,
       },
       },
     ],
     ],
   },
   },
@@ -176,7 +190,9 @@ Array [
         ],
         ],
         "price": 4.16,
         "price": 4.16,
         "sku": "225400",
         "sku": "225400",
+        "stockOnHand": 14,
         "taxCategory": "standard",
         "taxCategory": "standard",
+        "trackInventory": false,
       },
       },
       Object {
       Object {
         "assetPaths": Array [],
         "assetPaths": Array [],
@@ -187,7 +203,9 @@ Array [
         ],
         ],
         "price": 6.24,
         "price": 6.24,
         "sku": "225600",
         "sku": "225600",
+        "stockOnHand": 15,
         "taxCategory": "standard",
         "taxCategory": "standard",
+        "trackInventory": true,
       },
       },
     ],
     ],
   },
   },
@@ -227,7 +245,9 @@ Array [
         ],
         ],
         "price": 11.99,
         "price": 11.99,
         "sku": "10112",
         "sku": "10112",
+        "stockOnHand": 16,
         "taxCategory": "standard",
         "taxCategory": "standard",
+        "trackInventory": false,
       },
       },
       Object {
       Object {
         "assetPaths": Array [],
         "assetPaths": Array [],
@@ -239,7 +259,9 @@ Array [
         ],
         ],
         "price": 11.99,
         "price": 11.99,
         "sku": "10113",
         "sku": "10113",
+        "stockOnHand": 17,
         "taxCategory": "standard",
         "taxCategory": "standard",
+        "trackInventory": true,
       },
       },
       Object {
       Object {
         "assetPaths": Array [],
         "assetPaths": Array [],
@@ -251,7 +273,9 @@ Array [
         ],
         ],
         "price": 11.99,
         "price": 11.99,
         "sku": "10114",
         "sku": "10114",
+        "stockOnHand": 18,
         "taxCategory": "standard",
         "taxCategory": "standard",
+        "trackInventory": false,
       },
       },
       Object {
       Object {
         "assetPaths": Array [],
         "assetPaths": Array [],
@@ -263,7 +287,9 @@ Array [
         ],
         ],
         "price": 11.99,
         "price": 11.99,
         "sku": "10115",
         "sku": "10115",
+        "stockOnHand": 19,
         "taxCategory": "standard",
         "taxCategory": "standard",
+        "trackInventory": true,
       },
       },
     ],
     ],
   },
   },
@@ -301,7 +327,9 @@ Array [
         ],
         ],
         "price": 45.3,
         "price": 45.3,
         "sku": "PPS12",
         "sku": "PPS12",
+        "stockOnHand": 10,
         "taxCategory": "standard",
         "taxCategory": "standard",
+        "trackInventory": false,
       },
       },
       Object {
       Object {
         "assetPaths": Array [],
         "assetPaths": Array [],
@@ -312,7 +340,9 @@ Array [
         ],
         ],
         "price": 32.5,
         "price": 32.5,
         "sku": "PPS14",
         "sku": "PPS14",
+        "stockOnHand": 10,
         "taxCategory": "standard",
         "taxCategory": "standard",
+        "trackInventory": false,
       },
       },
       Object {
       Object {
         "assetPaths": Array [],
         "assetPaths": Array [],
@@ -323,7 +353,9 @@ Array [
         ],
         ],
         "price": 59.5,
         "price": 59.5,
         "sku": "PPSF",
         "sku": "PPSF",
+        "stockOnHand": 10,
         "taxCategory": "standard",
         "taxCategory": "standard",
+        "trackInventory": false,
       },
       },
     ],
     ],
   },
   },
@@ -367,7 +399,9 @@ Array [
         "optionValues": Array [],
         "optionValues": Array [],
         "price": 45.3,
         "price": 45.3,
         "sku": "PPS12",
         "sku": "PPS12",
+        "stockOnHand": 10,
         "taxCategory": "standard",
         "taxCategory": "standard",
+        "trackInventory": false,
       },
       },
     ],
     ],
   },
   },
@@ -405,7 +439,9 @@ Array [
         ],
         ],
         "price": 45.3,
         "price": 45.3,
         "sku": "PPS12",
         "sku": "PPS12",
+        "stockOnHand": 10,
         "taxCategory": "standard",
         "taxCategory": "standard",
+        "trackInventory": false,
       },
       },
       Object {
       Object {
         "assetPaths": Array [],
         "assetPaths": Array [],
@@ -416,7 +452,9 @@ Array [
         ],
         ],
         "price": 32.5,
         "price": 32.5,
         "sku": "PPS14",
         "sku": "PPS14",
+        "stockOnHand": 11,
         "taxCategory": "standard",
         "taxCategory": "standard",
+        "trackInventory": true,
       },
       },
       Object {
       Object {
         "assetPaths": Array [],
         "assetPaths": Array [],
@@ -427,7 +465,9 @@ Array [
         ],
         ],
         "price": 59.5,
         "price": 59.5,
         "sku": "PPSF",
         "sku": "PPSF",
+        "stockOnHand": 12,
         "taxCategory": "standard",
         "taxCategory": "standard",
+        "trackInventory": false,
       },
       },
     ],
     ],
   },
   },
@@ -449,7 +489,9 @@ Array [
         "optionValues": Array [],
         "optionValues": Array [],
         "price": 910.7,
         "price": 910.7,
         "sku": "M02",
         "sku": "M02",
+        "stockOnHand": 13,
         "taxCategory": "standard",
         "taxCategory": "standard",
+        "trackInventory": true,
       },
       },
     ],
     ],
   },
   },
@@ -481,7 +523,9 @@ Array [
         ],
         ],
         "price": 4.16,
         "price": 4.16,
         "sku": "225400",
         "sku": "225400",
+        "stockOnHand": 14,
         "taxCategory": "standard",
         "taxCategory": "standard",
+        "trackInventory": false,
       },
       },
       Object {
       Object {
         "assetPaths": Array [],
         "assetPaths": Array [],
@@ -492,7 +536,9 @@ Array [
         ],
         ],
         "price": 6.24,
         "price": 6.24,
         "sku": "225600",
         "sku": "225600",
+        "stockOnHand": 15,
         "taxCategory": "standard",
         "taxCategory": "standard",
+        "trackInventory": true,
       },
       },
     ],
     ],
   },
   },
@@ -532,7 +578,9 @@ Array [
         ],
         ],
         "price": 11.99,
         "price": 11.99,
         "sku": "10112",
         "sku": "10112",
+        "stockOnHand": 16,
         "taxCategory": "standard",
         "taxCategory": "standard",
+        "trackInventory": false,
       },
       },
       Object {
       Object {
         "assetPaths": Array [],
         "assetPaths": Array [],
@@ -544,7 +592,9 @@ Array [
         ],
         ],
         "price": 11.99,
         "price": 11.99,
         "sku": "10113",
         "sku": "10113",
+        "stockOnHand": 17,
         "taxCategory": "standard",
         "taxCategory": "standard",
+        "trackInventory": true,
       },
       },
       Object {
       Object {
         "assetPaths": Array [],
         "assetPaths": Array [],
@@ -556,7 +606,9 @@ Array [
         ],
         ],
         "price": 11.99,
         "price": 11.99,
         "sku": "10114",
         "sku": "10114",
+        "stockOnHand": 18,
         "taxCategory": "standard",
         "taxCategory": "standard",
+        "trackInventory": false,
       },
       },
       Object {
       Object {
         "assetPaths": Array [],
         "assetPaths": Array [],
@@ -568,7 +620,9 @@ Array [
         ],
         ],
         "price": 11.99,
         "price": 11.99,
         "sku": "10115",
         "sku": "10115",
+        "stockOnHand": 19,
         "taxCategory": "standard",
         "taxCategory": "standard",
+        "trackInventory": true,
       },
       },
     ],
     ],
   },
   },

+ 2 - 2
packages/core/src/data-import/providers/import-parser/import-parser.spec.ts

@@ -85,8 +85,8 @@ describe('ImportParser', () => {
                 const result = await importParser.parseProducts(input);
                 const result = await importParser.parseProducts(input);
 
 
                 expect(result.errors).toEqual([
                 expect(result.errors).toEqual([
-                    'Invalid Record Length: header length is 12, got 10 on line 3',
-                    'Invalid Record Length: header length is 12, got 1 on line 4',
+                    'Invalid Record Length: header length is 14, got 12 on line 3',
+                    'Invalid Record Length: header length is 14, got 1 on line 4',
                 ]);
                 ]);
                 expect(result.results.length).toBe(2);
                 expect(result.results.length).toBe(2);
             });
             });

+ 20 - 0
packages/core/src/data-import/providers/import-parser/import-parser.ts

@@ -15,6 +15,8 @@ export type BaseProductRecord = {
     sku?: string;
     sku?: string;
     price?: string;
     price?: string;
     taxCategory?: string;
     taxCategory?: string;
+    stockOnHand?: string;
+    trackInventory?: string;
     variantAssets?: string;
     variantAssets?: string;
     variantFacets?: string;
     variantFacets?: string;
 };
 };
@@ -26,6 +28,8 @@ export interface ParsedProductVariant {
     sku: string;
     sku: string;
     price: number;
     price: number;
     taxCategory: string;
     taxCategory: string;
+    stockOnHand: number;
+    trackInventory: boolean;
     assetPaths: string[];
     assetPaths: string[];
     facets: Array<{
     facets: Array<{
         facet: string;
         facet: string;
@@ -246,6 +250,8 @@ function parseVariantFromRecord(r: RawProductRecord): ParsedProductVariant {
         sku: parseString(r.sku),
         sku: parseString(r.sku),
         price: parseNumber(r.price),
         price: parseNumber(r.price),
         taxCategory: parseString(r.taxCategory),
         taxCategory: parseString(r.taxCategory),
+        stockOnHand: parseNumber(r.stockOnHand),
+        trackInventory: parseBoolean(r.trackInventory),
         assetPaths: parseStringArray(r.variantAssets),
         assetPaths: parseStringArray(r.variantAssets),
         facets: parseStringArray(r.variantFacets).map(pair => {
         facets: parseStringArray(r.variantFacets).map(pair => {
             const [facet, value] = pair.split(':');
             const [facet, value] = pair.split(':');
@@ -277,6 +283,20 @@ function parseNumber(input?: string): number {
     return +(input || '').trim();
     return +(input || '').trim();
 }
 }
 
 
+function parseBoolean(input?: string): boolean {
+    if (input == null) {
+        return false;
+    }
+    switch (input.toLowerCase()) {
+        case 'true':
+        case '1':
+        case 'yes':
+            return true;
+        default:
+            return false;
+    }
+}
+
 function parseStringArray(input?: string, separator = '|'): string[] {
 function parseStringArray(input?: string, separator = '|'): string[] {
     return (input || '')
     return (input || '')
         .trim()
         .trim()

+ 4 - 4
packages/core/src/data-import/providers/import-parser/test-fixtures/custom-fields.csv

@@ -1,4 +1,4 @@
-name                    , slug , description                          , assets , facets , optionGroups , optionValues     , sku   , price , taxCategory , variantAssets , variantFacets , product:keywords , product:customPage , variant:volumetric
-Perfect Paper Stretcher ,      , A great device for stretching paper. ,        ,        , size         , Half Imperial    , PPS12 , 45.3  , standard    ,               ,               , "paper, stretch" , grid-view          , 243
-                        ,      ,                                      ,        ,        ,              , Quarter Imperial , PPS14 , 32.5  , standard    ,               ,               ,                  ,                    , 344
-                        ,      ,                                      ,        ,        ,              , Full Imperial    , PPSF  , 59.5  , standard    ,               ,               ,                  ,                    , 656
+name                    , slug , description                          , assets , facets , optionGroups , optionValues     , sku   , price , taxCategory , stockOnHand , trackInventory , variantAssets , variantFacets , product:keywords , product:customPage , variant:volumetric
+Perfect Paper Stretcher ,      , A great device for stretching paper. ,        ,        , size         , Half Imperial    , PPS12 , 45.3  , standard    , 10          , false          ,               ,               , "paper, stretch" , grid-view          , 243
+                        ,      ,                                      ,        ,        ,              , Quarter Imperial , PPS14 , 32.5  , standard    , 10          , false          ,               ,               ,                  ,                    , 344
+                        ,      ,                                      ,        ,        ,              , Full Imperial    , PPSF  , 59.5  , standard    , 10          , false          ,               ,               ,                  ,                    , 656

+ 5 - 5
packages/core/src/data-import/providers/import-parser/test-fixtures/invalid-option-values.csv

@@ -1,5 +1,5 @@
-"name"          , "slug" , "description"                     , "assets" , facets , "optionGroups" , "optionValues" , "sku"   , "price" , "taxCategory" , "variantAssets" , variantFacets
-"Artists Smock" , ""     , "Keeps the paint off the clothes" , ""       ,        , "size"         , "small|beige"  , "10112" , "11.99" , "standard"    , ""              ,
-""              , ""     , ""                                , ""       ,        , ""             , "large|beige"  , "10113" , "11.99" , "standard"    , ""              ,
-""              , ""     , ""                                , ""       ,        , ""             , "small|navy"   , "10114" , "11.99" , "standard"    , ""              ,
-""              , ""     , ""                                , ""       ,        , ""             , "large|navy"   , "10115" , "11.99" , "standard"    , ""              ,
+"name"          , "slug" , "description"                     , "assets" , facets , "optionGroups" , "optionValues" , "sku"   , "price" , "taxCategory" , stockOnHand , trackInventory , "variantAssets" , variantFacets
+"Artists Smock" , ""     , "Keeps the paint off the clothes" , ""       ,        , "size"         , "small|beige"  , "10112" , "11.99" , "standard"    , 10          , false          , ""              ,
+""              , ""     , ""                                , ""       ,        , ""             , "large|beige"  , "10113" , "11.99" , "standard"    , 10          , false          , ""              ,
+""              , ""     , ""                                , ""       ,        , ""             , "small|navy"   , "10114" , "11.99" , "standard"    , 10          , false          , ""              ,
+""              , ""     , ""                                , ""       ,        , ""             , "large|navy"   , "10115" , "11.99" , "standard"    , 10          , false          , ""              ,

+ 4 - 4
packages/core/src/data-import/providers/import-parser/test-fixtures/invalid-row-length.csv

@@ -1,5 +1,5 @@
-name                    , slug , description                     , assets , facets , optionGroups , optionValues , sku      , price , taxCategory , variantAssets , variantFacets
-Mabef M/02 Studio Easel ,      , Mabef description               ,        ,        ,              ,              , M02      , 910.7 , standard    ,               ,
-Giotto Mega Pencils     ,      , Really mega pencils             ,        ,        , 225400       , 4.16         , standard ,       ,
+name                    , slug , description                     , assets , facets , optionGroups , optionValues , sku      , price , taxCategory , stockOnHand , trackInventory , variantAssets , variantFacets
+Mabef M/02 Studio Easel ,      , Mabef description               ,        ,        ,              ,              , M02      , 910.7 , standard    , 10          , false          ,               ,
+Giotto Mega Pencils     ,      , Really mega pencils             ,        ,        , 225400       , 4.16         , standard ,       ,             , 10          , false
 
 
-Artists Smock           ,      , Keeps the paint off the clothes ,        ,        ,              ,              , 10112    , 11.99 , standard    ,               ,
+Artists Smock           ,      , Keeps the paint off the clothes ,        ,        ,              ,              , 10112    , 11.99 , standard    , 10          , false          ,               ,

+ 11 - 11
packages/core/src/data-import/providers/import-parser/test-fixtures/multiple-products-multiple-variants.csv

@@ -1,11 +1,11 @@
-name                    , slug                    , description                          , assets , facets , optionGroups  , optionValues     , sku    , price , taxCategory , variantAssets , variantFacets
-Perfect Paper Stretcher , Perfect-paper-stretcher , A great device for stretching paper. ,        ,        , size          , Half Imperial    , PPS12  , 45.3  , standard    ,               ,
-                        ,                         ,                                      ,        ,        ,               , Quarter Imperial , PPS14  , 32.5  , standard    ,               ,
-                        ,                         ,                                      ,        ,        ,               , Full Imperial    , PPSF   , 59.5  , standard    ,               ,
-Mabef M/02 Studio Easel ,                         , Mabef description                    ,        ,        ,               ,                  , M02    , 910.7 , standard    ,               ,
-Giotto Mega Pencils     ,                         , Really mega pencils                  ,        ,        , box size      , Box of 8         , 225400 , 4.16  , standard    ,               ,
-                        ,                         ,                                      ,        ,        ,               , Box of 12        , 225600 , 6.24  , standard    ,               ,
-Artists Smock           ,                         , Keeps the paint off the clothes      ,        ,        , "size|colour" , "small|beige"    , 10112  , 11.99 , standard    ,               ,
-                        ,                         ,                                      ,        ,        ,               , "large|beige"    , 10113  , 11.99 , standard    ,               ,
-                        ,                         ,                                      ,        ,        ,               , "small|navy"     , 10114  , 11.99 , standard    ,               ,
-                        ,                         ,                                      ,        ,        ,               , "large|navy"     , 10115  , 11.99 , standard    ,               ,
+name                    , slug                    , description                          , assets , facets , optionGroups  , optionValues     , sku    , price , taxCategory , stockOnHand , trackInventory , variantAssets , variantFacets
+Perfect Paper Stretcher , Perfect-paper-stretcher , A great device for stretching paper. ,        ,        , size          , Half Imperial    , PPS12  , 45.3  , standard    , 10          , false          ,               ,
+                        ,                         ,                                      ,        ,        ,               , Quarter Imperial , PPS14  , 32.5  , standard    , 11          , true           ,               ,
+                        ,                         ,                                      ,        ,        ,               , Full Imperial    , PPSF   , 59.5  , standard    , 12          , 0              ,               ,
+Mabef M/02 Studio Easel ,                         , Mabef description                    ,        ,        ,               ,                  , M02    , 910.7 , standard    , 13          , True           ,               ,
+Giotto Mega Pencils     ,                         , Really mega pencils                  ,        ,        , box size      , Box of 8         , 225400 , 4.16  , standard    , 14          , False          ,               ,
+                        ,                         ,                                      ,        ,        ,               , Box of 12        , 225600 , 6.24  , standard    , 15          , 1              ,               ,
+Artists Smock           ,                         , Keeps the paint off the clothes      ,        ,        , "size|colour" , "small|beige"    , 10112  , 11.99 , standard    , 16          , false          ,               ,
+                        ,                         ,                                      ,        ,        ,               , "large|beige"    , 10113  , 11.99 , standard    , 17          , true           ,               ,
+                        ,                         ,                                      ,        ,        ,               , "small|navy"     , 10114  , 11.99 , standard    , 18          , FALSE          ,               ,
+                        ,                         ,                                      ,        ,        ,               , "large|navy"     , 10115  , 11.99 , standard    , 19          , TRUE           ,               ,

+ 4 - 4
packages/core/src/data-import/providers/import-parser/test-fixtures/single-product-multiple-variants.csv

@@ -1,4 +1,4 @@
-name                    , slug , description                          , assets , facets , optionGroups , optionValues     , sku   , price , taxCategory , variantAssets , variantFacets
-Perfect Paper Stretcher ,      , A great device for stretching paper. ,        ,        , size         , Half Imperial    , PPS12 , 45.3  , standard    ,               ,
-                        ,      ,                                      ,        ,        ,              , Quarter Imperial , PPS14 , 32.5  , standard    ,               ,
-                        ,      ,                                      ,        ,        ,              , Full Imperial    , PPSF  , 59.5  , standard    ,               ,
+name                    , slug , description                          , assets , facets , optionGroups , optionValues     , sku   , price , taxCategory , stockOnHand , trackInventory , variantAssets , variantFacets
+Perfect Paper Stretcher ,      , A great device for stretching paper. ,        ,        , size         , Half Imperial    , PPS12 , 45.3  , standard    , 10          , false          ,               ,
+                        ,      ,                                      ,        ,        ,              , Quarter Imperial , PPS14 , 32.5  , standard    , 10          , false          ,               ,
+                        ,      ,                                      ,        ,        ,              , Full Imperial    , PPSF  , 59.5  , standard    , 10          , false          ,               ,

+ 2 - 2
packages/core/src/data-import/providers/import-parser/test-fixtures/single-product-single-variant.csv

@@ -1,2 +1,2 @@
-name                    , slug , description                          , assets              , facets                  , optionGroups , optionValues , sku   , price , taxCategory , variantAssets , variantFacets
-Perfect Paper Stretcher ,      , A great device for stretching paper. , "pps1.jpg|pps2.jpg" , brand:KB|type:Accessory ,              ,              , PPS12 , 45.3  , standard    ,               , material:Wood
+name                    , slug , description                          , assets              , facets                  , optionGroups , optionValues , sku   , price , taxCategory , stockOnHand , trackInventory , variantAssets , variantFacets
+Perfect Paper Stretcher ,      , A great device for stretching paper. , "pps1.jpg|pps2.jpg" , brand:KB|type:Accessory ,              ,              , PPS12 , 45.3  , standard    , 10          , false          ,               , material:Wood

+ 2 - 0
packages/core/src/data-import/providers/importer/importer.ts

@@ -214,6 +214,8 @@ export class Importer {
                     assetIds: variantAssets.map(a => a.id) as string[],
                     assetIds: variantAssets.map(a => a.id) as string[],
                     sku: variant.sku,
                     sku: variant.sku,
                     taxCategoryId: this.getMatchingTaxCategoryId(variant.taxCategory, taxCategories),
                     taxCategoryId: this.getMatchingTaxCategoryId(variant.taxCategory, taxCategories),
+                    stockOnHand: variant.stockOnHand,
+                    trackInventory: variant.trackInventory,
                     optionIds: variant.optionValues.map(v => optionsMap[v]),
                     optionIds: variant.optionValues.map(v => optionsMap[v]),
                     translations: [
                     translations: [
                         {
                         {

+ 6 - 2
packages/core/src/service/services/product-variant.service.ts

@@ -144,7 +144,7 @@ export class ProductVariantService {
         product: Product,
         product: Product,
         input: CreateProductVariantInput,
         input: CreateProductVariantInput,
     ): Promise<ProductVariant> {
     ): Promise<ProductVariant> {
-        return await this.translatableSaver.create({
+        const createdVariant = await this.translatableSaver.create({
             input,
             input,
             entityType: ProductVariant,
             entityType: ProductVariant,
             translationType: ProductVariantTranslation,
             translationType: ProductVariantTranslation,
@@ -171,6 +171,10 @@ export class ProductVariantService {
                 taxCategoryId: input.taxCategoryId,
                 taxCategoryId: input.taxCategoryId,
             },
             },
         });
         });
+        if (input.stockOnHand != null && input.stockOnHand !== 0) {
+            await this.stockMovementService.adjustProductVariantStock(createdVariant.id, 0, input.stockOnHand);
+        }
+        return createdVariant;
     }
     }
 
 
     async update(ctx: RequestContext, input: UpdateProductVariantInput): Promise<Translated<ProductVariant>> {
     async update(ctx: RequestContext, input: UpdateProductVariantInput): Promise<Translated<ProductVariant>> {
@@ -193,7 +197,7 @@ export class ProductVariantService {
                     updatedVariant.facetValues = await this.facetValueService.findByIds(input.facetValueIds);
                     updatedVariant.facetValues = await this.facetValueService.findByIds(input.facetValueIds);
                 }
                 }
                 if (input.stockOnHand != null) {
                 if (input.stockOnHand != null) {
-                    await this.stockMovementService.adjustProductVariantStock(existingVariant, input.stockOnHand);
+                    await this.stockMovementService.adjustProductVariantStock(existingVariant.id, existingVariant.stockOnHand, input.stockOnHand);
                 }
                 }
                 await this.assetUpdater.updateEntityAssets(updatedVariant, input);
                 await this.assetUpdater.updateEntityAssets(updatedVariant, input);
             },
             },

+ 4 - 4
packages/core/src/service/services/stock-movement.service.ts

@@ -45,15 +45,15 @@ export class StockMovementService {
             });
             });
     }
     }
 
 
-    async adjustProductVariantStock(variant: ProductVariant, newStockLevel: number): Promise<StockAdjustment | undefined> {
-        if (variant.stockOnHand === newStockLevel) {
+    async adjustProductVariantStock(productVariantId: ID, oldStockLevel: number, newStockLevel: number): Promise<StockAdjustment | undefined> {
+        if (oldStockLevel === newStockLevel) {
             return;
             return;
         }
         }
-        const delta = newStockLevel - variant.stockOnHand;
+        const delta = newStockLevel - oldStockLevel;
 
 
         const adjustment = new StockAdjustment({
         const adjustment = new StockAdjustment({
             quantity: delta,
             quantity: delta,
-            productVariant: variant,
+            productVariant: { id: productVariantId },
         });
         });
         return this.connection.getRepository(StockAdjustment).save(adjustment);
         return this.connection.getRepository(StockAdjustment).save(adjustment);
     }
     }

Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 0
schema-admin.json


Diferenças do arquivo suprimidas por serem muito extensas
+ 326 - 431
schema.json


Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff