@infrab4a/connect 4.0.0-beta.27 → 4.0.0-beta.28

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.
@@ -3,8 +3,8 @@ import { plainToInstance, instanceToPlain, Expose, Type } from 'class-transforme
3
3
  import { __decorate, __metadata } from 'tslib';
4
4
  import { parseISO } from 'date-fns';
5
5
  export { add, addBusinessDays, addDays, addMonths, addYears, endOfDay, format, formatISO9075, parseISO, startOfDay, sub } from 'date-fns';
6
- import { isNil, isArray, first, last, flatten, compact, get as get$1, isString, isNumber, isDate, set, isObject, isEmpty, chunk, isBoolean, isInteger, isNaN as isNaN$1, omit } from 'lodash';
7
- export { chunk, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil, isNumber, isObject, isString, now, omit, pick, set } from 'lodash';
6
+ import { isNil, isArray, first, last, flatten, compact, get as get$1, isString, each, unset, isObject, isNumber, isDate, set, isEmpty, chunk, isBoolean, isInteger, isNaN as isNaN$1, omit } from 'lodash';
7
+ export { chunk, each, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil, isNumber, isObject, isString, now, omit, pick, set, unset } from 'lodash';
8
8
  import { Subject } from 'rxjs';
9
9
  import { debug } from 'debug';
10
10
  import { CustomError } from 'ts-custom-error';
@@ -1742,6 +1742,17 @@ const withFirestore = (MixinBase) => {
1742
1742
  : bindDate(data[key], key),
1743
1743
  }), {});
1744
1744
  };
1745
+ const omitByRecursivelyInPlace = (value, iteratee) => {
1746
+ each(value, (v, k) => {
1747
+ if (iteratee(v, k)) {
1748
+ unset(value, k);
1749
+ }
1750
+ else if (isObject(v)) {
1751
+ omitByRecursivelyInPlace(v, iteratee);
1752
+ }
1753
+ });
1754
+ return value;
1755
+ };
1745
1756
  return class extends MixinBase {
1746
1757
  constructor(...params) {
1747
1758
  const options = params[0];
@@ -1760,7 +1771,10 @@ const withFirestore = (MixinBase) => {
1760
1771
  }
1761
1772
  buildModelInstance() {
1762
1773
  return {
1763
- toFirestore: (data) => (data?.toPlain ? data.toPlain() : data),
1774
+ toFirestore: (data) => {
1775
+ const plain = data?.toPlain ? data.toPlain() : data;
1776
+ return omitByRecursivelyInPlace(plain, (value) => value === undefined);
1777
+ },
1764
1778
  fromFirestore: (snap) => {
1765
1779
  const data = snap.data();
1766
1780
  let bindedData = null;