@feathersjs/client 4.5.8 → 4.5.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/core.js CHANGED
@@ -8,118 +8,40 @@
8
8
  else
9
9
  root["feathers"] = factory();
10
10
  })(this, function() {
11
- return /******/ (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 = "./src/core.js");
95
- /******/ })
96
- /************************************************************************/
97
- /******/ ({
11
+ return /******/ (function() { // webpackBootstrap
12
+ /******/ var __webpack_modules__ = ({
98
13
 
99
14
  /***/ "../../node_modules/debug/src/browser.js":
100
- /*!**************************************************************************************!*\
101
- !*** /Users/daffl/Development/feathersjs/feathers/node_modules/debug/src/browser.js ***!
102
- \**************************************************************************************/
103
- /*! no static exports found */
15
+ /*!***********************************************!*\
16
+ !*** ../../node_modules/debug/src/browser.js ***!
17
+ \***********************************************/
104
18
  /***/ (function(module, exports, __webpack_require__) {
105
19
 
106
- /* WEBPACK VAR INJECTION */(function(process) {function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
107
-
108
20
  /* eslint-env browser */
109
21
 
110
22
  /**
111
23
  * This is the web browser implementation of `debug()`.
112
24
  */
113
- exports.log = log;
114
25
  exports.formatArgs = formatArgs;
115
26
  exports.save = save;
116
27
  exports.load = load;
117
28
  exports.useColors = useColors;
118
29
  exports.storage = localstorage();
30
+
31
+ exports.destroy = function () {
32
+ var warned = false;
33
+ return function () {
34
+ if (!warned) {
35
+ warned = true;
36
+ console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
37
+ }
38
+ };
39
+ }();
119
40
  /**
120
41
  * Colors.
121
42
  */
122
43
 
44
+
123
45
  exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'];
124
46
  /**
125
47
  * Currently only WebKit-based Web Inspectors, Firefox >= v31,
@@ -188,20 +110,16 @@ function formatArgs(args) {
188
110
  args.splice(lastC, 0, c);
189
111
  }
190
112
  /**
191
- * Invokes `console.log()` when available.
192
- * No-op when `console.log` is not a "function".
113
+ * Invokes `console.debug()` when available.
114
+ * No-op when `console.debug` is not a "function".
115
+ * If `console.debug` is not available, falls back
116
+ * to `console.log`.
193
117
  *
194
118
  * @api public
195
119
  */
196
120
 
197
121
 
198
- function log() {
199
- var _console;
200
-
201
- // This hackery is required for IE8/9, where
202
- // the `console.log` function doesn't have 'apply'
203
- return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments);
204
- }
122
+ exports.log = console.debug || console.log || function () {};
205
123
  /**
206
124
  * Save `namespaces`.
207
125
  *
@@ -280,16 +198,14 @@ formatters.j = function (v) {
280
198
  return '[UnexpectedJSONParseError]: ' + error.message;
281
199
  }
282
200
  };
283
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ "../../node_modules/process/browser.js")))
284
201
 
285
202
  /***/ }),
286
203
 
287
204
  /***/ "../../node_modules/debug/src/common.js":
288
- /*!*************************************************************************************!*\
289
- !*** /Users/daffl/Development/feathersjs/feathers/node_modules/debug/src/common.js ***!
290
- \*************************************************************************************/
291
- /*! no static exports found */
292
- /***/ (function(module, exports, __webpack_require__) {
205
+ /*!**********************************************!*\
206
+ !*** ../../node_modules/debug/src/common.js ***!
207
+ \**********************************************/
208
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
293
209
 
294
210
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
295
211
 
@@ -297,7 +213,7 @@ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread n
297
213
 
298
214
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
299
215
 
300
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
216
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
301
217
 
302
218
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
303
219
 
@@ -315,15 +231,11 @@ function setup(env) {
315
231
  createDebug.enable = enable;
316
232
  createDebug.enabled = enabled;
317
233
  createDebug.humanize = __webpack_require__(/*! ms */ "../../node_modules/ms/index.js");
234
+ createDebug.destroy = destroy;
318
235
  Object.keys(env).forEach(function (key) {
319
236
  createDebug[key] = env[key];
320
237
  });
321
238
  /**
322
- * Active `debug` instances.
323
- */
324
-
325
- createDebug.instances = [];
326
- /**
327
239
  * The currently active debug mode names, and names to skip.
328
240
  */
329
241
 
@@ -338,7 +250,7 @@ function setup(env) {
338
250
  createDebug.formatters = {};
339
251
  /**
340
252
  * Selects a color for a debug namespace
341
- * @param {String} namespace The namespace string for the for the debug instance to be colored
253
+ * @param {String} namespace The namespace string for the debug instance to be colored
342
254
  * @return {Number|String} An ANSI color code for the given namespace
343
255
  * @api private
344
256
  */
@@ -365,6 +277,9 @@ function setup(env) {
365
277
 
366
278
  function createDebug(namespace) {
367
279
  var prevTime;
280
+ var enableOverride = null;
281
+ var namespacesCache;
282
+ var enabledCache;
368
283
 
369
284
  function debug() {
370
285
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
@@ -396,7 +311,7 @@ function setup(env) {
396
311
  args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
397
312
  // If we encounter an escaped % then don't increase the array index
398
313
  if (match === '%%') {
399
- return match;
314
+ return '%';
400
315
  }
401
316
 
402
317
  index++;
@@ -419,33 +334,38 @@ function setup(env) {
419
334
  }
420
335
 
421
336
  debug.namespace = namespace;
422
- debug.enabled = createDebug.enabled(namespace);
423
337
  debug.useColors = createDebug.useColors();
424
- debug.color = selectColor(namespace);
425
- debug.destroy = destroy;
426
- debug.extend = extend; // Debug.formatArgs = formatArgs;
427
- // debug.rawLog = rawLog;
428
- // env-specific initialization logic for debug instances
338
+ debug.color = createDebug.selectColor(namespace);
339
+ debug.extend = extend;
340
+ debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
341
+
342
+ Object.defineProperty(debug, 'enabled', {
343
+ enumerable: true,
344
+ configurable: false,
345
+ get: function get() {
346
+ if (enableOverride !== null) {
347
+ return enableOverride;
348
+ }
349
+
350
+ if (namespacesCache !== createDebug.namespaces) {
351
+ namespacesCache = createDebug.namespaces;
352
+ enabledCache = createDebug.enabled(namespace);
353
+ }
354
+
355
+ return enabledCache;
356
+ },
357
+ set: function set(v) {
358
+ enableOverride = v;
359
+ }
360
+ }); // Env-specific initialization logic for debug instances
429
361
 
430
362
  if (typeof createDebug.init === 'function') {
431
363
  createDebug.init(debug);
432
364
  }
433
365
 
434
- createDebug.instances.push(debug);
435
366
  return debug;
436
367
  }
437
368
 
438
- function destroy() {
439
- var index = createDebug.instances.indexOf(this);
440
-
441
- if (index !== -1) {
442
- createDebug.instances.splice(index, 1);
443
- return true;
444
- }
445
-
446
- return false;
447
- }
448
-
449
369
  function extend(namespace, delimiter) {
450
370
  var newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
451
371
  newDebug.log = this.log;
@@ -462,6 +382,7 @@ function setup(env) {
462
382
 
463
383
  function enable(namespaces) {
464
384
  createDebug.save(namespaces);
385
+ createDebug.namespaces = namespaces;
465
386
  createDebug.names = [];
466
387
  createDebug.skips = [];
467
388
  var i;
@@ -482,11 +403,6 @@ function setup(env) {
482
403
  createDebug.names.push(new RegExp('^' + namespaces + '$'));
483
404
  }
484
405
  }
485
-
486
- for (i = 0; i < createDebug.instances.length; i++) {
487
- var instance = createDebug.instances[i];
488
- instance.enabled = createDebug.enabled(instance.namespace);
489
- }
490
406
  }
491
407
  /**
492
408
  * Disable debug output.
@@ -562,6 +478,15 @@ function setup(env) {
562
478
 
563
479
  return val;
564
480
  }
481
+ /**
482
+ * XXX DO NOT USE. This is a temporary stub function.
483
+ * XXX It WILL be removed in the next major release.
484
+ */
485
+
486
+
487
+ function destroy() {
488
+ console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
489
+ }
565
490
 
566
491
  createDebug.enable(createDebug.load());
567
492
  return createDebug;
@@ -571,2040 +496,1887 @@ module.exports = setup;
571
496
 
572
497
  /***/ }),
573
498
 
574
- /***/ "../../node_modules/events/events.js":
575
- /*!**********************************************************************************!*\
576
- !*** /Users/daffl/Development/feathersjs/feathers/node_modules/events/events.js ***!
577
- \**********************************************************************************/
578
- /*! no static exports found */
579
- /***/ (function(module, exports, __webpack_require__) {
499
+ /***/ "./src/core.js":
500
+ /*!*********************!*\
501
+ !*** ./src/core.js ***!
502
+ \*********************/
503
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
580
504
 
581
- "use strict";
582
- // Copyright Joyent, Inc. and other Node contributors.
583
- //
584
- // Permission is hereby granted, free of charge, to any person obtaining a
585
- // copy of this software and associated documentation files (the
586
- // "Software"), to deal in the Software without restriction, including
587
- // without limitation the rights to use, copy, modify, merge, publish,
588
- // distribute, sublicense, and/or sell copies of the Software, and to permit
589
- // persons to whom the Software is furnished to do so, subject to the
590
- // following conditions:
591
- //
592
- // The above copyright notice and this permission notice shall be included
593
- // in all copies or substantial portions of the Software.
594
- //
595
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
596
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
597
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
598
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
599
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
600
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
601
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
505
+ module.exports = __webpack_require__(/*! @feathersjs/feathers */ "../feathers/lib/index.js");
602
506
 
507
+ /***/ }),
603
508
 
509
+ /***/ "../commons/lib/hooks.js":
510
+ /*!*******************************!*\
511
+ !*** ../commons/lib/hooks.js ***!
512
+ \*******************************/
513
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
604
514
 
605
- var R = typeof Reflect === 'object' ? Reflect : null
606
- var ReflectApply = R && typeof R.apply === 'function'
607
- ? R.apply
608
- : function ReflectApply(target, receiver, args) {
609
- return Function.prototype.apply.call(target, receiver, args);
610
- }
515
+ "use strict";
611
516
 
612
- var ReflectOwnKeys
613
- if (R && typeof R.ownKeys === 'function') {
614
- ReflectOwnKeys = R.ownKeys
615
- } else if (Object.getOwnPropertySymbols) {
616
- ReflectOwnKeys = function ReflectOwnKeys(target) {
617
- return Object.getOwnPropertyNames(target)
618
- .concat(Object.getOwnPropertySymbols(target));
619
- };
620
- } else {
621
- ReflectOwnKeys = function ReflectOwnKeys(target) {
622
- return Object.getOwnPropertyNames(target);
623
- };
624
- }
625
517
 
626
- function ProcessEmitWarning(warning) {
627
- if (console && console.warn) console.warn(warning);
628
- }
518
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
629
519
 
630
- var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {
631
- return value !== value;
632
- }
520
+ Object.defineProperty(exports, "__esModule", ({
521
+ value: true
522
+ }));
523
+ exports.enableHooks = exports.processHooks = exports.getHooks = exports.isHookObject = exports.convertHookData = exports.makeArguments = exports.defaultMakeArguments = exports.createHookObject = exports.ACTIVATE_HOOKS = void 0;
633
524
 
634
- function EventEmitter() {
635
- EventEmitter.init.call(this);
636
- }
637
- module.exports = EventEmitter;
638
- module.exports.once = once;
525
+ var utils_1 = __webpack_require__(/*! ./utils */ "../commons/lib/utils.js");
639
526
 
640
- // Backwards-compat with node 0.10.x
641
- EventEmitter.EventEmitter = EventEmitter;
527
+ var _utils_1$_ = utils_1._,
528
+ each = _utils_1$_.each,
529
+ pick = _utils_1$_.pick;
530
+ exports.ACTIVATE_HOOKS = (0, utils_1.createSymbol)('__feathersActivateHooks');
642
531
 
643
- EventEmitter.prototype._events = undefined;
644
- EventEmitter.prototype._eventsCount = 0;
645
- EventEmitter.prototype._maxListeners = undefined;
532
+ function createHookObject(method) {
533
+ var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
534
+ var hook = {};
535
+ Object.defineProperty(hook, 'toJSON', {
536
+ value: function value() {
537
+ return pick(this, 'type', 'method', 'path', 'params', 'id', 'data', 'result', 'error');
538
+ }
539
+ });
540
+ return Object.assign(hook, data, {
541
+ method: method,
646
542
 
647
- // By default EventEmitters will print a warning if more than 10 listeners are
648
- // added to it. This is a useful default which helps finding memory leaks.
649
- var defaultMaxListeners = 10;
543
+ // A dynamic getter that returns the path of the service
544
+ get path() {
545
+ var app = data.app,
546
+ service = data.service;
650
547
 
651
- function checkListener(listener) {
652
- if (typeof listener !== 'function') {
653
- throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
654
- }
655
- }
548
+ if (!service || !app || !app.services) {
549
+ return null;
550
+ }
656
551
 
657
- Object.defineProperty(EventEmitter, 'defaultMaxListeners', {
658
- enumerable: true,
659
- get: function() {
660
- return defaultMaxListeners;
661
- },
662
- set: function(arg) {
663
- if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {
664
- throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.');
552
+ return Object.keys(app.services).find(function (path) {
553
+ return app.services[path] === service;
554
+ });
665
555
  }
666
- defaultMaxListeners = arg;
667
- }
668
- });
669
556
 
670
- EventEmitter.init = function() {
557
+ });
558
+ }
671
559
 
672
- if (this._events === undefined ||
673
- this._events === Object.getPrototypeOf(this)._events) {
674
- this._events = Object.create(null);
675
- this._eventsCount = 0;
676
- }
560
+ exports.createHookObject = createHookObject; // Fallback used by `makeArguments` which usually won't be used
677
561
 
678
- this._maxListeners = this._maxListeners || undefined;
679
- };
562
+ function defaultMakeArguments(hook) {
563
+ var result = [];
680
564
 
681
- // Obviously not all Emitters should be limited to 10. This function allows
682
- // that to be increased. Set to zero for unlimited.
683
- EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
684
- if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {
685
- throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.');
565
+ if (typeof hook.id !== 'undefined') {
566
+ result.push(hook.id);
686
567
  }
687
- this._maxListeners = n;
688
- return this;
689
- };
690
568
 
691
- function _getMaxListeners(that) {
692
- if (that._maxListeners === undefined)
693
- return EventEmitter.defaultMaxListeners;
694
- return that._maxListeners;
569
+ if (hook.data) {
570
+ result.push(hook.data);
571
+ }
572
+
573
+ result.push(hook.params || {});
574
+ return result;
695
575
  }
696
576
 
697
- EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
698
- return _getMaxListeners(this);
699
- };
577
+ exports.defaultMakeArguments = defaultMakeArguments; // Turns a hook object back into a list of arguments
578
+ // to call a service method with
700
579
 
701
- EventEmitter.prototype.emit = function emit(type) {
702
- var args = [];
703
- for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);
704
- var doError = (type === 'error');
580
+ function makeArguments(hook) {
581
+ switch (hook.method) {
582
+ case 'find':
583
+ return [hook.params];
705
584
 
706
- var events = this._events;
707
- if (events !== undefined)
708
- doError = (doError && events.error === undefined);
709
- else if (!doError)
710
- return false;
585
+ case 'get':
586
+ case 'remove':
587
+ return [hook.id, hook.params];
711
588
 
712
- // If there is no 'error' event listener then throw.
713
- if (doError) {
714
- var er;
715
- if (args.length > 0)
716
- er = args[0];
717
- if (er instanceof Error) {
718
- // Note: The comments on the `throw` lines are intentional, they show
719
- // up in Node's output if this results in an unhandled exception.
720
- throw er; // Unhandled 'error' event
721
- }
722
- // At least give some kind of context to the user
723
- var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));
724
- err.context = er;
725
- throw err; // Unhandled 'error' event
589
+ case 'update':
590
+ case 'patch':
591
+ return [hook.id, hook.data, hook.params];
592
+
593
+ case 'create':
594
+ return [hook.data, hook.params];
726
595
  }
727
596
 
728
- var handler = events[type];
597
+ return defaultMakeArguments(hook);
598
+ }
729
599
 
730
- if (handler === undefined)
731
- return false;
600
+ exports.makeArguments = makeArguments; // Converts different hook registration formats into the
601
+ // same internal format
732
602
 
733
- if (typeof handler === 'function') {
734
- ReflectApply(handler, this, args);
735
- } else {
736
- var len = handler.length;
737
- var listeners = arrayClone(handler, len);
738
- for (var i = 0; i < len; ++i)
739
- ReflectApply(listeners[i], this, args);
740
- }
603
+ function convertHookData(obj) {
604
+ var hook = {};
741
605
 
742
- return true;
743
- };
606
+ if (Array.isArray(obj)) {
607
+ hook = {
608
+ all: obj
609
+ };
610
+ } else if (_typeof(obj) !== 'object') {
611
+ hook = {
612
+ all: [obj]
613
+ };
614
+ } else {
615
+ each(obj, function (value, key) {
616
+ hook[key] = !Array.isArray(value) ? [value] : value;
617
+ });
618
+ }
744
619
 
745
- function _addListener(target, type, listener, prepend) {
746
- var m;
747
- var events;
748
- var existing;
620
+ return hook;
621
+ }
749
622
 
750
- checkListener(listener);
623
+ exports.convertHookData = convertHookData; // Duck-checks a given object to be a hook object
624
+ // A valid hook object has `type` and `method`
751
625
 
752
- events = target._events;
753
- if (events === undefined) {
754
- events = target._events = Object.create(null);
755
- target._eventsCount = 0;
756
- } else {
757
- // To avoid recursion in the case that type === "newListener"! Before
758
- // adding it to the listeners, first emit "newListener".
759
- if (events.newListener !== undefined) {
760
- target.emit('newListener', type,
761
- listener.listener ? listener.listener : listener);
626
+ function isHookObject(hookObject) {
627
+ return _typeof(hookObject) === 'object' && typeof hookObject.method === 'string' && typeof hookObject.type === 'string';
628
+ }
762
629
 
763
- // Re-assign `events` because a newListener handler could have caused the
764
- // this._events to be assigned to a new object
765
- events = target._events;
766
- }
767
- existing = events[type];
768
- }
630
+ exports.isHookObject = isHookObject; // Returns all service and application hooks combined
631
+ // for a given method and type `appLast` sets if the hooks
632
+ // from `app` should be added last (or first by default)
769
633
 
770
- if (existing === undefined) {
771
- // Optimize the case of one listener. Don't need the extra array object.
772
- existing = events[type] = listener;
773
- ++target._eventsCount;
774
- } else {
775
- if (typeof existing === 'function') {
776
- // Adding the second element, need to change to array.
777
- existing = events[type] =
778
- prepend ? [listener, existing] : [existing, listener];
779
- // If we've already got an array, just append.
780
- } else if (prepend) {
781
- existing.unshift(listener);
782
- } else {
783
- existing.push(listener);
784
- }
634
+ function getHooks(app, service, type, method) {
635
+ var appLast = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
636
+ var appHooks = app.__hooks[type][method] || [];
637
+ var serviceHooks = service.__hooks[type][method] || [];
785
638
 
786
- // Check for listener leak
787
- m = _getMaxListeners(target);
788
- if (m > 0 && existing.length > m && !existing.warned) {
789
- existing.warned = true;
790
- // No error code for this since it is a Warning
791
- // eslint-disable-next-line no-restricted-syntax
792
- var w = new Error('Possible EventEmitter memory leak detected. ' +
793
- existing.length + ' ' + String(type) + ' listeners ' +
794
- 'added. Use emitter.setMaxListeners() to ' +
795
- 'increase limit');
796
- w.name = 'MaxListenersExceededWarning';
797
- w.emitter = target;
798
- w.type = type;
799
- w.count = existing.length;
800
- ProcessEmitWarning(w);
801
- }
639
+ if (appLast) {
640
+ // Run hooks in the order of service -> app -> finally
641
+ return serviceHooks.concat(appHooks);
802
642
  }
803
643
 
804
- return target;
644
+ return appHooks.concat(serviceHooks);
805
645
  }
806
646
 
807
- EventEmitter.prototype.addListener = function addListener(type, listener) {
808
- return _addListener(this, type, listener, false);
809
- };
810
-
811
- EventEmitter.prototype.on = EventEmitter.prototype.addListener;
647
+ exports.getHooks = getHooks;
812
648
 
813
- EventEmitter.prototype.prependListener =
814
- function prependListener(type, listener) {
815
- return _addListener(this, type, listener, true);
816
- };
649
+ function processHooks(hooks, initialHookObject) {
650
+ var _this = this;
817
651
 
818
- function onceWrapper() {
819
- if (!this.fired) {
820
- this.target.removeListener(this.type, this.wrapFn);
821
- this.fired = true;
822
- if (arguments.length === 0)
823
- return this.listener.call(this.target);
824
- return this.listener.apply(this.target, arguments);
825
- }
826
- }
652
+ var hookObject = initialHookObject;
827
653
 
828
- function _onceWrap(target, type, listener) {
829
- var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };
830
- var wrapped = onceWrapper.bind(state);
831
- wrapped.listener = listener;
832
- state.wrapFn = wrapped;
833
- return wrapped;
834
- }
654
+ var updateCurrentHook = function updateCurrentHook(current) {
655
+ // Either use the returned hook object or the current
656
+ // hook object from the chain if the hook returned undefined
657
+ if (current) {
658
+ if (!isHookObject(current)) {
659
+ throw new Error("".concat(hookObject.type, " hook for '").concat(hookObject.method, "' method returned invalid hook object"));
660
+ }
835
661
 
836
- EventEmitter.prototype.once = function once(type, listener) {
837
- checkListener(listener);
838
- this.on(type, _onceWrap(this, type, listener));
839
- return this;
840
- };
662
+ hookObject = current;
663
+ }
841
664
 
842
- EventEmitter.prototype.prependOnceListener =
843
- function prependOnceListener(type, listener) {
844
- checkListener(listener);
845
- this.prependListener(type, _onceWrap(this, type, listener));
846
- return this;
847
- };
665
+ return hookObject;
666
+ }; // Go through all hooks and chain them into our promise
848
667
 
849
- // Emits a 'removeListener' event if and only if the listener was removed.
850
- EventEmitter.prototype.removeListener =
851
- function removeListener(type, listener) {
852
- var list, events, position, i, originalListener;
853
668
 
854
- checkListener(listener);
669
+ var promise = hooks.reduce(function (current, fn) {
670
+ // @ts-ignore
671
+ var hook = fn.bind(_this); // Use the returned hook object or the old one
855
672
 
856
- events = this._events;
857
- if (events === undefined)
858
- return this;
673
+ return current.then(function (currentHook) {
674
+ return hook(currentHook);
675
+ }).then(updateCurrentHook);
676
+ }, Promise.resolve(hookObject));
677
+ return promise.then(function () {
678
+ return hookObject;
679
+ }).catch(function (error) {
680
+ // Add the hook information to any errors
681
+ error.hook = hookObject;
682
+ throw error;
683
+ });
684
+ }
859
685
 
860
- list = events[type];
861
- if (list === undefined)
862
- return this;
686
+ exports.processHooks = processHooks; // Add `.hooks` functionality to an object
863
687
 
864
- if (list === listener || list.listener === listener) {
865
- if (--this._eventsCount === 0)
866
- this._events = Object.create(null);
867
- else {
868
- delete events[type];
869
- if (events.removeListener)
870
- this.emit('removeListener', type, list.listener || listener);
871
- }
872
- } else if (typeof list !== 'function') {
873
- position = -1;
688
+ function enableHooks(obj, methods, types) {
689
+ if (typeof obj.hooks === 'function') {
690
+ return obj;
691
+ }
874
692
 
875
- for (i = list.length - 1; i >= 0; i--) {
876
- if (list[i] === listener || list[i].listener === listener) {
877
- originalListener = list[i].listener;
878
- position = i;
879
- break;
880
- }
881
- }
693
+ var hookData = {};
694
+ types.forEach(function (type) {
695
+ // Initialize properties where hook functions are stored
696
+ hookData[type] = {};
697
+ }); // Add non-enumerable `__hooks` property to the object
882
698
 
883
- if (position < 0)
884
- return this;
699
+ Object.defineProperty(obj, '__hooks', {
700
+ configurable: true,
701
+ value: hookData,
702
+ writable: true
703
+ });
704
+ return Object.assign(obj, {
705
+ hooks: function hooks(allHooks) {
706
+ var _this2 = this;
885
707
 
886
- if (position === 0)
887
- list.shift();
888
- else {
889
- spliceOne(list, position);
708
+ each(allHooks, function (current, type) {
709
+ // @ts-ignore
710
+ if (!_this2.__hooks[type]) {
711
+ throw new Error("'".concat(type, "' is not a valid hook type"));
890
712
  }
891
713
 
892
- if (list.length === 1)
893
- events[type] = list[0];
714
+ var hooks = convertHookData(current);
715
+ each(hooks, function (_value, method) {
716
+ if (method !== 'all' && methods.indexOf(method) === -1) {
717
+ throw new Error("'".concat(method, "' is not a valid hook method"));
718
+ }
719
+ });
720
+ methods.forEach(function (method) {
721
+ // @ts-ignore
722
+ var myHooks = _this2.__hooks[type][method] || (_this2.__hooks[type][method] = []);
894
723
 
895
- if (events.removeListener !== undefined)
896
- this.emit('removeListener', type, originalListener || listener);
897
- }
724
+ if (hooks.all) {
725
+ myHooks.push.apply(myHooks, hooks.all);
726
+ }
898
727
 
728
+ if (hooks[method]) {
729
+ myHooks.push.apply(myHooks, hooks[method]);
730
+ }
731
+ });
732
+ });
899
733
  return this;
900
- };
734
+ }
735
+ });
736
+ }
901
737
 
902
- EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
738
+ exports.enableHooks = enableHooks;
903
739
 
904
- EventEmitter.prototype.removeAllListeners =
905
- function removeAllListeners(type) {
906
- var listeners, events, i;
740
+ /***/ }),
907
741
 
908
- events = this._events;
909
- if (events === undefined)
910
- return this;
742
+ /***/ "../commons/lib/index.js":
743
+ /*!*******************************!*\
744
+ !*** ../commons/lib/index.js ***!
745
+ \*******************************/
746
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
911
747
 
912
- // not listening for removeListener, no need to emit
913
- if (events.removeListener === undefined) {
914
- if (arguments.length === 0) {
915
- this._events = Object.create(null);
916
- this._eventsCount = 0;
917
- } else if (events[type] !== undefined) {
918
- if (--this._eventsCount === 0)
919
- this._events = Object.create(null);
920
- else
921
- delete events[type];
922
- }
923
- return this;
924
- }
748
+ "use strict";
925
749
 
926
- // emit removeListener for all listeners on all events
927
- if (arguments.length === 0) {
928
- var keys = Object.keys(events);
929
- var key;
930
- for (i = 0; i < keys.length; ++i) {
931
- key = keys[i];
932
- if (key === 'removeListener') continue;
933
- this.removeAllListeners(key);
934
- }
935
- this.removeAllListeners('removeListener');
936
- this._events = Object.create(null);
937
- this._eventsCount = 0;
938
- return this;
939
- }
940
750
 
941
- listeners = events[type];
751
+ var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
752
+ if (k2 === undefined) k2 = k;
753
+ Object.defineProperty(o, k2, {
754
+ enumerable: true,
755
+ get: function get() {
756
+ return m[k];
757
+ }
758
+ });
759
+ } : function (o, m, k, k2) {
760
+ if (k2 === undefined) k2 = k;
761
+ o[k2] = m[k];
762
+ });
942
763
 
943
- if (typeof listeners === 'function') {
944
- this.removeListener(type, listeners);
945
- } else if (listeners !== undefined) {
946
- // LIFO order
947
- for (i = listeners.length - 1; i >= 0; i--) {
948
- this.removeListener(type, listeners[i]);
949
- }
950
- }
764
+ var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
765
+ Object.defineProperty(o, "default", {
766
+ enumerable: true,
767
+ value: v
768
+ });
769
+ } : function (o, v) {
770
+ o["default"] = v;
771
+ });
951
772
 
952
- return this;
953
- };
773
+ var __importStar = this && this.__importStar || function (mod) {
774
+ if (mod && mod.__esModule) return mod;
775
+ var result = {};
776
+ if (mod != null) for (var k in mod) {
777
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
778
+ }
954
779
 
955
- function _listeners(target, type, unwrap) {
956
- var events = target._events;
780
+ __setModuleDefault(result, mod);
957
781
 
958
- if (events === undefined)
959
- return [];
782
+ return result;
783
+ };
960
784
 
961
- var evlistener = events[type];
962
- if (evlistener === undefined)
963
- return [];
785
+ var __exportStar = this && this.__exportStar || function (m, exports) {
786
+ for (var p in m) {
787
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
788
+ }
789
+ };
964
790
 
965
- if (typeof evlistener === 'function')
966
- return unwrap ? [evlistener.listener || evlistener] : [evlistener];
791
+ Object.defineProperty(exports, "__esModule", ({
792
+ value: true
793
+ }));
794
+ exports.hooks = void 0;
967
795
 
968
- return unwrap ?
969
- unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
970
- }
796
+ var hookUtils = __importStar(__webpack_require__(/*! ./hooks */ "../commons/lib/hooks.js"));
971
797
 
972
- EventEmitter.prototype.listeners = function listeners(type) {
973
- return _listeners(this, type, true);
974
- };
798
+ __exportStar(__webpack_require__(/*! ./utils */ "../commons/lib/utils.js"), exports);
975
799
 
976
- EventEmitter.prototype.rawListeners = function rawListeners(type) {
977
- return _listeners(this, type, false);
978
- };
800
+ exports.hooks = hookUtils;
979
801
 
980
- EventEmitter.listenerCount = function(emitter, type) {
981
- if (typeof emitter.listenerCount === 'function') {
982
- return emitter.listenerCount(type);
983
- } else {
984
- return listenerCount.call(emitter, type);
985
- }
986
- };
802
+ /***/ }),
987
803
 
988
- EventEmitter.prototype.listenerCount = listenerCount;
989
- function listenerCount(type) {
990
- var events = this._events;
804
+ /***/ "../commons/lib/utils.js":
805
+ /*!*******************************!*\
806
+ !*** ../commons/lib/utils.js ***!
807
+ \*******************************/
808
+ /***/ (function(__unused_webpack_module, exports) {
991
809
 
992
- if (events !== undefined) {
993
- var evlistener = events[type];
810
+ "use strict";
994
811
 
995
- if (typeof evlistener === 'function') {
996
- return 1;
997
- } else if (evlistener !== undefined) {
998
- return evlistener.length;
999
- }
1000
- }
1001
812
 
1002
- return 0;
1003
- }
813
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1004
814
 
1005
- EventEmitter.prototype.eventNames = function eventNames() {
1006
- return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];
1007
- };
815
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
1008
816
 
1009
- function arrayClone(arr, n) {
1010
- var copy = new Array(n);
1011
- for (var i = 0; i < n; ++i)
1012
- copy[i] = arr[i];
1013
- return copy;
1014
- }
817
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
1015
818
 
1016
- function spliceOne(list, index) {
1017
- for (; index + 1 < list.length; index++)
1018
- list[index] = list[index + 1];
1019
- list.pop();
1020
- }
819
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
1021
820
 
1022
- function unwrapListeners(arr) {
1023
- var ret = new Array(arr.length);
1024
- for (var i = 0; i < ret.length; ++i) {
1025
- ret[i] = arr[i].listener || arr[i];
1026
- }
1027
- return ret;
1028
- }
821
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
1029
822
 
1030
- function once(emitter, name) {
1031
- return new Promise(function (resolve, reject) {
1032
- function eventListener() {
1033
- if (errorListener !== undefined) {
1034
- emitter.removeListener('error', errorListener);
1035
- }
1036
- resolve([].slice.call(arguments));
1037
- };
1038
- var errorListener;
1039
-
1040
- // Adding an error listener is not optional because
1041
- // if an error is thrown on an event emitter we cannot
1042
- // guarantee that the actual event we are waiting will
1043
- // be fired. The result could be a silent way to create
1044
- // memory or file descriptor leaks, which is something
1045
- // we should avoid.
1046
- if (name !== 'error') {
1047
- errorListener = function errorListener(err) {
1048
- emitter.removeListener(name, eventListener);
1049
- reject(err);
1050
- };
823
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
1051
824
 
1052
- emitter.once('error', errorListener);
1053
- }
825
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
1054
826
 
1055
- emitter.once(name, eventListener);
1056
- });
1057
- }
827
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
1058
828
 
829
+ Object.defineProperty(exports, "__esModule", ({
830
+ value: true
831
+ }));
832
+ exports.createSymbol = exports.makeUrl = exports.isPromise = exports._ = exports.stripSlashes = void 0; // Removes all leading and trailing slashes from a path
1059
833
 
1060
- /***/ }),
834
+ function stripSlashes(name) {
835
+ return name.replace(/^(\/+)|(\/+)$/g, '');
836
+ }
1061
837
 
1062
- /***/ "../../node_modules/ms/index.js":
1063
- /*!*****************************************************************************!*\
1064
- !*** /Users/daffl/Development/feathersjs/feathers/node_modules/ms/index.js ***!
1065
- \*****************************************************************************/
1066
- /*! no static exports found */
1067
- /***/ (function(module, exports) {
838
+ exports.stripSlashes = stripSlashes; // A set of lodash-y utility functions that use ES6
1068
839
 
1069
- /**
1070
- * Helpers.
1071
- */
840
+ exports._ = {
841
+ each: function each(obj, callback) {
842
+ if (obj && typeof obj.forEach === 'function') {
843
+ obj.forEach(callback);
844
+ } else if (exports._.isObject(obj)) {
845
+ Object.keys(obj).forEach(function (key) {
846
+ return callback(obj[key], key);
847
+ });
848
+ }
849
+ },
850
+ some: function some(value, callback) {
851
+ return Object.keys(value).map(function (key) {
852
+ return [value[key], key];
853
+ }).some(function (_ref) {
854
+ var _ref2 = _slicedToArray(_ref, 2),
855
+ val = _ref2[0],
856
+ key = _ref2[1];
1072
857
 
1073
- var s = 1000;
1074
- var m = s * 60;
1075
- var h = m * 60;
1076
- var d = h * 24;
1077
- var w = d * 7;
1078
- var y = d * 365.25;
858
+ return callback(val, key);
859
+ });
860
+ },
861
+ every: function every(value, callback) {
862
+ return Object.keys(value).map(function (key) {
863
+ return [value[key], key];
864
+ }).every(function (_ref3) {
865
+ var _ref4 = _slicedToArray(_ref3, 2),
866
+ val = _ref4[0],
867
+ key = _ref4[1];
1079
868
 
1080
- /**
1081
- * Parse or format the given `val`.
1082
- *
1083
- * Options:
1084
- *
1085
- * - `long` verbose formatting [false]
1086
- *
1087
- * @param {String|Number} val
1088
- * @param {Object} [options]
1089
- * @throws {Error} throw an error if val is not a non-empty string or a number
1090
- * @return {String|Number}
1091
- * @api public
1092
- */
869
+ return callback(val, key);
870
+ });
871
+ },
872
+ keys: function keys(obj) {
873
+ return Object.keys(obj);
874
+ },
875
+ values: function values(obj) {
876
+ return exports._.keys(obj).map(function (key) {
877
+ return obj[key];
878
+ });
879
+ },
880
+ isMatch: function isMatch(obj, item) {
881
+ return exports._.keys(item).every(function (key) {
882
+ return obj[key] === item[key];
883
+ });
884
+ },
885
+ isEmpty: function isEmpty(obj) {
886
+ return exports._.keys(obj).length === 0;
887
+ },
888
+ isObject: function isObject(item) {
889
+ return _typeof(item) === 'object' && !Array.isArray(item) && item !== null;
890
+ },
891
+ isObjectOrArray: function isObjectOrArray(value) {
892
+ return _typeof(value) === 'object' && value !== null;
893
+ },
894
+ extend: function extend(first) {
895
+ for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
896
+ rest[_key - 1] = arguments[_key];
897
+ }
1093
898
 
1094
- module.exports = function(val, options) {
1095
- options = options || {};
1096
- var type = typeof val;
1097
- if (type === 'string' && val.length > 0) {
1098
- return parse(val);
1099
- } else if (type === 'number' && isFinite(val)) {
1100
- return options.long ? fmtLong(val) : fmtShort(val);
1101
- }
1102
- throw new Error(
1103
- 'val is not a non-empty string or a valid number. val=' +
1104
- JSON.stringify(val)
1105
- );
1106
- };
899
+ return Object.assign.apply(Object, [first].concat(rest));
900
+ },
901
+ omit: function omit(obj) {
902
+ var result = exports._.extend({}, obj);
1107
903
 
1108
- /**
1109
- * Parse the given `str` and return milliseconds.
1110
- *
1111
- * @param {String} str
1112
- * @return {Number}
1113
- * @api private
1114
- */
1115
-
1116
- function parse(str) {
1117
- str = String(str);
1118
- if (str.length > 100) {
1119
- return;
1120
- }
1121
- var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
1122
- str
1123
- );
1124
- if (!match) {
1125
- return;
1126
- }
1127
- var n = parseFloat(match[1]);
1128
- var type = (match[2] || 'ms').toLowerCase();
1129
- switch (type) {
1130
- case 'years':
1131
- case 'year':
1132
- case 'yrs':
1133
- case 'yr':
1134
- case 'y':
1135
- return n * y;
1136
- case 'weeks':
1137
- case 'week':
1138
- case 'w':
1139
- return n * w;
1140
- case 'days':
1141
- case 'day':
1142
- case 'd':
1143
- return n * d;
1144
- case 'hours':
1145
- case 'hour':
1146
- case 'hrs':
1147
- case 'hr':
1148
- case 'h':
1149
- return n * h;
1150
- case 'minutes':
1151
- case 'minute':
1152
- case 'mins':
1153
- case 'min':
1154
- case 'm':
1155
- return n * m;
1156
- case 'seconds':
1157
- case 'second':
1158
- case 'secs':
1159
- case 'sec':
1160
- case 's':
1161
- return n * s;
1162
- case 'milliseconds':
1163
- case 'millisecond':
1164
- case 'msecs':
1165
- case 'msec':
1166
- case 'ms':
1167
- return n;
1168
- default:
1169
- return undefined;
1170
- }
1171
- }
1172
-
1173
- /**
1174
- * Short format for `ms`.
1175
- *
1176
- * @param {Number} ms
1177
- * @return {String}
1178
- * @api private
1179
- */
1180
-
1181
- function fmtShort(ms) {
1182
- var msAbs = Math.abs(ms);
1183
- if (msAbs >= d) {
1184
- return Math.round(ms / d) + 'd';
1185
- }
1186
- if (msAbs >= h) {
1187
- return Math.round(ms / h) + 'h';
1188
- }
1189
- if (msAbs >= m) {
1190
- return Math.round(ms / m) + 'm';
1191
- }
1192
- if (msAbs >= s) {
1193
- return Math.round(ms / s) + 's';
1194
- }
1195
- return ms + 'ms';
1196
- }
1197
-
1198
- /**
1199
- * Long format for `ms`.
1200
- *
1201
- * @param {Number} ms
1202
- * @return {String}
1203
- * @api private
1204
- */
1205
-
1206
- function fmtLong(ms) {
1207
- var msAbs = Math.abs(ms);
1208
- if (msAbs >= d) {
1209
- return plural(ms, msAbs, d, 'day');
1210
- }
1211
- if (msAbs >= h) {
1212
- return plural(ms, msAbs, h, 'hour');
1213
- }
1214
- if (msAbs >= m) {
1215
- return plural(ms, msAbs, m, 'minute');
1216
- }
1217
- if (msAbs >= s) {
1218
- return plural(ms, msAbs, s, 'second');
1219
- }
1220
- return ms + ' ms';
1221
- }
1222
-
1223
- /**
1224
- * Pluralization helper.
1225
- */
1226
-
1227
- function plural(ms, msAbs, n, name) {
1228
- var isPlural = msAbs >= n * 1.5;
1229
- return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
1230
- }
1231
-
1232
-
1233
- /***/ }),
1234
-
1235
- /***/ "../../node_modules/process/browser.js":
1236
- /*!************************************************************************************!*\
1237
- !*** /Users/daffl/Development/feathersjs/feathers/node_modules/process/browser.js ***!
1238
- \************************************************************************************/
1239
- /*! no static exports found */
1240
- /***/ (function(module, exports) {
904
+ for (var _len2 = arguments.length, keys = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
905
+ keys[_key2 - 1] = arguments[_key2];
906
+ }
1241
907
 
1242
- // shim for using process in browser
1243
- var process = module.exports = {};
908
+ keys.forEach(function (key) {
909
+ return delete result[key];
910
+ });
911
+ return result;
912
+ },
913
+ pick: function pick(source) {
914
+ for (var _len3 = arguments.length, keys = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
915
+ keys[_key3 - 1] = arguments[_key3];
916
+ }
1244
917
 
1245
- // cached from whatever global is present so that test runners that stub it
1246
- // don't break things. But we need to wrap it in a try catch in case it is
1247
- // wrapped in strict mode code which doesn't define any globals. It's inside a
1248
- // function because try/catches deoptimize in certain engines.
918
+ return keys.reduce(function (result, key) {
919
+ if (source[key] !== undefined) {
920
+ result[key] = source[key];
921
+ }
1249
922
 
1250
- var cachedSetTimeout;
1251
- var cachedClearTimeout;
923
+ return result;
924
+ }, {});
925
+ },
926
+ // Recursively merge the source object into the target object
927
+ merge: function merge(target, source) {
928
+ if (exports._.isObject(target) && exports._.isObject(source)) {
929
+ Object.keys(source).forEach(function (key) {
930
+ if (exports._.isObject(source[key])) {
931
+ if (!target[key]) {
932
+ Object.assign(target, _defineProperty({}, key, {}));
933
+ }
1252
934
 
1253
- function defaultSetTimout() {
1254
- throw new Error('setTimeout has not been defined');
1255
- }
1256
- function defaultClearTimeout () {
1257
- throw new Error('clearTimeout has not been defined');
1258
- }
1259
- (function () {
1260
- try {
1261
- if (typeof setTimeout === 'function') {
1262
- cachedSetTimeout = setTimeout;
1263
- } else {
1264
- cachedSetTimeout = defaultSetTimout;
1265
- }
1266
- } catch (e) {
1267
- cachedSetTimeout = defaultSetTimout;
1268
- }
1269
- try {
1270
- if (typeof clearTimeout === 'function') {
1271
- cachedClearTimeout = clearTimeout;
935
+ exports._.merge(target[key], source[key]);
1272
936
  } else {
1273
- cachedClearTimeout = defaultClearTimeout;
1274
- }
1275
- } catch (e) {
1276
- cachedClearTimeout = defaultClearTimeout;
1277
- }
1278
- } ())
1279
- function runTimeout(fun) {
1280
- if (cachedSetTimeout === setTimeout) {
1281
- //normal enviroments in sane situations
1282
- return setTimeout(fun, 0);
1283
- }
1284
- // if setTimeout wasn't available but was latter defined
1285
- if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
1286
- cachedSetTimeout = setTimeout;
1287
- return setTimeout(fun, 0);
1288
- }
1289
- try {
1290
- // when when somebody has screwed with setTimeout but no I.E. maddness
1291
- return cachedSetTimeout(fun, 0);
1292
- } catch(e){
1293
- try {
1294
- // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
1295
- return cachedSetTimeout.call(null, fun, 0);
1296
- } catch(e){
1297
- // 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
1298
- return cachedSetTimeout.call(this, fun, 0);
1299
- }
1300
- }
1301
-
1302
-
1303
- }
1304
- function runClearTimeout(marker) {
1305
- if (cachedClearTimeout === clearTimeout) {
1306
- //normal enviroments in sane situations
1307
- return clearTimeout(marker);
1308
- }
1309
- // if clearTimeout wasn't available but was latter defined
1310
- if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
1311
- cachedClearTimeout = clearTimeout;
1312
- return clearTimeout(marker);
1313
- }
1314
- try {
1315
- // when when somebody has screwed with setTimeout but no I.E. maddness
1316
- return cachedClearTimeout(marker);
1317
- } catch (e){
1318
- try {
1319
- // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
1320
- return cachedClearTimeout.call(null, marker);
1321
- } catch (e){
1322
- // 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.
1323
- // Some versions of I.E. have different rules for clearTimeout vs setTimeout
1324
- return cachedClearTimeout.call(this, marker);
937
+ Object.assign(target, _defineProperty({}, key, source[key]));
1325
938
  }
939
+ });
1326
940
  }
1327
941
 
942
+ return target;
943
+ }
944
+ }; // Duck-checks if an object looks like a promise
1328
945
 
1329
-
946
+ function isPromise(result) {
947
+ return exports._.isObject(result) && typeof result.then === 'function';
1330
948
  }
1331
- var queue = [];
1332
- var draining = false;
1333
- var currentQueue;
1334
- var queueIndex = -1;
1335
949
 
1336
- function cleanUpNextTick() {
1337
- if (!draining || !currentQueue) {
1338
- return;
1339
- }
1340
- draining = false;
1341
- if (currentQueue.length) {
1342
- queue = currentQueue.concat(queue);
1343
- } else {
1344
- queueIndex = -1;
1345
- }
1346
- if (queue.length) {
1347
- drainQueue();
1348
- }
1349
- }
950
+ exports.isPromise = isPromise;
1350
951
 
1351
- function drainQueue() {
1352
- if (draining) {
1353
- return;
1354
- }
1355
- var timeout = runTimeout(cleanUpNextTick);
1356
- draining = true;
1357
-
1358
- var len = queue.length;
1359
- while(len) {
1360
- currentQueue = queue;
1361
- queue = [];
1362
- while (++queueIndex < len) {
1363
- if (currentQueue) {
1364
- currentQueue[queueIndex].run();
1365
- }
1366
- }
1367
- queueIndex = -1;
1368
- len = queue.length;
1369
- }
1370
- currentQueue = null;
1371
- draining = false;
1372
- runClearTimeout(timeout);
952
+ function makeUrl(path) {
953
+ var app = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
954
+ var get = typeof app.get === 'function' ? app.get.bind(app) : function () {};
955
+ var env = get('env') || "development";
956
+ var host = get('host') || process.env.HOST_NAME || 'localhost';
957
+ var protocol = env === 'development' || env === 'test' || env === undefined ? 'http' : 'https';
958
+ var PORT = get('port') || process.env.PORT || 3030;
959
+ var port = env === 'development' || env === 'test' || env === undefined ? ":".concat(PORT) : '';
960
+ path = path || '';
961
+ return "".concat(protocol, "://").concat(host).concat(port, "/").concat(exports.stripSlashes(path));
1373
962
  }
1374
963
 
1375
- process.nextTick = function (fun) {
1376
- var args = new Array(arguments.length - 1);
1377
- if (arguments.length > 1) {
1378
- for (var i = 1; i < arguments.length; i++) {
1379
- args[i - 1] = arguments[i];
1380
- }
1381
- }
1382
- queue.push(new Item(fun, args));
1383
- if (queue.length === 1 && !draining) {
1384
- runTimeout(drainQueue);
1385
- }
1386
- };
964
+ exports.makeUrl = makeUrl;
1387
965
 
1388
- // v8 likes predictible objects
1389
- function Item(fun, array) {
1390
- this.fun = fun;
1391
- this.array = array;
966
+ function createSymbol(name) {
967
+ return typeof Symbol !== 'undefined' ? Symbol(name) : name;
1392
968
  }
1393
- Item.prototype.run = function () {
1394
- this.fun.apply(null, this.array);
1395
- };
1396
- process.title = 'browser';
1397
- process.browser = true;
1398
- process.env = {};
1399
- process.argv = [];
1400
- process.version = ''; // empty string to avoid regexp issues
1401
- process.versions = {};
1402
-
1403
- function noop() {}
1404
-
1405
- process.on = noop;
1406
- process.addListener = noop;
1407
- process.once = noop;
1408
- process.off = noop;
1409
- process.removeListener = noop;
1410
- process.removeAllListeners = noop;
1411
- process.emit = noop;
1412
- process.prependListener = noop;
1413
- process.prependOnceListener = noop;
1414
-
1415
- process.listeners = function (name) { return [] }
1416
-
1417
- process.binding = function (name) {
1418
- throw new Error('process.binding is not supported');
1419
- };
1420
-
1421
- process.cwd = function () { return '/' };
1422
- process.chdir = function (dir) {
1423
- throw new Error('process.chdir is not supported');
1424
- };
1425
- process.umask = function() { return 0; };
1426
969
 
970
+ exports.createSymbol = createSymbol;
1427
971
 
1428
972
  /***/ }),
1429
973
 
1430
- /***/ "../../node_modules/uberproto/lib/proto.js":
1431
- /*!****************************************************************************************!*\
1432
- !*** /Users/daffl/Development/feathersjs/feathers/node_modules/uberproto/lib/proto.js ***!
1433
- \****************************************************************************************/
1434
- /*! no static exports found */
1435
- /***/ (function(module, exports, __webpack_require__) {
974
+ /***/ "../feathers/lib/application.js":
975
+ /*!**************************************!*\
976
+ !*** ../feathers/lib/application.js ***!
977
+ \**************************************/
978
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
1436
979
 
1437
- var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* global define */
1438
- /**
1439
- * Uberproto
1440
- *
1441
- * A base object for ECMAScript 5 style prototypal inheritance.
1442
- *
1443
- * @see https://github.com/rauschma/proto-js/
1444
- * @see http://ejohn.org/blog/simple-javascript-inheritance/
1445
- * @see http://uxebu.com/blog/2011/02/23/object-based-inheritance-for-ecmascript-5/
1446
- */
1447
- (function (root, factory) {
1448
- if (true) {
1449
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
1450
- __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
1451
- (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
1452
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
1453
- } else {}
1454
- }(this, function () {
1455
- var HAS_SYMBOLS = typeof Object.getOwnPropertySymbols === 'function';
980
+ var debug = __webpack_require__(/*! debug */ "../../node_modules/debug/src/browser.js")('feathers:application');
1456
981
 
1457
- function makeSuper (_super, old, name, fn) {
1458
- var isFunction = typeof old === 'function';
1459
- var newMethod = function () {
1460
- var tmp = this._super;
982
+ var _require = __webpack_require__(/*! @feathersjs/commons */ "../commons/lib/index.js"),
983
+ stripSlashes = _require.stripSlashes;
1461
984
 
1462
- // Add a new ._super() method that is the same method
1463
- // but either pointing to the prototype method
1464
- // or to the overwritten method
1465
- this._super = isFunction ? old : _super[name];
985
+ var Uberproto = __webpack_require__(/*! uberproto */ "../../node_modules/uberproto/lib/proto.js");
1466
986
 
1467
- // The method only need to be bound temporarily, so we
1468
- // remove it when we're done executing
1469
- var ret = fn.apply(this, arguments);
987
+ var events = __webpack_require__(/*! ./events */ "../feathers/lib/events.js");
1470
988
 
1471
- this._super = tmp;
989
+ var hooks = __webpack_require__(/*! ./hooks */ "../feathers/lib/hooks/index.js");
1472
990
 
1473
- return ret;
1474
- };
991
+ var version = __webpack_require__(/*! ./version */ "../feathers/lib/version.js");
1475
992
 
1476
- if (isFunction) {
1477
- Object.keys(old).forEach(function (name) {
1478
- newMethod[name] = old[name];
1479
- });
993
+ var Proto = Uberproto.extend({
994
+ create: null
995
+ });
996
+ var application = {
997
+ init: function init() {
998
+ Object.assign(this, {
999
+ version: version,
1000
+ methods: ['find', 'get', 'create', 'update', 'patch', 'remove'],
1001
+ mixins: [],
1002
+ services: {},
1003
+ providers: [],
1004
+ _setup: false,
1005
+ settings: {}
1006
+ });
1007
+ this.configure(hooks());
1008
+ this.configure(events());
1009
+ },
1010
+ get: function get(name) {
1011
+ return this.settings[name];
1012
+ },
1013
+ set: function set(name, value) {
1014
+ this.settings[name] = value;
1015
+ return this;
1016
+ },
1017
+ disable: function disable(name) {
1018
+ this.settings[name] = false;
1019
+ return this;
1020
+ },
1021
+ disabled: function disabled(name) {
1022
+ return !this.settings[name];
1023
+ },
1024
+ enable: function enable(name) {
1025
+ this.settings[name] = true;
1026
+ return this;
1027
+ },
1028
+ enabled: function enabled(name) {
1029
+ return !!this.settings[name];
1030
+ },
1031
+ configure: function configure(fn) {
1032
+ fn.call(this, this);
1033
+ return this;
1034
+ },
1035
+ service: function service(path, _service) {
1036
+ if (typeof _service !== 'undefined') {
1037
+ throw new Error('Registering a new service with `app.service(path, service)` is no longer supported. Use `app.use(path, service)` instead.');
1038
+ }
1480
1039
 
1481
- if (HAS_SYMBOLS) {
1482
- Object.getOwnPropertySymbols(old).forEach(function (name) {
1483
- newMethod[name] = old[name];
1484
- });
1485
- }
1040
+ var location = stripSlashes(path) || '/';
1041
+ var current = this.services[location];
1042
+
1043
+ if (typeof current === 'undefined' && typeof this.defaultService === 'function') {
1044
+ return this.use(location, this.defaultService(location)).service(location);
1486
1045
  }
1487
1046
 
1488
- return newMethod;
1489
- }
1047
+ return current;
1048
+ },
1049
+ use: function use(path, service) {
1050
+ var _this = this;
1490
1051
 
1491
- return {
1492
- /**
1493
- * Create a new object using Object.create. The arguments will be
1494
- * passed to the new instances init method or to a method name set in
1495
- * __init.
1496
- */
1497
- create: function () {
1498
- var instance = Object.create(this);
1499
- var init = typeof instance.__init === 'string' ? instance.__init : 'init';
1052
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1500
1053
 
1501
- if (typeof instance[init] === 'function') {
1502
- instance[init].apply(instance, arguments);
1503
- }
1504
- return instance;
1505
- },
1506
- /**
1507
- * Mixin a given set of properties
1508
- * @param prop The properties to mix in
1509
- * @param obj [optional]
1510
- * The object to add the mixin
1511
- */
1512
- mixin: function (prop, obj) {
1513
- var self = obj || this;
1514
- var fnTest = /\b_super\b/;
1515
- var _super = Object.getPrototypeOf(self) || self.prototype;
1516
- var descriptors = {};
1517
- var proto = prop;
1518
- var processProperty = function (name) {
1519
- var descriptor = Object.getOwnPropertyDescriptor(proto, name);
1054
+ if (typeof path !== 'string') {
1055
+ throw new Error("'".concat(path, "' is not a valid service path."));
1056
+ }
1520
1057
 
1521
- if (!descriptors[name] && descriptor) {
1522
- descriptors[name] = descriptor;
1523
- }
1524
- };
1058
+ var location = stripSlashes(path) || '/';
1059
+ var isSubApp = typeof service.service === 'function' && service.services;
1060
+ var isService = this.methods.concat('setup').some(function (name) {
1061
+ return typeof service[name] === 'function';
1062
+ });
1525
1063
 
1526
- // Collect all property descriptors
1527
- do {
1528
- Object.getOwnPropertyNames(proto).forEach(processProperty);
1064
+ if (isSubApp) {
1065
+ var subApp = service;
1066
+ Object.keys(subApp.services).forEach(function (subPath) {
1067
+ return _this.use("".concat(location, "/").concat(subPath), subApp.service(subPath));
1068
+ });
1069
+ return this;
1070
+ }
1529
1071
 
1530
- if (HAS_SYMBOLS) {
1531
- Object.getOwnPropertySymbols(proto).forEach(processProperty);
1532
- }
1533
- } while ((proto = Object.getPrototypeOf(proto)) && Object.getPrototypeOf(proto));
1072
+ if (!isService) {
1073
+ throw new Error("Invalid service object passed for path `".concat(location, "`"));
1074
+ } // If the service is already Uberproto'd use it directly
1534
1075
 
1535
- var processDescriptor = function (name) {
1536
- var descriptor = descriptors[name];
1537
1076
 
1538
- if (typeof descriptor.value === 'function' && fnTest.test(descriptor.value)) {
1539
- descriptor.value = makeSuper(_super, self[name], name, descriptor.value);
1540
- }
1077
+ var protoService = Proto.isPrototypeOf(service) ? service : Proto.extend(service);
1078
+ debug("Registering new service at `".concat(location, "`")); // Add all the mixins
1541
1079
 
1542
- Object.defineProperty(self, name, descriptor);
1543
- };
1080
+ this.mixins.forEach(function (fn) {
1081
+ return fn.call(_this, protoService, location, options);
1082
+ });
1544
1083
 
1545
- Object.keys(descriptors).forEach(processDescriptor);
1084
+ if (typeof protoService._setup === 'function') {
1085
+ protoService._setup(this, location);
1086
+ } // Run the provider functions to register the service
1546
1087
 
1547
- if (HAS_SYMBOLS) {
1548
- Object.getOwnPropertySymbols(descriptors).forEach(processDescriptor);
1549
- }
1550
1088
 
1551
- return self;
1552
- },
1553
- /**
1554
- * Extend the current or a given object with the given property and return the extended object.
1555
- * @param prop The properties to extend with
1556
- * @param obj [optional] The object to extend from
1557
- * @returns The extended object
1558
- */
1559
- extend: function (prop, obj) {
1560
- return this.mixin(prop, Object.create(obj || this));
1561
- },
1562
- /**
1563
- * Return a callback function with this set to the current or a given context object.
1564
- * @param name Name of the method to proxy
1565
- * @param args... [optional] Arguments to use for partial application
1566
- */
1567
- proxy: function (name) {
1568
- var fn = this[name];
1569
- var args = Array.prototype.slice.call(arguments, 1);
1089
+ this.providers.forEach(function (provider) {
1090
+ return provider.call(_this, protoService, location, options);
1091
+ }); // If we ran setup already, set this service up explicitly
1570
1092
 
1571
- args.unshift(this);
1572
- return fn.bind.apply(fn, args);
1093
+ if (this._isSetup && typeof protoService.setup === 'function') {
1094
+ debug("Setting up service for `".concat(location, "`"));
1095
+ protoService.setup(this, location);
1573
1096
  }
1574
- };
1575
- }));
1576
1097
 
1098
+ this.services[location] = protoService;
1099
+ return this;
1100
+ },
1101
+ setup: function setup() {
1102
+ var _this2 = this;
1103
+
1104
+ // Setup each service (pass the app so that they can look up other services etc.)
1105
+ Object.keys(this.services).forEach(function (path) {
1106
+ var service = _this2.services[path];
1107
+ debug("Setting up service for `".concat(path, "`"));
1108
+
1109
+ if (typeof service.setup === 'function') {
1110
+ service.setup(_this2, path);
1111
+ }
1112
+ });
1113
+ this._isSetup = true;
1114
+ return this;
1115
+ }
1116
+ };
1117
+ module.exports = application;
1577
1118
 
1578
1119
  /***/ }),
1579
1120
 
1580
- /***/ "../commons/lib/hooks.js":
1581
- /*!*******************************!*\
1582
- !*** ../commons/lib/hooks.js ***!
1583
- \*******************************/
1584
- /*! no static exports found */
1121
+ /***/ "../feathers/lib/events.js":
1122
+ /*!*********************************!*\
1123
+ !*** ../feathers/lib/events.js ***!
1124
+ \*********************************/
1585
1125
  /***/ (function(module, exports, __webpack_require__) {
1586
1126
 
1587
- "use strict";
1127
+ var _require = __webpack_require__(/*! events */ "../../node_modules/events/events.js"),
1128
+ EventEmitter = _require.EventEmitter;
1588
1129
 
1130
+ var Proto = __webpack_require__(/*! uberproto */ "../../node_modules/uberproto/lib/proto.js"); // Returns a hook that emits service events. Should always be
1131
+ // used as the very last hook in the chain
1589
1132
 
1590
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
1591
1133
 
1592
- Object.defineProperty(exports, "__esModule", {
1593
- value: true
1594
- });
1595
- exports.enableHooks = exports.processHooks = exports.getHooks = exports.isHookObject = exports.convertHookData = exports.makeArguments = exports.defaultMakeArguments = exports.createHookObject = exports.ACTIVATE_HOOKS = void 0;
1134
+ var eventHook = exports.eventHook = function eventHook() {
1135
+ return function (hook) {
1136
+ var app = hook.app,
1137
+ service = hook.service;
1138
+ var eventName = hook.event === null ? hook.event : app.eventMappings[hook.method];
1139
+ var isHookEvent = service._hookEvents && service._hookEvents.indexOf(eventName) !== -1; // If this event is not being sent yet and we are not in an error hook
1596
1140
 
1597
- var utils_1 = __webpack_require__(/*! ./utils */ "../commons/lib/utils.js");
1141
+ if (eventName && isHookEvent && hook.type !== 'error') {
1142
+ var results = Array.isArray(hook.result) ? hook.result : [hook.result];
1143
+ results.forEach(function (element) {
1144
+ return service.emit(eventName, element, hook);
1145
+ });
1146
+ }
1147
+ };
1148
+ }; // Mixin that turns a service into a Node event emitter
1598
1149
 
1599
- var _utils_1$_ = utils_1._,
1600
- each = _utils_1$_.each,
1601
- pick = _utils_1$_.pick;
1602
- exports.ACTIVATE_HOOKS = utils_1.createSymbol('__feathersActivateHooks');
1603
1150
 
1604
- function createHookObject(method) {
1605
- var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1606
- var hook = {};
1607
- Object.defineProperty(hook, 'toJSON', {
1608
- value: function value() {
1609
- return pick(this, 'type', 'method', 'path', 'params', 'id', 'data', 'result', 'error');
1610
- }
1611
- });
1612
- return Object.assign(hook, data, {
1613
- method: method,
1151
+ var eventMixin = exports.eventMixin = function eventMixin(service) {
1152
+ if (service._serviceEvents) {
1153
+ return;
1154
+ }
1614
1155
 
1615
- // A dynamic getter that returns the path of the service
1616
- get path() {
1617
- var app = data.app,
1618
- service = data.service;
1156
+ var app = this; // Indicates if the service is already an event emitter
1619
1157
 
1620
- if (!service || !app || !app.services) {
1621
- return null;
1622
- }
1158
+ var isEmitter = typeof service.on === 'function' && typeof service.emit === 'function'; // If not, mix it in (the service is always an Uberproto object that has a .mixin)
1623
1159
 
1624
- return Object.keys(app.services).find(function (path) {
1625
- return app.services[path] === service;
1626
- });
1627
- }
1160
+ if (typeof service.mixin === 'function' && !isEmitter) {
1161
+ service.mixin(EventEmitter.prototype);
1162
+ } // Define non-enumerable properties of
1628
1163
 
1629
- });
1630
- }
1631
1164
 
1632
- exports.createHookObject = createHookObject; // Fallback used by `makeArguments` which usually won't be used
1165
+ Object.defineProperties(service, {
1166
+ // A list of all events that this service sends
1167
+ _serviceEvents: {
1168
+ value: Array.isArray(service.events) ? service.events.slice() : []
1169
+ },
1170
+ // A list of events that should be handled through the event hooks
1171
+ _hookEvents: {
1172
+ value: []
1173
+ }
1174
+ }); // `app.eventMappings` has the mapping from method name to event name
1633
1175
 
1634
- function defaultMakeArguments(hook) {
1635
- var result = [];
1176
+ Object.keys(app.eventMappings).forEach(function (method) {
1177
+ var event = app.eventMappings[method];
1178
+ var alreadyEmits = service._serviceEvents.indexOf(event) !== -1; // Add events for known methods to _serviceEvents and _hookEvents
1179
+ // if the service indicated it does not send it itself yet
1636
1180
 
1637
- if (typeof hook.id !== 'undefined') {
1638
- result.push(hook.id);
1639
- }
1181
+ if (typeof service[method] === 'function' && !alreadyEmits) {
1182
+ service._serviceEvents.push(event);
1640
1183
 
1641
- if (hook.data) {
1642
- result.push(hook.data);
1643
- }
1184
+ service._hookEvents.push(event);
1185
+ }
1186
+ });
1187
+ };
1644
1188
 
1645
- result.push(hook.params || {});
1646
- return result;
1647
- }
1189
+ module.exports = function () {
1190
+ return function (app) {
1191
+ // Mappings from service method to event name
1192
+ Object.assign(app, {
1193
+ eventMappings: {
1194
+ create: 'created',
1195
+ update: 'updated',
1196
+ remove: 'removed',
1197
+ patch: 'patched'
1198
+ }
1199
+ }); // Register the event hook
1200
+ // `finally` hooks always run last after `error` and `after` hooks
1648
1201
 
1649
- exports.defaultMakeArguments = defaultMakeArguments; // Turns a hook object back into a list of arguments
1650
- // to call a service method with
1202
+ app.hooks({
1203
+ finally: eventHook()
1204
+ }); // Make the app an event emitter
1651
1205
 
1652
- function makeArguments(hook) {
1653
- switch (hook.method) {
1654
- case 'find':
1655
- return [hook.params];
1206
+ Proto.mixin(EventEmitter.prototype, app);
1207
+ app.mixins.push(eventMixin);
1208
+ };
1209
+ };
1656
1210
 
1657
- case 'get':
1658
- case 'remove':
1659
- return [hook.id, hook.params];
1211
+ /***/ }),
1660
1212
 
1661
- case 'update':
1662
- case 'patch':
1663
- return [hook.id, hook.data, hook.params];
1213
+ /***/ "../feathers/lib/hooks/base.js":
1214
+ /*!*************************************!*\
1215
+ !*** ../feathers/lib/hooks/base.js ***!
1216
+ \*************************************/
1217
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
1664
1218
 
1665
- case 'create':
1666
- return [hook.data, hook.params];
1667
- }
1219
+ var _require = __webpack_require__(/*! @feathersjs/commons */ "../commons/lib/index.js"),
1220
+ _ = _require._;
1668
1221
 
1669
- return defaultMakeArguments(hook);
1670
- }
1222
+ var assignArguments = function assignArguments(context) {
1223
+ var service = context.service,
1224
+ method = context.method;
1225
+ var parameters = service.methods[method];
1226
+ context.arguments.forEach(function (value, index) {
1227
+ context[parameters[index]] = value;
1228
+ });
1671
1229
 
1672
- exports.makeArguments = makeArguments; // Converts different hook registration formats into the
1673
- // same internal format
1230
+ if (!context.params) {
1231
+ context.params = {};
1232
+ }
1674
1233
 
1675
- function convertHookData(obj) {
1676
- var hook = {};
1234
+ return context;
1235
+ };
1677
1236
 
1678
- if (Array.isArray(obj)) {
1679
- hook = {
1680
- all: obj
1681
- };
1682
- } else if (_typeof(obj) !== 'object') {
1683
- hook = {
1684
- all: [obj]
1685
- };
1686
- } else {
1687
- each(obj, function (value, key) {
1688
- hook[key] = !Array.isArray(value) ? [value] : value;
1689
- });
1690
- }
1237
+ var validate = function validate(context) {
1238
+ var service = context.service,
1239
+ method = context.method,
1240
+ path = context.path;
1241
+ var parameters = service.methods[method];
1691
1242
 
1692
- return hook;
1693
- }
1243
+ if (parameters.includes('id') && context.id === undefined) {
1244
+ throw new Error("An id must be provided to the '".concat(path, ".").concat(method, "' method"));
1245
+ }
1694
1246
 
1695
- exports.convertHookData = convertHookData; // Duck-checks a given object to be a hook object
1696
- // A valid hook object has `type` and `method`
1247
+ if (parameters.includes('data') && !_.isObjectOrArray(context.data)) {
1248
+ throw new Error("A data object must be provided to the '".concat(path, ".").concat(method, "' method"));
1249
+ }
1697
1250
 
1698
- function isHookObject(hookObject) {
1699
- return _typeof(hookObject) === 'object' && typeof hookObject.method === 'string' && typeof hookObject.type === 'string';
1700
- }
1251
+ return context;
1252
+ };
1701
1253
 
1702
- exports.isHookObject = isHookObject; // Returns all service and application hooks combined
1703
- // for a given method and type `appLast` sets if the hooks
1704
- // from `app` should be added last (or first by default)
1254
+ module.exports = [assignArguments, validate];
1705
1255
 
1706
- function getHooks(app, service, type, method) {
1707
- var appLast = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
1708
- var appHooks = app.__hooks[type][method] || [];
1709
- var serviceHooks = service.__hooks[type][method] || [];
1256
+ /***/ }),
1710
1257
 
1711
- if (appLast) {
1712
- // Run hooks in the order of service -> app -> finally
1713
- return serviceHooks.concat(appHooks);
1714
- }
1258
+ /***/ "../feathers/lib/hooks/index.js":
1259
+ /*!**************************************!*\
1260
+ !*** ../feathers/lib/hooks/index.js ***!
1261
+ \**************************************/
1262
+ /***/ (function(module, exports, __webpack_require__) {
1715
1263
 
1716
- return appHooks.concat(serviceHooks);
1717
- }
1264
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
1718
1265
 
1719
- exports.getHooks = getHooks;
1266
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
1720
1267
 
1721
- function processHooks(hooks, initialHookObject) {
1722
- var _this = this;
1268
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
1723
1269
 
1724
- var hookObject = initialHookObject;
1270
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
1725
1271
 
1726
- var updateCurrentHook = function updateCurrentHook(current) {
1727
- // Either use the returned hook object or the current
1728
- // hook object from the chain if the hook returned undefined
1729
- if (current) {
1730
- if (!isHookObject(current)) {
1731
- throw new Error("".concat(hookObject.type, " hook for '").concat(hookObject.method, "' method returned invalid hook object"));
1732
- }
1272
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
1733
1273
 
1734
- hookObject = current;
1735
- }
1274
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
1736
1275
 
1737
- return hookObject;
1738
- }; // Go through all hooks and chain them into our promise
1276
+ var _require = __webpack_require__(/*! @feathersjs/commons */ "../commons/lib/index.js"),
1277
+ hooks = _require.hooks,
1278
+ isPromise = _require.isPromise;
1739
1279
 
1280
+ var baseHooks = __webpack_require__(/*! ./base */ "../feathers/lib/hooks/base.js");
1740
1281
 
1741
- var promise = hooks.reduce(function (current, fn) {
1742
- // @ts-ignore
1743
- var hook = fn.bind(_this); // Use the returned hook object or the old one
1282
+ var createHookObject = hooks.createHookObject,
1283
+ getHooks = hooks.getHooks,
1284
+ processHooks = hooks.processHooks,
1285
+ enableHooks = hooks.enableHooks,
1286
+ ACTIVATE_HOOKS = hooks.ACTIVATE_HOOKS;
1744
1287
 
1745
- return current.then(function (currentHook) {
1746
- return hook(currentHook);
1747
- }).then(updateCurrentHook);
1748
- }, Promise.resolve(hookObject));
1749
- return promise.then(function () {
1750
- return hookObject;
1751
- }).catch(function (error) {
1752
- // Add the hook information to any errors
1753
- error.hook = hookObject;
1754
- throw error;
1755
- });
1756
- }
1288
+ var withHooks = function withHooks(_ref) {
1289
+ var app = _ref.app,
1290
+ service = _ref.service,
1291
+ method = _ref.method,
1292
+ original = _ref.original;
1293
+ return function () {
1294
+ var _hooks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1757
1295
 
1758
- exports.processHooks = processHooks; // Add `.hooks` functionality to an object
1296
+ var hooks = app.hookTypes.reduce(function (result, type) {
1297
+ var value = _hooks[type] || [];
1298
+ result[type] = Array.isArray(value) ? value : [value];
1299
+ return result;
1300
+ }, {});
1301
+ return function () {
1302
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1303
+ args[_key] = arguments[_key];
1304
+ }
1759
1305
 
1760
- function enableHooks(obj, methods, types) {
1761
- if (typeof obj.hooks === 'function') {
1762
- return obj;
1763
- }
1306
+ var returnHook = args[args.length - 1] === true ? args.pop() : false; // Create the hook object that gets passed through
1764
1307
 
1765
- var hookData = {};
1766
- types.forEach(function (type) {
1767
- // Initialize properties where hook functions are stored
1768
- hookData[type] = {};
1769
- }); // Add non-enumerable `__hooks` property to the object
1308
+ var hookObject = createHookObject(method, {
1309
+ type: 'before',
1310
+ // initial hook object type
1311
+ arguments: args,
1312
+ service: service,
1313
+ app: app
1314
+ });
1315
+ return Promise.resolve(hookObject) // Run `before` hooks
1316
+ .then(function (hookObject) {
1317
+ return processHooks.call(service, baseHooks.concat(hooks.before), hookObject);
1318
+ }) // Run the original method
1319
+ .then(function (hookObject) {
1320
+ // If `hookObject.result` is set, skip the original method
1321
+ if (typeof hookObject.result !== 'undefined') {
1322
+ return hookObject;
1323
+ } // Otherwise, call it with arguments created from the hook object
1770
1324
 
1771
- Object.defineProperty(obj, '__hooks', {
1772
- configurable: true,
1773
- value: hookData,
1774
- writable: true
1775
- });
1776
- return Object.assign(obj, {
1777
- hooks: function hooks(allHooks) {
1778
- var _this2 = this;
1779
1325
 
1780
- each(allHooks, function (current, type) {
1781
- // @ts-ignore
1782
- if (!_this2.__hooks[type]) {
1783
- throw new Error("'".concat(type, "' is not a valid hook type"));
1784
- }
1326
+ var promise = new Promise(function (resolve) {
1327
+ var func = original || service[method];
1328
+ var args = service.methods[method].map(function (value) {
1329
+ return hookObject[value];
1330
+ });
1331
+ var result = func.apply(service, args);
1785
1332
 
1786
- var hooks = convertHookData(current);
1787
- each(hooks, function (_value, method) {
1788
- if (method !== 'all' && methods.indexOf(method) === -1) {
1789
- throw new Error("'".concat(method, "' is not a valid hook method"));
1790
- }
1791
- });
1792
- methods.forEach(function (method) {
1793
- // @ts-ignore
1794
- var myHooks = _this2.__hooks[type][method] || (_this2.__hooks[type][method] = []);
1795
-
1796
- if (hooks.all) {
1797
- myHooks.push.apply(myHooks, hooks.all);
1333
+ if (!isPromise(result)) {
1334
+ throw new Error("Service method '".concat(hookObject.method, "' for '").concat(hookObject.path, "' service must return a promise"));
1798
1335
  }
1799
1336
 
1800
- if (hooks[method]) {
1801
- myHooks.push.apply(myHooks, hooks[method]);
1802
- }
1337
+ resolve(result);
1338
+ });
1339
+ return promise.then(function (result) {
1340
+ hookObject.result = result;
1341
+ return hookObject;
1342
+ }).catch(function (error) {
1343
+ error.hook = hookObject;
1344
+ throw error;
1345
+ });
1346
+ }) // Run `after` hooks
1347
+ .then(function (hookObject) {
1348
+ var afterHookObject = Object.assign({}, hookObject, {
1349
+ type: 'after'
1350
+ });
1351
+ return processHooks.call(service, hooks.after, afterHookObject);
1352
+ }) // Run `errors` hooks
1353
+ .catch(function (error) {
1354
+ var errorHookObject = Object.assign({}, error.hook, {
1355
+ type: 'error',
1356
+ original: error.hook,
1357
+ error: error,
1358
+ result: undefined
1359
+ });
1360
+ return processHooks.call(service, hooks.error, errorHookObject).catch(function (error) {
1361
+ var errorHookObject = Object.assign({}, error.hook, {
1362
+ error: error,
1363
+ result: undefined
1364
+ });
1365
+ return errorHookObject;
1366
+ });
1367
+ }) // Run `finally` hooks
1368
+ .then(function (hookObject) {
1369
+ return processHooks.call(service, hooks.finally, hookObject).catch(function (error) {
1370
+ var errorHookObject = Object.assign({}, error.hook, {
1371
+ error: error,
1372
+ result: undefined
1373
+ });
1374
+ return errorHookObject;
1803
1375
  });
1376
+ }) // Resolve with a result or reject with an error
1377
+ .then(function (hookObject) {
1378
+ if (typeof hookObject.error !== 'undefined' && typeof hookObject.result === 'undefined') {
1379
+ return Promise.reject(returnHook ? hookObject : hookObject.error);
1380
+ } else {
1381
+ return returnHook ? hookObject : hookObject.result;
1382
+ }
1804
1383
  });
1805
- return this;
1806
- }
1807
- });
1808
- }
1809
-
1810
- exports.enableHooks = enableHooks;
1811
-
1812
- /***/ }),
1384
+ };
1385
+ };
1386
+ }; // A service mixin that adds `service.hooks()` method and functionality
1813
1387
 
1814
- /***/ "../commons/lib/index.js":
1815
- /*!*******************************!*\
1816
- !*** ../commons/lib/index.js ***!
1817
- \*******************************/
1818
- /*! no static exports found */
1819
- /***/ (function(module, exports, __webpack_require__) {
1820
1388
 
1821
- "use strict";
1389
+ var hookMixin = exports.hookMixin = function hookMixin(service) {
1390
+ if (typeof service.hooks === 'function') {
1391
+ return;
1392
+ }
1822
1393
 
1394
+ service.methods = Object.getOwnPropertyNames(service).filter(function (key) {
1395
+ return typeof service[key] === 'function' && service[key][ACTIVATE_HOOKS];
1396
+ }).reduce(function (result, methodName) {
1397
+ result[methodName] = service[methodName][ACTIVATE_HOOKS];
1398
+ return result;
1399
+ }, service.methods || {});
1400
+ Object.assign(service.methods, {
1401
+ find: ['params'],
1402
+ get: ['id', 'params'],
1403
+ create: ['data', 'params'],
1404
+ update: ['id', 'data', 'params'],
1405
+ patch: ['id', 'data', 'params'],
1406
+ remove: ['id', 'params']
1407
+ });
1408
+ var app = this;
1409
+ var methodNames = Object.keys(service.methods); // Assemble the mixin object that contains all "hooked" service methods
1823
1410
 
1824
- var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
1825
- if (k2 === undefined) k2 = k;
1826
- Object.defineProperty(o, k2, {
1827
- enumerable: true,
1828
- get: function get() {
1829
- return m[k];
1411
+ var mixin = methodNames.reduce(function (mixin, method) {
1412
+ if (typeof service[method] !== 'function') {
1413
+ return mixin;
1830
1414
  }
1831
- });
1832
- } : function (o, m, k, k2) {
1833
- if (k2 === undefined) k2 = k;
1834
- o[k2] = m[k];
1835
- });
1836
1415
 
1837
- var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
1838
- Object.defineProperty(o, "default", {
1839
- enumerable: true,
1840
- value: v
1841
- });
1842
- } : function (o, v) {
1843
- o["default"] = v;
1844
- });
1416
+ mixin[method] = function () {
1417
+ var service = this;
1418
+ var args = Array.from(arguments);
1845
1419
 
1846
- var __importStar = this && this.__importStar || function (mod) {
1847
- if (mod && mod.__esModule) return mod;
1848
- var result = {};
1849
- if (mod != null) for (var k in mod) {
1850
- if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
1851
- }
1420
+ var original = service._super.bind(service);
1852
1421
 
1853
- __setModuleDefault(result, mod);
1422
+ return withHooks({
1423
+ app: app,
1424
+ service: service,
1425
+ method: method,
1426
+ original: original
1427
+ })({
1428
+ before: getHooks(app, service, 'before', method),
1429
+ after: getHooks(app, service, 'after', method, true),
1430
+ error: getHooks(app, service, 'error', method, true),
1431
+ finally: getHooks(app, service, 'finally', method, true)
1432
+ }).apply(void 0, _toConsumableArray(args));
1433
+ };
1854
1434
 
1855
- return result;
1856
- };
1435
+ return mixin;
1436
+ }, {}); // Add .hooks method and properties to the service
1857
1437
 
1858
- var __exportStar = this && this.__exportStar || function (m, exports) {
1859
- for (var p in m) {
1860
- if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
1861
- }
1438
+ enableHooks(service, methodNames, app.hookTypes);
1439
+ service.mixin(mixin);
1862
1440
  };
1863
1441
 
1864
- Object.defineProperty(exports, "__esModule", {
1865
- value: true
1866
- });
1867
- exports.hooks = void 0;
1442
+ module.exports = function () {
1443
+ return function (app) {
1444
+ // We store a reference of all supported hook types on the app
1445
+ // in case someone needs it
1446
+ Object.assign(app, {
1447
+ hookTypes: ['before', 'after', 'error', 'finally']
1448
+ }); // Add functionality for hooks to be registered as app.hooks
1868
1449
 
1869
- var hookUtils = __importStar(__webpack_require__(/*! ./hooks */ "../commons/lib/hooks.js"));
1450
+ enableHooks(app, app.methods, app.hookTypes);
1451
+ app.mixins.push(hookMixin);
1452
+ };
1453
+ };
1870
1454
 
1871
- __exportStar(__webpack_require__(/*! ./utils */ "../commons/lib/utils.js"), exports);
1455
+ module.exports.withHooks = withHooks;
1456
+ module.exports.ACTIVATE_HOOKS = ACTIVATE_HOOKS;
1872
1457
 
1873
- exports.hooks = hookUtils;
1458
+ module.exports.activateHooks = function activateHooks(args) {
1459
+ return function (fn) {
1460
+ Object.defineProperty(fn, ACTIVATE_HOOKS, {
1461
+ value: args
1462
+ });
1463
+ return fn;
1464
+ };
1465
+ };
1874
1466
 
1875
1467
  /***/ }),
1876
1468
 
1877
- /***/ "../commons/lib/utils.js":
1878
- /*!*******************************!*\
1879
- !*** ../commons/lib/utils.js ***!
1880
- \*******************************/
1881
- /*! no static exports found */
1882
- /***/ (function(module, exports, __webpack_require__) {
1469
+ /***/ "../feathers/lib/index.js":
1470
+ /*!********************************!*\
1471
+ !*** ../feathers/lib/index.js ***!
1472
+ \********************************/
1473
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
1883
1474
 
1884
- "use strict";
1885
- /* WEBPACK VAR INJECTION */(function(process) {
1475
+ var Proto = __webpack_require__(/*! uberproto */ "../../node_modules/uberproto/lib/proto.js");
1886
1476
 
1887
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1477
+ var Application = __webpack_require__(/*! ./application */ "../feathers/lib/application.js");
1888
1478
 
1889
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
1479
+ var version = __webpack_require__(/*! ./version */ "../feathers/lib/version.js");
1890
1480
 
1891
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
1481
+ var _require = __webpack_require__(/*! ./hooks */ "../feathers/lib/hooks/index.js"),
1482
+ ACTIVATE_HOOKS = _require.ACTIVATE_HOOKS,
1483
+ activateHooks = _require.activateHooks; // A base object Prototype that does not inherit from a
1484
+ // potentially polluted Object prototype
1892
1485
 
1893
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
1894
1486
 
1895
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
1487
+ var baseObject = Object.create(null);
1896
1488
 
1897
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
1489
+ function createApplication() {
1490
+ var app = Object.create(baseObject); // Mix in the base application
1898
1491
 
1899
- function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
1492
+ Proto.mixin(Application, app);
1493
+ app.init();
1494
+ return app;
1495
+ }
1900
1496
 
1901
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
1497
+ createApplication.version = version;
1498
+ createApplication.ACTIVATE_HOOKS = ACTIVATE_HOOKS;
1499
+ createApplication.activateHooks = activateHooks;
1500
+ module.exports = createApplication; // For better ES module (TypeScript) compatibility
1902
1501
 
1903
- Object.defineProperty(exports, "__esModule", {
1904
- value: true
1905
- });
1906
- exports.createSymbol = exports.makeUrl = exports.isPromise = exports._ = exports.stripSlashes = void 0; // Removes all leading and trailing slashes from a path
1502
+ module.exports["default"] = createApplication;
1907
1503
 
1908
- function stripSlashes(name) {
1909
- return name.replace(/^(\/+)|(\/+)$/g, '');
1910
- }
1504
+ /***/ }),
1911
1505
 
1912
- exports.stripSlashes = stripSlashes; // A set of lodash-y utility functions that use ES6
1506
+ /***/ "../feathers/lib/version.js":
1507
+ /*!**********************************!*\
1508
+ !*** ../feathers/lib/version.js ***!
1509
+ \**********************************/
1510
+ /***/ (function(module) {
1913
1511
 
1914
- exports._ = {
1915
- each: function each(obj, callback) {
1916
- if (obj && typeof obj.forEach === 'function') {
1917
- obj.forEach(callback);
1918
- } else if (exports._.isObject(obj)) {
1919
- Object.keys(obj).forEach(function (key) {
1920
- return callback(obj[key], key);
1921
- });
1922
- }
1923
- },
1924
- some: function some(value, callback) {
1925
- return Object.keys(value).map(function (key) {
1926
- return [value[key], key];
1927
- }).some(function (_ref) {
1928
- var _ref2 = _slicedToArray(_ref, 2),
1929
- val = _ref2[0],
1930
- key = _ref2[1];
1512
+ module.exports = '4.5.12';
1931
1513
 
1932
- return callback(val, key);
1933
- });
1934
- },
1935
- every: function every(value, callback) {
1936
- return Object.keys(value).map(function (key) {
1937
- return [value[key], key];
1938
- }).every(function (_ref3) {
1939
- var _ref4 = _slicedToArray(_ref3, 2),
1940
- val = _ref4[0],
1941
- key = _ref4[1];
1514
+ /***/ }),
1942
1515
 
1943
- return callback(val, key);
1944
- });
1945
- },
1946
- keys: function keys(obj) {
1947
- return Object.keys(obj);
1948
- },
1949
- values: function values(obj) {
1950
- return exports._.keys(obj).map(function (key) {
1951
- return obj[key];
1952
- });
1953
- },
1954
- isMatch: function isMatch(obj, item) {
1955
- return exports._.keys(item).every(function (key) {
1956
- return obj[key] === item[key];
1957
- });
1958
- },
1959
- isEmpty: function isEmpty(obj) {
1960
- return exports._.keys(obj).length === 0;
1961
- },
1962
- isObject: function isObject(item) {
1963
- return _typeof(item) === 'object' && !Array.isArray(item) && item !== null;
1964
- },
1965
- isObjectOrArray: function isObjectOrArray(value) {
1966
- return _typeof(value) === 'object' && value !== null;
1967
- },
1968
- extend: function extend(first) {
1969
- for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1970
- rest[_key - 1] = arguments[_key];
1971
- }
1972
-
1973
- return Object.assign.apply(Object, [first].concat(rest));
1974
- },
1975
- omit: function omit(obj) {
1976
- var result = exports._.extend({}, obj);
1977
-
1978
- for (var _len2 = arguments.length, keys = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
1979
- keys[_key2 - 1] = arguments[_key2];
1980
- }
1981
-
1982
- keys.forEach(function (key) {
1983
- return delete result[key];
1984
- });
1985
- return result;
1986
- },
1987
- pick: function pick(source) {
1988
- for (var _len3 = arguments.length, keys = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
1989
- keys[_key3 - 1] = arguments[_key3];
1990
- }
1516
+ /***/ "../../node_modules/events/events.js":
1517
+ /*!*******************************************!*\
1518
+ !*** ../../node_modules/events/events.js ***!
1519
+ \*******************************************/
1520
+ /***/ (function(module) {
1991
1521
 
1992
- return keys.reduce(function (result, key) {
1993
- if (source[key] !== undefined) {
1994
- result[key] = source[key];
1995
- }
1522
+ "use strict";
1523
+ // Copyright Joyent, Inc. and other Node contributors.
1524
+ //
1525
+ // Permission is hereby granted, free of charge, to any person obtaining a
1526
+ // copy of this software and associated documentation files (the
1527
+ // "Software"), to deal in the Software without restriction, including
1528
+ // without limitation the rights to use, copy, modify, merge, publish,
1529
+ // distribute, sublicense, and/or sell copies of the Software, and to permit
1530
+ // persons to whom the Software is furnished to do so, subject to the
1531
+ // following conditions:
1532
+ //
1533
+ // The above copyright notice and this permission notice shall be included
1534
+ // in all copies or substantial portions of the Software.
1535
+ //
1536
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1537
+ // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1538
+ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
1539
+ // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
1540
+ // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
1541
+ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
1542
+ // USE OR OTHER DEALINGS IN THE SOFTWARE.
1996
1543
 
1997
- return result;
1998
- }, {});
1999
- },
2000
- // Recursively merge the source object into the target object
2001
- merge: function merge(target, source) {
2002
- if (exports._.isObject(target) && exports._.isObject(source)) {
2003
- Object.keys(source).forEach(function (key) {
2004
- if (exports._.isObject(source[key])) {
2005
- if (!target[key]) {
2006
- Object.assign(target, _defineProperty({}, key, {}));
2007
- }
2008
1544
 
2009
- exports._.merge(target[key], source[key]);
2010
- } else {
2011
- Object.assign(target, _defineProperty({}, key, source[key]));
2012
- }
2013
- });
2014
- }
2015
1545
 
2016
- return target;
1546
+ var R = typeof Reflect === 'object' ? Reflect : null
1547
+ var ReflectApply = R && typeof R.apply === 'function'
1548
+ ? R.apply
1549
+ : function ReflectApply(target, receiver, args) {
1550
+ return Function.prototype.apply.call(target, receiver, args);
2017
1551
  }
2018
- }; // Duck-checks if an object looks like a promise
2019
1552
 
2020
- function isPromise(result) {
2021
- return exports._.isObject(result) && typeof result.then === 'function';
1553
+ var ReflectOwnKeys
1554
+ if (R && typeof R.ownKeys === 'function') {
1555
+ ReflectOwnKeys = R.ownKeys
1556
+ } else if (Object.getOwnPropertySymbols) {
1557
+ ReflectOwnKeys = function ReflectOwnKeys(target) {
1558
+ return Object.getOwnPropertyNames(target)
1559
+ .concat(Object.getOwnPropertySymbols(target));
1560
+ };
1561
+ } else {
1562
+ ReflectOwnKeys = function ReflectOwnKeys(target) {
1563
+ return Object.getOwnPropertyNames(target);
1564
+ };
2022
1565
  }
2023
1566
 
2024
- exports.isPromise = isPromise;
2025
-
2026
- function makeUrl(path) {
2027
- var app = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2028
- var get = typeof app.get === 'function' ? app.get.bind(app) : function () {};
2029
- var env = get('env') || "development";
2030
- var host = get('host') || process.env.HOST_NAME || 'localhost';
2031
- var protocol = env === 'development' || env === 'test' || env === undefined ? 'http' : 'https';
2032
- var PORT = get('port') || process.env.PORT || 3030;
2033
- var port = env === 'development' || env === 'test' || env === undefined ? ":".concat(PORT) : '';
2034
- path = path || '';
2035
- return "".concat(protocol, "://").concat(host).concat(port, "/").concat(exports.stripSlashes(path));
1567
+ function ProcessEmitWarning(warning) {
1568
+ if (console && console.warn) console.warn(warning);
2036
1569
  }
2037
1570
 
2038
- exports.makeUrl = makeUrl;
2039
-
2040
- function createSymbol(name) {
2041
- return typeof Symbol !== 'undefined' ? Symbol(name) : name;
1571
+ var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {
1572
+ return value !== value;
2042
1573
  }
2043
1574
 
2044
- exports.createSymbol = createSymbol;
2045
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../node_modules/process/browser.js */ "../../node_modules/process/browser.js")))
2046
-
2047
- /***/ }),
2048
-
2049
- /***/ "../feathers/lib/application.js":
2050
- /*!**************************************!*\
2051
- !*** ../feathers/lib/application.js ***!
2052
- \**************************************/
2053
- /*! no static exports found */
2054
- /***/ (function(module, exports, __webpack_require__) {
2055
-
2056
- var debug = __webpack_require__(/*! debug */ "../../node_modules/debug/src/browser.js")('feathers:application');
2057
-
2058
- var _require = __webpack_require__(/*! @feathersjs/commons */ "../commons/lib/index.js"),
2059
- stripSlashes = _require.stripSlashes;
1575
+ function EventEmitter() {
1576
+ EventEmitter.init.call(this);
1577
+ }
1578
+ module.exports = EventEmitter;
1579
+ module.exports.once = once;
2060
1580
 
2061
- var Uberproto = __webpack_require__(/*! uberproto */ "../../node_modules/uberproto/lib/proto.js");
1581
+ // Backwards-compat with node 0.10.x
1582
+ EventEmitter.EventEmitter = EventEmitter;
2062
1583
 
2063
- var events = __webpack_require__(/*! ./events */ "../feathers/lib/events.js");
1584
+ EventEmitter.prototype._events = undefined;
1585
+ EventEmitter.prototype._eventsCount = 0;
1586
+ EventEmitter.prototype._maxListeners = undefined;
2064
1587
 
2065
- var hooks = __webpack_require__(/*! ./hooks */ "../feathers/lib/hooks/index.js");
1588
+ // By default EventEmitters will print a warning if more than 10 listeners are
1589
+ // added to it. This is a useful default which helps finding memory leaks.
1590
+ var defaultMaxListeners = 10;
2066
1591
 
2067
- var version = __webpack_require__(/*! ./version */ "../feathers/lib/version.js");
1592
+ function checkListener(listener) {
1593
+ if (typeof listener !== 'function') {
1594
+ throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
1595
+ }
1596
+ }
2068
1597
 
2069
- var Proto = Uberproto.extend({
2070
- create: null
2071
- });
2072
- var application = {
2073
- init: function init() {
2074
- Object.assign(this, {
2075
- version: version,
2076
- methods: ['find', 'get', 'create', 'update', 'patch', 'remove'],
2077
- mixins: [],
2078
- services: {},
2079
- providers: [],
2080
- _setup: false,
2081
- settings: {}
2082
- });
2083
- this.configure(hooks());
2084
- this.configure(events());
2085
- },
2086
- get: function get(name) {
2087
- return this.settings[name];
2088
- },
2089
- set: function set(name, value) {
2090
- this.settings[name] = value;
2091
- return this;
2092
- },
2093
- disable: function disable(name) {
2094
- this.settings[name] = false;
2095
- return this;
2096
- },
2097
- disabled: function disabled(name) {
2098
- return !this.settings[name];
2099
- },
2100
- enable: function enable(name) {
2101
- this.settings[name] = true;
2102
- return this;
2103
- },
2104
- enabled: function enabled(name) {
2105
- return !!this.settings[name];
2106
- },
2107
- configure: function configure(fn) {
2108
- fn.call(this, this);
2109
- return this;
1598
+ Object.defineProperty(EventEmitter, 'defaultMaxListeners', {
1599
+ enumerable: true,
1600
+ get: function() {
1601
+ return defaultMaxListeners;
2110
1602
  },
2111
- service: function service(path, _service) {
2112
- if (typeof _service !== 'undefined') {
2113
- throw new Error('Registering a new service with `app.service(path, service)` is no longer supported. Use `app.use(path, service)` instead.');
1603
+ set: function(arg) {
1604
+ if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {
1605
+ throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.');
2114
1606
  }
1607
+ defaultMaxListeners = arg;
1608
+ }
1609
+ });
2115
1610
 
2116
- var location = stripSlashes(path) || '/';
2117
- var current = this.services[location];
1611
+ EventEmitter.init = function() {
2118
1612
 
2119
- if (typeof current === 'undefined' && typeof this.defaultService === 'function') {
2120
- return this.use(location, this.defaultService(location)).service(location);
2121
- }
1613
+ if (this._events === undefined ||
1614
+ this._events === Object.getPrototypeOf(this)._events) {
1615
+ this._events = Object.create(null);
1616
+ this._eventsCount = 0;
1617
+ }
2122
1618
 
2123
- return current;
2124
- },
2125
- use: function use(path, service) {
2126
- var _this = this;
1619
+ this._maxListeners = this._maxListeners || undefined;
1620
+ };
2127
1621
 
2128
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1622
+ // Obviously not all Emitters should be limited to 10. This function allows
1623
+ // that to be increased. Set to zero for unlimited.
1624
+ EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
1625
+ if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {
1626
+ throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.');
1627
+ }
1628
+ this._maxListeners = n;
1629
+ return this;
1630
+ };
2129
1631
 
2130
- if (typeof path !== 'string') {
2131
- throw new Error("'".concat(path, "' is not a valid service path."));
2132
- }
1632
+ function _getMaxListeners(that) {
1633
+ if (that._maxListeners === undefined)
1634
+ return EventEmitter.defaultMaxListeners;
1635
+ return that._maxListeners;
1636
+ }
2133
1637
 
2134
- var location = stripSlashes(path) || '/';
2135
- var isSubApp = typeof service.service === 'function' && service.services;
2136
- var isService = this.methods.concat('setup').some(function (name) {
2137
- return typeof service[name] === 'function';
2138
- });
1638
+ EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
1639
+ return _getMaxListeners(this);
1640
+ };
2139
1641
 
2140
- if (isSubApp) {
2141
- var subApp = service;
2142
- Object.keys(subApp.services).forEach(function (subPath) {
2143
- return _this.use("".concat(location, "/").concat(subPath), subApp.service(subPath));
2144
- });
2145
- return this;
1642
+ EventEmitter.prototype.emit = function emit(type) {
1643
+ var args = [];
1644
+ for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);
1645
+ var doError = (type === 'error');
1646
+
1647
+ var events = this._events;
1648
+ if (events !== undefined)
1649
+ doError = (doError && events.error === undefined);
1650
+ else if (!doError)
1651
+ return false;
1652
+
1653
+ // If there is no 'error' event listener then throw.
1654
+ if (doError) {
1655
+ var er;
1656
+ if (args.length > 0)
1657
+ er = args[0];
1658
+ if (er instanceof Error) {
1659
+ // Note: The comments on the `throw` lines are intentional, they show
1660
+ // up in Node's output if this results in an unhandled exception.
1661
+ throw er; // Unhandled 'error' event
2146
1662
  }
1663
+ // At least give some kind of context to the user
1664
+ var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));
1665
+ err.context = er;
1666
+ throw err; // Unhandled 'error' event
1667
+ }
2147
1668
 
2148
- if (!isService) {
2149
- throw new Error("Invalid service object passed for path `".concat(location, "`"));
2150
- } // If the service is already Uberproto'd use it directly
1669
+ var handler = events[type];
2151
1670
 
1671
+ if (handler === undefined)
1672
+ return false;
2152
1673
 
2153
- var protoService = Proto.isPrototypeOf(service) ? service : Proto.extend(service);
2154
- debug("Registering new service at `".concat(location, "`")); // Add all the mixins
1674
+ if (typeof handler === 'function') {
1675
+ ReflectApply(handler, this, args);
1676
+ } else {
1677
+ var len = handler.length;
1678
+ var listeners = arrayClone(handler, len);
1679
+ for (var i = 0; i < len; ++i)
1680
+ ReflectApply(listeners[i], this, args);
1681
+ }
2155
1682
 
2156
- this.mixins.forEach(function (fn) {
2157
- return fn.call(_this, protoService, location, options);
2158
- });
1683
+ return true;
1684
+ };
2159
1685
 
2160
- if (typeof protoService._setup === 'function') {
2161
- protoService._setup(this, location);
2162
- } // Run the provider functions to register the service
1686
+ function _addListener(target, type, listener, prepend) {
1687
+ var m;
1688
+ var events;
1689
+ var existing;
2163
1690
 
1691
+ checkListener(listener);
2164
1692
 
2165
- this.providers.forEach(function (provider) {
2166
- return provider.call(_this, protoService, location, options);
2167
- }); // If we ran setup already, set this service up explicitly
1693
+ events = target._events;
1694
+ if (events === undefined) {
1695
+ events = target._events = Object.create(null);
1696
+ target._eventsCount = 0;
1697
+ } else {
1698
+ // To avoid recursion in the case that type === "newListener"! Before
1699
+ // adding it to the listeners, first emit "newListener".
1700
+ if (events.newListener !== undefined) {
1701
+ target.emit('newListener', type,
1702
+ listener.listener ? listener.listener : listener);
2168
1703
 
2169
- if (this._isSetup && typeof protoService.setup === 'function') {
2170
- debug("Setting up service for `".concat(location, "`"));
2171
- protoService.setup(this, location);
1704
+ // Re-assign `events` because a newListener handler could have caused the
1705
+ // this._events to be assigned to a new object
1706
+ events = target._events;
2172
1707
  }
1708
+ existing = events[type];
1709
+ }
2173
1710
 
2174
- this.services[location] = protoService;
2175
- return this;
2176
- },
2177
- setup: function setup() {
2178
- var _this2 = this;
2179
-
2180
- // Setup each service (pass the app so that they can look up other services etc.)
2181
- Object.keys(this.services).forEach(function (path) {
2182
- var service = _this2.services[path];
2183
- debug("Setting up service for `".concat(path, "`"));
1711
+ if (existing === undefined) {
1712
+ // Optimize the case of one listener. Don't need the extra array object.
1713
+ existing = events[type] = listener;
1714
+ ++target._eventsCount;
1715
+ } else {
1716
+ if (typeof existing === 'function') {
1717
+ // Adding the second element, need to change to array.
1718
+ existing = events[type] =
1719
+ prepend ? [listener, existing] : [existing, listener];
1720
+ // If we've already got an array, just append.
1721
+ } else if (prepend) {
1722
+ existing.unshift(listener);
1723
+ } else {
1724
+ existing.push(listener);
1725
+ }
2184
1726
 
2185
- if (typeof service.setup === 'function') {
2186
- service.setup(_this2, path);
2187
- }
2188
- });
2189
- this._isSetup = true;
2190
- return this;
1727
+ // Check for listener leak
1728
+ m = _getMaxListeners(target);
1729
+ if (m > 0 && existing.length > m && !existing.warned) {
1730
+ existing.warned = true;
1731
+ // No error code for this since it is a Warning
1732
+ // eslint-disable-next-line no-restricted-syntax
1733
+ var w = new Error('Possible EventEmitter memory leak detected. ' +
1734
+ existing.length + ' ' + String(type) + ' listeners ' +
1735
+ 'added. Use emitter.setMaxListeners() to ' +
1736
+ 'increase limit');
1737
+ w.name = 'MaxListenersExceededWarning';
1738
+ w.emitter = target;
1739
+ w.type = type;
1740
+ w.count = existing.length;
1741
+ ProcessEmitWarning(w);
1742
+ }
2191
1743
  }
1744
+
1745
+ return target;
1746
+ }
1747
+
1748
+ EventEmitter.prototype.addListener = function addListener(type, listener) {
1749
+ return _addListener(this, type, listener, false);
2192
1750
  };
2193
- module.exports = application;
2194
1751
 
2195
- /***/ }),
1752
+ EventEmitter.prototype.on = EventEmitter.prototype.addListener;
2196
1753
 
2197
- /***/ "../feathers/lib/events.js":
2198
- /*!*********************************!*\
2199
- !*** ../feathers/lib/events.js ***!
2200
- \*********************************/
2201
- /*! no static exports found */
2202
- /***/ (function(module, exports, __webpack_require__) {
1754
+ EventEmitter.prototype.prependListener =
1755
+ function prependListener(type, listener) {
1756
+ return _addListener(this, type, listener, true);
1757
+ };
2203
1758
 
2204
- var _require = __webpack_require__(/*! events */ "../../node_modules/events/events.js"),
2205
- EventEmitter = _require.EventEmitter;
1759
+ function onceWrapper() {
1760
+ if (!this.fired) {
1761
+ this.target.removeListener(this.type, this.wrapFn);
1762
+ this.fired = true;
1763
+ if (arguments.length === 0)
1764
+ return this.listener.call(this.target);
1765
+ return this.listener.apply(this.target, arguments);
1766
+ }
1767
+ }
2206
1768
 
2207
- var Proto = __webpack_require__(/*! uberproto */ "../../node_modules/uberproto/lib/proto.js"); // Returns a hook that emits service events. Should always be
2208
- // used as the very last hook in the chain
1769
+ function _onceWrap(target, type, listener) {
1770
+ var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };
1771
+ var wrapped = onceWrapper.bind(state);
1772
+ wrapped.listener = listener;
1773
+ state.wrapFn = wrapped;
1774
+ return wrapped;
1775
+ }
2209
1776
 
1777
+ EventEmitter.prototype.once = function once(type, listener) {
1778
+ checkListener(listener);
1779
+ this.on(type, _onceWrap(this, type, listener));
1780
+ return this;
1781
+ };
2210
1782
 
2211
- var eventHook = exports.eventHook = function eventHook() {
2212
- return function (hook) {
2213
- var app = hook.app,
2214
- service = hook.service;
2215
- var eventName = hook.event === null ? hook.event : app.eventMappings[hook.method];
2216
- var isHookEvent = service._hookEvents && service._hookEvents.indexOf(eventName) !== -1; // If this event is not being sent yet and we are not in an error hook
1783
+ EventEmitter.prototype.prependOnceListener =
1784
+ function prependOnceListener(type, listener) {
1785
+ checkListener(listener);
1786
+ this.prependListener(type, _onceWrap(this, type, listener));
1787
+ return this;
1788
+ };
2217
1789
 
2218
- if (eventName && isHookEvent && hook.type !== 'error') {
2219
- var results = Array.isArray(hook.result) ? hook.result : [hook.result];
2220
- results.forEach(function (element) {
2221
- return service.emit(eventName, element, hook);
2222
- });
2223
- }
2224
- };
2225
- }; // Mixin that turns a service into a Node event emitter
1790
+ // Emits a 'removeListener' event if and only if the listener was removed.
1791
+ EventEmitter.prototype.removeListener =
1792
+ function removeListener(type, listener) {
1793
+ var list, events, position, i, originalListener;
2226
1794
 
1795
+ checkListener(listener);
2227
1796
 
2228
- var eventMixin = exports.eventMixin = function eventMixin(service) {
2229
- if (service._serviceEvents) {
2230
- return;
2231
- }
1797
+ events = this._events;
1798
+ if (events === undefined)
1799
+ return this;
2232
1800
 
2233
- var app = this; // Indicates if the service is already an event emitter
1801
+ list = events[type];
1802
+ if (list === undefined)
1803
+ return this;
2234
1804
 
2235
- var isEmitter = typeof service.on === 'function' && typeof service.emit === 'function'; // If not, mix it in (the service is always an Uberproto object that has a .mixin)
1805
+ if (list === listener || list.listener === listener) {
1806
+ if (--this._eventsCount === 0)
1807
+ this._events = Object.create(null);
1808
+ else {
1809
+ delete events[type];
1810
+ if (events.removeListener)
1811
+ this.emit('removeListener', type, list.listener || listener);
1812
+ }
1813
+ } else if (typeof list !== 'function') {
1814
+ position = -1;
2236
1815
 
2237
- if (typeof service.mixin === 'function' && !isEmitter) {
2238
- service.mixin(EventEmitter.prototype);
2239
- } // Define non-enumerable properties of
1816
+ for (i = list.length - 1; i >= 0; i--) {
1817
+ if (list[i] === listener || list[i].listener === listener) {
1818
+ originalListener = list[i].listener;
1819
+ position = i;
1820
+ break;
1821
+ }
1822
+ }
2240
1823
 
1824
+ if (position < 0)
1825
+ return this;
2241
1826
 
2242
- Object.defineProperties(service, {
2243
- // A list of all events that this service sends
2244
- _serviceEvents: {
2245
- value: Array.isArray(service.events) ? service.events.slice() : []
2246
- },
2247
- // A list of events that should be handled through the event hooks
2248
- _hookEvents: {
2249
- value: []
2250
- }
2251
- }); // `app.eventMappings` has the mapping from method name to event name
1827
+ if (position === 0)
1828
+ list.shift();
1829
+ else {
1830
+ spliceOne(list, position);
1831
+ }
2252
1832
 
2253
- Object.keys(app.eventMappings).forEach(function (method) {
2254
- var event = app.eventMappings[method];
2255
- var alreadyEmits = service._serviceEvents.indexOf(event) !== -1; // Add events for known methods to _serviceEvents and _hookEvents
2256
- // if the service indicated it does not send it itself yet
1833
+ if (list.length === 1)
1834
+ events[type] = list[0];
2257
1835
 
2258
- if (typeof service[method] === 'function' && !alreadyEmits) {
2259
- service._serviceEvents.push(event);
1836
+ if (events.removeListener !== undefined)
1837
+ this.emit('removeListener', type, originalListener || listener);
1838
+ }
2260
1839
 
2261
- service._hookEvents.push(event);
2262
- }
2263
- });
2264
- };
1840
+ return this;
1841
+ };
2265
1842
 
2266
- module.exports = function () {
2267
- return function (app) {
2268
- // Mappings from service method to event name
2269
- Object.assign(app, {
2270
- eventMappings: {
2271
- create: 'created',
2272
- update: 'updated',
2273
- remove: 'removed',
2274
- patch: 'patched'
2275
- }
2276
- }); // Register the event hook
2277
- // `finally` hooks always run last after `error` and `after` hooks
1843
+ EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
2278
1844
 
2279
- app.hooks({
2280
- finally: eventHook()
2281
- }); // Make the app an event emitter
1845
+ EventEmitter.prototype.removeAllListeners =
1846
+ function removeAllListeners(type) {
1847
+ var listeners, events, i;
2282
1848
 
2283
- Proto.mixin(EventEmitter.prototype, app);
2284
- app.mixins.push(eventMixin);
2285
- };
2286
- };
1849
+ events = this._events;
1850
+ if (events === undefined)
1851
+ return this;
2287
1852
 
2288
- /***/ }),
1853
+ // not listening for removeListener, no need to emit
1854
+ if (events.removeListener === undefined) {
1855
+ if (arguments.length === 0) {
1856
+ this._events = Object.create(null);
1857
+ this._eventsCount = 0;
1858
+ } else if (events[type] !== undefined) {
1859
+ if (--this._eventsCount === 0)
1860
+ this._events = Object.create(null);
1861
+ else
1862
+ delete events[type];
1863
+ }
1864
+ return this;
1865
+ }
2289
1866
 
2290
- /***/ "../feathers/lib/hooks/base.js":
2291
- /*!*************************************!*\
2292
- !*** ../feathers/lib/hooks/base.js ***!
2293
- \*************************************/
2294
- /*! no static exports found */
2295
- /***/ (function(module, exports, __webpack_require__) {
1867
+ // emit removeListener for all listeners on all events
1868
+ if (arguments.length === 0) {
1869
+ var keys = Object.keys(events);
1870
+ var key;
1871
+ for (i = 0; i < keys.length; ++i) {
1872
+ key = keys[i];
1873
+ if (key === 'removeListener') continue;
1874
+ this.removeAllListeners(key);
1875
+ }
1876
+ this.removeAllListeners('removeListener');
1877
+ this._events = Object.create(null);
1878
+ this._eventsCount = 0;
1879
+ return this;
1880
+ }
2296
1881
 
2297
- var _require = __webpack_require__(/*! @feathersjs/commons */ "../commons/lib/index.js"),
2298
- _ = _require._;
1882
+ listeners = events[type];
2299
1883
 
2300
- var assignArguments = function assignArguments(context) {
2301
- var service = context.service,
2302
- method = context.method;
2303
- var parameters = service.methods[method];
2304
- context.arguments.forEach(function (value, index) {
2305
- context[parameters[index]] = value;
2306
- });
1884
+ if (typeof listeners === 'function') {
1885
+ this.removeListener(type, listeners);
1886
+ } else if (listeners !== undefined) {
1887
+ // LIFO order
1888
+ for (i = listeners.length - 1; i >= 0; i--) {
1889
+ this.removeListener(type, listeners[i]);
1890
+ }
1891
+ }
2307
1892
 
2308
- if (!context.params) {
2309
- context.params = {};
2310
- }
1893
+ return this;
1894
+ };
2311
1895
 
2312
- return context;
2313
- };
1896
+ function _listeners(target, type, unwrap) {
1897
+ var events = target._events;
2314
1898
 
2315
- var validate = function validate(context) {
2316
- var service = context.service,
2317
- method = context.method,
2318
- path = context.path;
2319
- var parameters = service.methods[method];
1899
+ if (events === undefined)
1900
+ return [];
2320
1901
 
2321
- if (parameters.includes('id') && context.id === undefined) {
2322
- throw new Error("An id must be provided to the '".concat(path, ".").concat(method, "' method"));
2323
- }
1902
+ var evlistener = events[type];
1903
+ if (evlistener === undefined)
1904
+ return [];
2324
1905
 
2325
- if (parameters.includes('data') && !_.isObjectOrArray(context.data)) {
2326
- throw new Error("A data object must be provided to the '".concat(path, ".").concat(method, "' method"));
2327
- }
1906
+ if (typeof evlistener === 'function')
1907
+ return unwrap ? [evlistener.listener || evlistener] : [evlistener];
2328
1908
 
2329
- return context;
1909
+ return unwrap ?
1910
+ unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
1911
+ }
1912
+
1913
+ EventEmitter.prototype.listeners = function listeners(type) {
1914
+ return _listeners(this, type, true);
2330
1915
  };
2331
1916
 
2332
- module.exports = [assignArguments, validate];
1917
+ EventEmitter.prototype.rawListeners = function rawListeners(type) {
1918
+ return _listeners(this, type, false);
1919
+ };
2333
1920
 
2334
- /***/ }),
1921
+ EventEmitter.listenerCount = function(emitter, type) {
1922
+ if (typeof emitter.listenerCount === 'function') {
1923
+ return emitter.listenerCount(type);
1924
+ } else {
1925
+ return listenerCount.call(emitter, type);
1926
+ }
1927
+ };
2335
1928
 
2336
- /***/ "../feathers/lib/hooks/index.js":
2337
- /*!**************************************!*\
2338
- !*** ../feathers/lib/hooks/index.js ***!
2339
- \**************************************/
2340
- /*! no static exports found */
2341
- /***/ (function(module, exports, __webpack_require__) {
1929
+ EventEmitter.prototype.listenerCount = listenerCount;
1930
+ function listenerCount(type) {
1931
+ var events = this._events;
2342
1932
 
2343
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
1933
+ if (events !== undefined) {
1934
+ var evlistener = events[type];
2344
1935
 
2345
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
1936
+ if (typeof evlistener === 'function') {
1937
+ return 1;
1938
+ } else if (evlistener !== undefined) {
1939
+ return evlistener.length;
1940
+ }
1941
+ }
2346
1942
 
2347
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
1943
+ return 0;
1944
+ }
2348
1945
 
2349
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
1946
+ EventEmitter.prototype.eventNames = function eventNames() {
1947
+ return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];
1948
+ };
2350
1949
 
2351
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
1950
+ function arrayClone(arr, n) {
1951
+ var copy = new Array(n);
1952
+ for (var i = 0; i < n; ++i)
1953
+ copy[i] = arr[i];
1954
+ return copy;
1955
+ }
2352
1956
 
2353
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
1957
+ function spliceOne(list, index) {
1958
+ for (; index + 1 < list.length; index++)
1959
+ list[index] = list[index + 1];
1960
+ list.pop();
1961
+ }
2354
1962
 
2355
- var _require = __webpack_require__(/*! @feathersjs/commons */ "../commons/lib/index.js"),
2356
- hooks = _require.hooks,
2357
- isPromise = _require.isPromise;
1963
+ function unwrapListeners(arr) {
1964
+ var ret = new Array(arr.length);
1965
+ for (var i = 0; i < ret.length; ++i) {
1966
+ ret[i] = arr[i].listener || arr[i];
1967
+ }
1968
+ return ret;
1969
+ }
2358
1970
 
2359
- var baseHooks = __webpack_require__(/*! ./base */ "../feathers/lib/hooks/base.js");
1971
+ function once(emitter, name) {
1972
+ return new Promise(function (resolve, reject) {
1973
+ function errorListener(err) {
1974
+ emitter.removeListener(name, resolver);
1975
+ reject(err);
1976
+ }
2360
1977
 
2361
- var createHookObject = hooks.createHookObject,
2362
- getHooks = hooks.getHooks,
2363
- processHooks = hooks.processHooks,
2364
- enableHooks = hooks.enableHooks,
2365
- ACTIVATE_HOOKS = hooks.ACTIVATE_HOOKS;
1978
+ function resolver() {
1979
+ if (typeof emitter.removeListener === 'function') {
1980
+ emitter.removeListener('error', errorListener);
1981
+ }
1982
+ resolve([].slice.call(arguments));
1983
+ };
2366
1984
 
2367
- var withHooks = function withHooks(_ref) {
2368
- var app = _ref.app,
2369
- service = _ref.service,
2370
- method = _ref.method,
2371
- original = _ref.original;
2372
- return function () {
2373
- var _hooks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1985
+ eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });
1986
+ if (name !== 'error') {
1987
+ addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });
1988
+ }
1989
+ });
1990
+ }
2374
1991
 
2375
- var hooks = app.hookTypes.reduce(function (result, type) {
2376
- var value = _hooks[type] || [];
2377
- result[type] = Array.isArray(value) ? value : [value];
2378
- return result;
2379
- }, {});
2380
- return function () {
2381
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2382
- args[_key] = arguments[_key];
1992
+ function addErrorHandlerIfEventEmitter(emitter, handler, flags) {
1993
+ if (typeof emitter.on === 'function') {
1994
+ eventTargetAgnosticAddListener(emitter, 'error', handler, flags);
1995
+ }
1996
+ }
1997
+
1998
+ function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
1999
+ if (typeof emitter.on === 'function') {
2000
+ if (flags.once) {
2001
+ emitter.once(name, listener);
2002
+ } else {
2003
+ emitter.on(name, listener);
2004
+ }
2005
+ } else if (typeof emitter.addEventListener === 'function') {
2006
+ // EventTarget does not have `error` event semantics like Node
2007
+ // EventEmitters, we do not listen for `error` events here.
2008
+ emitter.addEventListener(name, function wrapListener(arg) {
2009
+ // IE does not have builtin `{ once: true }` support so we
2010
+ // have to do it manually.
2011
+ if (flags.once) {
2012
+ emitter.removeEventListener(name, wrapListener);
2383
2013
  }
2014
+ listener(arg);
2015
+ });
2016
+ } else {
2017
+ throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter);
2018
+ }
2019
+ }
2384
2020
 
2385
- var returnHook = args[args.length - 1] === true ? args.pop() : false; // Create the hook object that gets passed through
2386
2021
 
2387
- var hookObject = createHookObject(method, {
2388
- type: 'before',
2389
- // initial hook object type
2390
- arguments: args,
2391
- service: service,
2392
- app: app
2393
- });
2394
- return Promise.resolve(hookObject) // Run `before` hooks
2395
- .then(function (hookObject) {
2396
- return processHooks.call(service, baseHooks.concat(hooks.before), hookObject);
2397
- }) // Run the original method
2398
- .then(function (hookObject) {
2399
- // If `hookObject.result` is set, skip the original method
2400
- if (typeof hookObject.result !== 'undefined') {
2401
- return hookObject;
2402
- } // Otherwise, call it with arguments created from the hook object
2022
+ /***/ }),
2403
2023
 
2024
+ /***/ "../../node_modules/ms/index.js":
2025
+ /*!**************************************!*\
2026
+ !*** ../../node_modules/ms/index.js ***!
2027
+ \**************************************/
2028
+ /***/ (function(module) {
2404
2029
 
2405
- var promise = new Promise(function (resolve) {
2406
- var func = original || service[method];
2407
- var args = service.methods[method].map(function (value) {
2408
- return hookObject[value];
2409
- });
2410
- var result = func.apply(service, args);
2030
+ /**
2031
+ * Helpers.
2032
+ */
2411
2033
 
2412
- if (!isPromise(result)) {
2413
- throw new Error("Service method '".concat(hookObject.method, "' for '").concat(hookObject.path, "' service must return a promise"));
2414
- }
2034
+ var s = 1000;
2035
+ var m = s * 60;
2036
+ var h = m * 60;
2037
+ var d = h * 24;
2038
+ var w = d * 7;
2039
+ var y = d * 365.25;
2415
2040
 
2416
- resolve(result);
2417
- });
2418
- return promise.then(function (result) {
2419
- hookObject.result = result;
2420
- return hookObject;
2421
- }).catch(function (error) {
2422
- error.hook = hookObject;
2423
- throw error;
2424
- });
2425
- }) // Run `after` hooks
2426
- .then(function (hookObject) {
2427
- var afterHookObject = Object.assign({}, hookObject, {
2428
- type: 'after'
2429
- });
2430
- return processHooks.call(service, hooks.after, afterHookObject);
2431
- }) // Run `errors` hooks
2432
- .catch(function (error) {
2433
- var errorHookObject = Object.assign({}, error.hook, {
2434
- type: 'error',
2435
- original: error.hook,
2436
- error: error,
2437
- result: undefined
2438
- });
2439
- return processHooks.call(service, hooks.error, errorHookObject).catch(function (error) {
2440
- var errorHookObject = Object.assign({}, error.hook, {
2441
- error: error,
2442
- result: undefined
2443
- });
2444
- return errorHookObject;
2445
- });
2446
- }) // Run `finally` hooks
2447
- .then(function (hookObject) {
2448
- return processHooks.call(service, hooks.finally, hookObject).catch(function (error) {
2449
- var errorHookObject = Object.assign({}, error.hook, {
2450
- error: error,
2451
- result: undefined
2452
- });
2453
- return errorHookObject;
2454
- });
2455
- }) // Resolve with a result or reject with an error
2456
- .then(function (hookObject) {
2457
- if (typeof hookObject.error !== 'undefined' && typeof hookObject.result === 'undefined') {
2458
- return Promise.reject(returnHook ? hookObject : hookObject.error);
2459
- } else {
2460
- return returnHook ? hookObject : hookObject.result;
2461
- }
2462
- });
2463
- };
2464
- };
2465
- }; // A service mixin that adds `service.hooks()` method and functionality
2041
+ /**
2042
+ * Parse or format the given `val`.
2043
+ *
2044
+ * Options:
2045
+ *
2046
+ * - `long` verbose formatting [false]
2047
+ *
2048
+ * @param {String|Number} val
2049
+ * @param {Object} [options]
2050
+ * @throws {Error} throw an error if val is not a non-empty string or a number
2051
+ * @return {String|Number}
2052
+ * @api public
2053
+ */
2054
+
2055
+ module.exports = function(val, options) {
2056
+ options = options || {};
2057
+ var type = typeof val;
2058
+ if (type === 'string' && val.length > 0) {
2059
+ return parse(val);
2060
+ } else if (type === 'number' && isFinite(val)) {
2061
+ return options.long ? fmtLong(val) : fmtShort(val);
2062
+ }
2063
+ throw new Error(
2064
+ 'val is not a non-empty string or a valid number. val=' +
2065
+ JSON.stringify(val)
2066
+ );
2067
+ };
2466
2068
 
2069
+ /**
2070
+ * Parse the given `str` and return milliseconds.
2071
+ *
2072
+ * @param {String} str
2073
+ * @return {Number}
2074
+ * @api private
2075
+ */
2467
2076
 
2468
- var hookMixin = exports.hookMixin = function hookMixin(service) {
2469
- if (typeof service.hooks === 'function') {
2077
+ function parse(str) {
2078
+ str = String(str);
2079
+ if (str.length > 100) {
2080
+ return;
2081
+ }
2082
+ var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
2083
+ str
2084
+ );
2085
+ if (!match) {
2470
2086
  return;
2471
2087
  }
2088
+ var n = parseFloat(match[1]);
2089
+ var type = (match[2] || 'ms').toLowerCase();
2090
+ switch (type) {
2091
+ case 'years':
2092
+ case 'year':
2093
+ case 'yrs':
2094
+ case 'yr':
2095
+ case 'y':
2096
+ return n * y;
2097
+ case 'weeks':
2098
+ case 'week':
2099
+ case 'w':
2100
+ return n * w;
2101
+ case 'days':
2102
+ case 'day':
2103
+ case 'd':
2104
+ return n * d;
2105
+ case 'hours':
2106
+ case 'hour':
2107
+ case 'hrs':
2108
+ case 'hr':
2109
+ case 'h':
2110
+ return n * h;
2111
+ case 'minutes':
2112
+ case 'minute':
2113
+ case 'mins':
2114
+ case 'min':
2115
+ case 'm':
2116
+ return n * m;
2117
+ case 'seconds':
2118
+ case 'second':
2119
+ case 'secs':
2120
+ case 'sec':
2121
+ case 's':
2122
+ return n * s;
2123
+ case 'milliseconds':
2124
+ case 'millisecond':
2125
+ case 'msecs':
2126
+ case 'msec':
2127
+ case 'ms':
2128
+ return n;
2129
+ default:
2130
+ return undefined;
2131
+ }
2132
+ }
2472
2133
 
2473
- service.methods = Object.getOwnPropertyNames(service).filter(function (key) {
2474
- return typeof service[key] === 'function' && service[key][ACTIVATE_HOOKS];
2475
- }).reduce(function (result, methodName) {
2476
- result[methodName] = service[methodName][ACTIVATE_HOOKS];
2477
- return result;
2478
- }, service.methods || {});
2479
- Object.assign(service.methods, {
2480
- find: ['params'],
2481
- get: ['id', 'params'],
2482
- create: ['data', 'params'],
2483
- update: ['id', 'data', 'params'],
2484
- patch: ['id', 'data', 'params'],
2485
- remove: ['id', 'params']
2486
- });
2487
- var app = this;
2488
- var methodNames = Object.keys(service.methods); // Assemble the mixin object that contains all "hooked" service methods
2134
+ /**
2135
+ * Short format for `ms`.
2136
+ *
2137
+ * @param {Number} ms
2138
+ * @return {String}
2139
+ * @api private
2140
+ */
2141
+
2142
+ function fmtShort(ms) {
2143
+ var msAbs = Math.abs(ms);
2144
+ if (msAbs >= d) {
2145
+ return Math.round(ms / d) + 'd';
2146
+ }
2147
+ if (msAbs >= h) {
2148
+ return Math.round(ms / h) + 'h';
2149
+ }
2150
+ if (msAbs >= m) {
2151
+ return Math.round(ms / m) + 'm';
2152
+ }
2153
+ if (msAbs >= s) {
2154
+ return Math.round(ms / s) + 's';
2155
+ }
2156
+ return ms + 'ms';
2157
+ }
2489
2158
 
2490
- var mixin = methodNames.reduce(function (mixin, method) {
2491
- if (typeof service[method] !== 'function') {
2492
- return mixin;
2493
- }
2159
+ /**
2160
+ * Long format for `ms`.
2161
+ *
2162
+ * @param {Number} ms
2163
+ * @return {String}
2164
+ * @api private
2165
+ */
2494
2166
 
2495
- mixin[method] = function () {
2496
- var service = this;
2497
- var args = Array.from(arguments);
2167
+ function fmtLong(ms) {
2168
+ var msAbs = Math.abs(ms);
2169
+ if (msAbs >= d) {
2170
+ return plural(ms, msAbs, d, 'day');
2171
+ }
2172
+ if (msAbs >= h) {
2173
+ return plural(ms, msAbs, h, 'hour');
2174
+ }
2175
+ if (msAbs >= m) {
2176
+ return plural(ms, msAbs, m, 'minute');
2177
+ }
2178
+ if (msAbs >= s) {
2179
+ return plural(ms, msAbs, s, 'second');
2180
+ }
2181
+ return ms + ' ms';
2182
+ }
2498
2183
 
2499
- var original = service._super.bind(service);
2184
+ /**
2185
+ * Pluralization helper.
2186
+ */
2500
2187
 
2501
- return withHooks({
2502
- app: app,
2503
- service: service,
2504
- method: method,
2505
- original: original
2506
- })({
2507
- before: getHooks(app, service, 'before', method),
2508
- after: getHooks(app, service, 'after', method, true),
2509
- error: getHooks(app, service, 'error', method, true),
2510
- finally: getHooks(app, service, 'finally', method, true)
2511
- }).apply(void 0, _toConsumableArray(args));
2512
- };
2188
+ function plural(ms, msAbs, n, name) {
2189
+ var isPlural = msAbs >= n * 1.5;
2190
+ return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
2191
+ }
2513
2192
 
2514
- return mixin;
2515
- }, {}); // Add .hooks method and properties to the service
2516
2193
 
2517
- enableHooks(service, methodNames, app.hookTypes);
2518
- service.mixin(mixin);
2519
- };
2194
+ /***/ }),
2520
2195
 
2521
- module.exports = function () {
2522
- return function (app) {
2523
- // We store a reference of all supported hook types on the app
2524
- // in case someone needs it
2525
- Object.assign(app, {
2526
- hookTypes: ['before', 'after', 'error', 'finally']
2527
- }); // Add functionality for hooks to be registered as app.hooks
2196
+ /***/ "../../node_modules/uberproto/lib/proto.js":
2197
+ /*!*************************************************!*\
2198
+ !*** ../../node_modules/uberproto/lib/proto.js ***!
2199
+ \*************************************************/
2200
+ /***/ (function(module, exports) {
2528
2201
 
2529
- enableHooks(app, app.methods, app.hookTypes);
2530
- app.mixins.push(hookMixin);
2531
- };
2532
- };
2202
+ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* global define */
2203
+ /**
2204
+ * Uberproto
2205
+ *
2206
+ * A base object for ECMAScript 5 style prototypal inheritance.
2207
+ *
2208
+ * @see https://github.com/rauschma/proto-js/
2209
+ * @see http://ejohn.org/blog/simple-javascript-inheritance/
2210
+ * @see http://uxebu.com/blog/2011/02/23/object-based-inheritance-for-ecmascript-5/
2211
+ */
2212
+ (function (root, factory) {
2213
+ if (true) {
2214
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
2215
+ __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
2216
+ (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
2217
+ __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
2218
+ } else {}
2219
+ }(this, function () {
2220
+ var HAS_SYMBOLS = typeof Object.getOwnPropertySymbols === 'function';
2533
2221
 
2534
- module.exports.withHooks = withHooks;
2535
- module.exports.ACTIVATE_HOOKS = ACTIVATE_HOOKS;
2222
+ function makeSuper (_super, old, name, fn) {
2223
+ var isFunction = typeof old === 'function';
2224
+ var newMethod = function () {
2225
+ var tmp = this._super;
2536
2226
 
2537
- module.exports.activateHooks = function activateHooks(args) {
2538
- return function (fn) {
2539
- Object.defineProperty(fn, ACTIVATE_HOOKS, {
2540
- value: args
2541
- });
2542
- return fn;
2543
- };
2544
- };
2227
+ // Add a new ._super() method that is the same method
2228
+ // but either pointing to the prototype method
2229
+ // or to the overwritten method
2230
+ this._super = isFunction ? old : _super[name];
2545
2231
 
2546
- /***/ }),
2232
+ // The method only need to be bound temporarily, so we
2233
+ // remove it when we're done executing
2234
+ var ret = fn.apply(this, arguments);
2547
2235
 
2548
- /***/ "../feathers/lib/index.js":
2549
- /*!********************************!*\
2550
- !*** ../feathers/lib/index.js ***!
2551
- \********************************/
2552
- /*! no static exports found */
2553
- /***/ (function(module, exports, __webpack_require__) {
2236
+ this._super = tmp;
2554
2237
 
2555
- var Proto = __webpack_require__(/*! uberproto */ "../../node_modules/uberproto/lib/proto.js");
2238
+ return ret;
2239
+ };
2556
2240
 
2557
- var Application = __webpack_require__(/*! ./application */ "../feathers/lib/application.js");
2241
+ if (isFunction) {
2242
+ Object.keys(old).forEach(function (name) {
2243
+ newMethod[name] = old[name];
2244
+ });
2558
2245
 
2559
- var version = __webpack_require__(/*! ./version */ "../feathers/lib/version.js");
2246
+ if (HAS_SYMBOLS) {
2247
+ Object.getOwnPropertySymbols(old).forEach(function (name) {
2248
+ newMethod[name] = old[name];
2249
+ });
2250
+ }
2251
+ }
2560
2252
 
2561
- var _require = __webpack_require__(/*! ./hooks */ "../feathers/lib/hooks/index.js"),
2562
- ACTIVATE_HOOKS = _require.ACTIVATE_HOOKS,
2563
- activateHooks = _require.activateHooks; // A base object Prototype that does not inherit from a
2564
- // potentially polluted Object prototype
2253
+ return newMethod;
2254
+ }
2565
2255
 
2256
+ return {
2257
+ /**
2258
+ * Create a new object using Object.create. The arguments will be
2259
+ * passed to the new instances init method or to a method name set in
2260
+ * __init.
2261
+ */
2262
+ create: function () {
2263
+ var instance = Object.create(this);
2264
+ var init = typeof instance.__init === 'string' ? instance.__init : 'init';
2566
2265
 
2567
- var baseObject = Object.create(null);
2266
+ if (typeof instance[init] === 'function') {
2267
+ instance[init].apply(instance, arguments);
2268
+ }
2269
+ return instance;
2270
+ },
2271
+ /**
2272
+ * Mixin a given set of properties
2273
+ * @param prop The properties to mix in
2274
+ * @param obj [optional]
2275
+ * The object to add the mixin
2276
+ */
2277
+ mixin: function (prop, obj) {
2278
+ var self = obj || this;
2279
+ var fnTest = /\b_super\b/;
2280
+ var _super = Object.getPrototypeOf(self) || self.prototype;
2281
+ var descriptors = {};
2282
+ var proto = prop;
2283
+ var processProperty = function (name) {
2284
+ var descriptor = Object.getOwnPropertyDescriptor(proto, name);
2568
2285
 
2569
- function createApplication() {
2570
- var app = Object.create(baseObject); // Mix in the base application
2286
+ if (!descriptors[name] && descriptor) {
2287
+ descriptors[name] = descriptor;
2288
+ }
2289
+ };
2571
2290
 
2572
- Proto.mixin(Application, app);
2573
- app.init();
2574
- return app;
2575
- }
2291
+ // Collect all property descriptors
2292
+ do {
2293
+ Object.getOwnPropertyNames(proto).forEach(processProperty);
2576
2294
 
2577
- createApplication.version = version;
2578
- createApplication.ACTIVATE_HOOKS = ACTIVATE_HOOKS;
2579
- createApplication.activateHooks = activateHooks;
2580
- module.exports = createApplication; // For better ES module (TypeScript) compatibility
2295
+ if (HAS_SYMBOLS) {
2296
+ Object.getOwnPropertySymbols(proto).forEach(processProperty);
2297
+ }
2298
+ } while ((proto = Object.getPrototypeOf(proto)) && Object.getPrototypeOf(proto));
2581
2299
 
2582
- module.exports.default = createApplication;
2300
+ var processDescriptor = function (name) {
2301
+ var descriptor = descriptors[name];
2583
2302
 
2584
- /***/ }),
2303
+ if (typeof descriptor.value === 'function' && fnTest.test(descriptor.value)) {
2304
+ descriptor.value = makeSuper(_super, self[name], name, descriptor.value);
2305
+ }
2585
2306
 
2586
- /***/ "../feathers/lib/version.js":
2587
- /*!**********************************!*\
2588
- !*** ../feathers/lib/version.js ***!
2589
- \**********************************/
2590
- /*! no static exports found */
2591
- /***/ (function(module, exports) {
2307
+ Object.defineProperty(self, name, descriptor);
2308
+ };
2592
2309
 
2593
- module.exports = '4.5.8';
2310
+ Object.keys(descriptors).forEach(processDescriptor);
2594
2311
 
2595
- /***/ }),
2312
+ if (HAS_SYMBOLS) {
2313
+ Object.getOwnPropertySymbols(descriptors).forEach(processDescriptor);
2314
+ }
2596
2315
 
2597
- /***/ "./src/core.js":
2598
- /*!*********************!*\
2599
- !*** ./src/core.js ***!
2600
- \*********************/
2601
- /*! no static exports found */
2602
- /***/ (function(module, exports, __webpack_require__) {
2316
+ return self;
2317
+ },
2318
+ /**
2319
+ * Extend the current or a given object with the given property and return the extended object.
2320
+ * @param prop The properties to extend with
2321
+ * @param obj [optional] The object to extend from
2322
+ * @returns The extended object
2323
+ */
2324
+ extend: function (prop, obj) {
2325
+ return this.mixin(prop, Object.create(obj || this));
2326
+ },
2327
+ /**
2328
+ * Return a callback function with this set to the current or a given context object.
2329
+ * @param name Name of the method to proxy
2330
+ * @param args... [optional] Arguments to use for partial application
2331
+ */
2332
+ proxy: function (name) {
2333
+ var fn = this[name];
2334
+ var args = Array.prototype.slice.call(arguments, 1);
2335
+
2336
+ args.unshift(this);
2337
+ return fn.bind.apply(fn, args);
2338
+ }
2339
+ };
2340
+ }));
2603
2341
 
2604
- module.exports = __webpack_require__(/*! @feathersjs/feathers */ "../feathers/lib/index.js");
2605
2342
 
2606
2343
  /***/ })
2607
2344
 
2608
- /******/ });
2345
+ /******/ });
2346
+ /************************************************************************/
2347
+ /******/ // The module cache
2348
+ /******/ var __webpack_module_cache__ = {};
2349
+ /******/
2350
+ /******/ // The require function
2351
+ /******/ function __webpack_require__(moduleId) {
2352
+ /******/ // Check if module is in cache
2353
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
2354
+ /******/ if (cachedModule !== undefined) {
2355
+ /******/ return cachedModule.exports;
2356
+ /******/ }
2357
+ /******/ // Create a new module (and put it into the cache)
2358
+ /******/ var module = __webpack_module_cache__[moduleId] = {
2359
+ /******/ // no module.id needed
2360
+ /******/ // no module.loaded needed
2361
+ /******/ exports: {}
2362
+ /******/ };
2363
+ /******/
2364
+ /******/ // Execute the module function
2365
+ /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
2366
+ /******/
2367
+ /******/ // Return the exports of the module
2368
+ /******/ return module.exports;
2369
+ /******/ }
2370
+ /******/
2371
+ /************************************************************************/
2372
+ /******/
2373
+ /******/ // startup
2374
+ /******/ // Load entry module and return exports
2375
+ /******/ // This entry module used 'module' so it can't be inlined
2376
+ /******/ var __webpack_exports__ = __webpack_require__("./src/core.js");
2377
+ /******/
2378
+ /******/ return __webpack_exports__;
2379
+ /******/ })()
2380
+ ;
2609
2381
  });
2610
2382
  //# sourceMappingURL=core.js.map