dataflux 1.14.1 → 1.14.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.
@@ -10,28 +10,28 @@ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol
10
10
  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); }
11
11
  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; }
12
12
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } /*
13
- * MIT License
14
- *
15
- * Copyright (c) 2022 Massimo Candela <https://massimocandela.com>
16
- *
17
- * Permission is hereby granted, free of charge, to any person obtaining a copy
18
- * of this software and associated documentation files (the "Software"), to deal
19
- * in the Software without restriction, including without limitation the rights
20
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
21
- * copies of the Software, and to permit persons to whom the Software is
22
- * furnished to do so, subject to the following conditions:
23
- *
24
- * The above copyright notice and this permission notice shall be included in all
25
- * copies or substantial portions of the Software.
26
- *
27
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
30
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
32
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
- * SOFTWARE.
34
- */
13
+ * MIT License
14
+ *
15
+ * Copyright (c) 2022 Massimo Candela <https://massimocandela.com>
16
+ *
17
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
18
+ * of this software and associated documentation files (the "Software"), to deal
19
+ * in the Software without restriction, including without limitation the rights
20
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
21
+ * copies of the Software, and to permit persons to whom the Software is
22
+ * furnished to do so, subject to the following conditions:
23
+ *
24
+ * The above copyright notice and this permission notice shall be included in all
25
+ * copies or substantial portions of the Software.
26
+ *
27
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
30
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
32
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
+ * SOFTWARE.
34
+ */
35
35
  var CRC32 = require('crc-32');
36
36
  var _getFingerprint = function _getFingerprint(object) {
37
37
  switch (_typeof(object)) {
@@ -13,28 +13,28 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
13
13
  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; }
14
14
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
15
15
  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); } /*
16
- * MIT License
17
- *
18
- * Copyright (c) 2022 Massimo Candela <https://massimocandela.com>
19
- *
20
- * Permission is hereby granted, free of charge, to any person obtaining a copy
21
- * of this software and associated documentation files (the "Software"), to deal
22
- * in the Software without restriction, including without limitation the rights
23
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
24
- * copies of the Software, and to permit persons to whom the Software is
25
- * furnished to do so, subject to the following conditions:
26
- *
27
- * The above copyright notice and this permission notice shall be included in all
28
- * copies or substantial portions of the Software.
29
- *
30
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
31
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
32
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
33
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
34
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
35
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
36
- * SOFTWARE.
37
- */
16
+ * MIT License
17
+ *
18
+ * Copyright (c) 2022 Massimo Candela <https://massimocandela.com>
19
+ *
20
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
21
+ * of this software and associated documentation files (the "Software"), to deal
22
+ * in the Software without restriction, including without limitation the rights
23
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
24
+ * copies of the Software, and to permit persons to whom the Software is
25
+ * furnished to do so, subject to the following conditions:
26
+ *
27
+ * The above copyright notice and this permission notice shall be included in all
28
+ * copies or substantial portions of the Software.
29
+ *
30
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
31
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
32
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
33
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
34
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
35
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
36
+ * SOFTWARE.
37
+ */
38
38
  var getDataStringHook = function getDataStringHook(hook) {
39
39
  var _hook$batch, _hook$fields;
40
40
  var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
@@ -57,7 +57,7 @@ var getDataStringHook = function getDataStringHook(hook) {
57
57
  });
58
58
  } else if (batch) {
59
59
  return axios(_objectSpread(_objectSpread({}, options), {}, {
60
- data: data
60
+ data: [data].flat()
61
61
  })).then(function (data) {
62
62
  return data.data;
63
63
  });
@@ -92,34 +92,37 @@ var createHookItem = function createHookItem(optionItem, defaultMethod, defaultU
92
92
  return Promise.resolve([]);
93
93
  };
94
94
  } else {
95
- return {
95
+ return _objectSpread(_objectSpread({
96
96
  method: defaultMethod,
97
- url: defaultUrl,
97
+ url: defaultUrl
98
+ }, options), {}, {
98
99
  fields: options.fields || [],
99
100
  headers: options.headers || {}
100
- };
101
+ });
101
102
  }
102
103
  case "function":
103
104
  return function (data) {
104
105
  var res = optionItem(data);
105
106
  if (typeof res === "string") {
106
- return {
107
+ return _objectSpread(_objectSpread({
107
108
  method: defaultMethod,
108
- url: res,
109
+ url: res
110
+ }, options), {}, {
109
111
  fields: options.fields || [],
110
112
  headers: options.headers || {}
111
- };
113
+ });
112
114
  } else {
113
115
  return Promise.resolve(res);
114
116
  }
115
117
  };
116
118
  case "object":
117
- return {
119
+ return _objectSpread(_objectSpread({
118
120
  method: optionItem.method || defaultMethod,
119
- url: optionItem.url || defaultUrl,
121
+ url: optionItem.url || defaultUrl
122
+ }, options), {}, {
120
123
  fields: options.fields || [],
121
124
  headers: optionItem.headers || options.headers || {}
122
- };
125
+ });
123
126
  default:
124
127
  throw new Error("Invalid ".concat(defaultMethod, " configuration"));
125
128
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dataflux",
3
- "version": "1.14.1",
3
+ "version": "1.14.3",
4
4
  "description": "DataFlux, automatically interfaces with your REST APIs to create a 2-way-synced local data store. Transparently manages data propagation in the React state.",
5
5
  "main": "dist/index.js",
6
6
  "bin": "dist/index.js",
@@ -35,6 +35,7 @@
35
35
  "release-it": {
36
36
  "hooks": {
37
37
  "before:init": [
38
+ "npm run test",
38
39
  "npm ci"
39
40
  ],
40
41
  "after:bump": [
@@ -81,13 +82,13 @@
81
82
  },
82
83
  "devDependencies": {
83
84
  "@babel/cli": "^7.23.0",
84
- "@babel/core": "^7.23.2",
85
+ "@babel/core": "^7.23.3",
85
86
  "@babel/node": "^7.22.19",
86
87
  "@babel/plugin-proposal-class-properties": "^7.18.6",
87
88
  "@babel/plugin-proposal-object-rest-spread": "^7.20.7",
88
- "@babel/plugin-transform-async-to-generator": "^7.22.5",
89
- "@babel/plugin-transform-runtime": "^7.23.2",
90
- "@babel/preset-env": "^7.23.2",
89
+ "@babel/plugin-transform-async-to-generator": "^7.23.3",
90
+ "@babel/plugin-transform-runtime": "^7.23.3",
91
+ "@babel/preset-env": "^7.23.3",
91
92
  "browserify": "^17.0.0",
92
93
  "chai": "^4.3.10",
93
94
  "chai-subset": "^1.6.0",