dataflux 1.7.5 → 1.8.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 CHANGED
@@ -308,10 +308,23 @@ An operation object is an object like follows:
308
308
  {
309
309
  "method": "get",
310
310
  "url": "https://api.example.com",
311
- "headers": {"Authorization": "bearer XXXX"}
311
+ "headers": {
312
+ "Authorization": "bearer XXXX"
313
+ },
314
+ "batch": false
312
315
  }
313
316
  ```
314
317
 
318
+ Possible parameters are:
319
+
320
+ | Parameter | Description | Default |
321
+ |-----------|--------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------|
322
+ | method | HTTP method, accepted are get,post,put, and delete | "get" for retrieve, "post" for insert, "put" for update, and "delete" for delete |
323
+ | url | The url of the api | |
324
+ | headers | Headers for the HTTP request ([list](https://en.wikipedia.org/wiki/List_of_HTTP_header_fields)). |
325
+ | batch | A boolean declaring if the API is able to receive an array of objects or an object at a time. This is not applicable for `retrieve`. | false |
326
+
327
+
315
328
  Usage example:
316
329
 
317
330
  ```js
package/dist/Model.js CHANGED
@@ -7,8 +7,6 @@ exports["default"] = void 0;
7
7
 
8
8
  var _modelHooksUtils = require("./modelHooksUtils");
9
9
 
10
- var _batchPromises = _interopRequireDefault(require("batch-promises"));
11
-
12
10
  var _axios2 = _interopRequireDefault(require("axios"));
13
11
 
14
12
  var _BasicObj = require("./BasicObj");
@@ -342,15 +340,9 @@ var Model = /*#__PURE__*/_createClass(function Model(name) {
342
340
  _classPrivateFieldInitSpec(this, _bulkOperation, {
343
341
  writable: true,
344
342
  value: function value(objects, action) {
345
- if (_classPrivateFieldGet(_this, _singleItemQuery)) {
346
- return (0, _batchPromises["default"])(_classPrivateFieldGet(_this, _batchSize), objects.map(function (i) {
347
- return _classPrivateFieldGet(_this, _removeHiddenFields).call(_this, i.toJSON());
348
- }), action);
349
- } else {
350
- return action(objects.map(function (i) {
351
- return _classPrivateFieldGet(_this, _removeHiddenFields).call(_this, i.toJSON());
352
- }));
353
- }
343
+ return action(objects.map(function (i) {
344
+ return _classPrivateFieldGet(_this, _removeHiddenFields).call(_this, i.toJSON());
345
+ }));
354
346
  }
355
347
  });
356
348
 
@@ -358,7 +350,7 @@ var Model = /*#__PURE__*/_createClass(function Model(name) {
358
350
  writable: true,
359
351
  value: function value(data) {
360
352
  if (Array.isArray(data)) {
361
- if (data.every(function (str) {
353
+ if (data.length && data.every(function (str) {
362
354
  return ["string", "number"].includes(_typeof(str));
363
355
  })) {
364
356
  return [{
@@ -111,6 +111,7 @@ var ObserverStore = /*#__PURE__*/function (_PersistentStore) {
111
111
 
112
112
  _defineProperty(_assertThisInitialized(_this), "multipleSubscribe", function (subscriptions, callback) {
113
113
  var dataPayload = {};
114
+ var subKey = (0, _uuid.v4)();
114
115
 
115
116
  var areAllDone = function areAllDone() {
116
117
  return subscriptions.map(function (_ref) {
@@ -123,7 +124,7 @@ var ObserverStore = /*#__PURE__*/function (_PersistentStore) {
123
124
  });
124
125
  };
125
126
 
126
- return Promise.all(subscriptions.map(function (sub) {
127
+ Promise.all(subscriptions.map(function (sub) {
127
128
  var _sub = _slicedToArray(sub, 2),
128
129
  name = _sub[0],
129
130
  _sub$ = _sub[1],
@@ -136,10 +137,10 @@ var ObserverStore = /*#__PURE__*/function (_PersistentStore) {
136
137
 
137
138
  return _this.subscribe(name, wrappedCallback, filterFunction);
138
139
  })).then(function (subKeys) {
139
- var subKey = (0, _uuid.v4)();
140
140
  _this._multipleSubscribed[subKey] = subKeys;
141
141
  return subKey;
142
142
  });
143
+ return subKey;
143
144
  });
144
145
 
145
146
  _defineProperty(_assertThisInitialized(_this), "subscribe", function (type, callback, filterFunction) {