@infrab4a/connect 4.0.0-beta.27 → 4.0.0-beta.29
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.
- package/esm2020/domain/users/models/user.mjs +2 -2
- package/esm2020/infra/firebase/firestore/mixins/with-firestore.mixin.mjs +17 -2
- package/esm2020/utils/index.mjs +3 -3
- package/fesm2015/infrab4a-connect.mjs +18 -4
- package/fesm2015/infrab4a-connect.mjs.map +1 -1
- package/fesm2020/infrab4a-connect.mjs +18 -4
- package/fesm2020/infrab4a-connect.mjs.map +1 -1
- package/package.json +1 -1
- package/utils/index.d.ts +2 -2
|
@@ -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,
|
|
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';
|
|
@@ -1008,7 +1008,7 @@ class User extends BaseModel {
|
|
|
1008
1008
|
const instance = super.toInstance(data);
|
|
1009
1009
|
if (!isNil(data.firstName))
|
|
1010
1010
|
instance.displayName = `${data.firstName}${!isNil(data.lastName) ? ` ${data.lastName}` : ''}`;
|
|
1011
|
-
return;
|
|
1011
|
+
return instance;
|
|
1012
1012
|
}
|
|
1013
1013
|
toPlain() {
|
|
1014
1014
|
const plain = super.toPlain();
|
|
@@ -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) =>
|
|
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;
|