@feathersjs/client 5.0.0-pre.3 → 5.0.0-pre.30

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
@@ -12,333 +12,247 @@ return /******/ (function() { // webpackBootstrap
12
12
  /******/ "use strict";
13
13
  /******/ var __webpack_modules__ = ({
14
14
 
15
- /***/ "../../node_modules/@feathersjs/hooks/lib/base.js":
16
- /*!********************************************************!*\
17
- !*** ../../node_modules/@feathersjs/hooks/lib/base.js ***!
18
- \********************************************************/
19
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
15
+ /***/ "../commons/lib/debug.js":
16
+ /*!*******************************!*\
17
+ !*** ../commons/lib/debug.js ***!
18
+ \*******************************/
19
+ /***/ (function(__unused_webpack_module, exports) {
20
20
 
21
21
 
22
22
 
23
- 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); }
23
+ Object.defineProperty(exports, "__esModule", ({
24
+ value: true
25
+ }));
26
+ exports.createDebug = exports.setDebug = exports.noopDebug = void 0;
27
+ var debuggers = {};
24
28
 
25
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
29
+ function noopDebug() {
30
+ return function () {};
31
+ }
26
32
 
27
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
33
+ exports.noopDebug = noopDebug;
34
+ var defaultInitializer = noopDebug;
28
35
 
29
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
36
+ function setDebug(debug) {
37
+ defaultInitializer = debug;
38
+ Object.keys(debuggers).forEach(function (name) {
39
+ debuggers[name] = debug(name);
40
+ });
41
+ }
30
42
 
31
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
43
+ exports.setDebug = setDebug;
32
44
 
33
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
45
+ function createDebug(name) {
46
+ if (!debuggers[name]) {
47
+ debuggers[name] = defaultInitializer(name);
48
+ }
34
49
 
35
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
50
+ return function () {
51
+ return debuggers[name].apply(debuggers, arguments);
52
+ };
53
+ }
36
54
 
37
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
55
+ exports.createDebug = createDebug;
38
56
 
39
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
57
+ /***/ }),
40
58
 
41
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
59
+ /***/ "../commons/lib/index.js":
60
+ /*!*******************************!*\
61
+ !*** ../commons/lib/index.js ***!
62
+ \*******************************/
63
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
42
64
 
43
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
44
65
 
45
- Object.defineProperty(exports, "__esModule", ({
46
- value: true
47
- }));
48
- exports.setMiddleware = exports.getMiddleware = exports.setManager = exports.getManager = exports.convertOptions = exports.HookManager = exports.BaseHookContext = exports.HOOKS = void 0;
49
66
 
50
- var utils_1 = __webpack_require__(/*! ./utils */ "../../node_modules/@feathersjs/hooks/lib/utils.js");
67
+ 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; }
51
68
 
52
- exports.HOOKS = Symbol('@feathersjs/hooks');
53
- /**
54
- * The base hook context.
55
- */
69
+ 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); }
56
70
 
57
- var BaseHookContext = function BaseHookContext() {
58
- var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
71
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
59
72
 
60
- _classCallCheck(this, BaseHookContext);
73
+ 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."); }
61
74
 
62
- Object.defineProperty(this, "self", {
63
- enumerable: true,
64
- configurable: true,
65
- writable: true,
66
- value: void 0
67
- });
68
- Object.assign(this, data);
69
- };
75
+ 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); }
70
76
 
71
- exports.BaseHookContext = BaseHookContext;
77
+ 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; }
72
78
 
73
- var HookManager = /*#__PURE__*/function () {
74
- function HookManager() {
75
- _classCallCheck(this, HookManager);
79
+ 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; }
76
80
 
77
- Object.defineProperty(this, "_parent", {
78
- enumerable: true,
79
- configurable: true,
80
- writable: true,
81
- value: null
82
- });
83
- Object.defineProperty(this, "_params", {
84
- enumerable: true,
85
- configurable: true,
86
- writable: true,
87
- value: null
88
- });
89
- Object.defineProperty(this, "_middleware", {
90
- enumerable: true,
91
- configurable: true,
92
- writable: true,
93
- value: null
94
- });
95
- Object.defineProperty(this, "_props", {
96
- enumerable: true,
97
- configurable: true,
98
- writable: true,
99
- value: null
100
- });
101
- Object.defineProperty(this, "_defaults", {
81
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
82
+
83
+ var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
84
+ if (k2 === undefined) k2 = k;
85
+ var desc = Object.getOwnPropertyDescriptor(m, k);
86
+
87
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
88
+ desc = {
102
89
  enumerable: true,
103
- configurable: true,
104
- writable: true,
105
- value: void 0
106
- });
90
+ get: function get() {
91
+ return m[k];
92
+ }
93
+ };
107
94
  }
108
95
 
109
- _createClass(HookManager, [{
110
- key: "parent",
111
- value: function parent(_parent) {
112
- this._parent = _parent;
113
- return this;
114
- }
115
- }, {
116
- key: "middleware",
117
- value: function middleware(_middleware) {
118
- this._middleware = (_middleware === null || _middleware === void 0 ? void 0 : _middleware.length) ? _middleware : null;
119
- return this;
120
- }
121
- }, {
122
- key: "getMiddleware",
123
- value: function getMiddleware() {
124
- var _a;
96
+ Object.defineProperty(o, k2, desc);
97
+ } : function (o, m, k, k2) {
98
+ if (k2 === undefined) k2 = k;
99
+ o[k2] = m[k];
100
+ });
125
101
 
126
- var previous = (_a = this._parent) === null || _a === void 0 ? void 0 : _a.getMiddleware();
102
+ var __exportStar = this && this.__exportStar || function (m, exports) {
103
+ for (var p in m) {
104
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
105
+ }
106
+ };
127
107
 
128
- if (previous && this._middleware) {
129
- return previous.concat(this._middleware);
130
- }
108
+ Object.defineProperty(exports, "__esModule", ({
109
+ value: true
110
+ }));
111
+ exports.createSymbol = exports.isPromise = exports._ = exports.stripSlashes = void 0; // Removes all leading and trailing slashes from a path
131
112
 
132
- return previous || this._middleware;
133
- }
134
- }, {
135
- key: "collectMiddleware",
136
- value: function collectMiddleware(self, _args) {
137
- var otherMiddleware = getMiddleware(self);
138
- var middleware = this.getMiddleware();
113
+ function stripSlashes(name) {
114
+ return name.replace(/^(\/+)|(\/+)$/g, '');
115
+ }
139
116
 
140
- if (otherMiddleware && middleware) {
141
- return otherMiddleware.concat(middleware);
142
- }
117
+ exports.stripSlashes = stripSlashes; // A set of lodash-y utility functions that use ES6
143
118
 
144
- return otherMiddleware || middleware || [];
119
+ exports._ = {
120
+ each: function each(obj, callback) {
121
+ if (obj && typeof obj.forEach === 'function') {
122
+ obj.forEach(callback);
123
+ } else if (exports._.isObject(obj)) {
124
+ Object.keys(obj).forEach(function (key) {
125
+ return callback(obj[key], key);
126
+ });
145
127
  }
146
- }, {
147
- key: "props",
148
- value: function props(_props) {
149
- if (!this._props) {
150
- this._props = {};
151
- }
128
+ },
129
+ some: function some(value, callback) {
130
+ return Object.keys(value).map(function (key) {
131
+ return [value[key], key];
132
+ }).some(function (_ref) {
133
+ var _ref2 = _slicedToArray(_ref, 2),
134
+ val = _ref2[0],
135
+ key = _ref2[1];
152
136
 
153
- utils_1.copyProperties(this._props, _props);
154
- return this;
155
- }
156
- }, {
157
- key: "getProps",
158
- value: function getProps() {
159
- var _a;
137
+ return callback(val, key);
138
+ });
139
+ },
140
+ every: function every(value, callback) {
141
+ return Object.keys(value).map(function (key) {
142
+ return [value[key], key];
143
+ }).every(function (_ref3) {
144
+ var _ref4 = _slicedToArray(_ref3, 2),
145
+ val = _ref4[0],
146
+ key = _ref4[1];
160
147
 
161
- var previous = (_a = this._parent) === null || _a === void 0 ? void 0 : _a.getProps();
148
+ return callback(val, key);
149
+ });
150
+ },
151
+ keys: function keys(obj) {
152
+ return Object.keys(obj);
153
+ },
154
+ values: function values(obj) {
155
+ return exports._.keys(obj).map(function (key) {
156
+ return obj[key];
157
+ });
158
+ },
159
+ isMatch: function isMatch(obj, item) {
160
+ return exports._.keys(item).every(function (key) {
161
+ return obj[key] === item[key];
162
+ });
163
+ },
164
+ isEmpty: function isEmpty(obj) {
165
+ return exports._.keys(obj).length === 0;
166
+ },
167
+ isObject: function isObject(item) {
168
+ return _typeof(item) === 'object' && !Array.isArray(item) && item !== null;
169
+ },
170
+ isObjectOrArray: function isObjectOrArray(value) {
171
+ return _typeof(value) === 'object' && value !== null;
172
+ },
173
+ extend: function extend(first) {
174
+ for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
175
+ rest[_key - 1] = arguments[_key];
176
+ }
162
177
 
163
- if (previous && this._props) {
164
- return utils_1.copyProperties({}, previous, this._props);
165
- }
178
+ return Object.assign.apply(Object, [first].concat(rest));
179
+ },
180
+ omit: function omit(obj) {
181
+ var result = exports._.extend({}, obj);
166
182
 
167
- return previous || this._props || null;
183
+ for (var _len2 = arguments.length, keys = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
184
+ keys[_key2 - 1] = arguments[_key2];
168
185
  }
169
- }, {
170
- key: "params",
171
- value: function params() {
172
- for (var _len = arguments.length, _params = new Array(_len), _key = 0; _key < _len; _key++) {
173
- _params[_key] = arguments[_key];
174
- }
175
186
 
176
- this._params = _params;
177
- return this;
187
+ keys.forEach(function (key) {
188
+ return delete result[key];
189
+ });
190
+ return result;
191
+ },
192
+ pick: function pick(source) {
193
+ for (var _len3 = arguments.length, keys = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
194
+ keys[_key3 - 1] = arguments[_key3];
178
195
  }
179
- }, {
180
- key: "getParams",
181
- value: function getParams() {
182
- var _a;
183
-
184
- var previous = (_a = this._parent) === null || _a === void 0 ? void 0 : _a.getParams();
185
196
 
186
- if (previous && this._params) {
187
- return previous.concat(this._params);
197
+ return keys.reduce(function (result, key) {
198
+ if (source[key] !== undefined) {
199
+ result[key] = source[key];
188
200
  }
189
201
 
190
- return previous || this._params;
191
- }
192
- }, {
193
- key: "defaults",
194
- value: function defaults(_defaults) {
195
- this._defaults = _defaults;
196
- return this;
197
- }
198
- }, {
199
- key: "getDefaults",
200
- value: function getDefaults(self, args, context) {
201
- var _a;
202
-
203
- var defaults = typeof this._defaults === 'function' ? this._defaults(self, args, context) : null;
204
- var previous = (_a = this._parent) === null || _a === void 0 ? void 0 : _a.getDefaults(self, args, context);
205
-
206
- if (previous && defaults) {
207
- return Object.assign({}, previous, defaults);
208
- }
209
-
210
- return previous || defaults;
211
- }
212
- }, {
213
- key: "getContextClass",
214
- value: function getContextClass() {
215
- var Base = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : BaseHookContext;
216
-
217
- var ContextClass = /*#__PURE__*/function (_Base) {
218
- _inherits(ContextClass, _Base);
219
-
220
- var _super = _createSuper(ContextClass);
221
-
222
- function ContextClass(data) {
223
- var _this;
224
-
225
- _classCallCheck(this, ContextClass);
226
-
227
- _this = _super.call(this, data);
228
- utils_1.copyToSelf(_assertThisInitialized(_this));
229
- return _this;
230
- }
231
-
232
- return ContextClass;
233
- }(Base);
234
-
235
- var params = this.getParams();
236
- var props = this.getProps();
237
-
238
- if (params) {
239
- params.forEach(function (name, index) {
240
- if ((props === null || props === void 0 ? void 0 : props[name]) !== undefined) {
241
- throw new Error("Hooks can not have a property and param named '".concat(name, "'. Use .defaults instead."));
202
+ return result;
203
+ }, {});
204
+ },
205
+ // Recursively merge the source object into the target object
206
+ merge: function merge(target, source) {
207
+ if (exports._.isObject(target) && exports._.isObject(source)) {
208
+ Object.keys(source).forEach(function (key) {
209
+ if (exports._.isObject(source[key])) {
210
+ if (!target[key]) {
211
+ Object.assign(target, _defineProperty({}, key, {}));
242
212
  }
243
213
 
244
- Object.defineProperty(ContextClass.prototype, name, {
245
- enumerable: true,
246
- get: function get() {
247
- return this === null || this === void 0 ? void 0 : this.arguments[index];
248
- },
249
- set: function set(value) {
250
- this.arguments[index] = value;
251
- }
252
- });
253
- });
254
- }
255
-
256
- if (props) {
257
- utils_1.copyProperties(ContextClass.prototype, props);
258
- }
259
-
260
- return ContextClass;
261
- }
262
- }, {
263
- key: "initializeContext",
264
- value: function initializeContext(self, args, context) {
265
- var ctx = this._parent ? this._parent.initializeContext(self, args, context) : context;
266
- var defaults = this.getDefaults(self, args, ctx);
267
-
268
- if (self) {
269
- ctx.self = self;
270
- }
271
-
272
- ctx.arguments = args;
273
-
274
- if (defaults) {
275
- for (var _i = 0, _Object$keys = Object.keys(defaults); _i < _Object$keys.length; _i++) {
276
- var name = _Object$keys[_i];
277
-
278
- if (ctx[name] === undefined) {
279
- ctx[name] = defaults[name];
280
- }
214
+ exports._.merge(target[key], source[key]);
215
+ } else {
216
+ Object.assign(target, _defineProperty({}, key, source[key]));
281
217
  }
282
- }
283
-
284
- return ctx;
218
+ });
285
219
  }
286
- }]);
287
-
288
- return HookManager;
289
- }();
290
-
291
- exports.HookManager = HookManager;
292
-
293
- function convertOptions() {
294
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
295
220
 
296
- if (!options) {
297
- return new HookManager();
221
+ return target;
298
222
  }
223
+ }; // Duck-checks if an object looks like a promise
299
224
 
300
- return Array.isArray(options) ? new HookManager().middleware(options) : options;
225
+ function isPromise(result) {
226
+ return exports._.isObject(result) && typeof result.then === 'function';
301
227
  }
302
228
 
303
- exports.convertOptions = convertOptions;
229
+ exports.isPromise = isPromise;
304
230
 
305
- function getManager(target) {
306
- return target && target[exports.HOOKS] || null;
231
+ function createSymbol(name) {
232
+ return typeof Symbol !== 'undefined' ? Symbol(name) : name;
307
233
  }
308
234
 
309
- exports.getManager = getManager;
310
-
311
- function setManager(target, manager) {
312
- var parent = getManager(target);
313
- target[exports.HOOKS] = manager.parent(parent);
314
- return target;
315
- }
235
+ exports.createSymbol = createSymbol;
316
236
 
317
- exports.setManager = setManager;
237
+ __exportStar(__webpack_require__(/*! ./debug */ "../commons/lib/debug.js"), exports);
318
238
 
319
- function getMiddleware(target) {
320
- var manager = getManager(target);
321
- return manager ? manager.getMiddleware() : null;
322
- }
239
+ /***/ }),
323
240
 
324
- exports.getMiddleware = getMiddleware;
241
+ /***/ "../feathers/lib/application.js":
242
+ /*!**************************************!*\
243
+ !*** ../feathers/lib/application.js ***!
244
+ \**************************************/
245
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
325
246
 
326
- function setMiddleware(target, middleware) {
327
- var manager = new HookManager().middleware(middleware);
328
- return setManager(target, manager);
329
- }
330
247
 
331
- exports.setMiddleware = setMiddleware;
332
248
 
333
- /***/ }),
249
+ 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); }
334
250
 
335
- /***/ "../../node_modules/@feathersjs/hooks/lib/compose.js":
336
- /*!***********************************************************!*\
337
- !*** ../../node_modules/@feathersjs/hooks/lib/compose.js ***!
338
- \***********************************************************/
339
- /***/ (function(__unused_webpack_module, exports) {
251
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
340
252
 
253
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
341
254
 
255
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
342
256
 
343
257
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
344
258
 
@@ -346,494 +260,652 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
346
260
 
347
261
  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; }
348
262
 
349
- Object.defineProperty(exports, "__esModule", ({
350
- value: true
351
- }));
352
- exports.compose = void 0;
263
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
353
264
 
354
- function compose(middleware) {
355
- if (!Array.isArray(middleware)) {
356
- throw new TypeError('Middleware stack must be an array!');
357
- }
265
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
358
266
 
359
- var _iterator = _createForOfIteratorHelper(middleware),
360
- _step;
267
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
361
268
 
362
- try {
363
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
364
- var fn = _step.value;
269
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
365
270
 
366
- if (typeof fn !== 'function') {
367
- throw new TypeError('Middleware must be composed of functions!');
368
- }
369
- }
370
- } catch (err) {
371
- _iterator.e(err);
372
- } finally {
373
- _iterator.f();
374
- }
271
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
375
272
 
376
- return function (context, next) {
377
- // last called middleware #
378
- var index = -1;
379
- return dispatch.call(this, 0);
273
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
380
274
 
381
- function dispatch(i) {
382
- if (i <= index) {
383
- return Promise.reject(new Error('next() called multiple times'));
384
- }
275
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
385
276
 
386
- index = i;
387
- var fn = middleware[i];
277
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
388
278
 
389
- if (i === middleware.length) {
390
- fn = next;
391
- }
279
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
392
280
 
393
- if (!fn) {
394
- return Promise.resolve();
395
- }
281
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
396
282
 
397
- try {
398
- return Promise.resolve(fn.call(this, context, dispatch.bind(this, i + 1)));
399
- } catch (err) {
400
- return Promise.reject(err);
401
- }
402
- }
283
+ var __importDefault = this && this.__importDefault || function (mod) {
284
+ return mod && mod.__esModule ? mod : {
285
+ "default": mod
403
286
  };
404
- }
405
-
406
- exports.compose = compose;
407
-
408
- /***/ }),
409
-
410
- /***/ "../../node_modules/@feathersjs/hooks/lib/hooks.js":
411
- /*!*********************************************************!*\
412
- !*** ../../node_modules/@feathersjs/hooks/lib/hooks.js ***!
413
- \*********************************************************/
414
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
415
-
416
-
287
+ };
417
288
 
418
289
  Object.defineProperty(exports, "__esModule", ({
419
290
  value: true
420
291
  }));
421
- exports.hookDecorator = exports.objectHooks = exports.functionHooks = exports.getOriginal = void 0;
422
-
423
- var compose_1 = __webpack_require__(/*! ./compose */ "../../node_modules/@feathersjs/hooks/lib/compose.js");
292
+ exports.Feathers = void 0;
424
293
 
425
- var base_1 = __webpack_require__(/*! ./base */ "../../node_modules/@feathersjs/hooks/lib/base.js");
294
+ var version_1 = __importDefault(__webpack_require__(/*! ./version */ "../feathers/lib/version.js"));
426
295
 
427
- var utils_1 = __webpack_require__(/*! ./utils */ "../../node_modules/@feathersjs/hooks/lib/utils.js");
296
+ var events_1 = __webpack_require__(/*! events */ "../../node_modules/events/events.js");
428
297
 
429
- function getOriginal(fn) {
430
- return typeof fn.original === 'function' ? getOriginal(fn.original) : fn;
431
- }
298
+ var commons_1 = __webpack_require__(/*! @feathersjs/commons */ "../commons/lib/index.js");
432
299
 
433
- exports.getOriginal = getOriginal;
300
+ var hooks_1 = __webpack_require__(/*! @feathersjs/hooks */ "../../node_modules/@feathersjs/hooks/script/index.js");
434
301
 
435
- function functionHooks(fn, managerOrMiddleware) {
436
- if (typeof fn !== 'function') {
437
- throw new Error('Can not apply hooks to non-function');
438
- }
302
+ var events_2 = __webpack_require__(/*! ./events */ "../feathers/lib/events.js");
439
303
 
440
- var manager = base_1.convertOptions(managerOrMiddleware);
304
+ var hooks_2 = __webpack_require__(/*! ./hooks */ "../feathers/lib/hooks.js");
441
305
 
442
- var wrapper = function wrapper() {
443
- var _this = this;
306
+ var service_1 = __webpack_require__(/*! ./service */ "../feathers/lib/service.js");
444
307
 
445
- var Context = wrapper.Context,
446
- original = wrapper.original; // If we got passed an existing HookContext instance, we want to return it as well
308
+ var hooks_3 = __webpack_require__(/*! ./hooks */ "../feathers/lib/hooks.js");
447
309
 
448
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
449
- args[_key] = arguments[_key];
450
- }
310
+ var debug = (0, commons_1.createDebug)('@feathersjs/feathers');
451
311
 
452
- var returnContext = args[args.length - 1] instanceof Context; // Use existing context or default
312
+ var Feathers = /*#__PURE__*/function (_events_1$EventEmitte) {
313
+ _inherits(Feathers, _events_1$EventEmitte);
453
314
 
454
- var base = returnContext ? args.pop() : new Context(); // Initialize the context
315
+ var _super = _createSuper(Feathers);
455
316
 
456
- var context = manager.initializeContext(this, args, base); // Assemble the hook chain
317
+ function Feathers() {
318
+ var _this;
457
319
 
458
- var hookChain = [// Return `ctx.result` or the context
459
- function (ctx, next) {
460
- return next().then(function () {
461
- return returnContext ? ctx : ctx.result;
462
- });
463
- }]; // Create the hook chain by calling the `collectMiddleware function
320
+ _classCallCheck(this, Feathers);
464
321
 
465
- var mw = manager.collectMiddleware(this, args);
322
+ _this = _super.call(this);
323
+ _this.services = {};
324
+ _this.settings = {};
325
+ _this.mixins = [hooks_2.hookMixin, events_2.eventMixin];
326
+ _this.version = version_1.default;
327
+ _this._isSetup = false;
328
+ _this.registerHooks = (0, hooks_3.enableHooks)(_assertThisInitialized(_this));
466
329
 
467
- if (mw) {
468
- Array.prototype.push.apply(hookChain, mw);
469
- } // Runs the actual original method if `ctx.result` is not already set
330
+ _this.registerHooks({
331
+ around: [events_2.eventHook]
332
+ });
470
333
 
334
+ return _this;
335
+ }
471
336
 
472
- hookChain.push(function (ctx, next) {
473
- if (!Object.prototype.hasOwnProperty.call(context, 'result')) {
474
- return Promise.resolve(original.apply(_this, ctx.arguments)).then(function (result) {
475
- ctx.result = result;
476
- return next();
477
- });
478
- }
337
+ _createClass(Feathers, [{
338
+ key: "get",
339
+ value: function get(name) {
340
+ return this.settings[name];
341
+ }
342
+ }, {
343
+ key: "set",
344
+ value: function set(name, value) {
345
+ this.settings[name] = value;
346
+ return this;
347
+ }
348
+ }, {
349
+ key: "configure",
350
+ value: function configure(callback) {
351
+ callback.call(this, this);
352
+ return this;
353
+ }
354
+ }, {
355
+ key: "defaultService",
356
+ value: function defaultService(location) {
357
+ throw new Error("Can not find service '".concat(location, "'"));
358
+ }
359
+ }, {
360
+ key: "service",
361
+ value: function service(location) {
362
+ var path = (0, commons_1.stripSlashes)(location) || '/';
363
+ var current = this.services[path];
479
364
 
480
- return next();
481
- });
482
- return compose_1.compose(hookChain).call(this, context);
483
- };
365
+ if (typeof current === 'undefined') {
366
+ this.use(path, this.defaultService(path));
367
+ return this.service(path);
368
+ }
484
369
 
485
- utils_1.copyFnProperties(wrapper, fn);
486
- utils_1.copyProperties(wrapper, fn);
487
- base_1.setManager(wrapper, manager);
488
- return Object.assign(wrapper, {
489
- original: getOriginal(fn),
490
- Context: manager.getContextClass(),
491
- createContext: function createContext() {
492
- var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
493
- return new wrapper.Context(data);
370
+ return current;
494
371
  }
495
- });
496
- }
497
-
498
- exports.functionHooks = functionHooks;
499
- ;
372
+ }, {
373
+ key: "_setup",
374
+ value: function _setup() {
375
+ var _this2 = this;
500
376
 
501
- function objectHooks(_obj, hooks) {
502
- var obj = typeof _obj === 'function' ? _obj.prototype : _obj;
377
+ this._isSetup = true;
378
+ return Object.keys(this.services).reduce(function (current, path) {
379
+ return current.then(function () {
380
+ var service = _this2.service(path);
503
381
 
504
- if (Array.isArray(hooks)) {
505
- return base_1.setMiddleware(obj, hooks);
506
- }
382
+ if (typeof service.setup === 'function') {
383
+ debug("Setting up service for `".concat(path, "`"));
384
+ return service.setup(_this2, path);
385
+ }
386
+ });
387
+ }, Promise.resolve()).then(function () {
388
+ return _this2;
389
+ });
390
+ }
391
+ }, {
392
+ key: "setup",
393
+ get: function get() {
394
+ return this._setup;
395
+ },
396
+ set: function set(value) {
397
+ this._setup = value[hooks_1.HOOKS] ? value : (0, hooks_1.hooks)(value, (0, hooks_1.middleware)().params('server').props({
398
+ app: this
399
+ }));
400
+ }
401
+ }, {
402
+ key: "_teardown",
403
+ value: function _teardown() {
404
+ var _this3 = this;
507
405
 
508
- return Object.keys(hooks).reduce(function (result, method) {
509
- var fn = obj[method];
406
+ this._isSetup = false;
407
+ return Object.keys(this.services).reduce(function (current, path) {
408
+ return current.then(function () {
409
+ var service = _this3.service(path);
510
410
 
511
- if (typeof fn !== 'function') {
512
- throw new Error("Can not apply hooks. '".concat(method, "' is not a function"));
411
+ if (typeof service.teardown === 'function') {
412
+ debug("Tearing down service for `".concat(path, "`"));
413
+ return service.teardown(_this3, path);
414
+ }
415
+ });
416
+ }, Promise.resolve()).then(function () {
417
+ return _this3;
418
+ });
513
419
  }
420
+ }, {
421
+ key: "teardown",
422
+ get: function get() {
423
+ return this._teardown;
424
+ },
425
+ set: function set(value) {
426
+ this._teardown = value[hooks_1.HOOKS] ? value : (0, hooks_1.hooks)(value, (0, hooks_1.middleware)().params('server').props({
427
+ app: this
428
+ }));
429
+ }
430
+ }, {
431
+ key: "use",
432
+ value: function use(path, service, options) {
433
+ var _this4 = this;
514
434
 
515
- var manager = base_1.convertOptions(hooks[method]);
516
- result[method] = functionHooks(fn, manager.props({
517
- method: method
518
- }));
519
- return result;
520
- }, obj);
521
- }
522
-
523
- exports.objectHooks = objectHooks;
524
- ;
435
+ if (typeof path !== 'string') {
436
+ throw new Error("'".concat(path, "' is not a valid service path."));
437
+ }
525
438
 
526
- var hookDecorator = function hookDecorator(managerOrMiddleware) {
527
- var wrapper = function wrapper(_target, method, descriptor) {
528
- var manager = base_1.convertOptions(managerOrMiddleware);
439
+ var location = (0, commons_1.stripSlashes)(path) || '/';
440
+ var subApp = service;
441
+ var isSubApp = typeof subApp.service === 'function' && subApp.services;
529
442
 
530
- if (!descriptor) {
531
- base_1.setManager(_target.prototype, manager);
532
- return _target;
533
- }
443
+ if (isSubApp) {
444
+ Object.keys(subApp.services).forEach(function (subPath) {
445
+ return _this4.use("".concat(location, "/").concat(subPath), subApp.service(subPath));
446
+ });
447
+ return this;
448
+ }
534
449
 
535
- var fn = descriptor.value;
450
+ var protoService = (0, service_1.wrapService)(location, service, options);
451
+ var serviceOptions = (0, service_1.getServiceOptions)(protoService);
536
452
 
537
- if (typeof fn !== 'function') {
538
- throw new Error("Can not apply hooks. '".concat(method, "' is not a function"));
539
- }
453
+ var _iterator = _createForOfIteratorHelper(service_1.protectedMethods),
454
+ _step;
540
455
 
541
- descriptor.value = functionHooks(fn, manager.props({
542
- method: method
543
- }));
544
- return descriptor;
545
- };
456
+ try {
457
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
458
+ var name = _step.value;
546
459
 
547
- return wrapper;
548
- };
460
+ if (serviceOptions.methods.includes(name)) {
461
+ throw new Error("'".concat(name, "' on service '").concat(location, "' is not allowed as a custom method name"));
462
+ }
463
+ }
464
+ } catch (err) {
465
+ _iterator.e(err);
466
+ } finally {
467
+ _iterator.f();
468
+ }
549
469
 
550
- exports.hookDecorator = hookDecorator;
470
+ debug("Registering new service at `".concat(location, "`")); // Add all the mixins
551
471
 
552
- /***/ }),
472
+ this.mixins.forEach(function (fn) {
473
+ return fn.call(_this4, protoService, location, serviceOptions);
474
+ });
475
+ this.services[location] = protoService; // If we ran setup already, set this service up explicitly, this will not `await`
553
476
 
554
- /***/ "../../node_modules/@feathersjs/hooks/lib/index.js":
555
- /*!*********************************************************!*\
556
- !*** ../../node_modules/@feathersjs/hooks/lib/index.js ***!
557
- \*********************************************************/
558
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
477
+ if (this._isSetup && typeof protoService.setup === 'function') {
478
+ debug("Setting up service for `".concat(location, "`"));
479
+ protoService.setup(this, location);
480
+ }
559
481
 
482
+ return this;
483
+ }
484
+ }, {
485
+ key: "unuse",
486
+ value: function () {
487
+ var _unuse = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(location) {
488
+ var path, service;
489
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
490
+ while (1) {
491
+ switch (_context.prev = _context.next) {
492
+ case 0:
493
+ path = (0, commons_1.stripSlashes)(location) || '/';
494
+ service = this.services[path];
495
+
496
+ if (!(service && typeof service.teardown === 'function')) {
497
+ _context.next = 5;
498
+ break;
499
+ }
500
+
501
+ _context.next = 5;
502
+ return service.teardown(this, path);
503
+
504
+ case 5:
505
+ delete this.services[path];
506
+ return _context.abrupt("return", service);
507
+
508
+ case 7:
509
+ case "end":
510
+ return _context.stop();
511
+ }
512
+ }
513
+ }, _callee, this);
514
+ }));
560
515
 
516
+ function unuse(_x) {
517
+ return _unuse.apply(this, arguments);
518
+ }
561
519
 
562
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
520
+ return unuse;
521
+ }()
522
+ }, {
523
+ key: "hooks",
524
+ value: function hooks(hookMap) {
525
+ var untypedMap = hookMap;
526
+
527
+ if (untypedMap.before || untypedMap.after || untypedMap.error || untypedMap.around) {
528
+ // regular hooks for all service methods
529
+ this.registerHooks(untypedMap);
530
+ } else if (untypedMap.setup || untypedMap.teardown) {
531
+ // .setup and .teardown application hooks
532
+ (0, hooks_1.hooks)(this, untypedMap);
533
+ } else {
534
+ // Other registration formats are just `around` hooks
535
+ this.registerHooks({
536
+ around: untypedMap
537
+ });
538
+ }
563
539
 
564
- 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."); }
540
+ return this;
541
+ }
542
+ }]);
565
543
 
566
- 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); }
544
+ return Feathers;
545
+ }(events_1.EventEmitter);
567
546
 
568
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
547
+ exports.Feathers = Feathers;
569
548
 
570
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
549
+ /***/ }),
571
550
 
572
- 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; }
551
+ /***/ "../feathers/lib/declarations.js":
552
+ /*!***************************************!*\
553
+ !*** ../feathers/lib/declarations.js ***!
554
+ \***************************************/
555
+ /***/ (function(__unused_webpack_module, exports) {
573
556
 
574
- var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
575
- if (k2 === undefined) k2 = k;
576
- Object.defineProperty(o, k2, {
577
- enumerable: true,
578
- get: function get() {
579
- return m[k];
580
- }
581
- });
582
- } : function (o, m, k, k2) {
583
- if (k2 === undefined) k2 = k;
584
- o[k2] = m[k];
585
- });
586
557
 
587
- var __exportStar = this && this.__exportStar || function (m, exports) {
588
- for (var p in m) {
589
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
590
- }
591
- };
592
558
 
593
559
  Object.defineProperty(exports, "__esModule", ({
594
560
  value: true
595
561
  }));
596
- exports.hooks = exports.middleware = void 0;
597
562
 
598
- var base_1 = __webpack_require__(/*! ./base */ "../../node_modules/@feathersjs/hooks/lib/base.js");
563
+ /***/ }),
599
564
 
600
- var hooks_1 = __webpack_require__(/*! ./hooks */ "../../node_modules/@feathersjs/hooks/lib/hooks.js");
565
+ /***/ "../feathers/lib/events.js":
566
+ /*!*********************************!*\
567
+ !*** ../feathers/lib/events.js ***!
568
+ \*********************************/
569
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
601
570
 
602
- __exportStar(__webpack_require__(/*! ./hooks */ "../../node_modules/@feathersjs/hooks/lib/hooks.js"), exports);
603
571
 
604
- __exportStar(__webpack_require__(/*! ./compose */ "../../node_modules/@feathersjs/hooks/lib/compose.js"), exports);
605
572
 
606
- __exportStar(__webpack_require__(/*! ./base */ "../../node_modules/@feathersjs/hooks/lib/base.js"), exports);
607
- /**
608
- * Initializes a hook settings object with the given middleware.
609
- * @param mw The list of middleware
610
- * @param options Middleware options (params, default, props)
611
- */
573
+ Object.defineProperty(exports, "__esModule", ({
574
+ value: true
575
+ }));
576
+ exports.eventMixin = exports.eventHook = void 0;
612
577
 
578
+ var events_1 = __webpack_require__(/*! events */ "../../node_modules/events/events.js");
613
579
 
614
- function middleware(mw, options) {
615
- var manager = new base_1.HookManager().middleware(mw);
580
+ var service_1 = __webpack_require__(/*! ./service */ "../feathers/lib/service.js");
616
581
 
617
- if (options) {
618
- if (options.params) {
619
- manager.params.apply(manager, _toConsumableArray(options.params));
620
- }
582
+ function eventHook(context, next) {
583
+ var _ref = (0, service_1.getServiceOptions)(context.self),
584
+ events = _ref.events;
621
585
 
622
- if (options.defaults) {
623
- manager.defaults(options.defaults);
586
+ var defaultEvent = service_1.defaultEventMap[context.method] || null;
587
+ context.event = defaultEvent;
588
+ return next().then(function () {
589
+ // Send the event only if the service does not do so already (indicated in the `events` option)
590
+ // This is used for custom events and for client services receiving event from the server
591
+ if (typeof context.event === 'string' && !events.includes(context.event)) {
592
+ var results = Array.isArray(context.result) ? context.result : [context.result];
593
+ results.forEach(function (element) {
594
+ return context.self.emit(context.event, element, context);
595
+ });
624
596
  }
597
+ });
598
+ }
625
599
 
626
- if (options.props) {
627
- manager.props(options.props);
628
- }
600
+ exports.eventHook = eventHook;
601
+
602
+ function eventMixin(service) {
603
+ var isEmitter = typeof service.on === 'function' && typeof service.emit === 'function';
604
+
605
+ if (!isEmitter) {
606
+ Object.assign(service, events_1.EventEmitter.prototype);
629
607
  }
630
608
 
631
- return manager;
609
+ return service;
632
610
  }
633
611
 
634
- exports.middleware = middleware; // Fallthrough to actual implementation
612
+ exports.eventMixin = eventMixin;
635
613
 
636
- function hooks() {
637
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
638
- args[_key] = arguments[_key];
639
- }
614
+ /***/ }),
640
615
 
641
- var target = args[0],
642
- _hooks = args[1];
616
+ /***/ "../feathers/lib/hooks.js":
617
+ /*!********************************!*\
618
+ !*** ../feathers/lib/hooks.js ***!
619
+ \********************************/
620
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
643
621
 
644
- if (typeof target === 'function' && (_hooks instanceof base_1.HookManager || Array.isArray(_hooks) || args.length === 1)) {
645
- return hooks_1.functionHooks(target, _hooks);
646
- }
647
622
 
648
- if (args.length === 2) {
649
- return hooks_1.objectHooks(target, _hooks);
650
- }
651
623
 
652
- return hooks_1.hookDecorator(target);
653
- }
624
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
654
625
 
655
- exports.hooks = hooks;
626
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
656
627
 
657
- /***/ }),
628
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
658
629
 
659
- /***/ "../../node_modules/@feathersjs/hooks/lib/utils.js":
660
- /*!*********************************************************!*\
661
- !*** ../../node_modules/@feathersjs/hooks/lib/utils.js ***!
662
- \*********************************************************/
663
- /***/ (function(__unused_webpack_module, exports) {
630
+ function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
664
631
 
632
+ function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
665
633
 
634
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
666
635
 
667
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
636
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
668
637
 
669
- 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); }
638
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
670
639
 
671
- 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; }
640
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
672
641
 
673
- Object.defineProperty(exports, "__esModule", ({
674
- value: true
675
- }));
676
- exports.copyFnProperties = exports.copyProperties = exports.copyToSelf = void 0;
677
- var proto = Object.prototype; // These are non-standard but offer a more reliable prototype based
678
- // lookup for properties
642
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
679
643
 
680
- var hasProtoDefinitions = typeof proto.__lookupGetter__ === 'function' && typeof proto.__defineGetter__ === 'function' && typeof proto.__defineSetter__ === 'function';
644
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
681
645
 
682
- function copyToSelf(target) {
683
- // tslint:disable-next-line
684
- for (var key in target) {
685
- if (!target.hasOwnProperty(key)) {
686
- var getter = hasProtoDefinitions ? target.constructor.prototype.__lookupGetter__(key) : Object.getOwnPropertyDescriptor(target, key);
646
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
687
647
 
688
- if (hasProtoDefinitions && getter) {
689
- target.__defineGetter__(key, getter);
648
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
690
649
 
691
- var setter = target.constructor.prototype.__lookupSetter__(key);
650
+ 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."); }
692
651
 
693
- if (setter) {
694
- target.__defineSetter__(key, setter);
695
- }
696
- } else if (getter) {
697
- Object.defineProperty(target, key, getter);
698
- } else {
699
- target[key] = target[key];
700
- }
701
- }
702
- }
703
- }
652
+ 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); }
704
653
 
705
- exports.copyToSelf = copyToSelf;
654
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
706
655
 
707
- function copyProperties(target) {
708
- for (var _len = arguments.length, originals = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
709
- originals[_key - 1] = arguments[_key];
710
- }
656
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
711
657
 
712
- for (var _i = 0, _originals = originals; _i < _originals.length; _i++) {
713
- var original = _originals[_i];
714
- var originalProps = Object.keys(original).concat(Object.getOwnPropertySymbols(original));
658
+ 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; }
715
659
 
716
- var _iterator = _createForOfIteratorHelper(originalProps),
717
- _step;
660
+ 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); }
718
661
 
719
- try {
720
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
721
- var prop = _step.value;
722
- var propDescriptor = Object.getOwnPropertyDescriptor(original, prop);
662
+ Object.defineProperty(exports, "__esModule", ({
663
+ value: true
664
+ }));
665
+ exports.hookMixin = exports.FeathersHookManager = exports.createContext = exports.enableHooks = exports.collectHooks = exports.convertHookData = void 0;
723
666
 
724
- if (propDescriptor && !Object.prototype.hasOwnProperty.call(target, prop)) {
725
- Object.defineProperty(target, prop, propDescriptor);
726
- }
727
- }
728
- } catch (err) {
729
- _iterator.e(err);
730
- } finally {
731
- _iterator.f();
667
+ var hooks_1 = __webpack_require__(/*! @feathersjs/hooks */ "../../node_modules/@feathersjs/hooks/script/index.js");
668
+
669
+ var service_1 = __webpack_require__(/*! ./service */ "../feathers/lib/service.js");
670
+
671
+ var types = ['before', 'after', 'error', 'around'];
672
+
673
+ var isType = function isType(value) {
674
+ return types.includes(value);
675
+ }; // Converts different hook registration formats into the
676
+ // same internal format
677
+
678
+
679
+ function convertHookData(input) {
680
+ var result = {};
681
+
682
+ if (Array.isArray(input)) {
683
+ result.all = input;
684
+ } else if (_typeof(input) !== 'object') {
685
+ result.all = [input];
686
+ } else {
687
+ for (var _i = 0, _Object$keys = Object.keys(input); _i < _Object$keys.length; _i++) {
688
+ var key = _Object$keys[_i];
689
+ var value = input[key];
690
+ result[key] = Array.isArray(value) ? value : [value];
732
691
  }
733
692
  }
734
693
 
735
- return target;
694
+ return result;
736
695
  }
737
696
 
738
- exports.copyProperties = copyProperties;
697
+ exports.convertHookData = convertHookData;
739
698
 
740
- function copyFnProperties(target, original) {
741
- var internalProps = ['name', 'length'];
699
+ function collectHooks(target, method) {
700
+ var _target$__hooks = target.__hooks,
701
+ collected = _target$__hooks.collected,
702
+ around = _target$__hooks.around;
703
+ return [].concat(_toConsumableArray(around.all || []), _toConsumableArray(around[method] || []), _toConsumableArray(collected.all || []), _toConsumableArray(collected[method] || []));
704
+ }
742
705
 
743
- try {
744
- for (var _i2 = 0, _internalProps = internalProps; _i2 < _internalProps.length; _i2++) {
745
- var prop = _internalProps[_i2];
746
- var value = original[prop];
747
- Object.defineProperty(target, prop, {
748
- value: value
706
+ exports.collectHooks = collectHooks; // Add `.hooks` functionality to an object
707
+
708
+ function enableHooks(object) {
709
+ var store = {
710
+ around: {},
711
+ before: {},
712
+ after: {},
713
+ error: {},
714
+ collected: {}
715
+ };
716
+ Object.defineProperty(object, '__hooks', {
717
+ configurable: true,
718
+ value: store,
719
+ writable: true
720
+ });
721
+ return function registerHooks(input) {
722
+ var store = this.__hooks;
723
+ var map = Object.keys(input).reduce(function (map, type) {
724
+ if (!isType(type)) {
725
+ throw new Error("'".concat(type, "' is not a valid hook type"));
726
+ }
727
+
728
+ map[type] = convertHookData(input[type]);
729
+ return map;
730
+ }, {});
731
+ var types = Object.keys(map);
732
+ types.forEach(function (type) {
733
+ return Object.keys(map[type]).forEach(function (method) {
734
+ var _a;
735
+
736
+ var mapHooks = map[type][method];
737
+ var storeHooks = (_a = store[type])[method] || (_a[method] = []);
738
+ storeHooks.push.apply(storeHooks, _toConsumableArray(mapHooks));
739
+
740
+ if (store.before[method] || store.after[method] || store.error[method]) {
741
+ var collected = (0, hooks_1.collect)({
742
+ before: store.before[method] || [],
743
+ after: store.after[method] || [],
744
+ error: store.error[method] || []
745
+ });
746
+ store.collected[method] = [collected];
747
+ }
749
748
  });
750
- }
751
- } catch (e) {// Avoid IE error
749
+ });
750
+ return this;
751
+ };
752
+ }
753
+
754
+ exports.enableHooks = enableHooks;
755
+
756
+ function createContext(service, method) {
757
+ var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
758
+ var createContext = service[method].createContext;
759
+
760
+ if (typeof createContext !== 'function') {
761
+ throw new Error("Can not create context for method ".concat(method));
752
762
  }
753
763
 
754
- return target;
764
+ return createContext(data);
755
765
  }
756
766
 
757
- exports.copyFnProperties = copyFnProperties;
767
+ exports.createContext = createContext;
758
768
 
759
- /***/ }),
769
+ var FeathersHookManager = /*#__PURE__*/function (_hooks_1$HookManager) {
770
+ _inherits(FeathersHookManager, _hooks_1$HookManager);
760
771
 
761
- /***/ "../commons/lib/debug.js":
762
- /*!*******************************!*\
763
- !*** ../commons/lib/debug.js ***!
764
- \*******************************/
765
- /***/ (function(__unused_webpack_module, exports) {
772
+ var _super = _createSuper(FeathersHookManager);
766
773
 
774
+ function FeathersHookManager(app, method) {
775
+ var _this;
767
776
 
777
+ _classCallCheck(this, FeathersHookManager);
768
778
 
769
- Object.defineProperty(exports, "__esModule", ({
770
- value: true
771
- }));
772
- exports.createDebug = exports.setDebug = exports.noopDebug = void 0;
773
- var debuggers = {};
779
+ _this = _super.call(this);
780
+ _this.app = app;
781
+ _this.method = method;
782
+ _this._middleware = [];
783
+ return _this;
784
+ }
774
785
 
775
- function noopDebug() {
776
- return function () {};
777
- }
786
+ _createClass(FeathersHookManager, [{
787
+ key: "collectMiddleware",
788
+ value: function collectMiddleware(self, args) {
789
+ var appHooks = collectHooks(this.app, this.method);
778
790
 
779
- exports.noopDebug = noopDebug;
780
- var defaultInitializer = noopDebug;
791
+ var middleware = _get(_getPrototypeOf(FeathersHookManager.prototype), "collectMiddleware", this).call(this, self, args);
781
792
 
782
- function setDebug(debug) {
783
- defaultInitializer = debug;
784
- Object.keys(debuggers).forEach(function (name) {
785
- debuggers[name] = debug(name);
786
- });
787
- }
793
+ var methodHooks = collectHooks(self, this.method);
794
+ return [].concat(_toConsumableArray(appHooks), _toConsumableArray(middleware), _toConsumableArray(methodHooks));
795
+ }
796
+ }, {
797
+ key: "initializeContext",
798
+ value: function initializeContext(self, args, context) {
799
+ var ctx = _get(_getPrototypeOf(FeathersHookManager.prototype), "initializeContext", this).call(this, self, args, context);
788
800
 
789
- exports.setDebug = setDebug;
801
+ ctx.params = ctx.params || {};
802
+ return ctx;
803
+ }
804
+ }, {
805
+ key: "middleware",
806
+ value: function middleware(mw) {
807
+ var _this$_middleware;
790
808
 
791
- function createDebug(name) {
792
- if (!debuggers[name]) {
793
- debuggers[name] = defaultInitializer(name);
809
+ (_this$_middleware = this._middleware).push.apply(_this$_middleware, _toConsumableArray(mw));
810
+
811
+ return this;
812
+ }
813
+ }]);
814
+
815
+ return FeathersHookManager;
816
+ }(hooks_1.HookManager);
817
+
818
+ exports.FeathersHookManager = FeathersHookManager;
819
+
820
+ function hookMixin(service, path, options) {
821
+ var _this2 = this;
822
+
823
+ if (typeof service.hooks === 'function') {
824
+ return service;
794
825
  }
795
826
 
796
- return function () {
797
- return debuggers[name].apply(debuggers, arguments);
798
- };
799
- }
827
+ var hookMethods = (0, service_1.getHookMethods)(service, options);
828
+ var serviceMethodHooks = hookMethods.reduce(function (res, method) {
829
+ var _FeathersHookManager;
800
830
 
801
- exports.createDebug = createDebug;
831
+ var params = service_1.defaultServiceArguments[method] || ['data', 'params'];
832
+ res[method] = (_FeathersHookManager = new FeathersHookManager(_this2, method)).params.apply(_FeathersHookManager, _toConsumableArray(params)).props({
833
+ app: _this2,
834
+ path: path,
835
+ method: method,
836
+ service: service,
837
+ event: null,
838
+ type: null,
802
839
 
803
- /***/ }),
840
+ get statusCode() {
841
+ var _a;
804
842
 
805
- /***/ "../commons/lib/index.js":
806
- /*!*******************************!*\
807
- !*** ../commons/lib/index.js ***!
808
- \*******************************/
809
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
843
+ return (_a = this.http) === null || _a === void 0 ? void 0 : _a.status;
844
+ },
845
+
846
+ set statusCode(value) {
847
+ this.http = this.http || {};
848
+ this.http.status = value;
849
+ }
850
+
851
+ });
852
+ return res;
853
+ }, {});
854
+ var registerHooks = enableHooks(service);
855
+ (0, hooks_1.hooks)(service, serviceMethodHooks);
810
856
 
857
+ service.hooks = function (hookOptions) {
858
+ var _this3 = this;
811
859
 
860
+ if (hookOptions.before || hookOptions.after || hookOptions.error || hookOptions.around) {
861
+ return registerHooks.call(this, hookOptions);
862
+ }
812
863
 
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; }
864
+ if (Array.isArray(hookOptions)) {
865
+ return (0, hooks_1.hooks)(this, hookOptions);
866
+ }
814
867
 
815
- 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); }
868
+ Object.keys(hookOptions).forEach(function (method) {
869
+ var manager = (0, hooks_1.getManager)(_this3[method]);
816
870
 
817
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
871
+ if (!(manager instanceof FeathersHookManager)) {
872
+ throw new Error("Method ".concat(method, " is not a Feathers hooks enabled service method"));
873
+ }
818
874
 
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."); }
875
+ manager.middleware(hookOptions[method]);
876
+ });
877
+ return this;
878
+ };
820
879
 
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); }
880
+ return service;
881
+ }
822
882
 
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; }
883
+ exports.hookMixin = hookMixin;
884
+
885
+ /***/ }),
886
+
887
+ /***/ "../feathers/lib/index.js":
888
+ /*!********************************!*\
889
+ !*** ../feathers/lib/index.js ***!
890
+ \********************************/
891
+ /***/ (function(module, exports, __webpack_require__) {
824
892
 
825
- function _iterableToArrayLimit(arr, i) { var _i = arr && (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; }
826
893
 
827
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
828
894
 
829
895
  var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
830
896
  if (k2 === undefined) k2 = k;
831
- Object.defineProperty(o, k2, {
832
- enumerable: true,
833
- get: function get() {
834
- return m[k];
835
- }
836
- });
897
+ var desc = Object.getOwnPropertyDescriptor(m, k);
898
+
899
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
900
+ desc = {
901
+ enumerable: true,
902
+ get: function get() {
903
+ return m[k];
904
+ }
905
+ };
906
+ }
907
+
908
+ Object.defineProperty(o, k2, desc);
837
909
  } : function (o, m, k, k2) {
838
910
  if (k2 === undefined) k2 = k;
839
911
  o[k2] = m[k];
@@ -845,939 +917,1097 @@ var __exportStar = this && this.__exportStar || function (m, exports) {
845
917
  }
846
918
  };
847
919
 
920
+ var __importDefault = this && this.__importDefault || function (mod) {
921
+ return mod && mod.__esModule ? mod : {
922
+ "default": mod
923
+ };
924
+ };
925
+
848
926
  Object.defineProperty(exports, "__esModule", ({
849
927
  value: true
850
928
  }));
851
- exports.createSymbol = exports.isPromise = exports._ = exports.stripSlashes = void 0; // Removes all leading and trailing slashes from a path
929
+ exports.Feathers = exports.version = exports.feathers = void 0;
852
930
 
853
- function stripSlashes(name) {
854
- return name.replace(/^(\/+)|(\/+)$/g, '');
855
- }
931
+ var commons_1 = __webpack_require__(/*! @feathersjs/commons */ "../commons/lib/index.js");
856
932
 
857
- exports.stripSlashes = stripSlashes; // A set of lodash-y utility functions that use ES6
933
+ var version_1 = __importDefault(__webpack_require__(/*! ./version */ "../feathers/lib/version.js"));
858
934
 
859
- exports._ = {
860
- each: function each(obj, callback) {
861
- if (obj && typeof obj.forEach === 'function') {
862
- obj.forEach(callback);
863
- } else if (exports._.isObject(obj)) {
864
- Object.keys(obj).forEach(function (key) {
865
- return callback(obj[key], key);
866
- });
867
- }
868
- },
869
- some: function some(value, callback) {
870
- return Object.keys(value).map(function (key) {
871
- return [value[key], key];
872
- }).some(function (_ref) {
873
- var _ref2 = _slicedToArray(_ref, 2),
874
- val = _ref2[0],
875
- key = _ref2[1];
935
+ exports.version = version_1.default;
876
936
 
877
- return callback(val, key);
878
- });
879
- },
880
- every: function every(value, callback) {
881
- return Object.keys(value).map(function (key) {
882
- return [value[key], key];
883
- }).every(function (_ref3) {
884
- var _ref4 = _slicedToArray(_ref3, 2),
885
- val = _ref4[0],
886
- key = _ref4[1];
937
+ var application_1 = __webpack_require__(/*! ./application */ "../feathers/lib/application.js");
887
938
 
888
- return callback(val, key);
889
- });
890
- },
891
- keys: function keys(obj) {
892
- return Object.keys(obj);
893
- },
894
- values: function values(obj) {
895
- return exports._.keys(obj).map(function (key) {
896
- return obj[key];
897
- });
898
- },
899
- isMatch: function isMatch(obj, item) {
900
- return exports._.keys(item).every(function (key) {
901
- return obj[key] === item[key];
902
- });
903
- },
904
- isEmpty: function isEmpty(obj) {
905
- return exports._.keys(obj).length === 0;
906
- },
907
- isObject: function isObject(item) {
908
- return _typeof(item) === 'object' && !Array.isArray(item) && item !== null;
909
- },
910
- isObjectOrArray: function isObjectOrArray(value) {
911
- return _typeof(value) === 'object' && value !== null;
912
- },
913
- extend: function extend(first) {
914
- for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
915
- rest[_key - 1] = arguments[_key];
916
- }
939
+ Object.defineProperty(exports, "Feathers", ({
940
+ enumerable: true,
941
+ get: function get() {
942
+ return application_1.Feathers;
943
+ }
944
+ }));
917
945
 
918
- return Object.assign.apply(Object, [first].concat(rest));
919
- },
920
- omit: function omit(obj) {
921
- var result = exports._.extend({}, obj);
946
+ function feathers() {
947
+ return new application_1.Feathers();
948
+ }
922
949
 
923
- for (var _len2 = arguments.length, keys = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
924
- keys[_key2 - 1] = arguments[_key2];
925
- }
950
+ exports.feathers = feathers;
951
+ feathers.setDebug = commons_1.setDebug;
926
952
 
927
- keys.forEach(function (key) {
928
- return delete result[key];
929
- });
930
- return result;
931
- },
932
- pick: function pick(source) {
933
- for (var _len3 = arguments.length, keys = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
934
- keys[_key3 - 1] = arguments[_key3];
935
- }
953
+ __exportStar(__webpack_require__(/*! ./hooks */ "../feathers/lib/hooks.js"), exports);
936
954
 
937
- return keys.reduce(function (result, key) {
938
- if (source[key] !== undefined) {
939
- result[key] = source[key];
940
- }
955
+ __exportStar(__webpack_require__(/*! ./declarations */ "../feathers/lib/declarations.js"), exports);
941
956
 
942
- return result;
943
- }, {});
944
- },
945
- // Recursively merge the source object into the target object
946
- merge: function merge(target, source) {
947
- if (exports._.isObject(target) && exports._.isObject(source)) {
948
- Object.keys(source).forEach(function (key) {
949
- if (exports._.isObject(source[key])) {
950
- if (!target[key]) {
951
- Object.assign(target, _defineProperty({}, key, {}));
952
- }
957
+ __exportStar(__webpack_require__(/*! ./service */ "../feathers/lib/service.js"), exports);
953
958
 
954
- exports._.merge(target[key], source[key]);
955
- } else {
956
- Object.assign(target, _defineProperty({}, key, source[key]));
957
- }
958
- });
959
- }
959
+ if (true) {
960
+ module.exports = Object.assign(feathers, module.exports);
961
+ }
960
962
 
961
- return target;
962
- }
963
- }; // Duck-checks if an object looks like a promise
963
+ /***/ }),
964
964
 
965
- function isPromise(result) {
966
- return exports._.isObject(result) && typeof result.then === 'function';
965
+ /***/ "../feathers/lib/service.js":
966
+ /*!**********************************!*\
967
+ !*** ../feathers/lib/service.js ***!
968
+ \**********************************/
969
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
970
+
971
+
972
+
973
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
974
+
975
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
976
+
977
+ 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; }
978
+
979
+ Object.defineProperty(exports, "__esModule", ({
980
+ value: true
981
+ }));
982
+ exports.wrapService = exports.getServiceOptions = exports.getHookMethods = exports.protectedMethods = exports.defaultEventMap = exports.defaultServiceMethods = exports.defaultServiceArguments = exports.SERVICE = void 0;
983
+
984
+ var events_1 = __webpack_require__(/*! events */ "../../node_modules/events/events.js");
985
+
986
+ var commons_1 = __webpack_require__(/*! @feathersjs/commons */ "../commons/lib/index.js");
987
+
988
+ exports.SERVICE = (0, commons_1.createSymbol)('@feathersjs/service');
989
+ exports.defaultServiceArguments = {
990
+ find: ['params'],
991
+ get: ['id', 'params'],
992
+ create: ['data', 'params'],
993
+ update: ['id', 'data', 'params'],
994
+ patch: ['id', 'data', 'params'],
995
+ remove: ['id', 'params']
996
+ };
997
+ exports.defaultServiceMethods = Object.keys(exports.defaultServiceArguments);
998
+ exports.defaultEventMap = {
999
+ create: 'created',
1000
+ update: 'updated',
1001
+ patch: 'patched',
1002
+ remove: 'removed'
1003
+ };
1004
+ exports.protectedMethods = Object.keys(Object.prototype).concat(Object.keys(events_1.EventEmitter.prototype)).concat(['all', 'around', 'before', 'after', 'error', 'hooks', 'setup', 'teardown', 'publish']);
1005
+
1006
+ function getHookMethods(service, options) {
1007
+ var methods = options.methods;
1008
+ return exports.defaultServiceMethods.filter(function (m) {
1009
+ return typeof service[m] === 'function' && !methods.includes(m);
1010
+ }).concat(methods);
967
1011
  }
968
1012
 
969
- exports.isPromise = isPromise;
1013
+ exports.getHookMethods = getHookMethods;
970
1014
 
971
- function createSymbol(name) {
972
- return typeof Symbol !== 'undefined' ? Symbol(name) : name;
1015
+ function getServiceOptions(service) {
1016
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1017
+ var existingOptions = service[exports.SERVICE];
1018
+
1019
+ if (existingOptions) {
1020
+ return existingOptions;
1021
+ }
1022
+
1023
+ var _options$methods = options.methods,
1024
+ methods = _options$methods === void 0 ? exports.defaultServiceMethods.filter(function (method) {
1025
+ return typeof service[method] === 'function';
1026
+ }) : _options$methods,
1027
+ _options$events = options.events,
1028
+ events = _options$events === void 0 ? service.events || [] : _options$events;
1029
+ var _options$serviceEvent = options.serviceEvents,
1030
+ serviceEvents = _options$serviceEvent === void 0 ? Object.values(exports.defaultEventMap).concat(events) : _options$serviceEvent;
1031
+ return _objectSpread(_objectSpread({}, options), {}, {
1032
+ events: events,
1033
+ methods: methods,
1034
+ serviceEvents: serviceEvents
1035
+ });
973
1036
  }
974
1037
 
975
- exports.createSymbol = createSymbol;
1038
+ exports.getServiceOptions = getServiceOptions;
976
1039
 
977
- __exportStar(__webpack_require__(/*! ./debug */ "../commons/lib/debug.js"), exports);
1040
+ function wrapService(location, service, options) {
1041
+ // Do nothing if this is already an initialized
1042
+ if (service[exports.SERVICE]) {
1043
+ return service;
1044
+ }
1045
+
1046
+ var protoService = Object.create(service);
1047
+ var serviceOptions = getServiceOptions(service, options);
1048
+
1049
+ if (Object.keys(serviceOptions.methods).length === 0 && typeof service.setup !== 'function') {
1050
+ throw new Error("Invalid service object passed for path `".concat(location, "`"));
1051
+ }
1052
+
1053
+ Object.defineProperty(protoService, exports.SERVICE, {
1054
+ value: serviceOptions
1055
+ });
1056
+ return protoService;
1057
+ }
1058
+
1059
+ exports.wrapService = wrapService;
978
1060
 
979
1061
  /***/ }),
980
1062
 
981
- /***/ "../feathers/lib/application.js":
982
- /*!**************************************!*\
983
- !*** ../feathers/lib/application.js ***!
984
- \**************************************/
985
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1063
+ /***/ "../feathers/lib/version.js":
1064
+ /*!**********************************!*\
1065
+ !*** ../feathers/lib/version.js ***!
1066
+ \**********************************/
1067
+ /***/ (function(__unused_webpack_module, exports) {
986
1068
 
987
1069
 
988
1070
 
989
- 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); }
1071
+ Object.defineProperty(exports, "__esModule", ({
1072
+ value: true
1073
+ }));
1074
+ exports["default"] = 'development';
990
1075
 
991
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
1076
+ /***/ }),
992
1077
 
993
- 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."); }
1078
+ /***/ "../../node_modules/events/events.js":
1079
+ /*!*******************************************!*\
1080
+ !*** ../../node_modules/events/events.js ***!
1081
+ \*******************************************/
1082
+ /***/ (function(module) {
994
1083
 
995
- 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); }
1084
+ // Copyright Joyent, Inc. and other Node contributors.
1085
+ //
1086
+ // Permission is hereby granted, free of charge, to any person obtaining a
1087
+ // copy of this software and associated documentation files (the
1088
+ // "Software"), to deal in the Software without restriction, including
1089
+ // without limitation the rights to use, copy, modify, merge, publish,
1090
+ // distribute, sublicense, and/or sell copies of the Software, and to permit
1091
+ // persons to whom the Software is furnished to do so, subject to the
1092
+ // following conditions:
1093
+ //
1094
+ // The above copyright notice and this permission notice shall be included
1095
+ // in all copies or substantial portions of the Software.
1096
+ //
1097
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1098
+ // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1099
+ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
1100
+ // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
1101
+ // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
1102
+ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
1103
+ // USE OR OTHER DEALINGS IN THE SOFTWARE.
996
1104
 
997
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
998
1105
 
999
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
1000
1106
 
1001
- 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; }
1107
+ var R = typeof Reflect === 'object' ? Reflect : null
1108
+ var ReflectApply = R && typeof R.apply === 'function'
1109
+ ? R.apply
1110
+ : function ReflectApply(target, receiver, args) {
1111
+ return Function.prototype.apply.call(target, receiver, args);
1112
+ }
1002
1113
 
1003
- 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; }
1114
+ var ReflectOwnKeys
1115
+ if (R && typeof R.ownKeys === 'function') {
1116
+ ReflectOwnKeys = R.ownKeys
1117
+ } else if (Object.getOwnPropertySymbols) {
1118
+ ReflectOwnKeys = function ReflectOwnKeys(target) {
1119
+ return Object.getOwnPropertyNames(target)
1120
+ .concat(Object.getOwnPropertySymbols(target));
1121
+ };
1122
+ } else {
1123
+ ReflectOwnKeys = function ReflectOwnKeys(target) {
1124
+ return Object.getOwnPropertyNames(target);
1125
+ };
1126
+ }
1004
1127
 
1005
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1128
+ function ProcessEmitWarning(warning) {
1129
+ if (console && console.warn) console.warn(warning);
1130
+ }
1006
1131
 
1007
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
1132
+ var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {
1133
+ return value !== value;
1134
+ }
1008
1135
 
1009
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
1136
+ function EventEmitter() {
1137
+ EventEmitter.init.call(this);
1138
+ }
1139
+ module.exports = EventEmitter;
1140
+ module.exports.once = once;
1010
1141
 
1011
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
1142
+ // Backwards-compat with node 0.10.x
1143
+ EventEmitter.EventEmitter = EventEmitter;
1012
1144
 
1013
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
1145
+ EventEmitter.prototype._events = undefined;
1146
+ EventEmitter.prototype._eventsCount = 0;
1147
+ EventEmitter.prototype._maxListeners = undefined;
1014
1148
 
1015
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
1149
+ // By default EventEmitters will print a warning if more than 10 listeners are
1150
+ // added to it. This is a useful default which helps finding memory leaks.
1151
+ var defaultMaxListeners = 10;
1016
1152
 
1017
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
1153
+ function checkListener(listener) {
1154
+ if (typeof listener !== 'function') {
1155
+ throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
1156
+ }
1157
+ }
1018
1158
 
1019
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
1159
+ Object.defineProperty(EventEmitter, 'defaultMaxListeners', {
1160
+ enumerable: true,
1161
+ get: function() {
1162
+ return defaultMaxListeners;
1163
+ },
1164
+ set: function(arg) {
1165
+ if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {
1166
+ throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.');
1167
+ }
1168
+ defaultMaxListeners = arg;
1169
+ }
1170
+ });
1020
1171
 
1021
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
1172
+ EventEmitter.init = function() {
1022
1173
 
1023
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
1174
+ if (this._events === undefined ||
1175
+ this._events === Object.getPrototypeOf(this)._events) {
1176
+ this._events = Object.create(null);
1177
+ this._eventsCount = 0;
1178
+ }
1024
1179
 
1025
- var __importDefault = this && this.__importDefault || function (mod) {
1026
- return mod && mod.__esModule ? mod : {
1027
- "default": mod
1028
- };
1180
+ this._maxListeners = this._maxListeners || undefined;
1029
1181
  };
1030
1182
 
1031
- Object.defineProperty(exports, "__esModule", ({
1032
- value: true
1033
- }));
1034
- exports.Feathers = void 0;
1183
+ // Obviously not all Emitters should be limited to 10. This function allows
1184
+ // that to be increased. Set to zero for unlimited.
1185
+ EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
1186
+ if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {
1187
+ throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.');
1188
+ }
1189
+ this._maxListeners = n;
1190
+ return this;
1191
+ };
1035
1192
 
1036
- var version_1 = __importDefault(__webpack_require__(/*! ./version */ "../feathers/lib/version.js"));
1193
+ function _getMaxListeners(that) {
1194
+ if (that._maxListeners === undefined)
1195
+ return EventEmitter.defaultMaxListeners;
1196
+ return that._maxListeners;
1197
+ }
1037
1198
 
1038
- var dependencies_1 = __webpack_require__(/*! ./dependencies */ "../feathers/lib/dependencies.js");
1199
+ EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
1200
+ return _getMaxListeners(this);
1201
+ };
1039
1202
 
1040
- var events_1 = __webpack_require__(/*! ./events */ "../feathers/lib/events.js");
1203
+ EventEmitter.prototype.emit = function emit(type) {
1204
+ var args = [];
1205
+ for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);
1206
+ var doError = (type === 'error');
1041
1207
 
1042
- var index_1 = __webpack_require__(/*! ./hooks/index */ "../feathers/lib/hooks/index.js");
1208
+ var events = this._events;
1209
+ if (events !== undefined)
1210
+ doError = (doError && events.error === undefined);
1211
+ else if (!doError)
1212
+ return false;
1043
1213
 
1044
- var service_1 = __webpack_require__(/*! ./service */ "../feathers/lib/service.js");
1214
+ // If there is no 'error' event listener then throw.
1215
+ if (doError) {
1216
+ var er;
1217
+ if (args.length > 0)
1218
+ er = args[0];
1219
+ if (er instanceof Error) {
1220
+ // Note: The comments on the `throw` lines are intentional, they show
1221
+ // up in Node's output if this results in an unhandled exception.
1222
+ throw er; // Unhandled 'error' event
1223
+ }
1224
+ // At least give some kind of context to the user
1225
+ var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));
1226
+ err.context = er;
1227
+ throw err; // Unhandled 'error' event
1228
+ }
1045
1229
 
1046
- var legacy_1 = __webpack_require__(/*! ./hooks/legacy */ "../feathers/lib/hooks/legacy.js");
1230
+ var handler = events[type];
1231
+
1232
+ if (handler === undefined)
1233
+ return false;
1047
1234
 
1048
- var debug = dependencies_1.createDebug('@feathersjs/feathers');
1235
+ if (typeof handler === 'function') {
1236
+ ReflectApply(handler, this, args);
1237
+ } else {
1238
+ var len = handler.length;
1239
+ var listeners = arrayClone(handler, len);
1240
+ for (var i = 0; i < len; ++i)
1241
+ ReflectApply(listeners[i], this, args);
1242
+ }
1049
1243
 
1050
- var Feathers = /*#__PURE__*/function (_dependencies_1$Event) {
1051
- _inherits(Feathers, _dependencies_1$Event);
1244
+ return true;
1245
+ };
1052
1246
 
1053
- var _super = _createSuper(Feathers);
1247
+ function _addListener(target, type, listener, prepend) {
1248
+ var m;
1249
+ var events;
1250
+ var existing;
1054
1251
 
1055
- function Feathers() {
1056
- var _this;
1252
+ checkListener(listener);
1057
1253
 
1058
- _classCallCheck(this, Feathers);
1254
+ events = target._events;
1255
+ if (events === undefined) {
1256
+ events = target._events = Object.create(null);
1257
+ target._eventsCount = 0;
1258
+ } else {
1259
+ // To avoid recursion in the case that type === "newListener"! Before
1260
+ // adding it to the listeners, first emit "newListener".
1261
+ if (events.newListener !== undefined) {
1262
+ target.emit('newListener', type,
1263
+ listener.listener ? listener.listener : listener);
1059
1264
 
1060
- _this = _super.call(this);
1061
- _this.services = {};
1062
- _this.settings = {};
1063
- _this.mixins = [index_1.hookMixin, events_1.eventMixin];
1064
- _this.version = version_1.default;
1065
- _this._isSetup = false;
1066
- _this.appHooks = _defineProperty({}, dependencies_1.HOOKS, [events_1.eventHook]);
1067
- _this.legacyHooks = legacy_1.enableLegacyHooks(_assertThisInitialized(_this));
1068
- return _this;
1265
+ // Re-assign `events` because a newListener handler could have caused the
1266
+ // this._events to be assigned to a new object
1267
+ events = target._events;
1268
+ }
1269
+ existing = events[type];
1069
1270
  }
1070
1271
 
1071
- _createClass(Feathers, [{
1072
- key: "get",
1073
- value: function get(name) {
1074
- return this.settings[name];
1075
- }
1076
- }, {
1077
- key: "set",
1078
- value: function set(name, value) {
1079
- this.settings[name] = value;
1080
- return this;
1081
- }
1082
- }, {
1083
- key: "configure",
1084
- value: function configure(callback) {
1085
- callback.call(this, this);
1086
- return this;
1272
+ if (existing === undefined) {
1273
+ // Optimize the case of one listener. Don't need the extra array object.
1274
+ existing = events[type] = listener;
1275
+ ++target._eventsCount;
1276
+ } else {
1277
+ if (typeof existing === 'function') {
1278
+ // Adding the second element, need to change to array.
1279
+ existing = events[type] =
1280
+ prepend ? [listener, existing] : [existing, listener];
1281
+ // If we've already got an array, just append.
1282
+ } else if (prepend) {
1283
+ existing.unshift(listener);
1284
+ } else {
1285
+ existing.push(listener);
1087
1286
  }
1088
- }, {
1089
- key: "defaultService",
1090
- value: function defaultService(location) {
1091
- throw new Error("Can not find service '".concat(location, "'"));
1287
+
1288
+ // Check for listener leak
1289
+ m = _getMaxListeners(target);
1290
+ if (m > 0 && existing.length > m && !existing.warned) {
1291
+ existing.warned = true;
1292
+ // No error code for this since it is a Warning
1293
+ // eslint-disable-next-line no-restricted-syntax
1294
+ var w = new Error('Possible EventEmitter memory leak detected. ' +
1295
+ existing.length + ' ' + String(type) + ' listeners ' +
1296
+ 'added. Use emitter.setMaxListeners() to ' +
1297
+ 'increase limit');
1298
+ w.name = 'MaxListenersExceededWarning';
1299
+ w.emitter = target;
1300
+ w.type = type;
1301
+ w.count = existing.length;
1302
+ ProcessEmitWarning(w);
1092
1303
  }
1093
- }, {
1094
- key: "service",
1095
- value: function service(location) {
1096
- var path = dependencies_1.stripSlashes(location) || '/';
1097
- var current = this.services[path];
1304
+ }
1098
1305
 
1099
- if (typeof current === 'undefined') {
1100
- this.use(path, this.defaultService(path));
1101
- return this.service(path);
1102
- }
1306
+ return target;
1307
+ }
1308
+
1309
+ EventEmitter.prototype.addListener = function addListener(type, listener) {
1310
+ return _addListener(this, type, listener, false);
1311
+ };
1312
+
1313
+ EventEmitter.prototype.on = EventEmitter.prototype.addListener;
1314
+
1315
+ EventEmitter.prototype.prependListener =
1316
+ function prependListener(type, listener) {
1317
+ return _addListener(this, type, listener, true);
1318
+ };
1319
+
1320
+ function onceWrapper() {
1321
+ if (!this.fired) {
1322
+ this.target.removeListener(this.type, this.wrapFn);
1323
+ this.fired = true;
1324
+ if (arguments.length === 0)
1325
+ return this.listener.call(this.target);
1326
+ return this.listener.apply(this.target, arguments);
1327
+ }
1328
+ }
1329
+
1330
+ function _onceWrap(target, type, listener) {
1331
+ var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };
1332
+ var wrapped = onceWrapper.bind(state);
1333
+ wrapped.listener = listener;
1334
+ state.wrapFn = wrapped;
1335
+ return wrapped;
1336
+ }
1103
1337
 
1104
- return current;
1105
- }
1106
- }, {
1107
- key: "use",
1108
- value: function use(path, service, options) {
1109
- var _this2 = this;
1338
+ EventEmitter.prototype.once = function once(type, listener) {
1339
+ checkListener(listener);
1340
+ this.on(type, _onceWrap(this, type, listener));
1341
+ return this;
1342
+ };
1110
1343
 
1111
- if (typeof path !== 'string') {
1112
- throw new Error("'".concat(path, "' is not a valid service path."));
1113
- }
1344
+ EventEmitter.prototype.prependOnceListener =
1345
+ function prependOnceListener(type, listener) {
1346
+ checkListener(listener);
1347
+ this.prependListener(type, _onceWrap(this, type, listener));
1348
+ return this;
1349
+ };
1114
1350
 
1115
- var location = dependencies_1.stripSlashes(path) || '/';
1116
- var subApp = service;
1117
- var isSubApp = typeof subApp.service === 'function' && subApp.services;
1351
+ // Emits a 'removeListener' event if and only if the listener was removed.
1352
+ EventEmitter.prototype.removeListener =
1353
+ function removeListener(type, listener) {
1354
+ var list, events, position, i, originalListener;
1118
1355
 
1119
- if (isSubApp) {
1120
- Object.keys(subApp.services).forEach(function (subPath) {
1121
- return _this2.use("".concat(location, "/").concat(subPath), subApp.service(subPath));
1122
- });
1123
- return this;
1124
- }
1356
+ checkListener(listener);
1125
1357
 
1126
- var protoService = service_1.wrapService(location, service, options);
1127
- var serviceOptions = service_1.getServiceOptions(service, options);
1128
- debug("Registering new service at `".concat(location, "`")); // Add all the mixins
1358
+ events = this._events;
1359
+ if (events === undefined)
1360
+ return this;
1129
1361
 
1130
- this.mixins.forEach(function (fn) {
1131
- return fn.call(_this2, protoService, location, serviceOptions);
1132
- }); // If we ran setup already, set this service up explicitly, this will not `await`
1362
+ list = events[type];
1363
+ if (list === undefined)
1364
+ return this;
1133
1365
 
1134
- if (this._isSetup && typeof protoService.setup === 'function') {
1135
- debug("Setting up service for `".concat(location, "`"));
1136
- protoService.setup(this, location);
1137
- }
1366
+ if (list === listener || list.listener === listener) {
1367
+ if (--this._eventsCount === 0)
1368
+ this._events = Object.create(null);
1369
+ else {
1370
+ delete events[type];
1371
+ if (events.removeListener)
1372
+ this.emit('removeListener', type, list.listener || listener);
1373
+ }
1374
+ } else if (typeof list !== 'function') {
1375
+ position = -1;
1138
1376
 
1139
- this.services[location] = protoService;
1140
- return this;
1141
- }
1142
- }, {
1143
- key: "hooks",
1144
- value: function hooks(hookMap) {
1145
- var _this3 = this;
1377
+ for (i = list.length - 1; i >= 0; i--) {
1378
+ if (list[i] === listener || list[i].listener === listener) {
1379
+ originalListener = list[i].listener;
1380
+ position = i;
1381
+ break;
1382
+ }
1383
+ }
1146
1384
 
1147
- var legacyMap = hookMap;
1385
+ if (position < 0)
1386
+ return this;
1148
1387
 
1149
- if (legacyMap.before || legacyMap.after || legacyMap.error) {
1150
- return this.legacyHooks(legacyMap);
1151
- }
1388
+ if (position === 0)
1389
+ list.shift();
1390
+ else {
1391
+ spliceOne(list, position);
1392
+ }
1152
1393
 
1153
- if (Array.isArray(hookMap)) {
1154
- var _this$appHooks$depend;
1394
+ if (list.length === 1)
1395
+ events[type] = list[0];
1155
1396
 
1156
- (_this$appHooks$depend = this.appHooks[dependencies_1.HOOKS]).push.apply(_this$appHooks$depend, _toConsumableArray(hookMap));
1157
- } else {
1158
- var methodHookMap = hookMap;
1159
- Object.keys(methodHookMap).forEach(function (key) {
1160
- var methodHooks = _this3.appHooks[key] || [];
1161
- _this3.appHooks[key] = methodHooks.concat(methodHookMap[key]);
1162
- });
1397
+ if (events.removeListener !== undefined)
1398
+ this.emit('removeListener', type, originalListener || listener);
1163
1399
  }
1164
1400
 
1165
1401
  return this;
1166
- }
1167
- }, {
1168
- key: "setup",
1169
- value: function setup() {
1170
- var _this4 = this;
1402
+ };
1171
1403
 
1172
- var promise = Promise.resolve(); // Setup each service (pass the app so that they can look up other services etc.)
1404
+ EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
1173
1405
 
1174
- var _loop = function _loop() {
1175
- var path = _Object$keys[_i];
1176
- promise = promise.then(function () {
1177
- var service = _this4.service(path);
1406
+ EventEmitter.prototype.removeAllListeners =
1407
+ function removeAllListeners(type) {
1408
+ var listeners, events, i;
1178
1409
 
1179
- if (typeof service.setup === 'function') {
1180
- debug("Setting up service for `".concat(path, "`"));
1181
- return service.setup(_this4, path);
1182
- }
1183
- });
1184
- };
1410
+ events = this._events;
1411
+ if (events === undefined)
1412
+ return this;
1185
1413
 
1186
- for (var _i = 0, _Object$keys = Object.keys(this.services); _i < _Object$keys.length; _i++) {
1187
- _loop();
1414
+ // not listening for removeListener, no need to emit
1415
+ if (events.removeListener === undefined) {
1416
+ if (arguments.length === 0) {
1417
+ this._events = Object.create(null);
1418
+ this._eventsCount = 0;
1419
+ } else if (events[type] !== undefined) {
1420
+ if (--this._eventsCount === 0)
1421
+ this._events = Object.create(null);
1422
+ else
1423
+ delete events[type];
1424
+ }
1425
+ return this;
1188
1426
  }
1189
1427
 
1190
- return promise.then(function () {
1191
- _this4._isSetup = true;
1192
- return _this4;
1193
- });
1194
- }
1195
- }]);
1196
-
1197
- return Feathers;
1198
- }(dependencies_1.EventEmitter);
1199
-
1200
- exports.Feathers = Feathers;
1428
+ // emit removeListener for all listeners on all events
1429
+ if (arguments.length === 0) {
1430
+ var keys = Object.keys(events);
1431
+ var key;
1432
+ for (i = 0; i < keys.length; ++i) {
1433
+ key = keys[i];
1434
+ if (key === 'removeListener') continue;
1435
+ this.removeAllListeners(key);
1436
+ }
1437
+ this.removeAllListeners('removeListener');
1438
+ this._events = Object.create(null);
1439
+ this._eventsCount = 0;
1440
+ return this;
1441
+ }
1201
1442
 
1202
- /***/ }),
1443
+ listeners = events[type];
1203
1444
 
1204
- /***/ "../feathers/lib/declarations.js":
1205
- /*!***************************************!*\
1206
- !*** ../feathers/lib/declarations.js ***!
1207
- \***************************************/
1208
- /***/ (function(__unused_webpack_module, exports) {
1445
+ if (typeof listeners === 'function') {
1446
+ this.removeListener(type, listeners);
1447
+ } else if (listeners !== undefined) {
1448
+ // LIFO order
1449
+ for (i = listeners.length - 1; i >= 0; i--) {
1450
+ this.removeListener(type, listeners[i]);
1451
+ }
1452
+ }
1209
1453
 
1454
+ return this;
1455
+ };
1210
1456
 
1457
+ function _listeners(target, type, unwrap) {
1458
+ var events = target._events;
1211
1459
 
1212
- Object.defineProperty(exports, "__esModule", ({
1213
- value: true
1214
- }));
1460
+ if (events === undefined)
1461
+ return [];
1215
1462
 
1216
- /***/ }),
1463
+ var evlistener = events[type];
1464
+ if (evlistener === undefined)
1465
+ return [];
1217
1466
 
1218
- /***/ "../feathers/lib/dependencies.js":
1219
- /*!***************************************!*\
1220
- !*** ../feathers/lib/dependencies.js ***!
1221
- \***************************************/
1222
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1467
+ if (typeof evlistener === 'function')
1468
+ return unwrap ? [evlistener.listener || evlistener] : [evlistener];
1223
1469
 
1470
+ return unwrap ?
1471
+ unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
1472
+ }
1224
1473
 
1474
+ EventEmitter.prototype.listeners = function listeners(type) {
1475
+ return _listeners(this, type, true);
1476
+ };
1225
1477
 
1226
- var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
1227
- if (k2 === undefined) k2 = k;
1228
- Object.defineProperty(o, k2, {
1229
- enumerable: true,
1230
- get: function get() {
1231
- return m[k];
1232
- }
1233
- });
1234
- } : function (o, m, k, k2) {
1235
- if (k2 === undefined) k2 = k;
1236
- o[k2] = m[k];
1237
- });
1478
+ EventEmitter.prototype.rawListeners = function rawListeners(type) {
1479
+ return _listeners(this, type, false);
1480
+ };
1238
1481
 
1239
- var __exportStar = this && this.__exportStar || function (m, exports) {
1240
- for (var p in m) {
1241
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
1482
+ EventEmitter.listenerCount = function(emitter, type) {
1483
+ if (typeof emitter.listenerCount === 'function') {
1484
+ return emitter.listenerCount(type);
1485
+ } else {
1486
+ return listenerCount.call(emitter, type);
1242
1487
  }
1243
1488
  };
1244
1489
 
1245
- Object.defineProperty(exports, "__esModule", ({
1246
- value: true
1247
- }));
1248
- exports.EventEmitter = void 0;
1490
+ EventEmitter.prototype.listenerCount = listenerCount;
1491
+ function listenerCount(type) {
1492
+ var events = this._events;
1249
1493
 
1250
- var events_1 = __webpack_require__(/*! events */ "../../node_modules/events/events.js");
1494
+ if (events !== undefined) {
1495
+ var evlistener = events[type];
1251
1496
 
1252
- Object.defineProperty(exports, "EventEmitter", ({
1253
- enumerable: true,
1254
- get: function get() {
1255
- return events_1.EventEmitter;
1497
+ if (typeof evlistener === 'function') {
1498
+ return 1;
1499
+ } else if (evlistener !== undefined) {
1500
+ return evlistener.length;
1501
+ }
1256
1502
  }
1257
- }));
1258
-
1259
- __exportStar(__webpack_require__(/*! @feathersjs/commons */ "../commons/lib/index.js"), exports);
1260
-
1261
- __exportStar(__webpack_require__(/*! @feathersjs/hooks */ "../../node_modules/@feathersjs/hooks/lib/index.js"), exports);
1262
1503
 
1263
- /***/ }),
1264
-
1265
- /***/ "../feathers/lib/events.js":
1266
- /*!*********************************!*\
1267
- !*** ../feathers/lib/events.js ***!
1268
- \*********************************/
1269
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1504
+ return 0;
1505
+ }
1270
1506
 
1507
+ EventEmitter.prototype.eventNames = function eventNames() {
1508
+ return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];
1509
+ };
1271
1510
 
1511
+ function arrayClone(arr, n) {
1512
+ var copy = new Array(n);
1513
+ for (var i = 0; i < n; ++i)
1514
+ copy[i] = arr[i];
1515
+ return copy;
1516
+ }
1272
1517
 
1273
- Object.defineProperty(exports, "__esModule", ({
1274
- value: true
1275
- }));
1276
- exports.eventMixin = exports.eventHook = void 0;
1518
+ function spliceOne(list, index) {
1519
+ for (; index + 1 < list.length; index++)
1520
+ list[index] = list[index + 1];
1521
+ list.pop();
1522
+ }
1277
1523
 
1278
- var dependencies_1 = __webpack_require__(/*! ./dependencies */ "../feathers/lib/dependencies.js");
1524
+ function unwrapListeners(arr) {
1525
+ var ret = new Array(arr.length);
1526
+ for (var i = 0; i < ret.length; ++i) {
1527
+ ret[i] = arr[i].listener || arr[i];
1528
+ }
1529
+ return ret;
1530
+ }
1279
1531
 
1280
- var service_1 = __webpack_require__(/*! ./service */ "../feathers/lib/service.js");
1532
+ function once(emitter, name) {
1533
+ return new Promise(function (resolve, reject) {
1534
+ function errorListener(err) {
1535
+ emitter.removeListener(name, resolver);
1536
+ reject(err);
1537
+ }
1281
1538
 
1282
- function eventHook(context, next) {
1283
- var _service_1$getService = service_1.getServiceOptions(context.self),
1284
- events = _service_1$getService.events;
1539
+ function resolver() {
1540
+ if (typeof emitter.removeListener === 'function') {
1541
+ emitter.removeListener('error', errorListener);
1542
+ }
1543
+ resolve([].slice.call(arguments));
1544
+ };
1285
1545
 
1286
- var defaultEvent = service_1.defaultEventMap[context.method] || null;
1287
- context.event = defaultEvent;
1288
- return next().then(function () {
1289
- // Send the event only if the service does not do so already (indicated in the `events` option)
1290
- // This is used for custom events and for client services receiving event from the server
1291
- if (typeof context.event === 'string' && !events.includes(context.event)) {
1292
- var results = Array.isArray(context.result) ? context.result : [context.result];
1293
- results.forEach(function (element) {
1294
- return context.self.emit(context.event, element, context);
1295
- });
1546
+ eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });
1547
+ if (name !== 'error') {
1548
+ addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });
1296
1549
  }
1297
1550
  });
1298
1551
  }
1299
1552
 
1300
- exports.eventHook = eventHook;
1301
-
1302
- function eventMixin(service) {
1303
- var isEmitter = typeof service.on === 'function' && typeof service.emit === 'function';
1304
-
1305
- if (!isEmitter) {
1306
- Object.assign(service, dependencies_1.EventEmitter.prototype);
1553
+ function addErrorHandlerIfEventEmitter(emitter, handler, flags) {
1554
+ if (typeof emitter.on === 'function') {
1555
+ eventTargetAgnosticAddListener(emitter, 'error', handler, flags);
1307
1556
  }
1557
+ }
1308
1558
 
1309
- return service;
1559
+ function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
1560
+ if (typeof emitter.on === 'function') {
1561
+ if (flags.once) {
1562
+ emitter.once(name, listener);
1563
+ } else {
1564
+ emitter.on(name, listener);
1565
+ }
1566
+ } else if (typeof emitter.addEventListener === 'function') {
1567
+ // EventTarget does not have `error` event semantics like Node
1568
+ // EventEmitters, we do not listen for `error` events here.
1569
+ emitter.addEventListener(name, function wrapListener(arg) {
1570
+ // IE does not have builtin `{ once: true }` support so we
1571
+ // have to do it manually.
1572
+ if (flags.once) {
1573
+ emitter.removeEventListener(name, wrapListener);
1574
+ }
1575
+ listener(arg);
1576
+ });
1577
+ } else {
1578
+ throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter);
1579
+ }
1310
1580
  }
1311
1581
 
1312
- exports.eventMixin = eventMixin;
1313
1582
 
1314
1583
  /***/ }),
1315
1584
 
1316
- /***/ "../feathers/lib/hooks/index.js":
1317
- /*!**************************************!*\
1318
- !*** ../feathers/lib/hooks/index.js ***!
1319
- \**************************************/
1585
+ /***/ "./src/core.ts":
1586
+ /*!*********************!*\
1587
+ !*** ./src/core.ts ***!
1588
+ \*********************/
1320
1589
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1321
1590
 
1322
1591
 
1592
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
1593
+ if (k2 === undefined) k2 = k;
1594
+ var desc = Object.getOwnPropertyDescriptor(m, k);
1595
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1596
+ desc = { enumerable: true, get: function() { return m[k]; } };
1597
+ }
1598
+ Object.defineProperty(o, k2, desc);
1599
+ }) : (function(o, m, k, k2) {
1600
+ if (k2 === undefined) k2 = k;
1601
+ o[k2] = m[k];
1602
+ }));
1603
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
1604
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
1605
+ };
1606
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1607
+ __exportStar(__webpack_require__(/*! @feathersjs/feathers */ "../feathers/lib/index.js"), exports);
1323
1608
 
1324
- 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); }
1325
-
1326
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
1327
-
1328
- 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."); }
1329
-
1330
- 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); }
1331
-
1332
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
1333
-
1334
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
1335
-
1336
- 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; }
1337
1609
 
1338
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1610
+ /***/ }),
1339
1611
 
1340
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
1612
+ /***/ "../../node_modules/@feathersjs/hooks/script/base.js":
1613
+ /*!***********************************************************!*\
1614
+ !*** ../../node_modules/@feathersjs/hooks/script/base.js ***!
1615
+ \***********************************************************/
1616
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1341
1617
 
1342
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
1343
1618
 
1344
- function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
1345
1619
 
1346
- function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
1620
+ 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); }
1347
1621
 
1348
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
1622
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
1349
1623
 
1350
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
1624
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
1351
1625
 
1352
1626
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
1353
1627
 
1354
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
1628
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
1355
1629
 
1356
1630
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
1357
1631
 
1358
1632
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
1359
1633
 
1360
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
1361
-
1362
- Object.defineProperty(exports, "__esModule", ({
1363
- value: true
1364
- }));
1365
- exports.hookMixin = exports.FeathersHookManager = exports.createContext = exports.fromErrorHooks = exports.fromBeforeHook = exports.fromAfterHook = void 0;
1634
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
1366
1635
 
1367
- var dependencies_1 = __webpack_require__(/*! ../dependencies */ "../feathers/lib/dependencies.js");
1636
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
1368
1637
 
1369
- var service_1 = __webpack_require__(/*! ../service */ "../feathers/lib/service.js");
1638
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
1370
1639
 
1371
- var legacy_1 = __webpack_require__(/*! ./legacy */ "../feathers/lib/hooks/legacy.js");
1640
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1372
1641
 
1373
- Object.defineProperty(exports, "fromAfterHook", ({
1374
- enumerable: true,
1375
- get: function get() {
1376
- return legacy_1.fromAfterHook;
1377
- }
1378
- }));
1379
- Object.defineProperty(exports, "fromBeforeHook", ({
1380
- enumerable: true,
1381
- get: function get() {
1382
- return legacy_1.fromBeforeHook;
1383
- }
1384
- }));
1385
- Object.defineProperty(exports, "fromErrorHooks", ({
1386
- enumerable: true,
1387
- get: function get() {
1388
- return legacy_1.fromErrorHooks;
1389
- }
1642
+ Object.defineProperty(exports, "__esModule", ({
1643
+ value: true
1390
1644
  }));
1645
+ exports.setMiddleware = exports.getMiddleware = exports.setManager = exports.getManager = exports.convertOptions = exports.HookManager = exports.BaseHookContext = exports.HOOKS = void 0;
1391
1646
 
1392
- function createContext(service, method) {
1393
- var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1394
- var createContext = service[method].createContext;
1395
-
1396
- if (typeof createContext !== 'function') {
1397
- throw new Error("Can not create context for method ".concat(method));
1398
- }
1647
+ var utils_js_1 = __webpack_require__(/*! ./utils.js */ "../../node_modules/@feathersjs/hooks/script/utils.js");
1399
1648
 
1400
- return createContext(data);
1401
- }
1649
+ exports.HOOKS = Symbol('@feathersjs/hooks');
1650
+ /**
1651
+ * The base hook context.
1652
+ */
1402
1653
 
1403
- exports.createContext = createContext;
1654
+ var BaseHookContext = /*#__PURE__*/_createClass(function BaseHookContext() {
1655
+ var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1404
1656
 
1405
- var FeathersHookManager = /*#__PURE__*/function (_dependencies_1$HookM) {
1406
- _inherits(FeathersHookManager, _dependencies_1$HookM);
1657
+ _classCallCheck(this, BaseHookContext);
1407
1658
 
1408
- var _super = _createSuper(FeathersHookManager);
1659
+ Object.defineProperty(this, "self", {
1660
+ enumerable: true,
1661
+ configurable: true,
1662
+ writable: true,
1663
+ value: void 0
1664
+ });
1665
+ Object.assign(this, data);
1666
+ });
1409
1667
 
1410
- function FeathersHookManager(app, method) {
1411
- var _this;
1668
+ exports.BaseHookContext = BaseHookContext;
1412
1669
 
1413
- _classCallCheck(this, FeathersHookManager);
1670
+ var HookManager = /*#__PURE__*/function () {
1671
+ function HookManager() {
1672
+ _classCallCheck(this, HookManager);
1414
1673
 
1415
- _this = _super.call(this);
1416
- _this.app = app;
1417
- _this.method = method;
1418
- _this._middleware = [];
1419
- return _this;
1674
+ Object.defineProperty(this, "_parent", {
1675
+ enumerable: true,
1676
+ configurable: true,
1677
+ writable: true,
1678
+ value: null
1679
+ });
1680
+ Object.defineProperty(this, "_params", {
1681
+ enumerable: true,
1682
+ configurable: true,
1683
+ writable: true,
1684
+ value: null
1685
+ });
1686
+ Object.defineProperty(this, "_middleware", {
1687
+ enumerable: true,
1688
+ configurable: true,
1689
+ writable: true,
1690
+ value: null
1691
+ });
1692
+ Object.defineProperty(this, "_props", {
1693
+ enumerable: true,
1694
+ configurable: true,
1695
+ writable: true,
1696
+ value: null
1697
+ });
1698
+ Object.defineProperty(this, "_defaults", {
1699
+ enumerable: true,
1700
+ configurable: true,
1701
+ writable: true,
1702
+ value: void 0
1703
+ });
1420
1704
  }
1421
1705
 
1422
- _createClass(FeathersHookManager, [{
1423
- key: "collectMiddleware",
1424
- value: function collectMiddleware(self, args) {
1425
- var app = this.app;
1426
- var appHooks = app.appHooks[dependencies_1.HOOKS].concat(app.appHooks[this.method] || []);
1427
- var legacyAppHooks = legacy_1.collectLegacyHooks(this.app, this.method);
1428
-
1429
- var middleware = _get(_getPrototypeOf(FeathersHookManager.prototype), "collectMiddleware", this).call(this, self, args);
1430
-
1431
- var legacyHooks = legacy_1.collectLegacyHooks(self, this.method);
1432
- return [].concat(_toConsumableArray(appHooks), _toConsumableArray(legacyAppHooks), _toConsumableArray(middleware), _toConsumableArray(legacyHooks));
1433
- }
1434
- }, {
1435
- key: "initializeContext",
1436
- value: function initializeContext(self, args, context) {
1437
- var ctx = _get(_getPrototypeOf(FeathersHookManager.prototype), "initializeContext", this).call(this, self, args, context);
1438
-
1439
- ctx.params = ctx.params || {};
1440
- return ctx;
1706
+ _createClass(HookManager, [{
1707
+ key: "parent",
1708
+ value: function parent(_parent) {
1709
+ this._parent = _parent;
1710
+ return this;
1441
1711
  }
1442
1712
  }, {
1443
1713
  key: "middleware",
1444
- value: function middleware(mw) {
1445
- var _this$_middleware;
1446
-
1447
- (_this$_middleware = this._middleware).push.apply(_this$_middleware, _toConsumableArray(mw));
1448
-
1714
+ value: function middleware(_middleware) {
1715
+ this._middleware = _middleware !== null && _middleware !== void 0 && _middleware.length ? _middleware : null;
1449
1716
  return this;
1450
1717
  }
1451
- }]);
1452
-
1453
- return FeathersHookManager;
1454
- }(dependencies_1.HookManager);
1455
-
1456
- exports.FeathersHookManager = FeathersHookManager;
1457
-
1458
- function hookMixin(service, path, options) {
1459
- if (typeof service.hooks === 'function') {
1460
- return service;
1461
- }
1462
-
1463
- var app = this;
1464
- var serviceMethodHooks = service_1.getHookMethods(service, options).reduce(function (res, method) {
1465
- var _FeathersHookManager;
1466
-
1467
- var params = service_1.defaultServiceArguments[method] || ['data', 'params'];
1468
- res[method] = (_FeathersHookManager = new FeathersHookManager(app, method)).params.apply(_FeathersHookManager, _toConsumableArray(params)).props({
1469
- app: app,
1470
- path: path,
1471
- method: method,
1472
- service: service,
1473
- event: null,
1474
- type: null
1475
- });
1476
- return res;
1477
- }, {});
1478
- var handleLegacyHooks = legacy_1.enableLegacyHooks(service);
1479
- dependencies_1.hooks(service, serviceMethodHooks);
1718
+ }, {
1719
+ key: "getMiddleware",
1720
+ value: function getMiddleware() {
1721
+ var _this$_parent;
1480
1722
 
1481
- service.hooks = function (hookOptions) {
1482
- var _this2 = this;
1723
+ var previous = (_this$_parent = this._parent) === null || _this$_parent === void 0 ? void 0 : _this$_parent.getMiddleware();
1483
1724
 
1484
- if (hookOptions.before || hookOptions.after || hookOptions.error) {
1485
- return handleLegacyHooks.call(this, hookOptions);
1486
- }
1725
+ if (previous && this._middleware) {
1726
+ return previous.concat(this._middleware);
1727
+ }
1487
1728
 
1488
- if (Array.isArray(hookOptions)) {
1489
- return dependencies_1.hooks(this, hookOptions);
1729
+ return previous || this._middleware;
1490
1730
  }
1731
+ }, {
1732
+ key: "collectMiddleware",
1733
+ value: function collectMiddleware(self, _args) {
1734
+ var otherMiddleware = getMiddleware(self);
1735
+ var middleware = this.getMiddleware();
1491
1736
 
1492
- Object.keys(hookOptions).forEach(function (method) {
1493
- var manager = dependencies_1.getManager(_this2[method]);
1494
-
1495
- if (!(manager instanceof FeathersHookManager)) {
1496
- throw new Error("Method ".concat(method, " is not a Feathers hooks enabled service method"));
1737
+ if (otherMiddleware && middleware) {
1738
+ return otherMiddleware.concat(middleware);
1497
1739
  }
1498
1740
 
1499
- manager.middleware(hookOptions[method]);
1500
- });
1501
- return this;
1502
- };
1503
-
1504
- return service;
1505
- }
1506
-
1507
- exports.hookMixin = hookMixin;
1741
+ return otherMiddleware || middleware || [];
1742
+ }
1743
+ }, {
1744
+ key: "props",
1745
+ value: function props(_props) {
1746
+ if (!this._props) {
1747
+ this._props = {};
1748
+ }
1508
1749
 
1509
- /***/ }),
1750
+ (0, utils_js_1.copyProperties)(this._props, _props);
1751
+ return this;
1752
+ }
1753
+ }, {
1754
+ key: "getProps",
1755
+ value: function getProps() {
1756
+ var _this$_parent2;
1510
1757
 
1511
- /***/ "../feathers/lib/hooks/legacy.js":
1512
- /*!***************************************!*\
1513
- !*** ../feathers/lib/hooks/legacy.js ***!
1514
- \***************************************/
1515
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1758
+ var previous = (_this$_parent2 = this._parent) === null || _this$_parent2 === void 0 ? void 0 : _this$_parent2.getProps();
1516
1759
 
1760
+ if (previous && this._props) {
1761
+ return (0, utils_js_1.copyProperties)({}, previous, this._props);
1762
+ }
1517
1763
 
1764
+ return previous || this._props || null;
1765
+ }
1766
+ }, {
1767
+ key: "params",
1768
+ value: function params() {
1769
+ for (var _len = arguments.length, _params = new Array(_len), _key = 0; _key < _len; _key++) {
1770
+ _params[_key] = arguments[_key];
1771
+ }
1518
1772
 
1519
- 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); }
1773
+ this._params = _params;
1774
+ return this;
1775
+ }
1776
+ }, {
1777
+ key: "getParams",
1778
+ value: function getParams() {
1779
+ var _this$_parent3;
1520
1780
 
1521
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
1781
+ var previous = (_this$_parent3 = this._parent) === null || _this$_parent3 === void 0 ? void 0 : _this$_parent3.getParams();
1522
1782
 
1523
- 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."); }
1783
+ if (previous && this._params) {
1784
+ return previous.concat(this._params);
1785
+ }
1524
1786
 
1525
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
1787
+ return previous || this._params;
1788
+ }
1789
+ }, {
1790
+ key: "defaults",
1791
+ value: function defaults(_defaults) {
1792
+ this._defaults = _defaults;
1793
+ return this;
1794
+ }
1795
+ }, {
1796
+ key: "getDefaults",
1797
+ value: function getDefaults(self, args, context) {
1798
+ var _this$_parent4;
1526
1799
 
1527
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
1800
+ var defaults = typeof this._defaults === 'function' ? this._defaults(self, args, context) : null;
1801
+ var previous = (_this$_parent4 = this._parent) === null || _this$_parent4 === void 0 ? void 0 : _this$_parent4.getDefaults(self, args, context);
1528
1802
 
1529
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
1803
+ if (previous && defaults) {
1804
+ return Object.assign({}, previous, defaults);
1805
+ }
1530
1806
 
1531
- 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); }
1807
+ return previous || defaults;
1808
+ }
1809
+ }, {
1810
+ key: "getContextClass",
1811
+ value: function getContextClass() {
1812
+ var Base = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : BaseHookContext;
1532
1813
 
1533
- 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; }
1814
+ var ContextClass = /*#__PURE__*/function (_Base) {
1815
+ _inherits(ContextClass, _Base);
1534
1816
 
1535
- Object.defineProperty(exports, "__esModule", ({
1536
- value: true
1537
- }));
1538
- exports.enableLegacyHooks = exports.convertHookData = exports.collectLegacyHooks = exports.fromErrorHooks = exports.fromAfterHook = exports.fromBeforeHook = void 0;
1817
+ var _super = _createSuper(ContextClass);
1539
1818
 
1540
- var dependencies_1 = __webpack_require__(/*! ../dependencies */ "../feathers/lib/dependencies.js");
1819
+ function ContextClass(data) {
1820
+ var _this;
1541
1821
 
1542
- var each = dependencies_1._.each;
1822
+ _classCallCheck(this, ContextClass);
1543
1823
 
1544
- function fromBeforeHook(hook) {
1545
- return function (context, next) {
1546
- context.type = 'before';
1547
- return Promise.resolve(hook.call(context.self, context)).then(function () {
1548
- context.type = null;
1549
- return next();
1550
- });
1551
- };
1552
- }
1824
+ _this = _super.call(this, data);
1825
+ (0, utils_js_1.copyToSelf)(_assertThisInitialized(_this));
1826
+ return _this;
1827
+ }
1553
1828
 
1554
- exports.fromBeforeHook = fromBeforeHook;
1829
+ return _createClass(ContextClass);
1830
+ }(Base);
1555
1831
 
1556
- function fromAfterHook(hook) {
1557
- return function (context, next) {
1558
- return next().then(function () {
1559
- context.type = 'after';
1560
- return hook.call(context.self, context);
1561
- }).then(function () {
1562
- context.type = null;
1563
- });
1564
- };
1565
- }
1832
+ var params = this.getParams();
1833
+ var props = this.getProps();
1566
1834
 
1567
- exports.fromAfterHook = fromAfterHook;
1835
+ if (params) {
1836
+ params.forEach(function (name, index) {
1837
+ if ((props === null || props === void 0 ? void 0 : props[name]) !== undefined) {
1838
+ throw new Error("Hooks can not have a property and param named '".concat(name, "'. Use .defaults instead."));
1839
+ }
1568
1840
 
1569
- function fromErrorHooks(hooks) {
1570
- return function (context, next) {
1571
- return next().catch(function (error) {
1572
- var promise = Promise.resolve();
1573
- context.original = Object.assign({}, context);
1574
- context.error = error;
1575
- context.type = 'error';
1576
- delete context.result;
1841
+ Object.defineProperty(ContextClass.prototype, name, {
1842
+ enumerable: true,
1843
+ get: function get() {
1844
+ return this === null || this === void 0 ? void 0 : this.arguments[index];
1845
+ },
1846
+ set: function set(value) {
1847
+ this.arguments[index] = value;
1848
+ }
1849
+ });
1850
+ });
1851
+ }
1577
1852
 
1578
- var _iterator = _createForOfIteratorHelper(hooks),
1579
- _step;
1853
+ if (props) {
1854
+ (0, utils_js_1.copyProperties)(ContextClass.prototype, props);
1855
+ }
1580
1856
 
1581
- try {
1582
- var _loop = function _loop() {
1583
- var hook = _step.value;
1584
- promise = promise.then(function () {
1585
- return hook.call(context.self, context);
1586
- });
1587
- };
1857
+ return ContextClass;
1858
+ }
1859
+ }, {
1860
+ key: "initializeContext",
1861
+ value: function initializeContext(self, args, context) {
1862
+ var ctx = this._parent ? this._parent.initializeContext(self, args, context) : context;
1863
+ var defaults = this.getDefaults(self, args, ctx);
1588
1864
 
1589
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
1590
- _loop();
1591
- }
1592
- } catch (err) {
1593
- _iterator.e(err);
1594
- } finally {
1595
- _iterator.f();
1865
+ if (self) {
1866
+ ctx.self = self;
1596
1867
  }
1597
1868
 
1598
- return promise.then(function () {
1599
- context.type = null;
1869
+ ctx.arguments = args;
1600
1870
 
1601
- if (context.result === undefined) {
1602
- throw context.error;
1871
+ if (defaults) {
1872
+ for (var _i = 0, _Object$keys = Object.keys(defaults); _i < _Object$keys.length; _i++) {
1873
+ var name = _Object$keys[_i];
1874
+
1875
+ if (ctx[name] === undefined) {
1876
+ ctx[name] = defaults[name];
1877
+ }
1603
1878
  }
1604
- });
1605
- });
1606
- };
1607
- }
1879
+ }
1608
1880
 
1609
- exports.fromErrorHooks = fromErrorHooks;
1881
+ return ctx;
1882
+ }
1883
+ }]);
1610
1884
 
1611
- function collectLegacyHooks(target, method) {
1612
- var _target$__hooks = target.__hooks,
1613
- _target$__hooks$befor = _target$__hooks.before[method],
1614
- before = _target$__hooks$befor === void 0 ? [] : _target$__hooks$befor,
1615
- _target$__hooks$after = _target$__hooks.after[method],
1616
- after = _target$__hooks$after === void 0 ? [] : _target$__hooks$after,
1617
- _target$__hooks$error = _target$__hooks.error[method],
1618
- error = _target$__hooks$error === void 0 ? [] : _target$__hooks$error;
1619
- var beforeHooks = before;
1620
-
1621
- var afterHooks = _toConsumableArray(after).reverse();
1622
-
1623
- var errorHook = fromErrorHooks(error);
1624
- return [errorHook].concat(_toConsumableArray(beforeHooks), _toConsumableArray(afterHooks));
1625
- }
1885
+ return HookManager;
1886
+ }();
1626
1887
 
1627
- exports.collectLegacyHooks = collectLegacyHooks; // Converts different hook registration formats into the
1628
- // same internal format
1888
+ exports.HookManager = HookManager;
1629
1889
 
1630
- function convertHookData(obj) {
1631
- var hook = {};
1890
+ function convertOptions() {
1891
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
1632
1892
 
1633
- if (Array.isArray(obj)) {
1634
- hook = {
1635
- all: obj
1636
- };
1637
- } else if (_typeof(obj) !== 'object') {
1638
- hook = {
1639
- all: [obj]
1640
- };
1641
- } else {
1642
- each(obj, function (value, key) {
1643
- hook[key] = !Array.isArray(value) ? [value] : value;
1644
- });
1893
+ if (!options) {
1894
+ return new HookManager();
1645
1895
  }
1646
1896
 
1647
- return hook;
1897
+ return Array.isArray(options) ? new HookManager().middleware(options) : options;
1648
1898
  }
1649
1899
 
1650
- exports.convertHookData = convertHookData; // Add `.hooks` functionality to an object
1651
-
1652
- function enableLegacyHooks(obj) {
1653
- var methods = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ['find', 'get', 'create', 'update', 'patch', 'remove'];
1654
- var types = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ['before', 'after', 'error'];
1655
- var hookData = {};
1656
- types.forEach(function (type) {
1657
- // Initialize properties where hook functions are stored
1658
- hookData[type] = {};
1659
- }); // Add non-enumerable `__hooks` property to the object
1900
+ exports.convertOptions = convertOptions;
1660
1901
 
1661
- Object.defineProperty(obj, '__hooks', {
1662
- configurable: true,
1663
- value: hookData,
1664
- writable: true
1665
- });
1666
- return function legacyHooks(allHooks) {
1667
- var _this = this;
1902
+ function getManager(target) {
1903
+ return target && target[exports.HOOKS] || null;
1904
+ }
1668
1905
 
1669
- each(allHooks, function (current, type) {
1670
- if (!_this.__hooks[type]) {
1671
- throw new Error("'".concat(type, "' is not a valid hook type"));
1672
- }
1906
+ exports.getManager = getManager;
1673
1907
 
1674
- var hooks = convertHookData(current);
1675
- each(hooks, function (_value, method) {
1676
- if (method !== 'all' && methods.indexOf(method) === -1) {
1677
- throw new Error("'".concat(method, "' is not a valid hook method"));
1678
- }
1679
- });
1680
- methods.forEach(function (method) {
1681
- var _this$__hooks$type$me;
1908
+ function setManager(target, manager) {
1909
+ var parent = getManager(target);
1910
+ target[exports.HOOKS] = manager.parent(parent);
1911
+ return target;
1912
+ }
1682
1913
 
1683
- var currentHooks = [].concat(_toConsumableArray(hooks.all || []), _toConsumableArray(hooks[method] || []));
1684
- _this.__hooks[type][method] = _this.__hooks[type][method] || [];
1914
+ exports.setManager = setManager;
1685
1915
 
1686
- if (type === 'before') {
1687
- currentHooks = currentHooks.map(fromBeforeHook);
1688
- }
1916
+ function getMiddleware(target) {
1917
+ var manager = getManager(target);
1918
+ return manager ? manager.getMiddleware() : null;
1919
+ }
1689
1920
 
1690
- if (type === 'after') {
1691
- currentHooks = currentHooks.map(fromAfterHook);
1692
- }
1921
+ exports.getMiddleware = getMiddleware;
1693
1922
 
1694
- (_this$__hooks$type$me = _this.__hooks[type][method]).push.apply(_this$__hooks$type$me, _toConsumableArray(currentHooks));
1695
- });
1696
- });
1697
- return this;
1698
- };
1923
+ function setMiddleware(target, middleware) {
1924
+ var manager = new HookManager().middleware(middleware);
1925
+ return setManager(target, manager);
1699
1926
  }
1700
1927
 
1701
- exports.enableLegacyHooks = enableLegacyHooks;
1928
+ exports.setMiddleware = setMiddleware;
1702
1929
 
1703
1930
  /***/ }),
1704
1931
 
1705
- /***/ "../feathers/lib/index.js":
1706
- /*!********************************!*\
1707
- !*** ../feathers/lib/index.js ***!
1708
- \********************************/
1709
- /***/ (function(module, exports, __webpack_require__) {
1932
+ /***/ "../../node_modules/@feathersjs/hooks/script/compose.js":
1933
+ /*!**************************************************************!*\
1934
+ !*** ../../node_modules/@feathersjs/hooks/script/compose.js ***!
1935
+ \**************************************************************/
1936
+ /***/ (function(__unused_webpack_module, exports) {
1710
1937
 
1711
1938
 
1712
1939
 
1713
- var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
1714
- if (k2 === undefined) k2 = k;
1715
- Object.defineProperty(o, k2, {
1716
- enumerable: true,
1717
- get: function get() {
1718
- return m[k];
1719
- }
1720
- });
1721
- } : function (o, m, k, k2) {
1722
- if (k2 === undefined) k2 = k;
1723
- o[k2] = m[k];
1724
- });
1940
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
1725
1941
 
1726
- var __exportStar = this && this.__exportStar || function (m, exports) {
1727
- for (var p in m) {
1728
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
1729
- }
1730
- };
1942
+ 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); }
1731
1943
 
1732
- var __importDefault = this && this.__importDefault || function (mod) {
1733
- return mod && mod.__esModule ? mod : {
1734
- "default": mod
1735
- };
1736
- };
1944
+ 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; }
1737
1945
 
1738
1946
  Object.defineProperty(exports, "__esModule", ({
1739
1947
  value: true
1740
1948
  }));
1741
- exports.Feathers = exports.version = exports.feathers = void 0;
1742
-
1743
- var dependencies_1 = __webpack_require__(/*! ./dependencies */ "../feathers/lib/dependencies.js");
1949
+ exports.compose = void 0;
1744
1950
 
1745
- var version_1 = __importDefault(__webpack_require__(/*! ./version */ "../feathers/lib/version.js"));
1951
+ function compose(middleware) {
1952
+ if (!Array.isArray(middleware)) {
1953
+ throw new TypeError('Middleware stack must be an array!');
1954
+ }
1746
1955
 
1747
- exports.version = version_1.default;
1956
+ var _iterator = _createForOfIteratorHelper(middleware),
1957
+ _step;
1748
1958
 
1749
- var application_1 = __webpack_require__(/*! ./application */ "../feathers/lib/application.js");
1959
+ try {
1960
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
1961
+ var fn = _step.value;
1750
1962
 
1751
- Object.defineProperty(exports, "Feathers", ({
1752
- enumerable: true,
1753
- get: function get() {
1754
- return application_1.Feathers;
1963
+ if (typeof fn !== 'function') {
1964
+ throw new TypeError('Middleware must be composed of functions!');
1965
+ }
1966
+ }
1967
+ } catch (err) {
1968
+ _iterator.e(err);
1969
+ } finally {
1970
+ _iterator.f();
1755
1971
  }
1756
- }));
1757
1972
 
1758
- function feathers() {
1759
- return new application_1.Feathers();
1760
- }
1973
+ return function (context, next) {
1974
+ // last called middleware #
1975
+ var index = -1;
1976
+ return dispatch.call(this, 0);
1761
1977
 
1762
- exports.feathers = feathers;
1763
- feathers.setDebug = dependencies_1.setDebug;
1978
+ function dispatch(i) {
1979
+ if (i <= index) {
1980
+ return Promise.reject(new Error('next() called multiple times'));
1981
+ }
1764
1982
 
1765
- __exportStar(__webpack_require__(/*! ./hooks/index */ "../feathers/lib/hooks/index.js"), exports);
1983
+ index = i;
1984
+ var fn = middleware[i];
1766
1985
 
1767
- __exportStar(__webpack_require__(/*! ./declarations */ "../feathers/lib/declarations.js"), exports);
1986
+ if (i === middleware.length) {
1987
+ fn = next;
1988
+ }
1768
1989
 
1769
- __exportStar(__webpack_require__(/*! ./service */ "../feathers/lib/service.js"), exports);
1990
+ if (!fn) {
1991
+ return Promise.resolve();
1992
+ }
1770
1993
 
1771
- if (true) {
1772
- module.exports = Object.assign(feathers, module.exports);
1994
+ try {
1995
+ return Promise.resolve(fn.call(this, context, dispatch.bind(this, i + 1)));
1996
+ } catch (err) {
1997
+ return Promise.reject(err);
1998
+ }
1999
+ }
2000
+ };
1773
2001
  }
1774
2002
 
2003
+ exports.compose = compose;
2004
+
1775
2005
  /***/ }),
1776
2006
 
1777
- /***/ "../feathers/lib/service.js":
1778
- /*!**********************************!*\
1779
- !*** ../feathers/lib/service.js ***!
1780
- \**********************************/
2007
+ /***/ "../../node_modules/@feathersjs/hooks/script/hooks.js":
2008
+ /*!************************************************************!*\
2009
+ !*** ../../node_modules/@feathersjs/hooks/script/hooks.js ***!
2010
+ \************************************************************/
1781
2011
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1782
2012
 
1783
2013
 
@@ -1785,626 +2015,459 @@ if (true) {
1785
2015
  Object.defineProperty(exports, "__esModule", ({
1786
2016
  value: true
1787
2017
  }));
1788
- exports.wrapService = exports.getServiceOptions = exports.getHookMethods = exports.defaultEventMap = exports.defaultServiceMethods = exports.defaultServiceArguments = exports.SERVICE = void 0;
2018
+ exports.hookDecorator = exports.objectHooks = exports.functionHooks = exports.getOriginal = void 0;
1789
2019
 
1790
- var dependencies_1 = __webpack_require__(/*! ./dependencies */ "../feathers/lib/dependencies.js");
2020
+ var compose_js_1 = __webpack_require__(/*! ./compose.js */ "../../node_modules/@feathersjs/hooks/script/compose.js");
1791
2021
 
1792
- exports.SERVICE = dependencies_1.createSymbol('@feathersjs/service');
1793
- exports.defaultServiceArguments = {
1794
- find: ['params'],
1795
- get: ['id', 'params'],
1796
- create: ['data', 'params'],
1797
- update: ['id', 'data', 'params'],
1798
- patch: ['id', 'data', 'params'],
1799
- remove: ['id', 'params']
1800
- };
1801
- exports.defaultServiceMethods = Object.keys(exports.defaultServiceArguments);
1802
- exports.defaultEventMap = {
1803
- create: 'created',
1804
- update: 'updated',
1805
- patch: 'patched',
1806
- remove: 'removed'
1807
- };
2022
+ var base_js_1 = __webpack_require__(/*! ./base.js */ "../../node_modules/@feathersjs/hooks/script/base.js");
1808
2023
 
1809
- function getHookMethods(service, options) {
1810
- var methods = options.methods;
1811
- return exports.defaultServiceMethods.filter(function (m) {
1812
- return typeof service[m] === 'function' && !methods.includes(m);
1813
- }).concat(methods);
1814
- }
2024
+ var utils_js_1 = __webpack_require__(/*! ./utils.js */ "../../node_modules/@feathersjs/hooks/script/utils.js");
1815
2025
 
1816
- exports.getHookMethods = getHookMethods;
2026
+ function getOriginal(fn) {
2027
+ return typeof fn.original === 'function' ? getOriginal(fn.original) : fn;
2028
+ }
1817
2029
 
1818
- function getServiceOptions(service) {
1819
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1820
- var existingOptions = service[exports.SERVICE];
2030
+ exports.getOriginal = getOriginal;
1821
2031
 
1822
- if (existingOptions) {
1823
- return existingOptions;
2032
+ function functionHooks(fn, managerOrMiddleware) {
2033
+ if (typeof fn !== 'function') {
2034
+ throw new Error('Can not apply hooks to non-function');
1824
2035
  }
1825
2036
 
1826
- var _options$methods = options.methods,
1827
- methods = _options$methods === void 0 ? exports.defaultServiceMethods.filter(function (method) {
1828
- return typeof service[method] === 'function';
1829
- }) : _options$methods,
1830
- _options$events = options.events,
1831
- events = _options$events === void 0 ? service.events || [] : _options$events;
1832
- var _options$serviceEvent = options.serviceEvents,
1833
- serviceEvents = _options$serviceEvent === void 0 ? Object.values(exports.defaultEventMap).concat(events) : _options$serviceEvent;
1834
- return Object.assign(Object.assign({}, options), {
1835
- events: events,
1836
- methods: methods,
1837
- serviceEvents: serviceEvents
1838
- });
1839
- }
2037
+ var manager = (0, base_js_1.convertOptions)(managerOrMiddleware);
1840
2038
 
1841
- exports.getServiceOptions = getServiceOptions;
2039
+ var wrapper = function wrapper() {
2040
+ var _this = this;
1842
2041
 
1843
- function wrapService(location, service, options) {
1844
- // Do nothing if this is already an initialized
1845
- if (service[exports.SERVICE]) {
1846
- return service;
1847
- }
2042
+ var Context = wrapper.Context,
2043
+ original = wrapper.original; // If we got passed an existing HookContext instance, we want to return it as well
1848
2044
 
1849
- var protoService = Object.create(service);
1850
- var serviceOptions = getServiceOptions(service, options);
2045
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2046
+ args[_key] = arguments[_key];
2047
+ }
1851
2048
 
1852
- if (Object.keys(serviceOptions.methods).length === 0 && typeof service.setup !== 'function') {
1853
- throw new Error("Invalid service object passed for path `".concat(location, "`"));
1854
- }
2049
+ var returnContext = args[args.length - 1] instanceof Context; // Use existing context or default
1855
2050
 
1856
- Object.defineProperty(protoService, exports.SERVICE, {
1857
- value: serviceOptions
1858
- });
1859
- return protoService;
1860
- }
2051
+ var base = returnContext ? args.pop() : new Context(); // Initialize the context
1861
2052
 
1862
- exports.wrapService = wrapService;
2053
+ var context = manager.initializeContext(this, args, base); // Assemble the hook chain
1863
2054
 
1864
- /***/ }),
2055
+ var hookChain = [// Return `ctx.result` or the context
2056
+ function (ctx, next) {
2057
+ return next().then(function () {
2058
+ return returnContext ? ctx : ctx.result;
2059
+ });
2060
+ }]; // Create the hook chain by calling the `collectMiddleware function
1865
2061
 
1866
- /***/ "../feathers/lib/version.js":
1867
- /*!**********************************!*\
1868
- !*** ../feathers/lib/version.js ***!
1869
- \**********************************/
1870
- /***/ (function(__unused_webpack_module, exports) {
2062
+ var mw = manager.collectMiddleware(this, args);
1871
2063
 
2064
+ if (mw) {
2065
+ Array.prototype.push.apply(hookChain, mw);
2066
+ } // Runs the actual original method if `ctx.result` is not already set
1872
2067
 
1873
2068
 
1874
- Object.defineProperty(exports, "__esModule", ({
1875
- value: true
1876
- }));
1877
- exports.default = 'development';
2069
+ hookChain.push(function (ctx, next) {
2070
+ if (!Object.prototype.hasOwnProperty.call(context, 'result')) {
2071
+ return Promise.resolve(original.apply(_this, ctx.arguments)).then(function (result) {
2072
+ ctx.result = result;
2073
+ return next();
2074
+ });
2075
+ }
1878
2076
 
1879
- /***/ }),
2077
+ return next();
2078
+ });
2079
+ return (0, compose_js_1.compose)(hookChain).call(this, context);
2080
+ };
1880
2081
 
1881
- /***/ "../../node_modules/events/events.js":
1882
- /*!*******************************************!*\
1883
- !*** ../../node_modules/events/events.js ***!
1884
- \*******************************************/
1885
- /***/ (function(module) {
2082
+ (0, utils_js_1.copyFnProperties)(wrapper, fn);
2083
+ (0, utils_js_1.copyProperties)(wrapper, fn);
2084
+ (0, base_js_1.setManager)(wrapper, manager);
2085
+ return Object.assign(wrapper, {
2086
+ original: getOriginal(fn),
2087
+ Context: manager.getContextClass(),
2088
+ createContext: function createContext() {
2089
+ var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2090
+ return new wrapper.Context(data);
2091
+ }
2092
+ });
2093
+ }
1886
2094
 
1887
- // Copyright Joyent, Inc. and other Node contributors.
1888
- //
1889
- // Permission is hereby granted, free of charge, to any person obtaining a
1890
- // copy of this software and associated documentation files (the
1891
- // "Software"), to deal in the Software without restriction, including
1892
- // without limitation the rights to use, copy, modify, merge, publish,
1893
- // distribute, sublicense, and/or sell copies of the Software, and to permit
1894
- // persons to whom the Software is furnished to do so, subject to the
1895
- // following conditions:
1896
- //
1897
- // The above copyright notice and this permission notice shall be included
1898
- // in all copies or substantial portions of the Software.
1899
- //
1900
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1901
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1902
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
1903
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
1904
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
1905
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
1906
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
2095
+ exports.functionHooks = functionHooks;
1907
2096
 
2097
+ function objectHooks(obj, hooks) {
2098
+ if (Array.isArray(hooks)) {
2099
+ return (0, base_js_1.setMiddleware)(obj, hooks);
2100
+ }
1908
2101
 
2102
+ for (var _i = 0, _Object$keys = Object.keys(hooks); _i < _Object$keys.length; _i++) {
2103
+ var method = _Object$keys[_i];
2104
+ var target = typeof obj[method] === 'function' ? obj : obj.prototype;
2105
+ var fn = target && target[method];
1909
2106
 
1910
- var R = typeof Reflect === 'object' ? Reflect : null
1911
- var ReflectApply = R && typeof R.apply === 'function'
1912
- ? R.apply
1913
- : function ReflectApply(target, receiver, args) {
1914
- return Function.prototype.apply.call(target, receiver, args);
2107
+ if (typeof fn !== 'function') {
2108
+ throw new Error("Can not apply hooks. '".concat(method, "' is not a function"));
2109
+ }
2110
+
2111
+ var manager = (0, base_js_1.convertOptions)(hooks[method]);
2112
+ target[method] = functionHooks(fn, manager.props({
2113
+ method: method
2114
+ }));
1915
2115
  }
1916
2116
 
1917
- var ReflectOwnKeys
1918
- if (R && typeof R.ownKeys === 'function') {
1919
- ReflectOwnKeys = R.ownKeys
1920
- } else if (Object.getOwnPropertySymbols) {
1921
- ReflectOwnKeys = function ReflectOwnKeys(target) {
1922
- return Object.getOwnPropertyNames(target)
1923
- .concat(Object.getOwnPropertySymbols(target));
1924
- };
1925
- } else {
1926
- ReflectOwnKeys = function ReflectOwnKeys(target) {
1927
- return Object.getOwnPropertyNames(target);
1928
- };
2117
+ return obj;
1929
2118
  }
1930
2119
 
1931
- function ProcessEmitWarning(warning) {
1932
- if (console && console.warn) console.warn(warning);
1933
- }
2120
+ exports.objectHooks = objectHooks;
1934
2121
 
1935
- var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {
1936
- return value !== value;
1937
- }
2122
+ var hookDecorator = function hookDecorator(managerOrMiddleware) {
2123
+ var wrapper = function wrapper(_target, method, descriptor) {
2124
+ var manager = (0, base_js_1.convertOptions)(managerOrMiddleware);
1938
2125
 
1939
- function EventEmitter() {
1940
- EventEmitter.init.call(this);
1941
- }
1942
- module.exports = EventEmitter;
1943
- module.exports.once = once;
2126
+ if (!descriptor) {
2127
+ (0, base_js_1.setManager)(_target.prototype, manager);
2128
+ return _target;
2129
+ }
1944
2130
 
1945
- // Backwards-compat with node 0.10.x
1946
- EventEmitter.EventEmitter = EventEmitter;
2131
+ var fn = descriptor.value;
1947
2132
 
1948
- EventEmitter.prototype._events = undefined;
1949
- EventEmitter.prototype._eventsCount = 0;
1950
- EventEmitter.prototype._maxListeners = undefined;
2133
+ if (typeof fn !== 'function') {
2134
+ throw new Error("Can not apply hooks. '".concat(method, "' is not a function"));
2135
+ }
1951
2136
 
1952
- // By default EventEmitters will print a warning if more than 10 listeners are
1953
- // added to it. This is a useful default which helps finding memory leaks.
1954
- var defaultMaxListeners = 10;
2137
+ descriptor.value = functionHooks(fn, manager.props({
2138
+ method: method
2139
+ }));
2140
+ return descriptor;
2141
+ };
1955
2142
 
1956
- function checkListener(listener) {
1957
- if (typeof listener !== 'function') {
1958
- throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
1959
- }
1960
- }
2143
+ return wrapper;
2144
+ };
1961
2145
 
1962
- Object.defineProperty(EventEmitter, 'defaultMaxListeners', {
1963
- enumerable: true,
1964
- get: function() {
1965
- return defaultMaxListeners;
1966
- },
1967
- set: function(arg) {
1968
- if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {
1969
- throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.');
1970
- }
1971
- defaultMaxListeners = arg;
1972
- }
1973
- });
2146
+ exports.hookDecorator = hookDecorator;
2147
+
2148
+ /***/ }),
2149
+
2150
+ /***/ "../../node_modules/@feathersjs/hooks/script/index.js":
2151
+ /*!************************************************************!*\
2152
+ !*** ../../node_modules/@feathersjs/hooks/script/index.js ***!
2153
+ \************************************************************/
2154
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1974
2155
 
1975
- EventEmitter.init = function() {
1976
2156
 
1977
- if (this._events === undefined ||
1978
- this._events === Object.getPrototypeOf(this)._events) {
1979
- this._events = Object.create(null);
1980
- this._eventsCount = 0;
1981
- }
1982
2157
 
1983
- this._maxListeners = this._maxListeners || undefined;
1984
- };
2158
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
1985
2159
 
1986
- // Obviously not all Emitters should be limited to 10. This function allows
1987
- // that to be increased. Set to zero for unlimited.
1988
- EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
1989
- if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {
1990
- throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.');
1991
- }
1992
- this._maxListeners = n;
1993
- return this;
1994
- };
2160
+ 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."); }
1995
2161
 
1996
- function _getMaxListeners(that) {
1997
- if (that._maxListeners === undefined)
1998
- return EventEmitter.defaultMaxListeners;
1999
- return that._maxListeners;
2000
- }
2162
+ 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); }
2001
2163
 
2002
- EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
2003
- return _getMaxListeners(this);
2004
- };
2164
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
2005
2165
 
2006
- EventEmitter.prototype.emit = function emit(type) {
2007
- var args = [];
2008
- for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);
2009
- var doError = (type === 'error');
2166
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
2010
2167
 
2011
- var events = this._events;
2012
- if (events !== undefined)
2013
- doError = (doError && events.error === undefined);
2014
- else if (!doError)
2015
- return false;
2168
+ 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; }
2016
2169
 
2017
- // If there is no 'error' event listener then throw.
2018
- if (doError) {
2019
- var er;
2020
- if (args.length > 0)
2021
- er = args[0];
2022
- if (er instanceof Error) {
2023
- // Note: The comments on the `throw` lines are intentional, they show
2024
- // up in Node's output if this results in an unhandled exception.
2025
- throw er; // Unhandled 'error' event
2170
+ var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
2171
+ if (k2 === undefined) k2 = k;
2172
+ Object.defineProperty(o, k2, {
2173
+ enumerable: true,
2174
+ get: function get() {
2175
+ return m[k];
2026
2176
  }
2027
- // At least give some kind of context to the user
2028
- var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));
2029
- err.context = er;
2030
- throw err; // Unhandled 'error' event
2177
+ });
2178
+ } : function (o, m, k, k2) {
2179
+ if (k2 === undefined) k2 = k;
2180
+ o[k2] = m[k];
2181
+ });
2182
+
2183
+ var __exportStar = this && this.__exportStar || function (m, exports) {
2184
+ for (var p in m) {
2185
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
2031
2186
  }
2187
+ };
2032
2188
 
2033
- var handler = events[type];
2189
+ Object.defineProperty(exports, "__esModule", ({
2190
+ value: true
2191
+ }));
2192
+ exports.hooks = exports.middleware = void 0;
2034
2193
 
2035
- if (handler === undefined)
2036
- return false;
2194
+ var base_js_1 = __webpack_require__(/*! ./base.js */ "../../node_modules/@feathersjs/hooks/script/base.js");
2037
2195
 
2038
- if (typeof handler === 'function') {
2039
- ReflectApply(handler, this, args);
2040
- } else {
2041
- var len = handler.length;
2042
- var listeners = arrayClone(handler, len);
2043
- for (var i = 0; i < len; ++i)
2044
- ReflectApply(listeners[i], this, args);
2045
- }
2196
+ var hooks_js_1 = __webpack_require__(/*! ./hooks.js */ "../../node_modules/@feathersjs/hooks/script/hooks.js");
2046
2197
 
2047
- return true;
2048
- };
2198
+ __exportStar(__webpack_require__(/*! ./hooks.js */ "../../node_modules/@feathersjs/hooks/script/hooks.js"), exports);
2049
2199
 
2050
- function _addListener(target, type, listener, prepend) {
2051
- var m;
2052
- var events;
2053
- var existing;
2200
+ __exportStar(__webpack_require__(/*! ./compose.js */ "../../node_modules/@feathersjs/hooks/script/compose.js"), exports);
2054
2201
 
2055
- checkListener(listener);
2202
+ __exportStar(__webpack_require__(/*! ./base.js */ "../../node_modules/@feathersjs/hooks/script/base.js"), exports);
2056
2203
 
2057
- events = target._events;
2058
- if (events === undefined) {
2059
- events = target._events = Object.create(null);
2060
- target._eventsCount = 0;
2061
- } else {
2062
- // To avoid recursion in the case that type === "newListener"! Before
2063
- // adding it to the listeners, first emit "newListener".
2064
- if (events.newListener !== undefined) {
2065
- target.emit('newListener', type,
2066
- listener.listener ? listener.listener : listener);
2204
+ __exportStar(__webpack_require__(/*! ./regular.js */ "../../node_modules/@feathersjs/hooks/script/regular.js"), exports);
2205
+ /**
2206
+ * Initializes a hook settings object with the given middleware.
2207
+ * @param mw The list of middleware
2208
+ * @param options Middleware options (params, default, props)
2209
+ */
2067
2210
 
2068
- // Re-assign `events` because a newListener handler could have caused the
2069
- // this._events to be assigned to a new object
2070
- events = target._events;
2211
+
2212
+ function middleware(mw, options) {
2213
+ var manager = new base_js_1.HookManager().middleware(mw);
2214
+
2215
+ if (options) {
2216
+ if (options.params) {
2217
+ manager.params.apply(manager, _toConsumableArray(options.params));
2071
2218
  }
2072
- existing = events[type];
2073
- }
2074
2219
 
2075
- if (existing === undefined) {
2076
- // Optimize the case of one listener. Don't need the extra array object.
2077
- existing = events[type] = listener;
2078
- ++target._eventsCount;
2079
- } else {
2080
- if (typeof existing === 'function') {
2081
- // Adding the second element, need to change to array.
2082
- existing = events[type] =
2083
- prepend ? [listener, existing] : [existing, listener];
2084
- // If we've already got an array, just append.
2085
- } else if (prepend) {
2086
- existing.unshift(listener);
2087
- } else {
2088
- existing.push(listener);
2220
+ if (options.defaults) {
2221
+ manager.defaults(options.defaults);
2089
2222
  }
2090
2223
 
2091
- // Check for listener leak
2092
- m = _getMaxListeners(target);
2093
- if (m > 0 && existing.length > m && !existing.warned) {
2094
- existing.warned = true;
2095
- // No error code for this since it is a Warning
2096
- // eslint-disable-next-line no-restricted-syntax
2097
- var w = new Error('Possible EventEmitter memory leak detected. ' +
2098
- existing.length + ' ' + String(type) + ' listeners ' +
2099
- 'added. Use emitter.setMaxListeners() to ' +
2100
- 'increase limit');
2101
- w.name = 'MaxListenersExceededWarning';
2102
- w.emitter = target;
2103
- w.type = type;
2104
- w.count = existing.length;
2105
- ProcessEmitWarning(w);
2224
+ if (options.props) {
2225
+ manager.props(options.props);
2106
2226
  }
2107
2227
  }
2108
2228
 
2109
- return target;
2229
+ return manager;
2110
2230
  }
2111
2231
 
2112
- EventEmitter.prototype.addListener = function addListener(type, listener) {
2113
- return _addListener(this, type, listener, false);
2114
- };
2232
+ exports.middleware = middleware; // Fallthrough to actual implementation
2115
2233
 
2116
- EventEmitter.prototype.on = EventEmitter.prototype.addListener;
2234
+ function hooks() {
2235
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2236
+ args[_key] = arguments[_key];
2237
+ }
2117
2238
 
2118
- EventEmitter.prototype.prependListener =
2119
- function prependListener(type, listener) {
2120
- return _addListener(this, type, listener, true);
2121
- };
2239
+ var target = args[0],
2240
+ _hooks = args[1];
2122
2241
 
2123
- function onceWrapper() {
2124
- if (!this.fired) {
2125
- this.target.removeListener(this.type, this.wrapFn);
2126
- this.fired = true;
2127
- if (arguments.length === 0)
2128
- return this.listener.call(this.target);
2129
- return this.listener.apply(this.target, arguments);
2242
+ if (typeof target === 'function' && (_hooks instanceof base_js_1.HookManager || Array.isArray(_hooks) || args.length === 1)) {
2243
+ return (0, hooks_js_1.functionHooks)(target, _hooks);
2130
2244
  }
2131
- }
2132
2245
 
2133
- function _onceWrap(target, type, listener) {
2134
- var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };
2135
- var wrapped = onceWrapper.bind(state);
2136
- wrapped.listener = listener;
2137
- state.wrapFn = wrapped;
2138
- return wrapped;
2246
+ if (args.length === 2) {
2247
+ return (0, hooks_js_1.objectHooks)(target, _hooks);
2248
+ }
2249
+
2250
+ return (0, hooks_js_1.hookDecorator)(target);
2139
2251
  }
2140
2252
 
2141
- EventEmitter.prototype.once = function once(type, listener) {
2142
- checkListener(listener);
2143
- this.on(type, _onceWrap(this, type, listener));
2144
- return this;
2145
- };
2253
+ exports.hooks = hooks;
2146
2254
 
2147
- EventEmitter.prototype.prependOnceListener =
2148
- function prependOnceListener(type, listener) {
2149
- checkListener(listener);
2150
- this.prependListener(type, _onceWrap(this, type, listener));
2151
- return this;
2152
- };
2255
+ /***/ }),
2153
2256
 
2154
- // Emits a 'removeListener' event if and only if the listener was removed.
2155
- EventEmitter.prototype.removeListener =
2156
- function removeListener(type, listener) {
2157
- var list, events, position, i, originalListener;
2257
+ /***/ "../../node_modules/@feathersjs/hooks/script/regular.js":
2258
+ /*!**************************************************************!*\
2259
+ !*** ../../node_modules/@feathersjs/hooks/script/regular.js ***!
2260
+ \**************************************************************/
2261
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
2158
2262
 
2159
- checkListener(listener);
2160
2263
 
2161
- events = this._events;
2162
- if (events === undefined)
2163
- return this;
2164
2264
 
2165
- list = events[type];
2166
- if (list === undefined)
2167
- return this;
2265
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2168
2266
 
2169
- if (list === listener || list.listener === listener) {
2170
- if (--this._eventsCount === 0)
2171
- this._events = Object.create(null);
2172
- else {
2173
- delete events[type];
2174
- if (events.removeListener)
2175
- this.emit('removeListener', type, list.listener || listener);
2176
- }
2177
- } else if (typeof list !== 'function') {
2178
- position = -1;
2267
+ 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."); }
2179
2268
 
2180
- for (i = list.length - 1; i >= 0; i--) {
2181
- if (list[i] === listener || list[i].listener === listener) {
2182
- originalListener = list[i].listener;
2183
- position = i;
2184
- break;
2185
- }
2186
- }
2269
+ 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); }
2187
2270
 
2188
- if (position < 0)
2189
- return this;
2271
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
2190
2272
 
2191
- if (position === 0)
2192
- list.shift();
2193
- else {
2194
- spliceOne(list, position);
2195
- }
2273
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
2196
2274
 
2197
- if (list.length === 1)
2198
- events[type] = list[0];
2275
+ 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; }
2199
2276
 
2200
- if (events.removeListener !== undefined)
2201
- this.emit('removeListener', type, originalListener || listener);
2202
- }
2277
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2278
+
2279
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
2280
+
2281
+ 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; }
2282
+
2283
+ Object.defineProperty(exports, "__esModule", ({
2284
+ value: true
2285
+ }));
2286
+ exports.collect = exports.fromErrorHook = exports.fromAfterHook = exports.fromBeforeHook = exports.runHooks = exports.runHook = void 0;
2287
+
2288
+ var compose_js_1 = __webpack_require__(/*! ./compose.js */ "../../node_modules/@feathersjs/hooks/script/compose.js");
2289
+
2290
+ var runHook = function runHook(hook, context, type) {
2291
+ if (type) context.type = type;
2292
+ return Promise.resolve(hook.call(context.self, context)).then(function (res) {
2293
+ if (type) context.type = null;
2294
+
2295
+ if (res && res !== context) {
2296
+ Object.assign(context, res);
2297
+ }
2298
+ });
2299
+ };
2203
2300
 
2204
- return this;
2205
- };
2301
+ exports.runHook = runHook;
2206
2302
 
2207
- EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
2303
+ var runHooks = function runHooks(hooks) {
2304
+ return function (context) {
2305
+ return hooks.reduce(function (promise, hook) {
2306
+ return promise.then(function () {
2307
+ return (0, exports.runHook)(hook, context);
2308
+ });
2309
+ }, Promise.resolve(context));
2310
+ };
2311
+ };
2208
2312
 
2209
- EventEmitter.prototype.removeAllListeners =
2210
- function removeAllListeners(type) {
2211
- var listeners, events, i;
2313
+ exports.runHooks = runHooks;
2212
2314
 
2213
- events = this._events;
2214
- if (events === undefined)
2215
- return this;
2315
+ function fromBeforeHook(hook) {
2316
+ return function (context, next) {
2317
+ return (0, exports.runHook)(hook, context, 'before').then(next);
2318
+ };
2319
+ }
2216
2320
 
2217
- // not listening for removeListener, no need to emit
2218
- if (events.removeListener === undefined) {
2219
- if (arguments.length === 0) {
2220
- this._events = Object.create(null);
2221
- this._eventsCount = 0;
2222
- } else if (events[type] !== undefined) {
2223
- if (--this._eventsCount === 0)
2224
- this._events = Object.create(null);
2225
- else
2226
- delete events[type];
2227
- }
2228
- return this;
2229
- }
2321
+ exports.fromBeforeHook = fromBeforeHook;
2230
2322
 
2231
- // emit removeListener for all listeners on all events
2232
- if (arguments.length === 0) {
2233
- var keys = Object.keys(events);
2234
- var key;
2235
- for (i = 0; i < keys.length; ++i) {
2236
- key = keys[i];
2237
- if (key === 'removeListener') continue;
2238
- this.removeAllListeners(key);
2239
- }
2240
- this.removeAllListeners('removeListener');
2241
- this._events = Object.create(null);
2242
- this._eventsCount = 0;
2243
- return this;
2244
- }
2323
+ function fromAfterHook(hook) {
2324
+ return function (context, next) {
2325
+ return next().then(function () {
2326
+ return (0, exports.runHook)(hook, context, 'after');
2327
+ });
2328
+ };
2329
+ }
2245
2330
 
2246
- listeners = events[type];
2331
+ exports.fromAfterHook = fromAfterHook;
2247
2332
 
2248
- if (typeof listeners === 'function') {
2249
- this.removeListener(type, listeners);
2250
- } else if (listeners !== undefined) {
2251
- // LIFO order
2252
- for (i = listeners.length - 1; i >= 0; i--) {
2253
- this.removeListener(type, listeners[i]);
2254
- }
2333
+ function fromErrorHook(hook) {
2334
+ return function (context, next) {
2335
+ return next().catch(function (error) {
2336
+ if (context.error !== error || context.result !== undefined) {
2337
+ context.original = _objectSpread({}, context);
2338
+ context.error = error;
2339
+ delete context.result;
2255
2340
  }
2256
2341
 
2257
- return this;
2258
- };
2259
-
2260
- function _listeners(target, type, unwrap) {
2261
- var events = target._events;
2342
+ return (0, exports.runHook)(hook, context, 'error').then(function () {
2343
+ if (context.result === undefined && context.error !== undefined) {
2344
+ throw context.error;
2345
+ }
2346
+ });
2347
+ });
2348
+ };
2349
+ }
2262
2350
 
2263
- if (events === undefined)
2264
- return [];
2351
+ exports.fromErrorHook = fromErrorHook;
2265
2352
 
2266
- var evlistener = events[type];
2267
- if (evlistener === undefined)
2268
- return [];
2353
+ function collect(_ref) {
2354
+ var _ref$before = _ref.before,
2355
+ before = _ref$before === void 0 ? [] : _ref$before,
2356
+ _ref$after = _ref.after,
2357
+ after = _ref$after === void 0 ? [] : _ref$after,
2358
+ _ref$error = _ref.error,
2359
+ error = _ref$error === void 0 ? [] : _ref$error;
2360
+ var beforeHooks = before.map(fromBeforeHook);
2269
2361
 
2270
- if (typeof evlistener === 'function')
2271
- return unwrap ? [evlistener.listener || evlistener] : [evlistener];
2362
+ var afterHooks = _toConsumableArray(after).reverse().map(fromAfterHook);
2272
2363
 
2273
- return unwrap ?
2274
- unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
2364
+ var errorHooks = error.length ? [fromErrorHook((0, exports.runHooks)(error))] : [];
2365
+ return (0, compose_js_1.compose)([].concat(errorHooks, _toConsumableArray(beforeHooks), _toConsumableArray(afterHooks)));
2275
2366
  }
2276
2367
 
2277
- EventEmitter.prototype.listeners = function listeners(type) {
2278
- return _listeners(this, type, true);
2279
- };
2368
+ exports.collect = collect;
2280
2369
 
2281
- EventEmitter.prototype.rawListeners = function rawListeners(type) {
2282
- return _listeners(this, type, false);
2283
- };
2370
+ /***/ }),
2284
2371
 
2285
- EventEmitter.listenerCount = function(emitter, type) {
2286
- if (typeof emitter.listenerCount === 'function') {
2287
- return emitter.listenerCount(type);
2288
- } else {
2289
- return listenerCount.call(emitter, type);
2290
- }
2291
- };
2372
+ /***/ "../../node_modules/@feathersjs/hooks/script/utils.js":
2373
+ /*!************************************************************!*\
2374
+ !*** ../../node_modules/@feathersjs/hooks/script/utils.js ***!
2375
+ \************************************************************/
2376
+ /***/ (function(__unused_webpack_module, exports) {
2292
2377
 
2293
- EventEmitter.prototype.listenerCount = listenerCount;
2294
- function listenerCount(type) {
2295
- var events = this._events;
2296
2378
 
2297
- if (events !== undefined) {
2298
- var evlistener = events[type];
2299
2379
 
2300
- if (typeof evlistener === 'function') {
2301
- return 1;
2302
- } else if (evlistener !== undefined) {
2303
- return evlistener.length;
2304
- }
2305
- }
2380
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
2306
2381
 
2307
- return 0;
2308
- }
2382
+ 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); }
2309
2383
 
2310
- EventEmitter.prototype.eventNames = function eventNames() {
2311
- return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];
2312
- };
2384
+ 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; }
2313
2385
 
2314
- function arrayClone(arr, n) {
2315
- var copy = new Array(n);
2316
- for (var i = 0; i < n; ++i)
2317
- copy[i] = arr[i];
2318
- return copy;
2319
- }
2386
+ Object.defineProperty(exports, "__esModule", ({
2387
+ value: true
2388
+ }));
2389
+ exports.copyFnProperties = exports.copyProperties = exports.copyToSelf = void 0;
2390
+ var proto = Object.prototype; // These are non-standard but offer a more reliable prototype based
2391
+ // lookup for properties
2320
2392
 
2321
- function spliceOne(list, index) {
2322
- for (; index + 1 < list.length; index++)
2323
- list[index] = list[index + 1];
2324
- list.pop();
2325
- }
2393
+ var hasProtoDefinitions = typeof proto.__lookupGetter__ === 'function' && typeof proto.__defineGetter__ === 'function' && typeof proto.__defineSetter__ === 'function';
2326
2394
 
2327
- function unwrapListeners(arr) {
2328
- var ret = new Array(arr.length);
2329
- for (var i = 0; i < ret.length; ++i) {
2330
- ret[i] = arr[i].listener || arr[i];
2331
- }
2332
- return ret;
2333
- }
2395
+ function copyToSelf(target) {
2396
+ // tslint:disable-next-line
2397
+ for (var key in target) {
2398
+ if (!Object.hasOwnProperty.call(target, key)) {
2399
+ var getter = hasProtoDefinitions ? target.constructor.prototype.__lookupGetter__(key) : Object.getOwnPropertyDescriptor(target, key);
2334
2400
 
2335
- function once(emitter, name) {
2336
- return new Promise(function (resolve, reject) {
2337
- function errorListener(err) {
2338
- emitter.removeListener(name, resolver);
2339
- reject(err);
2340
- }
2401
+ if (hasProtoDefinitions && getter) {
2402
+ target.__defineGetter__(key, getter);
2341
2403
 
2342
- function resolver() {
2343
- if (typeof emitter.removeListener === 'function') {
2344
- emitter.removeListener('error', errorListener);
2345
- }
2346
- resolve([].slice.call(arguments));
2347
- };
2404
+ var setter = target.constructor.prototype.__lookupSetter__(key);
2348
2405
 
2349
- eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });
2350
- if (name !== 'error') {
2351
- addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });
2406
+ if (setter) {
2407
+ target.__defineSetter__(key, setter);
2408
+ }
2409
+ } else if (getter) {
2410
+ Object.defineProperty(target, key, getter);
2411
+ } else {
2412
+ target[key] = target[key];
2413
+ }
2352
2414
  }
2353
- });
2415
+ }
2354
2416
  }
2355
2417
 
2356
- function addErrorHandlerIfEventEmitter(emitter, handler, flags) {
2357
- if (typeof emitter.on === 'function') {
2358
- eventTargetAgnosticAddListener(emitter, 'error', handler, flags);
2418
+ exports.copyToSelf = copyToSelf;
2419
+
2420
+ function copyProperties(target) {
2421
+ for (var _len = arguments.length, originals = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
2422
+ originals[_key - 1] = arguments[_key];
2359
2423
  }
2360
- }
2361
2424
 
2362
- function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
2363
- if (typeof emitter.on === 'function') {
2364
- if (flags.once) {
2365
- emitter.once(name, listener);
2366
- } else {
2367
- emitter.on(name, listener);
2368
- }
2369
- } else if (typeof emitter.addEventListener === 'function') {
2370
- // EventTarget does not have `error` event semantics like Node
2371
- // EventEmitters, we do not listen for `error` events here.
2372
- emitter.addEventListener(name, function wrapListener(arg) {
2373
- // IE does not have builtin `{ once: true }` support so we
2374
- // have to do it manually.
2375
- if (flags.once) {
2376
- emitter.removeEventListener(name, wrapListener);
2425
+ for (var _i = 0, _originals = originals; _i < _originals.length; _i++) {
2426
+ var original = _originals[_i];
2427
+ var originalProps = Object.keys(original).concat(Object.getOwnPropertySymbols(original));
2428
+
2429
+ var _iterator = _createForOfIteratorHelper(originalProps),
2430
+ _step;
2431
+
2432
+ try {
2433
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
2434
+ var prop = _step.value;
2435
+ var propDescriptor = Object.getOwnPropertyDescriptor(original, prop);
2436
+
2437
+ if (propDescriptor && !Object.prototype.hasOwnProperty.call(target, prop)) {
2438
+ Object.defineProperty(target, prop, propDescriptor);
2439
+ }
2377
2440
  }
2378
- listener(arg);
2379
- });
2380
- } else {
2381
- throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter);
2441
+ } catch (err) {
2442
+ _iterator.e(err);
2443
+ } finally {
2444
+ _iterator.f();
2445
+ }
2382
2446
  }
2383
- }
2384
2447
 
2448
+ return target;
2449
+ }
2385
2450
 
2386
- /***/ }),
2451
+ exports.copyProperties = copyProperties;
2387
2452
 
2388
- /***/ "./src/core.ts":
2389
- /*!*********************!*\
2390
- !*** ./src/core.ts ***!
2391
- \*********************/
2392
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
2453
+ function copyFnProperties(target, original) {
2454
+ var internalProps = ['name', 'length'];
2393
2455
 
2456
+ try {
2457
+ for (var _i2 = 0, _internalProps = internalProps; _i2 < _internalProps.length; _i2++) {
2458
+ var prop = _internalProps[_i2];
2459
+ var value = original[prop];
2460
+ Object.defineProperty(target, prop, {
2461
+ value: value
2462
+ });
2463
+ }
2464
+ } catch (_e) {// Avoid IE error
2465
+ }
2394
2466
 
2395
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
2396
- if (k2 === undefined) k2 = k;
2397
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
2398
- }) : (function(o, m, k, k2) {
2399
- if (k2 === undefined) k2 = k;
2400
- o[k2] = m[k];
2401
- }));
2402
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
2403
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
2404
- };
2405
- Object.defineProperty(exports, "__esModule", ({ value: true }));
2406
- __exportStar(__webpack_require__(/*! @feathersjs/feathers */ "../feathers/lib/index.js"), exports);
2467
+ return target;
2468
+ }
2407
2469
 
2470
+ exports.copyFnProperties = copyFnProperties;
2408
2471
 
2409
2472
  /***/ })
2410
2473