dataflux 1.17.0 → 1.17.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/README.md +2 -2
- package/dist/Model.js +6 -0
- package/dist/ReactStore.js +2 -1
- package/dist/dataflux.min.js +1 -1
- package/dist/dataflux.min.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -624,7 +624,7 @@ The store has the following method.
|
|
|
624
624
|
| addModel(model) | Introduce a new model to the store. If lazyLoad = false (default), the model is populated with the objects coming from the API. |
|
|
625
625
|
| get(type, id) | It allows to retrieve an object based on its type and store's ID (see `getId()` in [objects methods](#objects-methods). The type is the name of the model. |
|
|
626
626
|
| find(type, filterFunction) | The promise-oriented method to access objects given a type and a filter function. If the filter function is missing, all the objects are returned. See [example 1](#example-1). |
|
|
627
|
-
| delete(objects) | It deletes an array of objects. See [example
|
|
627
|
+
| delete(objects) | It deletes an array of objects. See [example 3](#example-3). |
|
|
628
628
|
| delete(type, filterFunction) | It deleted objects given an array and a filter function. See [example 1](#example-3). |
|
|
629
629
|
| insert(type, object) | It creates a new object of a given type and inserts it in the store. The object inserted MUST be ready to be persisted, read `mock()` below. |
|
|
630
630
|
| mock(type, object) | It creates a mock object of a given type and inserts it in the store. The mock object behaves exactly like a real object, except that it is not persisted (sent to the API) as long as you don't call `object.insert()`. This is useful when you want to create an object but you need to be able to change some properties before to send it to the API. Read [insert vs. mock](#insert-vs-mock). |
|
|
@@ -632,7 +632,7 @@ The store has the following method.
|
|
|
632
632
|
| multipleSubscribe(subscriptions, callback) | A method to subscribe to multiple models. The first parameter is an array of models' names and filterFunctions, the second parameter is the callback to be called when the cumulative dataset is ready. E.g., `multipleSubscribe([["book", filterFunction1], ["author", filterFunction2]], callback)`. It returns the key of the subscription. See [example 5](#example-5---observability). |
|
|
633
633
|
| unsubscribe(key) | Method to terminate a subscription given a subscription key. See [example 5](#example-5---observability). |
|
|
634
634
|
| findOne(type, stateAttribute, context, filterFunction) | This method automatically injects and updates the React state with the requested data. If multiple objects satisfy the query, only the first is selected. The `stateAttribute` is the name of the attribute that will be added/updated in the state, the `context` is the React.Component. It automatically unsubscribe when the React.Component will unmount. See [example 6](#example-6---observability--react). |
|
|
635
|
-
| findAll(type, stateAttribute, context, filterFunction) | This method automatically injects and updates the React state with the requested data. The `stateAttribute` is the name of the attribute that will be added/updated in the state, the `context` is the React.Component. It automatically unsubscribe when the React.Component will unmount. If the filter function is missing, all the objects are returned. See [example
|
|
635
|
+
| findAll(type, stateAttribute, context, filterFunction) | This method automatically injects and updates the React state with the requested data. The `stateAttribute` is the name of the attribute that will be added/updated in the state, the `context` is the React.Component. It automatically unsubscribe when the React.Component will unmount. If the filter function is missing, all the objects are returned. See [example 7](#example-6---observability--react). |
|
|
636
636
|
| preload(type) | This method allows to preLoad all objects of a given model. If you initialize the store with `lazyLoad:true`, the objects of a model are retrieved from the API at the first query performed on that model (e.g., at the first `.find()`). However, sometimes you may want to speed up the first query by pre loading the objects of a specific model while keeping `lazyLoad:true` on the store; in such a case you can use `store.preload(type)`. |
|
|
637
637
|
| save() | Persist the changes. Edited local objects will be sent to the REST APIs (insert/update/delete). See also [editing objects](#editing-objects). |
|
|
638
638
|
| save() | Persist the changes (`local -> remote`). Edited local objects will be sent to the REST APIs (insert/update/delete). See also [editing objects](#editing-objects). |
|
package/dist/Model.js
CHANGED
|
@@ -275,6 +275,12 @@ var Model = exports["default"] = /*#__PURE__*/_createClass(function Model(name)
|
|
|
275
275
|
} finally {
|
|
276
276
|
_iterator.f();
|
|
277
277
|
}
|
|
278
|
+
for (var _i = 0, _Object$values = Object.values(json); _i < _Object$values.length; _i++) {
|
|
279
|
+
var obj = _Object$values[_i];
|
|
280
|
+
if (_typeof(obj) === "object") {
|
|
281
|
+
_classPrivateFieldGet(_removeHiddenFields, _this).call(_this, obj);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
278
284
|
return json;
|
|
279
285
|
});
|
|
280
286
|
_classPrivateFieldInitSpec(this, _toArray, function (data) {
|
package/dist/ReactStore.js
CHANGED
|
@@ -63,7 +63,8 @@ var ReactStore = exports["default"] = /*#__PURE__*/function (_ObserverStore) {
|
|
|
63
63
|
_defineProperty(_this, "didUpdate", function (context) {
|
|
64
64
|
var _context$props;
|
|
65
65
|
var objects = Object.values((_context$props = context === null || context === void 0 ? void 0 : context.props) !== null && _context$props !== void 0 ? _context$props : {}).filter(function (i) {
|
|
66
|
-
|
|
66
|
+
var _i$isDataflux;
|
|
67
|
+
return i === null || i === void 0 || (_i$isDataflux = i.isDataflux) === null || _i$isDataflux === void 0 ? void 0 : _i$isDataflux.call(i);
|
|
67
68
|
});
|
|
68
69
|
var _f = objects.map(function (i) {
|
|
69
70
|
return i.getFingerprint();
|