@commercetools/sync-actions 5.13.0 → 5.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -685,7 +685,7 @@ function buildReferenceActions(_ref4) {
685
685
  });
686
686
  }
687
687
 
688
- var baseActionsList$j = [{
688
+ var baseActionsList$k = [{
689
689
  action: 'changeName',
690
690
  key: 'name'
691
691
  }, {
@@ -722,10 +722,10 @@ var referenceActionsList$3 = [{
722
722
  * SYNC FUNCTIONS
723
723
  */
724
724
 
725
- function actionsMapBase$j(diff, oldObj, newObj) {
725
+ function actionsMapBase$k(diff, oldObj, newObj) {
726
726
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
727
727
  return buildBaseAttributesActions({
728
- actions: baseActionsList$j,
728
+ actions: baseActionsList$k,
729
729
  diff: diff,
730
730
  oldObj: oldObj,
731
731
  newObj: newObj,
@@ -833,7 +833,7 @@ function createCategoryMapActions(mapActionGroup, syncActionConfig) {
833
833
  return function doMapActions(diff, newObj, oldObj) {
834
834
  var allActions = [];
835
835
  allActions.push(mapActionGroup('base', function () {
836
- return actionsMapBase$j(diff, oldObj, newObj, syncActionConfig);
836
+ return actionsMapBase$k(diff, oldObj, newObj, syncActionConfig);
837
837
  }));
838
838
  allActions.push(mapActionGroup('references', function () {
839
839
  return actionsMapReferences$3(diff, oldObj, newObj);
@@ -870,7 +870,7 @@ var categories = (function (actionGroupList, syncActionConfig) {
870
870
  });
871
871
 
872
872
  var isEmptyValue = createIsEmptyValue([undefined, null, '']);
873
- var baseActionsList$i = [{
873
+ var baseActionsList$j = [{
874
874
  action: 'setSalutation',
875
875
  key: 'salutation'
876
876
  }, {
@@ -935,10 +935,10 @@ var authenticationModeActionsList = [{
935
935
  * SYNC FUNCTIONS
936
936
  */
937
937
 
938
- function actionsMapBase$i(diff, oldObj, newObj) {
938
+ function actionsMapBase$j(diff, oldObj, newObj) {
939
939
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
940
940
  return buildBaseAttributesActions({
941
- actions: baseActionsList$i,
941
+ actions: baseActionsList$j,
942
942
  diff: diff,
943
943
  oldObj: oldObj,
944
944
  newObj: newObj,
@@ -1082,7 +1082,7 @@ function createCustomerMapActions(mapActionGroup, syncActionConfig) {
1082
1082
  return function doMapActions(diff, newObj, oldObj) {
1083
1083
  var allActions = [];
1084
1084
  allActions.push(mapActionGroup('base', function () {
1085
- return actionsMapBase$i(diff, oldObj, newObj, syncActionConfig);
1085
+ return actionsMapBase$j(diff, oldObj, newObj, syncActionConfig);
1086
1086
  }));
1087
1087
  allActions.push(mapActionGroup('references', function () {
1088
1088
  return actionsMapReferences$2(diff, oldObj, newObj);
@@ -1127,7 +1127,7 @@ var customers = (function (actionGroupList, syncActionConfig) {
1127
1127
  };
1128
1128
  });
1129
1129
 
1130
- var baseActionsList$h = [{
1130
+ var baseActionsList$i = [{
1131
1131
  action: 'changeQuantity',
1132
1132
  key: 'quantityOnStock',
1133
1133
  actionKey: 'quantity'
@@ -1146,10 +1146,10 @@ var referenceActionsList$1 = [{
1146
1146
  * SYNC FUNCTIONS
1147
1147
  */
1148
1148
 
1149
- function actionsMapBase$h(diff, oldObj, newObj) {
1149
+ function actionsMapBase$i(diff, oldObj, newObj) {
1150
1150
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1151
1151
  return buildBaseAttributesActions({
1152
- actions: baseActionsList$h,
1152
+ actions: baseActionsList$i,
1153
1153
  diff: diff,
1154
1154
  oldObj: oldObj,
1155
1155
  newObj: newObj,
@@ -1169,7 +1169,7 @@ function createInventoryMapActions(mapActionGroup, syncActionConfig) {
1169
1169
  return function doMapActions(diff, newObj, oldObj) {
1170
1170
  var allActions = [];
1171
1171
  allActions.push(mapActionGroup('base', function () {
1172
- return actionsMapBase$h(diff, oldObj, newObj, syncActionConfig);
1172
+ return actionsMapBase$i(diff, oldObj, newObj, syncActionConfig);
1173
1173
  }));
1174
1174
  allActions.push(mapActionGroup('references', function () {
1175
1175
  return actionsMapReferences$1(diff, oldObj, newObj);
@@ -1264,7 +1264,7 @@ function findMatchingPairs(diff) {
1264
1264
 
1265
1265
  var REGEX_NUMBER$2 = new RegExp(/^\d+$/);
1266
1266
  var REGEX_UNDERSCORE_NUMBER$2 = new RegExp(/^_\d+$/);
1267
- var baseActionsList$g = [{
1267
+ var baseActionsList$h = [{
1268
1268
  action: 'changeName',
1269
1269
  key: 'name'
1270
1270
  }, {
@@ -1671,10 +1671,10 @@ function _buildVariantAssetsActions(diffAssets, oldVariant, newVariant) {
1671
1671
  */
1672
1672
 
1673
1673
 
1674
- function actionsMapBase$g(diff, oldObj, newObj) {
1674
+ function actionsMapBase$h(diff, oldObj, newObj) {
1675
1675
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1676
1676
  return buildBaseAttributesActions({
1677
- actions: baseActionsList$g,
1677
+ actions: baseActionsList$h,
1678
1678
  diff: diff,
1679
1679
  oldObj: oldObj,
1680
1680
  newObj: newObj,
@@ -1774,7 +1774,7 @@ function actionsMapAssets(diff, oldObj, newObj, variantHashMap) {
1774
1774
  });
1775
1775
  return allAssetsActions;
1776
1776
  }
1777
- function actionsMapAttributes(diff, oldObj, newObj) {
1777
+ function actionsMapAttributes$1(diff, oldObj, newObj) {
1778
1778
  var sameForAllAttributeNames = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
1779
1779
  var variantHashMap = arguments.length > 4 ? arguments[4] : undefined;
1780
1780
  var actions = [];
@@ -1905,7 +1905,7 @@ function createProductMapActions(mapActionGroup, syncActionConfig) {
1905
1905
  staged = newObj.staged;
1906
1906
  var variantHashMap = findMatchingPairs(diff.variants, oldObj.variants, newObj.variants);
1907
1907
  allActions.push(mapActionGroup('attributes', function () {
1908
- return actionsMapAttributes(diff, oldObj, newObj, sameForAllAttributeNames || [], variantHashMap);
1908
+ return actionsMapAttributes$1(diff, oldObj, newObj, sameForAllAttributeNames || [], variantHashMap);
1909
1909
  }));
1910
1910
  allActions.push(mapActionGroup('variants', function () {
1911
1911
  return actionsMapAddVariants(diff, oldObj, newObj);
@@ -1915,7 +1915,7 @@ function createProductMapActions(mapActionGroup, syncActionConfig) {
1915
1915
  return actionsMapRemoveVariants(diff, oldObj, newObj);
1916
1916
  }));
1917
1917
  allActions.push(mapActionGroup('base', function () {
1918
- return actionsMapBase$g(diff, oldObj, newObj, syncActionConfig);
1918
+ return actionsMapBase$h(diff, oldObj, newObj, syncActionConfig);
1919
1919
  }));
1920
1920
  allActions.push(mapActionGroup('meta', function () {
1921
1921
  return actionsMapMeta(diff, oldObj, newObj);
@@ -1990,7 +1990,7 @@ var isRemoveAction = function isRemoveAction(key, resource) {
1990
1990
  return REGEX_UNDERSCORE_NUMBER$1.test(key) && Number(resource[2]) === 0;
1991
1991
  };
1992
1992
 
1993
- var baseActionsList$f = [{
1993
+ var baseActionsList$g = [{
1994
1994
  action: 'changeOrderState',
1995
1995
  key: 'orderState'
1996
1996
  }, {
@@ -2004,10 +2004,10 @@ var baseActionsList$f = [{
2004
2004
  * SYNC FUNCTIONS
2005
2005
  */
2006
2006
 
2007
- function actionsMapBase$f(diff, oldObj, newObj) {
2007
+ function actionsMapBase$g(diff, oldObj, newObj) {
2008
2008
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
2009
2009
  return buildBaseAttributesActions({
2010
- actions: baseActionsList$f,
2010
+ actions: baseActionsList$g,
2011
2011
  diff: diff,
2012
2012
  oldObj: oldObj,
2013
2013
  newObj: newObj,
@@ -2174,7 +2174,7 @@ function createOrderMapActions(mapActionGroup, syncActionConfig) {
2174
2174
  }
2175
2175
 
2176
2176
  allActions.push(mapActionGroup('base', function () {
2177
- return actionsMapBase$f(diff, oldObj, newObj, syncActionConfig);
2177
+ return actionsMapBase$g(diff, oldObj, newObj, syncActionConfig);
2178
2178
  }));
2179
2179
  allActions.push(mapActionGroup('deliveries', function () {
2180
2180
  return actionsMapDeliveries(diff, oldObj, newObj);
@@ -2213,7 +2213,7 @@ var orders = (function (actionGroupList, syncActionConfig) {
2213
2213
  };
2214
2214
  });
2215
2215
 
2216
- var baseActionsList$e = [{
2216
+ var baseActionsList$f = [{
2217
2217
  action: 'changeIsActive',
2218
2218
  key: 'isActive'
2219
2219
  }, {
@@ -2241,10 +2241,10 @@ var baseActionsList$e = [{
2241
2241
  action: 'setKey',
2242
2242
  key: 'key'
2243
2243
  }];
2244
- function actionsMapBase$e(diff, oldObj, newObj) {
2244
+ function actionsMapBase$f(diff, oldObj, newObj) {
2245
2245
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
2246
2246
  return buildBaseAttributesActions({
2247
- actions: baseActionsList$e,
2247
+ actions: baseActionsList$f,
2248
2248
  diff: diff,
2249
2249
  oldObj: oldObj,
2250
2250
  newObj: newObj,
@@ -2285,7 +2285,7 @@ function createProductDiscountsMapActions(mapActionGroup, syncActionConfig) {
2285
2285
  return function doMapActions(diff, newObj, oldObj) {
2286
2286
  var allActions = [];
2287
2287
  allActions.push(mapActionGroup('base', function () {
2288
- return actionsMapBase$e(diff, oldObj, newObj, syncActionConfig);
2288
+ return actionsMapBase$f(diff, oldObj, newObj, syncActionConfig);
2289
2289
  }));
2290
2290
  return combineValidityActions(flatten__default["default"](allActions));
2291
2291
  };
@@ -2301,7 +2301,7 @@ var productDiscounts = (function (actionGroupList) {
2301
2301
  };
2302
2302
  });
2303
2303
 
2304
- var baseActionsList$d = [{
2304
+ var baseActionsList$e = [{
2305
2305
  action: 'changeIsActive',
2306
2306
  key: 'isActive'
2307
2307
  }, {
@@ -2332,10 +2332,10 @@ var baseActionsList$d = [{
2332
2332
  action: 'changeGroups',
2333
2333
  key: 'groups'
2334
2334
  }];
2335
- function actionsMapBase$d(diff, oldObj, newObj) {
2335
+ function actionsMapBase$e(diff, oldObj, newObj) {
2336
2336
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
2337
2337
  return buildBaseAttributesActions({
2338
- actions: baseActionsList$d,
2338
+ actions: baseActionsList$e,
2339
2339
  diff: diff,
2340
2340
  oldObj: oldObj,
2341
2341
  newObj: newObj,
@@ -2347,7 +2347,7 @@ function createDiscountCodesMapActions(mapActionGroup, syncActionConfig) {
2347
2347
  return function doMapActions(diff, newObj, oldObj) {
2348
2348
  var allActions = [];
2349
2349
  allActions.push(mapActionGroup('base', function () {
2350
- return actionsMapBase$d(diff, oldObj, newObj, syncActionConfig);
2350
+ return actionsMapBase$e(diff, oldObj, newObj, syncActionConfig);
2351
2351
  }));
2352
2352
  allActions.push(mapActionGroup('custom', function () {
2353
2353
  return actionsMapCustom(diff, newObj, oldObj);
@@ -2375,17 +2375,17 @@ var discountCodes = (function (actionGroupList) {
2375
2375
  };
2376
2376
  });
2377
2377
 
2378
- var baseActionsList$c = [{
2378
+ var baseActionsList$d = [{
2379
2379
  action: 'changeName',
2380
2380
  key: 'name'
2381
2381
  }, {
2382
2382
  action: 'setKey',
2383
2383
  key: 'key'
2384
2384
  }];
2385
- function actionsMapBase$c(diff, oldObj, newObj) {
2385
+ function actionsMapBase$d(diff, oldObj, newObj) {
2386
2386
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
2387
2387
  return buildBaseAttributesActions({
2388
- actions: baseActionsList$c,
2388
+ actions: baseActionsList$d,
2389
2389
  diff: diff,
2390
2390
  oldObj: oldObj,
2391
2391
  newObj: newObj,
@@ -2397,7 +2397,7 @@ function createCustomerGroupMapActions(mapActionGroup, syncActionConfig) {
2397
2397
  return function doMapActions(diff, newObj, oldObj) {
2398
2398
  var allActions = [];
2399
2399
  allActions.push(mapActionGroup('base', function () {
2400
- return actionsMapBase$c(diff, oldObj, newObj, syncActionConfig);
2400
+ return actionsMapBase$d(diff, oldObj, newObj, syncActionConfig);
2401
2401
  }));
2402
2402
  allActions.push(mapActionGroup('custom', function () {
2403
2403
  return actionsMapCustom(diff, newObj, oldObj);
@@ -2416,7 +2416,7 @@ var customerGroup = (function (actionGroupList) {
2416
2416
  };
2417
2417
  });
2418
2418
 
2419
- var baseActionsList$b = [{
2419
+ var baseActionsList$c = [{
2420
2420
  action: 'changeIsActive',
2421
2421
  key: 'isActive'
2422
2422
  }, {
@@ -2453,10 +2453,10 @@ var baseActionsList$b = [{
2453
2453
  action: 'setKey',
2454
2454
  key: 'key'
2455
2455
  }];
2456
- function actionsMapBase$b(diff, oldObj, newObj) {
2456
+ function actionsMapBase$c(diff, oldObj, newObj) {
2457
2457
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
2458
2458
  return buildBaseAttributesActions({
2459
- actions: baseActionsList$b,
2459
+ actions: baseActionsList$c,
2460
2460
  diff: diff,
2461
2461
  oldObj: oldObj,
2462
2462
  newObj: newObj,
@@ -2468,7 +2468,7 @@ function createCartDiscountsMapActions(mapActionGroup, syncActionConfig) {
2468
2468
  return function doMapActions(diff, newObj, oldObj) {
2469
2469
  var allActions = [];
2470
2470
  allActions.push(mapActionGroup('base', function () {
2471
- return actionsMapBase$b(diff, oldObj, newObj, syncActionConfig);
2471
+ return actionsMapBase$c(diff, oldObj, newObj, syncActionConfig);
2472
2472
  }));
2473
2473
  allActions.push(mapActionGroup('custom', function () {
2474
2474
  return actionsMapCustom(diff, newObj, oldObj);
@@ -2487,7 +2487,7 @@ var cartDiscounts = (function (actionGroupList) {
2487
2487
  };
2488
2488
  });
2489
2489
 
2490
- var baseActionsList$a = [{
2490
+ var baseActionsList$b = [{
2491
2491
  action: 'changeName',
2492
2492
  key: 'name'
2493
2493
  }, {
@@ -2497,10 +2497,10 @@ var baseActionsList$a = [{
2497
2497
  action: 'setDescription',
2498
2498
  key: 'description'
2499
2499
  }];
2500
- function actionsMapBase$a(diff, oldObj, newObj) {
2500
+ function actionsMapBase$b(diff, oldObj, newObj) {
2501
2501
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
2502
2502
  return buildBaseAttributesActions({
2503
- actions: baseActionsList$a,
2503
+ actions: baseActionsList$b,
2504
2504
  diff: diff,
2505
2505
  oldObj: oldObj,
2506
2506
  newObj: newObj,
@@ -2534,7 +2534,7 @@ function createTaxCategoriesMapActions(mapActionGroup, syncActionConfig) {
2534
2534
  return function doMapActions(diff, newObj, oldObj) {
2535
2535
  var allActions = [];
2536
2536
  allActions.push(mapActionGroup('base', function () {
2537
- return actionsMapBase$a(diff, oldObj, newObj, syncActionConfig);
2537
+ return actionsMapBase$b(diff, oldObj, newObj, syncActionConfig);
2538
2538
  }));
2539
2539
  allActions.push(mapActionGroup('rates', function () {
2540
2540
  return actionsMapRates(diff, oldObj, newObj);
@@ -2561,7 +2561,7 @@ var taxCategories = (function (actionGroupList, syncActionConfig) {
2561
2561
  };
2562
2562
  });
2563
2563
 
2564
- var baseActionsList$9 = [{
2564
+ var baseActionsList$a = [{
2565
2565
  action: 'changeName',
2566
2566
  key: 'name'
2567
2567
  }, {
@@ -2578,10 +2578,10 @@ var hasLocation = function hasLocation(locations, otherLocation) {
2578
2578
  });
2579
2579
  };
2580
2580
 
2581
- function actionsMapBase$9(diff, oldObj, newObj) {
2581
+ function actionsMapBase$a(diff, oldObj, newObj) {
2582
2582
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
2583
2583
  return buildBaseAttributesActions({
2584
- actions: baseActionsList$9,
2584
+ actions: baseActionsList$a,
2585
2585
  diff: diff,
2586
2586
  oldObj: oldObj,
2587
2587
  newObj: newObj,
@@ -2626,7 +2626,7 @@ function createZonesMapActions(mapActionGroup, syncActionConfig) {
2626
2626
  return function doMapActions(diff, newObj, oldObj) {
2627
2627
  var allActions = [];
2628
2628
  allActions.push(mapActionGroup('base', function () {
2629
- return actionsMapBase$9(diff, oldObj, newObj, syncActionConfig);
2629
+ return actionsMapBase$a(diff, oldObj, newObj, syncActionConfig);
2630
2630
  }));
2631
2631
  allActions.push(flatten__default["default"](mapActionGroup('locations', function () {
2632
2632
  return actionsMapLocations(diff, oldObj, newObj);
@@ -2653,7 +2653,7 @@ var zones = (function (actionGroupList, syncActionConfig) {
2653
2653
  };
2654
2654
  });
2655
2655
 
2656
- var baseActionsList$8 = [{
2656
+ var baseActionsList$9 = [{
2657
2657
  action: 'setKey',
2658
2658
  key: 'key'
2659
2659
  }, {
@@ -2678,10 +2678,10 @@ var baseActionsList$8 = [{
2678
2678
  action: 'changeTaxCategory',
2679
2679
  key: 'taxCategory'
2680
2680
  }];
2681
- function actionsMapBase$8(diff, oldObj, newObj) {
2681
+ function actionsMapBase$9(diff, oldObj, newObj) {
2682
2682
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
2683
2683
  return buildBaseAttributesActions({
2684
- actions: baseActionsList$8,
2684
+ actions: baseActionsList$9,
2685
2685
  diff: diff,
2686
2686
  oldObj: oldObj,
2687
2687
  newObj: newObj,
@@ -2763,7 +2763,7 @@ function createShippingMethodsMapActions(mapActionGroup, syncActionConfig) {
2763
2763
  return function doMapActions(diff, newObj, oldObj) {
2764
2764
  var allActions = [];
2765
2765
  allActions.push(mapActionGroup('base', function () {
2766
- return actionsMapBase$8(diff, oldObj, newObj, syncActionConfig);
2766
+ return actionsMapBase$9(diff, oldObj, newObj, syncActionConfig);
2767
2767
  }));
2768
2768
  allActions.push(flatten__default["default"](mapActionGroup('zoneRates', function () {
2769
2769
  return actionsMapZoneRates(diff, oldObj, newObj);
@@ -3161,7 +3161,7 @@ createComparator(function () {
3161
3161
  createComparator(createCircularEqualCreator());
3162
3162
  createComparator(createCircularEqualCreator(sameValueZeroEqual));
3163
3163
 
3164
- var baseActionsList$7 = [{
3164
+ var baseActionsList$8 = [{
3165
3165
  action: 'changeName',
3166
3166
  key: 'name'
3167
3167
  }, {
@@ -3171,7 +3171,7 @@ var baseActionsList$7 = [{
3171
3171
  action: 'changeDescription',
3172
3172
  key: 'description'
3173
3173
  }];
3174
- function actionsMapBase$7(diff, previous, next) {
3174
+ function actionsMapBase$8(diff, previous, next) {
3175
3175
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
3176
3176
  // when `diff` is undefined, then the underlying `buildActions` has returned any diff
3177
3177
  // which given in product-types would mean that `buildActions` has run with `nestedValuesChanges` applied
@@ -3179,7 +3179,7 @@ function actionsMapBase$7(diff, previous, next) {
3179
3179
  if (!diff) return [];
3180
3180
  return buildBaseAttributesActions({
3181
3181
  diff: diff,
3182
- actions: baseActionsList$7,
3182
+ actions: baseActionsList$8,
3183
3183
  oldObj: previous,
3184
3184
  newObj: next,
3185
3185
  shouldOmitEmptyString: config.shouldOmitEmptyString
@@ -3405,7 +3405,7 @@ function createProductTypeMapActions(mapActionGroup, syncActionConfig) {
3405
3405
  return flatten__default["default"]([// we support only base fields for the product type,
3406
3406
  // for attributes, applying hints would be recommended
3407
3407
  mapActionGroup('base', function () {
3408
- return actionsMapBase$7(diff, previous, next, syncActionConfig);
3408
+ return actionsMapBase$8(diff, previous, next, syncActionConfig);
3409
3409
  }), actionsMapForHints(options.nestedValuesChanges, previous, next)]);
3410
3410
  };
3411
3411
  }
@@ -3422,7 +3422,7 @@ var productTypes = (function (actionGroupList, syncActionConfig) {
3422
3422
  };
3423
3423
  });
3424
3424
 
3425
- var baseActionsList$6 = [{
3425
+ var baseActionsList$7 = [{
3426
3426
  action: 'changeKey',
3427
3427
  key: 'key'
3428
3428
  }, {
@@ -3441,10 +3441,10 @@ var baseActionsList$6 = [{
3441
3441
  action: 'setTransitions',
3442
3442
  key: 'transitions'
3443
3443
  }];
3444
- function actionsMapBase$6(diff, oldObj, newObj) {
3444
+ function actionsMapBase$7(diff, oldObj, newObj) {
3445
3445
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
3446
3446
  return buildBaseAttributesActions({
3447
- actions: baseActionsList$6,
3447
+ actions: baseActionsList$7,
3448
3448
  diff: diff,
3449
3449
  oldObj: oldObj,
3450
3450
  newObj: newObj,
@@ -3494,7 +3494,7 @@ function createStatesMapActions(mapActionGroup, syncActionConfig) {
3494
3494
  var baseActions = [];
3495
3495
  var roleActions = [];
3496
3496
  baseActions.push(mapActionGroup('base', function () {
3497
- return actionsMapBase$6(diff, oldObj, newObj, syncActionConfig);
3497
+ return actionsMapBase$7(diff, oldObj, newObj, syncActionConfig);
3498
3498
  }));
3499
3499
  roleActions.push(mapActionGroup('roles', function () {
3500
3500
  return actionsMapRoles(diff, oldObj, newObj);
@@ -3512,7 +3512,7 @@ var states = (function (actionGroupList, syncActionConfig) {
3512
3512
  };
3513
3513
  });
3514
3514
 
3515
- var baseActionsList$5 = [{
3515
+ var baseActionsList$6 = [{
3516
3516
  action: 'changeKey',
3517
3517
  key: 'key'
3518
3518
  }, {
@@ -3531,10 +3531,10 @@ var baseActionsList$5 = [{
3531
3531
  action: 'setRoles',
3532
3532
  key: 'roles'
3533
3533
  }];
3534
- function actionsMapBase$5(diff, oldObj, newObj) {
3534
+ function actionsMapBase$6(diff, oldObj, newObj) {
3535
3535
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
3536
3536
  return buildBaseAttributesActions({
3537
- actions: baseActionsList$5,
3537
+ actions: baseActionsList$6,
3538
3538
  diff: diff,
3539
3539
  oldObj: oldObj,
3540
3540
  newObj: newObj,
@@ -3546,7 +3546,7 @@ function createChannelsMapActions$1(mapActionGroup, syncActionConfig) {
3546
3546
  return function doMapActions(diff, newObj, oldObj) {
3547
3547
  var allActions = [];
3548
3548
  allActions.push(mapActionGroup('base', function () {
3549
- return actionsMapBase$5(diff, oldObj, newObj, syncActionConfig);
3549
+ return actionsMapBase$6(diff, oldObj, newObj, syncActionConfig);
3550
3550
  }));
3551
3551
  allActions.push(mapActionGroup('custom', function () {
3552
3552
  return actionsMapCustom(diff, newObj, oldObj);
@@ -3576,7 +3576,7 @@ var getIsRemovedOperation = function getIsRemovedOperation(key) {
3576
3576
  return REGEX_UNDERSCORE_NUMBER.test(key);
3577
3577
  };
3578
3578
 
3579
- var baseActionsList$4 = [{
3579
+ var baseActionsList$5 = [{
3580
3580
  action: 'changeKey',
3581
3581
  key: 'key'
3582
3582
  }, {
@@ -3586,10 +3586,10 @@ var baseActionsList$4 = [{
3586
3586
  action: 'setDescription',
3587
3587
  key: 'description'
3588
3588
  }];
3589
- function actionsMapBase$4(diff, oldObj, newObj) {
3589
+ function actionsMapBase$5(diff, oldObj, newObj) {
3590
3590
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
3591
3591
  return buildBaseAttributesActions({
3592
- actions: baseActionsList$4,
3592
+ actions: baseActionsList$5,
3593
3593
  diff: diff,
3594
3594
  oldObj: oldObj,
3595
3595
  newObj: newObj,
@@ -3738,7 +3738,7 @@ function createTypeMapActions(mapActionGroup, syncActionConfig) {
3738
3738
  return function doMapActions(diff, next, previous) {
3739
3739
  var allActions = [];
3740
3740
  allActions.push(mapActionGroup('base', function () {
3741
- return actionsMapBase$4(diff, previous, next, syncActionConfig);
3741
+ return actionsMapBase$5(diff, previous, next, syncActionConfig);
3742
3742
  }), mapActionGroup('fieldDefinitions', function () {
3743
3743
  return actionsMapFieldDefinitions(diff.fieldDefinitions, previous.fieldDefinitions, next.fieldDefinitions, findMatchingPairs(diff.fieldDefinitions, previous.fieldDefinitions, next.fieldDefinitions, 'name'));
3744
3744
  }));
@@ -3755,7 +3755,7 @@ var types = (function (actionGroupList, syncActionConfig) {
3755
3755
  };
3756
3756
  });
3757
3757
 
3758
- var baseActionsList$3 = [{
3758
+ var baseActionsList$4 = [{
3759
3759
  action: 'changeName',
3760
3760
  key: 'name'
3761
3761
  }, {
@@ -3774,10 +3774,10 @@ var baseActionsList$3 = [{
3774
3774
  action: 'setShippingRateInputType',
3775
3775
  key: 'shippingRateInputType'
3776
3776
  }];
3777
- function actionsMapBase$3(diff, oldObj, newObj) {
3777
+ function actionsMapBase$4(diff, oldObj, newObj) {
3778
3778
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
3779
3779
  return buildBaseAttributesActions({
3780
- actions: baseActionsList$3,
3780
+ actions: baseActionsList$4,
3781
3781
  diff: diff,
3782
3782
  oldObj: oldObj,
3783
3783
  newObj: newObj,
@@ -3789,7 +3789,7 @@ function createChannelsMapActions(mapActionGroup, syncActionConfig) {
3789
3789
  return function doMapActions(diff, newObj, oldObj) {
3790
3790
  var allActions = [];
3791
3791
  allActions.push(mapActionGroup('base', function () {
3792
- return actionsMapBase$3(diff, oldObj, newObj, syncActionConfig);
3792
+ return actionsMapBase$4(diff, oldObj, newObj, syncActionConfig);
3793
3793
  }));
3794
3794
  return flatten__default["default"](allActions);
3795
3795
  };
@@ -3805,7 +3805,7 @@ var projects = (function (actionGroupList) {
3805
3805
  };
3806
3806
  });
3807
3807
 
3808
- var baseActionsList$2 = [{
3808
+ var baseActionsList$3 = [{
3809
3809
  action: 'setName',
3810
3810
  key: 'name'
3811
3811
  }, {
@@ -3818,9 +3818,9 @@ var baseActionsList$2 = [{
3818
3818
  action: 'setSupplyChannels',
3819
3819
  key: 'supplyChannels'
3820
3820
  }];
3821
- function actionsMapBase$2(diff, oldObj, newObj) {
3821
+ function actionsMapBase$3(diff, oldObj, newObj) {
3822
3822
  return buildBaseAttributesActions({
3823
- actions: baseActionsList$2,
3823
+ actions: baseActionsList$3,
3824
3824
  diff: diff,
3825
3825
  oldObj: oldObj,
3826
3826
  newObj: newObj
@@ -3831,7 +3831,7 @@ function createStoresMapActions(mapActionGroup) {
3831
3831
  return function doMapActions(diff, next, previous) {
3832
3832
  var allActions = [];
3833
3833
  allActions.push(mapActionGroup('base', function () {
3834
- return actionsMapBase$2(diff, previous, next);
3834
+ return actionsMapBase$3(diff, previous, next);
3835
3835
  }));
3836
3836
  allActions.push(mapActionGroup('custom', function () {
3837
3837
  return actionsMapCustom(diff, next, previous);
@@ -3850,16 +3850,16 @@ var stores = (function (actionGroupList) {
3850
3850
  };
3851
3851
  });
3852
3852
 
3853
- var baseActionsList$1 = [{
3853
+ var baseActionsList$2 = [{
3854
3854
  action: 'changeName',
3855
3855
  key: 'name'
3856
3856
  }, {
3857
3857
  action: 'setKey',
3858
3858
  key: 'key'
3859
3859
  }];
3860
- function actionsMapBase$1(diff, oldObj, newObj) {
3860
+ function actionsMapBase$2(diff, oldObj, newObj) {
3861
3861
  return buildBaseAttributesActions({
3862
- actions: baseActionsList$1,
3862
+ actions: baseActionsList$2,
3863
3863
  diff: diff,
3864
3864
  oldObj: oldObj,
3865
3865
  newObj: newObj
@@ -3870,7 +3870,7 @@ function createProductSelectionsMapActions(mapActionGroup) {
3870
3870
  return function doMapActions(diff, next, previous) {
3871
3871
  var allActions = [];
3872
3872
  allActions.push(mapActionGroup('base', function () {
3873
- return actionsMapBase$1(diff, previous, next);
3873
+ return actionsMapBase$2(diff, previous, next);
3874
3874
  }));
3875
3875
  allActions.push(mapActionGroup('custom', function () {
3876
3876
  return actionsMapCustom(diff, next, previous);
@@ -3889,7 +3889,7 @@ var productSelections = (function (actionGroupList) {
3889
3889
  };
3890
3890
  });
3891
3891
 
3892
- var baseActionsList = [{
3892
+ var baseActionsList$1 = [{
3893
3893
  action: 'changeValue',
3894
3894
  key: 'value'
3895
3895
  }, {
@@ -3912,10 +3912,10 @@ var baseActionsList = [{
3912
3912
  action: 'changeActive',
3913
3913
  key: 'active'
3914
3914
  }];
3915
- function actionsMapBase(diff, oldObj, newObj) {
3915
+ function actionsMapBase$1(diff, oldObj, newObj) {
3916
3916
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
3917
3917
  return buildBaseAttributesActions({
3918
- actions: baseActionsList,
3918
+ actions: baseActionsList$1,
3919
3919
  diff: diff,
3920
3920
  oldObj: oldObj,
3921
3921
  newObj: newObj,
@@ -3926,7 +3926,7 @@ function actionsMapBase(diff, oldObj, newObj) {
3926
3926
  function createPriceMapActions(mapActionGroup, syncActionConfig) {
3927
3927
  return function doMapActions(diff, newObj, oldObj) {
3928
3928
  var baseActions = mapActionGroup('base', function () {
3929
- return actionsMapBase(diff, oldObj, newObj, syncActionConfig);
3929
+ return actionsMapBase$1(diff, oldObj, newObj, syncActionConfig);
3930
3930
  });
3931
3931
  var customActions = mapActionGroup('custom', function () {
3932
3932
  return actionsMapCustom(diff, newObj, oldObj);
@@ -3944,6 +3944,88 @@ var prices = (function (actionGroupList, syncActionConfig) {
3944
3944
  };
3945
3945
  });
3946
3946
 
3947
+ var hasAttribute = function hasAttribute(attributes, newValue) {
3948
+ return attributes.some(function (attribute) {
3949
+ return attribute.key === newValue.key;
3950
+ });
3951
+ };
3952
+
3953
+ var baseActionsList = [{
3954
+ action: 'changeName',
3955
+ key: 'name'
3956
+ }, {
3957
+ action: 'setKey',
3958
+ key: 'key'
3959
+ }, {
3960
+ action: 'setDescription',
3961
+ key: 'description'
3962
+ }];
3963
+ function actionsMapBase(diff, oldObj, newObj) {
3964
+ var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
3965
+ return buildBaseAttributesActions({
3966
+ actions: baseActionsList,
3967
+ diff: diff,
3968
+ oldObj: oldObj,
3969
+ newObj: newObj,
3970
+ shouldOmitEmptyString: config.shouldOmitEmptyString
3971
+ });
3972
+ }
3973
+ function actionsMapAttributes(diff, oldObj, newObj) {
3974
+ var _createBuildArrayActi;
3975
+
3976
+ var handler = createBuildArrayActions('attributes', (_createBuildArrayActi = {}, _defineProperty(_createBuildArrayActi, ADD_ACTIONS, function (newAttribute) {
3977
+ return {
3978
+ action: 'addAttribute',
3979
+ attribute: newAttribute
3980
+ };
3981
+ }), _defineProperty(_createBuildArrayActi, REMOVE_ACTIONS, function (oldAttribute) {
3982
+ // We only add the action if the attribute is not included in the new object.
3983
+ return !hasAttribute(newObj.attributes, oldAttribute) ? {
3984
+ action: 'removeAttribute',
3985
+ attribute: oldAttribute
3986
+ } : null;
3987
+ }), _defineProperty(_createBuildArrayActi, CHANGE_ACTIONS, function (oldAttribute, newAttribute) {
3988
+ var result = []; // We only remove the attribute in case that the oldAttribute is not
3989
+ // included in the new object
3990
+
3991
+ if (!hasAttribute(newObj.attributes, oldAttribute)) result.push({
3992
+ action: 'removeAttribute',
3993
+ attribute: oldAttribute
3994
+ }); // We only add the attribute in case that the newAttribute was not
3995
+ // included in the old object
3996
+
3997
+ if (!hasAttribute(oldObj.attributes, newAttribute)) result.push({
3998
+ action: 'addAttribute',
3999
+ attribute: newAttribute
4000
+ });
4001
+ return result;
4002
+ }), _createBuildArrayActi));
4003
+ return handler(diff, oldObj, newObj);
4004
+ }
4005
+
4006
+ function createAttributeGroupsMapActions(mapActionGroup, syncActionConfig) {
4007
+ return function doMapActions(diff, newObj, oldObj) {
4008
+ var allActions = [];
4009
+ allActions.push(mapActionGroup('base', function () {
4010
+ return actionsMapBase(diff, oldObj, newObj, syncActionConfig);
4011
+ }));
4012
+ allActions.push(flatten__default["default"](mapActionGroup('attributes', function () {
4013
+ return actionsMapAttributes(diff, oldObj, newObj);
4014
+ })));
4015
+ return flatten__default["default"](allActions);
4016
+ };
4017
+ }
4018
+
4019
+ var attributeGroups = (function (actionGroupList, syncActionConfig) {
4020
+ var mapActionGroup = createMapActionGroup(actionGroupList);
4021
+ var doMapActions = createAttributeGroupsMapActions(mapActionGroup, syncActionConfig);
4022
+ var buildActions = createBuildActions(diff, doMapActions);
4023
+ return {
4024
+ buildActions: buildActions
4025
+ };
4026
+ });
4027
+
4028
+ exports.createSyncAttributeGroups = attributeGroups;
3947
4029
  exports.createSyncCartDiscounts = cartDiscounts;
3948
4030
  exports.createSyncCategories = categories;
3949
4031
  exports.createSyncChannels = channels;