@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.
@@ -295,11 +295,14 @@
295
295
  includeValueOnMove: false
296
296
  },
297
297
  textDiff: {
298
- // If the value to diff has a bigger length,
299
- // a text diffing algorithm is used
300
- // See https://github.com/benjamine/jsondiffpatch/
301
- // blob/master/docs/deltas.md#text-diffs
302
- minLength: 300
298
+ /**
299
+ * jsondiffpatch uses a very fine-grained diffing algorithm for long strings to easily identify
300
+ * what changed between strings. However, we don't actually care about what changed, just
301
+ * if the string changed at all. So we set the minimum length to diff to a very large number to avoid
302
+ * using the very slow algorithm.
303
+ * See https://github.com/benjamine/jsondiffpatch/blob/master/docs/deltas.md#text-diffs.
304
+ */
305
+ minLength: Number.MAX_SAFE_INTEGER
303
306
  }
304
307
  });
305
308
  function diff(oldObj, newObj) {
@@ -677,7 +680,7 @@
677
680
  });
678
681
  }
679
682
 
680
- var baseActionsList$j = [{
683
+ var baseActionsList$k = [{
681
684
  action: 'changeName',
682
685
  key: 'name'
683
686
  }, {
@@ -714,10 +717,10 @@
714
717
  * SYNC FUNCTIONS
715
718
  */
716
719
 
717
- function actionsMapBase$j(diff, oldObj, newObj) {
720
+ function actionsMapBase$k(diff, oldObj, newObj) {
718
721
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
719
722
  return buildBaseAttributesActions({
720
- actions: baseActionsList$j,
723
+ actions: baseActionsList$k,
721
724
  diff: diff,
722
725
  oldObj: oldObj,
723
726
  newObj: newObj,
@@ -825,7 +828,7 @@
825
828
  return function doMapActions(diff, newObj, oldObj) {
826
829
  var allActions = [];
827
830
  allActions.push(mapActionGroup('base', function () {
828
- return actionsMapBase$j(diff, oldObj, newObj, syncActionConfig);
831
+ return actionsMapBase$k(diff, oldObj, newObj, syncActionConfig);
829
832
  }));
830
833
  allActions.push(mapActionGroup('references', function () {
831
834
  return actionsMapReferences$3(diff, oldObj, newObj);
@@ -862,7 +865,7 @@
862
865
  });
863
866
 
864
867
  var isEmptyValue = createIsEmptyValue([undefined, null, '']);
865
- var baseActionsList$i = [{
868
+ var baseActionsList$j = [{
866
869
  action: 'setSalutation',
867
870
  key: 'salutation'
868
871
  }, {
@@ -927,10 +930,10 @@
927
930
  * SYNC FUNCTIONS
928
931
  */
929
932
 
930
- function actionsMapBase$i(diff, oldObj, newObj) {
933
+ function actionsMapBase$j(diff, oldObj, newObj) {
931
934
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
932
935
  return buildBaseAttributesActions({
933
- actions: baseActionsList$i,
936
+ actions: baseActionsList$j,
934
937
  diff: diff,
935
938
  oldObj: oldObj,
936
939
  newObj: newObj,
@@ -1074,7 +1077,7 @@
1074
1077
  return function doMapActions(diff, newObj, oldObj) {
1075
1078
  var allActions = [];
1076
1079
  allActions.push(mapActionGroup('base', function () {
1077
- return actionsMapBase$i(diff, oldObj, newObj, syncActionConfig);
1080
+ return actionsMapBase$j(diff, oldObj, newObj, syncActionConfig);
1078
1081
  }));
1079
1082
  allActions.push(mapActionGroup('references', function () {
1080
1083
  return actionsMapReferences$2(diff, oldObj, newObj);
@@ -1119,7 +1122,7 @@
1119
1122
  };
1120
1123
  });
1121
1124
 
1122
- var baseActionsList$h = [{
1125
+ var baseActionsList$i = [{
1123
1126
  action: 'changeQuantity',
1124
1127
  key: 'quantityOnStock',
1125
1128
  actionKey: 'quantity'
@@ -1138,10 +1141,10 @@
1138
1141
  * SYNC FUNCTIONS
1139
1142
  */
1140
1143
 
1141
- function actionsMapBase$h(diff, oldObj, newObj) {
1144
+ function actionsMapBase$i(diff, oldObj, newObj) {
1142
1145
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1143
1146
  return buildBaseAttributesActions({
1144
- actions: baseActionsList$h,
1147
+ actions: baseActionsList$i,
1145
1148
  diff: diff,
1146
1149
  oldObj: oldObj,
1147
1150
  newObj: newObj,
@@ -1161,7 +1164,7 @@
1161
1164
  return function doMapActions(diff, newObj, oldObj) {
1162
1165
  var allActions = [];
1163
1166
  allActions.push(mapActionGroup('base', function () {
1164
- return actionsMapBase$h(diff, oldObj, newObj, syncActionConfig);
1167
+ return actionsMapBase$i(diff, oldObj, newObj, syncActionConfig);
1165
1168
  }));
1166
1169
  allActions.push(mapActionGroup('references', function () {
1167
1170
  return actionsMapReferences$1(diff, oldObj, newObj);
@@ -1256,7 +1259,7 @@
1256
1259
 
1257
1260
  var REGEX_NUMBER$2 = new RegExp(/^\d+$/);
1258
1261
  var REGEX_UNDERSCORE_NUMBER$2 = new RegExp(/^_\d+$/);
1259
- var baseActionsList$g = [{
1262
+ var baseActionsList$h = [{
1260
1263
  action: 'changeName',
1261
1264
  key: 'name'
1262
1265
  }, {
@@ -1663,10 +1666,10 @@
1663
1666
  */
1664
1667
 
1665
1668
 
1666
- function actionsMapBase$g(diff, oldObj, newObj) {
1669
+ function actionsMapBase$h(diff, oldObj, newObj) {
1667
1670
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1668
1671
  return buildBaseAttributesActions({
1669
- actions: baseActionsList$g,
1672
+ actions: baseActionsList$h,
1670
1673
  diff: diff,
1671
1674
  oldObj: oldObj,
1672
1675
  newObj: newObj,
@@ -1766,7 +1769,7 @@
1766
1769
  });
1767
1770
  return allAssetsActions;
1768
1771
  }
1769
- function actionsMapAttributes(diff, oldObj, newObj) {
1772
+ function actionsMapAttributes$1(diff, oldObj, newObj) {
1770
1773
  var sameForAllAttributeNames = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
1771
1774
  var variantHashMap = arguments.length > 4 ? arguments[4] : undefined;
1772
1775
  var actions = [];
@@ -1897,7 +1900,7 @@
1897
1900
  staged = newObj.staged;
1898
1901
  var variantHashMap = findMatchingPairs(diff.variants, oldObj.variants, newObj.variants);
1899
1902
  allActions.push(mapActionGroup('attributes', function () {
1900
- return actionsMapAttributes(diff, oldObj, newObj, sameForAllAttributeNames || [], variantHashMap);
1903
+ return actionsMapAttributes$1(diff, oldObj, newObj, sameForAllAttributeNames || [], variantHashMap);
1901
1904
  }));
1902
1905
  allActions.push(mapActionGroup('variants', function () {
1903
1906
  return actionsMapAddVariants(diff, oldObj, newObj);
@@ -1907,7 +1910,7 @@
1907
1910
  return actionsMapRemoveVariants(diff, oldObj, newObj);
1908
1911
  }));
1909
1912
  allActions.push(mapActionGroup('base', function () {
1910
- return actionsMapBase$g(diff, oldObj, newObj, syncActionConfig);
1913
+ return actionsMapBase$h(diff, oldObj, newObj, syncActionConfig);
1911
1914
  }));
1912
1915
  allActions.push(mapActionGroup('meta', function () {
1913
1916
  return actionsMapMeta(diff, oldObj, newObj);
@@ -1982,7 +1985,7 @@
1982
1985
  return REGEX_UNDERSCORE_NUMBER$1.test(key) && Number(resource[2]) === 0;
1983
1986
  };
1984
1987
 
1985
- var baseActionsList$f = [{
1988
+ var baseActionsList$g = [{
1986
1989
  action: 'changeOrderState',
1987
1990
  key: 'orderState'
1988
1991
  }, {
@@ -1996,10 +1999,10 @@
1996
1999
  * SYNC FUNCTIONS
1997
2000
  */
1998
2001
 
1999
- function actionsMapBase$f(diff, oldObj, newObj) {
2002
+ function actionsMapBase$g(diff, oldObj, newObj) {
2000
2003
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
2001
2004
  return buildBaseAttributesActions({
2002
- actions: baseActionsList$f,
2005
+ actions: baseActionsList$g,
2003
2006
  diff: diff,
2004
2007
  oldObj: oldObj,
2005
2008
  newObj: newObj,
@@ -2166,7 +2169,7 @@
2166
2169
  }
2167
2170
 
2168
2171
  allActions.push(mapActionGroup('base', function () {
2169
- return actionsMapBase$f(diff, oldObj, newObj, syncActionConfig);
2172
+ return actionsMapBase$g(diff, oldObj, newObj, syncActionConfig);
2170
2173
  }));
2171
2174
  allActions.push(mapActionGroup('deliveries', function () {
2172
2175
  return actionsMapDeliveries(diff, oldObj, newObj);
@@ -2205,7 +2208,7 @@
2205
2208
  };
2206
2209
  });
2207
2210
 
2208
- var baseActionsList$e = [{
2211
+ var baseActionsList$f = [{
2209
2212
  action: 'changeIsActive',
2210
2213
  key: 'isActive'
2211
2214
  }, {
@@ -2233,10 +2236,10 @@
2233
2236
  action: 'setKey',
2234
2237
  key: 'key'
2235
2238
  }];
2236
- function actionsMapBase$e(diff, oldObj, newObj) {
2239
+ function actionsMapBase$f(diff, oldObj, newObj) {
2237
2240
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
2238
2241
  return buildBaseAttributesActions({
2239
- actions: baseActionsList$e,
2242
+ actions: baseActionsList$f,
2240
2243
  diff: diff,
2241
2244
  oldObj: oldObj,
2242
2245
  newObj: newObj,
@@ -2277,7 +2280,7 @@
2277
2280
  return function doMapActions(diff, newObj, oldObj) {
2278
2281
  var allActions = [];
2279
2282
  allActions.push(mapActionGroup('base', function () {
2280
- return actionsMapBase$e(diff, oldObj, newObj, syncActionConfig);
2283
+ return actionsMapBase$f(diff, oldObj, newObj, syncActionConfig);
2281
2284
  }));
2282
2285
  return combineValidityActions(flatten__default["default"](allActions));
2283
2286
  };
@@ -2293,7 +2296,7 @@
2293
2296
  };
2294
2297
  });
2295
2298
 
2296
- var baseActionsList$d = [{
2299
+ var baseActionsList$e = [{
2297
2300
  action: 'changeIsActive',
2298
2301
  key: 'isActive'
2299
2302
  }, {
@@ -2324,10 +2327,10 @@
2324
2327
  action: 'changeGroups',
2325
2328
  key: 'groups'
2326
2329
  }];
2327
- function actionsMapBase$d(diff, oldObj, newObj) {
2330
+ function actionsMapBase$e(diff, oldObj, newObj) {
2328
2331
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
2329
2332
  return buildBaseAttributesActions({
2330
- actions: baseActionsList$d,
2333
+ actions: baseActionsList$e,
2331
2334
  diff: diff,
2332
2335
  oldObj: oldObj,
2333
2336
  newObj: newObj,
@@ -2339,7 +2342,7 @@
2339
2342
  return function doMapActions(diff, newObj, oldObj) {
2340
2343
  var allActions = [];
2341
2344
  allActions.push(mapActionGroup('base', function () {
2342
- return actionsMapBase$d(diff, oldObj, newObj, syncActionConfig);
2345
+ return actionsMapBase$e(diff, oldObj, newObj, syncActionConfig);
2343
2346
  }));
2344
2347
  allActions.push(mapActionGroup('custom', function () {
2345
2348
  return actionsMapCustom(diff, newObj, oldObj);
@@ -2367,17 +2370,17 @@
2367
2370
  };
2368
2371
  });
2369
2372
 
2370
- var baseActionsList$c = [{
2373
+ var baseActionsList$d = [{
2371
2374
  action: 'changeName',
2372
2375
  key: 'name'
2373
2376
  }, {
2374
2377
  action: 'setKey',
2375
2378
  key: 'key'
2376
2379
  }];
2377
- function actionsMapBase$c(diff, oldObj, newObj) {
2380
+ function actionsMapBase$d(diff, oldObj, newObj) {
2378
2381
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
2379
2382
  return buildBaseAttributesActions({
2380
- actions: baseActionsList$c,
2383
+ actions: baseActionsList$d,
2381
2384
  diff: diff,
2382
2385
  oldObj: oldObj,
2383
2386
  newObj: newObj,
@@ -2389,7 +2392,7 @@
2389
2392
  return function doMapActions(diff, newObj, oldObj) {
2390
2393
  var allActions = [];
2391
2394
  allActions.push(mapActionGroup('base', function () {
2392
- return actionsMapBase$c(diff, oldObj, newObj, syncActionConfig);
2395
+ return actionsMapBase$d(diff, oldObj, newObj, syncActionConfig);
2393
2396
  }));
2394
2397
  allActions.push(mapActionGroup('custom', function () {
2395
2398
  return actionsMapCustom(diff, newObj, oldObj);
@@ -2408,7 +2411,7 @@
2408
2411
  };
2409
2412
  });
2410
2413
 
2411
- var baseActionsList$b = [{
2414
+ var baseActionsList$c = [{
2412
2415
  action: 'changeIsActive',
2413
2416
  key: 'isActive'
2414
2417
  }, {
@@ -2445,10 +2448,10 @@
2445
2448
  action: 'setKey',
2446
2449
  key: 'key'
2447
2450
  }];
2448
- function actionsMapBase$b(diff, oldObj, newObj) {
2451
+ function actionsMapBase$c(diff, oldObj, newObj) {
2449
2452
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
2450
2453
  return buildBaseAttributesActions({
2451
- actions: baseActionsList$b,
2454
+ actions: baseActionsList$c,
2452
2455
  diff: diff,
2453
2456
  oldObj: oldObj,
2454
2457
  newObj: newObj,
@@ -2460,7 +2463,7 @@
2460
2463
  return function doMapActions(diff, newObj, oldObj) {
2461
2464
  var allActions = [];
2462
2465
  allActions.push(mapActionGroup('base', function () {
2463
- return actionsMapBase$b(diff, oldObj, newObj, syncActionConfig);
2466
+ return actionsMapBase$c(diff, oldObj, newObj, syncActionConfig);
2464
2467
  }));
2465
2468
  allActions.push(mapActionGroup('custom', function () {
2466
2469
  return actionsMapCustom(diff, newObj, oldObj);
@@ -2479,7 +2482,7 @@
2479
2482
  };
2480
2483
  });
2481
2484
 
2482
- var baseActionsList$a = [{
2485
+ var baseActionsList$b = [{
2483
2486
  action: 'changeName',
2484
2487
  key: 'name'
2485
2488
  }, {
@@ -2489,10 +2492,10 @@
2489
2492
  action: 'setDescription',
2490
2493
  key: 'description'
2491
2494
  }];
2492
- function actionsMapBase$a(diff, oldObj, newObj) {
2495
+ function actionsMapBase$b(diff, oldObj, newObj) {
2493
2496
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
2494
2497
  return buildBaseAttributesActions({
2495
- actions: baseActionsList$a,
2498
+ actions: baseActionsList$b,
2496
2499
  diff: diff,
2497
2500
  oldObj: oldObj,
2498
2501
  newObj: newObj,
@@ -2526,7 +2529,7 @@
2526
2529
  return function doMapActions(diff, newObj, oldObj) {
2527
2530
  var allActions = [];
2528
2531
  allActions.push(mapActionGroup('base', function () {
2529
- return actionsMapBase$a(diff, oldObj, newObj, syncActionConfig);
2532
+ return actionsMapBase$b(diff, oldObj, newObj, syncActionConfig);
2530
2533
  }));
2531
2534
  allActions.push(mapActionGroup('rates', function () {
2532
2535
  return actionsMapRates(diff, oldObj, newObj);
@@ -2553,7 +2556,7 @@
2553
2556
  };
2554
2557
  });
2555
2558
 
2556
- var baseActionsList$9 = [{
2559
+ var baseActionsList$a = [{
2557
2560
  action: 'changeName',
2558
2561
  key: 'name'
2559
2562
  }, {
@@ -2570,10 +2573,10 @@
2570
2573
  });
2571
2574
  };
2572
2575
 
2573
- function actionsMapBase$9(diff, oldObj, newObj) {
2576
+ function actionsMapBase$a(diff, oldObj, newObj) {
2574
2577
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
2575
2578
  return buildBaseAttributesActions({
2576
- actions: baseActionsList$9,
2579
+ actions: baseActionsList$a,
2577
2580
  diff: diff,
2578
2581
  oldObj: oldObj,
2579
2582
  newObj: newObj,
@@ -2618,7 +2621,7 @@
2618
2621
  return function doMapActions(diff, newObj, oldObj) {
2619
2622
  var allActions = [];
2620
2623
  allActions.push(mapActionGroup('base', function () {
2621
- return actionsMapBase$9(diff, oldObj, newObj, syncActionConfig);
2624
+ return actionsMapBase$a(diff, oldObj, newObj, syncActionConfig);
2622
2625
  }));
2623
2626
  allActions.push(flatten__default["default"](mapActionGroup('locations', function () {
2624
2627
  return actionsMapLocations(diff, oldObj, newObj);
@@ -2645,7 +2648,7 @@
2645
2648
  };
2646
2649
  });
2647
2650
 
2648
- var baseActionsList$8 = [{
2651
+ var baseActionsList$9 = [{
2649
2652
  action: 'setKey',
2650
2653
  key: 'key'
2651
2654
  }, {
@@ -2670,10 +2673,10 @@
2670
2673
  action: 'changeTaxCategory',
2671
2674
  key: 'taxCategory'
2672
2675
  }];
2673
- function actionsMapBase$8(diff, oldObj, newObj) {
2676
+ function actionsMapBase$9(diff, oldObj, newObj) {
2674
2677
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
2675
2678
  return buildBaseAttributesActions({
2676
- actions: baseActionsList$8,
2679
+ actions: baseActionsList$9,
2677
2680
  diff: diff,
2678
2681
  oldObj: oldObj,
2679
2682
  newObj: newObj,
@@ -2755,7 +2758,7 @@
2755
2758
  return function doMapActions(diff, newObj, oldObj) {
2756
2759
  var allActions = [];
2757
2760
  allActions.push(mapActionGroup('base', function () {
2758
- return actionsMapBase$8(diff, oldObj, newObj, syncActionConfig);
2761
+ return actionsMapBase$9(diff, oldObj, newObj, syncActionConfig);
2759
2762
  }));
2760
2763
  allActions.push(flatten__default["default"](mapActionGroup('zoneRates', function () {
2761
2764
  return actionsMapZoneRates(diff, oldObj, newObj);
@@ -3153,7 +3156,7 @@
3153
3156
  createComparator(createCircularEqualCreator());
3154
3157
  createComparator(createCircularEqualCreator(sameValueZeroEqual));
3155
3158
 
3156
- var baseActionsList$7 = [{
3159
+ var baseActionsList$8 = [{
3157
3160
  action: 'changeName',
3158
3161
  key: 'name'
3159
3162
  }, {
@@ -3163,7 +3166,7 @@
3163
3166
  action: 'changeDescription',
3164
3167
  key: 'description'
3165
3168
  }];
3166
- function actionsMapBase$7(diff, previous, next) {
3169
+ function actionsMapBase$8(diff, previous, next) {
3167
3170
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
3168
3171
  // when `diff` is undefined, then the underlying `buildActions` has returned any diff
3169
3172
  // which given in product-types would mean that `buildActions` has run with `nestedValuesChanges` applied
@@ -3171,7 +3174,7 @@
3171
3174
  if (!diff) return [];
3172
3175
  return buildBaseAttributesActions({
3173
3176
  diff: diff,
3174
- actions: baseActionsList$7,
3177
+ actions: baseActionsList$8,
3175
3178
  oldObj: previous,
3176
3179
  newObj: next,
3177
3180
  shouldOmitEmptyString: config.shouldOmitEmptyString
@@ -3397,7 +3400,7 @@
3397
3400
  return flatten__default["default"]([// we support only base fields for the product type,
3398
3401
  // for attributes, applying hints would be recommended
3399
3402
  mapActionGroup('base', function () {
3400
- return actionsMapBase$7(diff, previous, next, syncActionConfig);
3403
+ return actionsMapBase$8(diff, previous, next, syncActionConfig);
3401
3404
  }), actionsMapForHints(options.nestedValuesChanges, previous, next)]);
3402
3405
  };
3403
3406
  }
@@ -3414,7 +3417,7 @@
3414
3417
  };
3415
3418
  });
3416
3419
 
3417
- var baseActionsList$6 = [{
3420
+ var baseActionsList$7 = [{
3418
3421
  action: 'changeKey',
3419
3422
  key: 'key'
3420
3423
  }, {
@@ -3433,10 +3436,10 @@
3433
3436
  action: 'setTransitions',
3434
3437
  key: 'transitions'
3435
3438
  }];
3436
- function actionsMapBase$6(diff, oldObj, newObj) {
3439
+ function actionsMapBase$7(diff, oldObj, newObj) {
3437
3440
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
3438
3441
  return buildBaseAttributesActions({
3439
- actions: baseActionsList$6,
3442
+ actions: baseActionsList$7,
3440
3443
  diff: diff,
3441
3444
  oldObj: oldObj,
3442
3445
  newObj: newObj,
@@ -3486,7 +3489,7 @@
3486
3489
  var baseActions = [];
3487
3490
  var roleActions = [];
3488
3491
  baseActions.push(mapActionGroup('base', function () {
3489
- return actionsMapBase$6(diff, oldObj, newObj, syncActionConfig);
3492
+ return actionsMapBase$7(diff, oldObj, newObj, syncActionConfig);
3490
3493
  }));
3491
3494
  roleActions.push(mapActionGroup('roles', function () {
3492
3495
  return actionsMapRoles(diff, oldObj, newObj);
@@ -3504,7 +3507,7 @@
3504
3507
  };
3505
3508
  });
3506
3509
 
3507
- var baseActionsList$5 = [{
3510
+ var baseActionsList$6 = [{
3508
3511
  action: 'changeKey',
3509
3512
  key: 'key'
3510
3513
  }, {
@@ -3523,10 +3526,10 @@
3523
3526
  action: 'setRoles',
3524
3527
  key: 'roles'
3525
3528
  }];
3526
- function actionsMapBase$5(diff, oldObj, newObj) {
3529
+ function actionsMapBase$6(diff, oldObj, newObj) {
3527
3530
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
3528
3531
  return buildBaseAttributesActions({
3529
- actions: baseActionsList$5,
3532
+ actions: baseActionsList$6,
3530
3533
  diff: diff,
3531
3534
  oldObj: oldObj,
3532
3535
  newObj: newObj,
@@ -3538,7 +3541,7 @@
3538
3541
  return function doMapActions(diff, newObj, oldObj) {
3539
3542
  var allActions = [];
3540
3543
  allActions.push(mapActionGroup('base', function () {
3541
- return actionsMapBase$5(diff, oldObj, newObj, syncActionConfig);
3544
+ return actionsMapBase$6(diff, oldObj, newObj, syncActionConfig);
3542
3545
  }));
3543
3546
  allActions.push(mapActionGroup('custom', function () {
3544
3547
  return actionsMapCustom(diff, newObj, oldObj);
@@ -3568,7 +3571,7 @@
3568
3571
  return REGEX_UNDERSCORE_NUMBER.test(key);
3569
3572
  };
3570
3573
 
3571
- var baseActionsList$4 = [{
3574
+ var baseActionsList$5 = [{
3572
3575
  action: 'changeKey',
3573
3576
  key: 'key'
3574
3577
  }, {
@@ -3578,10 +3581,10 @@
3578
3581
  action: 'setDescription',
3579
3582
  key: 'description'
3580
3583
  }];
3581
- function actionsMapBase$4(diff, oldObj, newObj) {
3584
+ function actionsMapBase$5(diff, oldObj, newObj) {
3582
3585
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
3583
3586
  return buildBaseAttributesActions({
3584
- actions: baseActionsList$4,
3587
+ actions: baseActionsList$5,
3585
3588
  diff: diff,
3586
3589
  oldObj: oldObj,
3587
3590
  newObj: newObj,
@@ -3730,7 +3733,7 @@
3730
3733
  return function doMapActions(diff, next, previous) {
3731
3734
  var allActions = [];
3732
3735
  allActions.push(mapActionGroup('base', function () {
3733
- return actionsMapBase$4(diff, previous, next, syncActionConfig);
3736
+ return actionsMapBase$5(diff, previous, next, syncActionConfig);
3734
3737
  }), mapActionGroup('fieldDefinitions', function () {
3735
3738
  return actionsMapFieldDefinitions(diff.fieldDefinitions, previous.fieldDefinitions, next.fieldDefinitions, findMatchingPairs(diff.fieldDefinitions, previous.fieldDefinitions, next.fieldDefinitions, 'name'));
3736
3739
  }));
@@ -3747,7 +3750,7 @@
3747
3750
  };
3748
3751
  });
3749
3752
 
3750
- var baseActionsList$3 = [{
3753
+ var baseActionsList$4 = [{
3751
3754
  action: 'changeName',
3752
3755
  key: 'name'
3753
3756
  }, {
@@ -3766,10 +3769,10 @@
3766
3769
  action: 'setShippingRateInputType',
3767
3770
  key: 'shippingRateInputType'
3768
3771
  }];
3769
- function actionsMapBase$3(diff, oldObj, newObj) {
3772
+ function actionsMapBase$4(diff, oldObj, newObj) {
3770
3773
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
3771
3774
  return buildBaseAttributesActions({
3772
- actions: baseActionsList$3,
3775
+ actions: baseActionsList$4,
3773
3776
  diff: diff,
3774
3777
  oldObj: oldObj,
3775
3778
  newObj: newObj,
@@ -3781,7 +3784,7 @@
3781
3784
  return function doMapActions(diff, newObj, oldObj) {
3782
3785
  var allActions = [];
3783
3786
  allActions.push(mapActionGroup('base', function () {
3784
- return actionsMapBase$3(diff, oldObj, newObj, syncActionConfig);
3787
+ return actionsMapBase$4(diff, oldObj, newObj, syncActionConfig);
3785
3788
  }));
3786
3789
  return flatten__default["default"](allActions);
3787
3790
  };
@@ -3797,7 +3800,7 @@
3797
3800
  };
3798
3801
  });
3799
3802
 
3800
- var baseActionsList$2 = [{
3803
+ var baseActionsList$3 = [{
3801
3804
  action: 'setName',
3802
3805
  key: 'name'
3803
3806
  }, {
@@ -3810,9 +3813,9 @@
3810
3813
  action: 'setSupplyChannels',
3811
3814
  key: 'supplyChannels'
3812
3815
  }];
3813
- function actionsMapBase$2(diff, oldObj, newObj) {
3816
+ function actionsMapBase$3(diff, oldObj, newObj) {
3814
3817
  return buildBaseAttributesActions({
3815
- actions: baseActionsList$2,
3818
+ actions: baseActionsList$3,
3816
3819
  diff: diff,
3817
3820
  oldObj: oldObj,
3818
3821
  newObj: newObj
@@ -3823,7 +3826,7 @@
3823
3826
  return function doMapActions(diff, next, previous) {
3824
3827
  var allActions = [];
3825
3828
  allActions.push(mapActionGroup('base', function () {
3826
- return actionsMapBase$2(diff, previous, next);
3829
+ return actionsMapBase$3(diff, previous, next);
3827
3830
  }));
3828
3831
  allActions.push(mapActionGroup('custom', function () {
3829
3832
  return actionsMapCustom(diff, next, previous);
@@ -3842,16 +3845,16 @@
3842
3845
  };
3843
3846
  });
3844
3847
 
3845
- var baseActionsList$1 = [{
3848
+ var baseActionsList$2 = [{
3846
3849
  action: 'changeName',
3847
3850
  key: 'name'
3848
3851
  }, {
3849
3852
  action: 'setKey',
3850
3853
  key: 'key'
3851
3854
  }];
3852
- function actionsMapBase$1(diff, oldObj, newObj) {
3855
+ function actionsMapBase$2(diff, oldObj, newObj) {
3853
3856
  return buildBaseAttributesActions({
3854
- actions: baseActionsList$1,
3857
+ actions: baseActionsList$2,
3855
3858
  diff: diff,
3856
3859
  oldObj: oldObj,
3857
3860
  newObj: newObj
@@ -3862,7 +3865,7 @@
3862
3865
  return function doMapActions(diff, next, previous) {
3863
3866
  var allActions = [];
3864
3867
  allActions.push(mapActionGroup('base', function () {
3865
- return actionsMapBase$1(diff, previous, next);
3868
+ return actionsMapBase$2(diff, previous, next);
3866
3869
  }));
3867
3870
  allActions.push(mapActionGroup('custom', function () {
3868
3871
  return actionsMapCustom(diff, next, previous);
@@ -3881,7 +3884,7 @@
3881
3884
  };
3882
3885
  });
3883
3886
 
3884
- var baseActionsList = [{
3887
+ var baseActionsList$1 = [{
3885
3888
  action: 'changeValue',
3886
3889
  key: 'value'
3887
3890
  }, {
@@ -3904,10 +3907,10 @@
3904
3907
  action: 'changeActive',
3905
3908
  key: 'active'
3906
3909
  }];
3907
- function actionsMapBase(diff, oldObj, newObj) {
3910
+ function actionsMapBase$1(diff, oldObj, newObj) {
3908
3911
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
3909
3912
  return buildBaseAttributesActions({
3910
- actions: baseActionsList,
3913
+ actions: baseActionsList$1,
3911
3914
  diff: diff,
3912
3915
  oldObj: oldObj,
3913
3916
  newObj: newObj,
@@ -3918,7 +3921,7 @@
3918
3921
  function createPriceMapActions(mapActionGroup, syncActionConfig) {
3919
3922
  return function doMapActions(diff, newObj, oldObj) {
3920
3923
  var baseActions = mapActionGroup('base', function () {
3921
- return actionsMapBase(diff, oldObj, newObj, syncActionConfig);
3924
+ return actionsMapBase$1(diff, oldObj, newObj, syncActionConfig);
3922
3925
  });
3923
3926
  var customActions = mapActionGroup('custom', function () {
3924
3927
  return actionsMapCustom(diff, newObj, oldObj);
@@ -3936,6 +3939,88 @@
3936
3939
  };
3937
3940
  });
3938
3941
 
3942
+ var hasAttribute = function hasAttribute(attributes, newValue) {
3943
+ return attributes.some(function (attribute) {
3944
+ return attribute.key === newValue.key;
3945
+ });
3946
+ };
3947
+
3948
+ var baseActionsList = [{
3949
+ action: 'changeName',
3950
+ key: 'name'
3951
+ }, {
3952
+ action: 'setKey',
3953
+ key: 'key'
3954
+ }, {
3955
+ action: 'setDescription',
3956
+ key: 'description'
3957
+ }];
3958
+ function actionsMapBase(diff, oldObj, newObj) {
3959
+ var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
3960
+ return buildBaseAttributesActions({
3961
+ actions: baseActionsList,
3962
+ diff: diff,
3963
+ oldObj: oldObj,
3964
+ newObj: newObj,
3965
+ shouldOmitEmptyString: config.shouldOmitEmptyString
3966
+ });
3967
+ }
3968
+ function actionsMapAttributes(diff, oldObj, newObj) {
3969
+ var _createBuildArrayActi;
3970
+
3971
+ var handler = createBuildArrayActions('attributes', (_createBuildArrayActi = {}, _defineProperty(_createBuildArrayActi, ADD_ACTIONS, function (newAttribute) {
3972
+ return {
3973
+ action: 'addAttribute',
3974
+ attribute: newAttribute
3975
+ };
3976
+ }), _defineProperty(_createBuildArrayActi, REMOVE_ACTIONS, function (oldAttribute) {
3977
+ // We only add the action if the attribute is not included in the new object.
3978
+ return !hasAttribute(newObj.attributes, oldAttribute) ? {
3979
+ action: 'removeAttribute',
3980
+ attribute: oldAttribute
3981
+ } : null;
3982
+ }), _defineProperty(_createBuildArrayActi, CHANGE_ACTIONS, function (oldAttribute, newAttribute) {
3983
+ var result = []; // We only remove the attribute in case that the oldAttribute is not
3984
+ // included in the new object
3985
+
3986
+ if (!hasAttribute(newObj.attributes, oldAttribute)) result.push({
3987
+ action: 'removeAttribute',
3988
+ attribute: oldAttribute
3989
+ }); // We only add the attribute in case that the newAttribute was not
3990
+ // included in the old object
3991
+
3992
+ if (!hasAttribute(oldObj.attributes, newAttribute)) result.push({
3993
+ action: 'addAttribute',
3994
+ attribute: newAttribute
3995
+ });
3996
+ return result;
3997
+ }), _createBuildArrayActi));
3998
+ return handler(diff, oldObj, newObj);
3999
+ }
4000
+
4001
+ function createAttributeGroupsMapActions(mapActionGroup, syncActionConfig) {
4002
+ return function doMapActions(diff, newObj, oldObj) {
4003
+ var allActions = [];
4004
+ allActions.push(mapActionGroup('base', function () {
4005
+ return actionsMapBase(diff, oldObj, newObj, syncActionConfig);
4006
+ }));
4007
+ allActions.push(flatten__default["default"](mapActionGroup('attributes', function () {
4008
+ return actionsMapAttributes(diff, oldObj, newObj);
4009
+ })));
4010
+ return flatten__default["default"](allActions);
4011
+ };
4012
+ }
4013
+
4014
+ var attributeGroups = (function (actionGroupList, syncActionConfig) {
4015
+ var mapActionGroup = createMapActionGroup(actionGroupList);
4016
+ var doMapActions = createAttributeGroupsMapActions(mapActionGroup, syncActionConfig);
4017
+ var buildActions = createBuildActions(diff, doMapActions);
4018
+ return {
4019
+ buildActions: buildActions
4020
+ };
4021
+ });
4022
+
4023
+ exports.createSyncAttributeGroups = attributeGroups;
3939
4024
  exports.createSyncCartDiscounts = cartDiscounts;
3940
4025
  exports.createSyncCategories = categories;
3941
4026
  exports.createSyncChannels = channels;