@weapnl/js-junction 0.0.5 → 0.0.7

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/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## v0.0.7
6
+ - Request cancel improvements.
7
+
8
+ ## v0.0.6
9
+ - Added support for request cancellation by key.
10
+
5
11
  ## v0.0.5
6
12
  - Added license file.
7
13
  - Private field bugfix, proxy access.
package/README.md CHANGED
@@ -320,6 +320,25 @@ request.cancel();
320
320
  api.cancelRequests(); // Cancel all currently pending requests.
321
321
  ```
322
322
 
323
+ You are also able to cancel requests by a key. This is useful when you want to allow only one request at a time for a specific action (a table index for example). This works on all types of requests.
324
+
325
+ To do this, you can use the following:
326
+
327
+ ```javascript
328
+ const request = api
329
+ .request('users')
330
+ .setKey('get-users')
331
+ .get();
332
+ ```
333
+ A previously pending request with the same key will be cancelled, and this new request will be executed.
334
+
335
+ This is also possible on a model:
336
+ ```javascript
337
+ const user = new User()
338
+ .setKey('get-user')
339
+ .index();
340
+ ```
341
+
323
342
  **Set a bearer token**
324
343
 
325
344
  ```javascript
package/dist/index.js CHANGED
@@ -26,7 +26,7 @@ return /******/ (() => { // webpackBootstrap
26
26
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
27
27
 
28
28
  "use strict";
29
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ Api)\n/* harmony export */ });\n/* harmony import */ var _request__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./request */ \"./src/request.js\");\n/* harmony import */ var _batch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./batch */ \"./src/batch.js\");\n/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! axios */ \"./node_modules/axios/lib/axios.js\");\n/* provided dependency */ var _ = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nfunction _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); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _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); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _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); }\n\n\n\nvar Api = /*#__PURE__*/function () {\n function Api() {\n _classCallCheck(this, Api);\n this.setHeader('X-Requested-With', 'XMLHttpRequest');\n this._requests = [];\n this.host('/').suffix('');\n this._onSuccess = function () {};\n this._onError = function () {};\n this._onValidationError = function () {};\n this._onUnauthorized = function () {};\n this._onForbidden = function () {};\n }\n\n /**\n * @param {string} host\n *\n * @returns {this} The current instance.\n */\n _createClass(Api, [{\n key: \"host\",\n value: function host(_host) {\n this._host = _host;\n return this;\n }\n\n /**\n * @param {string} suffix\n *\n * @returns {this} The current instance.\n */\n }, {\n key: \"suffix\",\n value: function suffix(_suffix) {\n if (!_.startsWith(_suffix, '/') && _suffix) {\n _suffix = \"/\".concat(_suffix);\n }\n this._suffix = _suffix;\n return this;\n }\n\n /**\n * @returns {string} Url containing the host and suffix.\n */\n }, {\n key: \"baseUrl\",\n get: function get() {\n var url = '';\n if (this._host) url += this._host;\n if (this._suffix) url += this._suffix;\n return url;\n }\n\n /**\n * @param {string} uri\n *\n * @returns {Request} The created request.\n */\n }, {\n key: \"request\",\n value: function request(uri) {\n if (!uri) throw new Error(\"Request url is empty.\");\n if (!_.startsWith(uri, '/')) {\n uri = \"/\".concat(uri);\n }\n var request = new _request__WEBPACK_IMPORTED_MODULE_0__[\"default\"]();\n request.setUrl(uri).onSuccess(this._onSuccess).onError(this._onError).onValidationError(this._onValidationError).onUnauthorized(this._onUnauthorized).onForbidden(this._onForbidden);\n this._requests.push(request);\n return request;\n }\n\n /**\n * @returns {this} The current instance.\n */\n }, {\n key: \"cancelRequests\",\n value: function cancelRequests() {\n this._requests.forEach(function (request) {\n request.cancel();\n });\n this._requests = [];\n return this;\n }\n\n /**\n * @param {array} requests\n * @returns Batch\n */\n }, {\n key: \"batch\",\n value: function batch(requests) {\n return new _batch__WEBPACK_IMPORTED_MODULE_1__[\"default\"](requests);\n }\n\n /**\n * @param {string} token\n */\n }, {\n key: \"setBearer\",\n value: function setBearer(token) {\n this.setHeader('Authorization', 'Bearer ' + token);\n }\n }, {\n key: \"resetBearer\",\n value: function resetBearer() {\n this.removeHeader('Authorization');\n }\n\n /**\n * @param {string} token\n */\n }, {\n key: \"setCsrf\",\n value: function setCsrf(token) {\n this.setHeader('X-CSRF-TOKEN', token);\n }\n }, {\n key: \"resetCsrf\",\n value: function resetCsrf() {\n this.removeHeader('X-CSRF-TOKEN');\n }\n\n /**\n * @param {string} key\n * @param {string} value\n */\n }, {\n key: \"setHeader\",\n value: function setHeader(key, value) {\n axios__WEBPACK_IMPORTED_MODULE_2__[\"default\"].defaults.headers.common[key] = value;\n }\n\n /**\n * @param {string} key\n */\n }, {\n key: \"removeHeader\",\n value: function removeHeader(key) {\n delete axios__WEBPACK_IMPORTED_MODULE_2__[\"default\"].defaults.headers.common[key];\n }\n\n /**\n * Set the default 'onSuccess'. Can be overridden in the Request class.\n *\n * @param {function(Response.data)} callback\n *\n * @returns {this} The current instance.\n */\n }, {\n key: \"onSuccess\",\n value: function onSuccess() {\n var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};\n this._onSuccess = callback;\n return this;\n }\n\n /**\n * Set the default 'onError'. Can be overridden in the Request class.\n *\n * @param {function(Response)} callback\n *\n * @returns {this} The current instance.\n */\n }, {\n key: \"onError\",\n value: function onError() {\n var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};\n this._onError = callback;\n return this;\n }\n\n /**\n * Set the default 'onValidationError'. Can be overridden in the Request class.\n *\n * @param {function(Response.validation)} callback\n *\n * @returns {this} The current instance.\n */\n }, {\n key: \"onValidationError\",\n value: function onValidationError() {\n var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};\n this._onValidationError = callback;\n return this;\n }\n\n /**\n * Set the default 'onUnauthorized'. Can be overridden in the Request class.\n *\n * @param {function(Response)} callback\n *\n * @returns {this} The current instance.\n */\n }, {\n key: \"onUnauthorized\",\n value: function onUnauthorized() {\n var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};\n this._onUnauthorized = callback;\n return this;\n }\n\n /**\n * Set the default 'onForbidden'. Can be overridden in the Request class.\n *\n * @param {function(Response)} callback\n *\n * @returns {this} The current instance.\n */\n }, {\n key: \"onForbidden\",\n value: function onForbidden() {\n var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};\n this._onForbidden = callback;\n return this;\n }\n\n /**\n * @param {function(Response)} onSuccess\n * @param {function(Error)} onError\n *\n * @returns {this}\n */\n }, {\n key: \"responseInterceptors\",\n value: function responseInterceptors() {\n var onSuccess = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};\n var onError = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};\n axios__WEBPACK_IMPORTED_MODULE_2__[\"default\"].interceptors.response.use(function (response) {\n onSuccess(response);\n return response;\n }, function (error) {\n onError(error);\n return Promise.reject(error);\n });\n return this;\n }\n }]);\n return Api;\n}();\n\n\n//# sourceURL=webpack://Api/./src/api.js?");
29
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ Api)\n/* harmony export */ });\n/* harmony import */ var _request__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./request */ \"./src/request.js\");\n/* harmony import */ var _batch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./batch */ \"./src/batch.js\");\n/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! axios */ \"./node_modules/axios/lib/axios.js\");\n/* provided dependency */ var _ = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nfunction _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); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _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); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _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); }\n\n\n\nvar Api = /*#__PURE__*/function () {\n function Api() {\n _classCallCheck(this, Api);\n this.setHeader('X-Requested-With', 'XMLHttpRequest');\n this._requests = {};\n this.host('/').suffix('');\n this._onSuccess = function () {};\n this._onError = function () {};\n this._onValidationError = function () {};\n this._onUnauthorized = function () {};\n this._onForbidden = function () {};\n }\n\n /**\n * @param {string} host\n *\n * @returns {this} The current instance.\n */\n _createClass(Api, [{\n key: \"host\",\n value: function host(_host) {\n this._host = _host;\n return this;\n }\n\n /**\n * @param {string} suffix\n *\n * @returns {this} The current instance.\n */\n }, {\n key: \"suffix\",\n value: function suffix(_suffix) {\n if (!_.startsWith(_suffix, '/') && _suffix) {\n _suffix = \"/\".concat(_suffix);\n }\n this._suffix = _suffix;\n return this;\n }\n\n /**\n * @returns {string} Url containing the host and suffix.\n */\n }, {\n key: \"baseUrl\",\n get: function get() {\n var url = '';\n if (this._host) url += this._host;\n if (this._suffix) url += this._suffix;\n return url;\n }\n }, {\n key: \"cancelRunning\",\n value: function cancelRunning(request) {\n var _this$_requests$reque;\n if (!request.key) {\n return;\n }\n (_this$_requests$reque = this._requests[request.key]) === null || _this$_requests$reque === void 0 || _this$_requests$reque.cancel();\n this._requests[request.key] = request;\n }\n\n /**\n * @param {string} uri\n *\n * @returns {Request} The created request.\n */\n }, {\n key: \"request\",\n value: function request(uri) {\n if (!uri) throw new Error(\"Request url is empty.\");\n if (!_.startsWith(uri, '/')) {\n uri = \"/\".concat(uri);\n }\n var request = new _request__WEBPACK_IMPORTED_MODULE_0__[\"default\"]();\n request.setUrl(uri).setApi(this).onSuccess(this._onSuccess).onError(this._onError).onValidationError(this._onValidationError).onUnauthorized(this._onUnauthorized).onForbidden(this._onForbidden);\n return request;\n }\n\n /**\n * @returns {this} The current instance.\n */\n }, {\n key: \"cancelRequests\",\n value: function cancelRequests() {\n this._requests.forEach(function (request) {\n request.cancel();\n });\n this._requests = [];\n return this;\n }\n\n /**\n * @param {array} requests\n * @returns Batch\n */\n }, {\n key: \"batch\",\n value: function batch(requests) {\n return new _batch__WEBPACK_IMPORTED_MODULE_1__[\"default\"](requests);\n }\n\n /**\n * @param {string} token\n */\n }, {\n key: \"setBearer\",\n value: function setBearer(token) {\n this.setHeader('Authorization', 'Bearer ' + token);\n }\n }, {\n key: \"resetBearer\",\n value: function resetBearer() {\n this.removeHeader('Authorization');\n }\n\n /**\n * @param {string} token\n */\n }, {\n key: \"setCsrf\",\n value: function setCsrf(token) {\n this.setHeader('X-CSRF-TOKEN', token);\n }\n }, {\n key: \"resetCsrf\",\n value: function resetCsrf() {\n this.removeHeader('X-CSRF-TOKEN');\n }\n\n /**\n * @param {string} key\n * @param {string} value\n */\n }, {\n key: \"setHeader\",\n value: function setHeader(key, value) {\n axios__WEBPACK_IMPORTED_MODULE_2__[\"default\"].defaults.headers.common[key] = value;\n }\n\n /**\n * @param {string} key\n */\n }, {\n key: \"removeHeader\",\n value: function removeHeader(key) {\n delete axios__WEBPACK_IMPORTED_MODULE_2__[\"default\"].defaults.headers.common[key];\n }\n\n /**\n * Set the default 'onSuccess'. Can be overridden in the Request class.\n *\n * @param {function(Response.data)} callback\n *\n * @returns {this} The current instance.\n */\n }, {\n key: \"onSuccess\",\n value: function onSuccess() {\n var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};\n this._onSuccess = callback;\n return this;\n }\n\n /**\n * Set the default 'onError'. Can be overridden in the Request class.\n *\n * @param {function(Response)} callback\n *\n * @returns {this} The current instance.\n */\n }, {\n key: \"onError\",\n value: function onError() {\n var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};\n this._onError = callback;\n return this;\n }\n\n /**\n * Set the default 'onValidationError'. Can be overridden in the Request class.\n *\n * @param {function(Response.validation)} callback\n *\n * @returns {this} The current instance.\n */\n }, {\n key: \"onValidationError\",\n value: function onValidationError() {\n var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};\n this._onValidationError = callback;\n return this;\n }\n\n /**\n * Set the default 'onUnauthorized'. Can be overridden in the Request class.\n *\n * @param {function(Response)} callback\n *\n * @returns {this} The current instance.\n */\n }, {\n key: \"onUnauthorized\",\n value: function onUnauthorized() {\n var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};\n this._onUnauthorized = callback;\n return this;\n }\n\n /**\n * Set the default 'onForbidden'. Can be overridden in the Request class.\n *\n * @param {function(Response)} callback\n *\n * @returns {this} The current instance.\n */\n }, {\n key: \"onForbidden\",\n value: function onForbidden() {\n var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};\n this._onForbidden = callback;\n return this;\n }\n\n /**\n * @param {function(Response)} onSuccess\n * @param {function(Error)} onError\n *\n * @returns {this}\n */\n }, {\n key: \"responseInterceptors\",\n value: function responseInterceptors() {\n var onSuccess = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};\n var onError = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};\n axios__WEBPACK_IMPORTED_MODULE_2__[\"default\"].interceptors.response.use(function (response) {\n onSuccess(response);\n return response;\n }, function (error) {\n onError(error);\n return Promise.reject(error);\n });\n return this;\n }\n }]);\n return Api;\n}();\n\n\n//# sourceURL=webpack://Api/./src/api.js?");
30
30
 
31
31
  /***/ }),
32
32
 
@@ -59,7 +59,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
59
59
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
60
60
 
61
61
  "use strict";
62
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ Model)\n/* harmony export */ });\n/* harmony import */ var _properties_accessors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./properties/accessors */ \"./src/builder/properties/accessors.js\");\n/* harmony import */ var _properties_attributes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./properties/attributes */ \"./src/builder/properties/attributes.js\");\n/* harmony import */ var _properties_counts__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./properties/counts */ \"./src/builder/properties/counts.js\");\n/* harmony import */ var _properties_relations__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./properties/relations */ \"./src/builder/properties/relations.js\");\n/* harmony import */ var _request__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../request */ \"./src/request.js\");\n/* provided dependency */ var _ = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nfunction _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); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _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; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _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); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _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); }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n\n\n\n\nvar Model = /*#__PURE__*/function (_Request) {\n _inherits(Model, _Request);\n var _super = _createSuper(Model);\n function Model() {\n var _this;\n var defaults = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, Model);\n _this = _super.call(this);\n _this._accessors = new _properties_accessors__WEBPACK_IMPORTED_MODULE_0__[\"default\"](_assertThisInitialized(_this));\n _this._attributes = new _properties_attributes__WEBPACK_IMPORTED_MODULE_1__[\"default\"](_assertThisInitialized(_this));\n _this._counts = new _properties_counts__WEBPACK_IMPORTED_MODULE_2__[\"default\"](_assertThisInitialized(_this));\n _this._relations = new _properties_relations__WEBPACK_IMPORTED_MODULE_3__[\"default\"](_assertThisInitialized(_this));\n _this.fill(defaults);\n return _this;\n }\n\n /**\n * Create an instance of the model for the given json object.\n *\n * @param {Object} json\n *\n * @returns {this} An instance of the model.\n */\n _createClass(Model, [{\n key: \"toJson\",\n value:\n /**\n * Convert the attributes of the current instance to json.\n *\n * @return {Object} The attributes of the current instance as json object.\n */\n function toJson() {\n return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, this._accessors.toJson()), this._attributes.toJson()), this._counts.toJson()), this._relations.toJson());\n }\n\n /**\n * @param values\n * @returns {this}\n */\n }, {\n key: \"fill\",\n value: function fill() {\n var values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n this._attributes.set(values);\n this._relations.set(values);\n return this;\n }\n\n /**\n * The accessors of the model which were appended on the api side.\n *\n * @returns {Object.<any, Object>}\n */\n }, {\n key: \"_identifier\",\n get:\n /**\n * @returns {int} Identifier attribute name of the model.\n */\n function get() {\n return _.get(this, 'id');\n }\n\n /**\n * Get a list of models.\n *\n * @returns {this[]} List of models.\n */\n }, {\n key: \"index\",\n value: function () {\n var _index = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n var _this2 = this;\n var items;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n _context.next = 2;\n return this._connection.get(this._queryString(), this.bodyParameters);\n case 2:\n this._response = _context.sent;\n if (this._response.data) {\n items = _.map(this._response.data.items, function (item) {\n return _this2.constructor.fromJson(item);\n });\n }\n _context.next = 6;\n return this.triggerResponseEvents(this._response, items);\n case 6:\n return _context.abrupt(\"return\", items);\n case 7:\n case \"end\":\n return _context.stop();\n }\n }, _callee, this);\n }));\n function index() {\n return _index.apply(this, arguments);\n }\n return index;\n }()\n /**\n * Get a single model.\n *\n * @param {int} [identifier]\n *\n * @returns {this} Model found for the given id.\n */\n }, {\n key: \"show\",\n value: function () {\n var _show = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(identifier) {\n var _identifier;\n var item;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n (_identifier = identifier) !== null && _identifier !== void 0 ? _identifier : identifier = this._identifier;\n if (identifier) {\n _context2.next = 3;\n break;\n }\n return _context2.abrupt(\"return\", null);\n case 3:\n _context2.next = 5;\n return this._connection.get(this._queryString(identifier), this.bodyParameters);\n case 5:\n this._response = _context2.sent;\n if (this._response.data) {\n item = this.constructor.fromJson(this._response.data);\n }\n _context2.next = 9;\n return this.triggerResponseEvents(this._response, item);\n case 9:\n return _context2.abrupt(\"return\", item);\n case 10:\n case \"end\":\n return _context2.stop();\n }\n }, _callee2, this);\n }));\n function show(_x) {\n return _show.apply(this, arguments);\n }\n return show;\n }()\n /**\n * Create an model.\n *\n * @param {Object} [extraData] Extra data to send to the API\n *\n * @returns {this} The created model.\n */\n }, {\n key: \"store\",\n value: function () {\n var _store = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n var extraData,\n item,\n _args3 = arguments;\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) switch (_context3.prev = _context3.next) {\n case 0:\n extraData = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {};\n _context3.next = 3;\n return this._connection.post(this._queryString(), _objectSpread(_objectSpread({}, this._attributes.toJson()), extraData));\n case 3:\n this._response = _context3.sent;\n if (this._response.data) {\n item = this.constructor.fromJson(this._response.data);\n }\n _context3.next = 7;\n return this.triggerResponseEvents(this._response, item);\n case 7:\n return _context3.abrupt(\"return\", item);\n case 8:\n case \"end\":\n return _context3.stop();\n }\n }, _callee3, this);\n }));\n function store() {\n return _store.apply(this, arguments);\n }\n return store;\n }()\n /**\n * Update the current model.\n *\n * @param {Object} [extraData] Extra data to send to the API\n *\n * @returns {this} The updated model.\n */\n }, {\n key: \"update\",\n value: function () {\n var _update = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n var extraData,\n item,\n _args4 = arguments;\n return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n while (1) switch (_context4.prev = _context4.next) {\n case 0:\n extraData = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {};\n _context4.next = 3;\n return this._connection.put(this._queryString(this._identifier), _objectSpread(_objectSpread({}, this._attributes.toJson()), extraData));\n case 3:\n this._response = _context4.sent;\n if (this._response.data) {\n item = this.constructor.fromJson(this._response.data);\n }\n _context4.next = 7;\n return this.triggerResponseEvents(this._response, item);\n case 7:\n return _context4.abrupt(\"return\", item);\n case 8:\n case \"end\":\n return _context4.stop();\n }\n }, _callee4, this);\n }));\n function update() {\n return _update.apply(this, arguments);\n }\n return update;\n }()\n /**\n * Delete the current model.\n *\n * @returns {boolean} Whether the deletion was successful.\n */\n }, {\n key: \"destroy\",\n value: function () {\n var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n while (1) switch (_context5.prev = _context5.next) {\n case 0:\n _context5.next = 2;\n return this._connection[\"delete\"](this._queryString(this._identifier));\n case 2:\n this._response = _context5.sent;\n _context5.next = 5;\n return this.triggerResponseEvents(this._response);\n case 5:\n return _context5.abrupt(\"return\", !!this._response.data);\n case 6:\n case \"end\":\n return _context5.stop();\n }\n }, _callee5, this);\n }));\n function destroy() {\n return _destroy.apply(this, arguments);\n }\n return destroy;\n }()\n /**\n * Save the current model. Based on the value of the identifier `store` or `update` will be called.\n *\n * @param {Object} [extraData] Extra data to send to the API\n *\n * @returns {this} The created or updated model.\n */\n }, {\n key: \"save\",\n value: function () {\n var _save = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {\n var extraData,\n _args6 = arguments;\n return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n while (1) switch (_context6.prev = _context6.next) {\n case 0:\n extraData = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {};\n return _context6.abrupt(\"return\", !this._identifier ? this.store(extraData) : this.update(extraData));\n case 2:\n case \"end\":\n return _context6.stop();\n }\n }, _callee6, this);\n }));\n function save() {\n return _save.apply(this, arguments);\n }\n return save;\n }()\n /**\n * @returns {this} The new clone of the current model.\n */\n }, {\n key: \"clone\",\n value: function clone() {\n return this.constructor.fromJson(this.toJson());\n }\n\n /**\n * Generate the query string for this model.\n * @private\n *\n * @param {int} [identifier] The identifier of the model.\n *\n * @returns {string} The querystring for the model.\n */\n }, {\n key: \"_queryString\",\n value: function _queryString(identifier) {\n return this.constructor.endpoint + (identifier ? \"/\".concat(identifier) : '');\n }\n }], [{\n key: \"fromJson\",\n value: function fromJson(json) {\n var instance = new this();\n instance._accessors.fromJson(json);\n instance._attributes.fromJson(json);\n instance._counts.fromJson(json);\n instance._relations.fromJson(json);\n return instance;\n }\n }, {\n key: \"accessors\",\n value: function accessors() {\n return {};\n }\n\n /**\n * The attributes of the model.\n *\n * @returns {Object.<any, Object>}\n */\n }, {\n key: \"attributes\",\n value: function attributes() {\n return {};\n }\n\n /**\n * The counts of relations of the model.\n *\n * @returns {Object.<any, Object>}\n */\n }, {\n key: \"counts\",\n value: function counts() {\n return {};\n }\n\n /**\n * The relations of the model.\n *\n * @returns {Object.<any, Object>}\n */\n }, {\n key: \"relations\",\n value: function relations() {\n return {};\n }\n\n /**\n * @returns {string} Endpoint of the model for the API.\n */\n }, {\n key: \"endpoint\",\n get: function get() {\n throw new Error('No endpoint defined in the model.');\n }\n }]);\n return Model;\n}(_request__WEBPACK_IMPORTED_MODULE_4__[\"default\"]);\n\n\n//# sourceURL=webpack://Api/./src/builder/model.js?");
62
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ Model)\n/* harmony export */ });\n/* harmony import */ var _properties_accessors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./properties/accessors */ \"./src/builder/properties/accessors.js\");\n/* harmony import */ var _properties_attributes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./properties/attributes */ \"./src/builder/properties/attributes.js\");\n/* harmony import */ var _properties_counts__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./properties/counts */ \"./src/builder/properties/counts.js\");\n/* harmony import */ var _properties_relations__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./properties/relations */ \"./src/builder/properties/relations.js\");\n/* harmony import */ var _request__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../request */ \"./src/request.js\");\n/* provided dependency */ var _ = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nfunction _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); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _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; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _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); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _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); }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n\n\n\n\nvar Model = /*#__PURE__*/function (_Request) {\n _inherits(Model, _Request);\n var _super = _createSuper(Model);\n function Model() {\n var _this;\n var defaults = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, Model);\n _this = _super.call(this);\n _this._accessors = new _properties_accessors__WEBPACK_IMPORTED_MODULE_0__[\"default\"](_assertThisInitialized(_this));\n _this._attributes = new _properties_attributes__WEBPACK_IMPORTED_MODULE_1__[\"default\"](_assertThisInitialized(_this));\n _this._counts = new _properties_counts__WEBPACK_IMPORTED_MODULE_2__[\"default\"](_assertThisInitialized(_this));\n _this._relations = new _properties_relations__WEBPACK_IMPORTED_MODULE_3__[\"default\"](_assertThisInitialized(_this));\n _this.setApi(api);\n _this.fill(defaults);\n return _this;\n }\n\n /**\n * Create an instance of the model for the given json object.\n *\n * @param {Object} json\n *\n * @returns {this} An instance of the model.\n */\n _createClass(Model, [{\n key: \"toJson\",\n value:\n /**\n * Convert the attributes of the current instance to json.\n *\n * @return {Object} The attributes of the current instance as json object.\n */\n function toJson() {\n return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, this._accessors.toJson()), this._attributes.toJson()), this._counts.toJson()), this._relations.toJson());\n }\n\n /**\n * @param values\n * @returns {this}\n */\n }, {\n key: \"fill\",\n value: function fill() {\n var values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n this._attributes.set(values);\n this._relations.set(values);\n return this;\n }\n\n /**\n * The accessors of the model which were appended on the api side.\n *\n * @returns {Object.<any, Object>}\n */\n }, {\n key: \"_identifier\",\n get:\n /**\n * @returns {int} Identifier attribute name of the model.\n */\n function get() {\n return _.get(this, 'id');\n }\n\n /**\n * Get a list of models.\n *\n * @returns {this[]} List of models.\n */\n }, {\n key: \"index\",\n value: function () {\n var _index = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n var _this2 = this;\n var items;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n _context.next = 2;\n return this._connection.get(this._queryString(), this.bodyParameters);\n case 2:\n this._response = _context.sent;\n if (this._response.data) {\n items = _.map(this._response.data.items, function (item) {\n return _this2.constructor.fromJson(item);\n });\n }\n _context.next = 6;\n return this.triggerResponseEvents(this._response, items);\n case 6:\n return _context.abrupt(\"return\", items);\n case 7:\n case \"end\":\n return _context.stop();\n }\n }, _callee, this);\n }));\n function index() {\n return _index.apply(this, arguments);\n }\n return index;\n }()\n /**\n * Get a single model.\n *\n * @param {int} [identifier]\n *\n * @returns {this} Model found for the given id.\n */\n }, {\n key: \"show\",\n value: function () {\n var _show = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(identifier) {\n var _identifier;\n var item;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n (_identifier = identifier) !== null && _identifier !== void 0 ? _identifier : identifier = this._identifier;\n if (identifier) {\n _context2.next = 3;\n break;\n }\n return _context2.abrupt(\"return\", null);\n case 3:\n _context2.next = 5;\n return this._connection.get(this._queryString(identifier), this.bodyParameters);\n case 5:\n this._response = _context2.sent;\n if (this._response.data) {\n item = this.constructor.fromJson(this._response.data);\n }\n _context2.next = 9;\n return this.triggerResponseEvents(this._response, item);\n case 9:\n return _context2.abrupt(\"return\", item);\n case 10:\n case \"end\":\n return _context2.stop();\n }\n }, _callee2, this);\n }));\n function show(_x) {\n return _show.apply(this, arguments);\n }\n return show;\n }()\n /**\n * Create an model.\n *\n * @param {Object} [extraData] Extra data to send to the API\n *\n * @returns {this} The created model.\n */\n }, {\n key: \"store\",\n value: function () {\n var _store = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n var extraData,\n item,\n _args3 = arguments;\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) switch (_context3.prev = _context3.next) {\n case 0:\n extraData = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {};\n _context3.next = 3;\n return this._connection.post(this._queryString(), _objectSpread(_objectSpread({}, this._attributes.toJson()), extraData));\n case 3:\n this._response = _context3.sent;\n if (this._response.data) {\n item = this.constructor.fromJson(this._response.data);\n }\n _context3.next = 7;\n return this.triggerResponseEvents(this._response, item);\n case 7:\n return _context3.abrupt(\"return\", item);\n case 8:\n case \"end\":\n return _context3.stop();\n }\n }, _callee3, this);\n }));\n function store() {\n return _store.apply(this, arguments);\n }\n return store;\n }()\n /**\n * Update the current model.\n *\n * @param {Object} [extraData] Extra data to send to the API\n *\n * @returns {this} The updated model.\n */\n }, {\n key: \"update\",\n value: function () {\n var _update = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n var extraData,\n item,\n _args4 = arguments;\n return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n while (1) switch (_context4.prev = _context4.next) {\n case 0:\n extraData = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {};\n _context4.next = 3;\n return this._connection.put(this._queryString(this._identifier), _objectSpread(_objectSpread({}, this._attributes.toJson()), extraData));\n case 3:\n this._response = _context4.sent;\n if (this._response.data) {\n item = this.constructor.fromJson(this._response.data);\n }\n _context4.next = 7;\n return this.triggerResponseEvents(this._response, item);\n case 7:\n return _context4.abrupt(\"return\", item);\n case 8:\n case \"end\":\n return _context4.stop();\n }\n }, _callee4, this);\n }));\n function update() {\n return _update.apply(this, arguments);\n }\n return update;\n }()\n /**\n * Delete the current model.\n *\n * @returns {boolean} Whether the deletion was successful.\n */\n }, {\n key: \"destroy\",\n value: function () {\n var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n while (1) switch (_context5.prev = _context5.next) {\n case 0:\n _context5.next = 2;\n return this._connection[\"delete\"](this._queryString(this._identifier));\n case 2:\n this._response = _context5.sent;\n _context5.next = 5;\n return this.triggerResponseEvents(this._response);\n case 5:\n return _context5.abrupt(\"return\", !!this._response.data);\n case 6:\n case \"end\":\n return _context5.stop();\n }\n }, _callee5, this);\n }));\n function destroy() {\n return _destroy.apply(this, arguments);\n }\n return destroy;\n }()\n /**\n * Save the current model. Based on the value of the identifier `store` or `update` will be called.\n *\n * @param {Object} [extraData] Extra data to send to the API\n *\n * @returns {this} The created or updated model.\n */\n }, {\n key: \"save\",\n value: function () {\n var _save = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {\n var extraData,\n _args6 = arguments;\n return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n while (1) switch (_context6.prev = _context6.next) {\n case 0:\n extraData = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {};\n return _context6.abrupt(\"return\", !this._identifier ? this.store(extraData) : this.update(extraData));\n case 2:\n case \"end\":\n return _context6.stop();\n }\n }, _callee6, this);\n }));\n function save() {\n return _save.apply(this, arguments);\n }\n return save;\n }()\n /**\n * @returns {this} The new clone of the current model.\n */\n }, {\n key: \"clone\",\n value: function clone() {\n return this.constructor.fromJson(this.toJson());\n }\n\n /**\n * Generate the query string for this model.\n * @private\n *\n * @param {int} [identifier] The identifier of the model.\n *\n * @returns {string} The querystring for the model.\n */\n }, {\n key: \"_queryString\",\n value: function _queryString(identifier) {\n return this.constructor.endpoint + (identifier ? \"/\".concat(identifier) : '');\n }\n }], [{\n key: \"fromJson\",\n value: function fromJson(json) {\n var instance = new this();\n instance._accessors.fromJson(json);\n instance._attributes.fromJson(json);\n instance._counts.fromJson(json);\n instance._relations.fromJson(json);\n return instance;\n }\n }, {\n key: \"accessors\",\n value: function accessors() {\n return {};\n }\n\n /**\n * The attributes of the model.\n *\n * @returns {Object.<any, Object>}\n */\n }, {\n key: \"attributes\",\n value: function attributes() {\n return {};\n }\n\n /**\n * The counts of relations of the model.\n *\n * @returns {Object.<any, Object>}\n */\n }, {\n key: \"counts\",\n value: function counts() {\n return {};\n }\n\n /**\n * The relations of the model.\n *\n * @returns {Object.<any, Object>}\n */\n }, {\n key: \"relations\",\n value: function relations() {\n return {};\n }\n\n /**\n * @returns {string} Endpoint of the model for the API.\n */\n }, {\n key: \"endpoint\",\n get: function get() {\n throw new Error('No endpoint defined in the model.');\n }\n }]);\n return Model;\n}(_request__WEBPACK_IMPORTED_MODULE_4__[\"default\"]);\n\n\n//# sourceURL=webpack://Api/./src/builder/model.js?");
63
63
 
64
64
  /***/ }),
65
65
 
@@ -70,7 +70,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
70
70
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
71
71
 
72
72
  "use strict";
73
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ Accessors)\n/* harmony export */ });\n/* harmony import */ var _caster__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../caster */ \"./src/builder/caster.js\");\n/* provided dependency */ var _ = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nfunction _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); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _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); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _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); }\n\n\n/**\n * @implements {Property}\n */\nvar Accessors = /*#__PURE__*/function () {\n /**\n * @param {Model} model Instance of the model.\n */\n function Accessors(model) {\n var _this = this;\n _classCallCheck(this, Accessors);\n this.model = model;\n _.each(model.constructor.accessors(), function (options, key) {\n _this.set(key, _.has(options, 'default') ? options[\"default\"] : null);\n });\n }\n\n /**\n * @param {Object} json.\n */\n _createClass(Accessors, [{\n key: \"fromJson\",\n value: function fromJson(json) {\n var _this2 = this;\n _.each(this.model.constructor.accessors(), function (options, key) {\n var _options$jsonKey;\n var value = _.get(json, (_options$jsonKey = options.jsonKey) !== null && _options$jsonKey !== void 0 ? _options$jsonKey : _.snakeCase(key), _.get(json, _.camelCase(key)));\n if (_.isNil(value)) {\n value = _.has(options, 'default') ? options[\"default\"] : null;\n } else {\n value = Accessors._getCastedFromJsonValue(value, options);\n }\n _this2.set(key, value);\n });\n }\n\n /**\n * @return {Object} The attributes casted to a json object.\n */\n }, {\n key: \"toJson\",\n value: function toJson() {\n var _this3 = this;\n var json = {};\n _.each(this.model.constructor.accessors(), function (options, key) {\n var _options$jsonKey2;\n var jsonValue = _this3.get(key);\n jsonValue = Accessors._getCastedToJsonValue(jsonValue, options);\n _.set(json, (_options$jsonKey2 = options.jsonKey) !== null && _options$jsonKey2 !== void 0 ? _options$jsonKey2 : _.snakeCase(key), jsonValue);\n });\n return json;\n }\n\n /**\n * @param {string} attribute\n *\n * @returns {*} The value of the attribute.\n */\n }, {\n key: \"get\",\n value: function get(attribute) {\n return _.get(this.model, attribute);\n }\n\n /**\n * @param {string} attribute\n * @param {*} value\n *\n * @returns {*} The value that was set.\n */\n }, {\n key: \"set\",\n value: function set(attribute, value) {\n this.model[attribute] = value;\n return value;\n }\n\n /**\n * @private\n *\n * @param {*} value\n * @param {Object} options\n *\n * @returns {*} The casted value.\n */\n }], [{\n key: \"_getCastedFromJsonValue\",\n value: function _getCastedFromJsonValue(value, options) {\n if (_.has(options, 'type') || _.has(options, 'fromJson')) {\n var cast = options.type ? options.type : options.fromJson;\n if (_.isArray(value)) {\n return _.map(value, function (val) {\n return _caster__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromJson(cast, val);\n });\n } else {\n return _caster__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromJson(cast, value);\n }\n }\n return value;\n }\n\n /**\n * @private\n *\n * @param {*} value\n * @param {Object} options\n *\n * @returns {*} The casted value.\n */\n }, {\n key: \"_getCastedToJsonValue\",\n value: function _getCastedToJsonValue(value, options) {\n if (_.has(options, 'type') || _.has(options, 'toJson')) {\n var cast = options.type ? options.type : options.toJson;\n if (_.isArray(value)) {\n return _.map(value, function (val) {\n return _caster__WEBPACK_IMPORTED_MODULE_0__[\"default\"].toJson(cast, val);\n });\n } else {\n return _caster__WEBPACK_IMPORTED_MODULE_0__[\"default\"].toJson(cast, value);\n }\n }\n return value;\n }\n }]);\n return Accessors;\n}();\n\n\n//# sourceURL=webpack://Api/./src/builder/properties/accessors.js?");
73
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ Accessors)\n/* harmony export */ });\n/* harmony import */ var _caster__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../caster */ \"./src/builder/caster.js\");\n/* provided dependency */ var _ = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nfunction _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); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _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); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _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); }\nfunction _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }\nfunction _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); } }\nfunction _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"get\"); return _classApplyDescriptorGet(receiver, descriptor); }\nfunction _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }\nfunction _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"set\"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }\nfunction _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError(\"attempted to \" + action + \" private field on non-instance\"); } return privateMap.get(receiver); }\nfunction _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; } }\n\n\n/**\n * @implements {Property}\n */\nvar _model = /*#__PURE__*/new WeakMap();\nvar Accessors = /*#__PURE__*/function () {\n /**\n * @param {Model} model Instance of the model.\n */\n function Accessors(model) {\n var _this = this;\n _classCallCheck(this, Accessors);\n _classPrivateFieldInitSpec(this, _model, {\n writable: true,\n value: void 0\n });\n _classPrivateFieldSet(this, _model, model);\n _.each(model.constructor.accessors(), function (options, key) {\n _this.set(key, _.has(options, 'default') ? options[\"default\"] : null);\n });\n }\n\n /**\n * @param {Object} json.\n */\n _createClass(Accessors, [{\n key: \"fromJson\",\n value: function fromJson(json) {\n var _this2 = this;\n _.each(_classPrivateFieldGet(this, _model).constructor.accessors(), function (options, key) {\n var _options$jsonKey;\n var value = _.get(json, (_options$jsonKey = options.jsonKey) !== null && _options$jsonKey !== void 0 ? _options$jsonKey : _.snakeCase(key), _.get(json, _.camelCase(key)));\n if (_.isNil(value)) {\n value = _.has(options, 'default') ? options[\"default\"] : null;\n } else {\n value = Accessors._getCastedFromJsonValue(value, options);\n }\n _this2.set(key, value);\n });\n }\n\n /**\n * @return {Object} The attributes casted to a json object.\n */\n }, {\n key: \"toJson\",\n value: function toJson() {\n var _this3 = this;\n var json = {};\n _.each(_classPrivateFieldGet(this, _model).constructor.accessors(), function (options, key) {\n var _options$jsonKey2;\n var jsonValue = _this3.get(key);\n jsonValue = Accessors._getCastedToJsonValue(jsonValue, options);\n _.set(json, (_options$jsonKey2 = options.jsonKey) !== null && _options$jsonKey2 !== void 0 ? _options$jsonKey2 : _.snakeCase(key), jsonValue);\n });\n return json;\n }\n\n /**\n * @param {string} attribute\n *\n * @returns {*} The value of the attribute.\n */\n }, {\n key: \"get\",\n value: function get(attribute) {\n return _.get(_classPrivateFieldGet(this, _model), attribute);\n }\n\n /**\n * @param {string} attribute\n * @param {*} value\n *\n * @returns {*} The value that was set.\n */\n }, {\n key: \"set\",\n value: function set(attribute, value) {\n _classPrivateFieldGet(this, _model)[attribute] = value;\n return value;\n }\n\n /**\n * @private\n *\n * @param {*} value\n * @param {Object} options\n *\n * @returns {*} The casted value.\n */\n }], [{\n key: \"_getCastedFromJsonValue\",\n value: function _getCastedFromJsonValue(value, options) {\n if (_.has(options, 'type') || _.has(options, 'fromJson')) {\n var cast = options.type ? options.type : options.fromJson;\n if (_.isArray(value)) {\n return _.map(value, function (val) {\n return _caster__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromJson(cast, val);\n });\n } else {\n return _caster__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromJson(cast, value);\n }\n }\n return value;\n }\n\n /**\n * @private\n *\n * @param {*} value\n * @param {Object} options\n *\n * @returns {*} The casted value.\n */\n }, {\n key: \"_getCastedToJsonValue\",\n value: function _getCastedToJsonValue(value, options) {\n if (_.has(options, 'type') || _.has(options, 'toJson')) {\n var cast = options.type ? options.type : options.toJson;\n if (_.isArray(value)) {\n return _.map(value, function (val) {\n return _caster__WEBPACK_IMPORTED_MODULE_0__[\"default\"].toJson(cast, val);\n });\n } else {\n return _caster__WEBPACK_IMPORTED_MODULE_0__[\"default\"].toJson(cast, value);\n }\n }\n return value;\n }\n }]);\n return Accessors;\n}();\n\n\n//# sourceURL=webpack://Api/./src/builder/properties/accessors.js?");
74
74
 
75
75
  /***/ }),
76
76
 
@@ -81,7 +81,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
81
81
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
82
82
 
83
83
  "use strict";
84
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ Attributes)\n/* harmony export */ });\n/* harmony import */ var _caster__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../caster */ \"./src/builder/caster.js\");\n/* provided dependency */ var _ = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nfunction _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); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _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); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _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); }\n\n\n/**\n * @implements {Property}\n */\nvar Attributes = /*#__PURE__*/function () {\n /**\n * @param {Model} model Instance of the model.\n */\n function Attributes(model) {\n var _this = this;\n _classCallCheck(this, Attributes);\n this.model = model;\n _.each(model.constructor.attributes(), function (options, key) {\n _this.set(key, _.has(options, 'default') ? options[\"default\"] : null);\n });\n }\n\n /**\n * @param {Object} json.\n */\n _createClass(Attributes, [{\n key: \"fromJson\",\n value: function fromJson(json) {\n var _this2 = this;\n _.each(this.model.constructor.attributes(), function (options, key) {\n var _options$jsonKey;\n var value = _.get(json, (_options$jsonKey = options.jsonKey) !== null && _options$jsonKey !== void 0 ? _options$jsonKey : _.snakeCase(key), _.get(json, _.camelCase(key)));\n if (_.isNil(value)) {\n value = _.has(options, 'default') ? options[\"default\"] : null;\n } else {\n value = Attributes._getCastedFromJsonValue(value, options);\n }\n _this2.set(key, value);\n });\n }\n\n /**\n * @return {Object} The attributes casted to a json object.\n */\n }, {\n key: \"toJson\",\n value: function toJson() {\n var _this3 = this;\n var json = {};\n _.each(this.model.constructor.attributes(), function (options, key) {\n var _options$jsonKey2;\n var jsonValue = _this3.get(key);\n jsonValue = Attributes._getCastedToJsonValue(jsonValue, options);\n _.set(json, (_options$jsonKey2 = options.jsonKey) !== null && _options$jsonKey2 !== void 0 ? _options$jsonKey2 : _.snakeCase(key), jsonValue);\n });\n return json;\n }\n\n /**\n * @param {string} attribute\n *\n * @returns {*} The value of the attribute.\n */\n }, {\n key: \"get\",\n value: function get(attribute) {\n return _.get(this.model, attribute);\n }\n\n /**\n * @param {string|Object} attribute\n * @param {*} value\n *\n * @returns {Attributes}\n */\n }, {\n key: \"set\",\n value: function set(attribute) {\n var _this4 = this;\n var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n if (_.isObject(attribute)) {\n _.each(this.model.constructor.attributes(), function (options, key) {\n if (!_.has(attribute, key)) return;\n _this4.set(key, attribute[key]);\n });\n return this;\n }\n this.model[attribute] = value;\n return this;\n }\n\n /**\n * @private\n *\n * @param {*} value\n * @param {Object} options\n *\n * @returns {*} The casted value.\n */\n }], [{\n key: \"_getCastedFromJsonValue\",\n value: function _getCastedFromJsonValue(value, options) {\n if (_.has(options, 'type') || _.has(options, 'fromJson')) {\n var cast = options.type ? options.type : options.fromJson;\n return _caster__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromJson(cast, value);\n }\n return value;\n }\n\n /**\n * @private\n *\n * @param {*} value\n * @param {Object} options\n *\n * @returns {*} The casted value.\n */\n }, {\n key: \"_getCastedToJsonValue\",\n value: function _getCastedToJsonValue(value, options) {\n if (_.has(options, 'type') || _.has(options, 'toJson')) {\n var cast = options.type ? options.type : options.toJson;\n return _caster__WEBPACK_IMPORTED_MODULE_0__[\"default\"].toJson(cast, value);\n }\n return value;\n }\n }]);\n return Attributes;\n}();\n\n\n//# sourceURL=webpack://Api/./src/builder/properties/attributes.js?");
84
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ Attributes)\n/* harmony export */ });\n/* harmony import */ var _caster__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../caster */ \"./src/builder/caster.js\");\n/* provided dependency */ var _ = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nfunction _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); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _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); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _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); }\nfunction _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }\nfunction _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); } }\nfunction _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"get\"); return _classApplyDescriptorGet(receiver, descriptor); }\nfunction _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }\nfunction _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"set\"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }\nfunction _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError(\"attempted to \" + action + \" private field on non-instance\"); } return privateMap.get(receiver); }\nfunction _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; } }\n\n\n/**\n * @implements {Property}\n */\nvar _model = /*#__PURE__*/new WeakMap();\nvar Attributes = /*#__PURE__*/function () {\n /**\n * @param {Model} model Instance of the model.\n */\n function Attributes(model) {\n var _this = this;\n _classCallCheck(this, Attributes);\n _classPrivateFieldInitSpec(this, _model, {\n writable: true,\n value: void 0\n });\n _classPrivateFieldSet(this, _model, model);\n _.each(model.constructor.attributes(), function (options, key) {\n _this.set(key, _.has(options, 'default') ? options[\"default\"] : null);\n });\n }\n\n /**\n * @param {Object} json.\n */\n _createClass(Attributes, [{\n key: \"fromJson\",\n value: function fromJson(json) {\n var _this2 = this;\n _.each(_classPrivateFieldGet(this, _model).constructor.attributes(), function (options, key) {\n var _options$jsonKey;\n var value = _.get(json, (_options$jsonKey = options.jsonKey) !== null && _options$jsonKey !== void 0 ? _options$jsonKey : _.snakeCase(key), _.get(json, _.camelCase(key)));\n if (_.isNil(value)) {\n value = _.has(options, 'default') ? options[\"default\"] : null;\n } else {\n value = Attributes._getCastedFromJsonValue(value, options);\n }\n _this2.set(key, value);\n });\n }\n\n /**\n * @return {Object} The attributes casted to a json object.\n */\n }, {\n key: \"toJson\",\n value: function toJson() {\n var _this3 = this;\n var json = {};\n _.each(_classPrivateFieldGet(this, _model).constructor.attributes(), function (options, key) {\n var _options$jsonKey2;\n var jsonValue = _this3.get(key);\n jsonValue = Attributes._getCastedToJsonValue(jsonValue, options);\n _.set(json, (_options$jsonKey2 = options.jsonKey) !== null && _options$jsonKey2 !== void 0 ? _options$jsonKey2 : _.snakeCase(key), jsonValue);\n });\n return json;\n }\n\n /**\n * @param {string} attribute\n *\n * @returns {*} The value of the attribute.\n */\n }, {\n key: \"get\",\n value: function get(attribute) {\n return _.get(_classPrivateFieldGet(this, _model), attribute);\n }\n\n /**\n * @param {string|Object} attribute\n * @param {*} value\n *\n * @returns {Attributes}\n */\n }, {\n key: \"set\",\n value: function set(attribute) {\n var _this4 = this;\n var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n if (_.isObject(attribute)) {\n _.each(_classPrivateFieldGet(this, _model).constructor.attributes(), function (options, key) {\n if (!_.has(attribute, key)) return;\n _this4.set(key, attribute[key]);\n });\n return this;\n }\n _classPrivateFieldGet(this, _model)[attribute] = value;\n return this;\n }\n\n /**\n * @private\n *\n * @param {*} value\n * @param {Object} options\n *\n * @returns {*} The casted value.\n */\n }], [{\n key: \"_getCastedFromJsonValue\",\n value: function _getCastedFromJsonValue(value, options) {\n if (_.has(options, 'type') || _.has(options, 'fromJson')) {\n var cast = options.type ? options.type : options.fromJson;\n return _caster__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromJson(cast, value);\n }\n return value;\n }\n\n /**\n * @private\n *\n * @param {*} value\n * @param {Object} options\n *\n * @returns {*} The casted value.\n */\n }, {\n key: \"_getCastedToJsonValue\",\n value: function _getCastedToJsonValue(value, options) {\n if (_.has(options, 'type') || _.has(options, 'toJson')) {\n var cast = options.type ? options.type : options.toJson;\n return _caster__WEBPACK_IMPORTED_MODULE_0__[\"default\"].toJson(cast, value);\n }\n return value;\n }\n }]);\n return Attributes;\n}();\n\n\n//# sourceURL=webpack://Api/./src/builder/properties/attributes.js?");
85
85
 
86
86
  /***/ }),
87
87
 
@@ -92,7 +92,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
92
92
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
93
93
 
94
94
  "use strict";
95
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ Counts)\n/* harmony export */ });\n/* provided dependency */ var _ = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nfunction _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); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _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); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _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); }\n/**\n * @implements {Property}\n */\nvar Counts = /*#__PURE__*/function () {\n /**\n * @param {Model} model Instance of the model.\n */\n function Counts(model) {\n var _this = this;\n _classCallCheck(this, Counts);\n this.model = model;\n _.each(model.constructor.counts(), function (options, key) {\n _this.set(_this.key(key, true), _.has(options, 'default') ? options[\"default\"] : null);\n });\n }\n\n /**\n * @param {Object} json.\n */\n _createClass(Counts, [{\n key: \"fromJson\",\n value: function fromJson(json) {\n var _this2 = this;\n _.each(this.model.constructor.counts(), function (options, key) {\n var value = _.get(json, _this2.key(key));\n value = value !== undefined ? _.toInteger(value) : null;\n _this2.set(_this2.key(key, true), value);\n });\n }\n\n /**\n * @return {Object} The attributes casted to a json object.\n */\n }, {\n key: \"toJson\",\n value: function toJson() {\n var _this3 = this;\n var json = {};\n _.each(this.model.constructor.counts(), function (options, key) {\n _.set(json, key, _this3.get(key));\n });\n return json;\n }\n\n /**\n * @param {string} attribute\n *\n * @returns {*} The value of the attribute.\n */\n }, {\n key: \"get\",\n value: function get(attribute) {\n return _.get(this.model, this.key(attribute, true));\n }\n\n /**\n * @param {string} attribute\n * @param {*} value\n *\n * @returns {*} The value that was set.\n */\n }, {\n key: \"set\",\n value: function set(attribute, value) {\n this.model[this.key(attribute, true)] = value;\n return value;\n }\n\n /**\n * @param {string} key\n * @param {boolean} camelCase\n * @returns {string} The key with `count` appended to it, in specified casing.\n */\n }, {\n key: \"key\",\n value: function key(_key) {\n var camelCase = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n _key = _.snakeCase(_key);\n if (!_.endsWith(_key, '_count')) {\n _key = \"\".concat(_key, \"_count\");\n }\n return camelCase ? _.camelCase(_key) : _key;\n }\n }]);\n return Counts;\n}();\n\n\n//# sourceURL=webpack://Api/./src/builder/properties/counts.js?");
95
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ Counts)\n/* harmony export */ });\n/* provided dependency */ var _ = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nfunction _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); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _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); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _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); }\nfunction _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }\nfunction _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); } }\nfunction _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"get\"); return _classApplyDescriptorGet(receiver, descriptor); }\nfunction _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }\nfunction _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"set\"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }\nfunction _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError(\"attempted to \" + action + \" private field on non-instance\"); } return privateMap.get(receiver); }\nfunction _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; } }\nvar _model = /*#__PURE__*/new WeakMap();\n/**\n * @implements {Property}\n */\nvar Counts = /*#__PURE__*/function () {\n /**\n * @param {Model} model Instance of the model.\n */\n function Counts(model) {\n var _this = this;\n _classCallCheck(this, Counts);\n _classPrivateFieldInitSpec(this, _model, {\n writable: true,\n value: void 0\n });\n _classPrivateFieldSet(this, _model, model);\n _.each(model.constructor.counts(), function (options, key) {\n _this.set(_this.key(key, true), _.has(options, 'default') ? options[\"default\"] : null);\n });\n }\n\n /**\n * @param {Object} json.\n */\n _createClass(Counts, [{\n key: \"fromJson\",\n value: function fromJson(json) {\n var _this2 = this;\n _.each(_classPrivateFieldGet(this, _model).constructor.counts(), function (options, key) {\n var value = _.get(json, _this2.key(key));\n value = value !== undefined ? _.toInteger(value) : null;\n _this2.set(_this2.key(key, true), value);\n });\n }\n\n /**\n * @return {Object} The attributes casted to a json object.\n */\n }, {\n key: \"toJson\",\n value: function toJson() {\n var _this3 = this;\n var json = {};\n _.each(_classPrivateFieldGet(this, _model).constructor.counts(), function (options, key) {\n _.set(json, key, _this3.get(key));\n });\n return json;\n }\n\n /**\n * @param {string} attribute\n *\n * @returns {*} The value of the attribute.\n */\n }, {\n key: \"get\",\n value: function get(attribute) {\n return _.get(_classPrivateFieldGet(this, _model), this.key(attribute, true));\n }\n\n /**\n * @param {string} attribute\n * @param {*} value\n *\n * @returns {*} The value that was set.\n */\n }, {\n key: \"set\",\n value: function set(attribute, value) {\n _classPrivateFieldGet(this, _model)[this.key(attribute, true)] = value;\n return value;\n }\n\n /**\n * @param {string} key\n * @param {boolean} camelCase\n * @returns {string} The key with `count` appended to it, in specified casing.\n */\n }, {\n key: \"key\",\n value: function key(_key) {\n var camelCase = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n _key = _.snakeCase(_key);\n if (!_.endsWith(_key, '_count')) {\n _key = \"\".concat(_key, \"_count\");\n }\n return camelCase ? _.camelCase(_key) : _key;\n }\n }]);\n return Counts;\n}();\n\n\n//# sourceURL=webpack://Api/./src/builder/properties/counts.js?");
96
96
 
97
97
  /***/ }),
98
98
 
@@ -103,7 +103,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
103
103
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
104
104
 
105
105
  "use strict";
106
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ Relations)\n/* harmony export */ });\n/* harmony import */ var _caster__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../caster */ \"./src/builder/caster.js\");\n/* provided dependency */ var _ = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nfunction _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); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _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); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _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); }\n\n\n/**\n * @implements {Property}\n */\nvar Relations = /*#__PURE__*/function () {\n /**\n * @param {Model} model Instance of the model.\n */\n function Relations(model) {\n var _this = this;\n _classCallCheck(this, Relations);\n this.model = model;\n _.each(model.constructor.relations(), function (options, key) {\n _this.set(key, _.has(options, 'default') ? options[\"default\"] : null);\n });\n }\n\n /**\n * @param {Object} json.\n */\n _createClass(Relations, [{\n key: \"fromJson\",\n value: function fromJson(json) {\n var _this2 = this;\n _.each(this.model.constructor.relations(), function (options, key) {\n var _options$jsonKey;\n var value = _.get(json, (_options$jsonKey = options.jsonKey) !== null && _options$jsonKey !== void 0 ? _options$jsonKey : _.snakeCase(key), _.get(json, _.camelCase(key)));\n value = value ? Relations._getCastedFromJsonValue(value, options) : value;\n _this2.set(key, value);\n });\n }\n\n /**\n * @return {Object} The attributes casted to a json object.\n */\n }, {\n key: \"toJson\",\n value: function toJson() {\n var _this3 = this;\n var json = {};\n _.each(this.model.constructor.relations(), function (options, key) {\n var _options$jsonKey2;\n var jsonValue = _this3.get(key);\n jsonValue = Relations._getCastedToJsonValue(jsonValue, options);\n _.set(json, (_options$jsonKey2 = options.jsonKey) !== null && _options$jsonKey2 !== void 0 ? _options$jsonKey2 : _.snakeCase(key), jsonValue);\n });\n return json;\n }\n\n /**\n * @param {string} relation\n *\n * @returns {*} The value of the relation.\n */\n }, {\n key: \"get\",\n value: function get(relation) {\n return _.get(this.model, relation);\n }\n\n /**\n * @param {string|Object} relation\n * @param {*} value\n *\n * @returns {Relations}\n */\n }, {\n key: \"set\",\n value: function set(relation) {\n var _this4 = this;\n var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n if (_.isObject(relation)) {\n _.each(this.model.constructor.relations(), function (options, key) {\n if (!_.has(relation, key)) return;\n _this4.set(key, relation[key]);\n });\n return this;\n }\n this.model[relation] = value;\n return this;\n }\n\n /**\n * @private\n *\n * @param {*} value\n * @param {Object} options\n *\n * @returns {*} The casted value.\n */\n }], [{\n key: \"_getCastedFromJsonValue\",\n value: function _getCastedFromJsonValue(value, options) {\n if (_.has(options, 'type')) {\n var cast = options.type;\n if (_.isArray(value)) {\n return _.map(value, function (val) {\n return _caster__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromJson(cast, val);\n });\n } else {\n return _caster__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromJson(cast, value);\n }\n }\n return value;\n }\n\n /**\n * @private\n *\n * @param {*} value\n * @param {Object} options\n *\n * @returns {*} The casted value.\n */\n }, {\n key: \"_getCastedToJsonValue\",\n value: function _getCastedToJsonValue(value, options) {\n if (_.has(options, 'type')) {\n var cast = options.type;\n if (_.isArray(value)) {\n return _.map(value, function (val) {\n return _caster__WEBPACK_IMPORTED_MODULE_0__[\"default\"].toJson(cast, val);\n });\n } else {\n return _caster__WEBPACK_IMPORTED_MODULE_0__[\"default\"].toJson(cast, value);\n }\n }\n return value;\n }\n }]);\n return Relations;\n}();\n\n\n//# sourceURL=webpack://Api/./src/builder/properties/relations.js?");
106
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ Relations)\n/* harmony export */ });\n/* harmony import */ var _caster__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../caster */ \"./src/builder/caster.js\");\n/* provided dependency */ var _ = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nfunction _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); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _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); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _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); }\nfunction _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }\nfunction _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError(\"Cannot initialize the same private elements twice on an object\"); } }\nfunction _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"get\"); return _classApplyDescriptorGet(receiver, descriptor); }\nfunction _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }\nfunction _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, \"set\"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }\nfunction _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError(\"attempted to \" + action + \" private field on non-instance\"); } return privateMap.get(receiver); }\nfunction _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; } }\n\n\n/**\n * @implements {Property}\n */\nvar _model = /*#__PURE__*/new WeakMap();\nvar Relations = /*#__PURE__*/function () {\n /**\n * @param {Model} model Instance of the model.\n */\n function Relations(model) {\n var _this = this;\n _classCallCheck(this, Relations);\n _classPrivateFieldInitSpec(this, _model, {\n writable: true,\n value: void 0\n });\n _classPrivateFieldSet(this, _model, model);\n _.each(model.constructor.relations(), function (options, key) {\n _this.set(key, _.has(options, 'default') ? options[\"default\"] : null);\n });\n }\n\n /**\n * @param {Object} json.\n */\n _createClass(Relations, [{\n key: \"fromJson\",\n value: function fromJson(json) {\n var _this2 = this;\n _.each(_classPrivateFieldGet(this, _model).constructor.relations(), function (options, key) {\n var _options$jsonKey;\n var value = _.get(json, (_options$jsonKey = options.jsonKey) !== null && _options$jsonKey !== void 0 ? _options$jsonKey : _.snakeCase(key), _.get(json, _.camelCase(key)));\n value = value ? Relations._getCastedFromJsonValue(value, options) : value;\n _this2.set(key, value);\n });\n }\n\n /**\n * @return {Object} The attributes casted to a json object.\n */\n }, {\n key: \"toJson\",\n value: function toJson() {\n var _this3 = this;\n var json = {};\n _.each(_classPrivateFieldGet(this, _model).constructor.relations(), function (options, key) {\n var _options$jsonKey2;\n var jsonValue = _this3.get(key);\n jsonValue = Relations._getCastedToJsonValue(jsonValue, options);\n _.set(json, (_options$jsonKey2 = options.jsonKey) !== null && _options$jsonKey2 !== void 0 ? _options$jsonKey2 : _.snakeCase(key), jsonValue);\n });\n return json;\n }\n\n /**\n * @param {string} relation\n *\n * @returns {*} The value of the relation.\n */\n }, {\n key: \"get\",\n value: function get(relation) {\n return _.get(_classPrivateFieldGet(this, _model), relation);\n }\n\n /**\n * @param {string|Object} relation\n * @param {*} value\n *\n * @returns {Relations}\n */\n }, {\n key: \"set\",\n value: function set(relation) {\n var _this4 = this;\n var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n if (_.isObject(relation)) {\n _.each(_classPrivateFieldGet(this, _model).constructor.relations(), function (options, key) {\n if (!_.has(relation, key)) return;\n _this4.set(key, relation[key]);\n });\n return this;\n }\n _classPrivateFieldGet(this, _model)[relation] = value;\n return this;\n }\n\n /**\n * @private\n *\n * @param {*} value\n * @param {Object} options\n *\n * @returns {*} The casted value.\n */\n }], [{\n key: \"_getCastedFromJsonValue\",\n value: function _getCastedFromJsonValue(value, options) {\n if (_.has(options, 'type')) {\n var cast = options.type;\n if (_.isArray(value)) {\n return _.map(value, function (val) {\n return _caster__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromJson(cast, val);\n });\n } else {\n return _caster__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fromJson(cast, value);\n }\n }\n return value;\n }\n\n /**\n * @private\n *\n * @param {*} value\n * @param {Object} options\n *\n * @returns {*} The casted value.\n */\n }, {\n key: \"_getCastedToJsonValue\",\n value: function _getCastedToJsonValue(value, options) {\n if (_.has(options, 'type')) {\n var cast = options.type;\n if (_.isArray(value)) {\n return _.map(value, function (val) {\n return _caster__WEBPACK_IMPORTED_MODULE_0__[\"default\"].toJson(cast, val);\n });\n } else {\n return _caster__WEBPACK_IMPORTED_MODULE_0__[\"default\"].toJson(cast, value);\n }\n }\n return value;\n }\n }]);\n return Relations;\n}();\n\n\n//# sourceURL=webpack://Api/./src/builder/properties/relations.js?");
107
107
 
108
108
  /***/ }),
109
109
 
@@ -114,7 +114,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
114
114
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
115
115
 
116
116
  "use strict";
117
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ Connection)\n/* harmony export */ });\n/* harmony import */ var _response__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./response */ \"./src/response.js\");\n/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! axios */ \"./node_modules/axios/lib/axios.js\");\n/* provided dependency */ var _ = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nfunction _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); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _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; }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _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); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _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); }\n\n\nvar Connection = /*#__PURE__*/function () {\n function Connection() {\n _classCallCheck(this, Connection);\n this._abortController = null;\n this._config = {};\n this._api = null;\n this.running = false;\n this.canceled = false;\n this.failed = false;\n }\n _createClass(Connection, [{\n key: \"cancel\",\n value: function cancel() {\n if (!this._abortController) return this;\n this._abortController.abort();\n this.canceled = true;\n }\n }, {\n key: \"setConfig\",\n value: function setConfig(config) {\n this._config = config;\n }\n }, {\n key: \"setApi\",\n value: function setApi(api) {\n this._api = api;\n }\n }, {\n key: \"get\",\n value: function () {\n var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(query, params) {\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n return _context.abrupt(\"return\", this._execute(query, 'get', params));\n case 1:\n case \"end\":\n return _context.stop();\n }\n }, _callee, this);\n }));\n function get(_x, _x2) {\n return _get.apply(this, arguments);\n }\n return get;\n }()\n }, {\n key: \"post\",\n value: function () {\n var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(query, data) {\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n return _context2.abrupt(\"return\", this._execute(query, 'post', data));\n case 1:\n case \"end\":\n return _context2.stop();\n }\n }, _callee2, this);\n }));\n function post(_x3, _x4) {\n return _post.apply(this, arguments);\n }\n return post;\n }()\n }, {\n key: \"put\",\n value: function () {\n var _put = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(query, params) {\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) switch (_context3.prev = _context3.next) {\n case 0:\n return _context3.abrupt(\"return\", this._execute(query, 'put', params));\n case 1:\n case \"end\":\n return _context3.stop();\n }\n }, _callee3, this);\n }));\n function put(_x5, _x6) {\n return _put.apply(this, arguments);\n }\n return put;\n }()\n }, {\n key: \"delete\",\n value: function () {\n var _delete2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(query) {\n return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n while (1) switch (_context4.prev = _context4.next) {\n case 0:\n return _context4.abrupt(\"return\", this._execute(query, 'delete'));\n case 1:\n case \"end\":\n return _context4.stop();\n }\n }, _callee4, this);\n }));\n function _delete(_x7) {\n return _delete2.apply(this, arguments);\n }\n return _delete;\n }()\n }, {\n key: \"_execute\",\n value: function () {\n var _execute2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(url, method, data) {\n var _this = this;\n var config, request, response;\n return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n while (1) switch (_context5.prev = _context5.next) {\n case 0:\n this.running = true;\n if (!_.startsWith(url, '/')) {\n url = \"/\".concat(url);\n }\n config = _objectSpread(_objectSpread({\n url: (this._api ? this._api.baseUrl : api.baseUrl) + url,\n method: method\n }, _defineProperty({}, method === 'get' ? 'params' : 'data', data)), {}, {\n signal: (this._abortController = new AbortController()).signal\n });\n request = (0,axios__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(Object.assign(config, this._config));\n response = new _response__WEBPACK_IMPORTED_MODULE_0__[\"default\"]();\n _context5.next = 7;\n return request.then(function (axiosResponse) {\n response.set(axiosResponse.status, axiosResponse);\n })[\"catch\"](function (error) {\n _this.failed = true;\n var statusCode = 0;\n if (error.response) {\n statusCode = error.response.status;\n }\n response.set(statusCode, error);\n })[\"finally\"](function () {\n _this.running = false;\n });\n case 7:\n return _context5.abrupt(\"return\", response);\n case 8:\n case \"end\":\n return _context5.stop();\n }\n }, _callee5, this);\n }));\n function _execute(_x8, _x9, _x10) {\n return _execute2.apply(this, arguments);\n }\n return _execute;\n }()\n }]);\n return Connection;\n}();\n\n\n//# sourceURL=webpack://Api/./src/connection.js?");
117
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ Connection)\n/* harmony export */ });\n/* harmony import */ var _response__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./response */ \"./src/response.js\");\n/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! axios */ \"./node_modules/axios/lib/axios.js\");\n/* provided dependency */ var _ = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nfunction _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); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _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; }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _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); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _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); }\n\n\nvar Connection = /*#__PURE__*/function () {\n function Connection() {\n _classCallCheck(this, Connection);\n this._abortController = null;\n this._config = {};\n this._api = null;\n this.running = false;\n this.canceled = false;\n this.failed = false;\n this._request = null;\n }\n _createClass(Connection, [{\n key: \"cancel\",\n value: function cancel() {\n if (!this._abortController || !this.running) return this;\n this._abortController.abort();\n this.canceled = true;\n }\n }, {\n key: \"setRequest\",\n value: function setRequest(request) {\n this._request = request;\n }\n }, {\n key: \"setConfig\",\n value: function setConfig(config) {\n this._config = config;\n }\n }, {\n key: \"setApi\",\n value: function setApi(api) {\n this._api = api;\n }\n }, {\n key: \"get\",\n value: function () {\n var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(query, params) {\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n return _context.abrupt(\"return\", this._execute(query, 'get', params));\n case 1:\n case \"end\":\n return _context.stop();\n }\n }, _callee, this);\n }));\n function get(_x, _x2) {\n return _get.apply(this, arguments);\n }\n return get;\n }()\n }, {\n key: \"post\",\n value: function () {\n var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(query, data) {\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n return _context2.abrupt(\"return\", this._execute(query, 'post', data));\n case 1:\n case \"end\":\n return _context2.stop();\n }\n }, _callee2, this);\n }));\n function post(_x3, _x4) {\n return _post.apply(this, arguments);\n }\n return post;\n }()\n }, {\n key: \"put\",\n value: function () {\n var _put = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(query, params) {\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) switch (_context3.prev = _context3.next) {\n case 0:\n return _context3.abrupt(\"return\", this._execute(query, 'put', params));\n case 1:\n case \"end\":\n return _context3.stop();\n }\n }, _callee3, this);\n }));\n function put(_x5, _x6) {\n return _put.apply(this, arguments);\n }\n return put;\n }()\n }, {\n key: \"delete\",\n value: function () {\n var _delete2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(query) {\n return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n while (1) switch (_context4.prev = _context4.next) {\n case 0:\n return _context4.abrupt(\"return\", this._execute(query, 'delete'));\n case 1:\n case \"end\":\n return _context4.stop();\n }\n }, _callee4, this);\n }));\n function _delete(_x7) {\n return _delete2.apply(this, arguments);\n }\n return _delete;\n }()\n }, {\n key: \"_execute\",\n value: function () {\n var _execute2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(url, method, data) {\n var _this = this;\n var config, request, response;\n return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n while (1) switch (_context5.prev = _context5.next) {\n case 0:\n this.running = true;\n if (!_.startsWith(url, '/')) {\n url = \"/\".concat(url);\n }\n this._api.cancelRunning(this._request);\n config = _objectSpread(_objectSpread({\n url: (this._api ? this._api.baseUrl : api.baseUrl) + url,\n method: method\n }, _defineProperty({}, method === 'get' ? 'params' : 'data', data)), {}, {\n signal: (this._abortController = new AbortController()).signal\n });\n request = (0,axios__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(Object.assign(config, this._config));\n response = new _response__WEBPACK_IMPORTED_MODULE_0__[\"default\"]();\n _context5.next = 8;\n return request.then(function (axiosResponse) {\n response.set(axiosResponse.status, axiosResponse);\n })[\"catch\"](function (error) {\n _this.failed = true;\n var statusCode = 0;\n if (error.response) {\n statusCode = error.response.status;\n }\n response.set(statusCode, error);\n })[\"finally\"](function () {\n _this.running = false;\n });\n case 8:\n return _context5.abrupt(\"return\", response);\n case 9:\n case \"end\":\n return _context5.stop();\n }\n }, _callee5, this);\n }));\n function _execute(_x8, _x9, _x10) {\n return _execute2.apply(this, arguments);\n }\n return _execute;\n }()\n }]);\n return Connection;\n}();\n\n\n//# sourceURL=webpack://Api/./src/connection.js?");
118
118
 
119
119
  /***/ }),
120
120
 
@@ -147,7 +147,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
147
147
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
148
148
 
149
149
  "use strict";
150
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ Filters)\n/* harmony export */ });\n/* harmony import */ var _limit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./limit */ \"./src/filters/limit.js\");\n/* harmony import */ var _order__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./order */ \"./src/filters/order.js\");\n/* harmony import */ var _relations__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./relations */ \"./src/filters/relations.js\");\n/* harmony import */ var _scopes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./scopes */ \"./src/filters/scopes.js\");\n/* harmony import */ var _search__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./search */ \"./src/filters/search.js\");\n/* harmony import */ var _wheres__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./wheres */ \"./src/filters/wheres.js\");\n/* harmony import */ var _whereIn__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./whereIn */ \"./src/filters/whereIn.js\");\n/* harmony import */ var _count__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./count */ \"./src/filters/count.js\");\n/* harmony import */ var _pluck__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./pluck */ \"./src/filters/pluck.js\");\n/* provided dependency */ var _ = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nfunction _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); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _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); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _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); }\n\n\n\n\n\n\n\n\n\nvar Filters = /*#__PURE__*/function () {\n function Filters() {\n _classCallCheck(this, Filters);\n this.count = new _count__WEBPACK_IMPORTED_MODULE_7__[\"default\"]();\n this.limit = new _limit__WEBPACK_IMPORTED_MODULE_0__[\"default\"]();\n this.order = new _order__WEBPACK_IMPORTED_MODULE_1__[\"default\"]();\n this.relations = new _relations__WEBPACK_IMPORTED_MODULE_2__[\"default\"]();\n this.scopes = new _scopes__WEBPACK_IMPORTED_MODULE_3__[\"default\"]();\n this.search = new _search__WEBPACK_IMPORTED_MODULE_4__[\"default\"]();\n this.wheres = new _wheres__WEBPACK_IMPORTED_MODULE_5__[\"default\"]();\n this.whereIn = new _whereIn__WEBPACK_IMPORTED_MODULE_6__[\"default\"]();\n this.pluck = new _pluck__WEBPACK_IMPORTED_MODULE_8__[\"default\"]();\n }\n _createClass(Filters, [{\n key: \"toObject\",\n value: function toObject() {\n var _ref;\n var items = [];\n for (var i = 0, filters = ['count', 'limit', 'order', 'relations', 'scopes', 'search', 'wheres', 'whereIn', 'pluck']; i < filters.length; i++) {\n if (this[filters[i]].filled()) items.push(this[filters[i]].toObject());\n }\n return (_ref = _).merge.apply(_ref, items);\n }\n }]);\n return Filters;\n}();\n\n\n//# sourceURL=webpack://Api/./src/filters/filters.js?");
150
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ Filters)\n/* harmony export */ });\n/* harmony import */ var _limit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./limit */ \"./src/filters/limit.js\");\n/* harmony import */ var _order__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./order */ \"./src/filters/order.js\");\n/* harmony import */ var _relations__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./relations */ \"./src/filters/relations.js\");\n/* harmony import */ var _scopes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./scopes */ \"./src/filters/scopes.js\");\n/* harmony import */ var _search__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./search */ \"./src/filters/search.js\");\n/* harmony import */ var _wheres__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./wheres */ \"./src/filters/wheres.js\");\n/* harmony import */ var _whereIn__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./whereIn */ \"./src/filters/whereIn.js\");\n/* harmony import */ var _whereNotIn__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./whereNotIn */ \"./src/filters/whereNotIn.js\");\n/* harmony import */ var _count__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./count */ \"./src/filters/count.js\");\n/* harmony import */ var _pluck__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./pluck */ \"./src/filters/pluck.js\");\n/* provided dependency */ var _ = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nfunction _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); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _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); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _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); }\n\n\n\n\n\n\n\n\n\n\nvar Filters = /*#__PURE__*/function () {\n function Filters() {\n _classCallCheck(this, Filters);\n this.count = new _count__WEBPACK_IMPORTED_MODULE_8__[\"default\"]();\n this.limit = new _limit__WEBPACK_IMPORTED_MODULE_0__[\"default\"]();\n this.order = new _order__WEBPACK_IMPORTED_MODULE_1__[\"default\"]();\n this.relations = new _relations__WEBPACK_IMPORTED_MODULE_2__[\"default\"]();\n this.scopes = new _scopes__WEBPACK_IMPORTED_MODULE_3__[\"default\"]();\n this.search = new _search__WEBPACK_IMPORTED_MODULE_4__[\"default\"]();\n this.wheres = new _wheres__WEBPACK_IMPORTED_MODULE_5__[\"default\"]();\n this.whereIn = new _whereIn__WEBPACK_IMPORTED_MODULE_6__[\"default\"]();\n this.whereNotIn = new _whereNotIn__WEBPACK_IMPORTED_MODULE_7__[\"default\"]();\n this.pluck = new _pluck__WEBPACK_IMPORTED_MODULE_9__[\"default\"]();\n }\n _createClass(Filters, [{\n key: \"toObject\",\n value: function toObject() {\n var _ref;\n var items = [];\n for (var i = 0, filters = ['count', 'limit', 'order', 'relations', 'scopes', 'search', 'wheres', 'whereIn', 'whereNotIn', 'pluck']; i < filters.length; i++) {\n if (this[filters[i]].filled()) items.push(this[filters[i]].toObject());\n }\n return (_ref = _).merge.apply(_ref, items);\n }\n }]);\n return Filters;\n}();\n\n\n//# sourceURL=webpack://Api/./src/filters/filters.js?");
151
151
 
152
152
  /***/ }),
153
153
 
@@ -224,7 +224,18 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
224
224
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
225
225
 
226
226
  "use strict";
227
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ Relations)\n/* harmony export */ });\n/* harmony import */ var _filter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./filter */ \"./src/filters/filter.js\");\n/* harmony import */ var _utilities_format__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utilities/format */ \"./src/utilities/format.js\");\nfunction _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); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _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); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _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); }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n\nvar Relations = /*#__PURE__*/function (_Filter) {\n _inherits(Relations, _Filter);\n var _super = _createSuper(Relations);\n function Relations() {\n var _this;\n _classCallCheck(this, Relations);\n _this = _super.call(this);\n _this._whereIns = [];\n return _this;\n }\n _createClass(Relations, [{\n key: \"filled\",\n value: function filled() {\n return this._whereIns.length > 0;\n }\n }, {\n key: \"add\",\n value: function add(column, values) {\n this._whereIns.push({\n column: _utilities_format__WEBPACK_IMPORTED_MODULE_1__[\"default\"].snakeCase(column),\n values: values\n });\n }\n }, {\n key: \"toObject\",\n value: function toObject() {\n var data = {};\n if (this.filled()) {\n data.where_in = this._whereIns;\n }\n return data;\n }\n }]);\n return Relations;\n}(_filter__WEBPACK_IMPORTED_MODULE_0__[\"default\"]);\n\n\n//# sourceURL=webpack://Api/./src/filters/whereIn.js?");
227
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WhereIn)\n/* harmony export */ });\n/* harmony import */ var _filter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./filter */ \"./src/filters/filter.js\");\n/* harmony import */ var _utilities_format__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utilities/format */ \"./src/utilities/format.js\");\nfunction _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); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _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); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _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); }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n\nvar WhereIn = /*#__PURE__*/function (_Filter) {\n _inherits(WhereIn, _Filter);\n var _super = _createSuper(WhereIn);\n function WhereIn() {\n var _this;\n _classCallCheck(this, WhereIn);\n _this = _super.call(this);\n _this._whereIns = [];\n return _this;\n }\n _createClass(WhereIn, [{\n key: \"filled\",\n value: function filled() {\n return this._whereIns.length > 0;\n }\n }, {\n key: \"add\",\n value: function add(column, values) {\n this._whereIns.push({\n column: _utilities_format__WEBPACK_IMPORTED_MODULE_1__[\"default\"].snakeCase(column),\n values: values\n });\n }\n }, {\n key: \"toObject\",\n value: function toObject() {\n var data = {};\n if (this.filled()) {\n data.where_in = this._whereIns;\n }\n return data;\n }\n }]);\n return WhereIn;\n}(_filter__WEBPACK_IMPORTED_MODULE_0__[\"default\"]);\n\n\n//# sourceURL=webpack://Api/./src/filters/whereIn.js?");
228
+
229
+ /***/ }),
230
+
231
+ /***/ "./src/filters/whereNotIn.js":
232
+ /*!***********************************!*\
233
+ !*** ./src/filters/whereNotIn.js ***!
234
+ \***********************************/
235
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
236
+
237
+ "use strict";
238
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ WhereNotIn)\n/* harmony export */ });\n/* harmony import */ var _filter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./filter */ \"./src/filters/filter.js\");\n/* harmony import */ var _utilities_format__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utilities/format */ \"./src/utilities/format.js\");\nfunction _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); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _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); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _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); }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n\nvar WhereNotIn = /*#__PURE__*/function (_Filter) {\n _inherits(WhereNotIn, _Filter);\n var _super = _createSuper(WhereNotIn);\n function WhereNotIn() {\n var _this;\n _classCallCheck(this, WhereNotIn);\n _this = _super.call(this);\n _this._whereNotIns = [];\n return _this;\n }\n _createClass(WhereNotIn, [{\n key: \"filled\",\n value: function filled() {\n return this._whereNotIns.length > 0;\n }\n }, {\n key: \"add\",\n value: function add(column, values) {\n this._whereNotIns.push({\n column: _utilities_format__WEBPACK_IMPORTED_MODULE_1__[\"default\"].snakeCase(column),\n values: values\n });\n }\n }, {\n key: \"toObject\",\n value: function toObject() {\n var data = {};\n if (this.filled()) {\n data.where_not_in = this._whereNotIns;\n }\n return data;\n }\n }]);\n return WhereNotIn;\n}(_filter__WEBPACK_IMPORTED_MODULE_0__[\"default\"]);\n\n\n//# sourceURL=webpack://Api/./src/filters/whereNotIn.js?");
228
239
 
229
240
  /***/ }),
230
241
 
@@ -268,7 +279,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
268
279
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
269
280
 
270
281
  "use strict";
271
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* provided dependency */ var _ = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _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.\"); }\nfunction _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); }\nfunction _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; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n/**\n * @mixin filterMixin\n */\nvar filterMixin = {\n count: function count(relations) {\n if (!Array.isArray(relations)) relations = [relations];\n this._filters.count.add(relations);\n return this;\n },\n limit: function limit(amount) {\n this._filters.limit.amount(amount);\n return this;\n },\n order: function order(input) {\n var _this = this;\n var direction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'asc';\n // If a single column name (string) is specified\n if (typeof input === 'string') {\n this._filters.order.add(_.snakeCase(input), direction);\n }\n\n // If there is an array input\n else if (Array.isArray(input)) {\n input.forEach(function (item) {\n // If the item is a string (single column name)\n if (typeof item === 'string') {\n _this._filters.order.add(_.snakeCase(input), 'asc');\n }\n\n // If the item is an array ([column name, direction])\n else if (Array.isArray(item)) {\n var _item = _slicedToArray(item, 2),\n column = _item[0],\n _item$ = _item[1],\n _direction = _item$ === void 0 ? 'asc' : _item$; // default value for dir is 'asc' if not specified\n\n _this._filters.order.add(_.snakeCase(column), _direction);\n }\n });\n }\n return this;\n },\n \"with\": function _with(relations) {\n if (!Array.isArray(relations)) relations = [relations];\n this._filters.relations.add(relations);\n return this;\n },\n scope: function scope(name) {\n for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n params[_key - 1] = arguments[_key];\n }\n this._filters.scopes.add(name, params);\n return this;\n },\n scopes: function scopes(input) {\n var _this2 = this;\n input.forEach(function (scope) {\n if (Array.isArray(scope)) {\n _this2.scope.apply(_this2, _toConsumableArray(scope));\n } else {\n _this2.scope(scope);\n }\n });\n return this;\n },\n search: function search(value) {\n var columns = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n if (!Array.isArray(columns)) columns = [columns];\n this._filters.search.value(value);\n this._filters.search.columns(columns);\n return this;\n },\n where: function where(column, operator, value) {\n if (arguments.length === 2) {\n value = operator;\n operator = '=';\n }\n this._filters.wheres.add(column, operator, value);\n return this;\n },\n wheres: function wheres(input) {\n var _this3 = this;\n input.forEach(function (where) {\n _this3.where.apply(_this3, _toConsumableArray(where));\n });\n return this;\n },\n whereIn: function whereIn(column, values) {\n if (!Array.isArray(values)) values = [values];\n this._filters.whereIn.add(column, values);\n return this;\n },\n whereIns: function whereIns(input) {\n var _this4 = this;\n input.forEach(function (whereIn) {\n _this4.whereIn.apply(_this4, _toConsumableArray(whereIn));\n });\n return this;\n },\n pluck: function pluck(fields) {\n if (!Array.isArray(fields)) fields = [fields];\n this._filters.pluck.add(fields);\n return this;\n }\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (filterMixin);\n\n//# sourceURL=webpack://Api/./src/mixins/filterMixin.js?");
282
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* provided dependency */ var _ = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _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.\"); }\nfunction _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); }\nfunction _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; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n/**\n * @mixin filterMixin\n */\nvar filterMixin = {\n count: function count(relations) {\n if (!Array.isArray(relations)) relations = [relations];\n this._filters.count.add(relations);\n return this;\n },\n limit: function limit(amount) {\n this._filters.limit.amount(amount);\n return this;\n },\n order: function order(input) {\n var _this = this;\n var direction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'asc';\n // If a single column name (string) is specified\n if (typeof input === 'string') {\n this._filters.order.add(_.snakeCase(input), direction);\n }\n\n // If there is an array input\n else if (Array.isArray(input)) {\n input.forEach(function (item) {\n // If the item is a string (single column name)\n if (typeof item === 'string') {\n _this._filters.order.add(_.snakeCase(input), 'asc');\n }\n\n // If the item is an array ([column name, direction])\n else if (Array.isArray(item)) {\n var _item = _slicedToArray(item, 2),\n column = _item[0],\n _item$ = _item[1],\n _direction = _item$ === void 0 ? 'asc' : _item$; // default value for dir is 'asc' if not specified\n\n _this._filters.order.add(_.snakeCase(column), _direction);\n }\n });\n }\n return this;\n },\n \"with\": function _with(relations) {\n if (!Array.isArray(relations)) relations = [relations];\n this._filters.relations.add(relations);\n return this;\n },\n scope: function scope(name) {\n for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n params[_key - 1] = arguments[_key];\n }\n this._filters.scopes.add(name, params);\n return this;\n },\n scopes: function scopes(input) {\n var _this2 = this;\n input.forEach(function (scope) {\n if (Array.isArray(scope)) {\n _this2.scope.apply(_this2, _toConsumableArray(scope));\n } else {\n _this2.scope(scope);\n }\n });\n return this;\n },\n search: function search(value) {\n var columns = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n if (!Array.isArray(columns)) columns = [columns];\n this._filters.search.value(value);\n this._filters.search.columns(columns);\n return this;\n },\n where: function where(column, operator, value) {\n if (arguments.length === 2) {\n value = operator;\n operator = '=';\n }\n this._filters.wheres.add(column, operator, value);\n return this;\n },\n wheres: function wheres(input) {\n var _this3 = this;\n input.forEach(function (where) {\n _this3.where.apply(_this3, _toConsumableArray(where));\n });\n return this;\n },\n whereIn: function whereIn(column, values) {\n if (!Array.isArray(values)) values = [values];\n this._filters.whereIn.add(column, values);\n return this;\n },\n whereIns: function whereIns(input) {\n var _this4 = this;\n input.forEach(function (whereIn) {\n _this4.whereIn.apply(_this4, _toConsumableArray(whereIn));\n });\n return this;\n },\n whereNotIn: function whereNotIn(column, values) {\n if (!Array.isArray(values)) values = [values];\n this._filters.whereNotIn.add(column, values);\n return this;\n },\n whereNotIns: function whereNotIns(input) {\n var _this5 = this;\n input.forEach(function (whereIn) {\n _this5.whereNotIn.apply(_this5, _toConsumableArray(whereIn));\n });\n return this;\n },\n pluck: function pluck(fields) {\n if (!Array.isArray(fields)) fields = [fields];\n this._filters.pluck.add(fields);\n return this;\n }\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (filterMixin);\n\n//# sourceURL=webpack://Api/./src/mixins/filterMixin.js?");
272
283
 
273
284
  /***/ }),
274
285
 
@@ -345,7 +356,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
345
356
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
346
357
 
347
358
  "use strict";
348
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ Request)\n/* harmony export */ });\n/* harmony import */ var _request_action__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./request/action */ \"./src/request/action.js\");\n/* harmony import */ var _connection__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./connection */ \"./src/connection.js\");\n/* harmony import */ var _filters_filters__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./filters/filters */ \"./src/filters/filters.js\");\n/* harmony import */ var _modifiers_modifiers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./modifiers/modifiers */ \"./src/modifiers/modifiers.js\");\n/* harmony import */ var _request_pagination__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./request/pagination */ \"./src/request/pagination.js\");\n/* harmony import */ var _mixins_actionMixin__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./mixins/actionMixin */ \"./src/mixins/actionMixin.js\");\n/* harmony import */ var _mixins_filterMixin__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./mixins/filterMixin */ \"./src/mixins/filterMixin.js\");\n/* harmony import */ var _mixins_modifierMixin__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./mixins/modifierMixin */ \"./src/mixins/modifierMixin.js\");\n/* harmony import */ var _mixins_paginationMixin__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./mixins/paginationMixin */ \"./src/mixins/paginationMixin.js\");\n/* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./api */ \"./src/api.js\");\n/* provided dependency */ var _ = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nfunction _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); }\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _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); }\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\nfunction _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; }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _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; }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _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); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _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); }\n\n\n\n\n\n\n\n\n\n\n\n/**\n * @mixes actionMixin\n * @mixes filterMixin\n * @mixes modifierMixin\n * @mixes paginationMixin\n */\nvar Request = /*#__PURE__*/function () {\n function Request() {\n _classCallCheck(this, Request);\n this.url = null;\n this._action = new _request_action__WEBPACK_IMPORTED_MODULE_0__[\"default\"]();\n this._filters = new _filters_filters__WEBPACK_IMPORTED_MODULE_2__[\"default\"]();\n this._modifiers = new _modifiers_modifiers__WEBPACK_IMPORTED_MODULE_3__[\"default\"]();\n this._pagination = new _request_pagination__WEBPACK_IMPORTED_MODULE_4__[\"default\"]();\n this._customParameters = [];\n this._onSuccess = function () {};\n this._onError = function () {};\n this._onValidationError = function () {};\n this._onUnauthorized = function () {};\n this._onForbidden = function () {};\n this._connection = new _connection__WEBPACK_IMPORTED_MODULE_1__[\"default\"]();\n this._response = null;\n }\n _createClass(Request, [{\n key: \"response\",\n get: function get() {\n return this._response;\n }\n\n /**\n * @param {string} url\n *\n * @returns {this} The current instance.\n */\n }, {\n key: \"setUrl\",\n value: function setUrl(url) {\n this.url = url;\n return this;\n }\n\n /**\n * @returns {this} The current instance.\n */\n }, {\n key: \"cancel\",\n value: function cancel() {\n this._connection.cancel();\n return this;\n }\n\n /**\n * @returns {this} The current instance.\n */\n }, {\n key: \"get\",\n value: function () {\n var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n var _this$url;\n var url;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n url = (_this$url = this.url) !== null && _this$url !== void 0 ? _this$url : this.constructor.endpoint;\n _context.next = 3;\n return this._connection.get(\"\".concat(url), this.bodyParameters);\n case 3:\n this._response = _context.sent;\n _context.next = 6;\n return this.triggerResponseEvents(this._response);\n case 6:\n return _context.abrupt(\"return\", this);\n case 7:\n case \"end\":\n return _context.stop();\n }\n }, _callee, this);\n }));\n function get() {\n return _get.apply(this, arguments);\n }\n return get;\n }()\n /**\n * @param {Object} data\n *\n * @returns {this} The current instance.\n */\n }, {\n key: \"post\",\n value: function () {\n var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n var _this$url2;\n var data,\n url,\n _args2 = arguments;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n data = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};\n url = (_this$url2 = this.url) !== null && _this$url2 !== void 0 ? _this$url2 : this.constructor.endpoint;\n _context2.next = 4;\n return this._connection.post(\"\".concat(url), data);\n case 4:\n this._response = _context2.sent;\n _context2.next = 7;\n return this.triggerResponseEvents(this._response);\n case 7:\n return _context2.abrupt(\"return\", this);\n case 8:\n case \"end\":\n return _context2.stop();\n }\n }, _callee2, this);\n }));\n function post() {\n return _post.apply(this, arguments);\n }\n return post;\n }()\n /**\n * @param {Object} data\n *\n * @returns {this} The current instance.\n */\n }, {\n key: \"put\",\n value: function () {\n var _put = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n var _this$url3;\n var data,\n url,\n _args3 = arguments;\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) switch (_context3.prev = _context3.next) {\n case 0:\n data = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {};\n url = (_this$url3 = this.url) !== null && _this$url3 !== void 0 ? _this$url3 : this.constructor.endpoint;\n _context3.next = 4;\n return this._connection.put(\"\".concat(url), _objectSpread(_objectSpread({}, data), this.bodyParameters));\n case 4:\n this._response = _context3.sent;\n _context3.next = 7;\n return this.triggerResponseEvents(this._response);\n case 7:\n return _context3.abrupt(\"return\", this);\n case 8:\n case \"end\":\n return _context3.stop();\n }\n }, _callee3, this);\n }));\n function put() {\n return _put.apply(this, arguments);\n }\n return put;\n }()\n /**\n * @returns {this} The current instance.\n */\n }, {\n key: \"delete\",\n value: function () {\n var _delete2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n var _this$url4;\n var url;\n return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n while (1) switch (_context4.prev = _context4.next) {\n case 0:\n url = (_this$url4 = this.url) !== null && _this$url4 !== void 0 ? _this$url4 : this.constructor.endpoint;\n _context4.next = 3;\n return this._connection[\"delete\"](\"\".concat(url));\n case 3:\n this._response = _context4.sent;\n _context4.next = 6;\n return this.triggerResponseEvents(this._response);\n case 6:\n return _context4.abrupt(\"return\", this);\n case 7:\n case \"end\":\n return _context4.stop();\n }\n }, _callee4, this);\n }));\n function _delete() {\n return _delete2.apply(this, arguments);\n }\n return _delete;\n }()\n /**\n * @param {Object} files\n * @param {Object} data\n *\n * @returns {this} The current instance.\n */\n }, {\n key: \"storeFiles\",\n value: function () {\n var _storeFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n var _this$url5;\n var files,\n data,\n url,\n formData,\n _args5 = arguments;\n return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n while (1) switch (_context5.prev = _context5.next) {\n case 0:\n files = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {};\n data = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {};\n url = (_this$url5 = this.url) !== null && _this$url5 !== void 0 ? _this$url5 : this.constructor.endpoint;\n this._connection.setConfig({\n headers: {\n 'Content-Type': 'multipart/form-data'\n }\n });\n formData = this._createFormData(_.merge({}, files, data));\n _context5.next = 7;\n return this._connection.post(\"\".concat(url, \"?\").concat(this.bodyParameters), formData);\n case 7:\n this._response = _context5.sent;\n _context5.next = 10;\n return this.triggerResponseEvents(this._response);\n case 10:\n return _context5.abrupt(\"return\", this);\n case 11:\n case \"end\":\n return _context5.stop();\n }\n }, _callee5, this);\n }));\n function storeFiles() {\n return _storeFiles.apply(this, arguments);\n }\n return storeFiles;\n }()\n /**\n * @returns {Object} Filter and modifier query parameters.\n */\n }, {\n key: \"bodyParameters\",\n get: function get() {\n var _ref, _ref2;\n return (_ref = _).merge.apply(_ref, _toConsumableArray(_.compact([this._filters.toObject(), this._modifiers.toObject(), this._pagination.toObject(), this._action.toObject(), (_ref2 = _).merge.apply(_ref2, _toConsumableArray(this._customParameters))])));\n }\n\n /**\n * @param {function(Response.data)} callback\n *\n * @returns {this} The current instance.\n */\n }, {\n key: \"onSuccess\",\n value: function onSuccess() {\n var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};\n this._onSuccess = callback;\n return this;\n }\n\n /**\n * @param {function(Response)} callback\n *\n * @returns {this} The current instance.\n */\n }, {\n key: \"onError\",\n value: function onError() {\n var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};\n this._onError = callback;\n return this;\n }\n\n /**\n * @param {function(Response.validation)} callback\n *\n * @returns {this} The current instance.\n */\n }, {\n key: \"onValidationError\",\n value: function onValidationError() {\n var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};\n this._onValidationError = callback;\n return this;\n }\n\n /**\n * @param {function(Response)} callback\n *\n * @returns {this} The current instance.\n */\n }, {\n key: \"onUnauthorized\",\n value: function onUnauthorized() {\n var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};\n this._onUnauthorized = callback;\n return this;\n }\n\n /**\n * @param {function(Response)} callback\n *\n * @returns {this} The current instance.\n */\n }, {\n key: \"onForbidden\",\n value: function onForbidden() {\n var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};\n this._onForbidden = callback;\n return this;\n }\n\n /**\n * @param {Response} response\n * @param {*} successResponse\n */\n }, {\n key: \"triggerResponseEvents\",\n value: function () {\n var _triggerResponseEvents = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(response) {\n var successResponse,\n validation,\n _args6 = arguments;\n return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n while (1) switch (_context6.prev = _context6.next) {\n case 0:\n successResponse = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : null;\n if (!(response.statusCode >= 200 && response.statusCode < 300)) {\n _context6.next = 7;\n break;\n }\n if (this._onSuccess) {\n _context6.next = 4;\n break;\n }\n return _context6.abrupt(\"return\");\n case 4:\n _context6.next = 6;\n return this._onSuccess.apply(this, _toConsumableArray([successResponse, response.data].filter(function (value) {\n return !!value;\n })));\n case 6:\n return _context6.abrupt(\"return\", _context6.sent);\n case 7:\n _context6.t0 = response.statusCode;\n _context6.next = _context6.t0 === 401 ? 10 : _context6.t0 === 403 ? 14 : _context6.t0 === 422 ? 18 : 24;\n break;\n case 10:\n if (!this._onUnauthorized) {\n _context6.next = 13;\n break;\n }\n _context6.next = 13;\n return this._onUnauthorized(response);\n case 13:\n return _context6.abrupt(\"break\", 28);\n case 14:\n if (!this._onForbidden) {\n _context6.next = 17;\n break;\n }\n _context6.next = 17;\n return this._onForbidden(response);\n case 17:\n return _context6.abrupt(\"break\", 28);\n case 18:\n validation = {\n message: response.validation.message,\n errors: {}\n };\n _.each(response.validation.errors, function (value, key) {\n return _.set(validation.errors, key, value);\n });\n if (!this._onValidationError) {\n _context6.next = 23;\n break;\n }\n _context6.next = 23;\n return this._onValidationError(validation);\n case 23:\n return _context6.abrupt(\"break\", 28);\n case 24:\n if (!this._onError) {\n _context6.next = 27;\n break;\n }\n _context6.next = 27;\n return this._onError(response);\n case 27:\n return _context6.abrupt(\"break\", 28);\n case 28:\n case \"end\":\n return _context6.stop();\n }\n }, _callee6, this);\n }));\n function triggerResponseEvents(_x) {\n return _triggerResponseEvents.apply(this, arguments);\n }\n return triggerResponseEvents;\n }()\n /**\n * Add custom parameters to the request.\n *\n * @param {Object} parameters\n *\n * @returns {this} The current instance.\n */\n }, {\n key: \"customParameters\",\n value: function customParameters() {\n var parameters = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n this._customParameters.push(parameters);\n return this;\n }\n\n /**\n * Convert data to FormData.\n *\n * @param {Object} data\n *\n * @returns {FormData}\n */\n }, {\n key: \"_createFormData\",\n value: function _createFormData() {\n var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var formData = new FormData();\n function appendFormData(data, name) {\n name = name || '';\n if (data instanceof File) {\n formData.append(name, data);\n } else if (data === true || data === false) {\n formData.append(name, data ? '1' : '0');\n } else if (_.isArray(data) || _.isObject(data)) {\n if (_.size(data) <= 0) {\n formData.append(name, '');\n } else {\n _.forOwn(data, function (dataItem, key) {\n var newName = name === '' ? key : name + '[' + key + ']';\n appendFormData(dataItem, newName);\n });\n }\n } else {\n formData.append(name, data);\n }\n }\n appendFormData(data);\n return formData;\n }\n\n /**\n * @param {Api} api\n *\n * @returns {this} The current instance.\n */\n }, {\n key: \"setApi\",\n value: function setApi(api) {\n this._connection.setApi(api);\n return this;\n }\n }]);\n return Request;\n}();\n\nObject.assign(Request.prototype, _mixins_actionMixin__WEBPACK_IMPORTED_MODULE_5__[\"default\"]);\nObject.assign(Request.prototype, _mixins_filterMixin__WEBPACK_IMPORTED_MODULE_6__[\"default\"]);\nObject.assign(Request.prototype, _mixins_modifierMixin__WEBPACK_IMPORTED_MODULE_7__[\"default\"]);\nObject.assign(Request.prototype, _mixins_paginationMixin__WEBPACK_IMPORTED_MODULE_8__[\"default\"]);\n\n//# sourceURL=webpack://Api/./src/request.js?");
359
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ Request)\n/* harmony export */ });\n/* harmony import */ var _request_action__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./request/action */ \"./src/request/action.js\");\n/* harmony import */ var _connection__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./connection */ \"./src/connection.js\");\n/* harmony import */ var _filters_filters__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./filters/filters */ \"./src/filters/filters.js\");\n/* harmony import */ var _modifiers_modifiers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./modifiers/modifiers */ \"./src/modifiers/modifiers.js\");\n/* harmony import */ var _request_pagination__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./request/pagination */ \"./src/request/pagination.js\");\n/* harmony import */ var _mixins_actionMixin__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./mixins/actionMixin */ \"./src/mixins/actionMixin.js\");\n/* harmony import */ var _mixins_filterMixin__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./mixins/filterMixin */ \"./src/mixins/filterMixin.js\");\n/* harmony import */ var _mixins_modifierMixin__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./mixins/modifierMixin */ \"./src/mixins/modifierMixin.js\");\n/* harmony import */ var _mixins_paginationMixin__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./mixins/paginationMixin */ \"./src/mixins/paginationMixin.js\");\n/* provided dependency */ var _ = __webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\");\nfunction _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); }\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _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); }\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\nfunction _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; }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _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; }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _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); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _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); }\n\n\n\n\n\n\n\n\n\n\n/**\n * @mixes actionMixin\n * @mixes filterMixin\n * @mixes modifierMixin\n * @mixes paginationMixin\n */\nvar Request = /*#__PURE__*/function () {\n function Request() {\n _classCallCheck(this, Request);\n this.url = null;\n this._action = new _request_action__WEBPACK_IMPORTED_MODULE_0__[\"default\"]();\n this._filters = new _filters_filters__WEBPACK_IMPORTED_MODULE_2__[\"default\"]();\n this._modifiers = new _modifiers_modifiers__WEBPACK_IMPORTED_MODULE_3__[\"default\"]();\n this._pagination = new _request_pagination__WEBPACK_IMPORTED_MODULE_4__[\"default\"]();\n this._customParameters = [];\n this._onSuccess = function () {};\n this._onError = function () {};\n this._onValidationError = function () {};\n this._onUnauthorized = function () {};\n this._onForbidden = function () {};\n this._connection = new _connection__WEBPACK_IMPORTED_MODULE_1__[\"default\"]();\n this._connection.setRequest(this);\n this._response = null;\n this.key = null;\n }\n _createClass(Request, [{\n key: \"setKey\",\n value: function setKey(name) {\n this.key = name;\n return this;\n }\n }, {\n key: \"response\",\n get: function get() {\n return this._response;\n }\n\n /**\n * @param {string} url\n *\n * @returns {this} The current instance.\n */\n }, {\n key: \"setUrl\",\n value: function setUrl(url) {\n this.url = url;\n return this;\n }\n\n /**\n * @returns {this} The current instance.\n */\n }, {\n key: \"cancel\",\n value: function cancel() {\n this._connection.cancel();\n return this;\n }\n\n /**\n * @returns {this} The current instance.\n */\n }, {\n key: \"get\",\n value: function () {\n var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n var _this$url;\n var url;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n url = (_this$url = this.url) !== null && _this$url !== void 0 ? _this$url : this.constructor.endpoint;\n _context.next = 3;\n return this._connection.get(\"\".concat(url), this.bodyParameters);\n case 3:\n this._response = _context.sent;\n _context.next = 6;\n return this.triggerResponseEvents(this._response);\n case 6:\n return _context.abrupt(\"return\", this);\n case 7:\n case \"end\":\n return _context.stop();\n }\n }, _callee, this);\n }));\n function get() {\n return _get.apply(this, arguments);\n }\n return get;\n }()\n /**\n * @param {Object} data\n *\n * @returns {this} The current instance.\n */\n }, {\n key: \"post\",\n value: function () {\n var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n var _this$url2;\n var data,\n url,\n _args2 = arguments;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n data = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};\n url = (_this$url2 = this.url) !== null && _this$url2 !== void 0 ? _this$url2 : this.constructor.endpoint;\n _context2.next = 4;\n return this._connection.post(\"\".concat(url), data);\n case 4:\n this._response = _context2.sent;\n _context2.next = 7;\n return this.triggerResponseEvents(this._response);\n case 7:\n return _context2.abrupt(\"return\", this);\n case 8:\n case \"end\":\n return _context2.stop();\n }\n }, _callee2, this);\n }));\n function post() {\n return _post.apply(this, arguments);\n }\n return post;\n }()\n /**\n * @param {Object} data\n *\n * @returns {this} The current instance.\n */\n }, {\n key: \"put\",\n value: function () {\n var _put = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n var _this$url3;\n var data,\n url,\n _args3 = arguments;\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) switch (_context3.prev = _context3.next) {\n case 0:\n data = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {};\n url = (_this$url3 = this.url) !== null && _this$url3 !== void 0 ? _this$url3 : this.constructor.endpoint;\n _context3.next = 4;\n return this._connection.put(\"\".concat(url), _objectSpread(_objectSpread({}, data), this.bodyParameters));\n case 4:\n this._response = _context3.sent;\n _context3.next = 7;\n return this.triggerResponseEvents(this._response);\n case 7:\n return _context3.abrupt(\"return\", this);\n case 8:\n case \"end\":\n return _context3.stop();\n }\n }, _callee3, this);\n }));\n function put() {\n return _put.apply(this, arguments);\n }\n return put;\n }()\n /**\n * @returns {this} The current instance.\n */\n }, {\n key: \"delete\",\n value: function () {\n var _delete2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n var _this$url4;\n var url;\n return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n while (1) switch (_context4.prev = _context4.next) {\n case 0:\n url = (_this$url4 = this.url) !== null && _this$url4 !== void 0 ? _this$url4 : this.constructor.endpoint;\n _context4.next = 3;\n return this._connection[\"delete\"](\"\".concat(url));\n case 3:\n this._response = _context4.sent;\n _context4.next = 6;\n return this.triggerResponseEvents(this._response);\n case 6:\n return _context4.abrupt(\"return\", this);\n case 7:\n case \"end\":\n return _context4.stop();\n }\n }, _callee4, this);\n }));\n function _delete() {\n return _delete2.apply(this, arguments);\n }\n return _delete;\n }()\n /**\n * @param {Object} files\n * @param {Object} data\n *\n * @returns {this} The current instance.\n */\n }, {\n key: \"storeFiles\",\n value: function () {\n var _storeFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {\n var _this$url5;\n var files,\n data,\n url,\n formData,\n _args5 = arguments;\n return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n while (1) switch (_context5.prev = _context5.next) {\n case 0:\n files = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {};\n data = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {};\n url = (_this$url5 = this.url) !== null && _this$url5 !== void 0 ? _this$url5 : this.constructor.endpoint;\n this._connection.setConfig({\n headers: {\n 'Content-Type': 'multipart/form-data'\n }\n });\n formData = this._createFormData(_.merge({}, files, data));\n _context5.next = 7;\n return this._connection.post(\"\".concat(url, \"?\").concat(this.bodyParameters), formData);\n case 7:\n this._response = _context5.sent;\n _context5.next = 10;\n return this.triggerResponseEvents(this._response);\n case 10:\n return _context5.abrupt(\"return\", this);\n case 11:\n case \"end\":\n return _context5.stop();\n }\n }, _callee5, this);\n }));\n function storeFiles() {\n return _storeFiles.apply(this, arguments);\n }\n return storeFiles;\n }()\n /**\n * @returns {Object} Filter and modifier query parameters.\n */\n }, {\n key: \"bodyParameters\",\n get: function get() {\n var _ref, _ref2;\n return (_ref = _).merge.apply(_ref, _toConsumableArray(_.compact([this._filters.toObject(), this._modifiers.toObject(), this._pagination.toObject(), this._action.toObject(), (_ref2 = _).merge.apply(_ref2, _toConsumableArray(this._customParameters))])));\n }\n\n /**\n * @param {function(Response.data)} callback\n *\n * @returns {this} The current instance.\n */\n }, {\n key: \"onSuccess\",\n value: function onSuccess() {\n var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};\n this._onSuccess = callback;\n return this;\n }\n\n /**\n * @param {function(Response)} callback\n *\n * @returns {this} The current instance.\n */\n }, {\n key: \"onError\",\n value: function onError() {\n var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};\n this._onError = callback;\n return this;\n }\n\n /**\n * @param {function(Response.validation)} callback\n *\n * @returns {this} The current instance.\n */\n }, {\n key: \"onValidationError\",\n value: function onValidationError() {\n var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};\n this._onValidationError = callback;\n return this;\n }\n\n /**\n * @param {function(Response)} callback\n *\n * @returns {this} The current instance.\n */\n }, {\n key: \"onUnauthorized\",\n value: function onUnauthorized() {\n var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};\n this._onUnauthorized = callback;\n return this;\n }\n\n /**\n * @param {function(Response)} callback\n *\n * @returns {this} The current instance.\n */\n }, {\n key: \"onForbidden\",\n value: function onForbidden() {\n var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};\n this._onForbidden = callback;\n return this;\n }\n\n /**\n * @param {Response} response\n * @param {*} successResponse\n */\n }, {\n key: \"triggerResponseEvents\",\n value: function () {\n var _triggerResponseEvents = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(response) {\n var successResponse,\n validation,\n _args6 = arguments;\n return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n while (1) switch (_context6.prev = _context6.next) {\n case 0:\n successResponse = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : null;\n if (!(response.statusCode >= 200 && response.statusCode < 300)) {\n _context6.next = 7;\n break;\n }\n if (this._onSuccess) {\n _context6.next = 4;\n break;\n }\n return _context6.abrupt(\"return\");\n case 4:\n _context6.next = 6;\n return this._onSuccess.apply(this, _toConsumableArray([successResponse, response.data].filter(function (value) {\n return !!value;\n })));\n case 6:\n return _context6.abrupt(\"return\", _context6.sent);\n case 7:\n _context6.t0 = response.statusCode;\n _context6.next = _context6.t0 === 401 ? 10 : _context6.t0 === 403 ? 14 : _context6.t0 === 422 ? 18 : 24;\n break;\n case 10:\n if (!this._onUnauthorized) {\n _context6.next = 13;\n break;\n }\n _context6.next = 13;\n return this._onUnauthorized(response);\n case 13:\n return _context6.abrupt(\"break\", 28);\n case 14:\n if (!this._onForbidden) {\n _context6.next = 17;\n break;\n }\n _context6.next = 17;\n return this._onForbidden(response);\n case 17:\n return _context6.abrupt(\"break\", 28);\n case 18:\n validation = {\n message: response.validation.message,\n errors: {}\n };\n _.each(response.validation.errors, function (value, key) {\n return _.set(validation.errors, key, value);\n });\n if (!this._onValidationError) {\n _context6.next = 23;\n break;\n }\n _context6.next = 23;\n return this._onValidationError(validation);\n case 23:\n return _context6.abrupt(\"break\", 28);\n case 24:\n if (!this._onError) {\n _context6.next = 27;\n break;\n }\n _context6.next = 27;\n return this._onError(response);\n case 27:\n return _context6.abrupt(\"break\", 28);\n case 28:\n case \"end\":\n return _context6.stop();\n }\n }, _callee6, this);\n }));\n function triggerResponseEvents(_x) {\n return _triggerResponseEvents.apply(this, arguments);\n }\n return triggerResponseEvents;\n }()\n /**\n * Add custom parameters to the request.\n *\n * @param {Object} parameters\n *\n * @returns {this} The current instance.\n */\n }, {\n key: \"customParameters\",\n value: function customParameters() {\n var parameters = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n this._customParameters.push(parameters);\n return this;\n }\n\n /**\n * Convert data to FormData.\n *\n * @param {Object} data\n *\n * @returns {FormData}\n */\n }, {\n key: \"_createFormData\",\n value: function _createFormData() {\n var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var formData = new FormData();\n function appendFormData(data, name) {\n name = name || '';\n if (data instanceof File) {\n formData.append(name, data);\n } else if (data === true || data === false) {\n formData.append(name, data ? '1' : '0');\n } else if (_.isArray(data) || _.isObject(data)) {\n if (_.size(data) <= 0) {\n formData.append(name, '');\n } else {\n _.forOwn(data, function (dataItem, key) {\n var newName = name === '' ? key : name + '[' + key + ']';\n appendFormData(dataItem, newName);\n });\n }\n } else {\n formData.append(name, data);\n }\n }\n appendFormData(data);\n return formData;\n }\n\n /**\n * @param {Api} api\n *\n * @returns {this} The current instance.\n */\n }, {\n key: \"setApi\",\n value: function setApi(api) {\n this._connection.setApi(api);\n return this;\n }\n }]);\n return Request;\n}();\n\nObject.assign(Request.prototype, _mixins_actionMixin__WEBPACK_IMPORTED_MODULE_5__[\"default\"]);\nObject.assign(Request.prototype, _mixins_filterMixin__WEBPACK_IMPORTED_MODULE_6__[\"default\"]);\nObject.assign(Request.prototype, _mixins_modifierMixin__WEBPACK_IMPORTED_MODULE_7__[\"default\"]);\nObject.assign(Request.prototype, _mixins_paginationMixin__WEBPACK_IMPORTED_MODULE_8__[\"default\"]);\n\n//# sourceURL=webpack://Api/./src/request.js?");
349
360
 
350
361
  /***/ }),
351
362
 
package/index.d.ts CHANGED
@@ -77,6 +77,7 @@ declare class Request extends Mixins {
77
77
  get(): Promise<this>;
78
78
  post(data?: object): Promise<this>;
79
79
  put(data?: object): Promise<this>;
80
+ setKey(key: string): this;
80
81
  delete(): Promise<this>;
81
82
  storeFiles(files?: object, data?: object): Promise<this>;
82
83
  readonly bodyParameters: object;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weapnl/js-junction",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "This project allows you to easily consume API's built with Junction.",
5
5
  "main": "./src/index.js",
6
6
  "scripts": {
package/src/api.js CHANGED
@@ -6,7 +6,7 @@ export default class Api {
6
6
  constructor () {
7
7
  this.setHeader('X-Requested-With', 'XMLHttpRequest');
8
8
 
9
- this._requests = [];
9
+ this._requests = {};
10
10
 
11
11
  this.host('/').suffix('');
12
12
 
@@ -55,6 +55,15 @@ export default class Api {
55
55
  return url;
56
56
  }
57
57
 
58
+ cancelRunning (request) {
59
+ if (! request.key) {
60
+ return;
61
+ }
62
+
63
+ this._requests[request.key]?.cancel();
64
+ this._requests[request.key] = request;
65
+ }
66
+
58
67
  /**
59
68
  * @param {string} uri
60
69
  *
@@ -70,14 +79,13 @@ export default class Api {
70
79
  const request = new Request();
71
80
 
72
81
  request.setUrl(uri)
82
+ .setApi(this)
73
83
  .onSuccess(this._onSuccess)
74
84
  .onError(this._onError)
75
85
  .onValidationError(this._onValidationError)
76
86
  .onUnauthorized(this._onUnauthorized)
77
87
  .onForbidden(this._onForbidden);
78
88
 
79
- this._requests.push(request);
80
-
81
89
  return request;
82
90
  }
83
91
 
@@ -13,6 +13,7 @@ export default class Model extends Request {
13
13
  this._counts = new Counts(this);
14
14
  this._relations = new Relations(this);
15
15
 
16
+ this.setApi(api);
16
17
  this.fill(defaults);
17
18
  }
18
19
 
@@ -115,6 +116,8 @@ export default class Model extends Request {
115
116
  * @returns {this[]} List of models.
116
117
  */
117
118
  async index () {
119
+ this._connection.cancelRunning(this);
120
+
118
121
  this._response = await this._connection.get(
119
122
  this._queryString(),
120
123
  this.bodyParameters,
@@ -145,6 +148,8 @@ export default class Model extends Request {
145
148
 
146
149
  if (! identifier) return null;
147
150
 
151
+ this._connection.cancelRunning(this);
152
+
148
153
  this._response = await this._connection.get(
149
154
  this._queryString(identifier),
150
155
  this.bodyParameters,
@@ -169,6 +174,8 @@ export default class Model extends Request {
169
174
  * @returns {this} The created model.
170
175
  */
171
176
  async store (extraData = {}) {
177
+ this._connection.cancelRunning(this);
178
+
172
179
  this._response = await this._connection.post(
173
180
  this._queryString(),
174
181
  { ...this._attributes.toJson(this), ...extraData },
@@ -193,6 +200,8 @@ export default class Model extends Request {
193
200
  * @returns {this} The updated model.
194
201
  */
195
202
  async update (extraData = {}) {
203
+ this._connection.cancelRunning(this);
204
+
196
205
  this._response = await this._connection.put(
197
206
  this._queryString(this._identifier),
198
207
  { ...this._attributes.toJson(this), ...extraData },
@@ -215,6 +224,8 @@ export default class Model extends Request {
215
224
  * @returns {boolean} Whether the deletion was successful.
216
225
  */
217
226
  async destroy () {
227
+ this._connection.cancelRunning(this);
228
+
218
229
  this._response = await this._connection.delete(
219
230
  this._queryString(this._identifier),
220
231
  );
package/src/connection.js CHANGED
@@ -14,13 +14,17 @@ export default class Connection {
14
14
  }
15
15
 
16
16
  cancel () {
17
- if (! this._abortController) return this;
17
+ if (! this._abortController || ! this.running) return this;
18
18
 
19
19
  this._abortController.abort();
20
20
 
21
21
  this.canceled = true;
22
22
  }
23
23
 
24
+ cancelRunning (request) {
25
+ this._api.cancelRunning(request);
26
+ }
27
+
24
28
  setConfig (config) {
25
29
  this._config = config;
26
30
  }
package/src/request.js CHANGED
@@ -8,7 +8,6 @@ import actionMixin from './mixins/actionMixin';
8
8
  import filterMixin from './mixins/filterMixin';
9
9
  import modifierMixin from './mixins/modifierMixin';
10
10
  import paginationMixin from './mixins/paginationMixin';
11
- import Api from './api';
12
11
 
13
12
  /**
14
13
  * @mixes actionMixin
@@ -35,6 +34,13 @@ export default class Request {
35
34
  this._connection = new Connection();
36
35
 
37
36
  this._response = null;
37
+ this.key = null;
38
+ }
39
+
40
+ setKey (key) {
41
+ this.key = key;
42
+
43
+ return this;
38
44
  }
39
45
 
40
46
  get response () {
@@ -67,6 +73,8 @@ export default class Request {
67
73
  async get () {
68
74
  const url = this.url ?? this.constructor.endpoint;
69
75
 
76
+ this._connection.cancelRunning(this);
77
+
70
78
  this._response = await this._connection.get(
71
79
  url,
72
80
  this.bodyParameters,
@@ -85,6 +93,8 @@ export default class Request {
85
93
  async post (data = {}) {
86
94
  const url = this.url ?? this.constructor.endpoint;
87
95
 
96
+ this._connection.cancelRunning(this);
97
+
88
98
  this._response = await this._connection.post(
89
99
  url,
90
100
  data,
@@ -103,6 +113,8 @@ export default class Request {
103
113
  async put (data = {}) {
104
114
  const url = this.url ?? this.constructor.endpoint;
105
115
 
116
+ this._connection.cancelRunning(this);
117
+
106
118
  this._response = await this._connection.put(
107
119
  url,
108
120
  { ...data, ...this.bodyParameters },
@@ -119,6 +131,8 @@ export default class Request {
119
131
  async delete () {
120
132
  const url = this.url ?? this.constructor.endpoint;
121
133
 
134
+ this._connection.cancelRunning(this);
135
+
122
136
  this._response = await this._connection.delete(
123
137
  url,
124
138
  );
@@ -137,6 +151,8 @@ export default class Request {
137
151
  async storeFiles (files = {}, data = {}) {
138
152
  const url = this.url ?? this.constructor.endpoint;
139
153
 
154
+ this._connection.cancelRunning(this);
155
+
140
156
  this._connection.setConfig({
141
157
  headers: {
142
158
  'Content-Type': 'multipart/form-data',