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