@commercetools/sync-actions 5.12.2 → 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.
@@ -287,11 +287,14 @@ var diffpatcher = new DiffPatcher({
287
287
  includeValueOnMove: false
288
288
  },
289
289
  textDiff: {
290
- // If the value to diff has a bigger length,
291
- // a text diffing algorithm is used
292
- // See https://github.com/benjamine/jsondiffpatch/
293
- // blob/master/docs/deltas.md#text-diffs
294
- minLength: 300
290
+ /**
291
+ * jsondiffpatch uses a very fine-grained diffing algorithm for long strings to easily identify
292
+ * what changed between strings. However, we don't actually care about what changed, just
293
+ * if the string changed at all. So we set the minimum length to diff to a very large number to avoid
294
+ * using the very slow algorithm.
295
+ * See https://github.com/benjamine/jsondiffpatch/blob/master/docs/deltas.md#text-diffs.
296
+ */
297
+ minLength: Number.MAX_SAFE_INTEGER
295
298
  }
296
299
  });
297
300
  function diff(oldObj, newObj) {
@@ -669,7 +672,7 @@ function buildReferenceActions(_ref4) {
669
672
  });
670
673
  }
671
674
 
672
- var baseActionsList$j = [{
675
+ var baseActionsList$k = [{
673
676
  action: 'changeName',
674
677
  key: 'name'
675
678
  }, {
@@ -706,10 +709,10 @@ var referenceActionsList$3 = [{
706
709
  * SYNC FUNCTIONS
707
710
  */
708
711
 
709
- function actionsMapBase$j(diff, oldObj, newObj) {
712
+ function actionsMapBase$k(diff, oldObj, newObj) {
710
713
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
711
714
  return buildBaseAttributesActions({
712
- actions: baseActionsList$j,
715
+ actions: baseActionsList$k,
713
716
  diff: diff,
714
717
  oldObj: oldObj,
715
718
  newObj: newObj,
@@ -817,7 +820,7 @@ function createCategoryMapActions(mapActionGroup, syncActionConfig) {
817
820
  return function doMapActions(diff, newObj, oldObj) {
818
821
  var allActions = [];
819
822
  allActions.push(mapActionGroup('base', function () {
820
- return actionsMapBase$j(diff, oldObj, newObj, syncActionConfig);
823
+ return actionsMapBase$k(diff, oldObj, newObj, syncActionConfig);
821
824
  }));
822
825
  allActions.push(mapActionGroup('references', function () {
823
826
  return actionsMapReferences$3(diff, oldObj, newObj);
@@ -854,7 +857,7 @@ var categories = (function (actionGroupList, syncActionConfig) {
854
857
  });
855
858
 
856
859
  var isEmptyValue = createIsEmptyValue([undefined, null, '']);
857
- var baseActionsList$i = [{
860
+ var baseActionsList$j = [{
858
861
  action: 'setSalutation',
859
862
  key: 'salutation'
860
863
  }, {
@@ -919,10 +922,10 @@ var authenticationModeActionsList = [{
919
922
  * SYNC FUNCTIONS
920
923
  */
921
924
 
922
- function actionsMapBase$i(diff, oldObj, newObj) {
925
+ function actionsMapBase$j(diff, oldObj, newObj) {
923
926
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
924
927
  return buildBaseAttributesActions({
925
- actions: baseActionsList$i,
928
+ actions: baseActionsList$j,
926
929
  diff: diff,
927
930
  oldObj: oldObj,
928
931
  newObj: newObj,
@@ -1066,7 +1069,7 @@ function createCustomerMapActions(mapActionGroup, syncActionConfig) {
1066
1069
  return function doMapActions(diff, newObj, oldObj) {
1067
1070
  var allActions = [];
1068
1071
  allActions.push(mapActionGroup('base', function () {
1069
- return actionsMapBase$i(diff, oldObj, newObj, syncActionConfig);
1072
+ return actionsMapBase$j(diff, oldObj, newObj, syncActionConfig);
1070
1073
  }));
1071
1074
  allActions.push(mapActionGroup('references', function () {
1072
1075
  return actionsMapReferences$2(diff, oldObj, newObj);
@@ -1111,7 +1114,7 @@ var customers = (function (actionGroupList, syncActionConfig) {
1111
1114
  };
1112
1115
  });
1113
1116
 
1114
- var baseActionsList$h = [{
1117
+ var baseActionsList$i = [{
1115
1118
  action: 'changeQuantity',
1116
1119
  key: 'quantityOnStock',
1117
1120
  actionKey: 'quantity'
@@ -1130,10 +1133,10 @@ var referenceActionsList$1 = [{
1130
1133
  * SYNC FUNCTIONS
1131
1134
  */
1132
1135
 
1133
- function actionsMapBase$h(diff, oldObj, newObj) {
1136
+ function actionsMapBase$i(diff, oldObj, newObj) {
1134
1137
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1135
1138
  return buildBaseAttributesActions({
1136
- actions: baseActionsList$h,
1139
+ actions: baseActionsList$i,
1137
1140
  diff: diff,
1138
1141
  oldObj: oldObj,
1139
1142
  newObj: newObj,
@@ -1153,7 +1156,7 @@ function createInventoryMapActions(mapActionGroup, syncActionConfig) {
1153
1156
  return function doMapActions(diff, newObj, oldObj) {
1154
1157
  var allActions = [];
1155
1158
  allActions.push(mapActionGroup('base', function () {
1156
- return actionsMapBase$h(diff, oldObj, newObj, syncActionConfig);
1159
+ return actionsMapBase$i(diff, oldObj, newObj, syncActionConfig);
1157
1160
  }));
1158
1161
  allActions.push(mapActionGroup('references', function () {
1159
1162
  return actionsMapReferences$1(diff, oldObj, newObj);
@@ -1248,7 +1251,7 @@ function findMatchingPairs(diff) {
1248
1251
 
1249
1252
  var REGEX_NUMBER$2 = new RegExp(/^\d+$/);
1250
1253
  var REGEX_UNDERSCORE_NUMBER$2 = new RegExp(/^_\d+$/);
1251
- var baseActionsList$g = [{
1254
+ var baseActionsList$h = [{
1252
1255
  action: 'changeName',
1253
1256
  key: 'name'
1254
1257
  }, {
@@ -1655,10 +1658,10 @@ function _buildVariantAssetsActions(diffAssets, oldVariant, newVariant) {
1655
1658
  */
1656
1659
 
1657
1660
 
1658
- function actionsMapBase$g(diff, oldObj, newObj) {
1661
+ function actionsMapBase$h(diff, oldObj, newObj) {
1659
1662
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1660
1663
  return buildBaseAttributesActions({
1661
- actions: baseActionsList$g,
1664
+ actions: baseActionsList$h,
1662
1665
  diff: diff,
1663
1666
  oldObj: oldObj,
1664
1667
  newObj: newObj,
@@ -1758,7 +1761,7 @@ function actionsMapAssets(diff, oldObj, newObj, variantHashMap) {
1758
1761
  });
1759
1762
  return allAssetsActions;
1760
1763
  }
1761
- function actionsMapAttributes(diff, oldObj, newObj) {
1764
+ function actionsMapAttributes$1(diff, oldObj, newObj) {
1762
1765
  var sameForAllAttributeNames = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
1763
1766
  var variantHashMap = arguments.length > 4 ? arguments[4] : undefined;
1764
1767
  var actions = [];
@@ -1889,7 +1892,7 @@ function createProductMapActions(mapActionGroup, syncActionConfig) {
1889
1892
  staged = newObj.staged;
1890
1893
  var variantHashMap = findMatchingPairs(diff.variants, oldObj.variants, newObj.variants);
1891
1894
  allActions.push(mapActionGroup('attributes', function () {
1892
- return actionsMapAttributes(diff, oldObj, newObj, sameForAllAttributeNames || [], variantHashMap);
1895
+ return actionsMapAttributes$1(diff, oldObj, newObj, sameForAllAttributeNames || [], variantHashMap);
1893
1896
  }));
1894
1897
  allActions.push(mapActionGroup('variants', function () {
1895
1898
  return actionsMapAddVariants(diff, oldObj, newObj);
@@ -1899,7 +1902,7 @@ function createProductMapActions(mapActionGroup, syncActionConfig) {
1899
1902
  return actionsMapRemoveVariants(diff, oldObj, newObj);
1900
1903
  }));
1901
1904
  allActions.push(mapActionGroup('base', function () {
1902
- return actionsMapBase$g(diff, oldObj, newObj, syncActionConfig);
1905
+ return actionsMapBase$h(diff, oldObj, newObj, syncActionConfig);
1903
1906
  }));
1904
1907
  allActions.push(mapActionGroup('meta', function () {
1905
1908
  return actionsMapMeta(diff, oldObj, newObj);
@@ -1974,7 +1977,7 @@ var isRemoveAction = function isRemoveAction(key, resource) {
1974
1977
  return REGEX_UNDERSCORE_NUMBER$1.test(key) && Number(resource[2]) === 0;
1975
1978
  };
1976
1979
 
1977
- var baseActionsList$f = [{
1980
+ var baseActionsList$g = [{
1978
1981
  action: 'changeOrderState',
1979
1982
  key: 'orderState'
1980
1983
  }, {
@@ -1988,10 +1991,10 @@ var baseActionsList$f = [{
1988
1991
  * SYNC FUNCTIONS
1989
1992
  */
1990
1993
 
1991
- function actionsMapBase$f(diff, oldObj, newObj) {
1994
+ function actionsMapBase$g(diff, oldObj, newObj) {
1992
1995
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1993
1996
  return buildBaseAttributesActions({
1994
- actions: baseActionsList$f,
1997
+ actions: baseActionsList$g,
1995
1998
  diff: diff,
1996
1999
  oldObj: oldObj,
1997
2000
  newObj: newObj,
@@ -2158,7 +2161,7 @@ function createOrderMapActions(mapActionGroup, syncActionConfig) {
2158
2161
  }
2159
2162
 
2160
2163
  allActions.push(mapActionGroup('base', function () {
2161
- return actionsMapBase$f(diff, oldObj, newObj, syncActionConfig);
2164
+ return actionsMapBase$g(diff, oldObj, newObj, syncActionConfig);
2162
2165
  }));
2163
2166
  allActions.push(mapActionGroup('deliveries', function () {
2164
2167
  return actionsMapDeliveries(diff, oldObj, newObj);
@@ -2197,7 +2200,7 @@ var orders = (function (actionGroupList, syncActionConfig) {
2197
2200
  };
2198
2201
  });
2199
2202
 
2200
- var baseActionsList$e = [{
2203
+ var baseActionsList$f = [{
2201
2204
  action: 'changeIsActive',
2202
2205
  key: 'isActive'
2203
2206
  }, {
@@ -2225,10 +2228,10 @@ var baseActionsList$e = [{
2225
2228
  action: 'setKey',
2226
2229
  key: 'key'
2227
2230
  }];
2228
- function actionsMapBase$e(diff, oldObj, newObj) {
2231
+ function actionsMapBase$f(diff, oldObj, newObj) {
2229
2232
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
2230
2233
  return buildBaseAttributesActions({
2231
- actions: baseActionsList$e,
2234
+ actions: baseActionsList$f,
2232
2235
  diff: diff,
2233
2236
  oldObj: oldObj,
2234
2237
  newObj: newObj,
@@ -2269,7 +2272,7 @@ function createProductDiscountsMapActions(mapActionGroup, syncActionConfig) {
2269
2272
  return function doMapActions(diff, newObj, oldObj) {
2270
2273
  var allActions = [];
2271
2274
  allActions.push(mapActionGroup('base', function () {
2272
- return actionsMapBase$e(diff, oldObj, newObj, syncActionConfig);
2275
+ return actionsMapBase$f(diff, oldObj, newObj, syncActionConfig);
2273
2276
  }));
2274
2277
  return combineValidityActions(flatten(allActions));
2275
2278
  };
@@ -2285,7 +2288,7 @@ var productDiscounts = (function (actionGroupList) {
2285
2288
  };
2286
2289
  });
2287
2290
 
2288
- var baseActionsList$d = [{
2291
+ var baseActionsList$e = [{
2289
2292
  action: 'changeIsActive',
2290
2293
  key: 'isActive'
2291
2294
  }, {
@@ -2316,10 +2319,10 @@ var baseActionsList$d = [{
2316
2319
  action: 'changeGroups',
2317
2320
  key: 'groups'
2318
2321
  }];
2319
- function actionsMapBase$d(diff, oldObj, newObj) {
2322
+ function actionsMapBase$e(diff, oldObj, newObj) {
2320
2323
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
2321
2324
  return buildBaseAttributesActions({
2322
- actions: baseActionsList$d,
2325
+ actions: baseActionsList$e,
2323
2326
  diff: diff,
2324
2327
  oldObj: oldObj,
2325
2328
  newObj: newObj,
@@ -2331,7 +2334,7 @@ function createDiscountCodesMapActions(mapActionGroup, syncActionConfig) {
2331
2334
  return function doMapActions(diff, newObj, oldObj) {
2332
2335
  var allActions = [];
2333
2336
  allActions.push(mapActionGroup('base', function () {
2334
- return actionsMapBase$d(diff, oldObj, newObj, syncActionConfig);
2337
+ return actionsMapBase$e(diff, oldObj, newObj, syncActionConfig);
2335
2338
  }));
2336
2339
  allActions.push(mapActionGroup('custom', function () {
2337
2340
  return actionsMapCustom(diff, newObj, oldObj);
@@ -2359,17 +2362,17 @@ var discountCodes = (function (actionGroupList) {
2359
2362
  };
2360
2363
  });
2361
2364
 
2362
- var baseActionsList$c = [{
2365
+ var baseActionsList$d = [{
2363
2366
  action: 'changeName',
2364
2367
  key: 'name'
2365
2368
  }, {
2366
2369
  action: 'setKey',
2367
2370
  key: 'key'
2368
2371
  }];
2369
- function actionsMapBase$c(diff, oldObj, newObj) {
2372
+ function actionsMapBase$d(diff, oldObj, newObj) {
2370
2373
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
2371
2374
  return buildBaseAttributesActions({
2372
- actions: baseActionsList$c,
2375
+ actions: baseActionsList$d,
2373
2376
  diff: diff,
2374
2377
  oldObj: oldObj,
2375
2378
  newObj: newObj,
@@ -2381,7 +2384,7 @@ function createCustomerGroupMapActions(mapActionGroup, syncActionConfig) {
2381
2384
  return function doMapActions(diff, newObj, oldObj) {
2382
2385
  var allActions = [];
2383
2386
  allActions.push(mapActionGroup('base', function () {
2384
- return actionsMapBase$c(diff, oldObj, newObj, syncActionConfig);
2387
+ return actionsMapBase$d(diff, oldObj, newObj, syncActionConfig);
2385
2388
  }));
2386
2389
  allActions.push(mapActionGroup('custom', function () {
2387
2390
  return actionsMapCustom(diff, newObj, oldObj);
@@ -2400,7 +2403,7 @@ var customerGroup = (function (actionGroupList) {
2400
2403
  };
2401
2404
  });
2402
2405
 
2403
- var baseActionsList$b = [{
2406
+ var baseActionsList$c = [{
2404
2407
  action: 'changeIsActive',
2405
2408
  key: 'isActive'
2406
2409
  }, {
@@ -2437,10 +2440,10 @@ var baseActionsList$b = [{
2437
2440
  action: 'setKey',
2438
2441
  key: 'key'
2439
2442
  }];
2440
- function actionsMapBase$b(diff, oldObj, newObj) {
2443
+ function actionsMapBase$c(diff, oldObj, newObj) {
2441
2444
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
2442
2445
  return buildBaseAttributesActions({
2443
- actions: baseActionsList$b,
2446
+ actions: baseActionsList$c,
2444
2447
  diff: diff,
2445
2448
  oldObj: oldObj,
2446
2449
  newObj: newObj,
@@ -2452,7 +2455,7 @@ function createCartDiscountsMapActions(mapActionGroup, syncActionConfig) {
2452
2455
  return function doMapActions(diff, newObj, oldObj) {
2453
2456
  var allActions = [];
2454
2457
  allActions.push(mapActionGroup('base', function () {
2455
- return actionsMapBase$b(diff, oldObj, newObj, syncActionConfig);
2458
+ return actionsMapBase$c(diff, oldObj, newObj, syncActionConfig);
2456
2459
  }));
2457
2460
  allActions.push(mapActionGroup('custom', function () {
2458
2461
  return actionsMapCustom(diff, newObj, oldObj);
@@ -2471,7 +2474,7 @@ var cartDiscounts = (function (actionGroupList) {
2471
2474
  };
2472
2475
  });
2473
2476
 
2474
- var baseActionsList$a = [{
2477
+ var baseActionsList$b = [{
2475
2478
  action: 'changeName',
2476
2479
  key: 'name'
2477
2480
  }, {
@@ -2481,10 +2484,10 @@ var baseActionsList$a = [{
2481
2484
  action: 'setDescription',
2482
2485
  key: 'description'
2483
2486
  }];
2484
- function actionsMapBase$a(diff, oldObj, newObj) {
2487
+ function actionsMapBase$b(diff, oldObj, newObj) {
2485
2488
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
2486
2489
  return buildBaseAttributesActions({
2487
- actions: baseActionsList$a,
2490
+ actions: baseActionsList$b,
2488
2491
  diff: diff,
2489
2492
  oldObj: oldObj,
2490
2493
  newObj: newObj,
@@ -2518,7 +2521,7 @@ function createTaxCategoriesMapActions(mapActionGroup, syncActionConfig) {
2518
2521
  return function doMapActions(diff, newObj, oldObj) {
2519
2522
  var allActions = [];
2520
2523
  allActions.push(mapActionGroup('base', function () {
2521
- return actionsMapBase$a(diff, oldObj, newObj, syncActionConfig);
2524
+ return actionsMapBase$b(diff, oldObj, newObj, syncActionConfig);
2522
2525
  }));
2523
2526
  allActions.push(mapActionGroup('rates', function () {
2524
2527
  return actionsMapRates(diff, oldObj, newObj);
@@ -2545,7 +2548,7 @@ var taxCategories = (function (actionGroupList, syncActionConfig) {
2545
2548
  };
2546
2549
  });
2547
2550
 
2548
- var baseActionsList$9 = [{
2551
+ var baseActionsList$a = [{
2549
2552
  action: 'changeName',
2550
2553
  key: 'name'
2551
2554
  }, {
@@ -2562,10 +2565,10 @@ var hasLocation = function hasLocation(locations, otherLocation) {
2562
2565
  });
2563
2566
  };
2564
2567
 
2565
- function actionsMapBase$9(diff, oldObj, newObj) {
2568
+ function actionsMapBase$a(diff, oldObj, newObj) {
2566
2569
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
2567
2570
  return buildBaseAttributesActions({
2568
- actions: baseActionsList$9,
2571
+ actions: baseActionsList$a,
2569
2572
  diff: diff,
2570
2573
  oldObj: oldObj,
2571
2574
  newObj: newObj,
@@ -2610,7 +2613,7 @@ function createZonesMapActions(mapActionGroup, syncActionConfig) {
2610
2613
  return function doMapActions(diff, newObj, oldObj) {
2611
2614
  var allActions = [];
2612
2615
  allActions.push(mapActionGroup('base', function () {
2613
- return actionsMapBase$9(diff, oldObj, newObj, syncActionConfig);
2616
+ return actionsMapBase$a(diff, oldObj, newObj, syncActionConfig);
2614
2617
  }));
2615
2618
  allActions.push(flatten(mapActionGroup('locations', function () {
2616
2619
  return actionsMapLocations(diff, oldObj, newObj);
@@ -2637,7 +2640,7 @@ var zones = (function (actionGroupList, syncActionConfig) {
2637
2640
  };
2638
2641
  });
2639
2642
 
2640
- var baseActionsList$8 = [{
2643
+ var baseActionsList$9 = [{
2641
2644
  action: 'setKey',
2642
2645
  key: 'key'
2643
2646
  }, {
@@ -2662,10 +2665,10 @@ var baseActionsList$8 = [{
2662
2665
  action: 'changeTaxCategory',
2663
2666
  key: 'taxCategory'
2664
2667
  }];
2665
- function actionsMapBase$8(diff, oldObj, newObj) {
2668
+ function actionsMapBase$9(diff, oldObj, newObj) {
2666
2669
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
2667
2670
  return buildBaseAttributesActions({
2668
- actions: baseActionsList$8,
2671
+ actions: baseActionsList$9,
2669
2672
  diff: diff,
2670
2673
  oldObj: oldObj,
2671
2674
  newObj: newObj,
@@ -2747,7 +2750,7 @@ function createShippingMethodsMapActions(mapActionGroup, syncActionConfig) {
2747
2750
  return function doMapActions(diff, newObj, oldObj) {
2748
2751
  var allActions = [];
2749
2752
  allActions.push(mapActionGroup('base', function () {
2750
- return actionsMapBase$8(diff, oldObj, newObj, syncActionConfig);
2753
+ return actionsMapBase$9(diff, oldObj, newObj, syncActionConfig);
2751
2754
  }));
2752
2755
  allActions.push(flatten(mapActionGroup('zoneRates', function () {
2753
2756
  return actionsMapZoneRates(diff, oldObj, newObj);
@@ -3145,7 +3148,7 @@ createComparator(function () {
3145
3148
  createComparator(createCircularEqualCreator());
3146
3149
  createComparator(createCircularEqualCreator(sameValueZeroEqual));
3147
3150
 
3148
- var baseActionsList$7 = [{
3151
+ var baseActionsList$8 = [{
3149
3152
  action: 'changeName',
3150
3153
  key: 'name'
3151
3154
  }, {
@@ -3155,7 +3158,7 @@ var baseActionsList$7 = [{
3155
3158
  action: 'changeDescription',
3156
3159
  key: 'description'
3157
3160
  }];
3158
- function actionsMapBase$7(diff, previous, next) {
3161
+ function actionsMapBase$8(diff, previous, next) {
3159
3162
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
3160
3163
  // when `diff` is undefined, then the underlying `buildActions` has returned any diff
3161
3164
  // which given in product-types would mean that `buildActions` has run with `nestedValuesChanges` applied
@@ -3163,7 +3166,7 @@ function actionsMapBase$7(diff, previous, next) {
3163
3166
  if (!diff) return [];
3164
3167
  return buildBaseAttributesActions({
3165
3168
  diff: diff,
3166
- actions: baseActionsList$7,
3169
+ actions: baseActionsList$8,
3167
3170
  oldObj: previous,
3168
3171
  newObj: next,
3169
3172
  shouldOmitEmptyString: config.shouldOmitEmptyString
@@ -3389,7 +3392,7 @@ function createProductTypeMapActions(mapActionGroup, syncActionConfig) {
3389
3392
  return flatten([// we support only base fields for the product type,
3390
3393
  // for attributes, applying hints would be recommended
3391
3394
  mapActionGroup('base', function () {
3392
- return actionsMapBase$7(diff, previous, next, syncActionConfig);
3395
+ return actionsMapBase$8(diff, previous, next, syncActionConfig);
3393
3396
  }), actionsMapForHints(options.nestedValuesChanges, previous, next)]);
3394
3397
  };
3395
3398
  }
@@ -3406,7 +3409,7 @@ var productTypes = (function (actionGroupList, syncActionConfig) {
3406
3409
  };
3407
3410
  });
3408
3411
 
3409
- var baseActionsList$6 = [{
3412
+ var baseActionsList$7 = [{
3410
3413
  action: 'changeKey',
3411
3414
  key: 'key'
3412
3415
  }, {
@@ -3425,10 +3428,10 @@ var baseActionsList$6 = [{
3425
3428
  action: 'setTransitions',
3426
3429
  key: 'transitions'
3427
3430
  }];
3428
- function actionsMapBase$6(diff, oldObj, newObj) {
3431
+ function actionsMapBase$7(diff, oldObj, newObj) {
3429
3432
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
3430
3433
  return buildBaseAttributesActions({
3431
- actions: baseActionsList$6,
3434
+ actions: baseActionsList$7,
3432
3435
  diff: diff,
3433
3436
  oldObj: oldObj,
3434
3437
  newObj: newObj,
@@ -3478,7 +3481,7 @@ function createStatesMapActions(mapActionGroup, syncActionConfig) {
3478
3481
  var baseActions = [];
3479
3482
  var roleActions = [];
3480
3483
  baseActions.push(mapActionGroup('base', function () {
3481
- return actionsMapBase$6(diff, oldObj, newObj, syncActionConfig);
3484
+ return actionsMapBase$7(diff, oldObj, newObj, syncActionConfig);
3482
3485
  }));
3483
3486
  roleActions.push(mapActionGroup('roles', function () {
3484
3487
  return actionsMapRoles(diff, oldObj, newObj);
@@ -3496,7 +3499,7 @@ var states = (function (actionGroupList, syncActionConfig) {
3496
3499
  };
3497
3500
  });
3498
3501
 
3499
- var baseActionsList$5 = [{
3502
+ var baseActionsList$6 = [{
3500
3503
  action: 'changeKey',
3501
3504
  key: 'key'
3502
3505
  }, {
@@ -3515,10 +3518,10 @@ var baseActionsList$5 = [{
3515
3518
  action: 'setRoles',
3516
3519
  key: 'roles'
3517
3520
  }];
3518
- function actionsMapBase$5(diff, oldObj, newObj) {
3521
+ function actionsMapBase$6(diff, oldObj, newObj) {
3519
3522
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
3520
3523
  return buildBaseAttributesActions({
3521
- actions: baseActionsList$5,
3524
+ actions: baseActionsList$6,
3522
3525
  diff: diff,
3523
3526
  oldObj: oldObj,
3524
3527
  newObj: newObj,
@@ -3530,7 +3533,7 @@ function createChannelsMapActions$1(mapActionGroup, syncActionConfig) {
3530
3533
  return function doMapActions(diff, newObj, oldObj) {
3531
3534
  var allActions = [];
3532
3535
  allActions.push(mapActionGroup('base', function () {
3533
- return actionsMapBase$5(diff, oldObj, newObj, syncActionConfig);
3536
+ return actionsMapBase$6(diff, oldObj, newObj, syncActionConfig);
3534
3537
  }));
3535
3538
  allActions.push(mapActionGroup('custom', function () {
3536
3539
  return actionsMapCustom(diff, newObj, oldObj);
@@ -3560,7 +3563,7 @@ var getIsRemovedOperation = function getIsRemovedOperation(key) {
3560
3563
  return REGEX_UNDERSCORE_NUMBER.test(key);
3561
3564
  };
3562
3565
 
3563
- var baseActionsList$4 = [{
3566
+ var baseActionsList$5 = [{
3564
3567
  action: 'changeKey',
3565
3568
  key: 'key'
3566
3569
  }, {
@@ -3570,10 +3573,10 @@ var baseActionsList$4 = [{
3570
3573
  action: 'setDescription',
3571
3574
  key: 'description'
3572
3575
  }];
3573
- function actionsMapBase$4(diff, oldObj, newObj) {
3576
+ function actionsMapBase$5(diff, oldObj, newObj) {
3574
3577
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
3575
3578
  return buildBaseAttributesActions({
3576
- actions: baseActionsList$4,
3579
+ actions: baseActionsList$5,
3577
3580
  diff: diff,
3578
3581
  oldObj: oldObj,
3579
3582
  newObj: newObj,
@@ -3722,7 +3725,7 @@ function createTypeMapActions(mapActionGroup, syncActionConfig) {
3722
3725
  return function doMapActions(diff, next, previous) {
3723
3726
  var allActions = [];
3724
3727
  allActions.push(mapActionGroup('base', function () {
3725
- return actionsMapBase$4(diff, previous, next, syncActionConfig);
3728
+ return actionsMapBase$5(diff, previous, next, syncActionConfig);
3726
3729
  }), mapActionGroup('fieldDefinitions', function () {
3727
3730
  return actionsMapFieldDefinitions(diff.fieldDefinitions, previous.fieldDefinitions, next.fieldDefinitions, findMatchingPairs(diff.fieldDefinitions, previous.fieldDefinitions, next.fieldDefinitions, 'name'));
3728
3731
  }));
@@ -3739,7 +3742,7 @@ var types = (function (actionGroupList, syncActionConfig) {
3739
3742
  };
3740
3743
  });
3741
3744
 
3742
- var baseActionsList$3 = [{
3745
+ var baseActionsList$4 = [{
3743
3746
  action: 'changeName',
3744
3747
  key: 'name'
3745
3748
  }, {
@@ -3758,10 +3761,10 @@ var baseActionsList$3 = [{
3758
3761
  action: 'setShippingRateInputType',
3759
3762
  key: 'shippingRateInputType'
3760
3763
  }];
3761
- function actionsMapBase$3(diff, oldObj, newObj) {
3764
+ function actionsMapBase$4(diff, oldObj, newObj) {
3762
3765
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
3763
3766
  return buildBaseAttributesActions({
3764
- actions: baseActionsList$3,
3767
+ actions: baseActionsList$4,
3765
3768
  diff: diff,
3766
3769
  oldObj: oldObj,
3767
3770
  newObj: newObj,
@@ -3773,7 +3776,7 @@ function createChannelsMapActions(mapActionGroup, syncActionConfig) {
3773
3776
  return function doMapActions(diff, newObj, oldObj) {
3774
3777
  var allActions = [];
3775
3778
  allActions.push(mapActionGroup('base', function () {
3776
- return actionsMapBase$3(diff, oldObj, newObj, syncActionConfig);
3779
+ return actionsMapBase$4(diff, oldObj, newObj, syncActionConfig);
3777
3780
  }));
3778
3781
  return flatten(allActions);
3779
3782
  };
@@ -3789,7 +3792,7 @@ var projects = (function (actionGroupList) {
3789
3792
  };
3790
3793
  });
3791
3794
 
3792
- var baseActionsList$2 = [{
3795
+ var baseActionsList$3 = [{
3793
3796
  action: 'setName',
3794
3797
  key: 'name'
3795
3798
  }, {
@@ -3802,9 +3805,9 @@ var baseActionsList$2 = [{
3802
3805
  action: 'setSupplyChannels',
3803
3806
  key: 'supplyChannels'
3804
3807
  }];
3805
- function actionsMapBase$2(diff, oldObj, newObj) {
3808
+ function actionsMapBase$3(diff, oldObj, newObj) {
3806
3809
  return buildBaseAttributesActions({
3807
- actions: baseActionsList$2,
3810
+ actions: baseActionsList$3,
3808
3811
  diff: diff,
3809
3812
  oldObj: oldObj,
3810
3813
  newObj: newObj
@@ -3815,7 +3818,7 @@ function createStoresMapActions(mapActionGroup) {
3815
3818
  return function doMapActions(diff, next, previous) {
3816
3819
  var allActions = [];
3817
3820
  allActions.push(mapActionGroup('base', function () {
3818
- return actionsMapBase$2(diff, previous, next);
3821
+ return actionsMapBase$3(diff, previous, next);
3819
3822
  }));
3820
3823
  allActions.push(mapActionGroup('custom', function () {
3821
3824
  return actionsMapCustom(diff, next, previous);
@@ -3834,16 +3837,16 @@ var stores = (function (actionGroupList) {
3834
3837
  };
3835
3838
  });
3836
3839
 
3837
- var baseActionsList$1 = [{
3840
+ var baseActionsList$2 = [{
3838
3841
  action: 'changeName',
3839
3842
  key: 'name'
3840
3843
  }, {
3841
3844
  action: 'setKey',
3842
3845
  key: 'key'
3843
3846
  }];
3844
- function actionsMapBase$1(diff, oldObj, newObj) {
3847
+ function actionsMapBase$2(diff, oldObj, newObj) {
3845
3848
  return buildBaseAttributesActions({
3846
- actions: baseActionsList$1,
3849
+ actions: baseActionsList$2,
3847
3850
  diff: diff,
3848
3851
  oldObj: oldObj,
3849
3852
  newObj: newObj
@@ -3854,7 +3857,7 @@ function createProductSelectionsMapActions(mapActionGroup) {
3854
3857
  return function doMapActions(diff, next, previous) {
3855
3858
  var allActions = [];
3856
3859
  allActions.push(mapActionGroup('base', function () {
3857
- return actionsMapBase$1(diff, previous, next);
3860
+ return actionsMapBase$2(diff, previous, next);
3858
3861
  }));
3859
3862
  allActions.push(mapActionGroup('custom', function () {
3860
3863
  return actionsMapCustom(diff, next, previous);
@@ -3873,7 +3876,7 @@ var productSelections = (function (actionGroupList) {
3873
3876
  };
3874
3877
  });
3875
3878
 
3876
- var baseActionsList = [{
3879
+ var baseActionsList$1 = [{
3877
3880
  action: 'changeValue',
3878
3881
  key: 'value'
3879
3882
  }, {
@@ -3896,10 +3899,10 @@ var baseActionsList = [{
3896
3899
  action: 'changeActive',
3897
3900
  key: 'active'
3898
3901
  }];
3899
- function actionsMapBase(diff, oldObj, newObj) {
3902
+ function actionsMapBase$1(diff, oldObj, newObj) {
3900
3903
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
3901
3904
  return buildBaseAttributesActions({
3902
- actions: baseActionsList,
3905
+ actions: baseActionsList$1,
3903
3906
  diff: diff,
3904
3907
  oldObj: oldObj,
3905
3908
  newObj: newObj,
@@ -3910,7 +3913,7 @@ function actionsMapBase(diff, oldObj, newObj) {
3910
3913
  function createPriceMapActions(mapActionGroup, syncActionConfig) {
3911
3914
  return function doMapActions(diff, newObj, oldObj) {
3912
3915
  var baseActions = mapActionGroup('base', function () {
3913
- return actionsMapBase(diff, oldObj, newObj, syncActionConfig);
3916
+ return actionsMapBase$1(diff, oldObj, newObj, syncActionConfig);
3914
3917
  });
3915
3918
  var customActions = mapActionGroup('custom', function () {
3916
3919
  return actionsMapCustom(diff, newObj, oldObj);
@@ -3928,4 +3931,85 @@ var prices = (function (actionGroupList, syncActionConfig) {
3928
3931
  };
3929
3932
  });
3930
3933
 
3931
- export { cartDiscounts as createSyncCartDiscounts, categories as createSyncCategories, channels as createSyncChannels, customerGroup as createSyncCustomerGroup, customers as createSyncCustomers, discountCodes as createSyncDiscountCodes, inventories as createSyncInventories, orders as createSyncOrders, productDiscounts as createSyncProductDiscounts, productSelections as createSyncProductSelections, productTypes as createSyncProductTypes, products as createSyncProducts, projects as createSyncProjects, shippingMethods as createSyncShippingMethods, prices as createSyncStandalonePrices, states as createSyncStates, stores as createSyncStores, taxCategories as createSyncTaxCategories, types as createSyncTypes, zones as createSyncZones };
3934
+ var hasAttribute = function hasAttribute(attributes, newValue) {
3935
+ return attributes.some(function (attribute) {
3936
+ return attribute.key === newValue.key;
3937
+ });
3938
+ };
3939
+
3940
+ var baseActionsList = [{
3941
+ action: 'changeName',
3942
+ key: 'name'
3943
+ }, {
3944
+ action: 'setKey',
3945
+ key: 'key'
3946
+ }, {
3947
+ action: 'setDescription',
3948
+ key: 'description'
3949
+ }];
3950
+ function actionsMapBase(diff, oldObj, newObj) {
3951
+ var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
3952
+ return buildBaseAttributesActions({
3953
+ actions: baseActionsList,
3954
+ diff: diff,
3955
+ oldObj: oldObj,
3956
+ newObj: newObj,
3957
+ shouldOmitEmptyString: config.shouldOmitEmptyString
3958
+ });
3959
+ }
3960
+ function actionsMapAttributes(diff, oldObj, newObj) {
3961
+ var _createBuildArrayActi;
3962
+
3963
+ var handler = createBuildArrayActions('attributes', (_createBuildArrayActi = {}, _defineProperty(_createBuildArrayActi, ADD_ACTIONS, function (newAttribute) {
3964
+ return {
3965
+ action: 'addAttribute',
3966
+ attribute: newAttribute
3967
+ };
3968
+ }), _defineProperty(_createBuildArrayActi, REMOVE_ACTIONS, function (oldAttribute) {
3969
+ // We only add the action if the attribute is not included in the new object.
3970
+ return !hasAttribute(newObj.attributes, oldAttribute) ? {
3971
+ action: 'removeAttribute',
3972
+ attribute: oldAttribute
3973
+ } : null;
3974
+ }), _defineProperty(_createBuildArrayActi, CHANGE_ACTIONS, function (oldAttribute, newAttribute) {
3975
+ var result = []; // We only remove the attribute in case that the oldAttribute is not
3976
+ // included in the new object
3977
+
3978
+ if (!hasAttribute(newObj.attributes, oldAttribute)) result.push({
3979
+ action: 'removeAttribute',
3980
+ attribute: oldAttribute
3981
+ }); // We only add the attribute in case that the newAttribute was not
3982
+ // included in the old object
3983
+
3984
+ if (!hasAttribute(oldObj.attributes, newAttribute)) result.push({
3985
+ action: 'addAttribute',
3986
+ attribute: newAttribute
3987
+ });
3988
+ return result;
3989
+ }), _createBuildArrayActi));
3990
+ return handler(diff, oldObj, newObj);
3991
+ }
3992
+
3993
+ function createAttributeGroupsMapActions(mapActionGroup, syncActionConfig) {
3994
+ return function doMapActions(diff, newObj, oldObj) {
3995
+ var allActions = [];
3996
+ allActions.push(mapActionGroup('base', function () {
3997
+ return actionsMapBase(diff, oldObj, newObj, syncActionConfig);
3998
+ }));
3999
+ allActions.push(flatten(mapActionGroup('attributes', function () {
4000
+ return actionsMapAttributes(diff, oldObj, newObj);
4001
+ })));
4002
+ return flatten(allActions);
4003
+ };
4004
+ }
4005
+
4006
+ var attributeGroups = (function (actionGroupList, syncActionConfig) {
4007
+ var mapActionGroup = createMapActionGroup(actionGroupList);
4008
+ var doMapActions = createAttributeGroupsMapActions(mapActionGroup, syncActionConfig);
4009
+ var buildActions = createBuildActions(diff, doMapActions);
4010
+ return {
4011
+ buildActions: buildActions
4012
+ };
4013
+ });
4014
+
4015
+ export { attributeGroups as createSyncAttributeGroups, cartDiscounts as createSyncCartDiscounts, categories as createSyncCategories, channels as createSyncChannels, customerGroup as createSyncCustomerGroup, customers as createSyncCustomers, discountCodes as createSyncDiscountCodes, inventories as createSyncInventories, orders as createSyncOrders, productDiscounts as createSyncProductDiscounts, productSelections as createSyncProductSelections, productTypes as createSyncProductTypes, products as createSyncProducts, projects as createSyncProjects, shippingMethods as createSyncShippingMethods, prices as createSyncStandalonePrices, states as createSyncStates, stores as createSyncStores, taxCategories as createSyncTaxCategories, types as createSyncTypes, zones as createSyncZones };