miolo 0.3.5 → 0.4.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/cli/miolo.cli.iife.bundle.js +568 -163
  2. package/dist/cli/miolo.cli.iife.bundle.js.map +1 -1
  3. package/dist/cli/miolo.cli.iife.bundle.min.js +2 -13
  4. package/dist/cli/miolo.cli.iife.js +708 -5
  5. package/dist/cli/miolo.cli.iife.js.map +1 -1
  6. package/dist/cli/miolo.cli.iife.min.js +2 -2
  7. package/dist/cli/miolo.cli.min.mjs +2 -2
  8. package/dist/cli/miolo.cli.mjs +289 -3
  9. package/dist/cli/miolo.cli.mjs.map +1 -1
  10. package/dist/cli/miolo.cli.umd.bundle.js +568 -163
  11. package/dist/cli/miolo.cli.umd.bundle.js.map +1 -1
  12. package/dist/cli/miolo.cli.umd.bundle.min.js +2 -13
  13. package/dist/cli/miolo.cli.umd.js +710 -7
  14. package/dist/cli/miolo.cli.umd.js.map +1 -1
  15. package/dist/cli/miolo.cli.umd.min.js +2 -2
  16. package/dist/cli-react/miolo.cli-react.iife.bundle.js +6903 -542
  17. package/dist/cli-react/miolo.cli-react.iife.bundle.js.map +1 -1
  18. package/dist/cli-react/miolo.cli-react.iife.bundle.min.js +8 -21
  19. package/dist/cli-react/miolo.cli-react.iife.js +363 -6
  20. package/dist/cli-react/miolo.cli-react.iife.js.map +1 -1
  21. package/dist/cli-react/miolo.cli-react.iife.min.js +2 -2
  22. package/dist/cli-react/miolo.cli-react.min.mjs +2 -2
  23. package/dist/cli-react/miolo.cli-react.mjs +290 -34
  24. package/dist/cli-react/miolo.cli-react.mjs.map +1 -1
  25. package/dist/cli-react/miolo.cli-react.umd.bundle.js +6903 -542
  26. package/dist/cli-react/miolo.cli-react.umd.bundle.js.map +1 -1
  27. package/dist/cli-react/miolo.cli-react.umd.bundle.min.js +8 -21
  28. package/dist/cli-react/miolo.cli-react.umd.js +365 -8
  29. package/dist/cli-react/miolo.cli-react.umd.js.map +1 -1
  30. package/dist/cli-react/miolo.cli-react.umd.min.js +2 -2
  31. package/dist/server/miolo.server.cjs +919 -74
  32. package/dist/server/miolo.server.min.mjs +2 -2
  33. package/dist/server/miolo.server.mjs +648 -54
  34. package/dist/server/miolo.server.mjs.map +1 -1
  35. package/dist/server/miolo.server.node.mjs +919 -74
  36. package/logo/miolo_logo.png +0 -0
  37. package/logo/miolo_name.png +0 -0
  38. package/logo/miolo_sm.png +0 -0
  39. package/package.json +24 -23
@@ -1,5 +1,5 @@
1
1
  /**
2
- * miolo v0.3.5
2
+ * miolo v0.4.0-beta.0
3
3
  *
4
4
  * Copyright (c) Donato Lorenzo <donato@afialapis.com>
5
5
  *
@@ -45,36 +45,306 @@ var miolo = (function (exports) {
45
45
  };
46
46
  }
47
47
 
48
- /**
49
- * calustra v0.9.0
50
- *
51
- * Copyright (c) Donato Lorenzo <donato@afialapis.com>
52
- *
53
- * This source code is licensed under the MIT license found in the
54
- * LICENSE.md file in the root directory of this source tree.
55
- *
56
- * @license MIT
57
- */
58
- function ownKeys(object, enumerableOnly) {
59
- var keys = Object.keys(object);
60
- if (Object.getOwnPropertySymbols) {
61
- var symbols = Object.getOwnPropertySymbols(object);
62
- enumerableOnly && (symbols = symbols.filter(function (sym) {
63
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
64
- })), keys.push.apply(keys, symbols);
48
+ function _regeneratorRuntime() {
49
+ _regeneratorRuntime = function () {
50
+ return exports;
51
+ };
52
+ var exports = {},
53
+ Op = Object.prototype,
54
+ hasOwn = Op.hasOwnProperty,
55
+ defineProperty = Object.defineProperty || function (obj, key, desc) {
56
+ obj[key] = desc.value;
57
+ },
58
+ $Symbol = "function" == typeof Symbol ? Symbol : {},
59
+ iteratorSymbol = $Symbol.iterator || "@@iterator",
60
+ asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
61
+ toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
62
+ function define(obj, key, value) {
63
+ return Object.defineProperty(obj, key, {
64
+ value: value,
65
+ enumerable: !0,
66
+ configurable: !0,
67
+ writable: !0
68
+ }), obj[key];
65
69
  }
66
- return keys;
67
- }
68
- function _objectSpread2(target) {
69
- for (var i = 1; i < arguments.length; i++) {
70
- var source = null != arguments[i] ? arguments[i] : {};
71
- i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
72
- _defineProperty(target, key, source[key]);
73
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
74
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
70
+ try {
71
+ define({}, "");
72
+ } catch (err) {
73
+ define = function (obj, key, value) {
74
+ return obj[key] = value;
75
+ };
76
+ }
77
+ function wrap(innerFn, outerFn, self, tryLocsList) {
78
+ var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
79
+ generator = Object.create(protoGenerator.prototype),
80
+ context = new Context(tryLocsList || []);
81
+ return defineProperty(generator, "_invoke", {
82
+ value: makeInvokeMethod(innerFn, self, context)
83
+ }), generator;
84
+ }
85
+ function tryCatch(fn, obj, arg) {
86
+ try {
87
+ return {
88
+ type: "normal",
89
+ arg: fn.call(obj, arg)
90
+ };
91
+ } catch (err) {
92
+ return {
93
+ type: "throw",
94
+ arg: err
95
+ };
96
+ }
97
+ }
98
+ exports.wrap = wrap;
99
+ var ContinueSentinel = {};
100
+ function Generator() {}
101
+ function GeneratorFunction() {}
102
+ function GeneratorFunctionPrototype() {}
103
+ var IteratorPrototype = {};
104
+ define(IteratorPrototype, iteratorSymbol, function () {
105
+ return this;
106
+ });
107
+ var getProto = Object.getPrototypeOf,
108
+ NativeIteratorPrototype = getProto && getProto(getProto(values([])));
109
+ NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
110
+ var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
111
+ function defineIteratorMethods(prototype) {
112
+ ["next", "throw", "return"].forEach(function (method) {
113
+ define(prototype, method, function (arg) {
114
+ return this._invoke(method, arg);
115
+ });
75
116
  });
76
117
  }
77
- return target;
118
+ function AsyncIterator(generator, PromiseImpl) {
119
+ function invoke(method, arg, resolve, reject) {
120
+ var record = tryCatch(generator[method], generator, arg);
121
+ if ("throw" !== record.type) {
122
+ var result = record.arg,
123
+ value = result.value;
124
+ return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
125
+ invoke("next", value, resolve, reject);
126
+ }, function (err) {
127
+ invoke("throw", err, resolve, reject);
128
+ }) : PromiseImpl.resolve(value).then(function (unwrapped) {
129
+ result.value = unwrapped, resolve(result);
130
+ }, function (error) {
131
+ return invoke("throw", error, resolve, reject);
132
+ });
133
+ }
134
+ reject(record.arg);
135
+ }
136
+ var previousPromise;
137
+ defineProperty(this, "_invoke", {
138
+ value: function (method, arg) {
139
+ function callInvokeWithMethodAndArg() {
140
+ return new PromiseImpl(function (resolve, reject) {
141
+ invoke(method, arg, resolve, reject);
142
+ });
143
+ }
144
+ return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
145
+ }
146
+ });
147
+ }
148
+ function makeInvokeMethod(innerFn, self, context) {
149
+ var state = "suspendedStart";
150
+ return function (method, arg) {
151
+ if ("executing" === state) throw new Error("Generator is already running");
152
+ if ("completed" === state) {
153
+ if ("throw" === method) throw arg;
154
+ return doneResult();
155
+ }
156
+ for (context.method = method, context.arg = arg;;) {
157
+ var delegate = context.delegate;
158
+ if (delegate) {
159
+ var delegateResult = maybeInvokeDelegate(delegate, context);
160
+ if (delegateResult) {
161
+ if (delegateResult === ContinueSentinel) continue;
162
+ return delegateResult;
163
+ }
164
+ }
165
+ if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
166
+ if ("suspendedStart" === state) throw state = "completed", context.arg;
167
+ context.dispatchException(context.arg);
168
+ } else "return" === context.method && context.abrupt("return", context.arg);
169
+ state = "executing";
170
+ var record = tryCatch(innerFn, self, context);
171
+ if ("normal" === record.type) {
172
+ if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
173
+ return {
174
+ value: record.arg,
175
+ done: context.done
176
+ };
177
+ }
178
+ "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
179
+ }
180
+ };
181
+ }
182
+ function maybeInvokeDelegate(delegate, context) {
183
+ var methodName = context.method,
184
+ method = delegate.iterator[methodName];
185
+ if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
186
+ var record = tryCatch(method, delegate.iterator, context.arg);
187
+ if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
188
+ var info = record.arg;
189
+ return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
190
+ }
191
+ function pushTryEntry(locs) {
192
+ var entry = {
193
+ tryLoc: locs[0]
194
+ };
195
+ 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
196
+ }
197
+ function resetTryEntry(entry) {
198
+ var record = entry.completion || {};
199
+ record.type = "normal", delete record.arg, entry.completion = record;
200
+ }
201
+ function Context(tryLocsList) {
202
+ this.tryEntries = [{
203
+ tryLoc: "root"
204
+ }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
205
+ }
206
+ function values(iterable) {
207
+ if (iterable) {
208
+ var iteratorMethod = iterable[iteratorSymbol];
209
+ if (iteratorMethod) return iteratorMethod.call(iterable);
210
+ if ("function" == typeof iterable.next) return iterable;
211
+ if (!isNaN(iterable.length)) {
212
+ var i = -1,
213
+ next = function next() {
214
+ for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
215
+ return next.value = undefined, next.done = !0, next;
216
+ };
217
+ return next.next = next;
218
+ }
219
+ }
220
+ return {
221
+ next: doneResult
222
+ };
223
+ }
224
+ function doneResult() {
225
+ return {
226
+ value: undefined,
227
+ done: !0
228
+ };
229
+ }
230
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
231
+ value: GeneratorFunctionPrototype,
232
+ configurable: !0
233
+ }), defineProperty(GeneratorFunctionPrototype, "constructor", {
234
+ value: GeneratorFunction,
235
+ configurable: !0
236
+ }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
237
+ var ctor = "function" == typeof genFun && genFun.constructor;
238
+ return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
239
+ }, exports.mark = function (genFun) {
240
+ return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
241
+ }, exports.awrap = function (arg) {
242
+ return {
243
+ __await: arg
244
+ };
245
+ }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
246
+ return this;
247
+ }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
248
+ void 0 === PromiseImpl && (PromiseImpl = Promise);
249
+ var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
250
+ return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
251
+ return result.done ? result.value : iter.next();
252
+ });
253
+ }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
254
+ return this;
255
+ }), define(Gp, "toString", function () {
256
+ return "[object Generator]";
257
+ }), exports.keys = function (val) {
258
+ var object = Object(val),
259
+ keys = [];
260
+ for (var key in object) keys.push(key);
261
+ return keys.reverse(), function next() {
262
+ for (; keys.length;) {
263
+ var key = keys.pop();
264
+ if (key in object) return next.value = key, next.done = !1, next;
265
+ }
266
+ return next.done = !0, next;
267
+ };
268
+ }, exports.values = values, Context.prototype = {
269
+ constructor: Context,
270
+ reset: function (skipTempReset) {
271
+ if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
272
+ },
273
+ stop: function () {
274
+ this.done = !0;
275
+ var rootRecord = this.tryEntries[0].completion;
276
+ if ("throw" === rootRecord.type) throw rootRecord.arg;
277
+ return this.rval;
278
+ },
279
+ dispatchException: function (exception) {
280
+ if (this.done) throw exception;
281
+ var context = this;
282
+ function handle(loc, caught) {
283
+ return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
284
+ }
285
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
286
+ var entry = this.tryEntries[i],
287
+ record = entry.completion;
288
+ if ("root" === entry.tryLoc) return handle("end");
289
+ if (entry.tryLoc <= this.prev) {
290
+ var hasCatch = hasOwn.call(entry, "catchLoc"),
291
+ hasFinally = hasOwn.call(entry, "finallyLoc");
292
+ if (hasCatch && hasFinally) {
293
+ if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
294
+ if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
295
+ } else if (hasCatch) {
296
+ if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
297
+ } else {
298
+ if (!hasFinally) throw new Error("try statement without catch or finally");
299
+ if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
300
+ }
301
+ }
302
+ }
303
+ },
304
+ abrupt: function (type, arg) {
305
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
306
+ var entry = this.tryEntries[i];
307
+ if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
308
+ var finallyEntry = entry;
309
+ break;
310
+ }
311
+ }
312
+ finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
313
+ var record = finallyEntry ? finallyEntry.completion : {};
314
+ return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
315
+ },
316
+ complete: function (record, afterLoc) {
317
+ if ("throw" === record.type) throw record.arg;
318
+ return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
319
+ },
320
+ finish: function (finallyLoc) {
321
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
322
+ var entry = this.tryEntries[i];
323
+ if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
324
+ }
325
+ },
326
+ catch: function (tryLoc) {
327
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
328
+ var entry = this.tryEntries[i];
329
+ if (entry.tryLoc === tryLoc) {
330
+ var record = entry.completion;
331
+ if ("throw" === record.type) {
332
+ var thrown = record.arg;
333
+ resetTryEntry(entry);
334
+ }
335
+ return thrown;
336
+ }
337
+ }
338
+ throw new Error("illegal catch attempt");
339
+ },
340
+ delegateYield: function (iterable, resultName, nextLoc) {
341
+ return this.delegate = {
342
+ iterator: values(iterable),
343
+ resultName: resultName,
344
+ nextLoc: nextLoc
345
+ }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
346
+ }
347
+ }, exports;
78
348
  }
79
349
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
80
350
  try {
@@ -106,53 +376,41 @@ var miolo = (function (exports) {
106
376
  });
107
377
  };
108
378
  }
109
- function _defineProperty(obj, key, value) {
110
- key = _toPropertyKey(key);
111
- if (key in obj) {
112
- Object.defineProperty(obj, key, {
113
- value: value,
114
- enumerable: true,
115
- configurable: true,
116
- writable: true
117
- });
118
- } else {
119
- obj[key] = value;
120
- }
121
- return obj;
122
- }
123
- function _toPrimitive(input, hint) {
124
- if (typeof input !== "object" || input === null) return input;
125
- var prim = input[Symbol.toPrimitive];
126
- if (prim !== undefined) {
127
- var res = prim.call(input, hint || "default");
128
- if (typeof res !== "object") return res;
129
- throw new TypeError("@@toPrimitive must return a primitive value.");
130
- }
131
- return (hint === "string" ? String : Number)(input);
132
- }
133
- function _toPropertyKey(arg) {
134
- var key = _toPrimitive(arg, "string");
135
- return typeof key === "symbol" ? key : String(key);
379
+ function _extends() {
380
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
381
+ for (var i = 1; i < arguments.length; i++) {
382
+ var source = arguments[i];
383
+ for (var key in source) {
384
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
385
+ target[key] = source[key];
386
+ }
387
+ }
388
+ }
389
+ return target;
390
+ };
391
+ return _extends.apply(this, arguments);
136
392
  }
137
393
 
138
394
  /**
139
395
  * Transform an JSON object to a query string
140
396
  */
141
397
  function json_to_query_string(params) {
142
- return '?' + Object.keys(params).map(k => {
398
+ return '?' + Object.keys(params).map(function (k) {
143
399
  var name = encodeURIComponent(k);
144
400
  if (Array.isArray(params[k])) {
145
- return params[k].map(val => "".concat(name, "[]=").concat(encodeURIComponent(val))).join('&');
401
+ return params[k].map(function (val) {
402
+ return name + "[]=" + encodeURIComponent(val);
403
+ }).join('&');
146
404
  }
147
- return "".concat(name, "=").concat(encodeURIComponent(params[k]));
405
+ return name + "=" + encodeURIComponent(params[k]);
148
406
  }).join('&');
149
407
  }
150
408
  function trim_left(str, what) {
151
- return str.replace(new RegExp("^".concat(what || '\\s', "+")), '');
409
+ return str.replace(new RegExp("^" + (what || '\\s') + "+"), '');
152
410
  }
153
411
  function omit_nil(obj) {
154
412
  if (typeof obj !== 'object') return obj;
155
- return Object.keys(obj).reduce((acc, v) => {
413
+ return Object.keys(obj).reduce(function (acc, v) {
156
414
  if (obj[v] !== undefined) acc[v] = obj[v];
157
415
  return acc;
158
416
  }, {});
@@ -193,14 +451,14 @@ var miolo = (function (exports) {
193
451
  return Promise.resolve(response);
194
452
  }
195
453
  if (response.headers.get('content-type').indexOf('json') >= 0) {
196
- return response.json().then(res => {
454
+ return response.json().then(function (res) {
197
455
  return {
198
456
  data: res,
199
457
  status: response.status
200
458
  };
201
459
  });
202
460
  }
203
- return response.text().then(text => {
461
+ return response.text().then(function (text) {
204
462
  return {
205
463
  data: text,
206
464
  status: response.status
@@ -211,10 +469,10 @@ var miolo = (function (exports) {
211
469
  /**
212
470
  * Build and execute remote request
213
471
  */
214
- function calustra_fetch(method, url, params, isMultiForm, auth) {
472
+ function miolo_fetch(method, url, params, isMultiForm, auth) {
215
473
  var requestURL = _url_make(url) + (method === 'GET' && params ? json_to_query_string(params) : '');
216
474
  var request = {
217
- method,
475
+ method: method,
218
476
  mode: 'cors',
219
477
  credentials: 'include',
220
478
  headers: {
@@ -232,114 +490,261 @@ var miolo = (function (exports) {
232
490
  }
233
491
  request.body = formData;
234
492
  } else {
235
- request.body = JSON.stringify(params || {}, (k, v) => v === undefined ? null : v);
493
+ request.body = JSON.stringify(params || {}, function (k, v) {
494
+ return v === undefined ? null : v;
495
+ });
236
496
  }
237
497
  }
238
498
  return fetch(requestURL, request).then(_response_handle);
239
499
  }
240
500
 
241
- class Fetcher {
242
- constructor() {
243
- _defineProperty(this, "log_error", (msg, e) => {
501
+ var Fetcher = /*#__PURE__*/function () {
502
+ function Fetcher() {
503
+ this.log_error = function (msg, e) {
244
504
  console.error(msg);
245
505
  console.error(e);
246
- });
247
- }
248
- get(url, params) {
249
- var _this = this;
250
- return _asyncToGenerator(function* () {
251
- /* eslint no-unused-vars:0 */
252
- try {
253
- var resp = yield calustra_fetch('GET', url, omit_nil(params));
254
- return resp;
255
- } catch (e) {
256
- _this.log_error("Error on GET ".concat(url), e);
257
- return {
258
- data: undefined,
259
- status: -1
260
- };
261
- }
262
- })();
263
- }
264
- post(url, data) {
265
- var _this2 = this;
266
- return _asyncToGenerator(function* () {
267
- try {
268
- var resp = yield calustra_fetch('POST', url, data, false);
269
- return resp;
270
- } catch (e) {
271
- _this2.log_error("Error on POST ".concat(url), e);
272
- return {
273
- data: undefined,
274
- status: -1
275
- };
276
- }
277
- })();
278
- }
279
- read(url, params) {
280
- var _this3 = this;
281
- return _asyncToGenerator(function* () {
282
- var result = yield _this3.get("".concat(url, "/read"), params);
283
- return result.data;
284
- })();
285
- }
286
- key_list(url, params) {
287
- var _this4 = this;
288
- return _asyncToGenerator(function* () {
289
- var result = yield _this4.get("".concat(url, "/key_list"), params);
290
- return result.data;
291
- })();
292
- }
293
- name_list(url, params) {
294
- var _this5 = this;
295
- return _asyncToGenerator(function* () {
296
- var result = yield _this5.key_list(url, params);
297
- return Object.values(result);
298
- })();
299
- }
300
- find(url, id) {
301
- var _this6 = this;
302
- return _asyncToGenerator(function* () {
303
- var result = yield _this6.get("".concat(url, "/find"), {
304
- id: id
305
- });
306
- return result.data;
307
- })();
308
- }
309
- distinct(url, field, params) {
310
- var _this7 = this;
311
- return _asyncToGenerator(function* () {
312
- var nparams = _objectSpread2(_objectSpread2({}, params), {}, {
313
- distinct_field: field
314
- });
315
- var result = yield _this7.get("".concat(url, "/distinct"), nparams);
316
- return result.data;
317
- })();
506
+ };
318
507
  }
319
- upsave(url, data) {
320
- var _this8 = this;
321
- return _asyncToGenerator(function* () {
508
+ var _proto = Fetcher.prototype;
509
+ _proto.get = /*#__PURE__*/function () {
510
+ var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(url, params) {
511
+ var resp;
512
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
513
+ while (1) switch (_context.prev = _context.next) {
514
+ case 0:
515
+ _context.prev = 0;
516
+ _context.next = 3;
517
+ return miolo_fetch('GET', url, omit_nil(params));
518
+ case 3:
519
+ resp = _context.sent;
520
+ return _context.abrupt("return", resp);
521
+ case 7:
522
+ _context.prev = 7;
523
+ _context.t0 = _context["catch"](0);
524
+ this.log_error("Error on GET " + url, _context.t0);
525
+ return _context.abrupt("return", {
526
+ data: undefined,
527
+ status: -1
528
+ });
529
+ case 11:
530
+ case "end":
531
+ return _context.stop();
532
+ }
533
+ }, _callee, this, [[0, 7]]);
534
+ }));
535
+ function get(_x, _x2) {
536
+ return _get.apply(this, arguments);
537
+ }
538
+ return get;
539
+ }();
540
+ _proto.post = /*#__PURE__*/function () {
541
+ var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(url, data) {
542
+ var resp;
543
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
544
+ while (1) switch (_context2.prev = _context2.next) {
545
+ case 0:
546
+ _context2.prev = 0;
547
+ _context2.next = 3;
548
+ return miolo_fetch('POST', url, data, false);
549
+ case 3:
550
+ resp = _context2.sent;
551
+ return _context2.abrupt("return", resp);
552
+ case 7:
553
+ _context2.prev = 7;
554
+ _context2.t0 = _context2["catch"](0);
555
+ this.log_error("Error on POST " + url, _context2.t0);
556
+ return _context2.abrupt("return", {
557
+ data: undefined,
558
+ status: -1
559
+ });
560
+ case 11:
561
+ case "end":
562
+ return _context2.stop();
563
+ }
564
+ }, _callee2, this, [[0, 7]]);
565
+ }));
566
+ function post(_x3, _x4) {
567
+ return _post.apply(this, arguments);
568
+ }
569
+ return post;
570
+ }();
571
+ _proto.read = /*#__PURE__*/function () {
572
+ var _read = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(url, params) {
322
573
  var result;
323
- if (data.id == undefined) {
324
- delete data.id;
325
- result = yield _this8.post("".concat(url, "/save"), data);
326
- } else {
327
- result = yield _this8.post("".concat(url, "/update"), data);
328
- }
329
- return result.data;
330
- })();
331
- }
332
- remove(url, id) {
333
- var _this9 = this;
334
- return _asyncToGenerator(function* () {
335
- var data = {
336
- id: id
337
- };
338
- var result = yield _this9.post("".concat(url, "/delete"), data);
339
- return result.data;
340
- })();
341
- }
342
- }
574
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
575
+ while (1) switch (_context3.prev = _context3.next) {
576
+ case 0:
577
+ _context3.next = 2;
578
+ return this.get(url + "/read", params);
579
+ case 2:
580
+ result = _context3.sent;
581
+ return _context3.abrupt("return", result.data);
582
+ case 4:
583
+ case "end":
584
+ return _context3.stop();
585
+ }
586
+ }, _callee3, this);
587
+ }));
588
+ function read(_x5, _x6) {
589
+ return _read.apply(this, arguments);
590
+ }
591
+ return read;
592
+ }();
593
+ _proto.key_list = /*#__PURE__*/function () {
594
+ var _key_list = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(url, params) {
595
+ var result;
596
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
597
+ while (1) switch (_context4.prev = _context4.next) {
598
+ case 0:
599
+ _context4.next = 2;
600
+ return this.get(url + "/key_list", params);
601
+ case 2:
602
+ result = _context4.sent;
603
+ return _context4.abrupt("return", result.data);
604
+ case 4:
605
+ case "end":
606
+ return _context4.stop();
607
+ }
608
+ }, _callee4, this);
609
+ }));
610
+ function key_list(_x7, _x8) {
611
+ return _key_list.apply(this, arguments);
612
+ }
613
+ return key_list;
614
+ }();
615
+ _proto.name_list = /*#__PURE__*/function () {
616
+ var _name_list = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(url, params) {
617
+ var result;
618
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
619
+ while (1) switch (_context5.prev = _context5.next) {
620
+ case 0:
621
+ _context5.next = 2;
622
+ return this.key_list(url, params);
623
+ case 2:
624
+ result = _context5.sent;
625
+ return _context5.abrupt("return", Object.values(result));
626
+ case 4:
627
+ case "end":
628
+ return _context5.stop();
629
+ }
630
+ }, _callee5, this);
631
+ }));
632
+ function name_list(_x9, _x10) {
633
+ return _name_list.apply(this, arguments);
634
+ }
635
+ return name_list;
636
+ }();
637
+ _proto.find = /*#__PURE__*/function () {
638
+ var _find = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(url, id) {
639
+ var result;
640
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
641
+ while (1) switch (_context6.prev = _context6.next) {
642
+ case 0:
643
+ _context6.next = 2;
644
+ return this.get(url + "/find", {
645
+ id: id
646
+ });
647
+ case 2:
648
+ result = _context6.sent;
649
+ return _context6.abrupt("return", result.data);
650
+ case 4:
651
+ case "end":
652
+ return _context6.stop();
653
+ }
654
+ }, _callee6, this);
655
+ }));
656
+ function find(_x11, _x12) {
657
+ return _find.apply(this, arguments);
658
+ }
659
+ return find;
660
+ }();
661
+ _proto.distinct = /*#__PURE__*/function () {
662
+ var _distinct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(url, field, params) {
663
+ var nparams, result;
664
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
665
+ while (1) switch (_context7.prev = _context7.next) {
666
+ case 0:
667
+ nparams = _extends({}, params, {
668
+ distinct_field: field
669
+ });
670
+ _context7.next = 3;
671
+ return this.get(url + "/distinct", nparams);
672
+ case 3:
673
+ result = _context7.sent;
674
+ return _context7.abrupt("return", result.data);
675
+ case 5:
676
+ case "end":
677
+ return _context7.stop();
678
+ }
679
+ }, _callee7, this);
680
+ }));
681
+ function distinct(_x13, _x14, _x15) {
682
+ return _distinct.apply(this, arguments);
683
+ }
684
+ return distinct;
685
+ }();
686
+ _proto.upsave = /*#__PURE__*/function () {
687
+ var _upsave = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(url, data) {
688
+ var result;
689
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
690
+ while (1) switch (_context8.prev = _context8.next) {
691
+ case 0:
692
+ if (!(data.id == undefined)) {
693
+ _context8.next = 7;
694
+ break;
695
+ }
696
+ delete data.id;
697
+ _context8.next = 4;
698
+ return this.post(url + "/save", data);
699
+ case 4:
700
+ result = _context8.sent;
701
+ _context8.next = 10;
702
+ break;
703
+ case 7:
704
+ _context8.next = 9;
705
+ return this.post(url + "/update", data);
706
+ case 9:
707
+ result = _context8.sent;
708
+ case 10:
709
+ return _context8.abrupt("return", result.data);
710
+ case 11:
711
+ case "end":
712
+ return _context8.stop();
713
+ }
714
+ }, _callee8, this);
715
+ }));
716
+ function upsave(_x16, _x17) {
717
+ return _upsave.apply(this, arguments);
718
+ }
719
+ return upsave;
720
+ }();
721
+ _proto.remove = /*#__PURE__*/function () {
722
+ var _remove = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(url, id) {
723
+ var data, result;
724
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
725
+ while (1) switch (_context9.prev = _context9.next) {
726
+ case 0:
727
+ data = {
728
+ id: id
729
+ };
730
+ _context9.next = 3;
731
+ return this.post(url + "/delete", data);
732
+ case 3:
733
+ result = _context9.sent;
734
+ return _context9.abrupt("return", result.data);
735
+ case 5:
736
+ case "end":
737
+ return _context9.stop();
738
+ }
739
+ }, _callee9, this);
740
+ }));
741
+ function remove(_x18, _x19) {
742
+ return _remove.apply(this, arguments);
743
+ }
744
+ return remove;
745
+ }();
746
+ return Fetcher;
747
+ }();
343
748
  Fetcher.keyList = Fetcher.key_list;
344
749
  Fetcher.nameList = Fetcher.name_list;
345
750