@commercetools/sync-actions 6.0.0 → 6.1.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.
@@ -2950,6 +2950,11 @@ var createIsEmptyValue = function createIsEmptyValue(emptyValues) {
2950
2950
  };
2951
2951
  };
2952
2952
 
2953
+ /* actions that start with 'set' can generate undefined valued */
2954
+ var isOptionalField = function isOptionalField(action) {
2955
+ return action.startsWith('set');
2956
+ };
2957
+
2953
2958
  /**
2954
2959
  * Builds actions for simple object properties, given a list of actions
2955
2960
  * E.g. [{ action: `changeName`, key: 'name' }]
@@ -2960,13 +2965,17 @@ var createIsEmptyValue = function createIsEmptyValue(emptyValues) {
2960
2965
  * @param {Object} options.oldObj - the object that needs to be updated
2961
2966
  * @param {Object} options.newObj - the new representation of the object
2962
2967
  * @param {Boolean} options.shouldOmitEmptyString - a flag to determine if we should treat an empty string a NON-value
2968
+ * @param {Boolean} options.shouldUnsetOmittedProperties - a flag to determine if we should unset fields which are omitted in the newObj
2969
+ * @param {Boolean} options.shouldPreventUnsettingRequiredFields - a flag to determine if required fields should be unset
2963
2970
  */
2964
2971
  function buildBaseAttributesActions(_ref) {
2965
2972
  var actions = _ref.actions,
2966
2973
  diff = _ref.diff,
2967
2974
  oldObj = _ref.oldObj,
2968
2975
  newObj = _ref.newObj,
2969
- shouldOmitEmptyString = _ref.shouldOmitEmptyString;
2976
+ shouldOmitEmptyString = _ref.shouldOmitEmptyString,
2977
+ shouldUnsetOmittedProperties = _ref.shouldUnsetOmittedProperties,
2978
+ shouldPreventUnsettingRequiredFields = _ref.shouldPreventUnsettingRequiredFields;
2970
2979
  var isEmptyValue = createIsEmptyValue(shouldOmitEmptyString ? [undefined, null, ''] : [undefined, null]);
2971
2980
  return actions.map(function (item) {
2972
2981
  var key = item.key; // e.g.: name, description, ...
@@ -2976,7 +2985,9 @@ function buildBaseAttributesActions(_ref) {
2976
2985
  var now = newObj[key];
2977
2986
  var isNotDefinedBefore = isEmptyValue(oldObj[key]);
2978
2987
  var isNotDefinedNow = isEmptyValue(newObj[key]);
2988
+ var isOmitted = !Object.keys(newObj).includes(key);
2979
2989
  if (!delta) return undefined;
2990
+ if (isNotDefinedNow && !isOptionalField(item.action) && shouldPreventUnsettingRequiredFields) return undefined;
2980
2991
  if (isNotDefinedNow && isNotDefinedBefore) return undefined;
2981
2992
  if (!isNotDefinedNow && isNotDefinedBefore)
2982
2993
  // no value previously set
@@ -2985,8 +2996,8 @@ function buildBaseAttributesActions(_ref) {
2985
2996
  }, actionKey, now);
2986
2997
 
2987
2998
  /* no new value */
2988
- if (isNotDefinedNow && !{}.hasOwnProperty.call(newObj, key)) return undefined;
2989
- if (isNotDefinedNow && {}.hasOwnProperty.call(newObj, key))
2999
+ if (isNotDefinedNow && isOmitted && !shouldUnsetOmittedProperties) return undefined;
3000
+ if (isNotDefinedNow)
2990
3001
  // value unset
2991
3002
  return {
2992
3003
  action: item.action
@@ -3096,7 +3107,9 @@ function actionsMapBase$k(diff, oldObj, newObj) {
3096
3107
  diff: diff,
3097
3108
  oldObj: oldObj,
3098
3109
  newObj: newObj,
3099
- shouldOmitEmptyString: config.shouldOmitEmptyString
3110
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
3111
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties,
3112
+ shouldPreventUnsettingRequiredFields: config.shouldPreventUnsettingRequiredFields
3100
3113
  });
3101
3114
  }
3102
3115
  function actionsMapReferences$3(diff, oldObj, newObj) {
@@ -3298,7 +3311,9 @@ function actionsMapBase$j(diff, oldObj, newObj) {
3298
3311
  diff: diff,
3299
3312
  oldObj: oldObj,
3300
3313
  newObj: newObj,
3301
- shouldOmitEmptyString: config.shouldOmitEmptyString
3314
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
3315
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties,
3316
+ shouldPreventUnsettingRequiredFields: config.shouldPreventUnsettingRequiredFields
3302
3317
  });
3303
3318
  }
3304
3319
  function actionsMapSetDefaultBase(diff, oldObj, newObj) {
@@ -3308,7 +3323,9 @@ function actionsMapSetDefaultBase(diff, oldObj, newObj) {
3308
3323
  diff: diff,
3309
3324
  oldObj: oldObj,
3310
3325
  newObj: newObj,
3311
- shouldOmitEmptyString: config.shouldOmitEmptyString
3326
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
3327
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties,
3328
+ shouldPreventUnsettingRequiredFields: config.shouldPreventUnsettingRequiredFields
3312
3329
  });
3313
3330
  }
3314
3331
  function actionsMapReferences$2(diff, oldObj, newObj) {
@@ -3504,7 +3521,9 @@ function actionsMapBase$i(diff, oldObj, newObj) {
3504
3521
  diff: diff,
3505
3522
  oldObj: oldObj,
3506
3523
  newObj: newObj,
3507
- shouldOmitEmptyString: config.shouldOmitEmptyString
3524
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
3525
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties,
3526
+ shouldPreventUnsettingRequiredFields: config.shouldPreventUnsettingRequiredFields
3508
3527
  });
3509
3528
  }
3510
3529
  function actionsMapReferences$1(diff, oldObj, newObj) {
@@ -4021,15 +4040,19 @@ function actionsMapBase$h(diff, oldObj, newObj) {
4021
4040
  diff: diff,
4022
4041
  oldObj: oldObj,
4023
4042
  newObj: newObj,
4024
- shouldOmitEmptyString: config.shouldOmitEmptyString
4043
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
4044
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties
4025
4045
  });
4026
4046
  }
4027
4047
  function actionsMapMeta(diff, oldObj, newObj) {
4048
+ var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
4028
4049
  return buildBaseAttributesActions({
4029
4050
  actions: metaActionsList,
4030
4051
  diff: diff,
4031
4052
  oldObj: oldObj,
4032
- newObj: newObj
4053
+ newObj: newObj,
4054
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
4055
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties
4033
4056
  });
4034
4057
  }
4035
4058
  function actionsMapAddVariants(diff, oldObj, newObj) {
@@ -4339,7 +4362,9 @@ function actionsMapBase$g(diff, oldObj, newObj) {
4339
4362
  diff: diff,
4340
4363
  oldObj: oldObj,
4341
4364
  newObj: newObj,
4342
- shouldOmitEmptyString: config.shouldOmitEmptyString
4365
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
4366
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties,
4367
+ shouldPreventUnsettingRequiredFields: config.shouldPreventUnsettingRequiredFields
4343
4368
  });
4344
4369
  }
4345
4370
  function actionsMapDeliveries(diff, oldObj, newObj) {
@@ -4558,7 +4583,9 @@ function actionsMapBase$f(diff, oldObj, newObj) {
4558
4583
  diff: diff,
4559
4584
  oldObj: oldObj,
4560
4585
  newObj: newObj,
4561
- shouldOmitEmptyString: config.shouldOmitEmptyString
4586
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
4587
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties,
4588
+ shouldPreventUnsettingRequiredFields: config.shouldPreventUnsettingRequiredFields
4562
4589
  });
4563
4590
  }
4564
4591
 
@@ -4646,7 +4673,9 @@ function actionsMapBase$e(diff, oldObj, newObj) {
4646
4673
  diff: diff,
4647
4674
  oldObj: oldObj,
4648
4675
  newObj: newObj,
4649
- shouldOmitEmptyString: config.shouldOmitEmptyString
4676
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
4677
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties,
4678
+ shouldPreventUnsettingRequiredFields: config.shouldPreventUnsettingRequiredFields
4650
4679
  });
4651
4680
  }
4652
4681
 
@@ -4697,7 +4726,9 @@ function actionsMapBase$d(diff, oldObj, newObj) {
4697
4726
  diff: diff,
4698
4727
  oldObj: oldObj,
4699
4728
  newObj: newObj,
4700
- shouldOmitEmptyString: config.shouldOmitEmptyString
4729
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
4730
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties,
4731
+ shouldPreventUnsettingRequiredFields: config.shouldPreventUnsettingRequiredFields
4701
4732
  });
4702
4733
  }
4703
4734
 
@@ -4767,7 +4798,9 @@ function actionsMapBase$c(diff, oldObj, newObj) {
4767
4798
  diff: diff,
4768
4799
  oldObj: oldObj,
4769
4800
  newObj: newObj,
4770
- shouldOmitEmptyString: config.shouldOmitEmptyString
4801
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
4802
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties,
4803
+ shouldPreventUnsettingRequiredFields: config.shouldPreventUnsettingRequiredFields
4771
4804
  });
4772
4805
  }
4773
4806
 
@@ -5115,7 +5148,9 @@ function actionsMapBase$b(diff, oldObj, newObj) {
5115
5148
  diff: diff,
5116
5149
  oldObj: oldObj,
5117
5150
  newObj: newObj,
5118
- shouldOmitEmptyString: config.shouldOmitEmptyString
5151
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
5152
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties,
5153
+ shouldPreventUnsettingRequiredFields: config.shouldPreventUnsettingRequiredFields
5119
5154
  });
5120
5155
  }
5121
5156
  function actionsMapRates(diff, oldObj, newObj) {
@@ -5203,7 +5238,9 @@ function actionsMapBase$a(diff, oldObj, newObj) {
5203
5238
  diff: diff,
5204
5239
  oldObj: oldObj,
5205
5240
  newObj: newObj,
5206
- shouldOmitEmptyString: config.shouldOmitEmptyString
5241
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
5242
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties,
5243
+ shouldPreventUnsettingRequiredFields: config.shouldPreventUnsettingRequiredFields
5207
5244
  });
5208
5245
  }
5209
5246
  function actionsMapLocations(diff, oldObj, newObj) {
@@ -5308,7 +5345,9 @@ function actionsMapBase$9(diff, oldObj, newObj) {
5308
5345
  diff: diff,
5309
5346
  oldObj: oldObj,
5310
5347
  newObj: newObj,
5311
- shouldOmitEmptyString: config.shouldOmitEmptyString
5348
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
5349
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties,
5350
+ shouldPreventUnsettingRequiredFields: config.shouldPreventUnsettingRequiredFields
5312
5351
  });
5313
5352
  }
5314
5353
  var addShippingRates = function addShippingRates(newZoneRate) {
@@ -5431,7 +5470,8 @@ function actionsMapBase$8(diff, previous, next) {
5431
5470
  actions: baseActionsList$8,
5432
5471
  oldObj: previous,
5433
5472
  newObj: next,
5434
- shouldOmitEmptyString: config.shouldOmitEmptyString
5473
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
5474
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties
5435
5475
  });
5436
5476
  }
5437
5477
 
@@ -5688,7 +5728,9 @@ function actionsMapBase$7(diff, oldObj, newObj) {
5688
5728
  diff: diff,
5689
5729
  oldObj: oldObj,
5690
5730
  newObj: newObj,
5691
- shouldOmitEmptyString: config.shouldOmitEmptyString
5731
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
5732
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties,
5733
+ shouldPreventUnsettingRequiredFields: config.shouldPreventUnsettingRequiredFields
5692
5734
  });
5693
5735
  }
5694
5736
  function actionsMapRoles(diff, oldObj, newObj) {
@@ -5774,7 +5816,9 @@ function actionsMapBase$6(diff, oldObj, newObj) {
5774
5816
  diff: diff,
5775
5817
  oldObj: oldObj,
5776
5818
  newObj: newObj,
5777
- shouldOmitEmptyString: config.shouldOmitEmptyString
5819
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
5820
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties,
5821
+ shouldPreventUnsettingRequiredFields: config.shouldPreventUnsettingRequiredFields
5778
5822
  });
5779
5823
  }
5780
5824
 
@@ -5825,7 +5869,9 @@ function actionsMapBase$5(diff, oldObj, newObj) {
5825
5869
  diff: diff,
5826
5870
  oldObj: oldObj,
5827
5871
  newObj: newObj,
5828
- shouldOmitEmptyString: config.shouldOmitEmptyString
5872
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
5873
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties,
5874
+ shouldPreventUnsettingRequiredFields: config.shouldPreventUnsettingRequiredFields
5829
5875
  });
5830
5876
  }
5831
5877
  function actionsMapEnums(fieldName, attributeType, attributeDiff, previous, next) {
@@ -6020,6 +6066,7 @@ function actionsMapBase$4(diff, oldObj, newObj) {
6020
6066
  });
6021
6067
  }
6022
6068
  var actionsMapBusinessUnit = function actionsMapBusinessUnit(diff, oldObj, newObj) {
6069
+ var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
6023
6070
  var businessUnits = diff.businessUnits;
6024
6071
  if (!businessUnits) {
6025
6072
  return [];
@@ -6028,10 +6075,13 @@ var actionsMapBusinessUnit = function actionsMapBusinessUnit(diff, oldObj, newOb
6028
6075
  actions: myBusinessUnitActionsList,
6029
6076
  diff: businessUnits,
6030
6077
  oldObj: oldObj.businessUnits,
6031
- newObj: newObj.businessUnits
6078
+ newObj: newObj.businessUnits,
6079
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
6080
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties
6032
6081
  });
6033
6082
  };
6034
6083
  function actionsMapSearchIndexingConfiguration(diff, oldObj, newObj) {
6084
+ var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
6035
6085
  var searchIndexing = diff.searchIndexing;
6036
6086
  if (!searchIndexing) {
6037
6087
  return [];
@@ -6044,7 +6094,10 @@ function actionsMapSearchIndexingConfiguration(diff, oldObj, newObj) {
6044
6094
  actions: customerSearchActionsList,
6045
6095
  diff: diff.searchIndexing.customers,
6046
6096
  oldObj: oldObj.searchIndexing.customers,
6047
- newObj: newObj.searchIndexing.customers
6097
+ newObj: newObj.searchIndexing.customers,
6098
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
6099
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties,
6100
+ shouldPreventUnsettingRequiredFields: config.shouldPreventUnsettingRequiredFields
6048
6101
  });
6049
6102
  }
6050
6103
 
@@ -6087,11 +6140,15 @@ var baseActionsList$3 = [{
6087
6140
  key: 'supplyChannels'
6088
6141
  }];
6089
6142
  function actionsMapBase$3(diff, oldObj, newObj) {
6143
+ var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
6090
6144
  return buildBaseAttributesActions({
6091
6145
  actions: baseActionsList$3,
6092
6146
  diff: diff,
6093
6147
  oldObj: oldObj,
6094
- newObj: newObj
6148
+ newObj: newObj,
6149
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
6150
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties,
6151
+ shouldPreventUnsettingRequiredFields: config.shouldPreventUnsettingRequiredFields
6095
6152
  });
6096
6153
  }
6097
6154
 
@@ -6108,10 +6165,11 @@ function createStoresMapActions(mapActionGroup) {
6108
6165
  };
6109
6166
  }
6110
6167
  var stores = (function (actionGroupList) {
6168
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
6111
6169
  var mapActionGroup = createMapActionGroup(actionGroupList);
6112
6170
  var doMapActions = createStoresMapActions(mapActionGroup);
6113
6171
  var onBeforeApplyingDiff = null;
6114
- var buildActions = createBuildActions(diff, doMapActions, onBeforeApplyingDiff);
6172
+ var buildActions = createBuildActions(diff, doMapActions, onBeforeApplyingDiff, options);
6115
6173
  return {
6116
6174
  buildActions: buildActions
6117
6175
  };
@@ -6125,11 +6183,15 @@ var baseActionsList$2 = [{
6125
6183
  key: 'key'
6126
6184
  }];
6127
6185
  function actionsMapBase$2(diff, oldObj, newObj) {
6186
+ var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
6128
6187
  return buildBaseAttributesActions({
6129
6188
  actions: baseActionsList$2,
6130
6189
  diff: diff,
6131
6190
  oldObj: oldObj,
6132
- newObj: newObj
6191
+ newObj: newObj,
6192
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
6193
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties,
6194
+ shouldPreventUnsettingRequiredFields: config.shouldPreventUnsettingRequiredFields
6133
6195
  });
6134
6196
  }
6135
6197
 
@@ -6186,7 +6248,9 @@ function actionsMapBase$1(diff, oldObj, newObj) {
6186
6248
  diff: diff,
6187
6249
  oldObj: oldObj,
6188
6250
  newObj: newObj,
6189
- shouldOmitEmptyString: config.shouldOmitEmptyString
6251
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
6252
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties,
6253
+ shouldPreventUnsettingRequiredFields: config.shouldPreventUnsettingRequiredFields
6190
6254
  });
6191
6255
  }
6192
6256
 
@@ -6232,7 +6296,9 @@ function actionsMapBase(diff, oldObj, newObj) {
6232
6296
  diff: diff,
6233
6297
  oldObj: oldObj,
6234
6298
  newObj: newObj,
6235
- shouldOmitEmptyString: config.shouldOmitEmptyString
6299
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
6300
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties,
6301
+ shouldPreventUnsettingRequiredFields: config.shouldPreventUnsettingRequiredFields
6236
6302
  });
6237
6303
  }
6238
6304
  function actionsMapAttributes(diff, oldObj, newObj) {
@@ -2958,6 +2958,11 @@
2958
2958
  };
2959
2959
  };
2960
2960
 
2961
+ /* actions that start with 'set' can generate undefined valued */
2962
+ var isOptionalField = function isOptionalField(action) {
2963
+ return action.startsWith('set');
2964
+ };
2965
+
2961
2966
  /**
2962
2967
  * Builds actions for simple object properties, given a list of actions
2963
2968
  * E.g. [{ action: `changeName`, key: 'name' }]
@@ -2968,13 +2973,17 @@
2968
2973
  * @param {Object} options.oldObj - the object that needs to be updated
2969
2974
  * @param {Object} options.newObj - the new representation of the object
2970
2975
  * @param {Boolean} options.shouldOmitEmptyString - a flag to determine if we should treat an empty string a NON-value
2976
+ * @param {Boolean} options.shouldUnsetOmittedProperties - a flag to determine if we should unset fields which are omitted in the newObj
2977
+ * @param {Boolean} options.shouldPreventUnsettingRequiredFields - a flag to determine if required fields should be unset
2971
2978
  */
2972
2979
  function buildBaseAttributesActions(_ref) {
2973
2980
  var actions = _ref.actions,
2974
2981
  diff = _ref.diff,
2975
2982
  oldObj = _ref.oldObj,
2976
2983
  newObj = _ref.newObj,
2977
- shouldOmitEmptyString = _ref.shouldOmitEmptyString;
2984
+ shouldOmitEmptyString = _ref.shouldOmitEmptyString,
2985
+ shouldUnsetOmittedProperties = _ref.shouldUnsetOmittedProperties,
2986
+ shouldPreventUnsettingRequiredFields = _ref.shouldPreventUnsettingRequiredFields;
2978
2987
  var isEmptyValue = createIsEmptyValue(shouldOmitEmptyString ? [undefined, null, ''] : [undefined, null]);
2979
2988
  return actions.map(function (item) {
2980
2989
  var key = item.key; // e.g.: name, description, ...
@@ -2984,7 +2993,9 @@
2984
2993
  var now = newObj[key];
2985
2994
  var isNotDefinedBefore = isEmptyValue(oldObj[key]);
2986
2995
  var isNotDefinedNow = isEmptyValue(newObj[key]);
2996
+ var isOmitted = !Object.keys(newObj).includes(key);
2987
2997
  if (!delta) return undefined;
2998
+ if (isNotDefinedNow && !isOptionalField(item.action) && shouldPreventUnsettingRequiredFields) return undefined;
2988
2999
  if (isNotDefinedNow && isNotDefinedBefore) return undefined;
2989
3000
  if (!isNotDefinedNow && isNotDefinedBefore)
2990
3001
  // no value previously set
@@ -2993,8 +3004,8 @@
2993
3004
  }, actionKey, now);
2994
3005
 
2995
3006
  /* no new value */
2996
- if (isNotDefinedNow && !{}.hasOwnProperty.call(newObj, key)) return undefined;
2997
- if (isNotDefinedNow && {}.hasOwnProperty.call(newObj, key))
3007
+ if (isNotDefinedNow && isOmitted && !shouldUnsetOmittedProperties) return undefined;
3008
+ if (isNotDefinedNow)
2998
3009
  // value unset
2999
3010
  return {
3000
3011
  action: item.action
@@ -3104,7 +3115,9 @@
3104
3115
  diff: diff,
3105
3116
  oldObj: oldObj,
3106
3117
  newObj: newObj,
3107
- shouldOmitEmptyString: config.shouldOmitEmptyString
3118
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
3119
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties,
3120
+ shouldPreventUnsettingRequiredFields: config.shouldPreventUnsettingRequiredFields
3108
3121
  });
3109
3122
  }
3110
3123
  function actionsMapReferences$3(diff, oldObj, newObj) {
@@ -3306,7 +3319,9 @@
3306
3319
  diff: diff,
3307
3320
  oldObj: oldObj,
3308
3321
  newObj: newObj,
3309
- shouldOmitEmptyString: config.shouldOmitEmptyString
3322
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
3323
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties,
3324
+ shouldPreventUnsettingRequiredFields: config.shouldPreventUnsettingRequiredFields
3310
3325
  });
3311
3326
  }
3312
3327
  function actionsMapSetDefaultBase(diff, oldObj, newObj) {
@@ -3316,7 +3331,9 @@
3316
3331
  diff: diff,
3317
3332
  oldObj: oldObj,
3318
3333
  newObj: newObj,
3319
- shouldOmitEmptyString: config.shouldOmitEmptyString
3334
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
3335
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties,
3336
+ shouldPreventUnsettingRequiredFields: config.shouldPreventUnsettingRequiredFields
3320
3337
  });
3321
3338
  }
3322
3339
  function actionsMapReferences$2(diff, oldObj, newObj) {
@@ -3512,7 +3529,9 @@
3512
3529
  diff: diff,
3513
3530
  oldObj: oldObj,
3514
3531
  newObj: newObj,
3515
- shouldOmitEmptyString: config.shouldOmitEmptyString
3532
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
3533
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties,
3534
+ shouldPreventUnsettingRequiredFields: config.shouldPreventUnsettingRequiredFields
3516
3535
  });
3517
3536
  }
3518
3537
  function actionsMapReferences$1(diff, oldObj, newObj) {
@@ -4029,15 +4048,19 @@
4029
4048
  diff: diff,
4030
4049
  oldObj: oldObj,
4031
4050
  newObj: newObj,
4032
- shouldOmitEmptyString: config.shouldOmitEmptyString
4051
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
4052
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties
4033
4053
  });
4034
4054
  }
4035
4055
  function actionsMapMeta(diff, oldObj, newObj) {
4056
+ var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
4036
4057
  return buildBaseAttributesActions({
4037
4058
  actions: metaActionsList,
4038
4059
  diff: diff,
4039
4060
  oldObj: oldObj,
4040
- newObj: newObj
4061
+ newObj: newObj,
4062
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
4063
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties
4041
4064
  });
4042
4065
  }
4043
4066
  function actionsMapAddVariants(diff, oldObj, newObj) {
@@ -4347,7 +4370,9 @@
4347
4370
  diff: diff,
4348
4371
  oldObj: oldObj,
4349
4372
  newObj: newObj,
4350
- shouldOmitEmptyString: config.shouldOmitEmptyString
4373
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
4374
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties,
4375
+ shouldPreventUnsettingRequiredFields: config.shouldPreventUnsettingRequiredFields
4351
4376
  });
4352
4377
  }
4353
4378
  function actionsMapDeliveries(diff, oldObj, newObj) {
@@ -4566,7 +4591,9 @@
4566
4591
  diff: diff,
4567
4592
  oldObj: oldObj,
4568
4593
  newObj: newObj,
4569
- shouldOmitEmptyString: config.shouldOmitEmptyString
4594
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
4595
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties,
4596
+ shouldPreventUnsettingRequiredFields: config.shouldPreventUnsettingRequiredFields
4570
4597
  });
4571
4598
  }
4572
4599
 
@@ -4654,7 +4681,9 @@
4654
4681
  diff: diff,
4655
4682
  oldObj: oldObj,
4656
4683
  newObj: newObj,
4657
- shouldOmitEmptyString: config.shouldOmitEmptyString
4684
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
4685
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties,
4686
+ shouldPreventUnsettingRequiredFields: config.shouldPreventUnsettingRequiredFields
4658
4687
  });
4659
4688
  }
4660
4689
 
@@ -4705,7 +4734,9 @@
4705
4734
  diff: diff,
4706
4735
  oldObj: oldObj,
4707
4736
  newObj: newObj,
4708
- shouldOmitEmptyString: config.shouldOmitEmptyString
4737
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
4738
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties,
4739
+ shouldPreventUnsettingRequiredFields: config.shouldPreventUnsettingRequiredFields
4709
4740
  });
4710
4741
  }
4711
4742
 
@@ -4775,7 +4806,9 @@
4775
4806
  diff: diff,
4776
4807
  oldObj: oldObj,
4777
4808
  newObj: newObj,
4778
- shouldOmitEmptyString: config.shouldOmitEmptyString
4809
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
4810
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties,
4811
+ shouldPreventUnsettingRequiredFields: config.shouldPreventUnsettingRequiredFields
4779
4812
  });
4780
4813
  }
4781
4814
 
@@ -5123,7 +5156,9 @@
5123
5156
  diff: diff,
5124
5157
  oldObj: oldObj,
5125
5158
  newObj: newObj,
5126
- shouldOmitEmptyString: config.shouldOmitEmptyString
5159
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
5160
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties,
5161
+ shouldPreventUnsettingRequiredFields: config.shouldPreventUnsettingRequiredFields
5127
5162
  });
5128
5163
  }
5129
5164
  function actionsMapRates(diff, oldObj, newObj) {
@@ -5211,7 +5246,9 @@
5211
5246
  diff: diff,
5212
5247
  oldObj: oldObj,
5213
5248
  newObj: newObj,
5214
- shouldOmitEmptyString: config.shouldOmitEmptyString
5249
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
5250
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties,
5251
+ shouldPreventUnsettingRequiredFields: config.shouldPreventUnsettingRequiredFields
5215
5252
  });
5216
5253
  }
5217
5254
  function actionsMapLocations(diff, oldObj, newObj) {
@@ -5316,7 +5353,9 @@
5316
5353
  diff: diff,
5317
5354
  oldObj: oldObj,
5318
5355
  newObj: newObj,
5319
- shouldOmitEmptyString: config.shouldOmitEmptyString
5356
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
5357
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties,
5358
+ shouldPreventUnsettingRequiredFields: config.shouldPreventUnsettingRequiredFields
5320
5359
  });
5321
5360
  }
5322
5361
  var addShippingRates = function addShippingRates(newZoneRate) {
@@ -5439,7 +5478,8 @@
5439
5478
  actions: baseActionsList$8,
5440
5479
  oldObj: previous,
5441
5480
  newObj: next,
5442
- shouldOmitEmptyString: config.shouldOmitEmptyString
5481
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
5482
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties
5443
5483
  });
5444
5484
  }
5445
5485
 
@@ -5696,7 +5736,9 @@
5696
5736
  diff: diff,
5697
5737
  oldObj: oldObj,
5698
5738
  newObj: newObj,
5699
- shouldOmitEmptyString: config.shouldOmitEmptyString
5739
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
5740
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties,
5741
+ shouldPreventUnsettingRequiredFields: config.shouldPreventUnsettingRequiredFields
5700
5742
  });
5701
5743
  }
5702
5744
  function actionsMapRoles(diff, oldObj, newObj) {
@@ -5782,7 +5824,9 @@
5782
5824
  diff: diff,
5783
5825
  oldObj: oldObj,
5784
5826
  newObj: newObj,
5785
- shouldOmitEmptyString: config.shouldOmitEmptyString
5827
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
5828
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties,
5829
+ shouldPreventUnsettingRequiredFields: config.shouldPreventUnsettingRequiredFields
5786
5830
  });
5787
5831
  }
5788
5832
 
@@ -5833,7 +5877,9 @@
5833
5877
  diff: diff,
5834
5878
  oldObj: oldObj,
5835
5879
  newObj: newObj,
5836
- shouldOmitEmptyString: config.shouldOmitEmptyString
5880
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
5881
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties,
5882
+ shouldPreventUnsettingRequiredFields: config.shouldPreventUnsettingRequiredFields
5837
5883
  });
5838
5884
  }
5839
5885
  function actionsMapEnums(fieldName, attributeType, attributeDiff, previous, next) {
@@ -6028,6 +6074,7 @@
6028
6074
  });
6029
6075
  }
6030
6076
  var actionsMapBusinessUnit = function actionsMapBusinessUnit(diff, oldObj, newObj) {
6077
+ var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
6031
6078
  var businessUnits = diff.businessUnits;
6032
6079
  if (!businessUnits) {
6033
6080
  return [];
@@ -6036,10 +6083,13 @@
6036
6083
  actions: myBusinessUnitActionsList,
6037
6084
  diff: businessUnits,
6038
6085
  oldObj: oldObj.businessUnits,
6039
- newObj: newObj.businessUnits
6086
+ newObj: newObj.businessUnits,
6087
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
6088
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties
6040
6089
  });
6041
6090
  };
6042
6091
  function actionsMapSearchIndexingConfiguration(diff, oldObj, newObj) {
6092
+ var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
6043
6093
  var searchIndexing = diff.searchIndexing;
6044
6094
  if (!searchIndexing) {
6045
6095
  return [];
@@ -6052,7 +6102,10 @@
6052
6102
  actions: customerSearchActionsList,
6053
6103
  diff: diff.searchIndexing.customers,
6054
6104
  oldObj: oldObj.searchIndexing.customers,
6055
- newObj: newObj.searchIndexing.customers
6105
+ newObj: newObj.searchIndexing.customers,
6106
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
6107
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties,
6108
+ shouldPreventUnsettingRequiredFields: config.shouldPreventUnsettingRequiredFields
6056
6109
  });
6057
6110
  }
6058
6111
 
@@ -6095,11 +6148,15 @@
6095
6148
  key: 'supplyChannels'
6096
6149
  }];
6097
6150
  function actionsMapBase$3(diff, oldObj, newObj) {
6151
+ var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
6098
6152
  return buildBaseAttributesActions({
6099
6153
  actions: baseActionsList$3,
6100
6154
  diff: diff,
6101
6155
  oldObj: oldObj,
6102
- newObj: newObj
6156
+ newObj: newObj,
6157
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
6158
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties,
6159
+ shouldPreventUnsettingRequiredFields: config.shouldPreventUnsettingRequiredFields
6103
6160
  });
6104
6161
  }
6105
6162
 
@@ -6116,10 +6173,11 @@
6116
6173
  };
6117
6174
  }
6118
6175
  var stores = (function (actionGroupList) {
6176
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
6119
6177
  var mapActionGroup = createMapActionGroup(actionGroupList);
6120
6178
  var doMapActions = createStoresMapActions(mapActionGroup);
6121
6179
  var onBeforeApplyingDiff = null;
6122
- var buildActions = createBuildActions(diff, doMapActions, onBeforeApplyingDiff);
6180
+ var buildActions = createBuildActions(diff, doMapActions, onBeforeApplyingDiff, options);
6123
6181
  return {
6124
6182
  buildActions: buildActions
6125
6183
  };
@@ -6133,11 +6191,15 @@
6133
6191
  key: 'key'
6134
6192
  }];
6135
6193
  function actionsMapBase$2(diff, oldObj, newObj) {
6194
+ var config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
6136
6195
  return buildBaseAttributesActions({
6137
6196
  actions: baseActionsList$2,
6138
6197
  diff: diff,
6139
6198
  oldObj: oldObj,
6140
- newObj: newObj
6199
+ newObj: newObj,
6200
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
6201
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties,
6202
+ shouldPreventUnsettingRequiredFields: config.shouldPreventUnsettingRequiredFields
6141
6203
  });
6142
6204
  }
6143
6205
 
@@ -6194,7 +6256,9 @@
6194
6256
  diff: diff,
6195
6257
  oldObj: oldObj,
6196
6258
  newObj: newObj,
6197
- shouldOmitEmptyString: config.shouldOmitEmptyString
6259
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
6260
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties,
6261
+ shouldPreventUnsettingRequiredFields: config.shouldPreventUnsettingRequiredFields
6198
6262
  });
6199
6263
  }
6200
6264
 
@@ -6240,7 +6304,9 @@
6240
6304
  diff: diff,
6241
6305
  oldObj: oldObj,
6242
6306
  newObj: newObj,
6243
- shouldOmitEmptyString: config.shouldOmitEmptyString
6307
+ shouldOmitEmptyString: config.shouldOmitEmptyString,
6308
+ shouldUnsetOmittedProperties: config.shouldUnsetOmittedProperties,
6309
+ shouldPreventUnsettingRequiredFields: config.shouldPreventUnsettingRequiredFields
6244
6310
  });
6245
6311
  }
6246
6312
  function actionsMapAttributes(diff, oldObj, newObj) {