1 | (function webpackUniversalModuleDefinition(root, factory) {
|
2 | if(typeof exports === 'object' && typeof module === 'object')
|
3 | module.exports = factory();
|
4 | else if(typeof define === 'function' && define.amd)
|
5 | define([], factory);
|
6 | else {
|
7 | var a = factory();
|
8 | for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
9 | }
|
10 | })(window, function() {
|
11 | return (function(modules) {
|
12 |
|
13 | var installedModules = {};
|
14 |
|
15 |
|
16 | function __webpack_require__(moduleId) {
|
17 |
|
18 |
|
19 | if(installedModules[moduleId]) {
|
20 | return installedModules[moduleId].exports;
|
21 | }
|
22 |
|
23 | var module = installedModules[moduleId] = {
|
24 | i: moduleId,
|
25 | l: false,
|
26 | exports: {}
|
27 | };
|
28 |
|
29 |
|
30 | modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
31 |
|
32 |
|
33 | module.l = true;
|
34 |
|
35 |
|
36 | return module.exports;
|
37 | }
|
38 |
|
39 |
|
40 |
|
41 | __webpack_require__.m = modules;
|
42 |
|
43 |
|
44 | __webpack_require__.c = installedModules;
|
45 |
|
46 |
|
47 | __webpack_require__.d = function(exports, name, getter) {
|
48 | if(!__webpack_require__.o(exports, name)) {
|
49 | Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
50 | }
|
51 | };
|
52 |
|
53 |
|
54 | __webpack_require__.r = function(exports) {
|
55 | if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
56 | Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
57 | }
|
58 | Object.defineProperty(exports, '__esModule', { value: true });
|
59 | };
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 | __webpack_require__.t = function(value, mode) {
|
67 | if(mode & 1) value = __webpack_require__(value);
|
68 | if(mode & 8) return value;
|
69 | if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
70 | var ns = Object.create(null);
|
71 | __webpack_require__.r(ns);
|
72 | Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
73 | if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
74 | return ns;
|
75 | };
|
76 |
|
77 |
|
78 | __webpack_require__.n = function(module) {
|
79 | var getter = module && module.__esModule ?
|
80 | function getDefault() { return module['default']; } :
|
81 | function getModuleExports() { return module; };
|
82 | __webpack_require__.d(getter, 'a', getter);
|
83 | return getter;
|
84 | };
|
85 |
|
86 |
|
87 | __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
88 |
|
89 |
|
90 | __webpack_require__.p = "";
|
91 |
|
92 |
|
93 |
|
94 | return __webpack_require__(__webpack_require__.s = 0);
|
95 | })
|
96 |
|
97 | ({
|
98 |
|
99 | "./node_modules/events/events.js":
|
100 |
|
101 |
|
102 |
|
103 |
|
104 | (function(module, exports, __webpack_require__) {
|
105 |
|
106 | "use strict";
|
107 |
|
108 |
|
109 |
|
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 |
|
121 |
|
122 |
|
123 |
|
124 |
|
125 |
|
126 |
|
127 |
|
128 |
|
129 |
|
130 | var R = typeof Reflect === 'object' ? Reflect : null
|
131 | var ReflectApply = R && typeof R.apply === 'function'
|
132 | ? R.apply
|
133 | : function ReflectApply(target, receiver, args) {
|
134 | return Function.prototype.apply.call(target, receiver, args);
|
135 | }
|
136 |
|
137 | var ReflectOwnKeys
|
138 | if (R && typeof R.ownKeys === 'function') {
|
139 | ReflectOwnKeys = R.ownKeys
|
140 | } else if (Object.getOwnPropertySymbols) {
|
141 | ReflectOwnKeys = function ReflectOwnKeys(target) {
|
142 | return Object.getOwnPropertyNames(target)
|
143 | .concat(Object.getOwnPropertySymbols(target));
|
144 | };
|
145 | } else {
|
146 | ReflectOwnKeys = function ReflectOwnKeys(target) {
|
147 | return Object.getOwnPropertyNames(target);
|
148 | };
|
149 | }
|
150 |
|
151 | function ProcessEmitWarning(warning) {
|
152 | if (console && console.warn) console.warn(warning);
|
153 | }
|
154 |
|
155 | var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {
|
156 | return value !== value;
|
157 | }
|
158 |
|
159 | function EventEmitter() {
|
160 | EventEmitter.init.call(this);
|
161 | }
|
162 | module.exports = EventEmitter;
|
163 |
|
164 |
|
165 | EventEmitter.EventEmitter = EventEmitter;
|
166 |
|
167 | EventEmitter.prototype._events = undefined;
|
168 | EventEmitter.prototype._eventsCount = 0;
|
169 | EventEmitter.prototype._maxListeners = undefined;
|
170 |
|
171 |
|
172 |
|
173 | var defaultMaxListeners = 10;
|
174 |
|
175 | Object.defineProperty(EventEmitter, 'defaultMaxListeners', {
|
176 | enumerable: true,
|
177 | get: function() {
|
178 | return defaultMaxListeners;
|
179 | },
|
180 | set: function(arg) {
|
181 | if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {
|
182 | throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.');
|
183 | }
|
184 | defaultMaxListeners = arg;
|
185 | }
|
186 | });
|
187 |
|
188 | EventEmitter.init = function() {
|
189 |
|
190 | if (this._events === undefined ||
|
191 | this._events === Object.getPrototypeOf(this)._events) {
|
192 | this._events = Object.create(null);
|
193 | this._eventsCount = 0;
|
194 | }
|
195 |
|
196 | this._maxListeners = this._maxListeners || undefined;
|
197 | };
|
198 |
|
199 |
|
200 |
|
201 | EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
|
202 | if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {
|
203 | throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.');
|
204 | }
|
205 | this._maxListeners = n;
|
206 | return this;
|
207 | };
|
208 |
|
209 | function $getMaxListeners(that) {
|
210 | if (that._maxListeners === undefined)
|
211 | return EventEmitter.defaultMaxListeners;
|
212 | return that._maxListeners;
|
213 | }
|
214 |
|
215 | EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
|
216 | return $getMaxListeners(this);
|
217 | };
|
218 |
|
219 | EventEmitter.prototype.emit = function emit(type) {
|
220 | var args = [];
|
221 | for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);
|
222 | var doError = (type === 'error');
|
223 |
|
224 | var events = this._events;
|
225 | if (events !== undefined)
|
226 | doError = (doError && events.error === undefined);
|
227 | else if (!doError)
|
228 | return false;
|
229 |
|
230 |
|
231 | if (doError) {
|
232 | var er;
|
233 | if (args.length > 0)
|
234 | er = args[0];
|
235 | if (er instanceof Error) {
|
236 |
|
237 |
|
238 | throw er;
|
239 | }
|
240 |
|
241 | var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));
|
242 | err.context = er;
|
243 | throw err;
|
244 | }
|
245 |
|
246 | var handler = events[type];
|
247 |
|
248 | if (handler === undefined)
|
249 | return false;
|
250 |
|
251 | if (typeof handler === 'function') {
|
252 | ReflectApply(handler, this, args);
|
253 | } else {
|
254 | var len = handler.length;
|
255 | var listeners = arrayClone(handler, len);
|
256 | for (var i = 0; i < len; ++i)
|
257 | ReflectApply(listeners[i], this, args);
|
258 | }
|
259 |
|
260 | return true;
|
261 | };
|
262 |
|
263 | function _addListener(target, type, listener, prepend) {
|
264 | var m;
|
265 | var events;
|
266 | var existing;
|
267 |
|
268 | if (typeof listener !== 'function') {
|
269 | throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
|
270 | }
|
271 |
|
272 | events = target._events;
|
273 | if (events === undefined) {
|
274 | events = target._events = Object.create(null);
|
275 | target._eventsCount = 0;
|
276 | } else {
|
277 |
|
278 |
|
279 | if (events.newListener !== undefined) {
|
280 | target.emit('newListener', type,
|
281 | listener.listener ? listener.listener : listener);
|
282 |
|
283 |
|
284 |
|
285 | events = target._events;
|
286 | }
|
287 | existing = events[type];
|
288 | }
|
289 |
|
290 | if (existing === undefined) {
|
291 |
|
292 | existing = events[type] = listener;
|
293 | ++target._eventsCount;
|
294 | } else {
|
295 | if (typeof existing === 'function') {
|
296 |
|
297 | existing = events[type] =
|
298 | prepend ? [listener, existing] : [existing, listener];
|
299 |
|
300 | } else if (prepend) {
|
301 | existing.unshift(listener);
|
302 | } else {
|
303 | existing.push(listener);
|
304 | }
|
305 |
|
306 |
|
307 | m = $getMaxListeners(target);
|
308 | if (m > 0 && existing.length > m && !existing.warned) {
|
309 | existing.warned = true;
|
310 |
|
311 |
|
312 | var w = new Error('Possible EventEmitter memory leak detected. ' +
|
313 | existing.length + ' ' + String(type) + ' listeners ' +
|
314 | 'added. Use emitter.setMaxListeners() to ' +
|
315 | 'increase limit');
|
316 | w.name = 'MaxListenersExceededWarning';
|
317 | w.emitter = target;
|
318 | w.type = type;
|
319 | w.count = existing.length;
|
320 | ProcessEmitWarning(w);
|
321 | }
|
322 | }
|
323 |
|
324 | return target;
|
325 | }
|
326 |
|
327 | EventEmitter.prototype.addListener = function addListener(type, listener) {
|
328 | return _addListener(this, type, listener, false);
|
329 | };
|
330 |
|
331 | EventEmitter.prototype.on = EventEmitter.prototype.addListener;
|
332 |
|
333 | EventEmitter.prototype.prependListener =
|
334 | function prependListener(type, listener) {
|
335 | return _addListener(this, type, listener, true);
|
336 | };
|
337 |
|
338 | function onceWrapper() {
|
339 | var args = [];
|
340 | for (var i = 0; i < arguments.length; i++) args.push(arguments[i]);
|
341 | if (!this.fired) {
|
342 | this.target.removeListener(this.type, this.wrapFn);
|
343 | this.fired = true;
|
344 | ReflectApply(this.listener, this.target, args);
|
345 | }
|
346 | }
|
347 |
|
348 | function _onceWrap(target, type, listener) {
|
349 | var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };
|
350 | var wrapped = onceWrapper.bind(state);
|
351 | wrapped.listener = listener;
|
352 | state.wrapFn = wrapped;
|
353 | return wrapped;
|
354 | }
|
355 |
|
356 | EventEmitter.prototype.once = function once(type, listener) {
|
357 | if (typeof listener !== 'function') {
|
358 | throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
|
359 | }
|
360 | this.on(type, _onceWrap(this, type, listener));
|
361 | return this;
|
362 | };
|
363 |
|
364 | EventEmitter.prototype.prependOnceListener =
|
365 | function prependOnceListener(type, listener) {
|
366 | if (typeof listener !== 'function') {
|
367 | throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
|
368 | }
|
369 | this.prependListener(type, _onceWrap(this, type, listener));
|
370 | return this;
|
371 | };
|
372 |
|
373 |
|
374 | EventEmitter.prototype.removeListener =
|
375 | function removeListener(type, listener) {
|
376 | var list, events, position, i, originalListener;
|
377 |
|
378 | if (typeof listener !== 'function') {
|
379 | throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
|
380 | }
|
381 |
|
382 | events = this._events;
|
383 | if (events === undefined)
|
384 | return this;
|
385 |
|
386 | list = events[type];
|
387 | if (list === undefined)
|
388 | return this;
|
389 |
|
390 | if (list === listener || list.listener === listener) {
|
391 | if (--this._eventsCount === 0)
|
392 | this._events = Object.create(null);
|
393 | else {
|
394 | delete events[type];
|
395 | if (events.removeListener)
|
396 | this.emit('removeListener', type, list.listener || listener);
|
397 | }
|
398 | } else if (typeof list !== 'function') {
|
399 | position = -1;
|
400 |
|
401 | for (i = list.length - 1; i >= 0; i--) {
|
402 | if (list[i] === listener || list[i].listener === listener) {
|
403 | originalListener = list[i].listener;
|
404 | position = i;
|
405 | break;
|
406 | }
|
407 | }
|
408 |
|
409 | if (position < 0)
|
410 | return this;
|
411 |
|
412 | if (position === 0)
|
413 | list.shift();
|
414 | else {
|
415 | spliceOne(list, position);
|
416 | }
|
417 |
|
418 | if (list.length === 1)
|
419 | events[type] = list[0];
|
420 |
|
421 | if (events.removeListener !== undefined)
|
422 | this.emit('removeListener', type, originalListener || listener);
|
423 | }
|
424 |
|
425 | return this;
|
426 | };
|
427 |
|
428 | EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
|
429 |
|
430 | EventEmitter.prototype.removeAllListeners =
|
431 | function removeAllListeners(type) {
|
432 | var listeners, events, i;
|
433 |
|
434 | events = this._events;
|
435 | if (events === undefined)
|
436 | return this;
|
437 |
|
438 |
|
439 | if (events.removeListener === undefined) {
|
440 | if (arguments.length === 0) {
|
441 | this._events = Object.create(null);
|
442 | this._eventsCount = 0;
|
443 | } else if (events[type] !== undefined) {
|
444 | if (--this._eventsCount === 0)
|
445 | this._events = Object.create(null);
|
446 | else
|
447 | delete events[type];
|
448 | }
|
449 | return this;
|
450 | }
|
451 |
|
452 |
|
453 | if (arguments.length === 0) {
|
454 | var keys = Object.keys(events);
|
455 | var key;
|
456 | for (i = 0; i < keys.length; ++i) {
|
457 | key = keys[i];
|
458 | if (key === 'removeListener') continue;
|
459 | this.removeAllListeners(key);
|
460 | }
|
461 | this.removeAllListeners('removeListener');
|
462 | this._events = Object.create(null);
|
463 | this._eventsCount = 0;
|
464 | return this;
|
465 | }
|
466 |
|
467 | listeners = events[type];
|
468 |
|
469 | if (typeof listeners === 'function') {
|
470 | this.removeListener(type, listeners);
|
471 | } else if (listeners !== undefined) {
|
472 |
|
473 | for (i = listeners.length - 1; i >= 0; i--) {
|
474 | this.removeListener(type, listeners[i]);
|
475 | }
|
476 | }
|
477 |
|
478 | return this;
|
479 | };
|
480 |
|
481 | function _listeners(target, type, unwrap) {
|
482 | var events = target._events;
|
483 |
|
484 | if (events === undefined)
|
485 | return [];
|
486 |
|
487 | var evlistener = events[type];
|
488 | if (evlistener === undefined)
|
489 | return [];
|
490 |
|
491 | if (typeof evlistener === 'function')
|
492 | return unwrap ? [evlistener.listener || evlistener] : [evlistener];
|
493 |
|
494 | return unwrap ?
|
495 | unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
|
496 | }
|
497 |
|
498 | EventEmitter.prototype.listeners = function listeners(type) {
|
499 | return _listeners(this, type, true);
|
500 | };
|
501 |
|
502 | EventEmitter.prototype.rawListeners = function rawListeners(type) {
|
503 | return _listeners(this, type, false);
|
504 | };
|
505 |
|
506 | EventEmitter.listenerCount = function(emitter, type) {
|
507 | if (typeof emitter.listenerCount === 'function') {
|
508 | return emitter.listenerCount(type);
|
509 | } else {
|
510 | return listenerCount.call(emitter, type);
|
511 | }
|
512 | };
|
513 |
|
514 | EventEmitter.prototype.listenerCount = listenerCount;
|
515 | function listenerCount(type) {
|
516 | var events = this._events;
|
517 |
|
518 | if (events !== undefined) {
|
519 | var evlistener = events[type];
|
520 |
|
521 | if (typeof evlistener === 'function') {
|
522 | return 1;
|
523 | } else if (evlistener !== undefined) {
|
524 | return evlistener.length;
|
525 | }
|
526 | }
|
527 |
|
528 | return 0;
|
529 | }
|
530 |
|
531 | EventEmitter.prototype.eventNames = function eventNames() {
|
532 | return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];
|
533 | };
|
534 |
|
535 | function arrayClone(arr, n) {
|
536 | var copy = new Array(n);
|
537 | for (var i = 0; i < n; ++i)
|
538 | copy[i] = arr[i];
|
539 | return copy;
|
540 | }
|
541 |
|
542 | function spliceOne(list, index) {
|
543 | for (; index + 1 < list.length; index++)
|
544 | list[index] = list[index + 1];
|
545 | list.pop();
|
546 | }
|
547 |
|
548 | function unwrapListeners(arr) {
|
549 | var ret = new Array(arr.length);
|
550 | for (var i = 0; i < ret.length; ++i) {
|
551 | ret[i] = arr[i].listener || arr[i];
|
552 | }
|
553 | return ret;
|
554 | }
|
555 |
|
556 |
|
557 | }),
|
558 |
|
559 | "./node_modules/process/browser.js":
|
560 |
|
561 |
|
562 |
|
563 |
|
564 | (function(module, exports) {
|
565 |
|
566 |
|
567 | var process = module.exports = {};
|
568 |
|
569 |
|
570 |
|
571 |
|
572 |
|
573 |
|
574 | var cachedSetTimeout;
|
575 | var cachedClearTimeout;
|
576 |
|
577 | function defaultSetTimout() {
|
578 | throw new Error('setTimeout has not been defined');
|
579 | }
|
580 | function defaultClearTimeout () {
|
581 | throw new Error('clearTimeout has not been defined');
|
582 | }
|
583 | (function () {
|
584 | try {
|
585 | if (typeof setTimeout === 'function') {
|
586 | cachedSetTimeout = setTimeout;
|
587 | } else {
|
588 | cachedSetTimeout = defaultSetTimout;
|
589 | }
|
590 | } catch (e) {
|
591 | cachedSetTimeout = defaultSetTimout;
|
592 | }
|
593 | try {
|
594 | if (typeof clearTimeout === 'function') {
|
595 | cachedClearTimeout = clearTimeout;
|
596 | } else {
|
597 | cachedClearTimeout = defaultClearTimeout;
|
598 | }
|
599 | } catch (e) {
|
600 | cachedClearTimeout = defaultClearTimeout;
|
601 | }
|
602 | } ())
|
603 | function runTimeout(fun) {
|
604 | if (cachedSetTimeout === setTimeout) {
|
605 |
|
606 | return setTimeout(fun, 0);
|
607 | }
|
608 |
|
609 | if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
610 | cachedSetTimeout = setTimeout;
|
611 | return setTimeout(fun, 0);
|
612 | }
|
613 | try {
|
614 |
|
615 | return cachedSetTimeout(fun, 0);
|
616 | } catch(e){
|
617 | try {
|
618 |
|
619 | return cachedSetTimeout.call(null, fun, 0);
|
620 | } catch(e){
|
621 |
|
622 | return cachedSetTimeout.call(this, fun, 0);
|
623 | }
|
624 | }
|
625 |
|
626 |
|
627 | }
|
628 | function runClearTimeout(marker) {
|
629 | if (cachedClearTimeout === clearTimeout) {
|
630 |
|
631 | return clearTimeout(marker);
|
632 | }
|
633 |
|
634 | if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
635 | cachedClearTimeout = clearTimeout;
|
636 | return clearTimeout(marker);
|
637 | }
|
638 | try {
|
639 |
|
640 | return cachedClearTimeout(marker);
|
641 | } catch (e){
|
642 | try {
|
643 |
|
644 | return cachedClearTimeout.call(null, marker);
|
645 | } catch (e){
|
646 |
|
647 |
|
648 | return cachedClearTimeout.call(this, marker);
|
649 | }
|
650 | }
|
651 |
|
652 |
|
653 |
|
654 | }
|
655 | var queue = [];
|
656 | var draining = false;
|
657 | var currentQueue;
|
658 | var queueIndex = -1;
|
659 |
|
660 | function cleanUpNextTick() {
|
661 | if (!draining || !currentQueue) {
|
662 | return;
|
663 | }
|
664 | draining = false;
|
665 | if (currentQueue.length) {
|
666 | queue = currentQueue.concat(queue);
|
667 | } else {
|
668 | queueIndex = -1;
|
669 | }
|
670 | if (queue.length) {
|
671 | drainQueue();
|
672 | }
|
673 | }
|
674 |
|
675 | function drainQueue() {
|
676 | if (draining) {
|
677 | return;
|
678 | }
|
679 | var timeout = runTimeout(cleanUpNextTick);
|
680 | draining = true;
|
681 |
|
682 | var len = queue.length;
|
683 | while(len) {
|
684 | currentQueue = queue;
|
685 | queue = [];
|
686 | while (++queueIndex < len) {
|
687 | if (currentQueue) {
|
688 | currentQueue[queueIndex].run();
|
689 | }
|
690 | }
|
691 | queueIndex = -1;
|
692 | len = queue.length;
|
693 | }
|
694 | currentQueue = null;
|
695 | draining = false;
|
696 | runClearTimeout(timeout);
|
697 | }
|
698 |
|
699 | process.nextTick = function (fun) {
|
700 | var args = new Array(arguments.length - 1);
|
701 | if (arguments.length > 1) {
|
702 | for (var i = 1; i < arguments.length; i++) {
|
703 | args[i - 1] = arguments[i];
|
704 | }
|
705 | }
|
706 | queue.push(new Item(fun, args));
|
707 | if (queue.length === 1 && !draining) {
|
708 | runTimeout(drainQueue);
|
709 | }
|
710 | };
|
711 |
|
712 |
|
713 | function Item(fun, array) {
|
714 | this.fun = fun;
|
715 | this.array = array;
|
716 | }
|
717 | Item.prototype.run = function () {
|
718 | this.fun.apply(null, this.array);
|
719 | };
|
720 | process.title = 'browser';
|
721 | process.browser = true;
|
722 | process.env = {};
|
723 | process.argv = [];
|
724 | process.version = '';
|
725 | process.versions = {};
|
726 |
|
727 | function noop() {}
|
728 |
|
729 | process.on = noop;
|
730 | process.addListener = noop;
|
731 | process.once = noop;
|
732 | process.off = noop;
|
733 | process.removeListener = noop;
|
734 | process.removeAllListeners = noop;
|
735 | process.emit = noop;
|
736 | process.prependListener = noop;
|
737 | process.prependOnceListener = noop;
|
738 |
|
739 | process.listeners = function (name) { return [] }
|
740 |
|
741 | process.binding = function (name) {
|
742 | throw new Error('process.binding is not supported');
|
743 | };
|
744 |
|
745 | process.cwd = function () { return '/' };
|
746 | process.chdir = function (dir) {
|
747 | throw new Error('process.chdir is not supported');
|
748 | };
|
749 | process.umask = function() { return 0; };
|
750 |
|
751 |
|
752 | }),
|
753 |
|
754 | "./node_modules/reflect-metadata/Reflect.js":
|
755 |
|
756 |
|
757 |
|
758 |
|
759 | (function(module, exports, __webpack_require__) {
|
760 |
|
761 | (function(process, global) { |
762 |
|
763 |
|
764 |
|
765 |
|
766 |
|
767 |
|
768 |
|
769 |
|
770 |
|
771 |
|
772 |
|
773 |
|
774 |
|
775 | var Reflect;
|
776 | (function (Reflect) {
|
777 |
|
778 |
|
779 | (function (factory) {
|
780 | var root = typeof global === "object" ? global :
|
781 | typeof self === "object" ? self :
|
782 | typeof this === "object" ? this :
|
783 | Function("return this;")();
|
784 | var exporter = makeExporter(Reflect);
|
785 | if (typeof root.Reflect === "undefined") {
|
786 | root.Reflect = Reflect;
|
787 | }
|
788 | else {
|
789 | exporter = makeExporter(root.Reflect, exporter);
|
790 | }
|
791 | factory(exporter);
|
792 | function makeExporter(target, previous) {
|
793 | return function (key, value) {
|
794 | if (typeof target[key] !== "function") {
|
795 | Object.defineProperty(target, key, { configurable: true, writable: true, value: value });
|
796 | }
|
797 | if (previous)
|
798 | previous(key, value);
|
799 | };
|
800 | }
|
801 | })(function (exporter) {
|
802 | var hasOwn = Object.prototype.hasOwnProperty;
|
803 |
|
804 | var supportsSymbol = typeof Symbol === "function";
|
805 | var toPrimitiveSymbol = supportsSymbol && typeof Symbol.toPrimitive !== "undefined" ? Symbol.toPrimitive : "@@toPrimitive";
|
806 | var iteratorSymbol = supportsSymbol && typeof Symbol.iterator !== "undefined" ? Symbol.iterator : "@@iterator";
|
807 | var supportsCreate = typeof Object.create === "function";
|
808 | var supportsProto = { __proto__: [] } instanceof Array;
|
809 | var downLevel = !supportsCreate && !supportsProto;
|
810 | var HashMap = {
|
811 |
|
812 | create: supportsCreate
|
813 | ? function () { return MakeDictionary(Object.create(null)); }
|
814 | : supportsProto
|
815 | ? function () { return MakeDictionary({ __proto__: null }); }
|
816 | : function () { return MakeDictionary({}); },
|
817 | has: downLevel
|
818 | ? function (map, key) { return hasOwn.call(map, key); }
|
819 | : function (map, key) { return key in map; },
|
820 | get: downLevel
|
821 | ? function (map, key) { return hasOwn.call(map, key) ? map[key] : undefined; }
|
822 | : function (map, key) { return map[key]; },
|
823 | };
|
824 |
|
825 | var functionPrototype = Object.getPrototypeOf(Function);
|
826 | var usePolyfill = typeof process === "object" && process.env && process.env["REFLECT_METADATA_USE_MAP_POLYFILL"] === "true";
|
827 | var _Map = !usePolyfill && typeof Map === "function" && typeof Map.prototype.entries === "function" ? Map : CreateMapPolyfill();
|
828 | var _Set = !usePolyfill && typeof Set === "function" && typeof Set.prototype.entries === "function" ? Set : CreateSetPolyfill();
|
829 | var _WeakMap = !usePolyfill && typeof WeakMap === "function" ? WeakMap : CreateWeakMapPolyfill();
|
830 |
|
831 |
|
832 | var Metadata = new _WeakMap();
|
833 | |
834 |
|
835 |
|
836 |
|
837 |
|
838 |
|
839 |
|
840 |
|
841 |
|
842 |
|
843 |
|
844 |
|
845 |
|
846 |
|
847 |
|
848 |
|
849 |
|
850 |
|
851 |
|
852 |
|
853 |
|
854 |
|
855 |
|
856 |
|
857 |
|
858 |
|
859 |
|
860 |
|
861 |
|
862 |
|
863 |
|
864 |
|
865 |
|
866 |
|
867 |
|
868 |
|
869 |
|
870 |
|
871 |
|
872 | function decorate(decorators, target, propertyKey, attributes) {
|
873 | if (!IsUndefined(propertyKey)) {
|
874 | if (!IsArray(decorators))
|
875 | throw new TypeError();
|
876 | if (!IsObject(target))
|
877 | throw new TypeError();
|
878 | if (!IsObject(attributes) && !IsUndefined(attributes) && !IsNull(attributes))
|
879 | throw new TypeError();
|
880 | if (IsNull(attributes))
|
881 | attributes = undefined;
|
882 | propertyKey = ToPropertyKey(propertyKey);
|
883 | return DecorateProperty(decorators, target, propertyKey, attributes);
|
884 | }
|
885 | else {
|
886 | if (!IsArray(decorators))
|
887 | throw new TypeError();
|
888 | if (!IsConstructor(target))
|
889 | throw new TypeError();
|
890 | return DecorateConstructor(decorators, target);
|
891 | }
|
892 | }
|
893 | exporter("decorate", decorate);
|
894 |
|
895 |
|
896 | |
897 |
|
898 |
|
899 |
|
900 |
|
901 |
|
902 |
|
903 |
|
904 |
|
905 |
|
906 |
|
907 |
|
908 |
|
909 |
|
910 |
|
911 |
|
912 |
|
913 |
|
914 |
|
915 |
|
916 |
|
917 |
|
918 |
|
919 |
|
920 |
|
921 |
|
922 |
|
923 |
|
924 |
|
925 |
|
926 |
|
927 |
|
928 |
|
929 |
|
930 |
|
931 |
|
932 |
|
933 |
|
934 |
|
935 |
|
936 | function metadata(metadataKey, metadataValue) {
|
937 | function decorator(target, propertyKey) {
|
938 | if (!IsObject(target))
|
939 | throw new TypeError();
|
940 | if (!IsUndefined(propertyKey) && !IsPropertyKey(propertyKey))
|
941 | throw new TypeError();
|
942 | OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey);
|
943 | }
|
944 | return decorator;
|
945 | }
|
946 | exporter("metadata", metadata);
|
947 | |
948 |
|
949 |
|
950 |
|
951 |
|
952 |
|
953 |
|
954 |
|
955 |
|
956 |
|
957 |
|
958 |
|
959 |
|
960 |
|
961 |
|
962 |
|
963 |
|
964 |
|
965 |
|
966 |
|
967 |
|
968 |
|
969 |
|
970 |
|
971 |
|
972 |
|
973 |
|
974 |
|
975 |
|
976 |
|
977 |
|
978 |
|
979 |
|
980 |
|
981 |
|
982 |
|
983 |
|
984 |
|
985 |
|
986 | function defineMetadata(metadataKey, metadataValue, target, propertyKey) {
|
987 | if (!IsObject(target))
|
988 | throw new TypeError();
|
989 | if (!IsUndefined(propertyKey))
|
990 | propertyKey = ToPropertyKey(propertyKey);
|
991 | return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey);
|
992 | }
|
993 | exporter("defineMetadata", defineMetadata);
|
994 | |
995 |
|
996 |
|
997 |
|
998 |
|
999 |
|
1000 |
|
1001 |
|
1002 |
|
1003 |
|
1004 |
|
1005 |
|
1006 |
|
1007 |
|
1008 |
|
1009 |
|
1010 |
|
1011 |
|
1012 |
|
1013 |
|
1014 |
|
1015 |
|
1016 |
|
1017 |
|
1018 |
|
1019 |
|
1020 |
|
1021 |
|
1022 |
|
1023 |
|
1024 |
|
1025 |
|
1026 |
|
1027 |
|
1028 | function hasMetadata(metadataKey, target, propertyKey) {
|
1029 | if (!IsObject(target))
|
1030 | throw new TypeError();
|
1031 | if (!IsUndefined(propertyKey))
|
1032 | propertyKey = ToPropertyKey(propertyKey);
|
1033 | return OrdinaryHasMetadata(metadataKey, target, propertyKey);
|
1034 | }
|
1035 | exporter("hasMetadata", hasMetadata);
|
1036 | |
1037 |
|
1038 |
|
1039 |
|
1040 |
|
1041 |
|
1042 |
|
1043 |
|
1044 |
|
1045 |
|
1046 |
|
1047 |
|
1048 |
|
1049 |
|
1050 |
|
1051 |
|
1052 |
|
1053 |
|
1054 |
|
1055 |
|
1056 |
|
1057 |
|
1058 |
|
1059 |
|
1060 |
|
1061 |
|
1062 |
|
1063 |
|
1064 |
|
1065 |
|
1066 |
|
1067 |
|
1068 |
|
1069 |
|
1070 | function hasOwnMetadata(metadataKey, target, propertyKey) {
|
1071 | if (!IsObject(target))
|
1072 | throw new TypeError();
|
1073 | if (!IsUndefined(propertyKey))
|
1074 | propertyKey = ToPropertyKey(propertyKey);
|
1075 | return OrdinaryHasOwnMetadata(metadataKey, target, propertyKey);
|
1076 | }
|
1077 | exporter("hasOwnMetadata", hasOwnMetadata);
|
1078 | |
1079 |
|
1080 |
|
1081 |
|
1082 |
|
1083 |
|
1084 |
|
1085 |
|
1086 |
|
1087 |
|
1088 |
|
1089 |
|
1090 |
|
1091 |
|
1092 |
|
1093 |
|
1094 |
|
1095 |
|
1096 |
|
1097 |
|
1098 |
|
1099 |
|
1100 |
|
1101 |
|
1102 |
|
1103 |
|
1104 |
|
1105 |
|
1106 |
|
1107 |
|
1108 |
|
1109 |
|
1110 |
|
1111 |
|
1112 | function getMetadata(metadataKey, target, propertyKey) {
|
1113 | if (!IsObject(target))
|
1114 | throw new TypeError();
|
1115 | if (!IsUndefined(propertyKey))
|
1116 | propertyKey = ToPropertyKey(propertyKey);
|
1117 | return OrdinaryGetMetadata(metadataKey, target, propertyKey);
|
1118 | }
|
1119 | exporter("getMetadata", getMetadata);
|
1120 | |
1121 |
|
1122 |
|
1123 |
|
1124 |
|
1125 |
|
1126 |
|
1127 |
|
1128 |
|
1129 |
|
1130 |
|
1131 |
|
1132 |
|
1133 |
|
1134 |
|
1135 |
|
1136 |
|
1137 |
|
1138 |
|
1139 |
|
1140 |
|
1141 |
|
1142 |
|
1143 |
|
1144 |
|
1145 |
|
1146 |
|
1147 |
|
1148 |
|
1149 |
|
1150 |
|
1151 |
|
1152 |
|
1153 |
|
1154 | function getOwnMetadata(metadataKey, target, propertyKey) {
|
1155 | if (!IsObject(target))
|
1156 | throw new TypeError();
|
1157 | if (!IsUndefined(propertyKey))
|
1158 | propertyKey = ToPropertyKey(propertyKey);
|
1159 | return OrdinaryGetOwnMetadata(metadataKey, target, propertyKey);
|
1160 | }
|
1161 | exporter("getOwnMetadata", getOwnMetadata);
|
1162 | |
1163 |
|
1164 |
|
1165 |
|
1166 |
|
1167 |
|
1168 |
|
1169 |
|
1170 |
|
1171 |
|
1172 |
|
1173 |
|
1174 |
|
1175 |
|
1176 |
|
1177 |
|
1178 |
|
1179 |
|
1180 |
|
1181 |
|
1182 |
|
1183 |
|
1184 |
|
1185 |
|
1186 |
|
1187 |
|
1188 |
|
1189 |
|
1190 |
|
1191 |
|
1192 |
|
1193 |
|
1194 |
|
1195 | function getMetadataKeys(target, propertyKey) {
|
1196 | if (!IsObject(target))
|
1197 | throw new TypeError();
|
1198 | if (!IsUndefined(propertyKey))
|
1199 | propertyKey = ToPropertyKey(propertyKey);
|
1200 | return OrdinaryMetadataKeys(target, propertyKey);
|
1201 | }
|
1202 | exporter("getMetadataKeys", getMetadataKeys);
|
1203 | |
1204 |
|
1205 |
|
1206 |
|
1207 |
|
1208 |
|
1209 |
|
1210 |
|
1211 |
|
1212 |
|
1213 |
|
1214 |
|
1215 |
|
1216 |
|
1217 |
|
1218 |
|
1219 |
|
1220 |
|
1221 |
|
1222 |
|
1223 |
|
1224 |
|
1225 |
|
1226 |
|
1227 |
|
1228 |
|
1229 |
|
1230 |
|
1231 |
|
1232 |
|
1233 |
|
1234 |
|
1235 |
|
1236 | function getOwnMetadataKeys(target, propertyKey) {
|
1237 | if (!IsObject(target))
|
1238 | throw new TypeError();
|
1239 | if (!IsUndefined(propertyKey))
|
1240 | propertyKey = ToPropertyKey(propertyKey);
|
1241 | return OrdinaryOwnMetadataKeys(target, propertyKey);
|
1242 | }
|
1243 | exporter("getOwnMetadataKeys", getOwnMetadataKeys);
|
1244 | |
1245 |
|
1246 |
|
1247 |
|
1248 |
|
1249 |
|
1250 |
|
1251 |
|
1252 |
|
1253 |
|
1254 |
|
1255 |
|
1256 |
|
1257 |
|
1258 |
|
1259 |
|
1260 |
|
1261 |
|
1262 |
|
1263 |
|
1264 |
|
1265 |
|
1266 |
|
1267 |
|
1268 |
|
1269 |
|
1270 |
|
1271 |
|
1272 |
|
1273 |
|
1274 |
|
1275 |
|
1276 |
|
1277 |
|
1278 | function deleteMetadata(metadataKey, target, propertyKey) {
|
1279 | if (!IsObject(target))
|
1280 | throw new TypeError();
|
1281 | if (!IsUndefined(propertyKey))
|
1282 | propertyKey = ToPropertyKey(propertyKey);
|
1283 | var metadataMap = GetOrCreateMetadataMap(target, propertyKey, false);
|
1284 | if (IsUndefined(metadataMap))
|
1285 | return false;
|
1286 | if (!metadataMap.delete(metadataKey))
|
1287 | return false;
|
1288 | if (metadataMap.size > 0)
|
1289 | return true;
|
1290 | var targetMetadata = Metadata.get(target);
|
1291 | targetMetadata.delete(propertyKey);
|
1292 | if (targetMetadata.size > 0)
|
1293 | return true;
|
1294 | Metadata.delete(target);
|
1295 | return true;
|
1296 | }
|
1297 | exporter("deleteMetadata", deleteMetadata);
|
1298 | function DecorateConstructor(decorators, target) {
|
1299 | for (var i = decorators.length - 1; i >= 0; --i) {
|
1300 | var decorator = decorators[i];
|
1301 | var decorated = decorator(target);
|
1302 | if (!IsUndefined(decorated) && !IsNull(decorated)) {
|
1303 | if (!IsConstructor(decorated))
|
1304 | throw new TypeError();
|
1305 | target = decorated;
|
1306 | }
|
1307 | }
|
1308 | return target;
|
1309 | }
|
1310 | function DecorateProperty(decorators, target, propertyKey, descriptor) {
|
1311 | for (var i = decorators.length - 1; i >= 0; --i) {
|
1312 | var decorator = decorators[i];
|
1313 | var decorated = decorator(target, propertyKey, descriptor);
|
1314 | if (!IsUndefined(decorated) && !IsNull(decorated)) {
|
1315 | if (!IsObject(decorated))
|
1316 | throw new TypeError();
|
1317 | descriptor = decorated;
|
1318 | }
|
1319 | }
|
1320 | return descriptor;
|
1321 | }
|
1322 | function GetOrCreateMetadataMap(O, P, Create) {
|
1323 | var targetMetadata = Metadata.get(O);
|
1324 | if (IsUndefined(targetMetadata)) {
|
1325 | if (!Create)
|
1326 | return undefined;
|
1327 | targetMetadata = new _Map();
|
1328 | Metadata.set(O, targetMetadata);
|
1329 | }
|
1330 | var metadataMap = targetMetadata.get(P);
|
1331 | if (IsUndefined(metadataMap)) {
|
1332 | if (!Create)
|
1333 | return undefined;
|
1334 | metadataMap = new _Map();
|
1335 | targetMetadata.set(P, metadataMap);
|
1336 | }
|
1337 | return metadataMap;
|
1338 | }
|
1339 |
|
1340 |
|
1341 | function OrdinaryHasMetadata(MetadataKey, O, P) {
|
1342 | var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P);
|
1343 | if (hasOwn)
|
1344 | return true;
|
1345 | var parent = OrdinaryGetPrototypeOf(O);
|
1346 | if (!IsNull(parent))
|
1347 | return OrdinaryHasMetadata(MetadataKey, parent, P);
|
1348 | return false;
|
1349 | }
|
1350 |
|
1351 |
|
1352 | function OrdinaryHasOwnMetadata(MetadataKey, O, P) {
|
1353 | var metadataMap = GetOrCreateMetadataMap(O, P, false);
|
1354 | if (IsUndefined(metadataMap))
|
1355 | return false;
|
1356 | return ToBoolean(metadataMap.has(MetadataKey));
|
1357 | }
|
1358 |
|
1359 |
|
1360 | function OrdinaryGetMetadata(MetadataKey, O, P) {
|
1361 | var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P);
|
1362 | if (hasOwn)
|
1363 | return OrdinaryGetOwnMetadata(MetadataKey, O, P);
|
1364 | var parent = OrdinaryGetPrototypeOf(O);
|
1365 | if (!IsNull(parent))
|
1366 | return OrdinaryGetMetadata(MetadataKey, parent, P);
|
1367 | return undefined;
|
1368 | }
|
1369 |
|
1370 |
|
1371 | function OrdinaryGetOwnMetadata(MetadataKey, O, P) {
|
1372 | var metadataMap = GetOrCreateMetadataMap(O, P, false);
|
1373 | if (IsUndefined(metadataMap))
|
1374 | return undefined;
|
1375 | return metadataMap.get(MetadataKey);
|
1376 | }
|
1377 |
|
1378 |
|
1379 | function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) {
|
1380 | var metadataMap = GetOrCreateMetadataMap(O, P, true);
|
1381 | metadataMap.set(MetadataKey, MetadataValue);
|
1382 | }
|
1383 |
|
1384 |
|
1385 | function OrdinaryMetadataKeys(O, P) {
|
1386 | var ownKeys = OrdinaryOwnMetadataKeys(O, P);
|
1387 | var parent = OrdinaryGetPrototypeOf(O);
|
1388 | if (parent === null)
|
1389 | return ownKeys;
|
1390 | var parentKeys = OrdinaryMetadataKeys(parent, P);
|
1391 | if (parentKeys.length <= 0)
|
1392 | return ownKeys;
|
1393 | if (ownKeys.length <= 0)
|
1394 | return parentKeys;
|
1395 | var set = new _Set();
|
1396 | var keys = [];
|
1397 | for (var _i = 0, ownKeys_1 = ownKeys; _i < ownKeys_1.length; _i++) {
|
1398 | var key = ownKeys_1[_i];
|
1399 | var hasKey = set.has(key);
|
1400 | if (!hasKey) {
|
1401 | set.add(key);
|
1402 | keys.push(key);
|
1403 | }
|
1404 | }
|
1405 | for (var _a = 0, parentKeys_1 = parentKeys; _a < parentKeys_1.length; _a++) {
|
1406 | var key = parentKeys_1[_a];
|
1407 | var hasKey = set.has(key);
|
1408 | if (!hasKey) {
|
1409 | set.add(key);
|
1410 | keys.push(key);
|
1411 | }
|
1412 | }
|
1413 | return keys;
|
1414 | }
|
1415 | // 3.1.7.1 OrdinaryOwnMetadataKeys(O, P)
|
1416 | // https://rbuckton.github.io/reflect-metadata/#ordinaryownmetadatakeys
|
1417 | function OrdinaryOwnMetadataKeys(O, P) {
|
1418 | var keys = [];
|
1419 | var metadataMap = GetOrCreateMetadataMap(O, P, false);
|
1420 | if (IsUndefined(metadataMap))
|
1421 | return keys;
|
1422 | var keysObj = metadataMap.keys();
|
1423 | var iterator = GetIterator(keysObj);
|
1424 | var k = 0;
|
1425 | while (true) {
|
1426 | var next = IteratorStep(iterator);
|
1427 | if (!next) {
|
1428 | keys.length = k;
|
1429 | return keys;
|
1430 | }
|
1431 | var nextValue = IteratorValue(next);
|
1432 | try {
|
1433 | keys[k] = nextValue;
|
1434 | }
|
1435 | catch (e) {
|
1436 | try {
|
1437 | IteratorClose(iterator);
|
1438 | }
|
1439 | finally {
|
1440 | throw e;
|
1441 | }
|
1442 | }
|
1443 | k++;
|
1444 | }
|
1445 | }
|
1446 |
|
1447 |
|
1448 | function Type(x) {
|
1449 | if (x === null)
|
1450 | return 1 ;
|
1451 | switch (typeof x) {
|
1452 | case "undefined": return 0 ;
|
1453 | case "boolean": return 2 ;
|
1454 | case "string": return 3 ;
|
1455 | case "symbol": return 4 ;
|
1456 | case "number": return 5 ;
|
1457 | case "object": return x === null ? 1 : 6 ;
|
1458 | default: return 6 ;
|
1459 | }
|
1460 | }
|
1461 |
|
1462 |
|
1463 | function IsUndefined(x) {
|
1464 | return x === undefined;
|
1465 | }
|
1466 |
|
1467 |
|
1468 | function IsNull(x) {
|
1469 | return x === null;
|
1470 | }
|
1471 |
|
1472 |
|
1473 | function IsSymbol(x) {
|
1474 | return typeof x === "symbol";
|
1475 | }
|
1476 |
|
1477 |
|
1478 | function IsObject(x) {
|
1479 | return typeof x === "object" ? x !== null : typeof x === "function";
|
1480 | }
|
1481 |
|
1482 |
|
1483 |
|
1484 |
|
1485 | function ToPrimitive(input, PreferredType) {
|
1486 | switch (Type(input)) {
|
1487 | case 0 : return input;
|
1488 | case 1 : return input;
|
1489 | case 2 : return input;
|
1490 | case 3 : return input;
|
1491 | case 4 : return input;
|
1492 | case 5 : return input;
|
1493 | }
|
1494 | var hint = PreferredType === 3 ? "string" : PreferredType === 5 ? "number" : "default";
|
1495 | var exoticToPrim = GetMethod(input, toPrimitiveSymbol);
|
1496 | if (exoticToPrim !== undefined) {
|
1497 | var result = exoticToPrim.call(input, hint);
|
1498 | if (IsObject(result))
|
1499 | throw new TypeError();
|
1500 | return result;
|
1501 | }
|
1502 | return OrdinaryToPrimitive(input, hint === "default" ? "number" : hint);
|
1503 | }
|
1504 |
|
1505 |
|
1506 | function OrdinaryToPrimitive(O, hint) {
|
1507 | if (hint === "string") {
|
1508 | var toString_1 = O.toString;
|
1509 | if (IsCallable(toString_1)) {
|
1510 | var result = toString_1.call(O);
|
1511 | if (!IsObject(result))
|
1512 | return result;
|
1513 | }
|
1514 | var valueOf = O.valueOf;
|
1515 | if (IsCallable(valueOf)) {
|
1516 | var result = valueOf.call(O);
|
1517 | if (!IsObject(result))
|
1518 | return result;
|
1519 | }
|
1520 | }
|
1521 | else {
|
1522 | var valueOf = O.valueOf;
|
1523 | if (IsCallable(valueOf)) {
|
1524 | var result = valueOf.call(O);
|
1525 | if (!IsObject(result))
|
1526 | return result;
|
1527 | }
|
1528 | var toString_2 = O.toString;
|
1529 | if (IsCallable(toString_2)) {
|
1530 | var result = toString_2.call(O);
|
1531 | if (!IsObject(result))
|
1532 | return result;
|
1533 | }
|
1534 | }
|
1535 | throw new TypeError();
|
1536 | }
|
1537 |
|
1538 |
|
1539 | function ToBoolean(argument) {
|
1540 | return !!argument;
|
1541 | }
|
1542 |
|
1543 |
|
1544 | function ToString(argument) {
|
1545 | return "" + argument;
|
1546 | }
|
1547 |
|
1548 |
|
1549 | function ToPropertyKey(argument) {
|
1550 | var key = ToPrimitive(argument, 3 );
|
1551 | if (IsSymbol(key))
|
1552 | return key;
|
1553 | return ToString(key);
|
1554 | }
|
1555 |
|
1556 |
|
1557 |
|
1558 |
|
1559 | function IsArray(argument) {
|
1560 | return Array.isArray
|
1561 | ? Array.isArray(argument)
|
1562 | : argument instanceof Object
|
1563 | ? argument instanceof Array
|
1564 | : Object.prototype.toString.call(argument) === "[object Array]";
|
1565 | }
|
1566 |
|
1567 |
|
1568 | function IsCallable(argument) {
|
1569 |
|
1570 | return typeof argument === "function";
|
1571 | }
|
1572 |
|
1573 |
|
1574 | function IsConstructor(argument) {
|
1575 |
|
1576 | return typeof argument === "function";
|
1577 | }
|
1578 |
|
1579 |
|
1580 | function IsPropertyKey(argument) {
|
1581 | switch (Type(argument)) {
|
1582 | case 3 : return true;
|
1583 | case 4 : return true;
|
1584 | default: return false;
|
1585 | }
|
1586 | }
|
1587 |
|
1588 |
|
1589 |
|
1590 |
|
1591 | function GetMethod(V, P) {
|
1592 | var func = V[P];
|
1593 | if (func === undefined || func === null)
|
1594 | return undefined;
|
1595 | if (!IsCallable(func))
|
1596 | throw new TypeError();
|
1597 | return func;
|
1598 | }
|
1599 |
|
1600 |
|
1601 | function GetIterator(obj) {
|
1602 | var method = GetMethod(obj, iteratorSymbol);
|
1603 | if (!IsCallable(method))
|
1604 | throw new TypeError();
|
1605 | var iterator = method.call(obj);
|
1606 | if (!IsObject(iterator))
|
1607 | throw new TypeError();
|
1608 | return iterator;
|
1609 | }
|
1610 |
|
1611 |
|
1612 | function IteratorValue(iterResult) {
|
1613 | return iterResult.value;
|
1614 | }
|
1615 |
|
1616 |
|
1617 | function IteratorStep(iterator) {
|
1618 | var result = iterator.next();
|
1619 | return result.done ? false : result;
|
1620 | }
|
1621 |
|
1622 |
|
1623 | function IteratorClose(iterator) {
|
1624 | var f = iterator["return"];
|
1625 | if (f)
|
1626 | f.call(iterator);
|
1627 | }
|
1628 |
|
1629 |
|
1630 |
|
1631 |
|
1632 | function OrdinaryGetPrototypeOf(O) {
|
1633 | var proto = Object.getPrototypeOf(O);
|
1634 | if (typeof O !== "function" || O === functionPrototype)
|
1635 | return proto;
|
1636 |
|
1637 |
|
1638 |
|
1639 |
|
1640 |
|
1641 |
|
1642 |
|
1643 | if (proto !== functionPrototype)
|
1644 | return proto;
|
1645 |
|
1646 | var prototype = O.prototype;
|
1647 | var prototypeProto = prototype && Object.getPrototypeOf(prototype);
|
1648 | if (prototypeProto == null || prototypeProto === Object.prototype)
|
1649 | return proto;
|
1650 |
|
1651 | var constructor = prototypeProto.constructor;
|
1652 | if (typeof constructor !== "function")
|
1653 | return proto;
|
1654 | // If we have some kind of self-reference, then we cannot determine the heritage.
|
1655 | if (constructor === O)
|
1656 | return proto;
|
1657 | // we have a pretty good guess at the heritage.
|
1658 | return constructor;
|
1659 | }
|
1660 | // naive Map shim
|
1661 | function CreateMapPolyfill() {
|
1662 | var cacheSentinel = {};
|
1663 | var arraySentinel = [];
|
1664 | var MapIterator = (function () {
|
1665 | function MapIterator(keys, values, selector) {
|
1666 | this._index = 0;
|
1667 | this._keys = keys;
|
1668 | this._values = values;
|
1669 | this._selector = selector;
|
1670 | }
|
1671 | MapIterator.prototype["@@iterator"] = function () { return this; };
|
1672 | MapIterator.prototype[iteratorSymbol] = function () { return this; };
|
1673 | MapIterator.prototype.next = function () {
|
1674 | var index = this._index;
|
1675 | if (index >= 0 && index < this._keys.length) {
|
1676 | var result = this._selector(this._keys[index], this._values[index]);
|
1677 | if (index + 1 >= this._keys.length) {
|
1678 | this._index = -1;
|
1679 | this._keys = arraySentinel;
|
1680 | this._values = arraySentinel;
|
1681 | }
|
1682 | else {
|
1683 | this._index++;
|
1684 | }
|
1685 | return { value: result, done: false };
|
1686 | }
|
1687 | return { value: undefined, done: true };
|
1688 | };
|
1689 | MapIterator.prototype.throw = function (error) {
|
1690 | if (this._index >= 0) {
|
1691 | this._index = -1;
|
1692 | this._keys = arraySentinel;
|
1693 | this._values = arraySentinel;
|
1694 | }
|
1695 | throw error;
|
1696 | };
|
1697 | MapIterator.prototype.return = function (value) {
|
1698 | if (this._index >= 0) {
|
1699 | this._index = -1;
|
1700 | this._keys = arraySentinel;
|
1701 | this._values = arraySentinel;
|
1702 | }
|
1703 | return { value: value, done: true };
|
1704 | };
|
1705 | return MapIterator;
|
1706 | }());
|
1707 | return (function () {
|
1708 | function Map() {
|
1709 | this._keys = [];
|
1710 | this._values = [];
|
1711 | this._cacheKey = cacheSentinel;
|
1712 | this._cacheIndex = -2;
|
1713 | }
|
1714 | Object.defineProperty(Map.prototype, "size", {
|
1715 | get: function () { return this._keys.length; },
|
1716 | enumerable: true,
|
1717 | configurable: true
|
1718 | });
|
1719 | Map.prototype.has = function (key) { return this._find(key, false) >= 0; };
|
1720 | Map.prototype.get = function (key) {
|
1721 | var index = this._find(key, false);
|
1722 | return index >= 0 ? this._values[index] : undefined;
|
1723 | };
|
1724 | Map.prototype.set = function (key, value) {
|
1725 | var index = this._find(key, true);
|
1726 | this._values[index] = value;
|
1727 | return this;
|
1728 | };
|
1729 | Map.prototype.delete = function (key) {
|
1730 | var index = this._find(key, false);
|
1731 | if (index >= 0) {
|
1732 | var size = this._keys.length;
|
1733 | for (var i = index + 1; i < size; i++) {
|
1734 | this._keys[i - 1] = this._keys[i];
|
1735 | this._values[i - 1] = this._values[i];
|
1736 | }
|
1737 | this._keys.length--;
|
1738 | this._values.length--;
|
1739 | if (key === this._cacheKey) {
|
1740 | this._cacheKey = cacheSentinel;
|
1741 | this._cacheIndex = -2;
|
1742 | }
|
1743 | return true;
|
1744 | }
|
1745 | return false;
|
1746 | };
|
1747 | Map.prototype.clear = function () {
|
1748 | this._keys.length = 0;
|
1749 | this._values.length = 0;
|
1750 | this._cacheKey = cacheSentinel;
|
1751 | this._cacheIndex = -2;
|
1752 | };
|
1753 | Map.prototype.keys = function () { return new MapIterator(this._keys, this._values, getKey); };
|
1754 | Map.prototype.values = function () { return new MapIterator(this._keys, this._values, getValue); };
|
1755 | Map.prototype.entries = function () { return new MapIterator(this._keys, this._values, getEntry); };
|
1756 | Map.prototype["@@iterator"] = function () { return this.entries(); };
|
1757 | Map.prototype[iteratorSymbol] = function () { return this.entries(); };
|
1758 | Map.prototype._find = function (key, insert) {
|
1759 | if (this._cacheKey !== key) {
|
1760 | this._cacheIndex = this._keys.indexOf(this._cacheKey = key);
|
1761 | }
|
1762 | if (this._cacheIndex < 0 && insert) {
|
1763 | this._cacheIndex = this._keys.length;
|
1764 | this._keys.push(key);
|
1765 | this._values.push(undefined);
|
1766 | }
|
1767 | return this._cacheIndex;
|
1768 | };
|
1769 | return Map;
|
1770 | }());
|
1771 | function getKey(key, _) {
|
1772 | return key;
|
1773 | }
|
1774 | function getValue(_, value) {
|
1775 | return value;
|
1776 | }
|
1777 | function getEntry(key, value) {
|
1778 | return [key, value];
|
1779 | }
|
1780 | }
|
1781 |
|
1782 | function CreateSetPolyfill() {
|
1783 | return (function () {
|
1784 | function Set() {
|
1785 | this._map = new _Map();
|
1786 | }
|
1787 | Object.defineProperty(Set.prototype, "size", {
|
1788 | get: function () { return this._map.size; },
|
1789 | enumerable: true,
|
1790 | configurable: true
|
1791 | });
|
1792 | Set.prototype.has = function (value) { return this._map.has(value); };
|
1793 | Set.prototype.add = function (value) { return this._map.set(value, value), this; };
|
1794 | Set.prototype.delete = function (value) { return this._map.delete(value); };
|
1795 | Set.prototype.clear = function () { this._map.clear(); };
|
1796 | Set.prototype.keys = function () { return this._map.keys(); };
|
1797 | Set.prototype.values = function () { return this._map.values(); };
|
1798 | Set.prototype.entries = function () { return this._map.entries(); };
|
1799 | Set.prototype["@@iterator"] = function () { return this.keys(); };
|
1800 | Set.prototype[iteratorSymbol] = function () { return this.keys(); };
|
1801 | return Set;
|
1802 | }());
|
1803 | }
|
1804 |
|
1805 | function CreateWeakMapPolyfill() {
|
1806 | var UUID_SIZE = 16;
|
1807 | var keys = HashMap.create();
|
1808 | var rootKey = CreateUniqueKey();
|
1809 | return (function () {
|
1810 | function WeakMap() {
|
1811 | this._key = CreateUniqueKey();
|
1812 | }
|
1813 | WeakMap.prototype.has = function (target) {
|
1814 | var table = GetOrCreateWeakMapTable(target, false);
|
1815 | return table !== undefined ? HashMap.has(table, this._key) : false;
|
1816 | };
|
1817 | WeakMap.prototype.get = function (target) {
|
1818 | var table = GetOrCreateWeakMapTable(target, false);
|
1819 | return table !== undefined ? HashMap.get(table, this._key) : undefined;
|
1820 | };
|
1821 | WeakMap.prototype.set = function (target, value) {
|
1822 | var table = GetOrCreateWeakMapTable(target, true);
|
1823 | table[this._key] = value;
|
1824 | return this;
|
1825 | };
|
1826 | WeakMap.prototype.delete = function (target) {
|
1827 | var table = GetOrCreateWeakMapTable(target, false);
|
1828 | return table !== undefined ? delete table[this._key] : false;
|
1829 | };
|
1830 | WeakMap.prototype.clear = function () {
|
1831 |
|
1832 | this._key = CreateUniqueKey();
|
1833 | };
|
1834 | return WeakMap;
|
1835 | }());
|
1836 | function CreateUniqueKey() {
|
1837 | var key;
|
1838 | do
|
1839 | key = "@@WeakMap@@" + CreateUUID();
|
1840 | while (HashMap.has(keys, key));
|
1841 | keys[key] = true;
|
1842 | return key;
|
1843 | }
|
1844 | function GetOrCreateWeakMapTable(target, create) {
|
1845 | if (!hasOwn.call(target, rootKey)) {
|
1846 | if (!create)
|
1847 | return undefined;
|
1848 | Object.defineProperty(target, rootKey, { value: HashMap.create() });
|
1849 | }
|
1850 | return target[rootKey];
|
1851 | }
|
1852 | function FillRandomBytes(buffer, size) {
|
1853 | for (var i = 0; i < size; ++i)
|
1854 | buffer[i] = Math.random() * 0xff | 0;
|
1855 | return buffer;
|
1856 | }
|
1857 | function GenRandomBytes(size) {
|
1858 | if (typeof Uint8Array === "function") {
|
1859 | if (typeof crypto !== "undefined")
|
1860 | return crypto.getRandomValues(new Uint8Array(size));
|
1861 | if (typeof msCrypto !== "undefined")
|
1862 | return msCrypto.getRandomValues(new Uint8Array(size));
|
1863 | return FillRandomBytes(new Uint8Array(size), size);
|
1864 | }
|
1865 | return FillRandomBytes(new Array(size), size);
|
1866 | }
|
1867 | function CreateUUID() {
|
1868 | var data = GenRandomBytes(UUID_SIZE);
|
1869 |
|
1870 | data[6] = data[6] & 0x4f | 0x40;
|
1871 | data[8] = data[8] & 0xbf | 0x80;
|
1872 | var result = "";
|
1873 | for (var offset = 0; offset < UUID_SIZE; ++offset) {
|
1874 | var byte = data[offset];
|
1875 | if (offset === 4 || offset === 6 || offset === 8)
|
1876 | result += "-";
|
1877 | if (byte < 16)
|
1878 | result += "0";
|
1879 | result += byte.toString(16).toLowerCase();
|
1880 | }
|
1881 | return result;
|
1882 | }
|
1883 | }
|
1884 |
|
1885 | function MakeDictionary(obj) {
|
1886 | obj.__ = undefined;
|
1887 | delete obj.__;
|
1888 | return obj;
|
1889 | }
|
1890 | });
|
1891 | })(Reflect || (Reflect = {}));
|
1892 |
|
1893 | }.call(this, __webpack_require__( "./node_modules/process/browser.js"), __webpack_require__( "./node_modules/webpack/buildin/global.js")))
|
1894 |
|
1895 | }),
|
1896 |
|
1897 | "./node_modules/webpack/buildin/global.js":
|
1898 |
|
1899 |
|
1900 |
|
1901 |
|
1902 | (function(module, exports) {
|
1903 |
|
1904 | var g;
|
1905 |
|
1906 |
|
1907 | g = (function() {
|
1908 | return this;
|
1909 | })();
|
1910 |
|
1911 | try {
|
1912 |
|
1913 | g = g || new Function("return this")();
|
1914 | } catch (e) {
|
1915 |
|
1916 | if (typeof window === "object") g = window;
|
1917 | }
|
1918 |
|
1919 |
|
1920 |
|
1921 |
|
1922 |
|
1923 | module.exports = g;
|
1924 |
|
1925 |
|
1926 | }),
|
1927 |
|
1928 | "./src/lib/commons/enums.ts":
|
1929 |
|
1930 |
|
1931 |
|
1932 |
|
1933 | (function(module, exports, __webpack_require__) {
|
1934 |
|
1935 | "use strict";
|
1936 |
|
1937 | Object.defineProperty(exports, "__esModule", { value: true });
|
1938 | var Verbs;
|
1939 | (function (Verbs) {
|
1940 | Verbs["Get"] = "GET";
|
1941 | Verbs["Post"] = "POST";
|
1942 | Verbs["Put"] = "PUT";
|
1943 | Verbs["Patch"] = "PATCH";
|
1944 | Verbs["Head"] = "HEAD";
|
1945 | Verbs["Delete"] = "DELETE";
|
1946 | })(Verbs = exports.Verbs || (exports.Verbs = {}));
|
1947 | var MethodType;
|
1948 | (function (MethodType) {
|
1949 | MethodType["Local"] = "Local";
|
1950 | MethodType["Http"] = "Http";
|
1951 | MethodType["MQ"] = "MQ";
|
1952 | MethodType["Redis"] = "Redis";
|
1953 | MethodType["Socket"] = "Socket";
|
1954 | MethodType["Kafka"] = "Kafka";
|
1955 | MethodType["Mock"] = "Mock";
|
1956 | })(MethodType = exports.MethodType || (exports.MethodType = {}));
|
1957 |
|
1958 |
|
1959 | }),
|
1960 |
|
1961 | "./src/lib/commons/index.ts":
|
1962 |
|
1963 |
|
1964 |
|
1965 |
|
1966 | (function(module, exports, __webpack_require__) {
|
1967 |
|
1968 | "use strict";
|
1969 |
|
1970 | function __export(m) {
|
1971 | for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
1972 | }
|
1973 | Object.defineProperty(exports, "__esModule", { value: true });
|
1974 | __export(__webpack_require__( "./src/lib/commons/enums.ts"));
|
1975 | __export(__webpack_require__( "./src/lib/commons/prototyped.ts"));
|
1976 | __export(__webpack_require__( "./src/lib/commons/method-descriptor.ts"));
|
1977 | __export(__webpack_require__( "./src/lib/commons/methodus-class.ts"));
|
1978 | __export(__webpack_require__( "./src/lib/commons/params-map.ts"));
|
1979 |
|
1980 |
|
1981 | }),
|
1982 |
|
1983 | "./src/lib/commons/method-descriptor.ts":
|
1984 |
|
1985 |
|
1986 |
|
1987 |
|
1988 | (function(module, exports, __webpack_require__) {
|
1989 |
|
1990 | "use strict";
|
1991 |
|
1992 | Object.defineProperty(exports, "__esModule", { value: true });
|
1993 | var MethodDescriptor = (function () {
|
1994 | function MethodDescriptor() {
|
1995 | }
|
1996 | return MethodDescriptor;
|
1997 | }());
|
1998 | exports.MethodDescriptor = MethodDescriptor;
|
1999 |
|
2000 |
|
2001 | }),
|
2002 |
|
2003 | "./src/lib/commons/methodus-class.ts":
|
2004 |
|
2005 |
|
2006 |
|
2007 |
|
2008 | (function(module, exports, __webpack_require__) {
|
2009 |
|
2010 | "use strict";
|
2011 |
|
2012 | Object.defineProperty(exports, "__esModule", { value: true });
|
2013 | var MethodusClass = (function () {
|
2014 | function MethodusClass() {
|
2015 | }
|
2016 | return MethodusClass;
|
2017 | }());
|
2018 | exports.MethodusClass = MethodusClass;
|
2019 |
|
2020 |
|
2021 | }),
|
2022 |
|
2023 | "./src/lib/commons/params-map.ts":
|
2024 |
|
2025 |
|
2026 |
|
2027 |
|
2028 | (function(module, exports, __webpack_require__) {
|
2029 |
|
2030 | "use strict";
|
2031 |
|
2032 | Object.defineProperty(exports, "__esModule", { value: true });
|
2033 | var ParamsMap = (function () {
|
2034 | function ParamsMap() {
|
2035 | }
|
2036 | return ParamsMap;
|
2037 | }());
|
2038 | exports.ParamsMap = ParamsMap;
|
2039 |
|
2040 |
|
2041 | }),
|
2042 |
|
2043 | "./src/lib/commons/prototyped.ts":
|
2044 |
|
2045 |
|
2046 |
|
2047 |
|
2048 | (function(module, exports, __webpack_require__) {
|
2049 |
|
2050 | "use strict";
|
2051 |
|
2052 | Object.defineProperty(exports, "__esModule", { value: true });
|
2053 | var Prototyped = (function () {
|
2054 | function Prototyped() {
|
2055 | }
|
2056 | return Prototyped;
|
2057 | }());
|
2058 | exports.Prototyped = Prototyped;
|
2059 |
|
2060 |
|
2061 | }),
|
2062 |
|
2063 | "./src/lib/decorators/index.ts":
|
2064 |
|
2065 |
|
2066 |
|
2067 |
|
2068 | (function(module, exports, __webpack_require__) {
|
2069 |
|
2070 | "use strict";
|
2071 |
|
2072 | function __export(m) {
|
2073 | for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
2074 | }
|
2075 | Object.defineProperty(exports, "__esModule", { value: true });
|
2076 | __export(__webpack_require__( "./src/lib/decorators/method-config-base.ts"));
|
2077 | __export(__webpack_require__( "./src/lib/decorators/method-config-extend.ts"));
|
2078 | __export(__webpack_require__( "./src/lib/decorators/method-config.ts"));
|
2079 | __export(__webpack_require__( "./src/lib/decorators/params.ts"));
|
2080 | __export(__webpack_require__( "./src/lib/decorators/method.ts"));
|
2081 |
|
2082 |
|
2083 | }),
|
2084 |
|
2085 | "./src/lib/decorators/method-config-base.ts":
|
2086 |
|
2087 |
|
2088 |
|
2089 |
|
2090 | (function(module, exports, __webpack_require__) {
|
2091 |
|
2092 | "use strict";
|
2093 |
|
2094 | Object.defineProperty(exports, "__esModule", { value: true });
|
2095 | var di_1 = __webpack_require__( "./src/lib/di/index.ts");
|
2096 |
|
2097 |
|
2098 |
|
2099 |
|
2100 | function MethodConfigBase(name) {
|
2101 | return function (target) {
|
2102 |
|
2103 | di_1.Injector.inject(target, name);
|
2104 | };
|
2105 | }
|
2106 | exports.MethodConfigBase = MethodConfigBase;
|
2107 |
|
2108 |
|
2109 | }),
|
2110 |
|
2111 | "./src/lib/decorators/method-config-extend.ts":
|
2112 |
|
2113 |
|
2114 |
|
2115 |
|
2116 | (function(module, exports, __webpack_require__) {
|
2117 |
|
2118 | "use strict";
|
2119 |
|
2120 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2121 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
2122 | return new (P || (P = Promise))(function (resolve, reject) {
|
2123 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
2124 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
2125 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
2126 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
2127 | });
|
2128 | };
|
2129 | var __generator = (this && this.__generator) || function (thisArg, body) {
|
2130 | var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
2131 | return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
2132 | function verb(n) { return function (v) { return step([n, v]); }; }
|
2133 | function step(op) {
|
2134 | if (f) throw new TypeError("Generator is already executing.");
|
2135 | while (_) try {
|
2136 | if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
2137 | if (y = 0, t) op = [op[0] & 2, t.value];
|
2138 | switch (op[0]) {
|
2139 | case 0: case 1: t = op; break;
|
2140 | case 4: _.label++; return { value: op[1], done: false };
|
2141 | case 5: _.label++; y = op[1]; op = [0]; continue;
|
2142 | case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
2143 | default:
|
2144 | if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
2145 | if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
2146 | if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
2147 | if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
2148 | if (t[2]) _.ops.pop();
|
2149 | _.trys.pop(); continue;
|
2150 | }
|
2151 | op = body.call(thisArg, _);
|
2152 | } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
2153 | if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
2154 | }
|
2155 | };
|
2156 | Object.defineProperty(exports, "__esModule", { value: true });
|
2157 |
|
2158 |
|
2159 |
|
2160 |
|
2161 | function MethodConfigExtend(extendTarget, name) {
|
2162 | var _this = this;
|
2163 | return function (target) {
|
2164 | var filterKeys = ['length', 'caller', 'prototype', 'name', 'methodus', 'methodus_base', 'arguments'];
|
2165 | var trueName = name || target.name;
|
2166 | target.methodus[trueName] = JSON.parse(JSON.stringify(extendTarget.methodus_base));
|
2167 | var inheritSettings = {};
|
2168 | Object.getOwnPropertyNames(extendTarget.prototype.constructor).forEach(function (key) {
|
2169 | if (filterKeys.indexOf(key) === -1) {
|
2170 | var func = function () {
|
2171 | var args = [];
|
2172 | for (var _i = 0; _i < arguments.length; _i++) {
|
2173 | args[_i] = arguments[_i];
|
2174 | }
|
2175 | return __awaiter(_this, void 0, void 0, function () {
|
2176 | return __generator(this, function (_a) {
|
2177 | switch (_a.label) {
|
2178 | case 0:
|
2179 | args.push({ target: target.methodus[trueName], instruct: true });
|
2180 | return [4 , extendTarget.prototype.constructor[key].apply(target, args)];
|
2181 | case 1: return [2 , _a.sent()];
|
2182 | }
|
2183 | });
|
2184 | });
|
2185 | };
|
2186 | inheritSettings[key] = func.bind(target);
|
2187 | }
|
2188 | });
|
2189 | Object.assign(target.prototype.constructor, inheritSettings);
|
2190 | };
|
2191 | }
|
2192 | exports.MethodConfigExtend = MethodConfigExtend;
|
2193 |
|
2194 |
|
2195 | }),
|
2196 |
|
2197 | "./src/lib/decorators/method-config.ts":
|
2198 |
|
2199 |
|
2200 |
|
2201 |
|
2202 | (function(module, exports, __webpack_require__) {
|
2203 |
|
2204 | "use strict";
|
2205 |
|
2206 | Object.defineProperty(exports, "__esModule", { value: true });
|
2207 | var di_1 = __webpack_require__( "./src/lib/di/index.ts");
|
2208 |
|
2209 |
|
2210 |
|
2211 |
|
2212 | function MethodConfig(name, middlewares, baseRoute) {
|
2213 | return function (target) {
|
2214 |
|
2215 | di_1.Injector.inject(target, name);
|
2216 | var proto = target.prototype || target.__proto__;
|
2217 | if (target.methodus) {
|
2218 | proto = target;
|
2219 | }
|
2220 | proto._symbol = name;
|
2221 | proto.methodus[name] = proto.methodus[name] || { _auth: {}, _events: {}, _descriptors: {} };
|
2222 | proto.methodus[name].name = name;
|
2223 | proto.methodus[name].baseRoute = baseRoute;
|
2224 | var methods = Object.getOwnPropertyNames(target.prototype);
|
2225 | methods.forEach(function (methodName) {
|
2226 | return target.prototype[methodName];
|
2227 | });
|
2228 | };
|
2229 | }
|
2230 | exports.MethodConfig = MethodConfig;
|
2231 |
|
2232 |
|
2233 | }),
|
2234 |
|
2235 | "./src/lib/decorators/method.ts":
|
2236 |
|
2237 |
|
2238 |
|
2239 |
|
2240 | (function(module, exports, __webpack_require__) {
|
2241 |
|
2242 | "use strict";
|
2243 |
|
2244 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2245 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
2246 | return new (P || (P = Promise))(function (resolve, reject) {
|
2247 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
2248 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
2249 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
2250 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
2251 | });
|
2252 | };
|
2253 | var __generator = (this && this.__generator) || function (thisArg, body) {
|
2254 | var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
2255 | return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
2256 | function verb(n) { return function (v) { return step([n, v]); }; }
|
2257 | function step(op) {
|
2258 | if (f) throw new TypeError("Generator is already executing.");
|
2259 | while (_) try {
|
2260 | if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
2261 | if (y = 0, t) op = [op[0] & 2, t.value];
|
2262 | switch (op[0]) {
|
2263 | case 0: case 1: t = op; break;
|
2264 | case 4: _.label++; return { value: op[1], done: false };
|
2265 | case 5: _.label++; y = op[1]; op = [0]; continue;
|
2266 | case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
2267 | default:
|
2268 | if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
2269 | if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
2270 | if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
2271 | if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
2272 | if (t[2]) _.ops.pop();
|
2273 | _.trys.pop(); continue;
|
2274 | }
|
2275 | op = body.call(thisArg, _);
|
2276 | } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
2277 | if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
2278 | }
|
2279 | };
|
2280 | Object.defineProperty(exports, "__esModule", { value: true });
|
2281 | var commons_1 = __webpack_require__( "./src/lib/commons/index.ts");
|
2282 | var rest_1 = __webpack_require__( "./src/lib/transports/rest.ts");
|
2283 | var socket_1 = __webpack_require__( "./src/lib/transports/socket.ts");
|
2284 |
|
2285 |
|
2286 |
|
2287 |
|
2288 |
|
2289 | function Method(verb, route) {
|
2290 | var _this = this;
|
2291 | return function (target, propertyKey, descriptor) {
|
2292 | target.methodus = target.methodus || {};
|
2293 | var name = target.name || target.constructor.name;
|
2294 | target.methodus[name] = target.methodus[name] || { _events: {}, _descriptors: {} };
|
2295 | var mTarget = target.methodus[name];
|
2296 | var metaObject = Object.assign({}, { verb: verb, route: route, propertyKey: propertyKey, params: [] });
|
2297 | if (mTarget._descriptors[propertyKey]) {
|
2298 | metaObject = Object.assign(metaObject, { params: mTarget._descriptors[propertyKey].params });
|
2299 | }
|
2300 | mTarget._descriptors[propertyKey] = metaObject;
|
2301 | var paramsMap;
|
2302 | if (metaObject.params) {
|
2303 | paramsMap = metaObject.params;
|
2304 | paramsMap.sort(function (a, b) {
|
2305 | return a.index - b.index;
|
2306 | });
|
2307 | }
|
2308 | var originalMethod = descriptor.value;
|
2309 | descriptor.value = function () {
|
2310 | var args = [];
|
2311 | for (var _i = 0; _i < arguments.length; _i++) {
|
2312 | args[_i] = arguments[_i];
|
2313 | }
|
2314 | return __awaiter(_this, void 0, void 0, function () {
|
2315 | var proto, name, config, methodus, completeConfiguration, _a, socket, messageName, finalRoute, request, result;
|
2316 | return __generator(this, function (_b) {
|
2317 | switch (_b.label) {
|
2318 | case 0:
|
2319 | proto = target.prototype || target.__proto__;
|
2320 | name = target.name;
|
2321 | if (target.constructor) {
|
2322 | name = target.constructor.name;
|
2323 | }
|
2324 | if (target._symbol) {
|
2325 | name = target._symbol;
|
2326 | }
|
2327 | if (proto._symbol) {
|
2328 | name = proto._symbol;
|
2329 | }
|
2330 | config = { methodType: commons_1.MethodType.Http };
|
2331 | if (window.METHODUS_CONFIG) {
|
2332 | config = window.METHODUS_CONFIG[name];
|
2333 | if (!config) {
|
2334 | config = { methodType: commons_1.MethodType.Http };
|
2335 | }
|
2336 | }
|
2337 | if (args && args[args.length - 1] && args[args.length - 1].instruct) {
|
2338 | mTarget = args[args.length - 1].target;
|
2339 | metaObject = mTarget._descriptors[propertyKey];
|
2340 | paramsMap = metaObject.params;
|
2341 | paramsMap.sort(function (a, b) {
|
2342 | return a.index - b.index;
|
2343 | });
|
2344 | }
|
2345 | methodus = mTarget;
|
2346 |
|
2347 | Object.assign(methodus, methodus._descriptors[propertyKey]);
|
2348 | completeConfiguration = Object.assign({}, methodus, config);
|
2349 | _a = config.methodType;
|
2350 | switch (_a) {
|
2351 | case commons_1.MethodType.Mock: return [3 , 1];
|
2352 | case commons_1.MethodType.Local: return [3 , 1];
|
2353 | case commons_1.MethodType.Socket: return [3 , 3];
|
2354 | case commons_1.MethodType.Http: return [3 , 5];
|
2355 | }
|
2356 | return [3 , 7];
|
2357 | case 1: return [4 , originalMethod.apply(target, args)];
|
2358 | case 2: return [2 , _b.sent()];
|
2359 | case 3:
|
2360 | socket = new socket_1.Socket();
|
2361 | messageName = completeConfiguration.verb + "_" + completeConfiguration.route;
|
2362 | return [4 , socket.send(messageName, args)];
|
2363 | case 4:
|
2364 | _b.sent();
|
2365 | return [2 , socket];
|
2366 | case 5:
|
2367 | finalRoute = completeConfiguration.route;
|
2368 |
|
2369 | if (methodus.baseRoute) {
|
2370 | finalRoute = methodus.baseRoute + methodus.baseRoute;
|
2371 | }
|
2372 | if (target.base !== undefined) {
|
2373 | finalRoute = target.base + finalRoute;
|
2374 | }
|
2375 | else if (window.RELATIVE_CONTRACTS) {
|
2376 | finalRoute = '.' + finalRoute;
|
2377 | }
|
2378 | request = new rest_1.Rest(finalRoute, completeConfiguration.verb, paramsMap, args);
|
2379 | return [4 , request.send()];
|
2380 | case 6:
|
2381 | result = _b.sent();
|
2382 | return [2 , result];
|
2383 | case 7: return [2 ];
|
2384 | }
|
2385 | });
|
2386 | });
|
2387 | };
|
2388 | return descriptor;
|
2389 | };
|
2390 | }
|
2391 | exports.Method = Method;
|
2392 |
|
2393 |
|
2394 | }),
|
2395 |
|
2396 | "./src/lib/decorators/params.ts":
|
2397 |
|
2398 |
|
2399 |
|
2400 |
|
2401 | (function(module, exports, __webpack_require__) {
|
2402 |
|
2403 | "use strict";
|
2404 |
|
2405 | Object.defineProperty(exports, "__esModule", { value: true });
|
2406 | function pushParams(target, propertyKey, param) {
|
2407 |
|
2408 | target.methodus = target.methodus || {};
|
2409 | var name = target.name || target.constructor.name;
|
2410 | target.methodus[name] = target.methodus[name] || { _events: {}, _descriptors: {} };
|
2411 | var mTarget = target.methodus[name];
|
2412 | mTarget._descriptors[propertyKey] = mTarget._descriptors[propertyKey] || { params: [] };
|
2413 | mTarget._descriptors[propertyKey].params.push(Object.assign({}, param, { type: 'any' }));
|
2414 | }
|
2415 | function build(from, name, type) {
|
2416 | return function (target, propertyKey, parameterIndex) {
|
2417 | if (name) {
|
2418 | pushParams(target, propertyKey, {
|
2419 | from: from, index: parameterIndex,
|
2420 | name: name,
|
2421 | });
|
2422 | }
|
2423 | else {
|
2424 | pushParams(target, propertyKey, { from: from, index: parameterIndex });
|
2425 | }
|
2426 | };
|
2427 | }
|
2428 | var P = (function () {
|
2429 | function P() {
|
2430 | }
|
2431 | P.Body = function (name, type) {
|
2432 | return build('body', name, type);
|
2433 | };
|
2434 | P.Param = function (name) {
|
2435 | return build('params', name);
|
2436 | };
|
2437 | P.Files = function (name) {
|
2438 | return build('files', name);
|
2439 | };
|
2440 | P.Headers = function (name) {
|
2441 | return build('headers', name);
|
2442 | };
|
2443 | P.Cookies = function (name) {
|
2444 | return build('cookies', name);
|
2445 | };
|
2446 | P.Query = function (name) {
|
2447 | return build('query', name);
|
2448 | };
|
2449 | return P;
|
2450 | }());
|
2451 | exports.P = P;
|
2452 |
|
2453 |
|
2454 | }),
|
2455 |
|
2456 | "./src/lib/di/index.ts":
|
2457 |
|
2458 |
|
2459 |
|
2460 |
|
2461 | (function(module, exports, __webpack_require__) {
|
2462 |
|
2463 | "use strict";
|
2464 |
|
2465 | function __export(m) {
|
2466 | for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
2467 | }
|
2468 | Object.defineProperty(exports, "__esModule", { value: true });
|
2469 | __export(__webpack_require__( "./src/lib/di/injectable.ts"));
|
2470 | __export(__webpack_require__( "./src/lib/di/injector.ts"));
|
2471 | __export(__webpack_require__( "./src/lib/di/inject.ts"));
|
2472 | __export(__webpack_require__( "./src/lib/di/singleton.ts"));
|
2473 |
|
2474 |
|
2475 | }),
|
2476 |
|
2477 | "./src/lib/di/inject.ts":
|
2478 |
|
2479 |
|
2480 |
|
2481 |
|
2482 | (function(module, exports, __webpack_require__) {
|
2483 |
|
2484 | "use strict";
|
2485 |
|
2486 | Object.defineProperty(exports, "__esModule", { value: true });
|
2487 | __webpack_require__( "./node_modules/reflect-metadata/Reflect.js");
|
2488 | var injector_1 = __webpack_require__( "./src/lib/di/injector.ts");
|
2489 | function Inject(name) {
|
2490 | return function (target, propertyKey, parameterIndex) {
|
2491 | var constructorArgs = Reflect.getOwnMetadata('design:paramtypes', target);
|
2492 | var propertyName = getConstructorArgumentsNames(target.prototype.constructor, parameterIndex);
|
2493 | target.prototype[propertyName] = injector_1.Injector.get(name || constructorArgs[parameterIndex]);
|
2494 | };
|
2495 | }
|
2496 | exports.Inject = Inject;
|
2497 | function getConstructorArgumentsNames(constructor, index) {
|
2498 | var functionString = constructor.toString();
|
2499 | var params = GetArgumentNames(functionString);
|
2500 | return params[index];
|
2501 | }
|
2502 | var RegExInsideParentheses = /[(][^)]*[)]/;
|
2503 | var RegExParenthesesAndSpaces = /[()\s]/g;
|
2504 | var GetArgumentNames = function (functionString) {
|
2505 | return RegExInsideParentheses.exec(functionString)[0].replace(RegExParenthesesAndSpaces, '').split(',').map(function (str) { return str.trim(); });
|
2506 | };
|
2507 |
|
2508 |
|
2509 | }),
|
2510 |
|
2511 | "./src/lib/di/injectable.ts":
|
2512 |
|
2513 |
|
2514 |
|
2515 |
|
2516 | (function(module, exports, __webpack_require__) {
|
2517 |
|
2518 | "use strict";
|
2519 |
|
2520 | Object.defineProperty(exports, "__esModule", { value: true });
|
2521 | __webpack_require__( "./node_modules/reflect-metadata/Reflect.js");
|
2522 | var injector_1 = __webpack_require__( "./src/lib/di/injector.ts");
|
2523 | var ANNOTATIONS = '__annotations__';
|
2524 | function Injectable(nameToken) {
|
2525 | function DecoratorFactory(cls) {
|
2526 |
|
2527 | injector_1.Injector.inject(cls, name);
|
2528 | return cls;
|
2529 | }
|
2530 | return DecoratorFactory;
|
2531 | }
|
2532 | exports.Injectable = Injectable;
|
2533 |
|
2534 |
|
2535 | }),
|
2536 |
|
2537 | "./src/lib/di/injector.ts":
|
2538 |
|
2539 |
|
2540 |
|
2541 |
|
2542 | (function(module, exports, __webpack_require__) {
|
2543 |
|
2544 | "use strict";
|
2545 |
|
2546 | var __spreadArrays = (this && this.__spreadArrays) || function () {
|
2547 | for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
2548 | for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
2549 | for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
2550 | r[k] = a[j];
|
2551 | return r;
|
2552 | };
|
2553 | Object.defineProperty(exports, "__esModule", { value: true });
|
2554 | __webpack_require__( "./node_modules/reflect-metadata/Reflect.js");
|
2555 | var ANNOTATIONS = '__annotations__';
|
2556 | var Injector = (function () {
|
2557 | function Injector() {
|
2558 | }
|
2559 | Injector.inject = function (target, name) {
|
2560 |
|
2561 | var annotations = target.hasOwnProperty(ANNOTATIONS) ?
|
2562 | target[ANNOTATIONS] :
|
2563 | Object.defineProperty(target, ANNOTATIONS, { value: [] })[ANNOTATIONS];
|
2564 | var constructorArgs = Reflect.getOwnMetadata('design:paramtypes', target);
|
2565 | if (target.name.length > 2) {
|
2566 | name = target.name;
|
2567 | }
|
2568 | Injector.register(name, target, constructorArgs);
|
2569 | annotations.push('injectable');
|
2570 | };
|
2571 | Injector.resolveAndCreate = function (tokens) {
|
2572 | tokens.forEach(function (target) {
|
2573 |
|
2574 | var name = target.name;
|
2575 | Injector.records.push({
|
2576 | name: name,
|
2577 | target: target,
|
2578 | deps: Reflect.getOwnMetadata('design:paramtypes', target) || []
|
2579 | });
|
2580 | });
|
2581 | return this;
|
2582 | };
|
2583 | Injector.register = function (name, target, deps) {
|
2584 | if (deps === void 0) { deps = []; }
|
2585 | Injector.records.push({
|
2586 | name: name,
|
2587 | target: target,
|
2588 | deps: deps
|
2589 | });
|
2590 | };
|
2591 | Injector.get = function (_token) {
|
2592 | var _a, _b;
|
2593 | if (!_token) {
|
2594 | return null;
|
2595 | }
|
2596 |
|
2597 | var symbol = _token;
|
2598 | if (typeof _token !== 'string') {
|
2599 | symbol = _token.name;
|
2600 | }
|
2601 |
|
2602 | var all = Injector.records.filter(function (record) {
|
2603 | return record.name === symbol;
|
2604 | });
|
2605 | if (!all || all.length === 0) {
|
2606 | return null;
|
2607 |
|
2608 |
|
2609 | }
|
2610 | var record = all[0];
|
2611 |
|
2612 | record.deps = record.deps.map(function (dep) {
|
2613 | if (dep) {
|
2614 | return Injector.get(dep);
|
2615 | }
|
2616 | else {
|
2617 | return null;
|
2618 | }
|
2619 | });
|
2620 | var annotations = Reflect.getOwnMetadata(ANNOTATIONS, record.target);
|
2621 | if (annotations && annotations.indexOf('singleton') === -1) {
|
2622 | return new ((_a = record.target).bind.apply(_a, __spreadArrays([void 0], record.deps)))();
|
2623 | }
|
2624 | else {
|
2625 | if (!this.singletons[symbol]) {
|
2626 | this.singletons[symbol] = new ((_b = record.target).bind.apply(_b, __spreadArrays([void 0], record.deps)))();
|
2627 | }
|
2628 | return this.singletons[symbol];
|
2629 | }
|
2630 | };
|
2631 | Injector.records = [];
|
2632 | Injector.singletons = {};
|
2633 | return Injector;
|
2634 | }());
|
2635 | exports.Injector = Injector;
|
2636 |
|
2637 |
|
2638 | }),
|
2639 |
|
2640 | "./src/lib/di/singleton.ts":
|
2641 |
|
2642 |
|
2643 |
|
2644 |
|
2645 | (function(module, exports, __webpack_require__) {
|
2646 |
|
2647 | "use strict";
|
2648 |
|
2649 | Object.defineProperty(exports, "__esModule", { value: true });
|
2650 | __webpack_require__( "./node_modules/reflect-metadata/Reflect.js");
|
2651 | var ANNOTATIONS = '__annotations__';
|
2652 | function Singleton() {
|
2653 | function DecoratorFactory(cls) {
|
2654 | var annotations = cls.hasOwnProperty(ANNOTATIONS) ?
|
2655 | cls[ANNOTATIONS] :
|
2656 | Object.defineProperty(cls, ANNOTATIONS, { value: [] })[ANNOTATIONS];
|
2657 | annotations.push('singleton');
|
2658 | return cls;
|
2659 | }
|
2660 | return DecoratorFactory;
|
2661 | }
|
2662 | exports.Singleton = Singleton;
|
2663 |
|
2664 |
|
2665 | }),
|
2666 |
|
2667 | "./src/lib/index.ts":
|
2668 |
|
2669 |
|
2670 |
|
2671 |
|
2672 | (function(module, exports, __webpack_require__) {
|
2673 |
|
2674 | "use strict";
|
2675 |
|
2676 | function __export(m) {
|
2677 | for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
2678 | }
|
2679 | Object.defineProperty(exports, "__esModule", { value: true });
|
2680 | __export(__webpack_require__( "./src/lib/decorators/index.ts"));
|
2681 | __export(__webpack_require__( "./src/lib/response/index.ts"));
|
2682 | __export(__webpack_require__( "./src/lib/transports/index.ts"));
|
2683 | __export(__webpack_require__( "./src/lib/commons/index.ts"));
|
2684 | __export(__webpack_require__( "./src/lib/di/index.ts"));
|
2685 |
|
2686 |
|
2687 | }),
|
2688 |
|
2689 | "./src/lib/response/index.ts":
|
2690 |
|
2691 |
|
2692 |
|
2693 |
|
2694 | (function(module, exports, __webpack_require__) {
|
2695 |
|
2696 | "use strict";
|
2697 |
|
2698 | function __export(m) {
|
2699 | for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
2700 | }
|
2701 | Object.defineProperty(exports, "__esModule", { value: true });
|
2702 | __export(__webpack_require__( "./src/lib/response/methodError.ts"));
|
2703 | __export(__webpack_require__( "./src/lib/response/methodResult.ts"));
|
2704 |
|
2705 |
|
2706 | }),
|
2707 |
|
2708 | "./src/lib/response/methodError.ts":
|
2709 |
|
2710 |
|
2711 |
|
2712 |
|
2713 | (function(module, exports, __webpack_require__) {
|
2714 |
|
2715 | "use strict";
|
2716 |
|
2717 | var __extends = (this && this.__extends) || (function () {
|
2718 | var extendStatics = function (d, b) {
|
2719 | extendStatics = Object.setPrototypeOf ||
|
2720 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
2721 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
2722 | return extendStatics(d, b);
|
2723 | };
|
2724 | return function (d, b) {
|
2725 | extendStatics(d, b);
|
2726 | function __() { this.constructor = d; }
|
2727 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
2728 | };
|
2729 | })();
|
2730 | Object.defineProperty(exports, "__esModule", { value: true });
|
2731 | var MethodError = (function (_super) {
|
2732 | __extends(MethodError, _super);
|
2733 | function MethodError(error, statusCode) {
|
2734 | var _this = this;
|
2735 | var message = error;
|
2736 | if (typeof error === 'object') {
|
2737 | message = error.message;
|
2738 | }
|
2739 | _this = _super.call(this, message) || this;
|
2740 | _this.error = error;
|
2741 | _this.statusCode = statusCode || 500;
|
2742 | return _this;
|
2743 | }
|
2744 | return MethodError;
|
2745 | }(Error));
|
2746 | exports.MethodError = MethodError;
|
2747 |
|
2748 |
|
2749 | }),
|
2750 |
|
2751 | "./src/lib/response/methodResult.ts":
|
2752 |
|
2753 |
|
2754 |
|
2755 |
|
2756 | (function(module, exports, __webpack_require__) {
|
2757 |
|
2758 | "use strict";
|
2759 |
|
2760 | Object.defineProperty(exports, "__esModule", { value: true });
|
2761 | var MethodResult = (function () {
|
2762 | function MethodResult(result, total, page) {
|
2763 | this.result = result;
|
2764 | if (total) {
|
2765 | this.total = total;
|
2766 | }
|
2767 | if (page) {
|
2768 | this.page = page;
|
2769 | }
|
2770 | }
|
2771 | MethodResult.prototype.pipe = function (streamToPipe) {
|
2772 | this.stream = streamToPipe;
|
2773 | };
|
2774 | return MethodResult;
|
2775 | }());
|
2776 | exports.MethodResult = MethodResult;
|
2777 |
|
2778 |
|
2779 | }),
|
2780 |
|
2781 | "./src/lib/transports/index.ts":
|
2782 |
|
2783 |
|
2784 |
|
2785 |
|
2786 | (function(module, exports, __webpack_require__) {
|
2787 |
|
2788 | "use strict";
|
2789 |
|
2790 | function __export(m) {
|
2791 | for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
2792 | }
|
2793 | Object.defineProperty(exports, "__esModule", { value: true });
|
2794 | __export(__webpack_require__( "./src/lib/transports/rest.ts"));
|
2795 |
|
2796 |
|
2797 | }),
|
2798 |
|
2799 | "./src/lib/transports/rest.ts":
|
2800 |
|
2801 |
|
2802 |
|
2803 |
|
2804 | (function(module, exports, __webpack_require__) {
|
2805 |
|
2806 | "use strict";
|
2807 |
|
2808 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2809 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
2810 | return new (P || (P = Promise))(function (resolve, reject) {
|
2811 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
2812 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
2813 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
2814 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
2815 | });
|
2816 | };
|
2817 | var __generator = (this && this.__generator) || function (thisArg, body) {
|
2818 | var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
2819 | return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
2820 | function verb(n) { return function (v) { return step([n, v]); }; }
|
2821 | function step(op) {
|
2822 | if (f) throw new TypeError("Generator is already executing.");
|
2823 | while (_) try {
|
2824 | if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
2825 | if (y = 0, t) op = [op[0] & 2, t.value];
|
2826 | switch (op[0]) {
|
2827 | case 0: case 1: t = op; break;
|
2828 | case 4: _.label++; return { value: op[1], done: false };
|
2829 | case 5: _.label++; y = op[1]; op = [0]; continue;
|
2830 | case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
2831 | default:
|
2832 | if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
2833 | if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
2834 | if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
2835 | if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
2836 | if (t[2]) _.ops.pop();
|
2837 | _.trys.pop(); continue;
|
2838 | }
|
2839 | op = body.call(thisArg, _);
|
2840 | } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
2841 | if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
2842 | }
|
2843 | };
|
2844 | Object.defineProperty(exports, "__esModule", { value: true });
|
2845 | var methodError_1 = __webpack_require__( "./src/lib/response/methodError.ts");
|
2846 | var Rest = (function () {
|
2847 | function Rest(uri, verb, paramsMap, args) {
|
2848 | this.options = {};
|
2849 | this.options.uri = uri;
|
2850 | this.parse(verb, paramsMap, args);
|
2851 | if (Rest.interceptor !== undefined) {
|
2852 | Rest.interceptor(this.options);
|
2853 | }
|
2854 | this.request = new Request(this.options.uri);
|
2855 | }
|
2856 | Rest.intercept = function (interceptor) {
|
2857 | Rest.interceptor = interceptor;
|
2858 | };
|
2859 | Rest.prototype.parse = function (verb, paramsMap, args) {
|
2860 | var _this = this;
|
2861 | var queryString = [];
|
2862 | var body = {};
|
2863 | var formData;
|
2864 | var headers = {};
|
2865 | var options = {
|
2866 | cache: 'default',
|
2867 | credentials: 'include',
|
2868 | headers: Object.assign(headers, {
|
2869 | 'Content-Type': 'application/json',
|
2870 | }),
|
2871 | method: verb,
|
2872 | mode: 'cors',
|
2873 | redirect: 'follow',
|
2874 | };
|
2875 | paramsMap.forEach(function (param) {
|
2876 | if (param.index !== undefined && args[param.index] !== undefined) {
|
2877 | switch (param.from) {
|
2878 | case 'params':
|
2879 | if (_this.options.uri) {
|
2880 | _this.options.uri = _this.options.uri.replace(':' + param.name, args[param.index]);
|
2881 | }
|
2882 | break;
|
2883 | case 'query':
|
2884 | if (param.name) {
|
2885 | queryString.push({ name: param.name, value: args[param.index] });
|
2886 | }
|
2887 | else {
|
2888 | var queryObject_1 = args[param.index];
|
2889 | Object.keys(queryObject_1).forEach(function (key) {
|
2890 | if (Array.isArray(queryObject_1[key])) {
|
2891 | queryObject_1[key].forEach(function (item) {
|
2892 | queryString.push({ name: key, value: item });
|
2893 | });
|
2894 | }
|
2895 | else {
|
2896 | queryString.push({ name: key, value: queryObject_1[key] });
|
2897 | }
|
2898 | });
|
2899 | }
|
2900 | break;
|
2901 | case 'body':
|
2902 | if (param.name) {
|
2903 | body[param.name] = args[param.index];
|
2904 | }
|
2905 | else {
|
2906 | Object.assign(body, args[param.index]);
|
2907 | }
|
2908 | break;
|
2909 | case 'files':
|
2910 |
|
2911 | var formData_1 = new FormData();
|
2912 | var argus = args[param.index];
|
2913 | if (!Array.isArray(args[param.index])) {
|
2914 | argus = [args[param.index]];
|
2915 | }
|
2916 | argus.forEach(function (file) {
|
2917 | formData_1.append(param.name || 'files', file, file.name);
|
2918 | });
|
2919 | Object.assign(options, { body: formData_1 });
|
2920 | delete options.headers['Content-Type'];
|
2921 | break;
|
2922 | case 'headers':
|
2923 | if (param.name) {
|
2924 | headers[param.name] = args[param.index];
|
2925 | }
|
2926 | else {
|
2927 | Object.assign(headers, args[param.index]);
|
2928 | }
|
2929 | break;
|
2930 | }
|
2931 | }
|
2932 | });
|
2933 | if (queryString.length > 0) {
|
2934 | this.options.uri = this.options.uri + '?' + queryString.map(function (item) {
|
2935 | if (typeof item.value === 'object') {
|
2936 | return item.name + "=" + encodeURIComponent(JSON.stringify(item.value));
|
2937 | }
|
2938 | else {
|
2939 | return item.name + "=" + encodeURIComponent(item.value);
|
2940 | }
|
2941 | }).join('&');
|
2942 | }
|
2943 | if (body && Object.keys(body).length > 0) {
|
2944 | Object.assign(this.options, options, { body: JSON.stringify(body) });
|
2945 | }
|
2946 | else {
|
2947 | Object.assign(this.options, options);
|
2948 | }
|
2949 | return this.options;
|
2950 | };
|
2951 | Rest.prototype.send = function () {
|
2952 | return __awaiter(this, void 0, void 0, function () {
|
2953 | var response, errorText, _a;
|
2954 | return __generator(this, function (_b) {
|
2955 | switch (_b.label) {
|
2956 | case 0: return [4 , fetch(this.request, this.options)];
|
2957 | case 1:
|
2958 | response = _b.sent();
|
2959 | if (!response.ok) return [3 , 2];
|
2960 | return [2 , response.json()];
|
2961 | case 2:
|
2962 | errorText = response.statusText;
|
2963 | if (!response.body) return [3 , 6];
|
2964 | _b.label = 3;
|
2965 | case 3:
|
2966 | _b.trys.push([3, 5, , 6]);
|
2967 | return [4 , response.json()];
|
2968 | case 4:
|
2969 | errorText = (_b.sent()).error;
|
2970 | return [3 , 6];
|
2971 | case 5:
|
2972 | _a = _b.sent();
|
2973 | return [3 , 6];
|
2974 | case 6: throw (new methodError_1.MethodError(errorText, response.status));
|
2975 | }
|
2976 | });
|
2977 | });
|
2978 | };
|
2979 | return Rest;
|
2980 | }());
|
2981 | exports.Rest = Rest;
|
2982 |
|
2983 |
|
2984 | }),
|
2985 |
|
2986 | "./src/lib/transports/socket.ts":
|
2987 |
|
2988 |
|
2989 |
|
2990 |
|
2991 | (function(module, exports, __webpack_require__) {
|
2992 |
|
2993 | "use strict";
|
2994 |
|
2995 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2996 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
2997 | return new (P || (P = Promise))(function (resolve, reject) {
|
2998 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
2999 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
3000 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
3001 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
3002 | });
|
3003 | };
|
3004 | var __generator = (this && this.__generator) || function (thisArg, body) {
|
3005 | var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
3006 | return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
3007 | function verb(n) { return function (v) { return step([n, v]); }; }
|
3008 | function step(op) {
|
3009 | if (f) throw new TypeError("Generator is already executing.");
|
3010 | while (_) try {
|
3011 | if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
3012 | if (y = 0, t) op = [op[0] & 2, t.value];
|
3013 | switch (op[0]) {
|
3014 | case 0: case 1: t = op; break;
|
3015 | case 4: _.label++; return { value: op[1], done: false };
|
3016 | case 5: _.label++; y = op[1]; op = [0]; continue;
|
3017 | case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
3018 | default:
|
3019 | if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
3020 | if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
3021 | if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
3022 | if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
3023 | if (t[2]) _.ops.pop();
|
3024 | _.trys.pop(); continue;
|
3025 | }
|
3026 | op = body.call(thisArg, _);
|
3027 | } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
3028 | if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
3029 | }
|
3030 | };
|
3031 | Object.defineProperty(exports, "__esModule", { value: true });
|
3032 | var events_1 = __webpack_require__( "./node_modules/events/events.js");
|
3033 | var socket = null;
|
3034 | var Socket = (function () {
|
3035 | function Socket() {
|
3036 | this.options = {};
|
3037 | this.io = window.io;
|
3038 | if (!this.io) {
|
3039 | console.warn('not implemented');
|
3040 | socket = new events_1.EventEmitter();
|
3041 | }
|
3042 | if (!socket) {
|
3043 | this.socket = socket = this.io('/', { nsp: '/' }).connect();
|
3044 | }
|
3045 | else {
|
3046 | this.socket = socket;
|
3047 | }
|
3048 | }
|
3049 | Socket.intercept = function (interceptor) {
|
3050 | };
|
3051 | Socket.prototype.parse = function (verb, paramsMap, args) {
|
3052 | };
|
3053 | Socket.prototype.send = function (messageName, parameters) {
|
3054 | return __awaiter(this, void 0, void 0, function () {
|
3055 | var _this = this;
|
3056 | return __generator(this, function (_a) {
|
3057 | return [2 , new Promise(function (resolve) {
|
3058 | var emition = _this.socket.emit(messageName, parameters, function (data) {
|
3059 | });
|
3060 | resolve(emition);
|
3061 | })];
|
3062 | });
|
3063 | });
|
3064 | };
|
3065 | Socket.prototype.execute = function () {
|
3066 | return __awaiter(this, void 0, void 0, function () {
|
3067 | return __generator(this, function (_a) {
|
3068 | return [2 ];
|
3069 | });
|
3070 | });
|
3071 | };
|
3072 | return Socket;
|
3073 | }());
|
3074 | exports.Socket = Socket;
|
3075 |
|
3076 |
|
3077 | }),
|
3078 |
|
3079 | 0:
|
3080 |
|
3081 |
|
3082 |
|
3083 |
|
3084 | (function(module, exports, __webpack_require__) {
|
3085 |
|
3086 | module.exports = __webpack_require__("./src/lib/index.ts");
|
3087 |
|
3088 |
|
3089 | })
|
3090 |
|
3091 | });
|
3092 | });
|
3093 |
|
\ | No newline at end of file |