@infrab4a/connect 0.4.7-beta.0 → 0.4.7-beta.2
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/bundles/infrab4a-connect.umd.js +10 -3
- package/bundles/infrab4a-connect.umd.js.map +1 -1
- package/esm2015/lib/infra/firebase/firestore/mixins/with-update-firestore.mixin.js +10 -4
- package/fesm2015/infrab4a-connect.js +9 -3
- package/fesm2015/infrab4a-connect.js.map +1 -1
- package/package.json +2 -2
|
@@ -1208,16 +1208,21 @@
|
|
|
1208
1208
|
var withUpdateFirestore = function (MixinBase) {
|
|
1209
1209
|
var getValueFromParams = function (params, field) { var _a; return (lodash.isNil((_a = params[field]) === null || _a === void 0 ? void 0 : _a.value) ? params[field] : params[field].value) || null; };
|
|
1210
1210
|
var getValueByAction = function (options) {
|
|
1211
|
+
var _b, _c;
|
|
1211
1212
|
var fieldValues = firebase__default["default"].firestore.FieldValue;
|
|
1213
|
+
console.log(options.value);
|
|
1214
|
+
console.log('Array.isArray(options.value)', Array.isArray(options.value));
|
|
1212
1215
|
if (lodash.isNil(options.action))
|
|
1213
1216
|
return options;
|
|
1214
1217
|
if (options.action === exports.UpdateOptionActions.REMOVE_FIELD)
|
|
1215
1218
|
return fieldValues.delete();
|
|
1216
1219
|
if (Array.isArray(options.value)) {
|
|
1220
|
+
console.log(options.action);
|
|
1221
|
+
console.log('options.action === UpdateOptionActions.REMOVE', options.action === exports.UpdateOptionActions.REMOVE);
|
|
1217
1222
|
if (options.action === exports.UpdateOptionActions.MERGE)
|
|
1218
|
-
return
|
|
1223
|
+
return (_b = firebase__default["default"].firestore.FieldValue).arrayUnion.apply(_b, __spreadArray([], __read(options.value)));
|
|
1219
1224
|
if (options.action === exports.UpdateOptionActions.REMOVE)
|
|
1220
|
-
return
|
|
1225
|
+
return (_c = firebase__default["default"].firestore.FieldValue).arrayRemove.apply(_c, __spreadArray([], __read(options.value)));
|
|
1221
1226
|
}
|
|
1222
1227
|
return options.value;
|
|
1223
1228
|
};
|
|
@@ -1255,10 +1260,12 @@
|
|
|
1255
1260
|
var model = this.model;
|
|
1256
1261
|
if (params instanceof model)
|
|
1257
1262
|
return params.toPlain();
|
|
1258
|
-
|
|
1263
|
+
var builded = Object.keys(params).reduce(function (data, currentKey) {
|
|
1259
1264
|
var _b;
|
|
1260
1265
|
return (Object.assign(Object.assign({}, data), (_b = {}, _b[currentKey] = getValueByAction(params[currentKey]), _b)));
|
|
1261
1266
|
}, {});
|
|
1267
|
+
console.log('builded', builded);
|
|
1268
|
+
return builded;
|
|
1262
1269
|
};
|
|
1263
1270
|
return UpdateFirestore;
|
|
1264
1271
|
}(MixinBase));
|