UNPKG

124 kBJavaScriptView Raw
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() {
11return /******/ (function(modules) { // webpackBootstrap
12/******/ // The module cache
13/******/ var installedModules = {};
14/******/
15/******/ // The require function
16/******/ function __webpack_require__(moduleId) {
17/******/
18/******/ // Check if module is in cache
19/******/ if(installedModules[moduleId]) {
20/******/ return installedModules[moduleId].exports;
21/******/ }
22/******/ // Create a new module (and put it into the cache)
23/******/ var module = installedModules[moduleId] = {
24/******/ i: moduleId,
25/******/ l: false,
26/******/ exports: {}
27/******/ };
28/******/
29/******/ // Execute the module function
30/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
31/******/
32/******/ // Flag the module as loaded
33/******/ module.l = true;
34/******/
35/******/ // Return the exports of the module
36/******/ return module.exports;
37/******/ }
38/******/
39/******/
40/******/ // expose the modules object (__webpack_modules__)
41/******/ __webpack_require__.m = modules;
42/******/
43/******/ // expose the module cache
44/******/ __webpack_require__.c = installedModules;
45/******/
46/******/ // define getter function for harmony exports
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/******/ // define __esModule on exports
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/******/ // create a fake namespace object
62/******/ // mode & 1: value is a module id, require it
63/******/ // mode & 2: merge all properties of value into the ns
64/******/ // mode & 4: return value when already ns object
65/******/ // mode & 8|1: behave like require
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/******/ // getDefaultExport function for compatibility with non-harmony modules
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/******/ // Object.prototype.hasOwnProperty.call
87/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
88/******/
89/******/ // __webpack_public_path__
90/******/ __webpack_require__.p = "";
91/******/
92/******/
93/******/ // Load entry module and return exports
94/******/ return __webpack_require__(__webpack_require__.s = 0);
95/******/ })
96/************************************************************************/
97/******/ ({
98
99/***/ "./node_modules/events/events.js":
100/*!***************************************!*\
101 !*** ./node_modules/events/events.js ***!
102 \***************************************/
103/*! no static exports found */
104/***/ (function(module, exports, __webpack_require__) {
105
106"use strict";
107// Copyright Joyent, Inc. and other Node contributors.
108//
109// Permission is hereby granted, free of charge, to any person obtaining a
110// copy of this software and associated documentation files (the
111// "Software"), to deal in the Software without restriction, including
112// without limitation the rights to use, copy, modify, merge, publish,
113// distribute, sublicense, and/or sell copies of the Software, and to permit
114// persons to whom the Software is furnished to do so, subject to the
115// following conditions:
116//
117// The above copyright notice and this permission notice shall be included
118// in all copies or substantial portions of the Software.
119//
120// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
121// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
122// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
123// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
124// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
125// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
126// USE OR OTHER DEALINGS IN THE SOFTWARE.
127
128
129
130var R = typeof Reflect === 'object' ? Reflect : null
131var 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
137var ReflectOwnKeys
138if (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
151function ProcessEmitWarning(warning) {
152 if (console && console.warn) console.warn(warning);
153}
154
155var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {
156 return value !== value;
157}
158
159function EventEmitter() {
160 EventEmitter.init.call(this);
161}
162module.exports = EventEmitter;
163
164// Backwards-compat with node 0.10.x
165EventEmitter.EventEmitter = EventEmitter;
166
167EventEmitter.prototype._events = undefined;
168EventEmitter.prototype._eventsCount = 0;
169EventEmitter.prototype._maxListeners = undefined;
170
171// By default EventEmitters will print a warning if more than 10 listeners are
172// added to it. This is a useful default which helps finding memory leaks.
173var defaultMaxListeners = 10;
174
175Object.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
188EventEmitter.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// Obviously not all Emitters should be limited to 10. This function allows
200// that to be increased. Set to zero for unlimited.
201EventEmitter.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
209function $getMaxListeners(that) {
210 if (that._maxListeners === undefined)
211 return EventEmitter.defaultMaxListeners;
212 return that._maxListeners;
213}
214
215EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
216 return $getMaxListeners(this);
217};
218
219EventEmitter.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 // If there is no 'error' event listener then throw.
231 if (doError) {
232 var er;
233 if (args.length > 0)
234 er = args[0];
235 if (er instanceof Error) {
236 // Note: The comments on the `throw` lines are intentional, they show
237 // up in Node's output if this results in an unhandled exception.
238 throw er; // Unhandled 'error' event
239 }
240 // At least give some kind of context to the user
241 var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));
242 err.context = er;
243 throw err; // Unhandled 'error' event
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
263function _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 // To avoid recursion in the case that type === "newListener"! Before
278 // adding it to the listeners, first emit "newListener".
279 if (events.newListener !== undefined) {
280 target.emit('newListener', type,
281 listener.listener ? listener.listener : listener);
282
283 // Re-assign `events` because a newListener handler could have caused the
284 // this._events to be assigned to a new object
285 events = target._events;
286 }
287 existing = events[type];
288 }
289
290 if (existing === undefined) {
291 // Optimize the case of one listener. Don't need the extra array object.
292 existing = events[type] = listener;
293 ++target._eventsCount;
294 } else {
295 if (typeof existing === 'function') {
296 // Adding the second element, need to change to array.
297 existing = events[type] =
298 prepend ? [listener, existing] : [existing, listener];
299 // If we've already got an array, just append.
300 } else if (prepend) {
301 existing.unshift(listener);
302 } else {
303 existing.push(listener);
304 }
305
306 // Check for listener leak
307 m = $getMaxListeners(target);
308 if (m > 0 && existing.length > m && !existing.warned) {
309 existing.warned = true;
310 // No error code for this since it is a Warning
311 // eslint-disable-next-line no-restricted-syntax
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
327EventEmitter.prototype.addListener = function addListener(type, listener) {
328 return _addListener(this, type, listener, false);
329};
330
331EventEmitter.prototype.on = EventEmitter.prototype.addListener;
332
333EventEmitter.prototype.prependListener =
334 function prependListener(type, listener) {
335 return _addListener(this, type, listener, true);
336 };
337
338function 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
348function _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
356EventEmitter.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
364EventEmitter.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// Emits a 'removeListener' event if and only if the listener was removed.
374EventEmitter.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
428EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
429
430EventEmitter.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 // not listening for removeListener, no need to emit
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 // emit removeListener for all listeners on all events
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 // LIFO order
473 for (i = listeners.length - 1; i >= 0; i--) {
474 this.removeListener(type, listeners[i]);
475 }
476 }
477
478 return this;
479 };
480
481function _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
498EventEmitter.prototype.listeners = function listeners(type) {
499 return _listeners(this, type, true);
500};
501
502EventEmitter.prototype.rawListeners = function rawListeners(type) {
503 return _listeners(this, type, false);
504};
505
506EventEmitter.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
514EventEmitter.prototype.listenerCount = listenerCount;
515function 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
531EventEmitter.prototype.eventNames = function eventNames() {
532 return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];
533};
534
535function 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
542function spliceOne(list, index) {
543 for (; index + 1 < list.length; index++)
544 list[index] = list[index + 1];
545 list.pop();
546}
547
548function 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 !*** ./node_modules/process/browser.js ***!
562 \*****************************************/
563/*! no static exports found */
564/***/ (function(module, exports) {
565
566// shim for using process in browser
567var process = module.exports = {};
568
569// cached from whatever global is present so that test runners that stub it
570// don't break things. But we need to wrap it in a try catch in case it is
571// wrapped in strict mode code which doesn't define any globals. It's inside a
572// function because try/catches deoptimize in certain engines.
573
574var cachedSetTimeout;
575var cachedClearTimeout;
576
577function defaultSetTimout() {
578 throw new Error('setTimeout has not been defined');
579}
580function 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} ())
603function runTimeout(fun) {
604 if (cachedSetTimeout === setTimeout) {
605 //normal enviroments in sane situations
606 return setTimeout(fun, 0);
607 }
608 // if setTimeout wasn't available but was latter defined
609 if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
610 cachedSetTimeout = setTimeout;
611 return setTimeout(fun, 0);
612 }
613 try {
614 // when when somebody has screwed with setTimeout but no I.E. maddness
615 return cachedSetTimeout(fun, 0);
616 } catch(e){
617 try {
618 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
619 return cachedSetTimeout.call(null, fun, 0);
620 } catch(e){
621 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
622 return cachedSetTimeout.call(this, fun, 0);
623 }
624 }
625
626
627}
628function runClearTimeout(marker) {
629 if (cachedClearTimeout === clearTimeout) {
630 //normal enviroments in sane situations
631 return clearTimeout(marker);
632 }
633 // if clearTimeout wasn't available but was latter defined
634 if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
635 cachedClearTimeout = clearTimeout;
636 return clearTimeout(marker);
637 }
638 try {
639 // when when somebody has screwed with setTimeout but no I.E. maddness
640 return cachedClearTimeout(marker);
641 } catch (e){
642 try {
643 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
644 return cachedClearTimeout.call(null, marker);
645 } catch (e){
646 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
647 // Some versions of I.E. have different rules for clearTimeout vs setTimeout
648 return cachedClearTimeout.call(this, marker);
649 }
650 }
651
652
653
654}
655var queue = [];
656var draining = false;
657var currentQueue;
658var queueIndex = -1;
659
660function 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
675function 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
699process.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// v8 likes predictible objects
713function Item(fun, array) {
714 this.fun = fun;
715 this.array = array;
716}
717Item.prototype.run = function () {
718 this.fun.apply(null, this.array);
719};
720process.title = 'browser';
721process.browser = true;
722process.env = {};
723process.argv = [];
724process.version = ''; // empty string to avoid regexp issues
725process.versions = {};
726
727function noop() {}
728
729process.on = noop;
730process.addListener = noop;
731process.once = noop;
732process.off = noop;
733process.removeListener = noop;
734process.removeAllListeners = noop;
735process.emit = noop;
736process.prependListener = noop;
737process.prependOnceListener = noop;
738
739process.listeners = function (name) { return [] }
740
741process.binding = function (name) {
742 throw new Error('process.binding is not supported');
743};
744
745process.cwd = function () { return '/' };
746process.chdir = function (dir) {
747 throw new Error('process.chdir is not supported');
748};
749process.umask = function() { return 0; };
750
751
752/***/ }),
753
754/***/ "./node_modules/reflect-metadata/Reflect.js":
755/*!**************************************************!*\
756 !*** ./node_modules/reflect-metadata/Reflect.js ***!
757 \**************************************************/
758/*! no static exports found */
759/***/ (function(module, exports, __webpack_require__) {
760
761/* WEBPACK VAR INJECTION */(function(process, global) {/*! *****************************************************************************
762Copyright (C) Microsoft. All rights reserved.
763Licensed under the Apache License, Version 2.0 (the "License"); you may not use
764this file except in compliance with the License. You may obtain a copy of the
765License at http://www.apache.org/licenses/LICENSE-2.0
766
767THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
768KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
769WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
770MERCHANTABLITY OR NON-INFRINGEMENT.
771
772See the Apache Version 2.0 License for specific language governing permissions
773and limitations under the License.
774***************************************************************************** */
775var Reflect;
776(function (Reflect) {
777 // Metadata Proposal
778 // https://rbuckton.github.io/reflect-metadata/
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 // feature test for Symbol support
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"; // feature test for Object.create support
808 var supportsProto = { __proto__: [] } instanceof Array; // feature test for __proto__ support
809 var downLevel = !supportsCreate && !supportsProto;
810 var HashMap = {
811 // create an object in dictionary mode (a.k.a. "slow" mode in v8)
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 // Load global or shim versions of Map, Set, and WeakMap
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 // [[Metadata]] internal slot
831 // https://rbuckton.github.io/reflect-metadata/#ordinary-object-internal-methods-and-internal-slots
832 var Metadata = new _WeakMap();
833 /**
834 * Applies a set of decorators to a property of a target object.
835 * @param decorators An array of decorators.
836 * @param target The target object.
837 * @param propertyKey (Optional) The property key to decorate.
838 * @param attributes (Optional) The property descriptor for the target key.
839 * @remarks Decorators are applied in reverse order.
840 * @example
841 *
842 * class Example {
843 * // property declarations are not part of ES6, though they are valid in TypeScript:
844 * // static staticProperty;
845 * // property;
846 *
847 * constructor(p) { }
848 * static staticMethod(p) { }
849 * method(p) { }
850 * }
851 *
852 * // constructor
853 * Example = Reflect.decorate(decoratorsArray, Example);
854 *
855 * // property (on constructor)
856 * Reflect.decorate(decoratorsArray, Example, "staticProperty");
857 *
858 * // property (on prototype)
859 * Reflect.decorate(decoratorsArray, Example.prototype, "property");
860 *
861 * // method (on constructor)
862 * Object.defineProperty(Example, "staticMethod",
863 * Reflect.decorate(decoratorsArray, Example, "staticMethod",
864 * Object.getOwnPropertyDescriptor(Example, "staticMethod")));
865 *
866 * // method (on prototype)
867 * Object.defineProperty(Example.prototype, "method",
868 * Reflect.decorate(decoratorsArray, Example.prototype, "method",
869 * Object.getOwnPropertyDescriptor(Example.prototype, "method")));
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 // 4.1.2 Reflect.metadata(metadataKey, metadataValue)
895 // https://rbuckton.github.io/reflect-metadata/#reflect.metadata
896 /**
897 * A default metadata decorator factory that can be used on a class, class member, or parameter.
898 * @param metadataKey The key for the metadata entry.
899 * @param metadataValue The value for the metadata entry.
900 * @returns A decorator function.
901 * @remarks
902 * If `metadataKey` is already defined for the target and target key, the
903 * metadataValue for that key will be overwritten.
904 * @example
905 *
906 * // constructor
907 * @Reflect.metadata(key, value)
908 * class Example {
909 * }
910 *
911 * // property (on constructor, TypeScript only)
912 * class Example {
913 * @Reflect.metadata(key, value)
914 * static staticProperty;
915 * }
916 *
917 * // property (on prototype, TypeScript only)
918 * class Example {
919 * @Reflect.metadata(key, value)
920 * property;
921 * }
922 *
923 * // method (on constructor)
924 * class Example {
925 * @Reflect.metadata(key, value)
926 * static staticMethod() { }
927 * }
928 *
929 * // method (on prototype)
930 * class Example {
931 * @Reflect.metadata(key, value)
932 * method() { }
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 * Define a unique metadata entry on the target.
949 * @param metadataKey A key used to store and retrieve metadata.
950 * @param metadataValue A value that contains attached metadata.
951 * @param target The target object on which to define metadata.
952 * @param propertyKey (Optional) The property key for the target.
953 * @example
954 *
955 * class Example {
956 * // property declarations are not part of ES6, though they are valid in TypeScript:
957 * // static staticProperty;
958 * // property;
959 *
960 * constructor(p) { }
961 * static staticMethod(p) { }
962 * method(p) { }
963 * }
964 *
965 * // constructor
966 * Reflect.defineMetadata("custom:annotation", options, Example);
967 *
968 * // property (on constructor)
969 * Reflect.defineMetadata("custom:annotation", options, Example, "staticProperty");
970 *
971 * // property (on prototype)
972 * Reflect.defineMetadata("custom:annotation", options, Example.prototype, "property");
973 *
974 * // method (on constructor)
975 * Reflect.defineMetadata("custom:annotation", options, Example, "staticMethod");
976 *
977 * // method (on prototype)
978 * Reflect.defineMetadata("custom:annotation", options, Example.prototype, "method");
979 *
980 * // decorator factory as metadata-producing annotation.
981 * function MyAnnotation(options): Decorator {
982 * return (target, key?) => Reflect.defineMetadata("custom:annotation", options, target, key);
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 * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined.
996 * @param metadataKey A key used to store and retrieve metadata.
997 * @param target The target object on which the metadata is defined.
998 * @param propertyKey (Optional) The property key for the target.
999 * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`.
1000 * @example
1001 *
1002 * class Example {
1003 * // property declarations are not part of ES6, though they are valid in TypeScript:
1004 * // static staticProperty;
1005 * // property;
1006 *
1007 * constructor(p) { }
1008 * static staticMethod(p) { }
1009 * method(p) { }
1010 * }
1011 *
1012 * // constructor
1013 * result = Reflect.hasMetadata("custom:annotation", Example);
1014 *
1015 * // property (on constructor)
1016 * result = Reflect.hasMetadata("custom:annotation", Example, "staticProperty");
1017 *
1018 * // property (on prototype)
1019 * result = Reflect.hasMetadata("custom:annotation", Example.prototype, "property");
1020 *
1021 * // method (on constructor)
1022 * result = Reflect.hasMetadata("custom:annotation", Example, "staticMethod");
1023 *
1024 * // method (on prototype)
1025 * result = Reflect.hasMetadata("custom:annotation", Example.prototype, "method");
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 * Gets a value indicating whether the target object has the provided metadata key defined.
1038 * @param metadataKey A key used to store and retrieve metadata.
1039 * @param target The target object on which the metadata is defined.
1040 * @param propertyKey (Optional) The property key for the target.
1041 * @returns `true` if the metadata key was defined on the target object; otherwise, `false`.
1042 * @example
1043 *
1044 * class Example {
1045 * // property declarations are not part of ES6, though they are valid in TypeScript:
1046 * // static staticProperty;
1047 * // property;
1048 *
1049 * constructor(p) { }
1050 * static staticMethod(p) { }
1051 * method(p) { }
1052 * }
1053 *
1054 * // constructor
1055 * result = Reflect.hasOwnMetadata("custom:annotation", Example);
1056 *
1057 * // property (on constructor)
1058 * result = Reflect.hasOwnMetadata("custom:annotation", Example, "staticProperty");
1059 *
1060 * // property (on prototype)
1061 * result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "property");
1062 *
1063 * // method (on constructor)
1064 * result = Reflect.hasOwnMetadata("custom:annotation", Example, "staticMethod");
1065 *
1066 * // method (on prototype)
1067 * result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "method");
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 * Gets the metadata value for the provided metadata key on the target object or its prototype chain.
1080 * @param metadataKey A key used to store and retrieve metadata.
1081 * @param target The target object on which the metadata is defined.
1082 * @param propertyKey (Optional) The property key for the target.
1083 * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
1084 * @example
1085 *
1086 * class Example {
1087 * // property declarations are not part of ES6, though they are valid in TypeScript:
1088 * // static staticProperty;
1089 * // property;
1090 *
1091 * constructor(p) { }
1092 * static staticMethod(p) { }
1093 * method(p) { }
1094 * }
1095 *
1096 * // constructor
1097 * result = Reflect.getMetadata("custom:annotation", Example);
1098 *
1099 * // property (on constructor)
1100 * result = Reflect.getMetadata("custom:annotation", Example, "staticProperty");
1101 *
1102 * // property (on prototype)
1103 * result = Reflect.getMetadata("custom:annotation", Example.prototype, "property");
1104 *
1105 * // method (on constructor)
1106 * result = Reflect.getMetadata("custom:annotation", Example, "staticMethod");
1107 *
1108 * // method (on prototype)
1109 * result = Reflect.getMetadata("custom:annotation", Example.prototype, "method");
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 * Gets the metadata value for the provided metadata key on the target object.
1122 * @param metadataKey A key used to store and retrieve metadata.
1123 * @param target The target object on which the metadata is defined.
1124 * @param propertyKey (Optional) The property key for the target.
1125 * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
1126 * @example
1127 *
1128 * class Example {
1129 * // property declarations are not part of ES6, though they are valid in TypeScript:
1130 * // static staticProperty;
1131 * // property;
1132 *
1133 * constructor(p) { }
1134 * static staticMethod(p) { }
1135 * method(p) { }
1136 * }
1137 *
1138 * // constructor
1139 * result = Reflect.getOwnMetadata("custom:annotation", Example);
1140 *
1141 * // property (on constructor)
1142 * result = Reflect.getOwnMetadata("custom:annotation", Example, "staticProperty");
1143 *
1144 * // property (on prototype)
1145 * result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "property");
1146 *
1147 * // method (on constructor)
1148 * result = Reflect.getOwnMetadata("custom:annotation", Example, "staticMethod");
1149 *
1150 * // method (on prototype)
1151 * result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "method");
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 * Gets the metadata keys defined on the target object or its prototype chain.
1164 * @param target The target object on which the metadata is defined.
1165 * @param propertyKey (Optional) The property key for the target.
1166 * @returns An array of unique metadata keys.
1167 * @example
1168 *
1169 * class Example {
1170 * // property declarations are not part of ES6, though they are valid in TypeScript:
1171 * // static staticProperty;
1172 * // property;
1173 *
1174 * constructor(p) { }
1175 * static staticMethod(p) { }
1176 * method(p) { }
1177 * }
1178 *
1179 * // constructor
1180 * result = Reflect.getMetadataKeys(Example);
1181 *
1182 * // property (on constructor)
1183 * result = Reflect.getMetadataKeys(Example, "staticProperty");
1184 *
1185 * // property (on prototype)
1186 * result = Reflect.getMetadataKeys(Example.prototype, "property");
1187 *
1188 * // method (on constructor)
1189 * result = Reflect.getMetadataKeys(Example, "staticMethod");
1190 *
1191 * // method (on prototype)
1192 * result = Reflect.getMetadataKeys(Example.prototype, "method");
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 * Gets the unique metadata keys defined on the target object.
1205 * @param target The target object on which the metadata is defined.
1206 * @param propertyKey (Optional) The property key for the target.
1207 * @returns An array of unique metadata keys.
1208 * @example
1209 *
1210 * class Example {
1211 * // property declarations are not part of ES6, though they are valid in TypeScript:
1212 * // static staticProperty;
1213 * // property;
1214 *
1215 * constructor(p) { }
1216 * static staticMethod(p) { }
1217 * method(p) { }
1218 * }
1219 *
1220 * // constructor
1221 * result = Reflect.getOwnMetadataKeys(Example);
1222 *
1223 * // property (on constructor)
1224 * result = Reflect.getOwnMetadataKeys(Example, "staticProperty");
1225 *
1226 * // property (on prototype)
1227 * result = Reflect.getOwnMetadataKeys(Example.prototype, "property");
1228 *
1229 * // method (on constructor)
1230 * result = Reflect.getOwnMetadataKeys(Example, "staticMethod");
1231 *
1232 * // method (on prototype)
1233 * result = Reflect.getOwnMetadataKeys(Example.prototype, "method");
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 * Deletes the metadata entry from the target object with the provided key.
1246 * @param metadataKey A key used to store and retrieve metadata.
1247 * @param target The target object on which the metadata is defined.
1248 * @param propertyKey (Optional) The property key for the target.
1249 * @returns `true` if the metadata entry was found and deleted; otherwise, false.
1250 * @example
1251 *
1252 * class Example {
1253 * // property declarations are not part of ES6, though they are valid in TypeScript:
1254 * // static staticProperty;
1255 * // property;
1256 *
1257 * constructor(p) { }
1258 * static staticMethod(p) { }
1259 * method(p) { }
1260 * }
1261 *
1262 * // constructor
1263 * result = Reflect.deleteMetadata("custom:annotation", Example);
1264 *
1265 * // property (on constructor)
1266 * result = Reflect.deleteMetadata("custom:annotation", Example, "staticProperty");
1267 *
1268 * // property (on prototype)
1269 * result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "property");
1270 *
1271 * // method (on constructor)
1272 * result = Reflect.deleteMetadata("custom:annotation", Example, "staticMethod");
1273 *
1274 * // method (on prototype)
1275 * result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "method");
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, /*Create*/ 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 // 3.1.1.1 OrdinaryHasMetadata(MetadataKey, O, P)
1340 // https://rbuckton.github.io/reflect-metadata/#ordinaryhasmetadata
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 // 3.1.2.1 OrdinaryHasOwnMetadata(MetadataKey, O, P)
1351 // https://rbuckton.github.io/reflect-metadata/#ordinaryhasownmetadata
1352 function OrdinaryHasOwnMetadata(MetadataKey, O, P) {
1353 var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false);
1354 if (IsUndefined(metadataMap))
1355 return false;
1356 return ToBoolean(metadataMap.has(MetadataKey));
1357 }
1358 // 3.1.3.1 OrdinaryGetMetadata(MetadataKey, O, P)
1359 // https://rbuckton.github.io/reflect-metadata/#ordinarygetmetadata
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 // 3.1.4.1 OrdinaryGetOwnMetadata(MetadataKey, O, P)
1370 // https://rbuckton.github.io/reflect-metadata/#ordinarygetownmetadata
1371 function OrdinaryGetOwnMetadata(MetadataKey, O, P) {
1372 var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false);
1373 if (IsUndefined(metadataMap))
1374 return undefined;
1375 return metadataMap.get(MetadataKey);
1376 }
1377 // 3.1.5.1 OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P)
1378 // https://rbuckton.github.io/reflect-metadata/#ordinarydefineownmetadata
1379 function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) {
1380 var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ true);
1381 metadataMap.set(MetadataKey, MetadataValue);
1382 }
1383 // 3.1.6.1 OrdinaryMetadataKeys(O, P)
1384 // https://rbuckton.github.io/reflect-metadata/#ordinarymetadatakeys
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, /*Create*/ 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 // 6 ECMAScript Data Typ0es and Values
1447 // https://tc39.github.io/ecma262/#sec-ecmascript-data-types-and-values
1448 function Type(x) {
1449 if (x === null)
1450 return 1 /* Null */;
1451 switch (typeof x) {
1452 case "undefined": return 0 /* Undefined */;
1453 case "boolean": return 2 /* Boolean */;
1454 case "string": return 3 /* String */;
1455 case "symbol": return 4 /* Symbol */;
1456 case "number": return 5 /* Number */;
1457 case "object": return x === null ? 1 /* Null */ : 6 /* Object */;
1458 default: return 6 /* Object */;
1459 }
1460 }
1461 // 6.1.1 The Undefined Type
1462 // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-undefined-type
1463 function IsUndefined(x) {
1464 return x === undefined;
1465 }
1466 // 6.1.2 The Null Type
1467 // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-null-type
1468 function IsNull(x) {
1469 return x === null;
1470 }
1471 // 6.1.5 The Symbol Type
1472 // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-symbol-type
1473 function IsSymbol(x) {
1474 return typeof x === "symbol";
1475 }
1476 // 6.1.7 The Object Type
1477 // https://tc39.github.io/ecma262/#sec-object-type
1478 function IsObject(x) {
1479 return typeof x === "object" ? x !== null : typeof x === "function";
1480 }
1481 // 7.1 Type Conversion
1482 // https://tc39.github.io/ecma262/#sec-type-conversion
1483 // 7.1.1 ToPrimitive(input [, PreferredType])
1484 // https://tc39.github.io/ecma262/#sec-toprimitive
1485 function ToPrimitive(input, PreferredType) {
1486 switch (Type(input)) {
1487 case 0 /* Undefined */: return input;
1488 case 1 /* Null */: return input;
1489 case 2 /* Boolean */: return input;
1490 case 3 /* String */: return input;
1491 case 4 /* Symbol */: return input;
1492 case 5 /* Number */: return input;
1493 }
1494 var hint = PreferredType === 3 /* String */ ? "string" : PreferredType === 5 /* Number */ ? "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 // 7.1.1.1 OrdinaryToPrimitive(O, hint)
1505 // https://tc39.github.io/ecma262/#sec-ordinarytoprimitive
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 // 7.1.2 ToBoolean(argument)
1538 // https://tc39.github.io/ecma262/2016/#sec-toboolean
1539 function ToBoolean(argument) {
1540 return !!argument;
1541 }
1542 // 7.1.12 ToString(argument)
1543 // https://tc39.github.io/ecma262/#sec-tostring
1544 function ToString(argument) {
1545 return "" + argument;
1546 }
1547 // 7.1.14 ToPropertyKey(argument)
1548 // https://tc39.github.io/ecma262/#sec-topropertykey
1549 function ToPropertyKey(argument) {
1550 var key = ToPrimitive(argument, 3 /* String */);
1551 if (IsSymbol(key))
1552 return key;
1553 return ToString(key);
1554 }
1555 // 7.2 Testing and Comparison Operations
1556 // https://tc39.github.io/ecma262/#sec-testing-and-comparison-operations
1557 // 7.2.2 IsArray(argument)
1558 // https://tc39.github.io/ecma262/#sec-isarray
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 // 7.2.3 IsCallable(argument)
1567 // https://tc39.github.io/ecma262/#sec-iscallable
1568 function IsCallable(argument) {
1569 // NOTE: This is an approximation as we cannot check for [[Call]] internal method.
1570 return typeof argument === "function";
1571 }
1572 // 7.2.4 IsConstructor(argument)
1573 // https://tc39.github.io/ecma262/#sec-isconstructor
1574 function IsConstructor(argument) {
1575 // NOTE: This is an approximation as we cannot check for [[Construct]] internal method.
1576 return typeof argument === "function";
1577 }
1578 // 7.2.7 IsPropertyKey(argument)
1579 // https://tc39.github.io/ecma262/#sec-ispropertykey
1580 function IsPropertyKey(argument) {
1581 switch (Type(argument)) {
1582 case 3 /* String */: return true;
1583 case 4 /* Symbol */: return true;
1584 default: return false;
1585 }
1586 }
1587 // 7.3 Operations on Objects
1588 // https://tc39.github.io/ecma262/#sec-operations-on-objects
1589 // 7.3.9 GetMethod(V, P)
1590 // https://tc39.github.io/ecma262/#sec-getmethod
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 // 7.4 Operations on Iterator Objects
1600 // https://tc39.github.io/ecma262/#sec-operations-on-iterator-objects
1601 function GetIterator(obj) {
1602 var method = GetMethod(obj, iteratorSymbol);
1603 if (!IsCallable(method))
1604 throw new TypeError(); // from Call
1605 var iterator = method.call(obj);
1606 if (!IsObject(iterator))
1607 throw new TypeError();
1608 return iterator;
1609 }
1610 // 7.4.4 IteratorValue(iterResult)
1611 // https://tc39.github.io/ecma262/2016/#sec-iteratorvalue
1612 function IteratorValue(iterResult) {
1613 return iterResult.value;
1614 }
1615 // 7.4.5 IteratorStep(iterator)
1616 // https://tc39.github.io/ecma262/#sec-iteratorstep
1617 function IteratorStep(iterator) {
1618 var result = iterator.next();
1619 return result.done ? false : result;
1620 }
1621 // 7.4.6 IteratorClose(iterator, completion)
1622 // https://tc39.github.io/ecma262/#sec-iteratorclose
1623 function IteratorClose(iterator) {
1624 var f = iterator["return"];
1625 if (f)
1626 f.call(iterator);
1627 }
1628 // 9.1 Ordinary Object Internal Methods and Internal Slots
1629 // https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots
1630 // 9.1.1.1 OrdinaryGetPrototypeOf(O)
1631 // https://tc39.github.io/ecma262/#sec-ordinarygetprototypeof
1632 function OrdinaryGetPrototypeOf(O) {
1633 var proto = Object.getPrototypeOf(O);
1634 if (typeof O !== "function" || O === functionPrototype)
1635 return proto;
1636 // TypeScript doesn't set __proto__ in ES5, as it's non-standard.
1637 // Try to determine the superclass constructor. Compatible implementations
1638 // must either set __proto__ on a subclass constructor to the superclass constructor,
1639 // or ensure each class has a valid `constructor` property on its prototype that
1640 // points back to the constructor.
1641 // If this is not the same as Function.[[Prototype]], then this is definately inherited.
1642 // This is the case when in ES6 or when using __proto__ in a compatible browser.
1643 if (proto !== functionPrototype)
1644 return proto;
1645 // If the super prototype is Object.prototype, null, or undefined, then we cannot determine the heritage.
1646 var prototype = O.prototype;
1647 var prototypeProto = prototype && Object.getPrototypeOf(prototype);
1648 if (prototypeProto == null || prototypeProto === Object.prototype)
1649 return proto;
1650 // If the constructor was not a function, then we cannot determine the heritage.
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 = /** @class */ (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 /** @class */ (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, /*insert*/ false) >= 0; };
1720 Map.prototype.get = function (key) {
1721 var index = this._find(key, /*insert*/ false);
1722 return index >= 0 ? this._values[index] : undefined;
1723 };
1724 Map.prototype.set = function (key, value) {
1725 var index = this._find(key, /*insert*/ true);
1726 this._values[index] = value;
1727 return this;
1728 };
1729 Map.prototype.delete = function (key) {
1730 var index = this._find(key, /*insert*/ 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 // naive Set shim
1782 function CreateSetPolyfill() {
1783 return /** @class */ (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 // naive WeakMap shim
1805 function CreateWeakMapPolyfill() {
1806 var UUID_SIZE = 16;
1807 var keys = HashMap.create();
1808 var rootKey = CreateUniqueKey();
1809 return /** @class */ (function () {
1810 function WeakMap() {
1811 this._key = CreateUniqueKey();
1812 }
1813 WeakMap.prototype.has = function (target) {
1814 var table = GetOrCreateWeakMapTable(target, /*create*/ false);
1815 return table !== undefined ? HashMap.has(table, this._key) : false;
1816 };
1817 WeakMap.prototype.get = function (target) {
1818 var table = GetOrCreateWeakMapTable(target, /*create*/ false);
1819 return table !== undefined ? HashMap.get(table, this._key) : undefined;
1820 };
1821 WeakMap.prototype.set = function (target, value) {
1822 var table = GetOrCreateWeakMapTable(target, /*create*/ true);
1823 table[this._key] = value;
1824 return this;
1825 };
1826 WeakMap.prototype.delete = function (target) {
1827 var table = GetOrCreateWeakMapTable(target, /*create*/ false);
1828 return table !== undefined ? delete table[this._key] : false;
1829 };
1830 WeakMap.prototype.clear = function () {
1831 // NOTE: not a real clear, just makes the previous data unreachable
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 // mark as random - RFC 4122 § 4.4
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 // uses a heuristic used by v8 and chakra to force an object into dictionary mode.
1885 function MakeDictionary(obj) {
1886 obj.__ = undefined;
1887 delete obj.__;
1888 return obj;
1889 }
1890 });
1891})(Reflect || (Reflect = {}));
1892
1893/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../process/browser.js */ "./node_modules/process/browser.js"), __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
1894
1895/***/ }),
1896
1897/***/ "./node_modules/webpack/buildin/global.js":
1898/*!***********************************!*\
1899 !*** (webpack)/buildin/global.js ***!
1900 \***********************************/
1901/*! no static exports found */
1902/***/ (function(module, exports) {
1903
1904var g;
1905
1906// This works in non-strict mode
1907g = (function() {
1908 return this;
1909})();
1910
1911try {
1912 // This works if eval is allowed (see CSP)
1913 g = g || new Function("return this")();
1914} catch (e) {
1915 // This works if the window reference is available
1916 if (typeof window === "object") g = window;
1917}
1918
1919// g can still be undefined, but nothing to do about it...
1920// We return undefined, instead of nothing here, so it's
1921// easier to handle this case. if(!global) { ...}
1922
1923module.exports = g;
1924
1925
1926/***/ }),
1927
1928/***/ "./src/lib/commons/enums.ts":
1929/*!**********************************!*\
1930 !*** ./src/lib/commons/enums.ts ***!
1931 \**********************************/
1932/*! no static exports found */
1933/***/ (function(module, exports, __webpack_require__) {
1934
1935"use strict";
1936
1937Object.defineProperty(exports, "__esModule", { value: true });
1938var 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 = {}));
1947var 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 !*** ./src/lib/commons/index.ts ***!
1964 \**********************************/
1965/*! no static exports found */
1966/***/ (function(module, exports, __webpack_require__) {
1967
1968"use strict";
1969
1970function __export(m) {
1971 for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
1972}
1973Object.defineProperty(exports, "__esModule", { value: true });
1974__export(__webpack_require__(/*! ./enums */ "./src/lib/commons/enums.ts"));
1975__export(__webpack_require__(/*! ./prototyped */ "./src/lib/commons/prototyped.ts"));
1976__export(__webpack_require__(/*! ./method-descriptor */ "./src/lib/commons/method-descriptor.ts"));
1977__export(__webpack_require__(/*! ./methodus-class */ "./src/lib/commons/methodus-class.ts"));
1978__export(__webpack_require__(/*! ./params-map */ "./src/lib/commons/params-map.ts"));
1979
1980
1981/***/ }),
1982
1983/***/ "./src/lib/commons/method-descriptor.ts":
1984/*!**********************************************!*\
1985 !*** ./src/lib/commons/method-descriptor.ts ***!
1986 \**********************************************/
1987/*! no static exports found */
1988/***/ (function(module, exports, __webpack_require__) {
1989
1990"use strict";
1991
1992Object.defineProperty(exports, "__esModule", { value: true });
1993var MethodDescriptor = /** @class */ (function () {
1994 function MethodDescriptor() {
1995 }
1996 return MethodDescriptor;
1997}());
1998exports.MethodDescriptor = MethodDescriptor;
1999
2000
2001/***/ }),
2002
2003/***/ "./src/lib/commons/methodus-class.ts":
2004/*!*******************************************!*\
2005 !*** ./src/lib/commons/methodus-class.ts ***!
2006 \*******************************************/
2007/*! no static exports found */
2008/***/ (function(module, exports, __webpack_require__) {
2009
2010"use strict";
2011
2012Object.defineProperty(exports, "__esModule", { value: true });
2013var MethodusClass = /** @class */ (function () {
2014 function MethodusClass() {
2015 }
2016 return MethodusClass;
2017}());
2018exports.MethodusClass = MethodusClass;
2019
2020
2021/***/ }),
2022
2023/***/ "./src/lib/commons/params-map.ts":
2024/*!***************************************!*\
2025 !*** ./src/lib/commons/params-map.ts ***!
2026 \***************************************/
2027/*! no static exports found */
2028/***/ (function(module, exports, __webpack_require__) {
2029
2030"use strict";
2031
2032Object.defineProperty(exports, "__esModule", { value: true });
2033var ParamsMap = /** @class */ (function () {
2034 function ParamsMap() {
2035 }
2036 return ParamsMap;
2037}());
2038exports.ParamsMap = ParamsMap;
2039
2040
2041/***/ }),
2042
2043/***/ "./src/lib/commons/prototyped.ts":
2044/*!***************************************!*\
2045 !*** ./src/lib/commons/prototyped.ts ***!
2046 \***************************************/
2047/*! no static exports found */
2048/***/ (function(module, exports, __webpack_require__) {
2049
2050"use strict";
2051
2052Object.defineProperty(exports, "__esModule", { value: true });
2053var Prototyped = /** @class */ (function () {
2054 function Prototyped() {
2055 }
2056 return Prototyped;
2057}());
2058exports.Prototyped = Prototyped;
2059
2060
2061/***/ }),
2062
2063/***/ "./src/lib/decorators/index.ts":
2064/*!*************************************!*\
2065 !*** ./src/lib/decorators/index.ts ***!
2066 \*************************************/
2067/*! no static exports found */
2068/***/ (function(module, exports, __webpack_require__) {
2069
2070"use strict";
2071
2072function __export(m) {
2073 for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
2074}
2075Object.defineProperty(exports, "__esModule", { value: true });
2076__export(__webpack_require__(/*! ./method-config-base */ "./src/lib/decorators/method-config-base.ts"));
2077__export(__webpack_require__(/*! ./method-config-extend */ "./src/lib/decorators/method-config-extend.ts"));
2078__export(__webpack_require__(/*! ./method-config */ "./src/lib/decorators/method-config.ts"));
2079__export(__webpack_require__(/*! ./params */ "./src/lib/decorators/params.ts"));
2080__export(__webpack_require__(/*! ./method */ "./src/lib/decorators/method.ts"));
2081
2082
2083/***/ }),
2084
2085/***/ "./src/lib/decorators/method-config-base.ts":
2086/*!**************************************************!*\
2087 !*** ./src/lib/decorators/method-config-base.ts ***!
2088 \**************************************************/
2089/*! no static exports found */
2090/***/ (function(module, exports, __webpack_require__) {
2091
2092"use strict";
2093
2094Object.defineProperty(exports, "__esModule", { value: true });
2095var di_1 = __webpack_require__(/*! ../di */ "./src/lib/di/index.ts");
2096/** the MethodConfig decorator registers the controller as a router
2097 * @param {string} name - the identifier of the controller in the resolver.
2098 * @param {Function[]} middlewares - an array of middlewares to apply to this controller}
2099 */
2100function MethodConfigBase(name) {
2101 return function (target) {
2102 // //use the injectable logic here
2103 di_1.Injector.inject(target, name);
2104 };
2105}
2106exports.MethodConfigBase = MethodConfigBase;
2107
2108
2109/***/ }),
2110
2111/***/ "./src/lib/decorators/method-config-extend.ts":
2112/*!****************************************************!*\
2113 !*** ./src/lib/decorators/method-config-extend.ts ***!
2114 \****************************************************/
2115/*! no static exports found */
2116/***/ (function(module, exports, __webpack_require__) {
2117
2118"use strict";
2119
2120var __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};
2129var __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};
2156Object.defineProperty(exports, "__esModule", { value: true });
2157/** the MethodConfig decorator registers the controller as a router
2158 * @param {string} name - the identifier of the controller in the resolver.
2159 * @param {Function[]} middlewares - an array of middlewares to apply to this controller}
2160 */
2161function 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 /*yield*/, extendTarget.prototype.constructor[key].apply(target, args)];
2181 case 1: return [2 /*return*/, _a.sent()];
2182 }
2183 });
2184 });
2185 };
2186 inheritSettings[key] = func.bind(target);
2187 }
2188 });
2189 Object.assign(target.prototype.constructor, inheritSettings);
2190 };
2191}
2192exports.MethodConfigExtend = MethodConfigExtend;
2193
2194
2195/***/ }),
2196
2197/***/ "./src/lib/decorators/method-config.ts":
2198/*!*********************************************!*\
2199 !*** ./src/lib/decorators/method-config.ts ***!
2200 \*********************************************/
2201/*! no static exports found */
2202/***/ (function(module, exports, __webpack_require__) {
2203
2204"use strict";
2205
2206Object.defineProperty(exports, "__esModule", { value: true });
2207var di_1 = __webpack_require__(/*! ../di */ "./src/lib/di/index.ts");
2208/** the MethodConfig decorator registers the controller as a router
2209 * @param {string} name - the identifier of the controller in the resolver.
2210 * @param {Function[]} middlewares - an array of middlewares to apply to this controller}
2211 */
2212function MethodConfig(name, middlewares, baseRoute) {
2213 return function (target) {
2214 //use the injectable logic here
2215 di_1.Injector.inject(target, name);
2216 var proto = target.prototype || target.__proto__;
2217 if (target.methodus) { // means its a static class , no prototype
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}
2230exports.MethodConfig = MethodConfig;
2231
2232
2233/***/ }),
2234
2235/***/ "./src/lib/decorators/method.ts":
2236/*!**************************************!*\
2237 !*** ./src/lib/decorators/method.ts ***!
2238 \**************************************/
2239/*! no static exports found */
2240/***/ (function(module, exports, __webpack_require__) {
2241
2242"use strict";
2243
2244var __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};
2253var __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};
2280Object.defineProperty(exports, "__esModule", { value: true });
2281var commons_1 = __webpack_require__(/*! ../commons/ */ "./src/lib/commons/index.ts");
2282var rest_1 = __webpack_require__(/*! ../transports/rest */ "./src/lib/transports/rest.ts");
2283var socket_1 = __webpack_require__(/*! ../transports/socket */ "./src/lib/transports/socket.ts");
2284/** the @Method decorator registers the model with the odm
2285 * @param {Verbs} verb - the HTTP verb for the route.
2286 * @param {string} route - express route string.
2287 * @param {Function[]} middlewares - an array of middlewares to apply to this function}
2288 */
2289function 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; // as MethodDescriptor;
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 // merge the configuration object
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 /*break*/, 1];
2352 case commons_1.MethodType.Local: return [3 /*break*/, 1];
2353 case commons_1.MethodType.Socket: return [3 /*break*/, 3];
2354 case commons_1.MethodType.Http: return [3 /*break*/, 5];
2355 }
2356 return [3 /*break*/, 7];
2357 case 1: return [4 /*yield*/, originalMethod.apply(target, args)];
2358 case 2: return [2 /*return*/, _b.sent()];
2359 case 3:
2360 socket = new socket_1.Socket();
2361 messageName = completeConfiguration.verb + "_" + completeConfiguration.route;
2362 return [4 /*yield*/, socket.send(messageName, args)];
2363 case 4:
2364 _b.sent();
2365 return [2 /*return*/, socket];
2366 case 5:
2367 finalRoute = completeConfiguration.route;
2368 //include base routes
2369 if (methodus.baseRoute) {
2370 finalRoute = methodus.baseRoute + finalRoute;
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 /*yield*/, request.send()];
2380 case 6:
2381 result = _b.sent();
2382 return [2 /*return*/, result];
2383 case 7: return [2 /*return*/];
2384 }
2385 });
2386 });
2387 };
2388 return descriptor;
2389 };
2390}
2391exports.Method = Method;
2392
2393
2394/***/ }),
2395
2396/***/ "./src/lib/decorators/params.ts":
2397/*!**************************************!*\
2398 !*** ./src/lib/decorators/params.ts ***!
2399 \**************************************/
2400/*! no static exports found */
2401/***/ (function(module, exports, __webpack_require__) {
2402
2403"use strict";
2404
2405Object.defineProperty(exports, "__esModule", { value: true });
2406function pushParams(target, propertyKey, param) {
2407 // const methodus = fp.maybeMethodus(target);
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}
2415function 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}
2428var P = /** @class */ (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}());
2451exports.P = P;
2452
2453
2454/***/ }),
2455
2456/***/ "./src/lib/di/index.ts":
2457/*!*****************************!*\
2458 !*** ./src/lib/di/index.ts ***!
2459 \*****************************/
2460/*! no static exports found */
2461/***/ (function(module, exports, __webpack_require__) {
2462
2463"use strict";
2464
2465function __export(m) {
2466 for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
2467}
2468Object.defineProperty(exports, "__esModule", { value: true });
2469__export(__webpack_require__(/*! ./injectable */ "./src/lib/di/injectable.ts"));
2470__export(__webpack_require__(/*! ./injector */ "./src/lib/di/injector.ts"));
2471__export(__webpack_require__(/*! ./inject */ "./src/lib/di/inject.ts"));
2472__export(__webpack_require__(/*! ./singleton */ "./src/lib/di/singleton.ts"));
2473
2474
2475/***/ }),
2476
2477/***/ "./src/lib/di/inject.ts":
2478/*!******************************!*\
2479 !*** ./src/lib/di/inject.ts ***!
2480 \******************************/
2481/*! no static exports found */
2482/***/ (function(module, exports, __webpack_require__) {
2483
2484"use strict";
2485
2486Object.defineProperty(exports, "__esModule", { value: true });
2487__webpack_require__(/*! reflect-metadata */ "./node_modules/reflect-metadata/Reflect.js");
2488var injector_1 = __webpack_require__(/*! ./injector */ "./src/lib/di/injector.ts");
2489function 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}
2496exports.Inject = Inject;
2497function getConstructorArgumentsNames(constructor, index) {
2498 var functionString = constructor.toString();
2499 var params = GetArgumentNames(functionString);
2500 return params[index];
2501}
2502var RegExInsideParentheses = /[(][^)]*[)]/;
2503var RegExParenthesesAndSpaces = /[()\s]/g;
2504var 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 !*** ./src/lib/di/injectable.ts ***!
2514 \**********************************/
2515/*! no static exports found */
2516/***/ (function(module, exports, __webpack_require__) {
2517
2518"use strict";
2519
2520Object.defineProperty(exports, "__esModule", { value: true });
2521__webpack_require__(/*! reflect-metadata */ "./node_modules/reflect-metadata/Reflect.js");
2522var injector_1 = __webpack_require__(/*! ./injector */ "./src/lib/di/injector.ts");
2523var ANNOTATIONS = '__annotations__';
2524function Injectable(nameToken) {
2525 function DecoratorFactory(cls) {
2526 //use the injectable logic here
2527 injector_1.Injector.inject(cls, name);
2528 return cls;
2529 }
2530 return DecoratorFactory;
2531}
2532exports.Injectable = Injectable;
2533
2534
2535/***/ }),
2536
2537/***/ "./src/lib/di/injector.ts":
2538/*!********************************!*\
2539 !*** ./src/lib/di/injector.ts ***!
2540 \********************************/
2541/*! no static exports found */
2542/***/ (function(module, exports, __webpack_require__) {
2543
2544"use strict";
2545
2546var __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};
2553Object.defineProperty(exports, "__esModule", { value: true });
2554__webpack_require__(/*! reflect-metadata */ "./node_modules/reflect-metadata/Reflect.js");
2555var ANNOTATIONS = '__annotations__';
2556var Injector = /** @class */ (function () {
2557 function Injector() {
2558 }
2559 Injector.inject = function (target, name) {
2560 //use the injectable logic here
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 // const annotations = token.hasOwnProperty(ANNOTATIONS);
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 //some times the token is a string so
2597 var symbol = _token;
2598 if (typeof _token !== 'string') {
2599 symbol = _token.name;
2600 }
2601 // get the `token` from the record set
2602 var all = Injector.records.filter(function (record) {
2603 return record.name === symbol;
2604 });
2605 if (!all || all.length === 0) {
2606 return null;
2607 // throw new Error(`Injection token not found ${symbol},
2608 // did you forgot to decorate it with the @Injectible decorator? `)
2609 }
2610 var record = all[0];
2611 // resolve dependencies into instances
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}());
2635exports.Injector = Injector;
2636
2637
2638/***/ }),
2639
2640/***/ "./src/lib/di/singleton.ts":
2641/*!*********************************!*\
2642 !*** ./src/lib/di/singleton.ts ***!
2643 \*********************************/
2644/*! no static exports found */
2645/***/ (function(module, exports, __webpack_require__) {
2646
2647"use strict";
2648
2649Object.defineProperty(exports, "__esModule", { value: true });
2650__webpack_require__(/*! reflect-metadata */ "./node_modules/reflect-metadata/Reflect.js");
2651var ANNOTATIONS = '__annotations__';
2652function 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}
2662exports.Singleton = Singleton;
2663
2664
2665/***/ }),
2666
2667/***/ "./src/lib/index.ts":
2668/*!**************************!*\
2669 !*** ./src/lib/index.ts ***!
2670 \**************************/
2671/*! no static exports found */
2672/***/ (function(module, exports, __webpack_require__) {
2673
2674"use strict";
2675
2676function __export(m) {
2677 for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
2678}
2679Object.defineProperty(exports, "__esModule", { value: true });
2680__export(__webpack_require__(/*! ./decorators */ "./src/lib/decorators/index.ts"));
2681__export(__webpack_require__(/*! ./response */ "./src/lib/response/index.ts"));
2682__export(__webpack_require__(/*! ./transports */ "./src/lib/transports/index.ts"));
2683__export(__webpack_require__(/*! ./commons */ "./src/lib/commons/index.ts"));
2684__export(__webpack_require__(/*! ./di */ "./src/lib/di/index.ts"));
2685
2686
2687/***/ }),
2688
2689/***/ "./src/lib/response/index.ts":
2690/*!***********************************!*\
2691 !*** ./src/lib/response/index.ts ***!
2692 \***********************************/
2693/*! no static exports found */
2694/***/ (function(module, exports, __webpack_require__) {
2695
2696"use strict";
2697
2698function __export(m) {
2699 for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
2700}
2701Object.defineProperty(exports, "__esModule", { value: true });
2702__export(__webpack_require__(/*! ./methodError */ "./src/lib/response/methodError.ts"));
2703__export(__webpack_require__(/*! ./methodResult */ "./src/lib/response/methodResult.ts"));
2704
2705
2706/***/ }),
2707
2708/***/ "./src/lib/response/methodError.ts":
2709/*!*****************************************!*\
2710 !*** ./src/lib/response/methodError.ts ***!
2711 \*****************************************/
2712/*! no static exports found */
2713/***/ (function(module, exports, __webpack_require__) {
2714
2715"use strict";
2716
2717var __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})();
2730Object.defineProperty(exports, "__esModule", { value: true });
2731var MethodError = /** @class */ (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));
2746exports.MethodError = MethodError;
2747
2748
2749/***/ }),
2750
2751/***/ "./src/lib/response/methodResult.ts":
2752/*!******************************************!*\
2753 !*** ./src/lib/response/methodResult.ts ***!
2754 \******************************************/
2755/*! no static exports found */
2756/***/ (function(module, exports, __webpack_require__) {
2757
2758"use strict";
2759
2760Object.defineProperty(exports, "__esModule", { value: true });
2761var MethodResult = /** @class */ (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}());
2776exports.MethodResult = MethodResult;
2777
2778
2779/***/ }),
2780
2781/***/ "./src/lib/transports/index.ts":
2782/*!*************************************!*\
2783 !*** ./src/lib/transports/index.ts ***!
2784 \*************************************/
2785/*! no static exports found */
2786/***/ (function(module, exports, __webpack_require__) {
2787
2788"use strict";
2789
2790function __export(m) {
2791 for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
2792}
2793Object.defineProperty(exports, "__esModule", { value: true });
2794__export(__webpack_require__(/*! ./rest */ "./src/lib/transports/rest.ts"));
2795
2796
2797/***/ }),
2798
2799/***/ "./src/lib/transports/rest.ts":
2800/*!************************************!*\
2801 !*** ./src/lib/transports/rest.ts ***!
2802 \************************************/
2803/*! no static exports found */
2804/***/ (function(module, exports, __webpack_require__) {
2805
2806"use strict";
2807
2808var __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};
2817var __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};
2844Object.defineProperty(exports, "__esModule", { value: true });
2845var methodError_1 = __webpack_require__(/*! ../response/methodError */ "./src/lib/response/methodError.ts");
2846var Rest = /** @class */ (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 // create a new multipart-form for every file
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 /*yield*/, fetch(this.request, this.options)];
2957 case 1:
2958 response = _b.sent();
2959 if (!response.ok) return [3 /*break*/, 2];
2960 return [2 /*return*/, response.json()];
2961 case 2:
2962 errorText = response.statusText;
2963 if (!response.body) return [3 /*break*/, 6];
2964 _b.label = 3;
2965 case 3:
2966 _b.trys.push([3, 5, , 6]);
2967 return [4 /*yield*/, response.json()];
2968 case 4:
2969 errorText = (_b.sent()).error;
2970 return [3 /*break*/, 6];
2971 case 5:
2972 _a = _b.sent();
2973 return [3 /*break*/, 6];
2974 case 6: throw (new methodError_1.MethodError(errorText, response.status));
2975 }
2976 });
2977 });
2978 };
2979 return Rest;
2980}());
2981exports.Rest = Rest;
2982
2983
2984/***/ }),
2985
2986/***/ "./src/lib/transports/socket.ts":
2987/*!**************************************!*\
2988 !*** ./src/lib/transports/socket.ts ***!
2989 \**************************************/
2990/*! no static exports found */
2991/***/ (function(module, exports, __webpack_require__) {
2992
2993"use strict";
2994
2995var __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};
3004var __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};
3031Object.defineProperty(exports, "__esModule", { value: true });
3032var events_1 = __webpack_require__(/*! events */ "./node_modules/events/events.js");
3033var socket = null;
3034var Socket = /** @class */ (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 /*return*/, 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 /*return*/];
3069 });
3070 });
3071 };
3072 return Socket;
3073}());
3074exports.Socket = Socket;
3075
3076
3077/***/ }),
3078
3079/***/ 0:
3080/*!********************************!*\
3081 !*** multi ./src/lib/index.ts ***!
3082 \********************************/
3083/*! no static exports found */
3084/***/ (function(module, exports, __webpack_require__) {
3085
3086module.exports = __webpack_require__(/*! ./src/lib/index.ts */"./src/lib/index.ts");
3087
3088
3089/***/ })
3090
3091/******/ });
3092});
3093//# sourceMappingURL=methodus-client.js.map
\No newline at end of file