Socket
Socket
Sign inDemoInstall

miolo-tools

Package Overview
Dependencies
9
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.43 to 0.0.44

81

dist/miolo-tools.cjs.js

@@ -17,7 +17,5 @@ 'use strict';

var name = encodeURIComponent(k);
if (Array.isArray(params[k])) {
return params[k].map(val => "".concat(name, "[]=").concat(encodeURIComponent(val))).join('&');
}
return "".concat(name, "=").concat(encodeURIComponent(params[k]));

@@ -34,3 +32,2 @@ }).join('&');

*/
function _url_make(path) {

@@ -45,7 +42,6 @@ if (path.indexOf('http') == 0) {

}
/**
* Decide what to do with the response
*/
function _response_handle(response) {

@@ -56,3 +52,2 @@ if (response.redirected) {

}
if (response.headers.get('content-type').indexOf('json') >= 0) {

@@ -66,3 +61,2 @@ return response.json().then(res => {

}
return response.text().then(text => {

@@ -75,7 +69,6 @@ return {

}
/**
* Build and execute remote request
*/
function make_request(method, url, params, isMultiForm, auth) {

@@ -91,15 +84,11 @@ var requestURL = _url_make(url) + (method === 'GET' && params ? json_to_query_string(params) : '');

};
if (auth) {
request.headers['Authorization'] = 'Basic ' + Buffer.from(auth.username + ":" + auth.password).toString('base64');
}
if (method === 'POST') {
if (isMultiForm) {
var formData = new FormData();
for (var name in params) {
formData.append(name, params[name]);
}
request.body = formData;

@@ -110,3 +99,2 @@ } else {

}
return fetch__default["default"](requestURL, request).then(_response_handle);

@@ -116,3 +104,2 @@ }

var _DEF_CATCH_LOG_URL = '/sys/jserror';
function miolo_catcher_init(catch_log_url) {

@@ -142,3 +129,2 @@ window.onerror = function (msg, file, line, col, error) {

var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {

@@ -150,6 +136,4 @@ var symbols = Object.getOwnPropertySymbols(object);

}
return keys;
}
function _objectSpread2(target) {

@@ -164,6 +148,4 @@ for (var i = 1; i < arguments.length; i++) {

}
return target;
}
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {

@@ -177,3 +159,2 @@ try {

}
if (info.done) {

@@ -185,18 +166,14 @@ resolve(value);

}
function _asyncToGenerator(fn) {
return function () {
var self = this,
args = arguments;
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);

@@ -206,3 +183,2 @@ });

}
function _defineProperty(obj, key, value) {

@@ -219,3 +195,2 @@ if (key in obj) {

}
return obj;

@@ -236,3 +211,2 @@ }

},
post(url, data) {

@@ -242,5 +216,3 @@ var isMultiForm = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;

}
};
class Fetcher {

@@ -252,13 +224,9 @@ constructor() {

});
this.request = _FetcherRequester;
}
get(url) {
var _arguments = arguments,
_this = this;
_this = this;
return _asyncToGenerator(function* () {
var params = _arguments.length > 1 && _arguments[1] !== undefined ? _arguments[1] : {};
/* eslint no-unused-vars:0 */

@@ -270,3 +238,2 @@ try {

_this.log_error("Error on GET ".concat(url), e);
return {

@@ -279,10 +246,7 @@ data: undefined,

}
post(url) {
var _arguments2 = arguments,
_this2 = this;
_this2 = this;
return _asyncToGenerator(function* () {
var params = _arguments2.length > 1 && _arguments2[1] !== undefined ? _arguments2[1] : {};
try {

@@ -293,3 +257,2 @@ var resp = yield _this2.request.post(url, params);

_this2.log_error("Error on POST ".concat(url), e);
return {

@@ -302,7 +265,5 @@ data: undefined,

}
read(url) {
var _arguments3 = arguments,
_this3 = this;
_this3 = this;
return _asyncToGenerator(function* () {

@@ -315,7 +276,5 @@ var params = _arguments3.length > 1 && _arguments3[1] !== undefined ? _arguments3[1] : {};

}
key_list(url, params) {
var _arguments4 = arguments,
_this4 = this;
_this4 = this;
return _asyncToGenerator(function* () {

@@ -327,7 +286,5 @@ var options = _arguments4.length > 2 && _arguments4[2] !== undefined ? _arguments4[2] : {};

}
name_list(url, params) {
var _arguments5 = arguments,
_this5 = this;
_this5 = this;
return _asyncToGenerator(function* () {

@@ -339,7 +296,5 @@ var options = _arguments5.length > 2 && _arguments5[2] !== undefined ? _arguments5[2] : {};

}
find(url, id) {
var _arguments6 = arguments,
_this6 = this;
_this6 = this;
return _asyncToGenerator(function* () {

@@ -353,15 +308,11 @@ var options = _arguments6.length > 2 && _arguments6[2] !== undefined ? _arguments6[2] : {};

}
distinct(url, field) {
var _arguments7 = arguments,
_this7 = this;
_this7 = this;
return _asyncToGenerator(function* () {
var params = _arguments7.length > 2 && _arguments7[2] !== undefined ? _arguments7[2] : {};
var options = _arguments7.length > 3 && _arguments7[3] !== undefined ? _arguments7[3] : {};
var nparams = _objectSpread2(_objectSpread2({}, params), {}, {
distinct_field: field
});
var result = yield _this7.get("".concat(url, "/distinct"), nparams, options);

@@ -371,11 +322,8 @@ return result.data;

}
upsave(url, params) {
var _arguments8 = arguments,
_this8 = this;
_this8 = this;
return _asyncToGenerator(function* () {
var options = _arguments8.length > 2 && _arguments8[2] !== undefined ? _arguments8[2] : {};
var result;
if (params.id == undefined) {

@@ -387,11 +335,8 @@ delete params.id;

}
return result.data;
})();
}
remove(url, id) {
var _arguments9 = arguments,
_this9 = this;
_this9 = this;
return _asyncToGenerator(function* () {

@@ -406,5 +351,3 @@ var options = _arguments9.length > 2 && _arguments9[2] !== undefined ? _arguments9[2] : {};

}
}
Fetcher.keyList = Fetcher.key_list;

@@ -411,0 +354,0 @@ Fetcher.nameList = Fetcher.name_list;

@@ -9,7 +9,5 @@ import fetch from 'isomorphic-fetch';

var name = encodeURIComponent(k);
if (Array.isArray(params[k])) {
return params[k].map(val => "".concat(name, "[]=").concat(encodeURIComponent(val))).join('&');
}
return "".concat(name, "=").concat(encodeURIComponent(params[k]));

@@ -26,3 +24,2 @@ }).join('&');

*/
function _url_make(path) {

@@ -37,7 +34,6 @@ if (path.indexOf('http') == 0) {

}
/**
* Decide what to do with the response
*/
function _response_handle(response) {

@@ -48,3 +44,2 @@ if (response.redirected) {

}
if (response.headers.get('content-type').indexOf('json') >= 0) {

@@ -58,3 +53,2 @@ return response.json().then(res => {

}
return response.text().then(text => {

@@ -67,7 +61,6 @@ return {

}
/**
* Build and execute remote request
*/
function make_request(method, url, params, isMultiForm, auth) {

@@ -83,15 +76,11 @@ var requestURL = _url_make(url) + (method === 'GET' && params ? json_to_query_string(params) : '');

};
if (auth) {
request.headers['Authorization'] = 'Basic ' + Buffer.from(auth.username + ":" + auth.password).toString('base64');
}
if (method === 'POST') {
if (isMultiForm) {
var formData = new FormData();
for (var name in params) {
formData.append(name, params[name]);
}
request.body = formData;

@@ -102,3 +91,2 @@ } else {

}
return fetch(requestURL, request).then(_response_handle);

@@ -108,3 +96,2 @@ }

var _DEF_CATCH_LOG_URL = '/sys/jserror';
function miolo_catcher_init(catch_log_url) {

@@ -134,3 +121,2 @@ window.onerror = function (msg, file, line, col, error) {

var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {

@@ -142,6 +128,4 @@ var symbols = Object.getOwnPropertySymbols(object);

}
return keys;
}
function _objectSpread2(target) {

@@ -156,6 +140,4 @@ for (var i = 1; i < arguments.length; i++) {

}
return target;
}
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {

@@ -169,3 +151,2 @@ try {

}
if (info.done) {

@@ -177,18 +158,14 @@ resolve(value);

}
function _asyncToGenerator(fn) {
return function () {
var self = this,
args = arguments;
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);

@@ -198,3 +175,2 @@ });

}
function _defineProperty(obj, key, value) {

@@ -211,3 +187,2 @@ if (key in obj) {

}
return obj;

@@ -228,3 +203,2 @@ }

},
post(url, data) {

@@ -234,5 +208,3 @@ var isMultiForm = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;

}
};
class Fetcher {

@@ -244,13 +216,9 @@ constructor() {

});
this.request = _FetcherRequester;
}
get(url) {
var _arguments = arguments,
_this = this;
_this = this;
return _asyncToGenerator(function* () {
var params = _arguments.length > 1 && _arguments[1] !== undefined ? _arguments[1] : {};
/* eslint no-unused-vars:0 */

@@ -262,3 +230,2 @@ try {

_this.log_error("Error on GET ".concat(url), e);
return {

@@ -271,10 +238,7 @@ data: undefined,

}
post(url) {
var _arguments2 = arguments,
_this2 = this;
_this2 = this;
return _asyncToGenerator(function* () {
var params = _arguments2.length > 1 && _arguments2[1] !== undefined ? _arguments2[1] : {};
try {

@@ -285,3 +249,2 @@ var resp = yield _this2.request.post(url, params);

_this2.log_error("Error on POST ".concat(url), e);
return {

@@ -294,7 +257,5 @@ data: undefined,

}
read(url) {
var _arguments3 = arguments,
_this3 = this;
_this3 = this;
return _asyncToGenerator(function* () {

@@ -307,7 +268,5 @@ var params = _arguments3.length > 1 && _arguments3[1] !== undefined ? _arguments3[1] : {};

}
key_list(url, params) {
var _arguments4 = arguments,
_this4 = this;
_this4 = this;
return _asyncToGenerator(function* () {

@@ -319,7 +278,5 @@ var options = _arguments4.length > 2 && _arguments4[2] !== undefined ? _arguments4[2] : {};

}
name_list(url, params) {
var _arguments5 = arguments,
_this5 = this;
_this5 = this;
return _asyncToGenerator(function* () {

@@ -331,7 +288,5 @@ var options = _arguments5.length > 2 && _arguments5[2] !== undefined ? _arguments5[2] : {};

}
find(url, id) {
var _arguments6 = arguments,
_this6 = this;
_this6 = this;
return _asyncToGenerator(function* () {

@@ -345,15 +300,11 @@ var options = _arguments6.length > 2 && _arguments6[2] !== undefined ? _arguments6[2] : {};

}
distinct(url, field) {
var _arguments7 = arguments,
_this7 = this;
_this7 = this;
return _asyncToGenerator(function* () {
var params = _arguments7.length > 2 && _arguments7[2] !== undefined ? _arguments7[2] : {};
var options = _arguments7.length > 3 && _arguments7[3] !== undefined ? _arguments7[3] : {};
var nparams = _objectSpread2(_objectSpread2({}, params), {}, {
distinct_field: field
});
var result = yield _this7.get("".concat(url, "/distinct"), nparams, options);

@@ -363,11 +314,8 @@ return result.data;

}
upsave(url, params) {
var _arguments8 = arguments,
_this8 = this;
_this8 = this;
return _asyncToGenerator(function* () {
var options = _arguments8.length > 2 && _arguments8[2] !== undefined ? _arguments8[2] : {};
var result;
if (params.id == undefined) {

@@ -379,11 +327,8 @@ delete params.id;

}
return result.data;
})();
}
remove(url, id) {
var _arguments9 = arguments,
_this9 = this;
_this9 = this;
return _asyncToGenerator(function* () {

@@ -398,5 +343,3 @@ var options = _arguments9.length > 2 && _arguments9[2] !== undefined ? _arguments9[2] : {};

}
}
Fetcher.keyList = Fetcher.key_list;

@@ -403,0 +346,0 @@ Fetcher.nameList = Fetcher.name_list;

@@ -17,7 +17,5 @@ (function (global, factory) {

var name = encodeURIComponent(k);
if (Array.isArray(params[k])) {
return params[k].map(val => "".concat(name, "[]=").concat(encodeURIComponent(val))).join('&');
}
return "".concat(name, "=").concat(encodeURIComponent(params[k]));

@@ -34,3 +32,2 @@ }).join('&');

*/
function _url_make(path) {

@@ -45,7 +42,6 @@ if (path.indexOf('http') == 0) {

}
/**
* Decide what to do with the response
*/
function _response_handle(response) {

@@ -56,3 +52,2 @@ if (response.redirected) {

}
if (response.headers.get('content-type').indexOf('json') >= 0) {

@@ -66,3 +61,2 @@ return response.json().then(res => {

}
return response.text().then(text => {

@@ -75,7 +69,6 @@ return {

}
/**
* Build and execute remote request
*/
function make_request(method, url, params, isMultiForm, auth) {

@@ -91,15 +84,11 @@ var requestURL = _url_make(url) + (method === 'GET' && params ? json_to_query_string(params) : '');

};
if (auth) {
request.headers['Authorization'] = 'Basic ' + Buffer.from(auth.username + ":" + auth.password).toString('base64');
}
if (method === 'POST') {
if (isMultiForm) {
var formData = new FormData();
for (var name in params) {
formData.append(name, params[name]);
}
request.body = formData;

@@ -110,3 +99,2 @@ } else {

}
return fetch__default["default"](requestURL, request).then(_response_handle);

@@ -116,3 +104,2 @@ }

var _DEF_CATCH_LOG_URL = '/sys/jserror';
function miolo_catcher_init(catch_log_url) {

@@ -142,3 +129,2 @@ window.onerror = function (msg, file, line, col, error) {

var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {

@@ -150,6 +136,4 @@ var symbols = Object.getOwnPropertySymbols(object);

}
return keys;
}
function _objectSpread2(target) {

@@ -164,6 +148,4 @@ for (var i = 1; i < arguments.length; i++) {

}
return target;
}
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {

@@ -177,3 +159,2 @@ try {

}
if (info.done) {

@@ -185,18 +166,14 @@ resolve(value);

}
function _asyncToGenerator(fn) {
return function () {
var self = this,
args = arguments;
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);

@@ -206,3 +183,2 @@ });

}
function _defineProperty(obj, key, value) {

@@ -219,3 +195,2 @@ if (key in obj) {

}
return obj;

@@ -236,3 +211,2 @@ }

},
post(url, data) {

@@ -242,5 +216,3 @@ var isMultiForm = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;

}
};
class Fetcher {

@@ -252,13 +224,9 @@ constructor() {

});
this.request = _FetcherRequester;
}
get(url) {
var _arguments = arguments,
_this = this;
_this = this;
return _asyncToGenerator(function* () {
var params = _arguments.length > 1 && _arguments[1] !== undefined ? _arguments[1] : {};
/* eslint no-unused-vars:0 */

@@ -270,3 +238,2 @@ try {

_this.log_error("Error on GET ".concat(url), e);
return {

@@ -279,10 +246,7 @@ data: undefined,

}
post(url) {
var _arguments2 = arguments,
_this2 = this;
_this2 = this;
return _asyncToGenerator(function* () {
var params = _arguments2.length > 1 && _arguments2[1] !== undefined ? _arguments2[1] : {};
try {

@@ -293,3 +257,2 @@ var resp = yield _this2.request.post(url, params);

_this2.log_error("Error on POST ".concat(url), e);
return {

@@ -302,7 +265,5 @@ data: undefined,

}
read(url) {
var _arguments3 = arguments,
_this3 = this;
_this3 = this;
return _asyncToGenerator(function* () {

@@ -315,7 +276,5 @@ var params = _arguments3.length > 1 && _arguments3[1] !== undefined ? _arguments3[1] : {};

}
key_list(url, params) {
var _arguments4 = arguments,
_this4 = this;
_this4 = this;
return _asyncToGenerator(function* () {

@@ -327,7 +286,5 @@ var options = _arguments4.length > 2 && _arguments4[2] !== undefined ? _arguments4[2] : {};

}
name_list(url, params) {
var _arguments5 = arguments,
_this5 = this;
_this5 = this;
return _asyncToGenerator(function* () {

@@ -339,7 +296,5 @@ var options = _arguments5.length > 2 && _arguments5[2] !== undefined ? _arguments5[2] : {};

}
find(url, id) {
var _arguments6 = arguments,
_this6 = this;
_this6 = this;
return _asyncToGenerator(function* () {

@@ -353,15 +308,11 @@ var options = _arguments6.length > 2 && _arguments6[2] !== undefined ? _arguments6[2] : {};

}
distinct(url, field) {
var _arguments7 = arguments,
_this7 = this;
_this7 = this;
return _asyncToGenerator(function* () {
var params = _arguments7.length > 2 && _arguments7[2] !== undefined ? _arguments7[2] : {};
var options = _arguments7.length > 3 && _arguments7[3] !== undefined ? _arguments7[3] : {};
var nparams = _objectSpread2(_objectSpread2({}, params), {}, {
distinct_field: field
});
var result = yield _this7.get("".concat(url, "/distinct"), nparams, options);

@@ -371,11 +322,8 @@ return result.data;

}
upsave(url, params) {
var _arguments8 = arguments,
_this8 = this;
_this8 = this;
return _asyncToGenerator(function* () {
var options = _arguments8.length > 2 && _arguments8[2] !== undefined ? _arguments8[2] : {};
var result;
if (params.id == undefined) {

@@ -387,11 +335,8 @@ delete params.id;

}
return result.data;
})();
}
remove(url, id) {
var _arguments9 = arguments,
_this9 = this;
_this9 = this;
return _asyncToGenerator(function* () {

@@ -406,5 +351,3 @@ var options = _arguments9.length > 2 && _arguments9[2] !== undefined ? _arguments9[2] : {};

}
}
Fetcher.keyList = Fetcher.key_list;

@@ -411,0 +354,0 @@ Fetcher.nameList = Fetcher.name_list;

@@ -17,7 +17,5 @@ (function (global, factory) {

var name = encodeURIComponent(k);
if (Array.isArray(params[k])) {
return params[k].map(val => "".concat(name, "[]=").concat(encodeURIComponent(val))).join('&');
}
return "".concat(name, "=").concat(encodeURIComponent(params[k]));

@@ -34,3 +32,2 @@ }).join('&');

*/
function _url_make(path) {

@@ -45,7 +42,6 @@ if (path.indexOf('http') == 0) {

}
/**
* Decide what to do with the response
*/
function _response_handle(response) {

@@ -56,3 +52,2 @@ if (response.redirected) {

}
if (response.headers.get('content-type').indexOf('json') >= 0) {

@@ -66,3 +61,2 @@ return response.json().then(res => {

}
return response.text().then(text => {

@@ -75,7 +69,6 @@ return {

}
/**
* Build and execute remote request
*/
function make_request(method, url, params, isMultiForm, auth) {

@@ -91,15 +84,11 @@ var requestURL = _url_make(url) + (method === 'GET' && params ? json_to_query_string(params) : '');

};
if (auth) {
request.headers['Authorization'] = 'Basic ' + Buffer.from(auth.username + ":" + auth.password).toString('base64');
}
if (method === 'POST') {
if (isMultiForm) {
var formData = new FormData();
for (var name in params) {
formData.append(name, params[name]);
}
request.body = formData;

@@ -110,3 +99,2 @@ } else {

}
return fetch__default["default"](requestURL, request).then(_response_handle);

@@ -116,3 +104,2 @@ }

var _DEF_CATCH_LOG_URL = '/sys/jserror';
function miolo_catcher_init(catch_log_url) {

@@ -142,3 +129,2 @@ window.onerror = function (msg, file, line, col, error) {

var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {

@@ -150,6 +136,4 @@ var symbols = Object.getOwnPropertySymbols(object);

}
return keys;
}
function _objectSpread2(target) {

@@ -164,6 +148,4 @@ for (var i = 1; i < arguments.length; i++) {

}
return target;
}
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {

@@ -177,3 +159,2 @@ try {

}
if (info.done) {

@@ -185,18 +166,14 @@ resolve(value);

}
function _asyncToGenerator(fn) {
return function () {
var self = this,
args = arguments;
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);

@@ -206,3 +183,2 @@ });

}
function _defineProperty(obj, key, value) {

@@ -219,3 +195,2 @@ if (key in obj) {

}
return obj;

@@ -236,3 +211,2 @@ }

},
post(url, data) {

@@ -242,5 +216,3 @@ var isMultiForm = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;

}
};
class Fetcher {

@@ -252,13 +224,9 @@ constructor() {

});
this.request = _FetcherRequester;
}
get(url) {
var _arguments = arguments,
_this = this;
_this = this;
return _asyncToGenerator(function* () {
var params = _arguments.length > 1 && _arguments[1] !== undefined ? _arguments[1] : {};
/* eslint no-unused-vars:0 */

@@ -270,3 +238,2 @@ try {

_this.log_error("Error on GET ".concat(url), e);
return {

@@ -279,10 +246,7 @@ data: undefined,

}
post(url) {
var _arguments2 = arguments,
_this2 = this;
_this2 = this;
return _asyncToGenerator(function* () {
var params = _arguments2.length > 1 && _arguments2[1] !== undefined ? _arguments2[1] : {};
try {

@@ -293,3 +257,2 @@ var resp = yield _this2.request.post(url, params);

_this2.log_error("Error on POST ".concat(url), e);
return {

@@ -302,7 +265,5 @@ data: undefined,

}
read(url) {
var _arguments3 = arguments,
_this3 = this;
_this3 = this;
return _asyncToGenerator(function* () {

@@ -315,7 +276,5 @@ var params = _arguments3.length > 1 && _arguments3[1] !== undefined ? _arguments3[1] : {};

}
key_list(url, params) {
var _arguments4 = arguments,
_this4 = this;
_this4 = this;
return _asyncToGenerator(function* () {

@@ -327,7 +286,5 @@ var options = _arguments4.length > 2 && _arguments4[2] !== undefined ? _arguments4[2] : {};

}
name_list(url, params) {
var _arguments5 = arguments,
_this5 = this;
_this5 = this;
return _asyncToGenerator(function* () {

@@ -339,7 +296,5 @@ var options = _arguments5.length > 2 && _arguments5[2] !== undefined ? _arguments5[2] : {};

}
find(url, id) {
var _arguments6 = arguments,
_this6 = this;
_this6 = this;
return _asyncToGenerator(function* () {

@@ -353,15 +308,11 @@ var options = _arguments6.length > 2 && _arguments6[2] !== undefined ? _arguments6[2] : {};

}
distinct(url, field) {
var _arguments7 = arguments,
_this7 = this;
_this7 = this;
return _asyncToGenerator(function* () {
var params = _arguments7.length > 2 && _arguments7[2] !== undefined ? _arguments7[2] : {};
var options = _arguments7.length > 3 && _arguments7[3] !== undefined ? _arguments7[3] : {};
var nparams = _objectSpread2(_objectSpread2({}, params), {}, {
distinct_field: field
});
var result = yield _this7.get("".concat(url, "/distinct"), nparams, options);

@@ -371,11 +322,8 @@ return result.data;

}
upsave(url, params) {
var _arguments8 = arguments,
_this8 = this;
_this8 = this;
return _asyncToGenerator(function* () {
var options = _arguments8.length > 2 && _arguments8[2] !== undefined ? _arguments8[2] : {};
var result;
if (params.id == undefined) {

@@ -387,11 +335,8 @@ delete params.id;

}
return result.data;
})();
}
remove(url, id) {
var _arguments9 = arguments,
_this9 = this;
_this9 = this;
return _asyncToGenerator(function* () {

@@ -406,5 +351,3 @@ var options = _arguments9.length > 2 && _arguments9[2] !== undefined ? _arguments9[2] : {};

}
}
Fetcher.keyList = Fetcher.key_list;

@@ -411,0 +354,0 @@ Fetcher.nameList = Fetcher.name_list;

@@ -7,7 +7,4 @@ "use strict";

exports.miolo_catcher_init = miolo_catcher_init;
var _request = require("../request");
var _DEF_CATCH_LOG_URL = '/sys/jserror';
function miolo_catcher_init(catch_log_url) {

@@ -14,0 +11,0 @@ window.onerror = function (msg, file, line, col, error) {

@@ -7,17 +7,9 @@ "use strict";

exports.Fetcher = void 0;
var _request = require("../request");
var _utils = require("./utils");
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function 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); } }
function _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); }); }; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var _FetcherRequester = {

@@ -27,3 +19,2 @@ get(url, params) {

},
post(url, data) {

@@ -33,5 +24,3 @@ var isMultiForm = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;

}
};
class Fetcher {

@@ -43,14 +32,10 @@ constructor() {

});
this.request = _FetcherRequester;
}
get(url) {
var _arguments = arguments,
_this = this;
_this = this;
return _asyncToGenerator(function* () {
var params = _arguments.length > 1 && _arguments[1] !== undefined ? _arguments[1] : {};
var options = _arguments.length > 2 && _arguments[2] !== undefined ? _arguments[2] : {};
/* eslint no-unused-vars:0 */

@@ -62,3 +47,2 @@ try {

_this.log_error("Error on GET ".concat(url), e);
return {

@@ -71,11 +55,8 @@ data: undefined,

}
post(url) {
var _arguments2 = arguments,
_this2 = this;
_this2 = this;
return _asyncToGenerator(function* () {
var params = _arguments2.length > 1 && _arguments2[1] !== undefined ? _arguments2[1] : {};
var options = _arguments2.length > 2 && _arguments2[2] !== undefined ? _arguments2[2] : {};
try {

@@ -86,3 +67,2 @@ var resp = yield _this2.request.post(url, params);

_this2.log_error("Error on POST ".concat(url), e);
return {

@@ -95,7 +75,5 @@ data: undefined,

}
read(url) {
var _arguments3 = arguments,
_this3 = this;
_this3 = this;
return _asyncToGenerator(function* () {

@@ -108,7 +86,5 @@ var params = _arguments3.length > 1 && _arguments3[1] !== undefined ? _arguments3[1] : {};

}
key_list(url, params) {
var _arguments4 = arguments,
_this4 = this;
_this4 = this;
return _asyncToGenerator(function* () {

@@ -120,7 +96,5 @@ var options = _arguments4.length > 2 && _arguments4[2] !== undefined ? _arguments4[2] : {};

}
name_list(url, params) {
var _arguments5 = arguments,
_this5 = this;
_this5 = this;
return _asyncToGenerator(function* () {

@@ -132,7 +106,5 @@ var options = _arguments5.length > 2 && _arguments5[2] !== undefined ? _arguments5[2] : {};

}
find(url, id) {
var _arguments6 = arguments,
_this6 = this;
_this6 = this;
return _asyncToGenerator(function* () {

@@ -146,15 +118,11 @@ var options = _arguments6.length > 2 && _arguments6[2] !== undefined ? _arguments6[2] : {};

}
distinct(url, field) {
var _arguments7 = arguments,
_this7 = this;
_this7 = this;
return _asyncToGenerator(function* () {
var params = _arguments7.length > 2 && _arguments7[2] !== undefined ? _arguments7[2] : {};
var options = _arguments7.length > 3 && _arguments7[3] !== undefined ? _arguments7[3] : {};
var nparams = _objectSpread(_objectSpread({}, params), {}, {
distinct_field: field
});
var result = yield _this7.get("".concat(url, "/distinct"), nparams, options);

@@ -164,11 +132,8 @@ return result.data;

}
upsave(url, params) {
var _arguments8 = arguments,
_this8 = this;
_this8 = this;
return _asyncToGenerator(function* () {
var options = _arguments8.length > 2 && _arguments8[2] !== undefined ? _arguments8[2] : {};
var result;
if (params.id == undefined) {

@@ -180,11 +145,8 @@ delete params.id;

}
return result.data;
})();
}
remove(url, id) {
var _arguments9 = arguments,
_this9 = this;
_this9 = this;
return _asyncToGenerator(function* () {

@@ -199,7 +161,5 @@ var options = _arguments9.length > 2 && _arguments9[2] !== undefined ? _arguments9[2] : {};

}
}
exports.Fetcher = Fetcher;
Fetcher.keyList = Fetcher.key_list;
Fetcher.nameList = Fetcher.name_list;

@@ -7,3 +7,2 @@ "use strict";

exports.omit_nil = omit_nil;
function omit_nil(obj) {

@@ -10,0 +9,0 @@ if (typeof obj !== 'object') return obj;

@@ -24,7 +24,4 @@ "use strict";

});
var _catcher = require("./catcher");
var _fetcher = require("./fetcher");
var _request = require("./request");

@@ -7,11 +7,6 @@ "use strict";

exports.make_request = make_request;
var _isomorphicFetch = _interopRequireDefault(require("isomorphic-fetch"));
var _queryString = require("./queryString");
var _utils = require("./utils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**

@@ -29,7 +24,6 @@ * Prepend host of API server

}
/**
* Decide what to do with the response
*/
function _response_handle(response) {

@@ -40,3 +34,2 @@ if (response.redirected) {

}
if (response.headers.get('content-type').indexOf('json') >= 0) {

@@ -50,3 +43,2 @@ return response.json().then(res => {

}
return response.text().then(text => {

@@ -59,7 +51,6 @@ return {

}
/**
* Build and execute remote request
*/
function make_request(method, url, params, isMultiForm, auth) {

@@ -75,15 +66,11 @@ var requestURL = _url_make(url) + (method === 'GET' && params ? (0, _queryString.json_to_query_string)(params) : '');

};
if (auth) {
request.headers['Authorization'] = 'Basic ' + Buffer.from(auth.username + ":" + auth.password).toString('base64');
}
if (method === 'POST') {
if (isMultiForm) {
var formData = new FormData();
for (var name in params) {
formData.append(name, params[name]);
}
request.body = formData;

@@ -94,4 +81,3 @@ } else {

}
return (0, _isomorphicFetch.default)(requestURL, request).then(_response_handle);
}

@@ -8,3 +8,2 @@ "use strict";

exports.json_to_query_string = json_to_query_string;
/**

@@ -16,18 +15,14 @@ * Transform an JSON object to a query string

var name = encodeURIComponent(k);
if (Array.isArray(params[k])) {
return params[k].map(val => "".concat(name, "[]=").concat(encodeURIComponent(val))).join('&');
}
return "".concat(name, "=").concat(encodeURIComponent(params[k]));
}).join('&');
}
/**
* Transform a query string to a JSON object
*/
function jquery_string_to_json(url) {
var search = url.indexOf('?') >= 0 ? url.substr(url.indexOf('?')) : '';
if (search && search != '?') {

@@ -42,4 +37,3 @@ var pairs = search.slice(1).split('&');

}
return {};
}

@@ -7,5 +7,4 @@ "use strict";

exports.trim_left = trim_left;
function trim_left(str, what) {
return str.replace(new RegExp("^".concat(what || '\\s', "+")), '');
}

2

package.json
{
"name": "miolo-tools",
"version": "0.0.43",
"version": "0.0.44",
"description": "cli tools for miolo",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc