@webiz/vue-api-query
Advanced tools
Comparing version
@@ -59,12 +59,8 @@ "use strict"; | ||
for (var _len = arguments.length, attributes = new Array(_len), _key = 0; _key < _len; _key++) { | ||
attributes[_key] = arguments[_key]; | ||
} | ||
if (attributes.length === 0) { | ||
if (arguments.length === 0) { | ||
_this._builder = new _Builder["default"]((0, _assertThisInitialized2["default"])(_this)); | ||
} else { | ||
Object.assign.apply(Object, [(0, _assertThisInitialized2["default"])(_this)].concat(attributes)); | ||
var _this2; | ||
_this._applyRelations((0, _assertThisInitialized2["default"])(_this)); | ||
(_this2 = _this).fill.apply(_this2, arguments); | ||
} | ||
@@ -148,4 +144,4 @@ | ||
value: function custom() { | ||
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | ||
args[_key2] = arguments[_key2]; | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
@@ -211,6 +207,6 @@ | ||
value: function _for() { | ||
var _this2 = this; | ||
var _this3 = this; | ||
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { | ||
args[_key3] = arguments[_key3]; | ||
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | ||
args[_key2] = arguments[_key2]; | ||
} | ||
@@ -228,3 +224,3 @@ | ||
if (!_this2.isValidId(object.getPrimaryKey())) { | ||
if (!_this3.isValidId(object.getPrimaryKey())) { | ||
throw new Error('The object referenced on for() method has an invalid id.'); | ||
@@ -379,3 +375,3 @@ } | ||
var model = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.constructor; | ||
var item = new model(data); | ||
var item = new model(data).fill(data); | ||
@@ -395,3 +391,3 @@ if (this._swr) { | ||
value: function _applyInstanceCollection(data) { | ||
var _this3 = this; | ||
var _this4 = this; | ||
@@ -402,3 +398,3 @@ var model = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.constructor; | ||
collection = collection.map(function (c) { | ||
return _this3._applyInstance(c, model); | ||
return _this4._applyInstance(c, model); | ||
}); | ||
@@ -533,3 +529,3 @@ return collection; | ||
value: function find(identifier) { | ||
var _this4 = this; | ||
var _this5 = this; | ||
@@ -546,3 +542,3 @@ if (identifier === undefined) { | ||
})).then(function (response) { | ||
return _this4._applyInstance(response.data); | ||
return _this5._applyInstance(response.data); | ||
}); | ||
@@ -553,3 +549,3 @@ } | ||
value: function $find(identifier) { | ||
var _this5 = this; | ||
var _this6 = this; | ||
@@ -561,3 +557,3 @@ if (identifier === undefined) { | ||
return this.find(identifier).then(function (response) { | ||
return _this5._applyInstance(response.data || response); | ||
return _this6._applyInstance(response.data || response); | ||
}); | ||
@@ -568,3 +564,3 @@ } | ||
value: function $$find(identifier) { | ||
var _this6 = this; | ||
var _this7 = this; | ||
@@ -579,3 +575,3 @@ if (identifier === undefined) { | ||
fetcher: function fetcher() { | ||
return _this6.$find(identifier); | ||
return _this7.$find(identifier); | ||
}, | ||
@@ -588,3 +584,3 @@ model: this | ||
value: function get() { | ||
var _this7 = this; | ||
var _this8 = this; | ||
@@ -598,3 +594,3 @@ var base = this._fromResource || "".concat(this.baseURL(), "/").concat(this.resource()); | ||
})).then(function (response) { | ||
var collection = _this7._applyInstanceCollection(response.data); | ||
var collection = _this8._applyInstanceCollection(response.data); | ||
@@ -620,3 +616,3 @@ if (response.data.data !== undefined) { | ||
value: function $$get() { | ||
var _this8 = this; | ||
var _this9 = this; | ||
@@ -629,3 +625,3 @@ var base = this._fromResource || "".concat(this.baseURL(), "/").concat(this.resource()); | ||
fetcher: function fetcher() { | ||
return _this8.$get(); | ||
return _this9.$get(); | ||
}, | ||
@@ -684,3 +680,3 @@ model: this | ||
value: function _create() { | ||
var _this9 = this; | ||
var _this10 = this; | ||
@@ -694,3 +690,3 @@ return this.request(this._reqConfig({ | ||
})).then(function (response) { | ||
return _this9._applyInstance(response.data.data || response.data); | ||
return _this10._applyInstance(response.data.data || response.data); | ||
}); | ||
@@ -701,3 +697,3 @@ } | ||
value: function _update() { | ||
var _this10 = this; | ||
var _this11 = this; | ||
@@ -709,3 +705,3 @@ return this.request(this._reqConfig({ | ||
})).then(function (response) { | ||
return _this10._applyInstance(response.data.data || response.data); | ||
return _this11._applyInstance(response.data.data || response.data); | ||
}); | ||
@@ -712,0 +708,0 @@ } |
{ | ||
"name": "@webiz/vue-api-query", | ||
"version": "1.2.1", | ||
"version": "1.3.0", | ||
"description": "💎 Elegant and simple way to build requests for REST API", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
71947
-0.35%1935
-0.15%