@commercetools/sync-actions 7.1.2 → 7.2.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.
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var flatten = require('lodash.flatten');
6
6
  var isEqual = require('lodash.isequal');
7
7
  var isNil = require('lodash.isnil');
8
- var jsondiffpatch = require('jsondiffpatch');
8
+ var jsondiffpatch_cjs = require('jsondiffpatch/dist/jsondiffpatch.cjs');
9
9
  var forEach = require('lodash.foreach');
10
10
  var uniqWith = require('lodash.uniqwith');
11
11
  var intersection = require('lodash.intersection');
@@ -15,28 +15,9 @@ var sortBy = require('lodash.sortby');
15
15
 
16
16
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
17
17
 
18
- function _interopNamespace(e) {
19
- if (e && e.__esModule) return e;
20
- var n = Object.create(null);
21
- if (e) {
22
- Object.keys(e).forEach(function (k) {
23
- if (k !== 'default') {
24
- var d = Object.getOwnPropertyDescriptor(e, k);
25
- Object.defineProperty(n, k, d.get ? d : {
26
- enumerable: true,
27
- get: function () { return e[k]; }
28
- });
29
- }
30
- });
31
- }
32
- n["default"] = e;
33
- return Object.freeze(n);
34
- }
35
-
36
18
  var flatten__default = /*#__PURE__*/_interopDefault(flatten);
37
19
  var isEqual__default = /*#__PURE__*/_interopDefault(isEqual);
38
20
  var isNil__default = /*#__PURE__*/_interopDefault(isNil);
39
- var jsondiffpatch__namespace = /*#__PURE__*/_interopNamespace(jsondiffpatch);
40
21
  var forEach__default = /*#__PURE__*/_interopDefault(forEach);
41
22
  var uniqWith__default = /*#__PURE__*/_interopDefault(uniqWith);
42
23
  var intersection__default = /*#__PURE__*/_interopDefault(intersection);
@@ -287,7 +268,7 @@ function objectHash(obj, index) {
287
268
  var objIndex = "$$index:".concat(index);
288
269
  return _typeof(obj) === 'object' && obj !== null ? obj.id || obj.name || obj.url || objIndex : objIndex;
289
270
  }
290
- var diffpatcher = jsondiffpatch__namespace.create({
271
+ var diffpatcher = new jsondiffpatch_cjs.DiffPatcher({
291
272
  objectHash: objectHash,
292
273
  arrays: {
293
274
  // detect items moved inside the array
@@ -670,7 +651,7 @@ function buildReferenceActions(_ref4) {
670
651
  });
671
652
  }
672
653
 
673
- var baseActionsList$l = [{
654
+ var baseActionsList$o = [{
674
655
  action: 'changeName',
675
656
  key: 'name'
676
657
  }, {
@@ -708,10 +689,10 @@ var referenceActionsList$3 = [{
708
689
  * SYNC FUNCTIONS
709
690
  */
710
691
 
711
- function actionsMapBase$l(diff, oldObj, newObj) {
692
+ function actionsMapBase$o(diff, oldObj, newObj) {
712
693
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
713
694
  return buildBaseAttributesActions({
714
- actions: baseActionsList$l,
695
+ actions: baseActionsList$o,
715
696
  diff: diff,
716
697
  oldObj: oldObj,
717
698
  newObj: newObj,
@@ -808,7 +789,7 @@ function createCategoryMapActions(mapActionGroup, syncActionConfig) {
808
789
  return function doMapActions(diff, newObj, oldObj) {
809
790
  var allActions = [];
810
791
  allActions.push(mapActionGroup('base', function () {
811
- return actionsMapBase$l(diff, oldObj, newObj, syncActionConfig);
792
+ return actionsMapBase$o(diff, oldObj, newObj, syncActionConfig);
812
793
  }));
813
794
  allActions.push(mapActionGroup('references', function () {
814
795
  return actionsMapReferences$3(diff, oldObj, newObj);
@@ -846,7 +827,7 @@ var categories = (function (actionGroupList, syncActionConfig) {
846
827
  });
847
828
 
848
829
  var isEmptyValue = createIsEmptyValue([undefined, null, '']);
849
- var baseActionsList$k = [{
830
+ var baseActionsList$n = [{
850
831
  action: 'setSalutation',
851
832
  key: 'salutation'
852
833
  }, {
@@ -912,10 +893,10 @@ var authenticationModeActionsList = [{
912
893
  * SYNC FUNCTIONS
913
894
  */
914
895
 
915
- function actionsMapBase$k(diff, oldObj, newObj) {
896
+ function actionsMapBase$n(diff, oldObj, newObj) {
916
897
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
917
898
  return buildBaseAttributesActions({
918
- actions: baseActionsList$k,
899
+ actions: baseActionsList$n,
919
900
  diff: diff,
920
901
  oldObj: oldObj,
921
902
  newObj: newObj,
@@ -1052,11 +1033,11 @@ function buildAuthenticationModeActions(_ref) {
1052
1033
  });
1053
1034
  }
1054
1035
 
1055
- function createCustomerMapActions(mapActionGroup, syncActionConfig) {
1036
+ function createCustomerMapActions$1(mapActionGroup, syncActionConfig) {
1056
1037
  return function doMapActions(diff, newObj, oldObj) {
1057
1038
  var allActions = [];
1058
1039
  allActions.push(mapActionGroup('base', function () {
1059
- return actionsMapBase$k(diff, oldObj, newObj, syncActionConfig);
1040
+ return actionsMapBase$n(diff, oldObj, newObj, syncActionConfig);
1060
1041
  }));
1061
1042
  allActions.push(mapActionGroup('references', function () {
1062
1043
  return actionsMapReferences$2(diff, oldObj, newObj);
@@ -1095,14 +1076,14 @@ var customers = (function (actionGroupList, syncActionConfig) {
1095
1076
  // for allowed action groups and return the return value of the callback
1096
1077
  // It will return an empty array for ignored action groups
1097
1078
  var mapActionGroup = createMapActionGroup(actionGroupList);
1098
- var doMapActions = createCustomerMapActions(mapActionGroup, syncActionConfig);
1079
+ var doMapActions = createCustomerMapActions$1(mapActionGroup, syncActionConfig);
1099
1080
  var buildActions = createBuildActions(diff, doMapActions, copyEmptyArrayProps);
1100
1081
  return {
1101
1082
  buildActions: buildActions
1102
1083
  };
1103
1084
  });
1104
1085
 
1105
- var baseActionsList$j = [{
1086
+ var baseActionsList$m = [{
1106
1087
  action: 'changeQuantity',
1107
1088
  key: 'quantityOnStock',
1108
1089
  actionKey: 'quantity'
@@ -1122,10 +1103,10 @@ var referenceActionsList$1 = [{
1122
1103
  * SYNC FUNCTIONS
1123
1104
  */
1124
1105
 
1125
- function actionsMapBase$j(diff, oldObj, newObj) {
1106
+ function actionsMapBase$m(diff, oldObj, newObj) {
1126
1107
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1127
1108
  return buildBaseAttributesActions({
1128
- actions: baseActionsList$j,
1109
+ actions: baseActionsList$m,
1129
1110
  diff: diff,
1130
1111
  oldObj: oldObj,
1131
1112
  newObj: newObj,
@@ -1147,7 +1128,7 @@ function createInventoryMapActions(mapActionGroup, syncActionConfig) {
1147
1128
  return function doMapActions(diff, newObj, oldObj) {
1148
1129
  var allActions = [];
1149
1130
  allActions.push(mapActionGroup('base', function () {
1150
- return actionsMapBase$j(diff, oldObj, newObj, syncActionConfig);
1131
+ return actionsMapBase$m(diff, oldObj, newObj, syncActionConfig);
1151
1132
  }));
1152
1133
  allActions.push(mapActionGroup('references', function () {
1153
1134
  return actionsMapReferences$1(diff, oldObj, newObj);
@@ -1237,7 +1218,7 @@ function findMatchingPairs(diff) {
1237
1218
 
1238
1219
  var REGEX_NUMBER$2 = new RegExp(/^\d+$/);
1239
1220
  var REGEX_UNDERSCORE_NUMBER$2 = new RegExp(/^_\d+$/);
1240
- var baseActionsList$i = [{
1221
+ var baseActionsList$l = [{
1241
1222
  action: 'changeName',
1242
1223
  key: 'name'
1243
1224
  }, {
@@ -1641,10 +1622,10 @@ function _buildVariantAssetsActions(diffAssets, oldVariant, newVariant) {
1641
1622
  * SYNC FUNCTIONS
1642
1623
  */
1643
1624
 
1644
- function actionsMapBase$i(diff, oldObj, newObj) {
1625
+ function actionsMapBase$l(diff, oldObj, newObj) {
1645
1626
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1646
1627
  return buildBaseAttributesActions({
1647
- actions: baseActionsList$i,
1628
+ actions: baseActionsList$l,
1648
1629
  diff: diff,
1649
1630
  oldObj: oldObj,
1650
1631
  newObj: newObj,
@@ -1881,7 +1862,7 @@ function createProductMapActions(mapActionGroup, syncActionConfig) {
1881
1862
  return actionsMapRemoveVariants(diff, oldObj, newObj);
1882
1863
  }));
1883
1864
  allActions.push(mapActionGroup('base', function () {
1884
- return actionsMapBase$i(diff, oldObj, newObj, syncActionConfig);
1865
+ return actionsMapBase$l(diff, oldObj, newObj, syncActionConfig);
1885
1866
  }));
1886
1867
  allActions.push(mapActionGroup('meta', function () {
1887
1868
  return actionsMapMeta(diff, oldObj, newObj);
@@ -1948,7 +1929,7 @@ var isAddAction = function isAddAction(key, resource) {
1948
1929
  var isRemoveAction = function isRemoveAction(key, resource) {
1949
1930
  return REGEX_UNDERSCORE_NUMBER$1.test(key) && Number(resource[2]) === 0;
1950
1931
  };
1951
- var baseActionsList$h = [{
1932
+ var baseActionsList$k = [{
1952
1933
  action: 'changeOrderState',
1953
1934
  key: 'orderState'
1954
1935
  }, {
@@ -1963,10 +1944,10 @@ var baseActionsList$h = [{
1963
1944
  * SYNC FUNCTIONS
1964
1945
  */
1965
1946
 
1966
- function actionsMapBase$h(diff, oldObj, newObj) {
1947
+ function actionsMapBase$k(diff, oldObj, newObj) {
1967
1948
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1968
1949
  return buildBaseAttributesActions({
1969
- actions: baseActionsList$h,
1950
+ actions: baseActionsList$k,
1970
1951
  diff: diff,
1971
1952
  oldObj: oldObj,
1972
1953
  newObj: newObj,
@@ -2116,7 +2097,7 @@ function createOrderMapActions(mapActionGroup, syncActionConfig) {
2116
2097
  deliveryHashMap = findMatchingPairs(diff.shippingInfo.deliveries, oldObj.shippingInfo.deliveries, newObj.shippingInfo.deliveries);
2117
2098
  }
2118
2099
  allActions.push(mapActionGroup('base', function () {
2119
- return actionsMapBase$h(diff, oldObj, newObj, syncActionConfig);
2100
+ return actionsMapBase$k(diff, oldObj, newObj, syncActionConfig);
2120
2101
  }));
2121
2102
  allActions.push(mapActionGroup('deliveries', function () {
2122
2103
  return actionsMapDeliveries(diff, oldObj, newObj);
@@ -2156,7 +2137,7 @@ var orders = (function (actionGroupList, syncActionConfig) {
2156
2137
  };
2157
2138
  });
2158
2139
 
2159
- var baseActionsList$g = [{
2140
+ var baseActionsList$j = [{
2160
2141
  action: 'setKey',
2161
2142
  key: 'key'
2162
2143
  }, {
@@ -2166,10 +2147,10 @@ var baseActionsList$g = [{
2166
2147
  action: 'transitionState',
2167
2148
  key: 'state'
2168
2149
  }];
2169
- function actionsMapBase$g(diff, oldObj, newObj) {
2150
+ function actionsMapBase$j(diff, oldObj, newObj) {
2170
2151
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
2171
2152
  return buildBaseAttributesActions({
2172
- actions: baseActionsList$g,
2153
+ actions: baseActionsList$j,
2173
2154
  diff: diff,
2174
2155
  oldObj: oldObj,
2175
2156
  newObj: newObj,
@@ -2183,7 +2164,7 @@ function createRecurringOrdersMapActions(mapActionGroup, syncActionConfig) {
2183
2164
  return function doMapActions(diff, newObj, oldObj) {
2184
2165
  var allActions = [];
2185
2166
  allActions.push(mapActionGroup('base', function () {
2186
- return actionsMapBase$g(diff, oldObj, newObj, syncActionConfig);
2167
+ return actionsMapBase$j(diff, oldObj, newObj, syncActionConfig);
2187
2168
  }));
2188
2169
  allActions.push(mapActionGroup('custom', function () {
2189
2170
  return actionsMapCustom(diff, newObj, oldObj);
@@ -2200,7 +2181,7 @@ var recurringOrders = (function (actionGroupList, syncActionConfig) {
2200
2181
  };
2201
2182
  });
2202
2183
 
2203
- var baseActionsList$f = [{
2184
+ var baseActionsList$i = [{
2204
2185
  action: 'changeIsActive',
2205
2186
  key: 'isActive'
2206
2187
  }, {
@@ -2228,10 +2209,10 @@ var baseActionsList$f = [{
2228
2209
  action: 'setKey',
2229
2210
  key: 'key'
2230
2211
  }];
2231
- function actionsMapBase$f(diff, oldObj, newObj) {
2212
+ function actionsMapBase$i(diff, oldObj, newObj) {
2232
2213
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
2233
2214
  return buildBaseAttributesActions({
2234
- actions: baseActionsList$f,
2215
+ actions: baseActionsList$i,
2235
2216
  diff: diff,
2236
2217
  oldObj: oldObj,
2237
2218
  newObj: newObj,
@@ -2269,7 +2250,7 @@ function createProductDiscountsMapActions(mapActionGroup, syncActionConfig) {
2269
2250
  return function doMapActions(diff, newObj, oldObj) {
2270
2251
  var allActions = [];
2271
2252
  allActions.push(mapActionGroup('base', function () {
2272
- return actionsMapBase$f(diff, oldObj, newObj, syncActionConfig);
2253
+ return actionsMapBase$i(diff, oldObj, newObj, syncActionConfig);
2273
2254
  }));
2274
2255
  return combineValidityActions(flatten__default["default"](allActions));
2275
2256
  };
@@ -2284,7 +2265,7 @@ var productDiscounts = (function (actionGroupList) {
2284
2265
  };
2285
2266
  });
2286
2267
 
2287
- var baseActionsList$e = [{
2268
+ var baseActionsList$h = [{
2288
2269
  action: 'changeIsActive',
2289
2270
  key: 'isActive'
2290
2271
  }, {
@@ -2318,10 +2299,10 @@ var baseActionsList$e = [{
2318
2299
  action: 'changeGroups',
2319
2300
  key: 'groups'
2320
2301
  }];
2321
- function actionsMapBase$e(diff, oldObj, newObj) {
2302
+ function actionsMapBase$h(diff, oldObj, newObj) {
2322
2303
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
2323
2304
  return buildBaseAttributesActions({
2324
- actions: baseActionsList$e,
2305
+ actions: baseActionsList$h,
2325
2306
  diff: diff,
2326
2307
  oldObj: oldObj,
2327
2308
  newObj: newObj,
@@ -2335,7 +2316,7 @@ function createDiscountCodesMapActions(mapActionGroup, syncActionConfig) {
2335
2316
  return function doMapActions(diff, newObj, oldObj) {
2336
2317
  var allActions = [];
2337
2318
  allActions.push(mapActionGroup('base', function () {
2338
- return actionsMapBase$e(diff, oldObj, newObj, syncActionConfig);
2319
+ return actionsMapBase$h(diff, oldObj, newObj, syncActionConfig);
2339
2320
  }));
2340
2321
  allActions.push(mapActionGroup('custom', function () {
2341
2322
  return actionsMapCustom(diff, newObj, oldObj);
@@ -2364,17 +2345,17 @@ var discountCodes = (function (actionGroupList) {
2364
2345
  };
2365
2346
  });
2366
2347
 
2367
- var baseActionsList$d = [{
2348
+ var baseActionsList$g = [{
2368
2349
  action: 'changeName',
2369
2350
  key: 'name'
2370
2351
  }, {
2371
2352
  action: 'setKey',
2372
2353
  key: 'key'
2373
2354
  }];
2374
- function actionsMapBase$d(diff, oldObj, newObj) {
2355
+ function actionsMapBase$g(diff, oldObj, newObj) {
2375
2356
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
2376
2357
  return buildBaseAttributesActions({
2377
- actions: baseActionsList$d,
2358
+ actions: baseActionsList$g,
2378
2359
  diff: diff,
2379
2360
  oldObj: oldObj,
2380
2361
  newObj: newObj,
@@ -2388,7 +2369,7 @@ function createCustomerGroupMapActions(mapActionGroup, syncActionConfig) {
2388
2369
  return function doMapActions(diff, newObj, oldObj) {
2389
2370
  var allActions = [];
2390
2371
  allActions.push(mapActionGroup('base', function () {
2391
- return actionsMapBase$d(diff, oldObj, newObj, syncActionConfig);
2372
+ return actionsMapBase$g(diff, oldObj, newObj, syncActionConfig);
2392
2373
  }));
2393
2374
  allActions.push(mapActionGroup('custom', function () {
2394
2375
  return actionsMapCustom(diff, newObj, oldObj);
@@ -2406,7 +2387,7 @@ var customerGroup = (function (actionGroupList) {
2406
2387
  };
2407
2388
  });
2408
2389
 
2409
- var baseActionsList$c = [{
2390
+ var baseActionsList$f = [{
2410
2391
  action: 'changeIsActive',
2411
2392
  key: 'isActive'
2412
2393
  }, {
@@ -2443,10 +2424,10 @@ var baseActionsList$c = [{
2443
2424
  action: 'setKey',
2444
2425
  key: 'key'
2445
2426
  }];
2446
- function actionsMapBase$c(diff, oldObj, newObj) {
2427
+ function actionsMapBase$f(diff, oldObj, newObj) {
2447
2428
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
2448
2429
  return buildBaseAttributesActions({
2449
- actions: baseActionsList$c,
2430
+ actions: baseActionsList$f,
2450
2431
  diff: diff,
2451
2432
  oldObj: oldObj,
2452
2433
  newObj: newObj,
@@ -2460,7 +2441,7 @@ function createCartDiscountsMapActions(mapActionGroup, syncActionConfig) {
2460
2441
  return function doMapActions(diff, newObj, oldObj) {
2461
2442
  var allActions = [];
2462
2443
  allActions.push(mapActionGroup('base', function () {
2463
- return actionsMapBase$c(diff, oldObj, newObj, syncActionConfig);
2444
+ return actionsMapBase$f(diff, oldObj, newObj, syncActionConfig);
2464
2445
  }));
2465
2446
  allActions.push(mapActionGroup('custom', function () {
2466
2447
  return actionsMapCustom(diff, newObj, oldObj);
@@ -2485,7 +2466,7 @@ function removeTypename(obj) {
2485
2466
  return objWithoutTypename;
2486
2467
  }
2487
2468
 
2488
- var baseActionsList$b = [{
2469
+ var baseActionsList$e = [{
2489
2470
  action: 'changeName',
2490
2471
  key: 'name'
2491
2472
  }, {
@@ -2495,10 +2476,10 @@ var baseActionsList$b = [{
2495
2476
  action: 'setDescription',
2496
2477
  key: 'description'
2497
2478
  }];
2498
- function actionsMapBase$b(diff, oldObj, newObj) {
2479
+ function actionsMapBase$e(diff, oldObj, newObj) {
2499
2480
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
2500
2481
  return buildBaseAttributesActions({
2501
- actions: baseActionsList$b,
2482
+ actions: baseActionsList$e,
2502
2483
  diff: diff,
2503
2484
  oldObj: oldObj,
2504
2485
  newObj: newObj,
@@ -2542,7 +2523,7 @@ function createTaxCategoriesMapActions(mapActionGroup, syncActionConfig) {
2542
2523
  return function doMapActions(diff, newObj, oldObj) {
2543
2524
  var allActions = [];
2544
2525
  allActions.push(mapActionGroup('base', function () {
2545
- return actionsMapBase$b(diff, oldObj, newObj, syncActionConfig);
2526
+ return actionsMapBase$e(diff, oldObj, newObj, syncActionConfig);
2546
2527
  }));
2547
2528
  allActions.push(mapActionGroup('rates', function () {
2548
2529
  return actionsMapRates(diff, oldObj, newObj);
@@ -2570,7 +2551,7 @@ var taxCategories = (function (actionGroupList, syncActionConfig) {
2570
2551
  };
2571
2552
  });
2572
2553
 
2573
- var baseActionsList$a = [{
2554
+ var baseActionsList$d = [{
2574
2555
  action: 'changeName',
2575
2556
  key: 'name'
2576
2557
  }, {
@@ -2585,10 +2566,10 @@ var hasLocation = function hasLocation(locations, otherLocation) {
2585
2566
  return location.country === otherLocation.country;
2586
2567
  });
2587
2568
  };
2588
- function actionsMapBase$a(diff, oldObj, newObj) {
2569
+ function actionsMapBase$d(diff, oldObj, newObj) {
2589
2570
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
2590
2571
  return buildBaseAttributesActions({
2591
- actions: baseActionsList$a,
2572
+ actions: baseActionsList$d,
2592
2573
  diff: diff,
2593
2574
  oldObj: oldObj,
2594
2575
  newObj: newObj,
@@ -2636,7 +2617,7 @@ function createZonesMapActions(mapActionGroup, syncActionConfig) {
2636
2617
  return function doMapActions(diff, newObj, oldObj) {
2637
2618
  var allActions = [];
2638
2619
  allActions.push(mapActionGroup('base', function () {
2639
- return actionsMapBase$a(diff, oldObj, newObj, syncActionConfig);
2620
+ return actionsMapBase$d(diff, oldObj, newObj, syncActionConfig);
2640
2621
  }));
2641
2622
  allActions.push(flatten__default["default"](mapActionGroup('locations', function () {
2642
2623
  return actionsMapLocations(diff, oldObj, newObj);
@@ -2664,7 +2645,7 @@ var zones = (function (actionGroupList, syncActionConfig) {
2664
2645
  };
2665
2646
  });
2666
2647
 
2667
- var baseActionsList$9 = [{
2648
+ var baseActionsList$c = [{
2668
2649
  action: 'setKey',
2669
2650
  key: 'key'
2670
2651
  }, {
@@ -2692,10 +2673,10 @@ var baseActionsList$9 = [{
2692
2673
  action: 'changeActive',
2693
2674
  key: 'active'
2694
2675
  }];
2695
- function actionsMapBase$9(diff, oldObj, newObj) {
2676
+ function actionsMapBase$c(diff, oldObj, newObj) {
2696
2677
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
2697
2678
  return buildBaseAttributesActions({
2698
- actions: baseActionsList$9,
2679
+ actions: baseActionsList$c,
2699
2680
  diff: diff,
2700
2681
  oldObj: oldObj,
2701
2682
  newObj: newObj,
@@ -2772,7 +2753,7 @@ function createShippingMethodsMapActions(mapActionGroup, syncActionConfig) {
2772
2753
  return function doMapActions(diff, newObj, oldObj) {
2773
2754
  var allActions = [];
2774
2755
  allActions.push(mapActionGroup('base', function () {
2775
- return actionsMapBase$9(diff, oldObj, newObj, syncActionConfig);
2756
+ return actionsMapBase$c(diff, oldObj, newObj, syncActionConfig);
2776
2757
  }));
2777
2758
  allActions.push(flatten__default["default"](mapActionGroup('zoneRates', function () {
2778
2759
  return actionsMapZoneRates(diff, oldObj, newObj);
@@ -2803,7 +2784,7 @@ var shippingMethods = (function (actionGroupList, syncActionConfig) {
2803
2784
  };
2804
2785
  });
2805
2786
 
2806
- var baseActionsList$8 = [{
2787
+ var baseActionsList$b = [{
2807
2788
  action: 'changeName',
2808
2789
  key: 'name'
2809
2790
  }, {
@@ -2813,7 +2794,7 @@ var baseActionsList$8 = [{
2813
2794
  action: 'changeDescription',
2814
2795
  key: 'description'
2815
2796
  }];
2816
- function actionsMapBase$8(diff, previous, next) {
2797
+ function actionsMapBase$b(diff, previous, next) {
2817
2798
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
2818
2799
  // when `diff` is undefined, then the underlying `buildActions` has returned any diff
2819
2800
  // which given in product-types would mean that `buildActions` has run with `nestedValuesChanges` applied
@@ -2821,7 +2802,7 @@ function actionsMapBase$8(diff, previous, next) {
2821
2802
  if (!diff) return [];
2822
2803
  return buildBaseAttributesActions({
2823
2804
  diff: diff,
2824
- actions: baseActionsList$8,
2805
+ actions: baseActionsList$b,
2825
2806
  oldObj: previous,
2826
2807
  newObj: next,
2827
2808
  shouldOmitEmptyString: config.shouldOmitEmptyString,
@@ -3040,7 +3021,7 @@ function createProductTypeMapActions(mapActionGroup, syncActionConfig) {
3040
3021
  // we support only base fields for the product type,
3041
3022
  // for attributes, applying hints would be recommended
3042
3023
  mapActionGroup('base', function () {
3043
- return actionsMapBase$8(diff, previous, next, syncActionConfig);
3024
+ return actionsMapBase$b(diff, previous, next, syncActionConfig);
3044
3025
  }), actionsMapForHints(options.nestedValuesChanges, previous, next)]);
3045
3026
  };
3046
3027
  }
@@ -3056,7 +3037,7 @@ var productTypes = (function (actionGroupList, syncActionConfig) {
3056
3037
  };
3057
3038
  });
3058
3039
 
3059
- var baseActionsList$7 = [{
3040
+ var baseActionsList$a = [{
3060
3041
  action: 'changeKey',
3061
3042
  key: 'key'
3062
3043
  }, {
@@ -3075,10 +3056,10 @@ var baseActionsList$7 = [{
3075
3056
  action: 'setTransitions',
3076
3057
  key: 'transitions'
3077
3058
  }];
3078
- function actionsMapBase$7(diff, oldObj, newObj) {
3059
+ function actionsMapBase$a(diff, oldObj, newObj) {
3079
3060
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
3080
3061
  return buildBaseAttributesActions({
3081
- actions: baseActionsList$7,
3062
+ actions: baseActionsList$a,
3082
3063
  diff: diff,
3083
3064
  oldObj: oldObj,
3084
3065
  newObj: newObj,
@@ -3127,7 +3108,7 @@ function createStatesMapActions(mapActionGroup, syncActionConfig) {
3127
3108
  var baseActions = [];
3128
3109
  var roleActions = [];
3129
3110
  baseActions.push(mapActionGroup('base', function () {
3130
- return actionsMapBase$7(diff, oldObj, newObj, syncActionConfig);
3111
+ return actionsMapBase$a(diff, oldObj, newObj, syncActionConfig);
3131
3112
  }));
3132
3113
  roleActions.push(mapActionGroup('roles', function () {
3133
3114
  return actionsMapRoles(diff, oldObj, newObj);
@@ -3144,7 +3125,7 @@ var states = (function (actionGroupList, syncActionConfig) {
3144
3125
  };
3145
3126
  });
3146
3127
 
3147
- var baseActionsList$6 = [{
3128
+ var baseActionsList$9 = [{
3148
3129
  action: 'changeKey',
3149
3130
  key: 'key'
3150
3131
  }, {
@@ -3163,10 +3144,10 @@ var baseActionsList$6 = [{
3163
3144
  action: 'setRoles',
3164
3145
  key: 'roles'
3165
3146
  }];
3166
- function actionsMapBase$6(diff, oldObj, newObj) {
3147
+ function actionsMapBase$9(diff, oldObj, newObj) {
3167
3148
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
3168
3149
  return buildBaseAttributesActions({
3169
- actions: baseActionsList$6,
3150
+ actions: baseActionsList$9,
3170
3151
  diff: diff,
3171
3152
  oldObj: oldObj,
3172
3153
  newObj: newObj,
@@ -3180,7 +3161,7 @@ function createChannelsMapActions$1(mapActionGroup, syncActionConfig) {
3180
3161
  return function doMapActions(diff, newObj, oldObj) {
3181
3162
  var allActions = [];
3182
3163
  allActions.push(mapActionGroup('base', function () {
3183
- return actionsMapBase$6(diff, oldObj, newObj, syncActionConfig);
3164
+ return actionsMapBase$9(diff, oldObj, newObj, syncActionConfig);
3184
3165
  }));
3185
3166
  allActions.push(mapActionGroup('custom', function () {
3186
3167
  return actionsMapCustom(diff, newObj, oldObj);
@@ -3206,7 +3187,7 @@ var getIsChangedOperation = function getIsChangedOperation(key) {
3206
3187
  var getIsRemovedOperation = function getIsRemovedOperation(key) {
3207
3188
  return REGEX_UNDERSCORE_NUMBER.test(key);
3208
3189
  };
3209
- var baseActionsList$5 = [{
3190
+ var baseActionsList$8 = [{
3210
3191
  action: 'changeKey',
3211
3192
  key: 'key'
3212
3193
  }, {
@@ -3216,10 +3197,10 @@ var baseActionsList$5 = [{
3216
3197
  action: 'setDescription',
3217
3198
  key: 'description'
3218
3199
  }];
3219
- function actionsMapBase$5(diff, oldObj, newObj) {
3200
+ function actionsMapBase$8(diff, oldObj, newObj) {
3220
3201
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
3221
3202
  return buildBaseAttributesActions({
3222
- actions: baseActionsList$5,
3203
+ actions: baseActionsList$8,
3223
3204
  diff: diff,
3224
3205
  oldObj: oldObj,
3225
3206
  newObj: newObj,
@@ -3361,7 +3342,7 @@ function createTypeMapActions(mapActionGroup, syncActionConfig) {
3361
3342
  return function doMapActions(diff, next, previous) {
3362
3343
  var allActions = [];
3363
3344
  allActions.push(mapActionGroup('base', function () {
3364
- return actionsMapBase$5(diff, previous, next, syncActionConfig);
3345
+ return actionsMapBase$8(diff, previous, next, syncActionConfig);
3365
3346
  }), mapActionGroup('fieldDefinitions', function () {
3366
3347
  return actionsMapFieldDefinitions(diff.fieldDefinitions, previous.fieldDefinitions, next.fieldDefinitions, findMatchingPairs(diff.fieldDefinitions, previous.fieldDefinitions, next.fieldDefinitions, 'name'));
3367
3348
  }));
@@ -3377,7 +3358,7 @@ var types = (function (actionGroupList, syncActionConfig) {
3377
3358
  };
3378
3359
  });
3379
3360
 
3380
- var baseActionsList$4 = [{
3361
+ var baseActionsList$7 = [{
3381
3362
  action: 'changeName',
3382
3363
  key: 'name'
3383
3364
  }, {
@@ -3413,10 +3394,10 @@ var businessUnitSearchActionsList = [{
3413
3394
  action: 'changeBusinessUnitSearchStatus',
3414
3395
  key: 'status'
3415
3396
  }];
3416
- function actionsMapBase$4(diff, oldObj, newObj) {
3397
+ function actionsMapBase$7(diff, oldObj, newObj) {
3417
3398
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
3418
3399
  return buildBaseAttributesActions({
3419
- actions: baseActionsList$4,
3400
+ actions: baseActionsList$7,
3420
3401
  diff: diff,
3421
3402
  oldObj: oldObj,
3422
3403
  newObj: newObj,
@@ -3474,7 +3455,7 @@ function createChannelsMapActions(mapActionGroup, syncActionConfig) {
3474
3455
  return function doMapActions(diff, newObj, oldObj) {
3475
3456
  var allActions = [];
3476
3457
  allActions.push(mapActionGroup('base', function () {
3477
- return actionsMapBase$4(diff, oldObj, newObj, syncActionConfig);
3458
+ return actionsMapBase$7(diff, oldObj, newObj, syncActionConfig);
3478
3459
  }));
3479
3460
  allActions.push(mapActionGroup('businessUnit', function () {
3480
3461
  return actionsMapBusinessUnit(diff, oldObj, newObj);
@@ -3495,7 +3476,7 @@ var projects = (function (actionGroupList) {
3495
3476
  };
3496
3477
  });
3497
3478
 
3498
- var baseActionsList$3 = [{
3479
+ var baseActionsList$6 = [{
3499
3480
  action: 'setName',
3500
3481
  key: 'name'
3501
3482
  }, {
@@ -3508,10 +3489,10 @@ var baseActionsList$3 = [{
3508
3489
  action: 'setSupplyChannels',
3509
3490
  key: 'supplyChannels'
3510
3491
  }];
3511
- function actionsMapBase$3(diff, oldObj, newObj) {
3492
+ function actionsMapBase$6(diff, oldObj, newObj) {
3512
3493
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
3513
3494
  return buildBaseAttributesActions({
3514
- actions: baseActionsList$3,
3495
+ actions: baseActionsList$6,
3515
3496
  diff: diff,
3516
3497
  oldObj: oldObj,
3517
3498
  newObj: newObj,
@@ -3525,7 +3506,7 @@ function createStoresMapActions(mapActionGroup) {
3525
3506
  return function doMapActions(diff, next, previous) {
3526
3507
  var allActions = [];
3527
3508
  allActions.push(mapActionGroup('base', function () {
3528
- return actionsMapBase$3(diff, previous, next);
3509
+ return actionsMapBase$6(diff, previous, next);
3529
3510
  }));
3530
3511
  allActions.push(mapActionGroup('custom', function () {
3531
3512
  return actionsMapCustom(diff, next, previous);
@@ -3544,17 +3525,17 @@ var stores = (function (actionGroupList) {
3544
3525
  };
3545
3526
  });
3546
3527
 
3547
- var baseActionsList$2 = [{
3528
+ var baseActionsList$5 = [{
3548
3529
  action: 'changeName',
3549
3530
  key: 'name'
3550
3531
  }, {
3551
3532
  action: 'setKey',
3552
3533
  key: 'key'
3553
3534
  }];
3554
- function actionsMapBase$2(diff, oldObj, newObj) {
3535
+ function actionsMapBase$5(diff, oldObj, newObj) {
3555
3536
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
3556
3537
  return buildBaseAttributesActions({
3557
- actions: baseActionsList$2,
3538
+ actions: baseActionsList$5,
3558
3539
  diff: diff,
3559
3540
  oldObj: oldObj,
3560
3541
  newObj: newObj,
@@ -3568,7 +3549,7 @@ function createProductSelectionsMapActions(mapActionGroup) {
3568
3549
  return function doMapActions(diff, next, previous) {
3569
3550
  var allActions = [];
3570
3551
  allActions.push(mapActionGroup('base', function () {
3571
- return actionsMapBase$2(diff, previous, next);
3552
+ return actionsMapBase$5(diff, previous, next);
3572
3553
  }));
3573
3554
  allActions.push(mapActionGroup('custom', function () {
3574
3555
  return actionsMapCustom(diff, next, previous);
@@ -3586,7 +3567,7 @@ var productSelections = (function (actionGroupList) {
3586
3567
  };
3587
3568
  });
3588
3569
 
3589
- var baseActionsList$1 = [{
3570
+ var baseActionsList$4 = [{
3590
3571
  action: 'changeValue',
3591
3572
  key: 'value'
3592
3573
  }, {
@@ -3610,10 +3591,10 @@ var baseActionsList$1 = [{
3610
3591
  action: 'changeActive',
3611
3592
  key: 'active'
3612
3593
  }];
3613
- function actionsMapBase$1(diff, oldObj, newObj) {
3594
+ function actionsMapBase$4(diff, oldObj, newObj) {
3614
3595
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
3615
3596
  return buildBaseAttributesActions({
3616
- actions: baseActionsList$1,
3597
+ actions: baseActionsList$4,
3617
3598
  diff: diff,
3618
3599
  oldObj: oldObj,
3619
3600
  newObj: newObj,
@@ -3626,7 +3607,7 @@ function actionsMapBase$1(diff, oldObj, newObj) {
3626
3607
  function createPriceMapActions(mapActionGroup, syncActionConfig) {
3627
3608
  return function doMapActions(diff, newObj, oldObj) {
3628
3609
  var baseActions = mapActionGroup('base', function () {
3629
- return actionsMapBase$1(diff, oldObj, newObj, syncActionConfig);
3610
+ return actionsMapBase$4(diff, oldObj, newObj, syncActionConfig);
3630
3611
  });
3631
3612
  var customActions = mapActionGroup('custom', function () {
3632
3613
  return actionsMapCustom(diff, newObj, oldObj);
@@ -3648,7 +3629,7 @@ var hasAttribute = function hasAttribute(attributes, newValue) {
3648
3629
  return attribute.key === newValue.key;
3649
3630
  });
3650
3631
  };
3651
- var baseActionsList = [{
3632
+ var baseActionsList$3 = [{
3652
3633
  action: 'changeName',
3653
3634
  key: 'name'
3654
3635
  }, {
@@ -3658,10 +3639,10 @@ var baseActionsList = [{
3658
3639
  action: 'setDescription',
3659
3640
  key: 'description'
3660
3641
  }];
3661
- function actionsMapBase(diff, oldObj, newObj) {
3642
+ function actionsMapBase$3(diff, oldObj, newObj) {
3662
3643
  var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
3663
3644
  return buildBaseAttributesActions({
3664
- actions: baseActionsList,
3645
+ actions: baseActionsList$3,
3665
3646
  diff: diff,
3666
3647
  oldObj: oldObj,
3667
3648
  newObj: newObj,
@@ -3706,7 +3687,7 @@ function createAttributeGroupsMapActions(mapActionGroup, syncActionConfig) {
3706
3687
  return function doMapActions(diff, newObj, oldObj) {
3707
3688
  var allActions = [];
3708
3689
  allActions.push(mapActionGroup('base', function () {
3709
- return actionsMapBase(diff, oldObj, newObj, syncActionConfig);
3690
+ return actionsMapBase$3(diff, oldObj, newObj, syncActionConfig);
3710
3691
  }));
3711
3692
  allActions.push(flatten__default["default"](mapActionGroup('attributes', function () {
3712
3693
  return actionsMapAttributes(diff, oldObj, newObj);
@@ -3723,7 +3704,187 @@ var attributeGroups = (function (actionGroupList, syncActionConfig) {
3723
3704
  };
3724
3705
  });
3725
3706
 
3707
+ var baseActionsList$2 = [{
3708
+ action: 'setKey',
3709
+ key: 'key'
3710
+ }, {
3711
+ action: 'changeTriggers',
3712
+ key: 'triggers'
3713
+ }, {
3714
+ action: 'setTimeoutInMs',
3715
+ key: 'timeoutInMs'
3716
+ }, {
3717
+ action: 'changeDestination',
3718
+ key: 'destination'
3719
+ }];
3720
+ var actionsMapBase$2 = function actionsMapBase(diff, oldObj, newObj, config) {
3721
+ return buildBaseAttributesActions({
3722
+ actions: baseActionsList$2,
3723
+ diff: diff,
3724
+ oldObj: oldObj,
3725
+ newObj: newObj,
3726
+ shouldOmitEmptyString: config === null || config === void 0 ? void 0 : config.shouldOmitEmptyString
3727
+ });
3728
+ };
3729
+
3730
+ var createApiExtensionsMapActions = function createApiExtensionsMapActions(mapActionGroup, syncActionConfig) {
3731
+ return function doMapActions(diff, newObj, oldObj) {
3732
+ var allActions = [];
3733
+ allActions.push(mapActionGroup('base', function () {
3734
+ return actionsMapBase$2(diff, oldObj, newObj, syncActionConfig);
3735
+ }));
3736
+ return flatten__default["default"](allActions);
3737
+ };
3738
+ };
3739
+ var apiExtensions = (function (actionGroupList, syncActionConfig) {
3740
+ var mapActionGroup = createMapActionGroup(actionGroupList);
3741
+ var doMapActions = createApiExtensionsMapActions(mapActionGroup, syncActionConfig);
3742
+ var buildActions = createBuildActions(diff, doMapActions);
3743
+ return {
3744
+ buildActions: buildActions
3745
+ };
3746
+ });
3747
+
3748
+ var baseActionsList$1 = [{
3749
+ action: 'setStores',
3750
+ key: 'stores'
3751
+ }, {
3752
+ action: 'changeAssociateMode',
3753
+ key: 'associateMode'
3754
+ }, {
3755
+ action: 'changeApprovalRuleMode',
3756
+ key: 'approvalRuleMode'
3757
+ }, {
3758
+ action: 'changeName',
3759
+ key: 'name'
3760
+ }, {
3761
+ action: 'changeParentUnit',
3762
+ key: 'parentUnit'
3763
+ }, {
3764
+ action: 'changeStatus',
3765
+ key: 'status'
3766
+ }, {
3767
+ action: 'setContactEmail',
3768
+ key: 'contactEmail'
3769
+ }, {
3770
+ action: 'setStoreMode',
3771
+ key: 'storeMode'
3772
+ }];
3773
+ var actionsMapAssociates = function actionsMapAssociates(diff, oldObj, newObj) {
3774
+ var handler = createBuildArrayActions('associates', _defineProperty(_defineProperty(_defineProperty({}, ADD_ACTIONS, function (newObject) {
3775
+ return {
3776
+ action: 'addAssociate',
3777
+ associate: newObject
3778
+ };
3779
+ }), REMOVE_ACTIONS, function (objectToRemove) {
3780
+ return {
3781
+ action: 'removeAssociate',
3782
+ customer: {
3783
+ typeId: 'customer',
3784
+ id: objectToRemove.customer.id
3785
+ }
3786
+ };
3787
+ }), CHANGE_ACTIONS, function (oldObject, updatedObject) {
3788
+ return {
3789
+ action: 'changeAssociate',
3790
+ associate: updatedObject
3791
+ };
3792
+ }));
3793
+ return handler(diff, oldObj, newObj);
3794
+ };
3795
+ var actionsMapBase$1 = function actionsMapBase(diff, oldObj, newObj, config) {
3796
+ return buildBaseAttributesActions({
3797
+ actions: baseActionsList$1,
3798
+ diff: diff,
3799
+ oldObj: oldObj,
3800
+ newObj: newObj,
3801
+ shouldOmitEmptyString: config === null || config === void 0 ? void 0 : config.shouldOmitEmptyString
3802
+ });
3803
+ };
3804
+
3805
+ var createCustomerMapActions = function createCustomerMapActions(mapActionGroup, syncActionConfig) {
3806
+ return function doMapActions(diff, newObj, oldObj) {
3807
+ var allActions = [];
3808
+ allActions.push(mapActionGroup('base', function () {
3809
+ return actionsMapBase$1(diff, oldObj, newObj, syncActionConfig);
3810
+ }));
3811
+ allActions.push(mapActionGroup('addresses', function () {
3812
+ return actionsMapAddresses(diff, oldObj, newObj);
3813
+ }));
3814
+ allActions.push(mapActionGroup('base', function () {
3815
+ return actionsMapSetDefaultBase(diff, oldObj, newObj, syncActionConfig);
3816
+ }));
3817
+ allActions.push(mapActionGroup('billingAddressIds', function () {
3818
+ return actionsMapBillingAddresses(diff, oldObj, newObj);
3819
+ }));
3820
+ allActions.push(mapActionGroup('shippingAddressIds', function () {
3821
+ return actionsMapShippingAddresses(diff, oldObj, newObj);
3822
+ }));
3823
+ allActions.push(mapActionGroup('associates', function () {
3824
+ return actionsMapAssociates(diff, oldObj, newObj);
3825
+ }));
3826
+ allActions.push(mapActionGroup('custom', function () {
3827
+ return actionsMapCustom(diff, newObj, oldObj);
3828
+ }));
3829
+ return flatten__default["default"](allActions);
3830
+ };
3831
+ };
3832
+ var businessUnits = (function (actionGroupList, syncActionConfig) {
3833
+ var mapActionGroup = createMapActionGroup(actionGroupList);
3834
+ var doMapActions = createCustomerMapActions(mapActionGroup, syncActionConfig);
3835
+ var buildActions = createBuildActions(diff, doMapActions);
3836
+ return {
3837
+ buildActions: buildActions
3838
+ };
3839
+ });
3840
+
3841
+ var baseActionsList = [{
3842
+ action: 'setKey',
3843
+ key: 'key'
3844
+ }, {
3845
+ action: 'setMessages',
3846
+ key: 'messages'
3847
+ }, {
3848
+ action: 'setChanges',
3849
+ key: 'changes'
3850
+ }, {
3851
+ action: 'changeDestination',
3852
+ key: 'destination'
3853
+ }];
3854
+ var actionsMapBase = function actionsMapBase(diff, oldObj, newObj, config) {
3855
+ return buildBaseAttributesActions({
3856
+ actions: baseActionsList,
3857
+ diff: diff,
3858
+ oldObj: oldObj,
3859
+ newObj: newObj,
3860
+ shouldOmitEmptyString: config === null || config === void 0 ? void 0 : config.shouldOmitEmptyString
3861
+ });
3862
+ };
3863
+
3864
+ var createSubscriptionsMapActions = function createSubscriptionsMapActions(mapActionGroup, syncActionConfig) {
3865
+ return function doMapActions(diff, newObj, oldObj) {
3866
+ var allActions = [];
3867
+ allActions.push(mapActionGroup('base', function () {
3868
+ return actionsMapBase(diff, oldObj, newObj, syncActionConfig);
3869
+ }));
3870
+ allActions.push(mapActionGroup('custom', function () {
3871
+ return actionsMapCustom(diff, newObj, oldObj);
3872
+ }));
3873
+ return allActions.flat();
3874
+ };
3875
+ };
3876
+ var subscriptions = (function (actionGroupList, syncActionConfig) {
3877
+ var mapActionGroup = createMapActionGroup(actionGroupList);
3878
+ var doMapActions = createSubscriptionsMapActions(mapActionGroup, syncActionConfig);
3879
+ var buildActions = createBuildActions(diff, doMapActions);
3880
+ return {
3881
+ buildActions: buildActions
3882
+ };
3883
+ });
3884
+
3885
+ exports.createSyncApiExtensions = apiExtensions;
3726
3886
  exports.createSyncAttributeGroups = attributeGroups;
3887
+ exports.createSyncBusinessUnits = businessUnits;
3727
3888
  exports.createSyncCartDiscounts = cartDiscounts;
3728
3889
  exports.createSyncCategories = categories;
3729
3890
  exports.createSyncChannels = channels;
@@ -3742,6 +3903,7 @@ exports.createSyncShippingMethods = shippingMethods;
3742
3903
  exports.createSyncStandalonePrices = prices;
3743
3904
  exports.createSyncStates = states;
3744
3905
  exports.createSyncStores = stores;
3906
+ exports.createSyncSubscriptions = subscriptions;
3745
3907
  exports.createSyncTaxCategories = taxCategories;
3746
3908
  exports.createSyncTypes = types;
3747
3909
  exports.createSyncZones = zones;