@feathersjs/client 4.5.15 → 4.5.17

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
@@ -22,12 +22,12 @@ return /******/ (function() { // webpackBootstrap
22
22
  /**
23
23
  * This is the web browser implementation of `debug()`.
24
24
  */
25
+
25
26
  exports.formatArgs = formatArgs;
26
27
  exports.save = save;
27
28
  exports.load = load;
28
29
  exports.useColors = useColors;
29
30
  exports.storage = localstorage();
30
-
31
31
  exports.destroy = function () {
32
32
  var warned = false;
33
33
  return function () {
@@ -37,12 +37,13 @@ exports.destroy = function () {
37
37
  }
38
38
  };
39
39
  }();
40
+
40
41
  /**
41
42
  * Colors.
42
43
  */
43
44
 
44
-
45
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'];
46
+
46
47
  /**
47
48
  * Currently only WebKit-based Web Inspectors, Firefox >= v31,
48
49
  * and the Firebug extension (any Firefox version) are known
@@ -50,57 +51,57 @@ exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066F
50
51
  *
51
52
  * TODO: add a `localStorage` variable to explicitly enable/disable colors
52
53
  */
53
- // eslint-disable-next-line complexity
54
54
 
55
+ // eslint-disable-next-line complexity
55
56
  function useColors() {
56
57
  // NB: In an Electron preload script, document will be defined but not fully
57
58
  // initialized. Since we know we're in Chrome, we'll just detect this case
58
59
  // explicitly
59
60
  if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
60
61
  return true;
61
- } // Internet Explorer and Edge do not support colors.
62
-
62
+ }
63
63
 
64
+ // Internet Explorer and Edge do not support colors.
64
65
  if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
65
66
  return false;
66
- } // Is webkit? http://stackoverflow.com/a/16459606/376773
67
- // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
68
-
67
+ }
69
68
 
70
- return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
71
- typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
69
+ // Is webkit? http://stackoverflow.com/a/16459606/376773
70
+ // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
71
+ return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance ||
72
+ // Is firebug? http://stackoverflow.com/a/398120/376773
73
+ typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) ||
74
+ // Is firefox >= v31?
72
75
  // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
73
- typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
76
+ typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 ||
77
+ // Double check webkit in userAgent just in case we are in a worker
74
78
  typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
75
79
  }
80
+
76
81
  /**
77
82
  * Colorize log arguments if enabled.
78
83
  *
79
84
  * @api public
80
85
  */
81
86
 
82
-
83
87
  function formatArgs(args) {
84
88
  args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
85
-
86
89
  if (!this.useColors) {
87
90
  return;
88
91
  }
89
-
90
92
  var c = 'color: ' + this.color;
91
- args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other
93
+ args.splice(1, 0, c, 'color: inherit');
94
+
95
+ // The final "%c" is somewhat tricky, because there could be other
92
96
  // arguments passed either before or after the %c, so we need to
93
97
  // figure out the correct index to insert the CSS into
94
-
95
98
  var index = 0;
96
99
  var lastC = 0;
97
100
  args[0].replace(/%[a-zA-Z%]/g, function (match) {
98
101
  if (match === '%%') {
99
102
  return;
100
103
  }
101
-
102
104
  index++;
103
-
104
105
  if (match === '%c') {
105
106
  // We only are interested in the *last* %c
106
107
  // (the user may have provided their own)
@@ -109,6 +110,7 @@ function formatArgs(args) {
109
110
  });
110
111
  args.splice(lastC, 0, c);
111
112
  }
113
+
112
114
  /**
113
115
  * Invokes `console.debug()` when available.
114
116
  * No-op when `console.debug` is not a "function".
@@ -117,17 +119,14 @@ function formatArgs(args) {
117
119
  *
118
120
  * @api public
119
121
  */
120
-
121
-
122
122
  exports.log = console.debug || console.log || function () {};
123
+
123
124
  /**
124
125
  * Save `namespaces`.
125
126
  *
126
127
  * @param {String} namespaces
127
128
  * @api private
128
129
  */
129
-
130
-
131
130
  function save(namespaces) {
132
131
  try {
133
132
  if (namespaces) {
@@ -135,34 +134,34 @@ function save(namespaces) {
135
134
  } else {
136
135
  exports.storage.removeItem('debug');
137
136
  }
138
- } catch (error) {// Swallow
137
+ } catch (error) {
138
+ // Swallow
139
139
  // XXX (@Qix-) should we be logging these?
140
140
  }
141
141
  }
142
+
142
143
  /**
143
144
  * Load `namespaces`.
144
145
  *
145
146
  * @return {String} returns the previously persisted debug modes
146
147
  * @api private
147
148
  */
148
-
149
-
150
149
  function load() {
151
150
  var r;
152
-
153
151
  try {
154
152
  r = exports.storage.getItem('debug');
155
- } catch (error) {// Swallow
153
+ } catch (error) {
154
+ // Swallow
156
155
  // XXX (@Qix-) should we be logging these?
157
- } // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
158
-
156
+ }
159
157
 
158
+ // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
160
159
  if (!r && typeof process !== 'undefined' && 'env' in process) {
161
160
  r = process.env.DEBUG;
162
161
  }
163
-
164
162
  return r;
165
163
  }
164
+
166
165
  /**
167
166
  * Localstorage attempts to return the localstorage.
168
167
  *
@@ -174,19 +173,19 @@ function load() {
174
173
  * @api private
175
174
  */
176
175
 
177
-
178
176
  function localstorage() {
179
177
  try {
180
178
  // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
181
179
  // The Browser also has localStorage in the global context.
182
180
  return localStorage;
183
- } catch (error) {// Swallow
181
+ } catch (error) {
182
+ // Swallow
184
183
  // XXX (@Qix-) should we be logging these?
185
184
  }
186
185
  }
187
-
188
186
  module.exports = __webpack_require__(/*! ./common */ "../../node_modules/debug/src/common.js")(exports);
189
187
  var formatters = module.exports.formatters;
188
+
190
189
  /**
191
190
  * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
192
191
  */
@@ -208,21 +207,16 @@ formatters.j = function (v) {
208
207
  /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
209
208
 
210
209
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
211
-
212
210
  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."); }
213
-
214
211
  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); }
215
-
216
212
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
217
-
218
213
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
219
-
220
- 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; }
221
-
214
+ 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; }
222
215
  /**
223
216
  * This is the common logic for both the Node.js and web browser
224
217
  * implementations of `debug()`.
225
218
  */
219
+
226
220
  function setup(env) {
227
221
  createDebug.debug = createDebug;
228
222
  createDebug.default = createDebug;
@@ -235,29 +229,29 @@ function setup(env) {
235
229
  Object.keys(env).forEach(function (key) {
236
230
  createDebug[key] = env[key];
237
231
  });
232
+
238
233
  /**
239
234
  * The currently active debug mode names, and names to skip.
240
235
  */
241
236
 
242
237
  createDebug.names = [];
243
238
  createDebug.skips = [];
239
+
244
240
  /**
245
241
  * Map of special "%n" handling functions, for the debug "format" argument.
246
242
  *
247
243
  * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
248
244
  */
249
-
250
245
  createDebug.formatters = {};
246
+
251
247
  /**
252
248
  * Selects a color for a debug namespace
253
249
  * @param {String} namespace The namespace string for the debug instance to be colored
254
250
  * @return {Number|String} An ANSI color code for the given namespace
255
251
  * @api private
256
252
  */
257
-
258
253
  function selectColor(namespace) {
259
254
  var hash = 0;
260
-
261
255
  for (var i = 0; i < namespace.length; i++) {
262
256
  hash = (hash << 5) - hash + namespace.charCodeAt(i);
263
257
  hash |= 0; // Convert to 32bit integer
@@ -265,8 +259,8 @@ function setup(env) {
265
259
 
266
260
  return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
267
261
  }
268
-
269
262
  createDebug.selectColor = selectColor;
263
+
270
264
  /**
271
265
  * Create a debugger with the given `namespace`.
272
266
  *
@@ -274,25 +268,22 @@ function setup(env) {
274
268
  * @return {Function}
275
269
  * @api public
276
270
  */
277
-
278
271
  function createDebug(namespace) {
279
272
  var prevTime;
280
273
  var enableOverride = null;
281
274
  var namespacesCache;
282
275
  var enabledCache;
283
-
284
276
  function debug() {
285
277
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
286
278
  args[_key] = arguments[_key];
287
279
  }
288
-
289
280
  // Disabled?
290
281
  if (!debug.enabled) {
291
282
  return;
292
283
  }
284
+ var self = debug;
293
285
 
294
- var self = debug; // Set `diff` timestamp
295
-
286
+ // Set `diff` timestamp
296
287
  var curr = Number(new Date());
297
288
  var ms = curr - (prevTime || curr);
298
289
  self.diff = ms;
@@ -300,39 +291,36 @@ function setup(env) {
300
291
  self.curr = curr;
301
292
  prevTime = curr;
302
293
  args[0] = createDebug.coerce(args[0]);
303
-
304
294
  if (typeof args[0] !== 'string') {
305
295
  // Anything else let's inspect with %O
306
296
  args.unshift('%O');
307
- } // Apply any `formatters` transformations
308
-
297
+ }
309
298
 
299
+ // Apply any `formatters` transformations
310
300
  var index = 0;
311
301
  args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
312
302
  // If we encounter an escaped % then don't increase the array index
313
303
  if (match === '%%') {
314
304
  return '%';
315
305
  }
316
-
317
306
  index++;
318
307
  var formatter = createDebug.formatters[format];
319
-
320
308
  if (typeof formatter === 'function') {
321
309
  var val = args[index];
322
- match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format`
310
+ match = formatter.call(self, val);
323
311
 
312
+ // Now we need to remove `args[index]` since it's inlined in the `format`
324
313
  args.splice(index, 1);
325
314
  index--;
326
315
  }
327
-
328
316
  return match;
329
- }); // Apply env-specific formatting (colors, etc.)
317
+ });
330
318
 
319
+ // Apply env-specific formatting (colors, etc.)
331
320
  createDebug.formatArgs.call(self, args);
332
321
  var logFn = self.log || createDebug.log;
333
322
  logFn.apply(self, args);
334
323
  }
335
-
336
324
  debug.namespace = namespace;
337
325
  debug.useColors = createDebug.useColors();
338
326
  debug.color = createDebug.selectColor(namespace);
@@ -346,31 +334,29 @@ function setup(env) {
346
334
  if (enableOverride !== null) {
347
335
  return enableOverride;
348
336
  }
349
-
350
337
  if (namespacesCache !== createDebug.namespaces) {
351
338
  namespacesCache = createDebug.namespaces;
352
339
  enabledCache = createDebug.enabled(namespace);
353
340
  }
354
-
355
341
  return enabledCache;
356
342
  },
357
343
  set: function set(v) {
358
344
  enableOverride = v;
359
345
  }
360
- }); // Env-specific initialization logic for debug instances
346
+ });
361
347
 
348
+ // Env-specific initialization logic for debug instances
362
349
  if (typeof createDebug.init === 'function') {
363
350
  createDebug.init(debug);
364
351
  }
365
-
366
352
  return debug;
367
353
  }
368
-
369
354
  function extend(namespace, delimiter) {
370
355
  var newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
371
356
  newDebug.log = this.log;
372
357
  return newDebug;
373
358
  }
359
+
374
360
  /**
375
361
  * Enables a debug mode by namespaces. This can include modes
376
362
  * separated by a colon and wildcards.
@@ -378,8 +364,6 @@ function setup(env) {
378
364
  * @param {String} namespaces
379
365
  * @api public
380
366
  */
381
-
382
-
383
367
  function enable(namespaces) {
384
368
  createDebug.save(namespaces);
385
369
  createDebug.namespaces = namespaces;
@@ -388,15 +372,12 @@ function setup(env) {
388
372
  var i;
389
373
  var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
390
374
  var len = split.length;
391
-
392
375
  for (i = 0; i < len; i++) {
393
376
  if (!split[i]) {
394
377
  // ignore empty strings
395
378
  continue;
396
379
  }
397
-
398
380
  namespaces = split[i].replace(/\*/g, '.*?');
399
-
400
381
  if (namespaces[0] === '-') {
401
382
  createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));
402
383
  } else {
@@ -404,14 +385,13 @@ function setup(env) {
404
385
  }
405
386
  }
406
387
  }
388
+
407
389
  /**
408
390
  * Disable debug output.
409
391
  *
410
392
  * @return {String} namespaces
411
393
  * @api public
412
394
  */
413
-
414
-
415
395
  function disable() {
416
396
  var namespaces = [].concat(_toConsumableArray(createDebug.names.map(toNamespace)), _toConsumableArray(createDebug.skips.map(toNamespace).map(function (namespace) {
417
397
  return '-' + namespace;
@@ -419,6 +399,7 @@ function setup(env) {
419
399
  createDebug.enable('');
420
400
  return namespaces;
421
401
  }
402
+
422
403
  /**
423
404
  * Returns true if the given mode name is enabled, false otherwise.
424
405
  *
@@ -426,30 +407,25 @@ function setup(env) {
426
407
  * @return {Boolean}
427
408
  * @api public
428
409
  */
429
-
430
-
431
410
  function enabled(name) {
432
411
  if (name[name.length - 1] === '*') {
433
412
  return true;
434
413
  }
435
-
436
414
  var i;
437
415
  var len;
438
-
439
416
  for (i = 0, len = createDebug.skips.length; i < len; i++) {
440
417
  if (createDebug.skips[i].test(name)) {
441
418
  return false;
442
419
  }
443
420
  }
444
-
445
421
  for (i = 0, len = createDebug.names.length; i < len; i++) {
446
422
  if (createDebug.names[i].test(name)) {
447
423
  return true;
448
424
  }
449
425
  }
450
-
451
426
  return false;
452
427
  }
428
+
453
429
  /**
454
430
  * Convert regexp to namespace
455
431
  *
@@ -457,11 +433,10 @@ function setup(env) {
457
433
  * @return {String} namespace
458
434
  * @api private
459
435
  */
460
-
461
-
462
436
  function toNamespace(regexp) {
463
437
  return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, '*');
464
438
  }
439
+
465
440
  /**
466
441
  * Coerce `val`.
467
442
  *
@@ -469,29 +444,23 @@ function setup(env) {
469
444
  * @return {Mixed}
470
445
  * @api private
471
446
  */
472
-
473
-
474
447
  function coerce(val) {
475
448
  if (val instanceof Error) {
476
449
  return val.stack || val.message;
477
450
  }
478
-
479
451
  return val;
480
452
  }
453
+
481
454
  /**
482
455
  * XXX DO NOT USE. This is a temporary stub function.
483
456
  * XXX It WILL be removed in the next major release.
484
457
  */
485
-
486
-
487
458
  function destroy() {
488
459
  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
460
  }
490
-
491
461
  createDebug.enable(createDebug.load());
492
462
  return createDebug;
493
463
  }
494
-
495
464
  module.exports = setup;
496
465
 
497
466
  /***/ }),
@@ -516,19 +485,15 @@ module.exports = __webpack_require__(/*! @feathersjs/feathers */ "../feathers/li
516
485
 
517
486
 
518
487
  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); }
519
-
520
488
  Object.defineProperty(exports, "__esModule", ({
521
489
  value: true
522
490
  }));
523
491
  exports.enableHooks = exports.processHooks = exports.getHooks = exports.isHookObject = exports.convertHookData = exports.makeArguments = exports.defaultMakeArguments = exports.createHookObject = exports.ACTIVATE_HOOKS = void 0;
524
-
525
492
  var utils_1 = __webpack_require__(/*! ./utils */ "../commons/lib/utils.js");
526
-
527
493
  var _utils_1$_ = utils_1._,
528
- each = _utils_1$_.each,
529
- pick = _utils_1$_.pick;
494
+ each = _utils_1$_.each,
495
+ pick = _utils_1$_.pick;
530
496
  exports.ACTIVATE_HOOKS = (0, utils_1.createSymbol)('__feathersActivateHooks');
531
-
532
497
  function createHookObject(method) {
533
498
  var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
534
499
  var hook = {};
@@ -539,70 +504,55 @@ function createHookObject(method) {
539
504
  });
540
505
  return Object.assign(hook, data, {
541
506
  method: method,
542
-
543
507
  // A dynamic getter that returns the path of the service
544
508
  get path() {
545
509
  var app = data.app,
546
- service = data.service;
547
-
510
+ service = data.service;
548
511
  if (!service || !app || !app.services) {
549
512
  return null;
550
513
  }
551
-
552
514
  return Object.keys(app.services).find(function (path) {
553
515
  return app.services[path] === service;
554
516
  });
555
517
  }
556
-
557
518
  });
558
519
  }
559
-
560
- exports.createHookObject = createHookObject; // Fallback used by `makeArguments` which usually won't be used
561
-
520
+ exports.createHookObject = createHookObject;
521
+ // Fallback used by `makeArguments` which usually won't be used
562
522
  function defaultMakeArguments(hook) {
563
523
  var result = [];
564
-
565
524
  if (typeof hook.id !== 'undefined') {
566
525
  result.push(hook.id);
567
526
  }
568
-
569
527
  if (hook.data) {
570
528
  result.push(hook.data);
571
529
  }
572
-
573
530
  result.push(hook.params || {});
574
531
  return result;
575
532
  }
576
-
577
- exports.defaultMakeArguments = defaultMakeArguments; // Turns a hook object back into a list of arguments
533
+ exports.defaultMakeArguments = defaultMakeArguments;
534
+ // Turns a hook object back into a list of arguments
578
535
  // to call a service method with
579
-
580
536
  function makeArguments(hook) {
581
537
  switch (hook.method) {
582
538
  case 'find':
583
539
  return [hook.params];
584
-
585
540
  case 'get':
586
541
  case 'remove':
587
542
  return [hook.id, hook.params];
588
-
589
543
  case 'update':
590
544
  case 'patch':
591
545
  return [hook.id, hook.data, hook.params];
592
-
593
546
  case 'create':
594
547
  return [hook.data, hook.params];
595
548
  }
596
-
597
549
  return defaultMakeArguments(hook);
598
550
  }
599
-
600
- exports.makeArguments = makeArguments; // Converts different hook registration formats into the
551
+ exports.makeArguments = makeArguments;
552
+ // Converts different hook registration formats into the
601
553
  // same internal format
602
-
603
554
  function convertHookData(obj) {
604
555
  var hook = {};
605
-
606
556
  if (Array.isArray(obj)) {
607
557
  hook = {
608
558
  all: obj
@@ -616,41 +566,32 @@ function convertHookData(obj) {
616
566
  hook[key] = !Array.isArray(value) ? [value] : value;
617
567
  });
618
568
  }
619
-
620
569
  return hook;
621
570
  }
622
-
623
- exports.convertHookData = convertHookData; // Duck-checks a given object to be a hook object
571
+ exports.convertHookData = convertHookData;
572
+ // Duck-checks a given object to be a hook object
624
573
  // A valid hook object has `type` and `method`
625
-
626
574
  function isHookObject(hookObject) {
627
575
  return _typeof(hookObject) === 'object' && typeof hookObject.method === 'string' && typeof hookObject.type === 'string';
628
576
  }
629
-
630
- exports.isHookObject = isHookObject; // Returns all service and application hooks combined
577
+ exports.isHookObject = isHookObject;
578
+ // Returns all service and application hooks combined
631
579
  // for a given method and type `appLast` sets if the hooks
632
580
  // from `app` should be added last (or first by default)
633
-
634
581
  function getHooks(app, service, type, method) {
635
582
  var appLast = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
636
583
  var appHooks = app.__hooks[type][method] || [];
637
584
  var serviceHooks = service.__hooks[type][method] || [];
638
-
639
585
  if (appLast) {
640
586
  // Run hooks in the order of service -> app -> finally
641
587
  return serviceHooks.concat(appHooks);
642
588
  }
643
-
644
589
  return appHooks.concat(serviceHooks);
645
590
  }
646
-
647
591
  exports.getHooks = getHooks;
648
-
649
592
  function processHooks(hooks, initialHookObject) {
650
593
  var _this = this;
651
-
652
594
  var hookObject = initialHookObject;
653
-
654
595
  var updateCurrentHook = function updateCurrentHook(current) {
655
596
  // Either use the returned hook object or the current
656
597
  // hook object from the chain if the hook returned undefined
@@ -658,18 +599,15 @@ function processHooks(hooks, initialHookObject) {
658
599
  if (!isHookObject(current)) {
659
600
  throw new Error("".concat(hookObject.type, " hook for '").concat(hookObject.method, "' method returned invalid hook object"));
660
601
  }
661
-
662
602
  hookObject = current;
663
603
  }
664
-
665
604
  return hookObject;
666
- }; // Go through all hooks and chain them into our promise
667
-
668
-
605
+ };
606
+ // Go through all hooks and chain them into our promise
669
607
  var promise = hooks.reduce(function (current, fn) {
670
608
  // @ts-ignore
671
- var hook = fn.bind(_this); // Use the returned hook object or the old one
672
-
609
+ var hook = fn.bind(_this);
610
+ // Use the returned hook object or the old one
673
611
  return current.then(function (currentHook) {
674
612
  return hook(currentHook);
675
613
  }).then(updateCurrentHook);
@@ -682,20 +620,18 @@ function processHooks(hooks, initialHookObject) {
682
620
  throw error;
683
621
  });
684
622
  }
685
-
686
- exports.processHooks = processHooks; // Add `.hooks` functionality to an object
687
-
623
+ exports.processHooks = processHooks;
624
+ // Add `.hooks` functionality to an object
688
625
  function enableHooks(obj, methods, types) {
689
626
  if (typeof obj.hooks === 'function') {
690
627
  return obj;
691
628
  }
692
-
693
629
  var hookData = {};
694
630
  types.forEach(function (type) {
695
631
  // Initialize properties where hook functions are stored
696
632
  hookData[type] = {};
697
- }); // Add non-enumerable `__hooks` property to the object
698
-
633
+ });
634
+ // Add non-enumerable `__hooks` property to the object
699
635
  Object.defineProperty(obj, '__hooks', {
700
636
  configurable: true,
701
637
  value: hookData,
@@ -704,13 +640,11 @@ function enableHooks(obj, methods, types) {
704
640
  return Object.assign(obj, {
705
641
  hooks: function hooks(allHooks) {
706
642
  var _this2 = this;
707
-
708
643
  each(allHooks, function (current, type) {
709
644
  // @ts-ignore
710
645
  if (!_this2.__hooks[type]) {
711
646
  throw new Error("'".concat(type, "' is not a valid hook type"));
712
647
  }
713
-
714
648
  var hooks = convertHookData(current);
715
649
  each(hooks, function (_value, method) {
716
650
  if (method !== 'all' && methods.indexOf(method) === -1) {
@@ -720,11 +654,9 @@ function enableHooks(obj, methods, types) {
720
654
  methods.forEach(function (method) {
721
655
  // @ts-ignore
722
656
  var myHooks = _this2.__hooks[type][method] || (_this2.__hooks[type][method] = []);
723
-
724
657
  if (hooks.all) {
725
658
  myHooks.push.apply(myHooks, hooks.all);
726
659
  }
727
-
728
660
  if (hooks[method]) {
729
661
  myHooks.push.apply(myHooks, hooks[method]);
730
662
  }
@@ -734,7 +666,6 @@ function enableHooks(obj, methods, types) {
734
666
  }
735
667
  });
736
668
  }
737
-
738
669
  exports.enableHooks = enableHooks;
739
670
 
740
671
  /***/ }),
@@ -751,7 +682,6 @@ exports.enableHooks = enableHooks;
751
682
  var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
752
683
  if (k2 === undefined) k2 = k;
753
684
  var desc = Object.getOwnPropertyDescriptor(m, k);
754
-
755
685
  if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
756
686
  desc = {
757
687
  enumerable: true,
@@ -760,13 +690,11 @@ var __createBinding = this && this.__createBinding || (Object.create ? function
760
690
  }
761
691
  };
762
692
  }
763
-
764
693
  Object.defineProperty(o, k2, desc);
765
694
  } : function (o, m, k, k2) {
766
695
  if (k2 === undefined) k2 = k;
767
696
  o[k2] = m[k];
768
697
  });
769
-
770
698
  var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
771
699
  Object.defineProperty(o, "default", {
772
700
  enumerable: true,
@@ -775,34 +703,22 @@ var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? fun
775
703
  } : function (o, v) {
776
704
  o["default"] = v;
777
705
  });
778
-
779
706
  var __importStar = this && this.__importStar || function (mod) {
780
707
  if (mod && mod.__esModule) return mod;
781
708
  var result = {};
782
- if (mod != null) for (var k in mod) {
783
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
784
- }
785
-
709
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
786
710
  __setModuleDefault(result, mod);
787
-
788
711
  return result;
789
712
  };
790
-
791
713
  var __exportStar = this && this.__exportStar || function (m, exports) {
792
- for (var p in m) {
793
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
794
- }
714
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
795
715
  };
796
-
797
716
  Object.defineProperty(exports, "__esModule", ({
798
717
  value: true
799
718
  }));
800
719
  exports.hooks = void 0;
801
-
802
720
  var hookUtils = __importStar(__webpack_require__(/*! ./hooks */ "../commons/lib/hooks.js"));
803
-
804
721
  __exportStar(__webpack_require__(/*! ./utils */ "../commons/lib/utils.js"), exports);
805
-
806
722
  exports.hooks = hookUtils;
807
723
 
808
724
  /***/ }),
@@ -816,33 +732,26 @@ exports.hooks = hookUtils;
816
732
  "use strict";
817
733
 
818
734
 
819
- 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; }
820
-
735
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
736
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
737
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
821
738
  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); }
822
-
823
739
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
824
-
825
740
  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."); }
826
-
827
741
  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); }
828
-
829
- 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; }
830
-
831
- 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; }
832
-
742
+ 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; }
743
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
833
744
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
834
-
835
745
  Object.defineProperty(exports, "__esModule", ({
836
746
  value: true
837
747
  }));
838
- exports.createSymbol = exports.makeUrl = exports.isPromise = exports._ = exports.stripSlashes = void 0; // Removes all leading and trailing slashes from a path
839
-
748
+ exports.createSymbol = exports.makeUrl = exports.isPromise = exports._ = exports.stripSlashes = void 0;
749
+ // Removes all leading and trailing slashes from a path
840
750
  function stripSlashes(name) {
841
751
  return name.replace(/^(\/+)|(\/+)$/g, '');
842
752
  }
843
-
844
- exports.stripSlashes = stripSlashes; // A set of lodash-y utility functions that use ES6
845
-
753
+ exports.stripSlashes = stripSlashes;
754
+ // A set of lodash-y utility functions that use ES6
846
755
  exports._ = {
847
756
  each: function each(obj, callback) {
848
757
  if (obj && typeof obj.forEach === 'function') {
@@ -858,9 +767,8 @@ exports._ = {
858
767
  return [value[key], key];
859
768
  }).some(function (_ref) {
860
769
  var _ref2 = _slicedToArray(_ref, 2),
861
- val = _ref2[0],
862
- key = _ref2[1];
863
-
770
+ val = _ref2[0],
771
+ key = _ref2[1];
864
772
  return callback(val, key);
865
773
  });
866
774
  },
@@ -869,9 +777,8 @@ exports._ = {
869
777
  return [value[key], key];
870
778
  }).every(function (_ref3) {
871
779
  var _ref4 = _slicedToArray(_ref3, 2),
872
- val = _ref4[0],
873
- key = _ref4[1];
874
-
780
+ val = _ref4[0],
781
+ key = _ref4[1];
875
782
  return callback(val, key);
876
783
  });
877
784
  },
@@ -901,16 +808,13 @@ exports._ = {
901
808
  for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
902
809
  rest[_key - 1] = arguments[_key];
903
810
  }
904
-
905
811
  return Object.assign.apply(Object, [first].concat(rest));
906
812
  },
907
813
  omit: function omit(obj) {
908
814
  var result = exports._.extend({}, obj);
909
-
910
815
  for (var _len2 = arguments.length, keys = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
911
816
  keys[_key2 - 1] = arguments[_key2];
912
817
  }
913
-
914
818
  keys.forEach(function (key) {
915
819
  return delete result[key];
916
820
  });
@@ -920,12 +824,10 @@ exports._ = {
920
824
  for (var _len3 = arguments.length, keys = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
921
825
  keys[_key3 - 1] = arguments[_key3];
922
826
  }
923
-
924
827
  return keys.reduce(function (result, key) {
925
828
  if (source[key] !== undefined) {
926
829
  result[key] = source[key];
927
830
  }
928
-
929
831
  return result;
930
832
  }, {});
931
833
  },
@@ -937,24 +839,20 @@ exports._ = {
937
839
  if (!target[key]) {
938
840
  Object.assign(target, _defineProperty({}, key, {}));
939
841
  }
940
-
941
842
  exports._.merge(target[key], source[key]);
942
843
  } else {
943
844
  Object.assign(target, _defineProperty({}, key, source[key]));
944
845
  }
945
846
  });
946
847
  }
947
-
948
848
  return target;
949
849
  }
950
- }; // Duck-checks if an object looks like a promise
951
-
850
+ };
851
+ // Duck-checks if an object looks like a promise
952
852
  function isPromise(result) {
953
853
  return exports._.isObject(result) && typeof result.then === 'function';
954
854
  }
955
-
956
855
  exports.isPromise = isPromise;
957
-
958
856
  function makeUrl(path) {
959
857
  var app = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
960
858
  var get = typeof app.get === 'function' ? app.get.bind(app) : function () {};
@@ -966,13 +864,10 @@ function makeUrl(path) {
966
864
  path = path || '';
967
865
  return "".concat(protocol, "://").concat(host).concat(port, "/").concat(exports.stripSlashes(path));
968
866
  }
969
-
970
867
  exports.makeUrl = makeUrl;
971
-
972
868
  function createSymbol(name) {
973
869
  return typeof Symbol !== 'undefined' ? Symbol(name) : name;
974
870
  }
975
-
976
871
  exports.createSymbol = createSymbol;
977
872
 
978
873
  /***/ }),
@@ -984,18 +879,12 @@ exports.createSymbol = createSymbol;
984
879
  /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
985
880
 
986
881
  var debug = __webpack_require__(/*! debug */ "../../node_modules/debug/src/browser.js")('feathers:application');
987
-
988
882
  var _require = __webpack_require__(/*! @feathersjs/commons */ "../commons/lib/index.js"),
989
- stripSlashes = _require.stripSlashes;
990
-
883
+ stripSlashes = _require.stripSlashes;
991
884
  var Uberproto = __webpack_require__(/*! uberproto */ "../../node_modules/uberproto/lib/proto.js");
992
-
993
885
  var events = __webpack_require__(/*! ./events */ "../feathers/lib/events.js");
994
-
995
886
  var hooks = __webpack_require__(/*! ./hooks */ "../feathers/lib/hooks/index.js");
996
-
997
887
  var version = __webpack_require__(/*! ./version */ "../feathers/lib/version.js");
998
-
999
888
  var Proto = Uberproto.extend({
1000
889
  create: null
1001
890
  });
@@ -1042,31 +931,24 @@ var application = {
1042
931
  if (typeof _service !== 'undefined') {
1043
932
  throw new Error('Registering a new service with `app.service(path, service)` is no longer supported. Use `app.use(path, service)` instead.');
1044
933
  }
1045
-
1046
934
  var location = stripSlashes(path) || '/';
1047
- var current = this.services[location];
1048
-
935
+ var current = this.services.hasOwnProperty(location) ? this.services[location] : undefined;
1049
936
  if (typeof current === 'undefined' && typeof this.defaultService === 'function') {
1050
937
  return this.use(location, this.defaultService(location)).service(location);
1051
938
  }
1052
-
1053
939
  return current;
1054
940
  },
1055
941
  use: function use(path, service) {
1056
942
  var _this = this;
1057
-
1058
943
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1059
-
1060
944
  if (typeof path !== 'string') {
1061
945
  throw new Error("'".concat(path, "' is not a valid service path."));
1062
946
  }
1063
-
1064
947
  var location = stripSlashes(path) || '/';
1065
948
  var isSubApp = typeof service.service === 'function' && service.services;
1066
949
  var isService = this.methods.concat('setup').some(function (name) {
1067
950
  return typeof service[name] === 'function';
1068
951
  });
1069
-
1070
952
  if (isSubApp) {
1071
953
  var subApp = service;
1072
954
  Object.keys(subApp.services).forEach(function (subPath) {
@@ -1074,44 +956,41 @@ var application = {
1074
956
  });
1075
957
  return this;
1076
958
  }
1077
-
1078
959
  if (!isService) {
1079
960
  throw new Error("Invalid service object passed for path `".concat(location, "`"));
1080
- } // If the service is already Uberproto'd use it directly
1081
-
961
+ }
1082
962
 
963
+ // If the service is already Uberproto'd use it directly
1083
964
  var protoService = Proto.isPrototypeOf(service) ? service : Proto.extend(service);
1084
- debug("Registering new service at `".concat(location, "`")); // Add all the mixins
965
+ debug("Registering new service at `".concat(location, "`"));
1085
966
 
967
+ // Add all the mixins
1086
968
  this.mixins.forEach(function (fn) {
1087
969
  return fn.call(_this, protoService, location, options);
1088
970
  });
1089
-
1090
971
  if (typeof protoService._setup === 'function') {
1091
972
  protoService._setup(this, location);
1092
- } // Run the provider functions to register the service
1093
-
973
+ }
1094
974
 
975
+ // Run the provider functions to register the service
1095
976
  this.providers.forEach(function (provider) {
1096
977
  return provider.call(_this, protoService, location, options);
1097
- }); // If we ran setup already, set this service up explicitly
978
+ });
1098
979
 
980
+ // If we ran setup already, set this service up explicitly
1099
981
  if (this._isSetup && typeof protoService.setup === 'function') {
1100
982
  debug("Setting up service for `".concat(location, "`"));
1101
983
  protoService.setup(this, location);
1102
984
  }
1103
-
1104
985
  this.services[location] = protoService;
1105
986
  return this;
1106
987
  },
1107
988
  setup: function setup() {
1108
989
  var _this2 = this;
1109
-
1110
990
  // Setup each service (pass the app so that they can look up other services etc.)
1111
991
  Object.keys(this.services).forEach(function (path) {
1112
992
  var service = _this2.services[path];
1113
993
  debug("Setting up service for `".concat(path, "`"));
1114
-
1115
994
  if (typeof service.setup === 'function') {
1116
995
  service.setup(_this2, path);
1117
996
  }
@@ -1131,19 +1010,19 @@ module.exports = application;
1131
1010
  /***/ (function(module, exports, __webpack_require__) {
1132
1011
 
1133
1012
  var _require = __webpack_require__(/*! events */ "../../node_modules/events/events.js"),
1134
- EventEmitter = _require.EventEmitter;
1013
+ EventEmitter = _require.EventEmitter;
1014
+ var Proto = __webpack_require__(/*! uberproto */ "../../node_modules/uberproto/lib/proto.js");
1135
1015
 
1136
- var Proto = __webpack_require__(/*! uberproto */ "../../node_modules/uberproto/lib/proto.js"); // Returns a hook that emits service events. Should always be
1016
+ // Returns a hook that emits service events. Should always be
1137
1017
  // used as the very last hook in the chain
1138
-
1139
-
1140
1018
  var eventHook = exports.eventHook = function eventHook() {
1141
1019
  return function (hook) {
1142
1020
  var app = hook.app,
1143
- service = hook.service;
1021
+ service = hook.service;
1144
1022
  var eventName = hook.event === null ? hook.event : app.eventMappings[hook.method];
1145
- 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
1023
+ var isHookEvent = service._hookEvents && service._hookEvents.indexOf(eventName) !== -1;
1146
1024
 
1025
+ // If this event is not being sent yet and we are not in an error hook
1147
1026
  if (eventName && isHookEvent && hook.type !== 'error') {
1148
1027
  var results = Array.isArray(hook.result) ? hook.result : [hook.result];
1149
1028
  results.forEach(function (element) {
@@ -1151,23 +1030,23 @@ var eventHook = exports.eventHook = function eventHook() {
1151
1030
  });
1152
1031
  }
1153
1032
  };
1154
- }; // Mixin that turns a service into a Node event emitter
1155
-
1033
+ };
1156
1034
 
1035
+ // Mixin that turns a service into a Node event emitter
1157
1036
  var eventMixin = exports.eventMixin = function eventMixin(service) {
1158
1037
  if (service._serviceEvents) {
1159
1038
  return;
1160
1039
  }
1040
+ var app = this;
1041
+ // Indicates if the service is already an event emitter
1042
+ var isEmitter = typeof service.on === 'function' && typeof service.emit === 'function';
1161
1043
 
1162
- var app = this; // Indicates if the service is already an event emitter
1163
-
1164
- 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)
1165
-
1044
+ // If not, mix it in (the service is always an Uberproto object that has a .mixin)
1166
1045
  if (typeof service.mixin === 'function' && !isEmitter) {
1167
1046
  service.mixin(EventEmitter.prototype);
1168
- } // Define non-enumerable properties of
1169
-
1047
+ }
1170
1048
 
1049
+ // Define non-enumerable properties of
1171
1050
  Object.defineProperties(service, {
1172
1051
  // A list of all events that this service sends
1173
1052
  _serviceEvents: {
@@ -1177,21 +1056,21 @@ var eventMixin = exports.eventMixin = function eventMixin(service) {
1177
1056
  _hookEvents: {
1178
1057
  value: []
1179
1058
  }
1180
- }); // `app.eventMappings` has the mapping from method name to event name
1059
+ });
1181
1060
 
1061
+ // `app.eventMappings` has the mapping from method name to event name
1182
1062
  Object.keys(app.eventMappings).forEach(function (method) {
1183
1063
  var event = app.eventMappings[method];
1184
- var alreadyEmits = service._serviceEvents.indexOf(event) !== -1; // Add events for known methods to _serviceEvents and _hookEvents
1185
- // if the service indicated it does not send it itself yet
1064
+ var alreadyEmits = service._serviceEvents.indexOf(event) !== -1;
1186
1065
 
1066
+ // Add events for known methods to _serviceEvents and _hookEvents
1067
+ // if the service indicated it does not send it itself yet
1187
1068
  if (typeof service[method] === 'function' && !alreadyEmits) {
1188
1069
  service._serviceEvents.push(event);
1189
-
1190
1070
  service._hookEvents.push(event);
1191
1071
  }
1192
1072
  });
1193
1073
  };
1194
-
1195
1074
  module.exports = function () {
1196
1075
  return function (app) {
1197
1076
  // Mappings from service method to event name
@@ -1202,13 +1081,15 @@ module.exports = function () {
1202
1081
  remove: 'removed',
1203
1082
  patch: 'patched'
1204
1083
  }
1205
- }); // Register the event hook
1206
- // `finally` hooks always run last after `error` and `after` hooks
1084
+ });
1207
1085
 
1086
+ // Register the event hook
1087
+ // `finally` hooks always run last after `error` and `after` hooks
1208
1088
  app.hooks({
1209
1089
  finally: eventHook()
1210
- }); // Make the app an event emitter
1090
+ });
1211
1091
 
1092
+ // Make the app an event emitter
1212
1093
  Proto.mixin(EventEmitter.prototype, app);
1213
1094
  app.mixins.push(eventMixin);
1214
1095
  };
@@ -1223,40 +1104,32 @@ module.exports = function () {
1223
1104
  /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
1224
1105
 
1225
1106
  var _require = __webpack_require__(/*! @feathersjs/commons */ "../commons/lib/index.js"),
1226
- _ = _require._;
1227
-
1107
+ _ = _require._;
1228
1108
  var assignArguments = function assignArguments(context) {
1229
1109
  var service = context.service,
1230
- method = context.method;
1110
+ method = context.method;
1231
1111
  var parameters = service.methods[method];
1232
1112
  context.arguments.forEach(function (value, index) {
1233
1113
  context[parameters[index]] = value;
1234
1114
  });
1235
-
1236
1115
  if (!context.params) {
1237
1116
  context.params = {};
1238
1117
  }
1239
-
1240
1118
  return context;
1241
1119
  };
1242
-
1243
1120
  var validate = function validate(context) {
1244
1121
  var service = context.service,
1245
- method = context.method,
1246
- path = context.path;
1122
+ method = context.method,
1123
+ path = context.path;
1247
1124
  var parameters = service.methods[method];
1248
-
1249
1125
  if (parameters.includes('id') && context.id === undefined) {
1250
1126
  throw new Error("An id must be provided to the '".concat(path, ".").concat(method, "' method"));
1251
1127
  }
1252
-
1253
1128
  if (parameters.includes('data') && !_.isObjectOrArray(context.data)) {
1254
1129
  throw new Error("A data object must be provided to the '".concat(path, ".").concat(method, "' method"));
1255
1130
  }
1256
-
1257
1131
  return context;
1258
1132
  };
1259
-
1260
1133
  module.exports = [assignArguments, validate];
1261
1134
 
1262
1135
  /***/ }),
@@ -1267,38 +1140,22 @@ module.exports = [assignArguments, validate];
1267
1140
  \**************************************/
1268
1141
  /***/ (function(module, exports, __webpack_require__) {
1269
1142
 
1270
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
1271
-
1272
- 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."); }
1273
-
1274
- 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); }
1275
-
1276
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
1277
-
1278
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
1279
-
1280
- 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; }
1281
-
1282
1143
  var _require = __webpack_require__(/*! @feathersjs/commons */ "../commons/lib/index.js"),
1283
- hooks = _require.hooks,
1284
- isPromise = _require.isPromise;
1285
-
1144
+ hooks = _require.hooks,
1145
+ isPromise = _require.isPromise;
1286
1146
  var baseHooks = __webpack_require__(/*! ./base */ "../feathers/lib/hooks/base.js");
1287
-
1288
1147
  var createHookObject = hooks.createHookObject,
1289
- getHooks = hooks.getHooks,
1290
- processHooks = hooks.processHooks,
1291
- enableHooks = hooks.enableHooks,
1292
- ACTIVATE_HOOKS = hooks.ACTIVATE_HOOKS;
1293
-
1148
+ getHooks = hooks.getHooks,
1149
+ processHooks = hooks.processHooks,
1150
+ enableHooks = hooks.enableHooks,
1151
+ ACTIVATE_HOOKS = hooks.ACTIVATE_HOOKS;
1294
1152
  var withHooks = function withHooks(_ref) {
1295
1153
  var app = _ref.app,
1296
- service = _ref.service,
1297
- method = _ref.method,
1298
- original = _ref.original;
1154
+ service = _ref.service,
1155
+ method = _ref.method,
1156
+ original = _ref.original;
1299
1157
  return function () {
1300
1158
  var _hooks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1301
-
1302
1159
  var hooks = app.hookTypes.reduce(function (result, type) {
1303
1160
  var value = _hooks[type] || [];
1304
1161
  result[type] = Array.isArray(value) ? value : [value];
@@ -1308,9 +1165,9 @@ var withHooks = function withHooks(_ref) {
1308
1165
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1309
1166
  args[_key] = arguments[_key];
1310
1167
  }
1168
+ var returnHook = args[args.length - 1] === true ? args.pop() : false;
1311
1169
 
1312
- var returnHook = args[args.length - 1] === true ? args.pop() : false; // Create the hook object that gets passed through
1313
-
1170
+ // Create the hook object that gets passed through
1314
1171
  var hookObject = createHookObject(method, {
1315
1172
  type: 'before',
1316
1173
  // initial hook object type
@@ -1318,28 +1175,30 @@ var withHooks = function withHooks(_ref) {
1318
1175
  service: service,
1319
1176
  app: app
1320
1177
  });
1321
- return Promise.resolve(hookObject) // Run `before` hooks
1178
+ return Promise.resolve(hookObject)
1179
+
1180
+ // Run `before` hooks
1322
1181
  .then(function (hookObject) {
1323
1182
  return processHooks.call(service, baseHooks.concat(hooks.before), hookObject);
1324
- }) // Run the original method
1183
+ })
1184
+
1185
+ // Run the original method
1325
1186
  .then(function (hookObject) {
1326
1187
  // If `hookObject.result` is set, skip the original method
1327
1188
  if (typeof hookObject.result !== 'undefined') {
1328
1189
  return hookObject;
1329
- } // Otherwise, call it with arguments created from the hook object
1330
-
1190
+ }
1331
1191
 
1192
+ // Otherwise, call it with arguments created from the hook object
1332
1193
  var promise = new Promise(function (resolve) {
1333
1194
  var func = original || service[method];
1334
1195
  var args = service.methods[method].map(function (value) {
1335
1196
  return hookObject[value];
1336
1197
  });
1337
1198
  var result = func.apply(service, args);
1338
-
1339
1199
  if (!isPromise(result)) {
1340
1200
  throw new Error("Service method '".concat(hookObject.method, "' for '").concat(hookObject.path, "' service must return a promise"));
1341
1201
  }
1342
-
1343
1202
  resolve(result);
1344
1203
  });
1345
1204
  return promise.then(function (result) {
@@ -1349,13 +1208,17 @@ var withHooks = function withHooks(_ref) {
1349
1208
  error.hook = hookObject;
1350
1209
  throw error;
1351
1210
  });
1352
- }) // Run `after` hooks
1211
+ })
1212
+
1213
+ // Run `after` hooks
1353
1214
  .then(function (hookObject) {
1354
1215
  var afterHookObject = Object.assign({}, hookObject, {
1355
1216
  type: 'after'
1356
1217
  });
1357
1218
  return processHooks.call(service, hooks.after, afterHookObject);
1358
- }) // Run `errors` hooks
1219
+ })
1220
+
1221
+ // Run `errors` hooks
1359
1222
  .catch(function (error) {
1360
1223
  var errorHookObject = Object.assign({}, error.hook, {
1361
1224
  type: 'error',
@@ -1370,7 +1233,9 @@ var withHooks = function withHooks(_ref) {
1370
1233
  });
1371
1234
  return errorHookObject;
1372
1235
  });
1373
- }) // Run `finally` hooks
1236
+ })
1237
+
1238
+ // Run `finally` hooks
1374
1239
  .then(function (hookObject) {
1375
1240
  return processHooks.call(service, hooks.finally, hookObject).catch(function (error) {
1376
1241
  var errorHookObject = Object.assign({}, error.hook, {
@@ -1379,7 +1244,9 @@ var withHooks = function withHooks(_ref) {
1379
1244
  });
1380
1245
  return errorHookObject;
1381
1246
  });
1382
- }) // Resolve with a result or reject with an error
1247
+ })
1248
+
1249
+ // Resolve with a result or reject with an error
1383
1250
  .then(function (hookObject) {
1384
1251
  if (typeof hookObject.error !== 'undefined' && typeof hookObject.result === 'undefined') {
1385
1252
  return Promise.reject(returnHook ? hookObject : hookObject.error);
@@ -1389,14 +1256,13 @@ var withHooks = function withHooks(_ref) {
1389
1256
  });
1390
1257
  };
1391
1258
  };
1392
- }; // A service mixin that adds `service.hooks()` method and functionality
1393
-
1259
+ };
1394
1260
 
1261
+ // A service mixin that adds `service.hooks()` method and functionality
1395
1262
  var hookMixin = exports.hookMixin = function hookMixin(service) {
1396
1263
  if (typeof service.hooks === 'function') {
1397
1264
  return;
1398
1265
  }
1399
-
1400
1266
  service.methods = Object.getOwnPropertyNames(service).filter(function (key) {
1401
1267
  return typeof service[key] === 'function' && service[key][ACTIVATE_HOOKS];
1402
1268
  }).reduce(function (result, methodName) {
@@ -1412,19 +1278,16 @@ var hookMixin = exports.hookMixin = function hookMixin(service) {
1412
1278
  remove: ['id', 'params']
1413
1279
  });
1414
1280
  var app = this;
1415
- var methodNames = Object.keys(service.methods); // Assemble the mixin object that contains all "hooked" service methods
1416
-
1281
+ var methodNames = Object.keys(service.methods);
1282
+ // Assemble the mixin object that contains all "hooked" service methods
1417
1283
  var mixin = methodNames.reduce(function (mixin, method) {
1418
1284
  if (typeof service[method] !== 'function') {
1419
1285
  return mixin;
1420
1286
  }
1421
-
1422
1287
  mixin[method] = function () {
1423
1288
  var service = this;
1424
1289
  var args = Array.from(arguments);
1425
-
1426
1290
  var original = service._super.bind(service);
1427
-
1428
1291
  return withHooks({
1429
1292
  app: app,
1430
1293
  service: service,
@@ -1435,32 +1298,30 @@ var hookMixin = exports.hookMixin = function hookMixin(service) {
1435
1298
  after: getHooks(app, service, 'after', method, true),
1436
1299
  error: getHooks(app, service, 'error', method, true),
1437
1300
  finally: getHooks(app, service, 'finally', method, true)
1438
- }).apply(void 0, _toConsumableArray(args));
1301
+ }).apply(void 0, args);
1439
1302
  };
1440
-
1441
1303
  return mixin;
1442
- }, {}); // Add .hooks method and properties to the service
1304
+ }, {});
1443
1305
 
1306
+ // Add .hooks method and properties to the service
1444
1307
  enableHooks(service, methodNames, app.hookTypes);
1445
1308
  service.mixin(mixin);
1446
1309
  };
1447
-
1448
1310
  module.exports = function () {
1449
1311
  return function (app) {
1450
1312
  // We store a reference of all supported hook types on the app
1451
1313
  // in case someone needs it
1452
1314
  Object.assign(app, {
1453
1315
  hookTypes: ['before', 'after', 'error', 'finally']
1454
- }); // Add functionality for hooks to be registered as app.hooks
1316
+ });
1455
1317
 
1318
+ // Add functionality for hooks to be registered as app.hooks
1456
1319
  enableHooks(app, app.methods, app.hookTypes);
1457
1320
  app.mixins.push(hookMixin);
1458
1321
  };
1459
1322
  };
1460
-
1461
1323
  module.exports.withHooks = withHooks;
1462
1324
  module.exports.ACTIVATE_HOOKS = ACTIVATE_HOOKS;
1463
-
1464
1325
  module.exports.activateHooks = function activateHooks(args) {
1465
1326
  return function (fn) {
1466
1327
  Object.defineProperty(fn, ACTIVATE_HOOKS, {
@@ -1479,32 +1340,28 @@ module.exports.activateHooks = function activateHooks(args) {
1479
1340
  /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
1480
1341
 
1481
1342
  var Proto = __webpack_require__(/*! uberproto */ "../../node_modules/uberproto/lib/proto.js");
1482
-
1483
1343
  var Application = __webpack_require__(/*! ./application */ "../feathers/lib/application.js");
1484
-
1485
1344
  var version = __webpack_require__(/*! ./version */ "../feathers/lib/version.js");
1486
-
1487
1345
  var _require = __webpack_require__(/*! ./hooks */ "../feathers/lib/hooks/index.js"),
1488
- ACTIVATE_HOOKS = _require.ACTIVATE_HOOKS,
1489
- activateHooks = _require.activateHooks; // A base object Prototype that does not inherit from a
1346
+ ACTIVATE_HOOKS = _require.ACTIVATE_HOOKS,
1347
+ activateHooks = _require.activateHooks;
1348
+ // A base object Prototype that does not inherit from a
1490
1349
  // potentially polluted Object prototype
1491
-
1492
-
1493
1350
  var baseObject = Object.create(null);
1494
-
1495
1351
  function createApplication() {
1496
- var app = Object.create(baseObject); // Mix in the base application
1352
+ var app = Object.create(baseObject);
1497
1353
 
1354
+ // Mix in the base application
1498
1355
  Proto.mixin(Application, app);
1499
1356
  app.init();
1500
1357
  return app;
1501
1358
  }
1502
-
1503
1359
  createApplication.version = version;
1504
1360
  createApplication.ACTIVATE_HOOKS = ACTIVATE_HOOKS;
1505
1361
  createApplication.activateHooks = activateHooks;
1506
- module.exports = createApplication; // For better ES module (TypeScript) compatibility
1362
+ module.exports = createApplication;
1507
1363
 
1364
+ // For better ES module (TypeScript) compatibility
1508
1365
  module.exports["default"] = createApplication;
1509
1366
 
1510
1367
  /***/ }),
@@ -1515,7 +1372,7 @@ module.exports["default"] = createApplication;
1515
1372
  \**********************************/
1516
1373
  /***/ (function(module) {
1517
1374
 
1518
- module.exports = '4.5.15';
1375
+ module.exports = '4.5.17';
1519
1376
 
1520
1377
  /***/ }),
1521
1378