dataflux 1.12.2 → 1.13.0
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 -1
- package/dist/BasicObj.js +23 -1
- package/dist/Model.js +28 -5
- package/dist/Obj.js +23 -1
- package/dist/ObserverStore.js +32 -4
- package/dist/PersistentStore.js +24 -2
- package/dist/PubSub.js +1 -1
- package/dist/ReactStore.js +24 -2
- package/dist/Store.js +42 -4
- package/dist/SubObj.js +23 -1
- package/dist/dataflux.min.js +1 -1
- package/dist/dataflux.min.js.map +1 -1
- package/dist/fingerprint.js +24 -2
- package/dist/modelHooksUtils.js +23 -1
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -569,7 +569,8 @@ The store has the following method.
|
|
|
569
569
|
| 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)`. |
|
|
570
570
|
| save() | Persist the changes. Edited local objects will be sent to the REST APIs (insert/update/delete). See also [editing objects](#editing-objects). |
|
|
571
571
|
| 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). |
|
|
572
|
-
| refresh()
|
|
572
|
+
| refresh(type) | This method syncs all the objects in the store with the remote version offered by the REST APIs (`remote -> local`). Remote changes are applied locally, including adding/removing objects. Objects edited locally but not yet persisted are preserved locally (tip: you can also create a store with the `autoRefresh` option). If a model type is passed, only objects of that type will be refreshed. |
|
|
573
|
+
| reset(type) | This method syncs all the objects in the store with the remote version offered by the REST APIs (`remote -> local`). Remote changes are applied locally, including adding/removing objects. Objects edited locally but not yet persisted are reverted to the corresponding remote object. If a model type is passed, only objects of that type will be reset. |
|
|
573
574
|
| findSync(type, filterFunction) | This method returns the objects in a synchronous way (no Promise). However, *it works only if you already performed an async operation (e.g., like refresh, load, find, subscribe) or if you set lazyLoad to false and the store had enough time to load.* |
|
|
574
575
|
|
|
575
576
|
### Insert vs. Mock
|
package/dist/BasicObj.js
CHANGED
|
@@ -21,7 +21,29 @@ function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) {
|
|
|
21
21
|
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
|
22
22
|
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
|
23
23
|
function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
|
|
24
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
24
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } /*
|
|
25
|
+
* MIT License
|
|
26
|
+
*
|
|
27
|
+
* Copyright (c) 2022 Massimo Candela <https://massimocandela.com>
|
|
28
|
+
*
|
|
29
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
30
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
31
|
+
* in the Software without restriction, including without limitation the rights
|
|
32
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
33
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
34
|
+
* furnished to do so, subject to the following conditions:
|
|
35
|
+
*
|
|
36
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
37
|
+
* copies or substantial portions of the Software.
|
|
38
|
+
*
|
|
39
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
40
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
41
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
42
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
43
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
44
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
45
|
+
* SOFTWARE.
|
|
46
|
+
*/
|
|
25
47
|
var dateRegex = new RegExp("^[0-9][0-9][0-9][0-9]-[0-9].*T[0-9].*Z$");
|
|
26
48
|
exports.dateRegex = dateRegex;
|
|
27
49
|
var globalError = "_object";
|
package/dist/Model.js
CHANGED
|
@@ -11,14 +11,14 @@ var _SubObj = _interopRequireDefault(require("./SubObj"));
|
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
12
12
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
13
13
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
14
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0)
|
|
14
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
15
15
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
16
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
17
17
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
18
18
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
19
19
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
20
20
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
21
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
21
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
22
22
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
23
23
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
24
24
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
@@ -33,7 +33,29 @@ function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classEx
|
|
|
33
33
|
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
|
34
34
|
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
|
35
35
|
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
|
36
|
-
function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
|
|
36
|
+
function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } } /*
|
|
37
|
+
* MIT License
|
|
38
|
+
*
|
|
39
|
+
* Copyright (c) 2022 Massimo Candela <https://massimocandela.com>
|
|
40
|
+
*
|
|
41
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
42
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
43
|
+
* in the Software without restriction, including without limitation the rights
|
|
44
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
45
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
46
|
+
* furnished to do so, subject to the following conditions:
|
|
47
|
+
*
|
|
48
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
49
|
+
* copies or substantial portions of the Software.
|
|
50
|
+
*
|
|
51
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
52
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
53
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
54
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
55
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
56
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
57
|
+
* SOFTWARE.
|
|
58
|
+
*/
|
|
37
59
|
var _type = /*#__PURE__*/new WeakMap();
|
|
38
60
|
var _store = /*#__PURE__*/new WeakMap();
|
|
39
61
|
var _includes = /*#__PURE__*/new WeakMap();
|
|
@@ -343,6 +365,7 @@ var Model = /*#__PURE__*/_createClass(function Model(name) {
|
|
|
343
365
|
value: function value(data, objects) {
|
|
344
366
|
if (Array.isArray(data) && Array.isArray(objects) && objects.length === data.length) {
|
|
345
367
|
for (var i = 0; i < data.length; i++) {
|
|
368
|
+
(0, _BasicObj.setValues)(data[i], _this, _SubObj["default"], null, objects[i]);
|
|
346
369
|
objects[i].setId(data[i].id);
|
|
347
370
|
delete objects[i].setId;
|
|
348
371
|
}
|
|
@@ -376,8 +399,8 @@ var Model = /*#__PURE__*/_createClass(function Model(name) {
|
|
|
376
399
|
_classPrivateFieldInitSpec(this, _hanldeApiError, {
|
|
377
400
|
writable: true,
|
|
378
401
|
value: function value(error, objects, operation) {
|
|
379
|
-
var _error$response$data, _error3,
|
|
380
|
-
error = (_error$response$data = (_error3 = error) === null || _error3 === void 0
|
|
402
|
+
var _error$response$data, _error3, _ref, _error$message, _error4, _error5;
|
|
403
|
+
error = (_error$response$data = (_error3 = error) === null || _error3 === void 0 || (_error3 = _error3.response) === null || _error3 === void 0 ? void 0 : _error3.data) !== null && _error$response$data !== void 0 ? _error$response$data : error;
|
|
381
404
|
var targets = objects.map(function (object) {
|
|
382
405
|
return object.getId();
|
|
383
406
|
});
|
package/dist/Obj.js
CHANGED
|
@@ -30,7 +30,29 @@ function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _
|
|
|
30
30
|
function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
|
|
31
31
|
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
|
32
32
|
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
|
33
|
-
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
|
33
|
+
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; } /*
|
|
34
|
+
* MIT License
|
|
35
|
+
*
|
|
36
|
+
* Copyright (c) 2022 Massimo Candela <https://massimocandela.com>
|
|
37
|
+
*
|
|
38
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
39
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
40
|
+
* in the Software without restriction, including without limitation the rights
|
|
41
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
42
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
43
|
+
* furnished to do so, subject to the following conditions:
|
|
44
|
+
*
|
|
45
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
46
|
+
* copies or substantial portions of the Software.
|
|
47
|
+
*
|
|
48
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
49
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
50
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
51
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
52
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
53
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
54
|
+
* SOFTWARE.
|
|
55
|
+
*/
|
|
34
56
|
var _loaded = /*#__PURE__*/new WeakMap();
|
|
35
57
|
var Obj = /*#__PURE__*/function (_BasicObj) {
|
|
36
58
|
_inherits(Obj, _BasicObj);
|
package/dist/ObserverStore.js
CHANGED
|
@@ -13,8 +13,8 @@ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol
|
|
|
13
13
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
14
14
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
15
15
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
16
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
17
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0)
|
|
16
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
17
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
18
18
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
19
19
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
20
20
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
@@ -39,7 +39,29 @@ function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _
|
|
|
39
39
|
function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
|
|
40
40
|
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
|
41
41
|
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
|
42
|
-
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
|
42
|
+
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; } /*
|
|
43
|
+
* MIT License
|
|
44
|
+
*
|
|
45
|
+
* Copyright (c) 2022 Massimo Candela <https://massimocandela.com>
|
|
46
|
+
*
|
|
47
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
48
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
49
|
+
* in the Software without restriction, including without limitation the rights
|
|
50
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
51
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
52
|
+
* furnished to do so, subject to the following conditions:
|
|
53
|
+
*
|
|
54
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
55
|
+
* copies or substantial portions of the Software.
|
|
56
|
+
*
|
|
57
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
58
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
59
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
60
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
61
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
62
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
63
|
+
* SOFTWARE.
|
|
64
|
+
*/
|
|
43
65
|
var _queryPromises = /*#__PURE__*/new WeakMap();
|
|
44
66
|
var _unsubPromises = /*#__PURE__*/new WeakMap();
|
|
45
67
|
var _getUniqueSubs = /*#__PURE__*/new WeakMap();
|
|
@@ -228,13 +250,19 @@ var ObserverStore = /*#__PURE__*/function (_PersistentStore) {
|
|
|
228
250
|
_classPrivateFieldGet(_assertThisInitialized(_this), _appendIfNotExistent).call(_assertThisInitialized(_this), _this._subscribed[type]["*"], item);
|
|
229
251
|
}
|
|
230
252
|
});
|
|
253
|
+
_defineProperty(_assertThisInitialized(_this), "reset", function (type) {
|
|
254
|
+
return _this._refresh(type, true);
|
|
255
|
+
});
|
|
231
256
|
_defineProperty(_assertThisInitialized(_this), "refresh", function (type) {
|
|
257
|
+
return _this._refresh(type, false);
|
|
258
|
+
});
|
|
259
|
+
_defineProperty(_assertThisInitialized(_this), "_refresh", function (type, force) {
|
|
232
260
|
var refreshByType = function refreshByType(type) {
|
|
233
261
|
_this.pubSub.publish("refresh", {
|
|
234
262
|
status: "start",
|
|
235
263
|
model: type
|
|
236
264
|
});
|
|
237
|
-
return _this.refreshObjectByType(type).then(function (_ref5) {
|
|
265
|
+
return _this.refreshObjectByType(type, force).then(function (_ref5) {
|
|
238
266
|
var _ref6 = _slicedToArray(_ref5, 3),
|
|
239
267
|
inserted = _ref6[0],
|
|
240
268
|
updated = _ref6[1],
|
package/dist/PersistentStore.js
CHANGED
|
@@ -9,7 +9,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
9
9
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
10
10
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
11
11
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
12
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
12
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
13
13
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
14
14
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
15
15
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
@@ -24,7 +24,29 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
24
24
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
25
25
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
26
26
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
27
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
27
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /*
|
|
28
|
+
* MIT License
|
|
29
|
+
*
|
|
30
|
+
* Copyright (c) 2022 Massimo Candela <https://massimocandela.com>
|
|
31
|
+
*
|
|
32
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
33
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
34
|
+
* in the Software without restriction, including without limitation the rights
|
|
35
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
36
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
37
|
+
* furnished to do so, subject to the following conditions:
|
|
38
|
+
*
|
|
39
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
40
|
+
* copies or substantial portions of the Software.
|
|
41
|
+
*
|
|
42
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
43
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
44
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
45
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
46
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
47
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
48
|
+
* SOFTWARE.
|
|
49
|
+
*/
|
|
28
50
|
var PersistentStore = /*#__PURE__*/function (_Store) {
|
|
29
51
|
_inherits(PersistentStore, _Store);
|
|
30
52
|
var _super = _createSuper(PersistentStore);
|
package/dist/PubSub.js
CHANGED
|
@@ -7,7 +7,7 @@ exports["default"] = void 0;
|
|
|
7
7
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
8
8
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
9
9
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
10
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
11
11
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
12
12
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
13
13
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
package/dist/ReactStore.js
CHANGED
|
@@ -11,7 +11,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
11
11
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
12
12
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
13
13
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
14
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
14
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
15
15
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
16
16
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
17
17
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
@@ -31,7 +31,29 @@ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollect
|
|
|
31
31
|
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
|
32
32
|
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
|
33
33
|
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
|
34
|
-
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
|
34
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; } /*
|
|
35
|
+
* MIT License
|
|
36
|
+
*
|
|
37
|
+
* Copyright (c) 2022 Massimo Candela <https://massimocandela.com>
|
|
38
|
+
*
|
|
39
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
40
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
41
|
+
* in the Software without restriction, including without limitation the rights
|
|
42
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
43
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
44
|
+
* furnished to do so, subject to the following conditions:
|
|
45
|
+
*
|
|
46
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
47
|
+
* copies or substantial portions of the Software.
|
|
48
|
+
*
|
|
49
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
50
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
51
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
52
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
53
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
54
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
55
|
+
* SOFTWARE.
|
|
56
|
+
*/
|
|
35
57
|
var _addSubscriptionToContext = /*#__PURE__*/new WeakMap();
|
|
36
58
|
var _fixState = /*#__PURE__*/new WeakSet();
|
|
37
59
|
var ReactStore = /*#__PURE__*/function (_ObserverStore) {
|
package/dist/Store.js
CHANGED
|
@@ -11,7 +11,7 @@ var _batchPromises = _interopRequireDefault(require("batch-promises"));
|
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
12
12
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
13
13
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
14
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
14
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
15
15
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
16
16
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
17
17
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
@@ -24,9 +24,32 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
24
24
|
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
|
25
25
|
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
|
26
26
|
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
|
27
|
-
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
|
27
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; } /*
|
|
28
|
+
* MIT License
|
|
29
|
+
*
|
|
30
|
+
* Copyright (c) 2022 Massimo Candela <https://massimocandela.com>
|
|
31
|
+
*
|
|
32
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
33
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
34
|
+
* in the Software without restriction, including without limitation the rights
|
|
35
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
36
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
37
|
+
* furnished to do so, subject to the following conditions:
|
|
38
|
+
*
|
|
39
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
40
|
+
* copies or substantial portions of the Software.
|
|
41
|
+
*
|
|
42
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
43
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
44
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
45
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
46
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
47
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
48
|
+
* SOFTWARE.
|
|
49
|
+
*/
|
|
28
50
|
var objectStatuses = ["new", "old", "mock", "deleted"];
|
|
29
51
|
var _merge = /*#__PURE__*/new WeakMap();
|
|
52
|
+
var _wipe = /*#__PURE__*/new WeakMap();
|
|
30
53
|
var _error = /*#__PURE__*/new WeakSet();
|
|
31
54
|
var _deleteByObject = /*#__PURE__*/new WeakMap();
|
|
32
55
|
var _deleteByFilter = /*#__PURE__*/new WeakSet();
|
|
@@ -55,6 +78,7 @@ var Store = /*#__PURE__*/function () {
|
|
|
55
78
|
return filterFunction ? all.filter(filterFunction) : all;
|
|
56
79
|
});
|
|
57
80
|
_defineProperty(this, "refreshObjectByType", function (type) {
|
|
81
|
+
var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
58
82
|
return _this._getPromise(type).then(function () {
|
|
59
83
|
var item = _this.models[type];
|
|
60
84
|
var inserted = [];
|
|
@@ -85,7 +109,12 @@ var Store = /*#__PURE__*/function () {
|
|
|
85
109
|
var oldFingerprint = currentObject.fingerprint;
|
|
86
110
|
if (oldFingerprint !== newFingerprint) {
|
|
87
111
|
// Nothing to do otherwise
|
|
88
|
-
if (
|
|
112
|
+
if (force) {
|
|
113
|
+
_classPrivateFieldGet(_this, _wipe).call(_this, currentObject.object);
|
|
114
|
+
_classPrivateFieldGet(_this, _merge).call(_this, currentObject.object, wrapper.toJSON());
|
|
115
|
+
currentObject.fingerprint = newFingerprint;
|
|
116
|
+
updated.push(currentObject.object);
|
|
117
|
+
} else if (_this.hasChanged(type, currentObject.object)) {// Was the object edited locally?
|
|
89
118
|
|
|
90
119
|
// Nothing for now
|
|
91
120
|
} else {
|
|
@@ -126,7 +155,16 @@ var Store = /*#__PURE__*/function () {
|
|
|
126
155
|
for (var key in newObject) {
|
|
127
156
|
originalObject[key] = newObject[key];
|
|
128
157
|
}
|
|
129
|
-
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
_classPrivateFieldInitSpec(this, _wipe, {
|
|
161
|
+
writable: true,
|
|
162
|
+
value: function value(originalObject) {
|
|
163
|
+
for (var key in originalObject) {
|
|
164
|
+
if (key !== "id") {
|
|
165
|
+
delete originalObject[key];
|
|
166
|
+
}
|
|
167
|
+
}
|
|
130
168
|
}
|
|
131
169
|
});
|
|
132
170
|
_classPrivateFieldInitSpec(this, _deleteByObject, {
|
package/dist/SubObj.js
CHANGED
|
@@ -27,7 +27,29 @@ function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classEx
|
|
|
27
27
|
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
|
28
28
|
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
|
29
29
|
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
|
30
|
-
function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
|
|
30
|
+
function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } } /*
|
|
31
|
+
* MIT License
|
|
32
|
+
*
|
|
33
|
+
* Copyright (c) 2022 Massimo Candela <https://massimocandela.com>
|
|
34
|
+
*
|
|
35
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
36
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
37
|
+
* in the Software without restriction, including without limitation the rights
|
|
38
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
39
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
40
|
+
* furnished to do so, subject to the following conditions:
|
|
41
|
+
*
|
|
42
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
43
|
+
* copies or substantial portions of the Software.
|
|
44
|
+
*
|
|
45
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
46
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
47
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
48
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
49
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
50
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
51
|
+
* SOFTWARE.
|
|
52
|
+
*/
|
|
31
53
|
var _model = /*#__PURE__*/new WeakMap();
|
|
32
54
|
var _parent = /*#__PURE__*/new WeakMap();
|
|
33
55
|
var _parentField = /*#__PURE__*/new WeakMap();
|