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

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