@feathersjs/client 5.0.32 → 5.0.34

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,733 +12,488 @@ return /******/ (function() { // webpackBootstrap
12
12
  /******/ "use strict";
13
13
  /******/ var __webpack_modules__ = ({
14
14
 
15
- /***/ "../commons/lib/debug.js":
16
- /*!*******************************!*\
17
- !*** ../commons/lib/debug.js ***!
18
- \*******************************/
19
- /***/ (function(__unused_webpack_module, exports) {
20
-
21
-
22
-
23
- Object.defineProperty(exports, "__esModule", ({
24
- value: true
25
- }));
26
- exports.noopDebug = noopDebug;
27
- exports.setDebug = setDebug;
28
- exports.createDebug = createDebug;
29
- var debuggers = {};
30
- function noopDebug() {
31
- return function () {};
32
- }
33
- var defaultInitializer = noopDebug;
34
- function setDebug(debug) {
35
- defaultInitializer = debug;
36
- Object.keys(debuggers).forEach(function (name) {
37
- debuggers[name] = debug(name);
38
- });
39
- }
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
-
49
- /***/ }),
50
-
51
- /***/ "../commons/lib/index.js":
52
- /*!*******************************!*\
53
- !*** ../commons/lib/index.js ***!
54
- \*******************************/
15
+ /***/ "../../node_modules/@feathersjs/hooks/script/base.js":
16
+ /*!***********************************************************!*\
17
+ !*** ../../node_modules/@feathersjs/hooks/script/base.js ***!
18
+ \***********************************************************/
55
19
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
56
20
 
57
21
 
58
22
 
59
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
60
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
61
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
23
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
24
+ function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
25
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
26
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
27
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
28
+ function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
29
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
62
30
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
63
- function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
64
- 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."); }
31
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
32
+ 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."); }
65
33
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
34
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
35
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
66
36
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
67
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
68
- function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
69
- var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
70
- if (k2 === undefined) k2 = k;
71
- var desc = Object.getOwnPropertyDescriptor(m, k);
72
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
73
- desc = {
74
- enumerable: true,
75
- get: function get() {
76
- return m[k];
77
- }
78
- };
79
- }
80
- Object.defineProperty(o, k2, desc);
81
- } : function (o, m, k, k2) {
82
- if (k2 === undefined) k2 = k;
83
- o[k2] = m[k];
84
- });
85
- var __exportStar = this && this.__exportStar || function (m, exports) {
86
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
87
- };
37
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
38
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
39
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
40
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
41
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
88
42
  Object.defineProperty(exports, "__esModule", ({
89
43
  value: true
90
44
  }));
91
- exports._ = void 0;
92
- exports.stripSlashes = stripSlashes;
93
- exports.isPromise = isPromise;
94
- exports.createSymbol = createSymbol;
95
- // Removes all leading and trailing slashes from a path
96
- function stripSlashes(name) {
97
- return name.replace(/^(\/+)|(\/+)$/g, '');
98
- }
99
- // A set of lodash-y utility functions that use ES6
100
- exports._ = {
101
- each: function each(obj, callback) {
102
- if (obj && typeof obj.forEach === 'function') {
103
- obj.forEach(callback);
104
- } else if (exports._.isObject(obj)) {
105
- Object.keys(obj).forEach(function (key) {
106
- return callback(obj[key], key);
107
- });
45
+ exports.setMiddleware = exports.getMiddleware = exports.setManager = exports.getManager = exports.convertOptions = exports.HookManager = exports.BaseHookContext = exports.HOOKS = void 0;
46
+ var utils_js_1 = __webpack_require__(/*! ./utils.js */ "../../node_modules/@feathersjs/hooks/script/utils.js");
47
+ exports.HOOKS = Symbol.for('@feathersjs/hooks');
48
+ /**
49
+ * The base hook context.
50
+ */
51
+ var BaseHookContext = /*#__PURE__*/function () {
52
+ function BaseHookContext() {
53
+ var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
54
+ _classCallCheck(this, BaseHookContext);
55
+ Object.defineProperty(this, "self", {
56
+ enumerable: true,
57
+ configurable: true,
58
+ writable: true,
59
+ value: void 0
60
+ });
61
+ Object.assign(this, data);
62
+ }
63
+ return _createClass(BaseHookContext, [{
64
+ key: "toJSON",
65
+ value: function toJSON() {
66
+ var _this = this;
67
+ var keys = Object.keys(this);
68
+ var proto = Object.getPrototypeOf(this);
69
+ while (proto) {
70
+ keys.push.apply(keys, _toConsumableArray(Object.keys(proto)));
71
+ proto = Object.getPrototypeOf(proto);
72
+ }
73
+ return keys.reduce(function (result, key) {
74
+ result[key] = _this[key];
75
+ return result;
76
+ }, {});
108
77
  }
109
- },
110
- some: function some(value, callback) {
111
- return Object.keys(value).map(function (key) {
112
- return [value[key], key];
113
- }).some(function (_ref) {
114
- var _ref2 = _slicedToArray(_ref, 2),
115
- val = _ref2[0],
116
- key = _ref2[1];
117
- return callback(val, key);
78
+ }]);
79
+ }();
80
+ exports.BaseHookContext = BaseHookContext;
81
+ var HookManager = /*#__PURE__*/function () {
82
+ function HookManager() {
83
+ _classCallCheck(this, HookManager);
84
+ Object.defineProperty(this, "_parent", {
85
+ enumerable: true,
86
+ configurable: true,
87
+ writable: true,
88
+ value: null
118
89
  });
119
- },
120
- every: function every(value, callback) {
121
- return Object.keys(value).map(function (key) {
122
- return [value[key], key];
123
- }).every(function (_ref3) {
124
- var _ref4 = _slicedToArray(_ref3, 2),
125
- val = _ref4[0],
126
- key = _ref4[1];
127
- return callback(val, key);
90
+ Object.defineProperty(this, "_params", {
91
+ enumerable: true,
92
+ configurable: true,
93
+ writable: true,
94
+ value: null
128
95
  });
129
- },
130
- keys: function keys(obj) {
131
- return Object.keys(obj);
132
- },
133
- values: function values(obj) {
134
- return exports._.keys(obj).map(function (key) {
135
- return obj[key];
96
+ Object.defineProperty(this, "_middleware", {
97
+ enumerable: true,
98
+ configurable: true,
99
+ writable: true,
100
+ value: null
136
101
  });
137
- },
138
- isMatch: function isMatch(obj, item) {
139
- return exports._.keys(item).every(function (key) {
140
- return obj[key] === item[key];
102
+ Object.defineProperty(this, "_props", {
103
+ enumerable: true,
104
+ configurable: true,
105
+ writable: true,
106
+ value: null
141
107
  });
142
- },
143
- isEmpty: function isEmpty(obj) {
144
- return exports._.keys(obj).length === 0;
145
- },
146
- isObject: function isObject(item) {
147
- return _typeof(item) === 'object' && !Array.isArray(item) && item !== null;
148
- },
149
- isObjectOrArray: function isObjectOrArray(value) {
150
- return _typeof(value) === 'object' && value !== null;
151
- },
152
- extend: function extend(first) {
153
- for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
154
- rest[_key - 1] = arguments[_key];
108
+ Object.defineProperty(this, "_defaults", {
109
+ enumerable: true,
110
+ configurable: true,
111
+ writable: true,
112
+ value: void 0
113
+ });
114
+ }
115
+ return _createClass(HookManager, [{
116
+ key: "parent",
117
+ value: function parent(_parent) {
118
+ this._parent = _parent;
119
+ return this;
155
120
  }
156
- return Object.assign.apply(Object, [first].concat(rest));
157
- },
158
- omit: function omit(obj) {
159
- var result = exports._.extend({}, obj);
160
- for (var _len2 = arguments.length, keys = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
161
- keys[_key2 - 1] = arguments[_key2];
121
+ }, {
122
+ key: "middleware",
123
+ value: function middleware(_middleware) {
124
+ this._middleware = _middleware !== null && _middleware !== void 0 && _middleware.length ? _middleware : null;
125
+ return this;
162
126
  }
163
- keys.forEach(function (key) {
164
- return delete result[key];
165
- });
166
- return result;
167
- },
168
- pick: function pick(source) {
169
- for (var _len3 = arguments.length, keys = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
170
- keys[_key3 - 1] = arguments[_key3];
127
+ }, {
128
+ key: "getMiddleware",
129
+ value: function getMiddleware() {
130
+ var _this$_parent;
131
+ var previous = (_this$_parent = this._parent) === null || _this$_parent === void 0 ? void 0 : _this$_parent.getMiddleware();
132
+ if (previous && this._middleware) {
133
+ return previous.concat(this._middleware);
134
+ }
135
+ return previous || this._middleware;
171
136
  }
172
- return keys.reduce(function (result, key) {
173
- if (source[key] !== undefined) {
174
- result[key] = source[key];
137
+ }, {
138
+ key: "collectMiddleware",
139
+ value: function collectMiddleware(self, _args) {
140
+ var otherMiddleware = getMiddleware(self);
141
+ var middleware = this.getMiddleware();
142
+ if (otherMiddleware && middleware) {
143
+ return otherMiddleware.concat(middleware);
175
144
  }
176
- return result;
177
- }, {});
178
- },
179
- // Recursively merge the source object into the target object
180
- merge: function merge(target, source) {
181
- if (exports._.isObject(target) && exports._.isObject(source)) {
182
- Object.keys(source).forEach(function (key) {
183
- if (exports._.isObject(source[key])) {
184
- if (!target[key]) {
185
- Object.assign(target, _defineProperty({}, key, {}));
186
- }
187
- exports._.merge(target[key], source[key]);
188
- } else {
189
- Object.assign(target, _defineProperty({}, key, source[key]));
190
- }
191
- });
192
- }
193
- return target;
194
- }
195
- };
196
- // Duck-checks if an object looks like a promise
197
- function isPromise(result) {
198
- return exports._.isObject(result) && typeof result.then === 'function';
199
- }
200
- function createSymbol(name) {
201
- return typeof Symbol !== 'undefined' ? Symbol.for(name) : name;
202
- }
203
- __exportStar(__webpack_require__(/*! ./debug */ "../commons/lib/debug.js"), exports);
204
-
205
- /***/ }),
206
-
207
- /***/ "../feathers/lib/application.js":
208
- /*!**************************************!*\
209
- !*** ../feathers/lib/application.js ***!
210
- \**************************************/
211
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
212
-
213
-
214
-
215
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
216
- 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 e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
217
- function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
218
- function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
219
- function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, 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 o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
220
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
221
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
222
- function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
223
- function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
224
- function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
225
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
226
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
227
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
228
- function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
229
- function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
230
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
231
- function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
232
- function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
233
- function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
234
- var __importDefault = this && this.__importDefault || function (mod) {
235
- return mod && mod.__esModule ? mod : {
236
- "default": mod
237
- };
238
- };
239
- Object.defineProperty(exports, "__esModule", ({
240
- value: true
241
- }));
242
- exports.Feathers = void 0;
243
- var version_1 = __importDefault(__webpack_require__(/*! ./version */ "../feathers/lib/version.js"));
244
- var events_1 = __webpack_require__(/*! events */ "../../node_modules/events/events.js");
245
- var commons_1 = __webpack_require__(/*! @feathersjs/commons */ "../commons/lib/index.js");
246
- var hooks_1 = __webpack_require__(/*! @feathersjs/hooks */ "../../node_modules/@feathersjs/hooks/script/index.js");
247
- var events_2 = __webpack_require__(/*! ./events */ "../feathers/lib/events.js");
248
- var hooks_2 = __webpack_require__(/*! ./hooks */ "../feathers/lib/hooks.js");
249
- var service_1 = __webpack_require__(/*! ./service */ "../feathers/lib/service.js");
250
- var hooks_3 = __webpack_require__(/*! ./hooks */ "../feathers/lib/hooks.js");
251
- var debug = (0, commons_1.createDebug)('@feathersjs/feathers');
252
- var Feathers = /*#__PURE__*/function (_events_1$EventEmitte) {
253
- function Feathers() {
254
- var _this;
255
- _classCallCheck(this, Feathers);
256
- _this = _callSuper(this, Feathers);
257
- _this.services = {};
258
- _this.settings = {};
259
- _this.mixins = [hooks_2.hookMixin, events_2.eventMixin];
260
- _this.version = version_1.default;
261
- _this._isSetup = false;
262
- _this.registerHooks = (0, hooks_3.enableHooks)(_this);
263
- _this.registerHooks({
264
- around: [events_2.eventHook]
265
- });
266
- return _this;
267
- }
268
- _inherits(Feathers, _events_1$EventEmitte);
269
- return _createClass(Feathers, [{
270
- key: "get",
271
- value: function get(name) {
272
- return this.settings[name];
145
+ return otherMiddleware || middleware || [];
273
146
  }
274
147
  }, {
275
- key: "set",
276
- value: function set(name, value) {
277
- this.settings[name] = value;
148
+ key: "props",
149
+ value: function props(_props) {
150
+ if (!this._props) {
151
+ this._props = {};
152
+ }
153
+ (0, utils_js_1.copyProperties)(this._props, _props);
278
154
  return this;
279
155
  }
280
156
  }, {
281
- key: "configure",
282
- value: function configure(callback) {
283
- callback.call(this, this);
284
- return this;
157
+ key: "getProps",
158
+ value: function getProps() {
159
+ var _this$_parent2;
160
+ var previous = (_this$_parent2 = this._parent) === null || _this$_parent2 === void 0 ? void 0 : _this$_parent2.getProps();
161
+ if (previous && this._props) {
162
+ return (0, utils_js_1.copyProperties)({}, previous, this._props);
163
+ }
164
+ return previous || this._props || null;
285
165
  }
286
166
  }, {
287
- key: "defaultService",
288
- value: function defaultService(location) {
289
- throw new Error("Can not find service '".concat(location, "'"));
167
+ key: "params",
168
+ value: function params() {
169
+ for (var _len = arguments.length, _params = new Array(_len), _key = 0; _key < _len; _key++) {
170
+ _params[_key] = arguments[_key];
171
+ }
172
+ this._params = _params;
173
+ return this;
290
174
  }
291
175
  }, {
292
- key: "service",
293
- value: function service(location) {
294
- var path = (0, commons_1.stripSlashes)(location) || '/';
295
- var current = this.services.hasOwnProperty(path) ? this.services[path] : undefined;
296
- if (typeof current === 'undefined') {
297
- this.use(path, this.defaultService(path));
298
- return this.service(path);
176
+ key: "getParams",
177
+ value: function getParams() {
178
+ var _this$_parent3;
179
+ var previous = (_this$_parent3 = this._parent) === null || _this$_parent3 === void 0 ? void 0 : _this$_parent3.getParams();
180
+ if (previous && this._params) {
181
+ return previous.concat(this._params);
299
182
  }
300
- return current;
183
+ return previous || this._params;
301
184
  }
302
185
  }, {
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
- });
186
+ key: "defaults",
187
+ value: function defaults(_defaults) {
188
+ this._defaults = _defaults;
189
+ return this;
318
190
  }
319
191
  }, {
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
- }));
192
+ key: "getDefaults",
193
+ value: function getDefaults(self, args, context) {
194
+ var _this$_parent4;
195
+ var defaults = typeof this._defaults === 'function' ? this._defaults(self, args, context) : null;
196
+ var previous = (_this$_parent4 = this._parent) === null || _this$_parent4 === void 0 ? void 0 : _this$_parent4.getDefaults(self, args, context);
197
+ if (previous && defaults) {
198
+ return Object.assign({}, previous, defaults);
199
+ }
200
+ return previous || defaults;
328
201
  }
329
202
  }, {
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);
203
+ key: "getContextClass",
204
+ value: function getContextClass() {
205
+ var Base = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : BaseHookContext;
206
+ var ContextClass = /*#__PURE__*/function (_Base) {
207
+ function ContextClass(data) {
208
+ _classCallCheck(this, ContextClass);
209
+ return _callSuper(this, ContextClass, [data]);
210
+ }
211
+ _inherits(ContextClass, _Base);
212
+ return _createClass(ContextClass);
213
+ }(Base);
214
+ var params = this.getParams();
215
+ var props = this.getProps();
216
+ if (params) {
217
+ params.forEach(function (name, index) {
218
+ if ((props === null || props === void 0 ? void 0 : props[name]) !== undefined) {
219
+ throw new Error("Hooks can not have a property and param named '".concat(name, "'. Use .defaults instead."));
340
220
  }
221
+ Object.defineProperty(ContextClass.prototype, name, {
222
+ enumerable: true,
223
+ get: function get() {
224
+ return this === null || this === void 0 ? void 0 : this.arguments[index];
225
+ },
226
+ set: function set(value) {
227
+ this.arguments[index] = value;
228
+ }
229
+ });
341
230
  });
342
- }, Promise.resolve()).then(function () {
343
- return _this3;
344
- });
345
- }
346
- }, {
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
- }));
231
+ }
232
+ if (props) {
233
+ (0, utils_js_1.copyProperties)(ContextClass.prototype, props);
234
+ }
235
+ return ContextClass;
355
236
  }
356
237
  }, {
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."));
362
- }
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;
238
+ key: "initializeContext",
239
+ value: function initializeContext(self, args, context) {
240
+ var ctx = this._parent ? this._parent.initializeContext(self, args, context) : context;
241
+ var defaults = this.getDefaults(self, args, ctx);
242
+ if (self) {
243
+ ctx.self = self;
371
244
  }
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"));
245
+ ctx.arguments = args;
246
+ if (defaults) {
247
+ for (var _i = 0, _Object$keys = Object.keys(defaults); _i < _Object$keys.length; _i++) {
248
+ var name = _Object$keys[_i];
249
+ if (ctx[name] === undefined) {
250
+ ctx[name] = defaults[name];
381
251
  }
382
252
  }
383
- } catch (err) {
384
- _iterator.e(err);
385
- } finally {
386
- _iterator.f();
387
- }
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) switch (_context.prev = _context.next) {
408
- case 0:
409
- path = (0, commons_1.stripSlashes)(location) || '/';
410
- service = this.services[path];
411
- if (!(service && typeof service.teardown === 'function')) {
412
- _context.next = 5;
413
- break;
414
- }
415
- _context.next = 5;
416
- return service.teardown(this, path);
417
- case 5:
418
- delete this.services[path];
419
- return _context.abrupt("return", service);
420
- case 7:
421
- case "end":
422
- return _context.stop();
423
- }
424
- }, _callee, this);
425
- }));
426
- function unuse(_x) {
427
- return _unuse.apply(this, arguments);
428
253
  }
429
- return unuse;
430
- }()
431
- }, {
432
- key: "hooks",
433
- value: function hooks(hookMap) {
434
- var untypedMap = hookMap;
435
- if (untypedMap.before || untypedMap.after || untypedMap.error || untypedMap.around) {
436
- // regular hooks for all service methods
437
- this.registerHooks(untypedMap);
438
- } else if (untypedMap.setup || untypedMap.teardown) {
439
- // .setup and .teardown application hooks
440
- (0, hooks_1.hooks)(this, untypedMap);
441
- } else {
442
- // Other registration formats are just `around` hooks
443
- this.registerHooks({
444
- around: untypedMap
445
- });
446
- }
447
- return this;
254
+ return ctx;
448
255
  }
449
256
  }]);
450
- }(events_1.EventEmitter);
451
- exports.Feathers = Feathers;
257
+ }();
258
+ exports.HookManager = HookManager;
259
+ function convertOptions() {
260
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
261
+ if (!options) {
262
+ return new HookManager();
263
+ }
264
+ return Array.isArray(options) ? new HookManager().middleware(options) : options;
265
+ }
266
+ exports.convertOptions = convertOptions;
267
+ function getManager(target) {
268
+ return target && target[exports.HOOKS] || null;
269
+ }
270
+ exports.getManager = getManager;
271
+ function setManager(target, manager) {
272
+ var parent = getManager(target);
273
+ target[exports.HOOKS] = manager.parent(parent);
274
+ return target;
275
+ }
276
+ exports.setManager = setManager;
277
+ function getMiddleware(target) {
278
+ var manager = getManager(target);
279
+ return manager ? manager.getMiddleware() : null;
280
+ }
281
+ exports.getMiddleware = getMiddleware;
282
+ function setMiddleware(target, middleware) {
283
+ var manager = new HookManager().middleware(middleware);
284
+ return setManager(target, manager);
285
+ }
286
+ exports.setMiddleware = setMiddleware;
452
287
 
453
288
  /***/ }),
454
289
 
455
- /***/ "../feathers/lib/declarations.js":
456
- /*!***************************************!*\
457
- !*** ../feathers/lib/declarations.js ***!
458
- \***************************************/
290
+ /***/ "../../node_modules/@feathersjs/hooks/script/compose.js":
291
+ /*!**************************************************************!*\
292
+ !*** ../../node_modules/@feathersjs/hooks/script/compose.js ***!
293
+ \**************************************************************/
459
294
  /***/ (function(__unused_webpack_module, exports) {
460
295
 
461
296
 
462
297
 
298
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, 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 o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
299
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
300
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
463
301
  Object.defineProperty(exports, "__esModule", ({
464
302
  value: true
465
303
  }));
466
-
467
- /***/ }),
468
-
469
- /***/ "../feathers/lib/events.js":
470
- /*!*********************************!*\
471
- !*** ../feathers/lib/events.js ***!
472
- \*********************************/
473
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
474
-
475
-
476
-
477
- Object.defineProperty(exports, "__esModule", ({
478
- value: true
479
- }));
480
- exports.eventHook = eventHook;
481
- exports.eventMixin = eventMixin;
482
- var events_1 = __webpack_require__(/*! events */ "../../node_modules/events/events.js");
483
- var service_1 = __webpack_require__(/*! ./service */ "../feathers/lib/service.js");
484
- function eventHook(context, next) {
485
- var _ref = (0, service_1.getServiceOptions)(context.self),
486
- events = _ref.events;
487
- var defaultEvent = service_1.defaultEventMap[context.method] || null;
488
- context.event = defaultEvent;
489
- return next().then(function () {
490
- // Send the event only if the service does not do so already (indicated in the `events` option)
491
- // This is used for custom events and for client services receiving event from the server
492
- if (typeof context.event === 'string' && !events.includes(context.event)) {
493
- var results = Array.isArray(context.result) ? context.result : [context.result];
494
- results.forEach(function (element) {
495
- return context.self.emit(context.event, element, context);
496
- });
304
+ exports.compose = void 0;
305
+ function compose(middleware) {
306
+ if (!Array.isArray(middleware)) {
307
+ throw new TypeError('Middleware stack must be an array!');
308
+ }
309
+ var _iterator = _createForOfIteratorHelper(middleware),
310
+ _step;
311
+ try {
312
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
313
+ var fn = _step.value;
314
+ if (typeof fn !== 'function') {
315
+ throw new TypeError('Middleware must be composed of functions!');
316
+ }
497
317
  }
498
- });
499
- }
500
- function eventMixin(service) {
501
- var isEmitter = typeof service.on === 'function' && typeof service.emit === 'function';
502
- if (!isEmitter) {
503
- Object.assign(service, events_1.EventEmitter.prototype);
318
+ } catch (err) {
319
+ _iterator.e(err);
320
+ } finally {
321
+ _iterator.f();
504
322
  }
505
- return service;
323
+ return function (context, next) {
324
+ // last called middleware #
325
+ var index = -1;
326
+ return dispatch.call(this, 0);
327
+ function dispatch(i) {
328
+ if (i <= index) {
329
+ return Promise.reject(new Error('next() called multiple times'));
330
+ }
331
+ index = i;
332
+ var fn = middleware[i];
333
+ if (i === middleware.length) {
334
+ fn = next;
335
+ }
336
+ if (!fn) {
337
+ return Promise.resolve();
338
+ }
339
+ try {
340
+ return Promise.resolve(fn.call(this, context, dispatch.bind(this, i + 1)));
341
+ } catch (err) {
342
+ return Promise.reject(err);
343
+ }
344
+ }
345
+ };
506
346
  }
347
+ exports.compose = compose;
507
348
 
508
349
  /***/ }),
509
350
 
510
- /***/ "../feathers/lib/hooks.js":
511
- /*!********************************!*\
512
- !*** ../feathers/lib/hooks.js ***!
513
- \********************************/
351
+ /***/ "../../node_modules/@feathersjs/hooks/script/hooks.js":
352
+ /*!************************************************************!*\
353
+ !*** ../../node_modules/@feathersjs/hooks/script/hooks.js ***!
354
+ \************************************************************/
514
355
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
515
356
 
516
357
 
517
358
 
518
- function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
519
- function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
520
- function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
521
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
522
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
523
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
524
- function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
525
- function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
526
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
527
- function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
528
- function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); }
529
- function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; }
530
- function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
531
- function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
532
- function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
533
- function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
534
- 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."); }
535
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
536
- function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
537
- function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
538
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
539
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
540
359
  Object.defineProperty(exports, "__esModule", ({
541
360
  value: true
542
361
  }));
543
- exports.FeathersHookManager = void 0;
544
- exports.convertHookData = convertHookData;
545
- exports.collectHooks = collectHooks;
546
- exports.enableHooks = enableHooks;
547
- exports.createContext = createContext;
548
- exports.hookMixin = hookMixin;
549
- var hooks_1 = __webpack_require__(/*! @feathersjs/hooks */ "../../node_modules/@feathersjs/hooks/script/index.js");
550
- var service_1 = __webpack_require__(/*! ./service */ "../feathers/lib/service.js");
551
- var types = ['before', 'after', 'error', 'around'];
552
- var isType = function isType(value) {
553
- return types.includes(value);
554
- };
555
- // Converts different hook registration formats into the
556
- // same internal format
557
- function convertHookData(input) {
558
- var result = {};
559
- if (Array.isArray(input)) {
560
- result.all = input;
561
- } else if (_typeof(input) !== 'object') {
562
- result.all = [input];
563
- } else {
564
- for (var _i = 0, _Object$keys = Object.keys(input); _i < _Object$keys.length; _i++) {
565
- var key = _Object$keys[_i];
566
- var value = input[key];
567
- result[key] = Array.isArray(value) ? value : [value];
568
- }
569
- }
570
- return result;
571
- }
572
- function collectHooks(target, method) {
573
- var _target$__hooks = target.__hooks,
574
- collected = _target$__hooks.collected,
575
- collectedAll = _target$__hooks.collectedAll,
576
- around = _target$__hooks.around;
577
- return [].concat(_toConsumableArray(around.all || []), _toConsumableArray(around[method] || []), _toConsumableArray(collectedAll.before || []), _toConsumableArray(collected[method] || []), _toConsumableArray(collectedAll.after || []));
578
- }
579
- // Add `.hooks` functionality to an object
580
- function enableHooks(object) {
581
- var store = {
582
- around: {},
583
- before: {},
584
- after: {},
585
- error: {},
586
- collected: {},
587
- collectedAll: {}
588
- };
589
- Object.defineProperty(object, '__hooks', {
590
- configurable: true,
591
- value: store,
592
- writable: true
593
- });
594
- return function registerHooks(input) {
595
- var store = this.__hooks;
596
- var map = Object.keys(input).reduce(function (map, type) {
597
- if (!isType(type)) {
598
- throw new Error("'".concat(type, "' is not a valid hook type"));
599
- }
600
- map[type] = convertHookData(input[type]);
601
- return map;
602
- }, {});
603
- var types = Object.keys(map);
604
- types.forEach(function (type) {
605
- return Object.keys(map[type]).forEach(function (method) {
606
- var _a;
607
- var mapHooks = map[type][method];
608
- var storeHooks = (_a = store[type])[method] || (_a[method] = []);
609
- storeHooks.push.apply(storeHooks, _toConsumableArray(mapHooks));
610
- if (method === 'all') {
611
- if (store.before[method] || store.error[method]) {
612
- var beforeAll = (0, hooks_1.collect)({
613
- before: store.before[method] || [],
614
- error: store.error[method] || []
615
- });
616
- store.collectedAll.before = [beforeAll];
617
- }
618
- if (store.after[method]) {
619
- var afterAll = (0, hooks_1.collect)({
620
- after: store.after[method] || []
621
- });
622
- store.collectedAll.after = [afterAll];
623
- }
624
- } else {
625
- if (store.before[method] || store.after[method] || store.error[method]) {
626
- var collected = (0, hooks_1.collect)({
627
- before: store.before[method] || [],
628
- after: store.after[method] || [],
629
- error: store.error[method] || []
630
- });
631
- store.collected[method] = [collected];
632
- }
633
- }
634
- });
635
- });
636
- return this;
637
- };
638
- }
639
- function createContext(service, method) {
640
- var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
641
- var createContext = service[method].createContext;
642
- if (typeof createContext !== 'function') {
643
- throw new Error("Can not create context for method ".concat(method));
644
- }
645
- return createContext(data);
362
+ exports.legacyDecorator = exports.hookDecorator = exports.objectHooks = exports.functionHooks = exports.getOriginal = void 0;
363
+ var compose_js_1 = __webpack_require__(/*! ./compose.js */ "../../node_modules/@feathersjs/hooks/script/compose.js");
364
+ var base_js_1 = __webpack_require__(/*! ./base.js */ "../../node_modules/@feathersjs/hooks/script/base.js");
365
+ var utils_js_1 = __webpack_require__(/*! ./utils.js */ "../../node_modules/@feathersjs/hooks/script/utils.js");
366
+ function getOriginal(fn) {
367
+ return typeof fn.original === 'function' ? getOriginal(fn.original) : fn;
646
368
  }
647
- var FeathersHookManager = /*#__PURE__*/function (_hooks_1$HookManager) {
648
- function FeathersHookManager(app, method) {
649
- var _this;
650
- _classCallCheck(this, FeathersHookManager);
651
- _this = _callSuper(this, FeathersHookManager);
652
- _this.app = app;
653
- _this.method = method;
654
- _this._middleware = [];
655
- return _this;
656
- }
657
- _inherits(FeathersHookManager, _hooks_1$HookManager);
658
- return _createClass(FeathersHookManager, [{
659
- key: "collectMiddleware",
660
- value: function collectMiddleware(self, args) {
661
- var appHooks = collectHooks(this.app, this.method);
662
- var middleware = _superPropGet(FeathersHookManager, "collectMiddleware", this, 3)([self, args]);
663
- var methodHooks = collectHooks(self, this.method);
664
- return [].concat(_toConsumableArray(appHooks), _toConsumableArray(middleware), _toConsumableArray(methodHooks));
665
- }
666
- }, {
667
- key: "initializeContext",
668
- value: function initializeContext(self, args, context) {
669
- var ctx = _superPropGet(FeathersHookManager, "initializeContext", this, 3)([self, args, context]);
670
- ctx.params = ctx.params || {};
671
- return ctx;
672
- }
673
- }, {
674
- key: "middleware",
675
- value: function middleware(mw) {
676
- var _this$_middleware;
677
- (_this$_middleware = this._middleware).push.apply(_this$_middleware, _toConsumableArray(mw));
678
- return this;
679
- }
680
- }]);
681
- }(hooks_1.HookManager);
682
- exports.FeathersHookManager = FeathersHookManager;
683
- function hookMixin(service, path, options) {
684
- var _this2 = this;
685
- if (typeof service.hooks === 'function') {
686
- return service;
369
+ exports.getOriginal = getOriginal;
370
+ function functionHooks(fn, managerOrMiddleware) {
371
+ if (typeof fn !== 'function') {
372
+ throw new Error('Can not apply hooks to non-function');
687
373
  }
688
- var hookMethods = (0, service_1.getHookMethods)(service, options);
689
- var serviceMethodHooks = hookMethods.reduce(function (res, method) {
690
- var _FeathersHookManager;
691
- var params = service_1.defaultServiceArguments[method] || ['data', 'params'];
692
- res[method] = (_FeathersHookManager = new FeathersHookManager(_this2, method)).params.apply(_FeathersHookManager, _toConsumableArray(params)).props({
693
- app: _this2,
694
- path: path,
695
- method: method,
696
- service: service,
697
- event: null,
698
- type: 'around',
699
- get statusCode() {
700
- var _a;
701
- return (_a = this.http) === null || _a === void 0 ? void 0 : _a.status;
702
- },
703
- set statusCode(value) {
704
- this.http = this.http || {};
705
- this.http.status = value;
706
- }
707
- });
708
- return res;
709
- }, {});
710
- var registerHooks = enableHooks(service);
711
- (0, hooks_1.hooks)(service, serviceMethodHooks);
712
- service.hooks = function (hookOptions) {
713
- var _this3 = this;
714
- if (hookOptions.before || hookOptions.after || hookOptions.error || hookOptions.around) {
715
- return registerHooks.call(this, hookOptions);
374
+ var manager = (0, base_js_1.convertOptions)(managerOrMiddleware);
375
+ var _wrapper = function wrapper() {
376
+ var _this = this;
377
+ var Context = _wrapper.Context,
378
+ original = _wrapper.original;
379
+ // If we got passed an existing HookContext instance, we want to return it as well
380
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
381
+ args[_key] = arguments[_key];
716
382
  }
717
- if (Array.isArray(hookOptions)) {
718
- return (0, hooks_1.hooks)(this, hookOptions);
383
+ var returnContext = args[args.length - 1] instanceof Context;
384
+ // Use existing context or default
385
+ var base = returnContext ? args.pop() : new Context();
386
+ // Initialize the context
387
+ var context = manager.initializeContext(this, args, base);
388
+ // Assemble the hook chain
389
+ var hookChain = [
390
+ // Return `ctx.result` or the context
391
+ function (ctx, next) {
392
+ return next().then(function () {
393
+ return returnContext ? ctx : ctx.result;
394
+ });
395
+ }];
396
+ // Create the hook chain by calling the `collectMiddleware function
397
+ var mw = manager.collectMiddleware(this, args);
398
+ if (mw) {
399
+ Array.prototype.push.apply(hookChain, mw);
719
400
  }
720
- Object.keys(hookOptions).forEach(function (method) {
721
- var manager = (0, hooks_1.getManager)(_this3[method]);
722
- if (!(manager instanceof FeathersHookManager)) {
723
- throw new Error("Method ".concat(method, " is not a Feathers hooks enabled service method"));
401
+ // Runs the actual original method if `ctx.result` is not already set
402
+ hookChain.push(function (ctx, next) {
403
+ if (!Object.prototype.hasOwnProperty.call(context, 'result')) {
404
+ return Promise.resolve(original.apply(_this, ctx.arguments)).then(function (result) {
405
+ ctx.result = result;
406
+ return next();
407
+ });
724
408
  }
725
- manager.middleware(hookOptions[method]);
409
+ return next();
726
410
  });
727
- return this;
411
+ return (0, compose_js_1.compose)(hookChain).call(this, context);
728
412
  };
729
- return service;
413
+ (0, utils_js_1.copyFnProperties)(_wrapper, fn);
414
+ (0, utils_js_1.copyProperties)(_wrapper, fn);
415
+ (0, base_js_1.setManager)(_wrapper, manager);
416
+ return Object.assign(_wrapper, {
417
+ original: getOriginal(fn),
418
+ Context: manager.getContextClass(),
419
+ createContext: function createContext() {
420
+ var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
421
+ return new _wrapper.Context(data);
422
+ }
423
+ });
424
+ }
425
+ exports.functionHooks = functionHooks;
426
+ function objectHooks(obj, hooks) {
427
+ if (Array.isArray(hooks)) {
428
+ return (0, base_js_1.setMiddleware)(obj, hooks);
429
+ }
430
+ for (var _i = 0, _Object$keys = Object.keys(hooks); _i < _Object$keys.length; _i++) {
431
+ var method = _Object$keys[_i];
432
+ var target = typeof obj[method] === 'function' ? obj : obj.prototype;
433
+ var fn = target && target[method];
434
+ if (typeof fn !== 'function') {
435
+ throw new Error("Can not apply hooks. '".concat(method, "' is not a function"));
436
+ }
437
+ var manager = (0, base_js_1.convertOptions)(hooks[method]);
438
+ target[method] = functionHooks(fn, manager.props({
439
+ method: method
440
+ }));
441
+ }
442
+ return obj;
730
443
  }
444
+ exports.objectHooks = objectHooks;
445
+ var hookDecorator = function hookDecorator(managerOrMiddleware) {
446
+ return function (target, context) {
447
+ var manager = (0, base_js_1.convertOptions)(managerOrMiddleware);
448
+ if (context.kind === 'class') {
449
+ (0, base_js_1.setManager)(target.prototype, manager);
450
+ return target;
451
+ } else if (context.kind === 'method') {
452
+ var method = String(context.name);
453
+ return functionHooks(target, manager.props({
454
+ method: method
455
+ }));
456
+ }
457
+ throw new Error('Can not apply hooks.');
458
+ };
459
+ };
460
+ exports.hookDecorator = hookDecorator;
461
+ var legacyDecorator = function legacyDecorator(managerOrMiddleware) {
462
+ var wrapper = function wrapper(_target, method, descriptor) {
463
+ var manager = (0, base_js_1.convertOptions)(managerOrMiddleware);
464
+ if (!descriptor) {
465
+ (0, base_js_1.setManager)(_target.prototype, manager);
466
+ return _target;
467
+ }
468
+ var fn = descriptor.value;
469
+ if (typeof fn !== 'function') {
470
+ throw new Error("Can not apply hooks. '".concat(method, "' is not a function"));
471
+ }
472
+ descriptor.value = functionHooks(fn, manager.props({
473
+ method: method
474
+ }));
475
+ return descriptor;
476
+ };
477
+ return wrapper;
478
+ };
479
+ exports.legacyDecorator = legacyDecorator;
731
480
 
732
481
  /***/ }),
733
482
 
734
- /***/ "../feathers/lib/index.js":
735
- /*!********************************!*\
736
- !*** ../feathers/lib/index.js ***!
737
- \********************************/
738
- /***/ (function(module, exports, __webpack_require__) {
483
+ /***/ "../../node_modules/@feathersjs/hooks/script/index.js":
484
+ /*!************************************************************!*\
485
+ !*** ../../node_modules/@feathersjs/hooks/script/index.js ***!
486
+ \************************************************************/
487
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
739
488
 
740
489
 
741
490
 
491
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
492
+ 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."); }
493
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
494
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
495
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
496
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
742
497
  var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
743
498
  if (k2 === undefined) k2 = k;
744
499
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -758,43 +513,60 @@ var __createBinding = this && this.__createBinding || (Object.create ? function
758
513
  var __exportStar = this && this.__exportStar || function (m, exports) {
759
514
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
760
515
  };
761
- var __importDefault = this && this.__importDefault || function (mod) {
762
- return mod && mod.__esModule ? mod : {
763
- "default": mod
764
- };
765
- };
766
516
  Object.defineProperty(exports, "__esModule", ({
767
517
  value: true
768
518
  }));
769
- exports.Feathers = exports.version = void 0;
770
- exports.feathers = feathers;
771
- var commons_1 = __webpack_require__(/*! @feathersjs/commons */ "../commons/lib/index.js");
772
- var version_1 = __importDefault(__webpack_require__(/*! ./version */ "../feathers/lib/version.js"));
773
- exports.version = version_1.default;
774
- var application_1 = __webpack_require__(/*! ./application */ "../feathers/lib/application.js");
775
- Object.defineProperty(exports, "Feathers", ({
776
- enumerable: true,
777
- get: function get() {
778
- return application_1.Feathers;
519
+ exports.hooks = exports.middleware = void 0;
520
+ var base_js_1 = __webpack_require__(/*! ./base.js */ "../../node_modules/@feathersjs/hooks/script/base.js");
521
+ var hooks_js_1 = __webpack_require__(/*! ./hooks.js */ "../../node_modules/@feathersjs/hooks/script/hooks.js");
522
+ __exportStar(__webpack_require__(/*! ./hooks.js */ "../../node_modules/@feathersjs/hooks/script/hooks.js"), exports);
523
+ __exportStar(__webpack_require__(/*! ./compose.js */ "../../node_modules/@feathersjs/hooks/script/compose.js"), exports);
524
+ __exportStar(__webpack_require__(/*! ./base.js */ "../../node_modules/@feathersjs/hooks/script/base.js"), exports);
525
+ __exportStar(__webpack_require__(/*! ./regular.js */ "../../node_modules/@feathersjs/hooks/script/regular.js"), exports);
526
+ /**
527
+ * Initializes a hook settings object with the given middleware.
528
+ * @param mw The list of middleware
529
+ * @param options Middleware options (params, default, props)
530
+ */
531
+ function middleware(mw, options) {
532
+ var manager = new base_js_1.HookManager().middleware(mw);
533
+ if (options) {
534
+ if (options.params) {
535
+ manager.params.apply(manager, _toConsumableArray(options.params));
536
+ }
537
+ if (options.defaults) {
538
+ manager.defaults(options.defaults);
539
+ }
540
+ if (options.props) {
541
+ manager.props(options.props);
542
+ }
779
543
  }
780
- }));
781
- function feathers() {
782
- return new application_1.Feathers();
544
+ return manager;
783
545
  }
784
- feathers.setDebug = commons_1.setDebug;
785
- __exportStar(__webpack_require__(/*! ./hooks */ "../feathers/lib/hooks.js"), exports);
786
- __exportStar(__webpack_require__(/*! ./declarations */ "../feathers/lib/declarations.js"), exports);
787
- __exportStar(__webpack_require__(/*! ./service */ "../feathers/lib/service.js"), exports);
788
- if (true) {
789
- module.exports = Object.assign(feathers, module.exports);
546
+ exports.middleware = middleware;
547
+ // Fallthrough to actual implementation
548
+ function hooks() {
549
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
550
+ args[_key] = arguments[_key];
551
+ }
552
+ var target = args[0],
553
+ _hooks = args[1];
554
+ if (typeof target === 'function' && (_hooks instanceof base_js_1.HookManager || Array.isArray(_hooks) || args.length === 1)) {
555
+ return (0, hooks_js_1.functionHooks)(target, _hooks);
556
+ }
557
+ if (args.length === 2) {
558
+ return (0, hooks_js_1.objectHooks)(target, _hooks);
559
+ }
560
+ return (0, hooks_js_1.hookDecorator)(target);
790
561
  }
562
+ exports.hooks = hooks;
791
563
 
792
564
  /***/ }),
793
565
 
794
- /***/ "../feathers/lib/service.js":
795
- /*!**********************************!*\
796
- !*** ../feathers/lib/service.js ***!
797
- \**********************************/
566
+ /***/ "../../node_modules/@feathersjs/hooks/script/regular.js":
567
+ /*!**************************************************************!*\
568
+ !*** ../../node_modules/@feathersjs/hooks/script/regular.js ***!
569
+ \**************************************************************/
798
570
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
799
571
 
800
572
 
@@ -814,87 +586,136 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
814
586
  Object.defineProperty(exports, "__esModule", ({
815
587
  value: true
816
588
  }));
817
- exports.normalizeServiceOptions = exports.protectedMethods = exports.defaultServiceEvents = exports.defaultEventMap = exports.defaultServiceMethods = exports.defaultServiceArguments = exports.SERVICE = void 0;
818
- exports.getHookMethods = getHookMethods;
819
- exports.getServiceOptions = getServiceOptions;
820
- exports.wrapService = wrapService;
821
- var events_1 = __webpack_require__(/*! events */ "../../node_modules/events/events.js");
822
- var commons_1 = __webpack_require__(/*! @feathersjs/commons */ "../commons/lib/index.js");
823
- exports.SERVICE = (0, commons_1.createSymbol)('@feathersjs/service');
824
- exports.defaultServiceArguments = {
825
- find: ['params'],
826
- get: ['id', 'params'],
827
- create: ['data', 'params'],
828
- update: ['id', 'data', 'params'],
829
- patch: ['id', 'data', 'params'],
830
- remove: ['id', 'params']
589
+ exports.collect = exports.fromErrorHook = exports.fromAfterHook = exports.fromBeforeHook = exports.runHooks = exports.runHook = void 0;
590
+ var compose_js_1 = __webpack_require__(/*! ./compose.js */ "../../node_modules/@feathersjs/hooks/script/compose.js");
591
+ var runHook = function runHook(hook, context, type) {
592
+ var typeBefore = context.type;
593
+ if (type) context.type = type;
594
+ return Promise.resolve(hook.call(context.self, context)).then(function (res) {
595
+ if (type) context.type = typeBefore;
596
+ if (res && res !== context) {
597
+ Object.assign(context, res);
598
+ }
599
+ });
831
600
  };
832
- exports.defaultServiceMethods = ['find', 'get', 'create', 'update', 'patch', 'remove'];
833
- exports.defaultEventMap = {
834
- create: 'created',
835
- update: 'updated',
836
- patch: 'patched',
837
- remove: 'removed'
601
+ exports.runHook = runHook;
602
+ var runHooks = function runHooks(hooks) {
603
+ return function (context) {
604
+ return hooks.reduce(function (promise, hook) {
605
+ return promise.then(function () {
606
+ return (0, exports.runHook)(hook, context);
607
+ });
608
+ }, Promise.resolve(context));
609
+ };
838
610
  };
839
- exports.defaultServiceEvents = Object.values(exports.defaultEventMap);
840
- exports.protectedMethods = Object.keys(Object.prototype).concat(Object.keys(events_1.EventEmitter.prototype)).concat(['all', 'around', 'before', 'after', 'error', 'hooks', 'setup', 'teardown', 'publish']);
841
- function getHookMethods(service, options) {
842
- var methods = options.methods;
843
- return exports.defaultServiceMethods.filter(function (m) {
844
- return typeof service[m] === 'function' && !methods.includes(m);
845
- }).concat(methods);
846
- }
847
- function getServiceOptions(service) {
848
- return service[exports.SERVICE];
611
+ exports.runHooks = runHooks;
612
+ function fromBeforeHook(hook) {
613
+ return function (context, next) {
614
+ return (0, exports.runHook)(hook, context, 'before').then(next);
615
+ };
849
616
  }
850
- var normalizeServiceOptions = function normalizeServiceOptions(service) {
851
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
852
- var _options$methods = options.methods,
853
- methods = _options$methods === void 0 ? exports.defaultServiceMethods.filter(function (method) {
854
- return typeof service[method] === 'function';
855
- }) : _options$methods,
856
- _options$events = options.events,
857
- events = _options$events === void 0 ? service.events || [] : _options$events;
858
- var serviceEvents = options.serviceEvents || exports.defaultServiceEvents.concat(events);
859
- return _objectSpread(_objectSpread({}, options), {}, {
860
- events: events,
861
- methods: methods,
862
- serviceEvents: serviceEvents
863
- });
864
- };
865
- exports.normalizeServiceOptions = normalizeServiceOptions;
866
- function wrapService(location, service, options) {
867
- // Do nothing if this is already an initialized
868
- if (service[exports.SERVICE]) {
869
- return service;
870
- }
871
- var protoService = Object.create(service);
872
- var serviceOptions = (0, exports.normalizeServiceOptions)(service, options);
873
- if (Object.keys(serviceOptions.methods).length === 0 && ![].concat(_toConsumableArray(exports.defaultServiceMethods), ['setup', 'teardown']).some(function (method) {
874
- return typeof service[method] === 'function';
875
- })) {
876
- throw new Error("Invalid service object passed for path `".concat(location, "`"));
877
- }
878
- Object.defineProperty(protoService, exports.SERVICE, {
879
- value: serviceOptions
880
- });
881
- return protoService;
617
+ exports.fromBeforeHook = fromBeforeHook;
618
+ function fromAfterHook(hook) {
619
+ return function (context, next) {
620
+ return next().then(function () {
621
+ return (0, exports.runHook)(hook, context, 'after');
622
+ });
623
+ };
624
+ }
625
+ exports.fromAfterHook = fromAfterHook;
626
+ function fromErrorHook(hook) {
627
+ return function (context, next) {
628
+ return next().catch(function (error) {
629
+ if (context.error !== error || context.result !== undefined) {
630
+ context.original = _objectSpread({}, context);
631
+ context.error = error;
632
+ delete context.result;
633
+ }
634
+ return (0, exports.runHook)(hook, context, 'error').then(function () {
635
+ if (context.result === undefined && context.error !== undefined) {
636
+ throw context.error;
637
+ }
638
+ }).catch(function (error) {
639
+ context.error = error;
640
+ throw context.error;
641
+ });
642
+ });
643
+ };
644
+ }
645
+ exports.fromErrorHook = fromErrorHook;
646
+ function collect(_ref) {
647
+ var _ref$before = _ref.before,
648
+ before = _ref$before === void 0 ? [] : _ref$before,
649
+ _ref$after = _ref.after,
650
+ after = _ref$after === void 0 ? [] : _ref$after,
651
+ _ref$error = _ref.error,
652
+ error = _ref$error === void 0 ? [] : _ref$error;
653
+ var beforeHooks = before.map(fromBeforeHook);
654
+ var afterHooks = _toConsumableArray(after).reverse().map(fromAfterHook);
655
+ var errorHooks = error.length ? [fromErrorHook((0, exports.runHooks)(error))] : [];
656
+ return (0, compose_js_1.compose)([].concat(errorHooks, _toConsumableArray(beforeHooks), _toConsumableArray(afterHooks)));
882
657
  }
658
+ exports.collect = collect;
883
659
 
884
660
  /***/ }),
885
661
 
886
- /***/ "../feathers/lib/version.js":
887
- /*!**********************************!*\
888
- !*** ../feathers/lib/version.js ***!
889
- \**********************************/
662
+ /***/ "../../node_modules/@feathersjs/hooks/script/utils.js":
663
+ /*!************************************************************!*\
664
+ !*** ../../node_modules/@feathersjs/hooks/script/utils.js ***!
665
+ \************************************************************/
890
666
  /***/ (function(__unused_webpack_module, exports) {
891
667
 
892
668
 
893
669
 
670
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, 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 o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
671
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
672
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
894
673
  Object.defineProperty(exports, "__esModule", ({
895
674
  value: true
896
675
  }));
897
- exports["default"] = 'development';
676
+ exports.copyFnProperties = exports.copyProperties = void 0;
677
+ function copyProperties(target) {
678
+ for (var _len = arguments.length, originals = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
679
+ originals[_key - 1] = arguments[_key];
680
+ }
681
+ for (var _i = 0, _originals = originals; _i < _originals.length; _i++) {
682
+ var original = _originals[_i];
683
+ var originalProps = Object.keys(original).concat(Object.getOwnPropertySymbols(original));
684
+ var _iterator = _createForOfIteratorHelper(originalProps),
685
+ _step;
686
+ try {
687
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
688
+ var prop = _step.value;
689
+ var propDescriptor = Object.getOwnPropertyDescriptor(original, prop);
690
+ if (propDescriptor && !Object.prototype.hasOwnProperty.call(target, prop)) {
691
+ Object.defineProperty(target, prop, propDescriptor);
692
+ }
693
+ }
694
+ } catch (err) {
695
+ _iterator.e(err);
696
+ } finally {
697
+ _iterator.f();
698
+ }
699
+ }
700
+ return target;
701
+ }
702
+ exports.copyProperties = copyProperties;
703
+ function copyFnProperties(target, original) {
704
+ var internalProps = ['name', 'length'];
705
+ try {
706
+ for (var _i2 = 0, _internalProps = internalProps; _i2 < _internalProps.length; _i2++) {
707
+ var prop = _internalProps[_i2];
708
+ var value = original[prop];
709
+ Object.defineProperty(target, prop, {
710
+ value: value
711
+ });
712
+ }
713
+ } catch (_e) {
714
+ // Avoid IE error
715
+ }
716
+ return target;
717
+ }
718
+ exports.copyFnProperties = copyFnProperties;
898
719
 
899
720
  /***/ }),
900
721
 
@@ -1358,562 +1179,780 @@ function once(emitter, name) {
1358
1179
  emitter.removeListener(name, resolver);
1359
1180
  reject(err);
1360
1181
  }
1361
-
1362
- function resolver() {
1363
- if (typeof emitter.removeListener === 'function') {
1364
- emitter.removeListener('error', errorListener);
1365
- }
1366
- resolve([].slice.call(arguments));
1367
- };
1368
-
1369
- eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });
1370
- if (name !== 'error') {
1371
- addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });
1182
+
1183
+ function resolver() {
1184
+ if (typeof emitter.removeListener === 'function') {
1185
+ emitter.removeListener('error', errorListener);
1186
+ }
1187
+ resolve([].slice.call(arguments));
1188
+ };
1189
+
1190
+ eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });
1191
+ if (name !== 'error') {
1192
+ addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });
1193
+ }
1194
+ });
1195
+ }
1196
+
1197
+ function addErrorHandlerIfEventEmitter(emitter, handler, flags) {
1198
+ if (typeof emitter.on === 'function') {
1199
+ eventTargetAgnosticAddListener(emitter, 'error', handler, flags);
1200
+ }
1201
+ }
1202
+
1203
+ function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
1204
+ if (typeof emitter.on === 'function') {
1205
+ if (flags.once) {
1206
+ emitter.once(name, listener);
1207
+ } else {
1208
+ emitter.on(name, listener);
1209
+ }
1210
+ } else if (typeof emitter.addEventListener === 'function') {
1211
+ // EventTarget does not have `error` event semantics like Node
1212
+ // EventEmitters, we do not listen for `error` events here.
1213
+ emitter.addEventListener(name, function wrapListener(arg) {
1214
+ // IE does not have builtin `{ once: true }` support so we
1215
+ // have to do it manually.
1216
+ if (flags.once) {
1217
+ emitter.removeEventListener(name, wrapListener);
1218
+ }
1219
+ listener(arg);
1220
+ });
1221
+ } else {
1222
+ throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter);
1223
+ }
1224
+ }
1225
+
1226
+
1227
+ /***/ }),
1228
+
1229
+ /***/ "../commons/lib/debug.js":
1230
+ /*!*******************************!*\
1231
+ !*** ../commons/lib/debug.js ***!
1232
+ \*******************************/
1233
+ /***/ (function(__unused_webpack_module, exports) {
1234
+
1235
+
1236
+
1237
+ Object.defineProperty(exports, "__esModule", ({
1238
+ value: true
1239
+ }));
1240
+ exports.noopDebug = noopDebug;
1241
+ exports.setDebug = setDebug;
1242
+ exports.createDebug = createDebug;
1243
+ var debuggers = {};
1244
+ function noopDebug() {
1245
+ return function () {};
1246
+ }
1247
+ var defaultInitializer = noopDebug;
1248
+ function setDebug(debug) {
1249
+ defaultInitializer = debug;
1250
+ Object.keys(debuggers).forEach(function (name) {
1251
+ debuggers[name] = debug(name);
1252
+ });
1253
+ }
1254
+ function createDebug(name) {
1255
+ if (!debuggers[name]) {
1256
+ debuggers[name] = defaultInitializer(name);
1257
+ }
1258
+ return function () {
1259
+ return debuggers[name].apply(debuggers, arguments);
1260
+ };
1261
+ }
1262
+
1263
+ /***/ }),
1264
+
1265
+ /***/ "../commons/lib/index.js":
1266
+ /*!*******************************!*\
1267
+ !*** ../commons/lib/index.js ***!
1268
+ \*******************************/
1269
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1270
+
1271
+
1272
+
1273
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
1274
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
1275
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
1276
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
1277
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
1278
+ 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."); }
1279
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
1280
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
1281
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
1282
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
1283
+ var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
1284
+ if (k2 === undefined) k2 = k;
1285
+ var desc = Object.getOwnPropertyDescriptor(m, k);
1286
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1287
+ desc = {
1288
+ enumerable: true,
1289
+ get: function get() {
1290
+ return m[k];
1291
+ }
1292
+ };
1293
+ }
1294
+ Object.defineProperty(o, k2, desc);
1295
+ } : function (o, m, k, k2) {
1296
+ if (k2 === undefined) k2 = k;
1297
+ o[k2] = m[k];
1298
+ });
1299
+ var __exportStar = this && this.__exportStar || function (m, exports) {
1300
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
1301
+ };
1302
+ Object.defineProperty(exports, "__esModule", ({
1303
+ value: true
1304
+ }));
1305
+ exports._ = void 0;
1306
+ exports.stripSlashes = stripSlashes;
1307
+ exports.isPromise = isPromise;
1308
+ exports.createSymbol = createSymbol;
1309
+ // Removes all leading and trailing slashes from a path
1310
+ function stripSlashes(name) {
1311
+ return name.replace(/^(\/+)|(\/+)$/g, '');
1312
+ }
1313
+ // A set of lodash-y utility functions that use ES6
1314
+ exports._ = {
1315
+ each: function each(obj, callback) {
1316
+ if (obj && typeof obj.forEach === 'function') {
1317
+ obj.forEach(callback);
1318
+ } else if (exports._.isObject(obj)) {
1319
+ Object.keys(obj).forEach(function (key) {
1320
+ return callback(obj[key], key);
1321
+ });
1322
+ }
1323
+ },
1324
+ some: function some(value, callback) {
1325
+ return Object.keys(value).map(function (key) {
1326
+ return [value[key], key];
1327
+ }).some(function (_ref) {
1328
+ var _ref2 = _slicedToArray(_ref, 2),
1329
+ val = _ref2[0],
1330
+ key = _ref2[1];
1331
+ return callback(val, key);
1332
+ });
1333
+ },
1334
+ every: function every(value, callback) {
1335
+ return Object.keys(value).map(function (key) {
1336
+ return [value[key], key];
1337
+ }).every(function (_ref3) {
1338
+ var _ref4 = _slicedToArray(_ref3, 2),
1339
+ val = _ref4[0],
1340
+ key = _ref4[1];
1341
+ return callback(val, key);
1342
+ });
1343
+ },
1344
+ keys: function keys(obj) {
1345
+ return Object.keys(obj);
1346
+ },
1347
+ values: function values(obj) {
1348
+ return exports._.keys(obj).map(function (key) {
1349
+ return obj[key];
1350
+ });
1351
+ },
1352
+ isMatch: function isMatch(obj, item) {
1353
+ return exports._.keys(item).every(function (key) {
1354
+ return obj[key] === item[key];
1355
+ });
1356
+ },
1357
+ isEmpty: function isEmpty(obj) {
1358
+ return exports._.keys(obj).length === 0;
1359
+ },
1360
+ isObject: function isObject(item) {
1361
+ return _typeof(item) === 'object' && !Array.isArray(item) && item !== null;
1362
+ },
1363
+ isObjectOrArray: function isObjectOrArray(value) {
1364
+ return _typeof(value) === 'object' && value !== null;
1365
+ },
1366
+ extend: function extend(first) {
1367
+ for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1368
+ rest[_key - 1] = arguments[_key];
1369
+ }
1370
+ return Object.assign.apply(Object, [first].concat(rest));
1371
+ },
1372
+ omit: function omit(obj) {
1373
+ var result = exports._.extend({}, obj);
1374
+ for (var _len2 = arguments.length, keys = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
1375
+ keys[_key2 - 1] = arguments[_key2];
1372
1376
  }
1373
- });
1374
- }
1375
-
1376
- function addErrorHandlerIfEventEmitter(emitter, handler, flags) {
1377
- if (typeof emitter.on === 'function') {
1378
- eventTargetAgnosticAddListener(emitter, 'error', handler, flags);
1379
- }
1380
- }
1381
-
1382
- function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
1383
- if (typeof emitter.on === 'function') {
1384
- if (flags.once) {
1385
- emitter.once(name, listener);
1386
- } else {
1387
- emitter.on(name, listener);
1377
+ keys.forEach(function (key) {
1378
+ return delete result[key];
1379
+ });
1380
+ return result;
1381
+ },
1382
+ pick: function pick(source) {
1383
+ for (var _len3 = arguments.length, keys = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
1384
+ keys[_key3 - 1] = arguments[_key3];
1388
1385
  }
1389
- } else if (typeof emitter.addEventListener === 'function') {
1390
- // EventTarget does not have `error` event semantics like Node
1391
- // EventEmitters, we do not listen for `error` events here.
1392
- emitter.addEventListener(name, function wrapListener(arg) {
1393
- // IE does not have builtin `{ once: true }` support so we
1394
- // have to do it manually.
1395
- if (flags.once) {
1396
- emitter.removeEventListener(name, wrapListener);
1386
+ return keys.reduce(function (result, key) {
1387
+ if (source[key] !== undefined) {
1388
+ result[key] = source[key];
1397
1389
  }
1398
- listener(arg);
1399
- });
1400
- } else {
1401
- throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter);
1402
- }
1403
- }
1404
-
1405
-
1406
- /***/ }),
1407
-
1408
- /***/ "./src/core.ts":
1409
- /*!*********************!*\
1410
- !*** ./src/core.ts ***!
1411
- \*********************/
1412
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1413
-
1414
-
1415
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
1416
- if (k2 === undefined) k2 = k;
1417
- var desc = Object.getOwnPropertyDescriptor(m, k);
1418
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1419
- desc = { enumerable: true, get: function() { return m[k]; } };
1390
+ return result;
1391
+ }, {});
1392
+ },
1393
+ // Recursively merge the source object into the target object
1394
+ merge: function merge(target, source) {
1395
+ if (exports._.isObject(target) && exports._.isObject(source)) {
1396
+ Object.keys(source).forEach(function (key) {
1397
+ if (exports._.isObject(source[key])) {
1398
+ if (!target[key]) {
1399
+ Object.assign(target, _defineProperty({}, key, {}));
1400
+ }
1401
+ exports._.merge(target[key], source[key]);
1402
+ } else {
1403
+ Object.assign(target, _defineProperty({}, key, source[key]));
1404
+ }
1405
+ });
1420
1406
  }
1421
- Object.defineProperty(o, k2, desc);
1422
- }) : (function(o, m, k, k2) {
1423
- if (k2 === undefined) k2 = k;
1424
- o[k2] = m[k];
1425
- }));
1426
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
1427
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
1407
+ return target;
1408
+ }
1428
1409
  };
1429
- Object.defineProperty(exports, "__esModule", ({ value: true }));
1430
- __exportStar(__webpack_require__(/*! @feathersjs/feathers */ "../feathers/lib/index.js"), exports);
1431
-
1410
+ // Duck-checks if an object looks like a promise
1411
+ function isPromise(result) {
1412
+ return exports._.isObject(result) && typeof result.then === 'function';
1413
+ }
1414
+ function createSymbol(name) {
1415
+ return typeof Symbol !== 'undefined' ? Symbol.for(name) : name;
1416
+ }
1417
+ __exportStar(__webpack_require__(/*! ./debug */ "../commons/lib/debug.js"), exports);
1432
1418
 
1433
1419
  /***/ }),
1434
1420
 
1435
- /***/ "../../node_modules/@feathersjs/hooks/script/base.js":
1436
- /*!***********************************************************!*\
1437
- !*** ../../node_modules/@feathersjs/hooks/script/base.js ***!
1438
- \***********************************************************/
1421
+ /***/ "../feathers/lib/application.js":
1422
+ /*!**************************************!*\
1423
+ !*** ../feathers/lib/application.js ***!
1424
+ \**************************************/
1439
1425
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1440
1426
 
1441
1427
 
1442
1428
 
1443
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
1444
- function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
1445
- function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
1446
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
1447
- function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
1448
- function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
1449
- function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
1450
1429
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
1451
- function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
1452
- 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."); }
1430
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return r; }; var t, r = {}, e = Object.prototype, n = e.hasOwnProperty, o = "function" == typeof Symbol ? Symbol : {}, i = o.iterator || "@@iterator", a = o.asyncIterator || "@@asyncIterator", u = o.toStringTag || "@@toStringTag"; function c(t, r, e, n) { return Object.defineProperty(t, r, { value: e, enumerable: !n, configurable: !n, writable: !n }); } try { c({}, ""); } catch (t) { c = function c(t, r, e) { return t[r] = e; }; } function h(r, e, n, o) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype); return c(a, "_invoke", function (r, e, n) { var o = 1; return function (i, a) { if (3 === o) throw Error("Generator is already running"); if (4 === o) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var u = n.delegate; if (u) { var c = d(u, n); if (c) { if (c === f) continue; return c; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (1 === o) throw o = 4, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = 3; var h = s(r, e, n); if ("normal" === h.type) { if (o = n.done ? 4 : 2, h.arg === f) continue; return { value: h.arg, done: n.done }; } "throw" === h.type && (o = 4, n.method = "throw", n.arg = h.arg); } }; }(r, n, new Context(o || [])), !0), a; } function s(t, r, e) { try { return { type: "normal", arg: t.call(r, e) }; } catch (t) { return { type: "throw", arg: t }; } } r.wrap = h; var f = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var l = {}; c(l, i, function () { return this; }); var p = Object.getPrototypeOf, y = p && p(p(x([]))); y && y !== e && n.call(y, i) && (l = y); var v = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(l); function g(t) { ["next", "throw", "return"].forEach(function (r) { c(t, r, function (t) { return this._invoke(r, t); }); }); } function AsyncIterator(t, r) { function e(o, i, a, u) { var c = s(t[o], t, i); if ("throw" !== c.type) { var h = c.arg, f = h.value; return f && "object" == _typeof(f) && n.call(f, "__await") ? r.resolve(f.__await).then(function (t) { e("next", t, a, u); }, function (t) { e("throw", t, a, u); }) : r.resolve(f).then(function (t) { h.value = t, a(h); }, function (t) { return e("throw", t, a, u); }); } u(c.arg); } var o; c(this, "_invoke", function (t, n) { function i() { return new r(function (r, o) { e(t, n, r, o); }); } return o = o ? o.then(i, i) : i(); }, !0); } function d(r, e) { var n = e.method, o = r.i[n]; if (o === t) return e.delegate = null, "throw" === n && r.i.return && (e.method = "return", e.arg = t, d(r, e), "throw" === e.method) || "return" !== n && (e.method = "throw", e.arg = new TypeError("The iterator does not provide a '" + n + "' method")), f; var i = s(o, r.i, e.arg); if ("throw" === i.type) return e.method = "throw", e.arg = i.arg, e.delegate = null, f; var a = i.arg; return a ? a.done ? (e[r.r] = a.value, e.next = r.n, "return" !== e.method && (e.method = "next", e.arg = t), e.delegate = null, f) : a : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"), e.delegate = null, f); } function w(t) { this.tryEntries.push(t); } function m(r) { var e = r[4] || {}; e.type = "normal", e.arg = t, r[4] = e; } function Context(t) { this.tryEntries = [[-1]], t.forEach(w, this), this.reset(!0); } function x(r) { if (null != r) { var e = r[i]; if (e) return e.call(r); if ("function" == typeof r.next) return r; if (!isNaN(r.length)) { var o = -1, a = function e() { for (; ++o < r.length;) if (n.call(r, o)) return e.value = r[o], e.done = !1, e; return e.value = t, e.done = !0, e; }; return a.next = a; } } throw new TypeError(_typeof(r) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, c(v, "constructor", GeneratorFunctionPrototype), c(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = c(GeneratorFunctionPrototype, u, "GeneratorFunction"), r.isGeneratorFunction = function (t) { var r = "function" == typeof t && t.constructor; return !!r && (r === GeneratorFunction || "GeneratorFunction" === (r.displayName || r.name)); }, r.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, c(t, u, "GeneratorFunction")), t.prototype = Object.create(v), t; }, r.awrap = function (t) { return { __await: t }; }, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function () { return this; }), r.AsyncIterator = AsyncIterator, r.async = function (t, e, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(h(t, e, n, o), i); return r.isGeneratorFunction(e) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, g(v), c(v, u, "Generator"), c(v, i, function () { return this; }), c(v, "toString", function () { return "[object Generator]"; }), r.keys = function (t) { var r = Object(t), e = []; for (var n in r) e.unshift(n); return function t() { for (; e.length;) if ((n = e.pop()) in r) return t.value = n, t.done = !1, t; return t.done = !0, t; }; }, r.values = x, Context.prototype = { constructor: Context, reset: function reset(r) { if (this.prev = this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(m), !r) for (var e in this) "t" === e.charAt(0) && n.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0][4]; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(r) { if (this.done) throw r; var e = this; function n(t) { a.type = "throw", a.arg = r, e.next = t; } for (var o = e.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i[4], u = this.prev, c = i[1], h = i[2]; if (-1 === i[0]) return n("end"), !1; if (!c && !h) throw Error("try statement without catch or finally"); if (null != i[0] && i[0] <= u) { if (u < c) return this.method = "next", this.arg = t, n(c), !0; if (u < h) return n(h), !1; } } }, abrupt: function abrupt(t, r) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var n = this.tryEntries[e]; if (n[0] > -1 && n[0] <= this.prev && this.prev < n[2]) { var o = n; break; } } o && ("break" === t || "continue" === t) && o[0] <= r && r <= o[2] && (o = null); var i = o ? o[4] : {}; return i.type = t, i.arg = r, o ? (this.method = "next", this.next = o[2], f) : this.complete(i); }, complete: function complete(t, r) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && r && (this.next = r), f; }, finish: function finish(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[2] === t) return this.complete(e[4], e[3]), m(e), f; } }, catch: function _catch(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[0] === t) { var n = e[4]; if ("throw" === n.type) { var o = n.arg; m(e); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(r, e, n) { return this.delegate = { i: x(r), r: e, n: n }, "next" === this.method && (this.arg = t), f; } }, r; }
1431
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
1432
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
1433
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, 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 o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
1453
1434
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
1454
- function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
1455
- function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
1456
1435
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
1457
1436
  function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
1458
1437
  function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
1459
1438
  function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
1460
1439
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
1461
1440
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
1441
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
1442
+ function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
1443
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
1444
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
1445
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
1446
+ function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
1447
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
1448
+ var __importDefault = this && this.__importDefault || function (mod) {
1449
+ return mod && mod.__esModule ? mod : {
1450
+ "default": mod
1451
+ };
1452
+ };
1462
1453
  Object.defineProperty(exports, "__esModule", ({
1463
1454
  value: true
1464
1455
  }));
1465
- exports.setMiddleware = exports.getMiddleware = exports.setManager = exports.getManager = exports.convertOptions = exports.HookManager = exports.BaseHookContext = exports.HOOKS = void 0;
1466
- var utils_js_1 = __webpack_require__(/*! ./utils.js */ "../../node_modules/@feathersjs/hooks/script/utils.js");
1467
- exports.HOOKS = Symbol.for('@feathersjs/hooks');
1468
- /**
1469
- * The base hook context.
1470
- */
1471
- var BaseHookContext = /*#__PURE__*/function () {
1472
- function BaseHookContext() {
1473
- var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1474
- _classCallCheck(this, BaseHookContext);
1475
- Object.defineProperty(this, "self", {
1476
- enumerable: true,
1477
- configurable: true,
1478
- writable: true,
1479
- value: void 0
1480
- });
1481
- Object.assign(this, data);
1482
- }
1483
- return _createClass(BaseHookContext, [{
1484
- key: "toJSON",
1485
- value: function toJSON() {
1486
- var _this = this;
1487
- var keys = Object.keys(this);
1488
- var proto = Object.getPrototypeOf(this);
1489
- while (proto) {
1490
- keys.push.apply(keys, _toConsumableArray(Object.keys(proto)));
1491
- proto = Object.getPrototypeOf(proto);
1492
- }
1493
- return keys.reduce(function (result, key) {
1494
- result[key] = _this[key];
1495
- return result;
1496
- }, {});
1497
- }
1498
- }]);
1499
- }();
1500
- exports.BaseHookContext = BaseHookContext;
1501
- var HookManager = /*#__PURE__*/function () {
1502
- function HookManager() {
1503
- _classCallCheck(this, HookManager);
1504
- Object.defineProperty(this, "_parent", {
1505
- enumerable: true,
1506
- configurable: true,
1507
- writable: true,
1508
- value: null
1509
- });
1510
- Object.defineProperty(this, "_params", {
1511
- enumerable: true,
1512
- configurable: true,
1513
- writable: true,
1514
- value: null
1515
- });
1516
- Object.defineProperty(this, "_middleware", {
1517
- enumerable: true,
1518
- configurable: true,
1519
- writable: true,
1520
- value: null
1521
- });
1522
- Object.defineProperty(this, "_props", {
1523
- enumerable: true,
1524
- configurable: true,
1525
- writable: true,
1526
- value: null
1527
- });
1528
- Object.defineProperty(this, "_defaults", {
1529
- enumerable: true,
1530
- configurable: true,
1531
- writable: true,
1532
- value: void 0
1456
+ exports.Feathers = void 0;
1457
+ var version_1 = __importDefault(__webpack_require__(/*! ./version */ "../feathers/lib/version.js"));
1458
+ var events_1 = __webpack_require__(/*! events */ "../../node_modules/events/events.js");
1459
+ var commons_1 = __webpack_require__(/*! @feathersjs/commons */ "../commons/lib/index.js");
1460
+ var hooks_1 = __webpack_require__(/*! @feathersjs/hooks */ "../../node_modules/@feathersjs/hooks/script/index.js");
1461
+ var events_2 = __webpack_require__(/*! ./events */ "../feathers/lib/events.js");
1462
+ var hooks_2 = __webpack_require__(/*! ./hooks */ "../feathers/lib/hooks.js");
1463
+ var service_1 = __webpack_require__(/*! ./service */ "../feathers/lib/service.js");
1464
+ var hooks_3 = __webpack_require__(/*! ./hooks */ "../feathers/lib/hooks.js");
1465
+ var debug = (0, commons_1.createDebug)('@feathersjs/feathers');
1466
+ var Feathers = /*#__PURE__*/function (_events_1$EventEmitte) {
1467
+ function Feathers() {
1468
+ var _this;
1469
+ _classCallCheck(this, Feathers);
1470
+ _this = _callSuper(this, Feathers);
1471
+ _this.services = {};
1472
+ _this.settings = {};
1473
+ _this.mixins = [hooks_2.hookMixin, events_2.eventMixin];
1474
+ _this.version = version_1.default;
1475
+ _this._isSetup = false;
1476
+ _this.registerHooks = (0, hooks_3.enableHooks)(_this);
1477
+ _this.registerHooks({
1478
+ around: [events_2.eventHook]
1533
1479
  });
1480
+ return _this;
1534
1481
  }
1535
- return _createClass(HookManager, [{
1536
- key: "parent",
1537
- value: function parent(_parent) {
1538
- this._parent = _parent;
1539
- return this;
1482
+ _inherits(Feathers, _events_1$EventEmitte);
1483
+ return _createClass(Feathers, [{
1484
+ key: "get",
1485
+ value: function get(name) {
1486
+ return this.settings[name];
1540
1487
  }
1541
1488
  }, {
1542
- key: "middleware",
1543
- value: function middleware(_middleware) {
1544
- this._middleware = _middleware !== null && _middleware !== void 0 && _middleware.length ? _middleware : null;
1489
+ key: "set",
1490
+ value: function set(name, value) {
1491
+ this.settings[name] = value;
1545
1492
  return this;
1546
1493
  }
1547
1494
  }, {
1548
- key: "getMiddleware",
1549
- value: function getMiddleware() {
1550
- var _this$_parent;
1551
- var previous = (_this$_parent = this._parent) === null || _this$_parent === void 0 ? void 0 : _this$_parent.getMiddleware();
1552
- if (previous && this._middleware) {
1553
- return previous.concat(this._middleware);
1554
- }
1555
- return previous || this._middleware;
1495
+ key: "configure",
1496
+ value: function configure(callback) {
1497
+ callback.call(this, this);
1498
+ return this;
1556
1499
  }
1557
1500
  }, {
1558
- key: "collectMiddleware",
1559
- value: function collectMiddleware(self, _args) {
1560
- var otherMiddleware = getMiddleware(self);
1561
- var middleware = this.getMiddleware();
1562
- if (otherMiddleware && middleware) {
1563
- return otherMiddleware.concat(middleware);
1564
- }
1565
- return otherMiddleware || middleware || [];
1501
+ key: "defaultService",
1502
+ value: function defaultService(location) {
1503
+ throw new Error("Can not find service '".concat(location, "'"));
1566
1504
  }
1567
1505
  }, {
1568
- key: "props",
1569
- value: function props(_props) {
1570
- if (!this._props) {
1571
- this._props = {};
1506
+ key: "service",
1507
+ value: function service(location) {
1508
+ var path = (0, commons_1.stripSlashes)(location) || '/';
1509
+ var current = this.services.hasOwnProperty(path) ? this.services[path] : undefined;
1510
+ if (typeof current === 'undefined') {
1511
+ this.use(path, this.defaultService(path));
1512
+ return this.service(path);
1572
1513
  }
1573
- (0, utils_js_1.copyProperties)(this._props, _props);
1574
- return this;
1514
+ return current;
1575
1515
  }
1576
1516
  }, {
1577
- key: "getProps",
1578
- value: function getProps() {
1579
- var _this$_parent2;
1580
- var previous = (_this$_parent2 = this._parent) === null || _this$_parent2 === void 0 ? void 0 : _this$_parent2.getProps();
1581
- if (previous && this._props) {
1582
- return (0, utils_js_1.copyProperties)({}, previous, this._props);
1583
- }
1584
- return previous || this._props || null;
1517
+ key: "_setup",
1518
+ value: function _setup() {
1519
+ var _this2 = this;
1520
+ this._isSetup = true;
1521
+ return Object.keys(this.services).reduce(function (current, path) {
1522
+ return current.then(function () {
1523
+ var service = _this2.service(path);
1524
+ if (typeof service.setup === 'function') {
1525
+ debug("Setting up service for `".concat(path, "`"));
1526
+ return service.setup(_this2, path);
1527
+ }
1528
+ });
1529
+ }, Promise.resolve()).then(function () {
1530
+ return _this2;
1531
+ });
1585
1532
  }
1586
1533
  }, {
1587
- key: "params",
1588
- value: function params() {
1589
- for (var _len = arguments.length, _params = new Array(_len), _key = 0; _key < _len; _key++) {
1590
- _params[_key] = arguments[_key];
1591
- }
1592
- this._params = _params;
1593
- return this;
1534
+ key: "setup",
1535
+ get: function get() {
1536
+ return this._setup;
1537
+ },
1538
+ set: function set(value) {
1539
+ this._setup = value[hooks_1.HOOKS] ? value : (0, hooks_1.hooks)(value, (0, hooks_1.middleware)().params('server').props({
1540
+ app: this
1541
+ }));
1594
1542
  }
1595
1543
  }, {
1596
- key: "getParams",
1597
- value: function getParams() {
1598
- var _this$_parent3;
1599
- var previous = (_this$_parent3 = this._parent) === null || _this$_parent3 === void 0 ? void 0 : _this$_parent3.getParams();
1600
- if (previous && this._params) {
1601
- return previous.concat(this._params);
1602
- }
1603
- return previous || this._params;
1544
+ key: "_teardown",
1545
+ value: function _teardown() {
1546
+ var _this3 = this;
1547
+ this._isSetup = false;
1548
+ return Object.keys(this.services).reduce(function (current, path) {
1549
+ return current.then(function () {
1550
+ var service = _this3.service(path);
1551
+ if (typeof service.teardown === 'function') {
1552
+ debug("Tearing down service for `".concat(path, "`"));
1553
+ return service.teardown(_this3, path);
1554
+ }
1555
+ });
1556
+ }, Promise.resolve()).then(function () {
1557
+ return _this3;
1558
+ });
1604
1559
  }
1605
1560
  }, {
1606
- key: "defaults",
1607
- value: function defaults(_defaults) {
1608
- this._defaults = _defaults;
1609
- return this;
1561
+ key: "teardown",
1562
+ get: function get() {
1563
+ return this._teardown;
1564
+ },
1565
+ set: function set(value) {
1566
+ this._teardown = value[hooks_1.HOOKS] ? value : (0, hooks_1.hooks)(value, (0, hooks_1.middleware)().params('server').props({
1567
+ app: this
1568
+ }));
1610
1569
  }
1611
1570
  }, {
1612
- key: "getDefaults",
1613
- value: function getDefaults(self, args, context) {
1614
- var _this$_parent4;
1615
- var defaults = typeof this._defaults === 'function' ? this._defaults(self, args, context) : null;
1616
- var previous = (_this$_parent4 = this._parent) === null || _this$_parent4 === void 0 ? void 0 : _this$_parent4.getDefaults(self, args, context);
1617
- if (previous && defaults) {
1618
- return Object.assign({}, previous, defaults);
1571
+ key: "use",
1572
+ value: function use(path, service, options) {
1573
+ var _this4 = this;
1574
+ if (typeof path !== 'string') {
1575
+ throw new Error("'".concat(path, "' is not a valid service path."));
1619
1576
  }
1620
- return previous || defaults;
1621
- }
1622
- }, {
1623
- key: "getContextClass",
1624
- value: function getContextClass() {
1625
- var Base = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : BaseHookContext;
1626
- var ContextClass = /*#__PURE__*/function (_Base) {
1627
- function ContextClass(data) {
1628
- _classCallCheck(this, ContextClass);
1629
- return _callSuper(this, ContextClass, [data]);
1630
- }
1631
- _inherits(ContextClass, _Base);
1632
- return _createClass(ContextClass);
1633
- }(Base);
1634
- var params = this.getParams();
1635
- var props = this.getProps();
1636
- if (params) {
1637
- params.forEach(function (name, index) {
1638
- if ((props === null || props === void 0 ? void 0 : props[name]) !== undefined) {
1639
- throw new Error("Hooks can not have a property and param named '".concat(name, "'. Use .defaults instead."));
1640
- }
1641
- Object.defineProperty(ContextClass.prototype, name, {
1642
- enumerable: true,
1643
- get: function get() {
1644
- return this === null || this === void 0 ? void 0 : this.arguments[index];
1645
- },
1646
- set: function set(value) {
1647
- this.arguments[index] = value;
1648
- }
1649
- });
1577
+ var location = (0, commons_1.stripSlashes)(path) || '/';
1578
+ var subApp = service;
1579
+ var isSubApp = typeof subApp.service === 'function' && subApp.services;
1580
+ if (isSubApp) {
1581
+ Object.keys(subApp.services).forEach(function (subPath) {
1582
+ return _this4.use("".concat(location, "/").concat(subPath), subApp.service(subPath));
1650
1583
  });
1584
+ return this;
1651
1585
  }
1652
- if (props) {
1653
- (0, utils_js_1.copyProperties)(ContextClass.prototype, props);
1586
+ var protoService = (0, service_1.wrapService)(location, service, options);
1587
+ var serviceOptions = (0, service_1.getServiceOptions)(protoService);
1588
+ var _iterator = _createForOfIteratorHelper(service_1.protectedMethods),
1589
+ _step;
1590
+ try {
1591
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
1592
+ var name = _step.value;
1593
+ if (serviceOptions.methods.includes(name)) {
1594
+ throw new Error("'".concat(name, "' on service '").concat(location, "' is not allowed as a custom method name"));
1595
+ }
1596
+ }
1597
+ } catch (err) {
1598
+ _iterator.e(err);
1599
+ } finally {
1600
+ _iterator.f();
1654
1601
  }
1655
- return ContextClass;
1602
+ debug("Registering new service at `".concat(location, "`"));
1603
+ // Add all the mixins
1604
+ this.mixins.forEach(function (fn) {
1605
+ return fn.call(_this4, protoService, location, serviceOptions);
1606
+ });
1607
+ this.services[location] = protoService;
1608
+ // If we ran setup already, set this service up explicitly, this will not `await`
1609
+ if (this._isSetup && typeof protoService.setup === 'function') {
1610
+ debug("Setting up service for `".concat(location, "`"));
1611
+ protoService.setup(this, location);
1612
+ }
1613
+ return this;
1656
1614
  }
1657
1615
  }, {
1658
- key: "initializeContext",
1659
- value: function initializeContext(self, args, context) {
1660
- var ctx = this._parent ? this._parent.initializeContext(self, args, context) : context;
1661
- var defaults = this.getDefaults(self, args, ctx);
1662
- if (self) {
1663
- ctx.self = self;
1664
- }
1665
- ctx.arguments = args;
1666
- if (defaults) {
1667
- for (var _i = 0, _Object$keys = Object.keys(defaults); _i < _Object$keys.length; _i++) {
1668
- var name = _Object$keys[_i];
1669
- if (ctx[name] === undefined) {
1670
- ctx[name] = defaults[name];
1616
+ key: "unuse",
1617
+ value: function () {
1618
+ var _unuse = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(location) {
1619
+ var path, service;
1620
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
1621
+ while (1) switch (_context.prev = _context.next) {
1622
+ case 0:
1623
+ path = (0, commons_1.stripSlashes)(location) || '/';
1624
+ service = this.services[path];
1625
+ if (!(service && typeof service.teardown === 'function')) {
1626
+ _context.next = 5;
1627
+ break;
1628
+ }
1629
+ _context.next = 5;
1630
+ return service.teardown(this, path);
1631
+ case 5:
1632
+ delete this.services[path];
1633
+ return _context.abrupt("return", service);
1634
+ case 7:
1635
+ case "end":
1636
+ return _context.stop();
1671
1637
  }
1672
- }
1638
+ }, _callee, this);
1639
+ }));
1640
+ function unuse(_x) {
1641
+ return _unuse.apply(this, arguments);
1642
+ }
1643
+ return unuse;
1644
+ }()
1645
+ }, {
1646
+ key: "hooks",
1647
+ value: function hooks(hookMap) {
1648
+ var untypedMap = hookMap;
1649
+ if (untypedMap.before || untypedMap.after || untypedMap.error || untypedMap.around) {
1650
+ // regular hooks for all service methods
1651
+ this.registerHooks(untypedMap);
1652
+ } else if (untypedMap.setup || untypedMap.teardown) {
1653
+ // .setup and .teardown application hooks
1654
+ (0, hooks_1.hooks)(this, untypedMap);
1655
+ } else {
1656
+ // Other registration formats are just `around` hooks
1657
+ this.registerHooks({
1658
+ around: untypedMap
1659
+ });
1673
1660
  }
1674
- return ctx;
1661
+ return this;
1675
1662
  }
1676
1663
  }]);
1677
- }();
1678
- exports.HookManager = HookManager;
1679
- function convertOptions() {
1680
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
1681
- if (!options) {
1682
- return new HookManager();
1683
- }
1684
- return Array.isArray(options) ? new HookManager().middleware(options) : options;
1685
- }
1686
- exports.convertOptions = convertOptions;
1687
- function getManager(target) {
1688
- return target && target[exports.HOOKS] || null;
1689
- }
1690
- exports.getManager = getManager;
1691
- function setManager(target, manager) {
1692
- var parent = getManager(target);
1693
- target[exports.HOOKS] = manager.parent(parent);
1694
- return target;
1695
- }
1696
- exports.setManager = setManager;
1697
- function getMiddleware(target) {
1698
- var manager = getManager(target);
1699
- return manager ? manager.getMiddleware() : null;
1700
- }
1701
- exports.getMiddleware = getMiddleware;
1702
- function setMiddleware(target, middleware) {
1703
- var manager = new HookManager().middleware(middleware);
1704
- return setManager(target, manager);
1705
- }
1706
- exports.setMiddleware = setMiddleware;
1664
+ }(events_1.EventEmitter);
1665
+ exports.Feathers = Feathers;
1707
1666
 
1708
1667
  /***/ }),
1709
1668
 
1710
- /***/ "../../node_modules/@feathersjs/hooks/script/compose.js":
1711
- /*!**************************************************************!*\
1712
- !*** ../../node_modules/@feathersjs/hooks/script/compose.js ***!
1713
- \**************************************************************/
1669
+ /***/ "../feathers/lib/declarations.js":
1670
+ /*!***************************************!*\
1671
+ !*** ../feathers/lib/declarations.js ***!
1672
+ \***************************************/
1714
1673
  /***/ (function(__unused_webpack_module, exports) {
1715
1674
 
1716
1675
 
1717
1676
 
1718
- function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, 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 o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
1719
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
1720
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
1721
1677
  Object.defineProperty(exports, "__esModule", ({
1722
1678
  value: true
1723
1679
  }));
1724
- exports.compose = void 0;
1725
- function compose(middleware) {
1726
- if (!Array.isArray(middleware)) {
1727
- throw new TypeError('Middleware stack must be an array!');
1728
- }
1729
- var _iterator = _createForOfIteratorHelper(middleware),
1730
- _step;
1731
- try {
1732
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
1733
- var fn = _step.value;
1734
- if (typeof fn !== 'function') {
1735
- throw new TypeError('Middleware must be composed of functions!');
1736
- }
1680
+
1681
+ /***/ }),
1682
+
1683
+ /***/ "../feathers/lib/events.js":
1684
+ /*!*********************************!*\
1685
+ !*** ../feathers/lib/events.js ***!
1686
+ \*********************************/
1687
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1688
+
1689
+
1690
+
1691
+ Object.defineProperty(exports, "__esModule", ({
1692
+ value: true
1693
+ }));
1694
+ exports.eventHook = eventHook;
1695
+ exports.eventMixin = eventMixin;
1696
+ var events_1 = __webpack_require__(/*! events */ "../../node_modules/events/events.js");
1697
+ var service_1 = __webpack_require__(/*! ./service */ "../feathers/lib/service.js");
1698
+ function eventHook(context, next) {
1699
+ var _ref = (0, service_1.getServiceOptions)(context.self),
1700
+ events = _ref.events;
1701
+ var defaultEvent = service_1.defaultEventMap[context.method] || null;
1702
+ context.event = defaultEvent;
1703
+ return next().then(function () {
1704
+ // Send the event only if the service does not do so already (indicated in the `events` option)
1705
+ // This is used for custom events and for client services receiving event from the server
1706
+ if (typeof context.event === 'string' && !events.includes(context.event)) {
1707
+ var results = Array.isArray(context.result) ? context.result : [context.result];
1708
+ results.forEach(function (element) {
1709
+ return context.self.emit(context.event, element, context);
1710
+ });
1737
1711
  }
1738
- } catch (err) {
1739
- _iterator.e(err);
1740
- } finally {
1741
- _iterator.f();
1712
+ });
1713
+ }
1714
+ function eventMixin(service) {
1715
+ var isEmitter = typeof service.on === 'function' && typeof service.emit === 'function';
1716
+ if (!isEmitter) {
1717
+ Object.assign(service, events_1.EventEmitter.prototype);
1742
1718
  }
1743
- return function (context, next) {
1744
- // last called middleware #
1745
- var index = -1;
1746
- return dispatch.call(this, 0);
1747
- function dispatch(i) {
1748
- if (i <= index) {
1749
- return Promise.reject(new Error('next() called multiple times'));
1750
- }
1751
- index = i;
1752
- var fn = middleware[i];
1753
- if (i === middleware.length) {
1754
- fn = next;
1755
- }
1756
- if (!fn) {
1757
- return Promise.resolve();
1758
- }
1759
- try {
1760
- return Promise.resolve(fn.call(this, context, dispatch.bind(this, i + 1)));
1761
- } catch (err) {
1762
- return Promise.reject(err);
1763
- }
1764
- }
1765
- };
1719
+ return service;
1766
1720
  }
1767
- exports.compose = compose;
1768
1721
 
1769
1722
  /***/ }),
1770
1723
 
1771
- /***/ "../../node_modules/@feathersjs/hooks/script/hooks.js":
1772
- /*!************************************************************!*\
1773
- !*** ../../node_modules/@feathersjs/hooks/script/hooks.js ***!
1774
- \************************************************************/
1724
+ /***/ "../feathers/lib/hooks.js":
1725
+ /*!********************************!*\
1726
+ !*** ../feathers/lib/hooks.js ***!
1727
+ \********************************/
1775
1728
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1776
1729
 
1777
1730
 
1778
1731
 
1732
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
1733
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
1734
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
1735
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
1736
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
1737
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
1738
+ function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
1739
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
1740
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
1741
+ function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
1742
+ function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); }
1743
+ function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; }
1744
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
1745
+ function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
1746
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
1747
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
1748
+ 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."); }
1749
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
1750
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
1751
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
1752
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
1753
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
1779
1754
  Object.defineProperty(exports, "__esModule", ({
1780
1755
  value: true
1781
1756
  }));
1782
- exports.legacyDecorator = exports.hookDecorator = exports.objectHooks = exports.functionHooks = exports.getOriginal = void 0;
1783
- var compose_js_1 = __webpack_require__(/*! ./compose.js */ "../../node_modules/@feathersjs/hooks/script/compose.js");
1784
- var base_js_1 = __webpack_require__(/*! ./base.js */ "../../node_modules/@feathersjs/hooks/script/base.js");
1785
- var utils_js_1 = __webpack_require__(/*! ./utils.js */ "../../node_modules/@feathersjs/hooks/script/utils.js");
1786
- function getOriginal(fn) {
1787
- return typeof fn.original === 'function' ? getOriginal(fn.original) : fn;
1788
- }
1789
- exports.getOriginal = getOriginal;
1790
- function functionHooks(fn, managerOrMiddleware) {
1791
- if (typeof fn !== 'function') {
1792
- throw new Error('Can not apply hooks to non-function');
1793
- }
1794
- var manager = (0, base_js_1.convertOptions)(managerOrMiddleware);
1795
- var _wrapper = function wrapper() {
1796
- var _this = this;
1797
- var Context = _wrapper.Context,
1798
- original = _wrapper.original;
1799
- // If we got passed an existing HookContext instance, we want to return it as well
1800
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1801
- args[_key] = arguments[_key];
1802
- }
1803
- var returnContext = args[args.length - 1] instanceof Context;
1804
- // Use existing context or default
1805
- var base = returnContext ? args.pop() : new Context();
1806
- // Initialize the context
1807
- var context = manager.initializeContext(this, args, base);
1808
- // Assemble the hook chain
1809
- var hookChain = [
1810
- // Return `ctx.result` or the context
1811
- function (ctx, next) {
1812
- return next().then(function () {
1813
- return returnContext ? ctx : ctx.result;
1814
- });
1815
- }];
1816
- // Create the hook chain by calling the `collectMiddleware function
1817
- var mw = manager.collectMiddleware(this, args);
1818
- if (mw) {
1819
- Array.prototype.push.apply(hookChain, mw);
1757
+ exports.FeathersHookManager = void 0;
1758
+ exports.convertHookData = convertHookData;
1759
+ exports.collectHooks = collectHooks;
1760
+ exports.enableHooks = enableHooks;
1761
+ exports.createContext = createContext;
1762
+ exports.hookMixin = hookMixin;
1763
+ var hooks_1 = __webpack_require__(/*! @feathersjs/hooks */ "../../node_modules/@feathersjs/hooks/script/index.js");
1764
+ var service_1 = __webpack_require__(/*! ./service */ "../feathers/lib/service.js");
1765
+ var types = ['before', 'after', 'error', 'around'];
1766
+ var isType = function isType(value) {
1767
+ return types.includes(value);
1768
+ };
1769
+ // Converts different hook registration formats into the
1770
+ // same internal format
1771
+ function convertHookData(input) {
1772
+ var result = {};
1773
+ if (Array.isArray(input)) {
1774
+ result.all = input;
1775
+ } else if (_typeof(input) !== 'object') {
1776
+ result.all = [input];
1777
+ } else {
1778
+ for (var _i = 0, _Object$keys = Object.keys(input); _i < _Object$keys.length; _i++) {
1779
+ var key = _Object$keys[_i];
1780
+ var value = input[key];
1781
+ result[key] = Array.isArray(value) ? value : [value];
1820
1782
  }
1821
- // Runs the actual original method if `ctx.result` is not already set
1822
- hookChain.push(function (ctx, next) {
1823
- if (!Object.prototype.hasOwnProperty.call(context, 'result')) {
1824
- return Promise.resolve(original.apply(_this, ctx.arguments)).then(function (result) {
1825
- ctx.result = result;
1826
- return next();
1827
- });
1783
+ }
1784
+ return result;
1785
+ }
1786
+ function collectHooks(target, method) {
1787
+ var _target$__hooks = target.__hooks,
1788
+ collected = _target$__hooks.collected,
1789
+ collectedAll = _target$__hooks.collectedAll,
1790
+ around = _target$__hooks.around;
1791
+ return [].concat(_toConsumableArray(around.all || []), _toConsumableArray(around[method] || []), _toConsumableArray(collectedAll.before || []), _toConsumableArray(collected[method] || []), _toConsumableArray(collectedAll.after || []));
1792
+ }
1793
+ // Add `.hooks` functionality to an object
1794
+ function enableHooks(object) {
1795
+ var store = {
1796
+ around: {},
1797
+ before: {},
1798
+ after: {},
1799
+ error: {},
1800
+ collected: {},
1801
+ collectedAll: {}
1802
+ };
1803
+ Object.defineProperty(object, '__hooks', {
1804
+ configurable: true,
1805
+ value: store,
1806
+ writable: true
1807
+ });
1808
+ return function registerHooks(input) {
1809
+ var store = this.__hooks;
1810
+ var map = Object.keys(input).reduce(function (map, type) {
1811
+ if (!isType(type)) {
1812
+ throw new Error("'".concat(type, "' is not a valid hook type"));
1828
1813
  }
1829
- return next();
1814
+ map[type] = convertHookData(input[type]);
1815
+ return map;
1816
+ }, {});
1817
+ var types = Object.keys(map);
1818
+ types.forEach(function (type) {
1819
+ return Object.keys(map[type]).forEach(function (method) {
1820
+ var _a;
1821
+ var mapHooks = map[type][method];
1822
+ var storeHooks = (_a = store[type])[method] || (_a[method] = []);
1823
+ storeHooks.push.apply(storeHooks, _toConsumableArray(mapHooks));
1824
+ if (method === 'all') {
1825
+ if (store.before[method] || store.error[method]) {
1826
+ var beforeAll = (0, hooks_1.collect)({
1827
+ before: store.before[method] || [],
1828
+ error: store.error[method] || []
1829
+ });
1830
+ store.collectedAll.before = [beforeAll];
1831
+ }
1832
+ if (store.after[method]) {
1833
+ var afterAll = (0, hooks_1.collect)({
1834
+ after: store.after[method] || []
1835
+ });
1836
+ store.collectedAll.after = [afterAll];
1837
+ }
1838
+ } else {
1839
+ if (store.before[method] || store.after[method] || store.error[method]) {
1840
+ var collected = (0, hooks_1.collect)({
1841
+ before: store.before[method] || [],
1842
+ after: store.after[method] || [],
1843
+ error: store.error[method] || []
1844
+ });
1845
+ store.collected[method] = [collected];
1846
+ }
1847
+ }
1848
+ });
1830
1849
  });
1831
- return (0, compose_js_1.compose)(hookChain).call(this, context);
1850
+ return this;
1832
1851
  };
1833
- (0, utils_js_1.copyFnProperties)(_wrapper, fn);
1834
- (0, utils_js_1.copyProperties)(_wrapper, fn);
1835
- (0, base_js_1.setManager)(_wrapper, manager);
1836
- return Object.assign(_wrapper, {
1837
- original: getOriginal(fn),
1838
- Context: manager.getContextClass(),
1839
- createContext: function createContext() {
1840
- var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1841
- return new _wrapper.Context(data);
1842
- }
1843
- });
1844
1852
  }
1845
- exports.functionHooks = functionHooks;
1846
- function objectHooks(obj, hooks) {
1847
- if (Array.isArray(hooks)) {
1848
- return (0, base_js_1.setMiddleware)(obj, hooks);
1849
- }
1850
- for (var _i = 0, _Object$keys = Object.keys(hooks); _i < _Object$keys.length; _i++) {
1851
- var method = _Object$keys[_i];
1852
- var target = typeof obj[method] === 'function' ? obj : obj.prototype;
1853
- var fn = target && target[method];
1854
- if (typeof fn !== 'function') {
1855
- throw new Error("Can not apply hooks. '".concat(method, "' is not a function"));
1856
- }
1857
- var manager = (0, base_js_1.convertOptions)(hooks[method]);
1858
- target[method] = functionHooks(fn, manager.props({
1859
- method: method
1860
- }));
1853
+ function createContext(service, method) {
1854
+ var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1855
+ var createContext = service[method].createContext;
1856
+ if (typeof createContext !== 'function') {
1857
+ throw new Error("Can not create context for method ".concat(method));
1861
1858
  }
1862
- return obj;
1859
+ return createContext(data);
1863
1860
  }
1864
- exports.objectHooks = objectHooks;
1865
- var hookDecorator = function hookDecorator(managerOrMiddleware) {
1866
- return function (target, context) {
1867
- var manager = (0, base_js_1.convertOptions)(managerOrMiddleware);
1868
- if (context.kind === 'class') {
1869
- (0, base_js_1.setManager)(target.prototype, manager);
1870
- return target;
1871
- } else if (context.kind === 'method') {
1872
- var method = String(context.name);
1873
- return functionHooks(target, manager.props({
1874
- method: method
1875
- }));
1861
+ var FeathersHookManager = /*#__PURE__*/function (_hooks_1$HookManager) {
1862
+ function FeathersHookManager(app, method) {
1863
+ var _this;
1864
+ _classCallCheck(this, FeathersHookManager);
1865
+ _this = _callSuper(this, FeathersHookManager);
1866
+ _this.app = app;
1867
+ _this.method = method;
1868
+ _this._middleware = [];
1869
+ return _this;
1870
+ }
1871
+ _inherits(FeathersHookManager, _hooks_1$HookManager);
1872
+ return _createClass(FeathersHookManager, [{
1873
+ key: "collectMiddleware",
1874
+ value: function collectMiddleware(self, args) {
1875
+ var appHooks = collectHooks(this.app, this.method);
1876
+ var middleware = _superPropGet(FeathersHookManager, "collectMiddleware", this, 3)([self, args]);
1877
+ var methodHooks = collectHooks(self, this.method);
1878
+ return [].concat(_toConsumableArray(appHooks), _toConsumableArray(middleware), _toConsumableArray(methodHooks));
1876
1879
  }
1877
- throw new Error('Can not apply hooks.');
1878
- };
1879
- };
1880
- exports.hookDecorator = hookDecorator;
1881
- var legacyDecorator = function legacyDecorator(managerOrMiddleware) {
1882
- var wrapper = function wrapper(_target, method, descriptor) {
1883
- var manager = (0, base_js_1.convertOptions)(managerOrMiddleware);
1884
- if (!descriptor) {
1885
- (0, base_js_1.setManager)(_target.prototype, manager);
1886
- return _target;
1880
+ }, {
1881
+ key: "initializeContext",
1882
+ value: function initializeContext(self, args, context) {
1883
+ var ctx = _superPropGet(FeathersHookManager, "initializeContext", this, 3)([self, args, context]);
1884
+ ctx.params = ctx.params || {};
1885
+ return ctx;
1887
1886
  }
1888
- var fn = descriptor.value;
1889
- if (typeof fn !== 'function') {
1890
- throw new Error("Can not apply hooks. '".concat(method, "' is not a function"));
1887
+ }, {
1888
+ key: "middleware",
1889
+ value: function middleware(mw) {
1890
+ var _this$_middleware;
1891
+ (_this$_middleware = this._middleware).push.apply(_this$_middleware, _toConsumableArray(mw));
1892
+ return this;
1891
1893
  }
1892
- descriptor.value = functionHooks(fn, manager.props({
1893
- method: method
1894
- }));
1895
- return descriptor;
1894
+ }]);
1895
+ }(hooks_1.HookManager);
1896
+ exports.FeathersHookManager = FeathersHookManager;
1897
+ function hookMixin(service, path, options) {
1898
+ var _this2 = this;
1899
+ if (typeof service.hooks === 'function') {
1900
+ return service;
1901
+ }
1902
+ var hookMethods = (0, service_1.getHookMethods)(service, options);
1903
+ var serviceMethodHooks = hookMethods.reduce(function (res, method) {
1904
+ var _FeathersHookManager;
1905
+ var params = service_1.defaultServiceArguments[method] || ['data', 'params'];
1906
+ res[method] = (_FeathersHookManager = new FeathersHookManager(_this2, method)).params.apply(_FeathersHookManager, _toConsumableArray(params)).props({
1907
+ app: _this2,
1908
+ path: path,
1909
+ method: method,
1910
+ service: service,
1911
+ event: null,
1912
+ type: 'around',
1913
+ get statusCode() {
1914
+ var _a;
1915
+ return (_a = this.http) === null || _a === void 0 ? void 0 : _a.status;
1916
+ },
1917
+ set statusCode(value) {
1918
+ this.http = this.http || {};
1919
+ this.http.status = value;
1920
+ }
1921
+ });
1922
+ return res;
1923
+ }, {});
1924
+ var registerHooks = enableHooks(service);
1925
+ (0, hooks_1.hooks)(service, serviceMethodHooks);
1926
+ service.hooks = function (hookOptions) {
1927
+ var _this3 = this;
1928
+ if (hookOptions.before || hookOptions.after || hookOptions.error || hookOptions.around) {
1929
+ return registerHooks.call(this, hookOptions);
1930
+ }
1931
+ if (Array.isArray(hookOptions)) {
1932
+ return (0, hooks_1.hooks)(this, hookOptions);
1933
+ }
1934
+ Object.keys(hookOptions).forEach(function (method) {
1935
+ var manager = (0, hooks_1.getManager)(_this3[method]);
1936
+ if (!(manager instanceof FeathersHookManager)) {
1937
+ throw new Error("Method ".concat(method, " is not a Feathers hooks enabled service method"));
1938
+ }
1939
+ manager.middleware(hookOptions[method]);
1940
+ });
1941
+ return this;
1896
1942
  };
1897
- return wrapper;
1898
- };
1899
- exports.legacyDecorator = legacyDecorator;
1943
+ return service;
1944
+ }
1900
1945
 
1901
1946
  /***/ }),
1902
1947
 
1903
- /***/ "../../node_modules/@feathersjs/hooks/script/index.js":
1904
- /*!************************************************************!*\
1905
- !*** ../../node_modules/@feathersjs/hooks/script/index.js ***!
1906
- \************************************************************/
1907
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1948
+ /***/ "../feathers/lib/index.js":
1949
+ /*!********************************!*\
1950
+ !*** ../feathers/lib/index.js ***!
1951
+ \********************************/
1952
+ /***/ (function(module, exports, __webpack_require__) {
1908
1953
 
1909
1954
 
1910
1955
 
1911
- function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
1912
- 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."); }
1913
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
1914
- function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
1915
- function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
1916
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
1917
1956
  var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
1918
1957
  if (k2 === undefined) k2 = k;
1919
1958
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -1922,71 +1961,54 @@ var __createBinding = this && this.__createBinding || (Object.create ? function
1922
1961
  enumerable: true,
1923
1962
  get: function get() {
1924
1963
  return m[k];
1925
- }
1926
- };
1927
- }
1928
- Object.defineProperty(o, k2, desc);
1929
- } : function (o, m, k, k2) {
1930
- if (k2 === undefined) k2 = k;
1931
- o[k2] = m[k];
1932
- });
1933
- var __exportStar = this && this.__exportStar || function (m, exports) {
1934
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
1935
- };
1936
- Object.defineProperty(exports, "__esModule", ({
1937
- value: true
1938
- }));
1939
- exports.hooks = exports.middleware = void 0;
1940
- var base_js_1 = __webpack_require__(/*! ./base.js */ "../../node_modules/@feathersjs/hooks/script/base.js");
1941
- var hooks_js_1 = __webpack_require__(/*! ./hooks.js */ "../../node_modules/@feathersjs/hooks/script/hooks.js");
1942
- __exportStar(__webpack_require__(/*! ./hooks.js */ "../../node_modules/@feathersjs/hooks/script/hooks.js"), exports);
1943
- __exportStar(__webpack_require__(/*! ./compose.js */ "../../node_modules/@feathersjs/hooks/script/compose.js"), exports);
1944
- __exportStar(__webpack_require__(/*! ./base.js */ "../../node_modules/@feathersjs/hooks/script/base.js"), exports);
1945
- __exportStar(__webpack_require__(/*! ./regular.js */ "../../node_modules/@feathersjs/hooks/script/regular.js"), exports);
1946
- /**
1947
- * Initializes a hook settings object with the given middleware.
1948
- * @param mw The list of middleware
1949
- * @param options Middleware options (params, default, props)
1950
- */
1951
- function middleware(mw, options) {
1952
- var manager = new base_js_1.HookManager().middleware(mw);
1953
- if (options) {
1954
- if (options.params) {
1955
- manager.params.apply(manager, _toConsumableArray(options.params));
1956
- }
1957
- if (options.defaults) {
1958
- manager.defaults(options.defaults);
1959
- }
1960
- if (options.props) {
1961
- manager.props(options.props);
1962
- }
1963
- }
1964
- return manager;
1965
- }
1966
- exports.middleware = middleware;
1967
- // Fallthrough to actual implementation
1968
- function hooks() {
1969
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1970
- args[_key] = arguments[_key];
1971
- }
1972
- var target = args[0],
1973
- _hooks = args[1];
1974
- if (typeof target === 'function' && (_hooks instanceof base_js_1.HookManager || Array.isArray(_hooks) || args.length === 1)) {
1975
- return (0, hooks_js_1.functionHooks)(target, _hooks);
1964
+ }
1965
+ };
1976
1966
  }
1977
- if (args.length === 2) {
1978
- return (0, hooks_js_1.objectHooks)(target, _hooks);
1967
+ Object.defineProperty(o, k2, desc);
1968
+ } : function (o, m, k, k2) {
1969
+ if (k2 === undefined) k2 = k;
1970
+ o[k2] = m[k];
1971
+ });
1972
+ var __exportStar = this && this.__exportStar || function (m, exports) {
1973
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
1974
+ };
1975
+ var __importDefault = this && this.__importDefault || function (mod) {
1976
+ return mod && mod.__esModule ? mod : {
1977
+ "default": mod
1978
+ };
1979
+ };
1980
+ Object.defineProperty(exports, "__esModule", ({
1981
+ value: true
1982
+ }));
1983
+ exports.Feathers = exports.version = void 0;
1984
+ exports.feathers = feathers;
1985
+ var commons_1 = __webpack_require__(/*! @feathersjs/commons */ "../commons/lib/index.js");
1986
+ var version_1 = __importDefault(__webpack_require__(/*! ./version */ "../feathers/lib/version.js"));
1987
+ exports.version = version_1.default;
1988
+ var application_1 = __webpack_require__(/*! ./application */ "../feathers/lib/application.js");
1989
+ Object.defineProperty(exports, "Feathers", ({
1990
+ enumerable: true,
1991
+ get: function get() {
1992
+ return application_1.Feathers;
1979
1993
  }
1980
- return (0, hooks_js_1.hookDecorator)(target);
1994
+ }));
1995
+ function feathers() {
1996
+ return new application_1.Feathers();
1997
+ }
1998
+ feathers.setDebug = commons_1.setDebug;
1999
+ __exportStar(__webpack_require__(/*! ./hooks */ "../feathers/lib/hooks.js"), exports);
2000
+ __exportStar(__webpack_require__(/*! ./declarations */ "../feathers/lib/declarations.js"), exports);
2001
+ __exportStar(__webpack_require__(/*! ./service */ "../feathers/lib/service.js"), exports);
2002
+ if (true) {
2003
+ module.exports = Object.assign(feathers, module.exports);
1981
2004
  }
1982
- exports.hooks = hooks;
1983
2005
 
1984
2006
  /***/ }),
1985
2007
 
1986
- /***/ "../../node_modules/@feathersjs/hooks/script/regular.js":
1987
- /*!**************************************************************!*\
1988
- !*** ../../node_modules/@feathersjs/hooks/script/regular.js ***!
1989
- \**************************************************************/
2008
+ /***/ "../feathers/lib/service.js":
2009
+ /*!**********************************!*\
2010
+ !*** ../feathers/lib/service.js ***!
2011
+ \**********************************/
1990
2012
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1991
2013
 
1992
2014
 
@@ -2006,136 +2028,114 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
2006
2028
  Object.defineProperty(exports, "__esModule", ({
2007
2029
  value: true
2008
2030
  }));
2009
- exports.collect = exports.fromErrorHook = exports.fromAfterHook = exports.fromBeforeHook = exports.runHooks = exports.runHook = void 0;
2010
- var compose_js_1 = __webpack_require__(/*! ./compose.js */ "../../node_modules/@feathersjs/hooks/script/compose.js");
2011
- var runHook = function runHook(hook, context, type) {
2012
- var typeBefore = context.type;
2013
- if (type) context.type = type;
2014
- return Promise.resolve(hook.call(context.self, context)).then(function (res) {
2015
- if (type) context.type = typeBefore;
2016
- if (res && res !== context) {
2017
- Object.assign(context, res);
2018
- }
2019
- });
2031
+ exports.normalizeServiceOptions = exports.protectedMethods = exports.defaultServiceEvents = exports.defaultEventMap = exports.defaultServiceMethods = exports.defaultServiceArguments = exports.SERVICE = void 0;
2032
+ exports.getHookMethods = getHookMethods;
2033
+ exports.getServiceOptions = getServiceOptions;
2034
+ exports.wrapService = wrapService;
2035
+ var events_1 = __webpack_require__(/*! events */ "../../node_modules/events/events.js");
2036
+ var commons_1 = __webpack_require__(/*! @feathersjs/commons */ "../commons/lib/index.js");
2037
+ exports.SERVICE = (0, commons_1.createSymbol)('@feathersjs/service');
2038
+ exports.defaultServiceArguments = {
2039
+ find: ['params'],
2040
+ get: ['id', 'params'],
2041
+ create: ['data', 'params'],
2042
+ update: ['id', 'data', 'params'],
2043
+ patch: ['id', 'data', 'params'],
2044
+ remove: ['id', 'params']
2020
2045
  };
2021
- exports.runHook = runHook;
2022
- var runHooks = function runHooks(hooks) {
2023
- return function (context) {
2024
- return hooks.reduce(function (promise, hook) {
2025
- return promise.then(function () {
2026
- return (0, exports.runHook)(hook, context);
2027
- });
2028
- }, Promise.resolve(context));
2029
- };
2046
+ exports.defaultServiceMethods = ['find', 'get', 'create', 'update', 'patch', 'remove'];
2047
+ exports.defaultEventMap = {
2048
+ create: 'created',
2049
+ update: 'updated',
2050
+ patch: 'patched',
2051
+ remove: 'removed'
2030
2052
  };
2031
- exports.runHooks = runHooks;
2032
- function fromBeforeHook(hook) {
2033
- return function (context, next) {
2034
- return (0, exports.runHook)(hook, context, 'before').then(next);
2035
- };
2036
- }
2037
- exports.fromBeforeHook = fromBeforeHook;
2038
- function fromAfterHook(hook) {
2039
- return function (context, next) {
2040
- return next().then(function () {
2041
- return (0, exports.runHook)(hook, context, 'after');
2042
- });
2043
- };
2053
+ exports.defaultServiceEvents = Object.values(exports.defaultEventMap);
2054
+ exports.protectedMethods = Object.keys(Object.prototype).concat(Object.keys(events_1.EventEmitter.prototype)).concat(['all', 'around', 'before', 'after', 'error', 'hooks', 'setup', 'teardown', 'publish']);
2055
+ function getHookMethods(service, options) {
2056
+ var methods = options.methods;
2057
+ return exports.defaultServiceMethods.filter(function (m) {
2058
+ return typeof service[m] === 'function' && !methods.includes(m);
2059
+ }).concat(methods);
2044
2060
  }
2045
- exports.fromAfterHook = fromAfterHook;
2046
- function fromErrorHook(hook) {
2047
- return function (context, next) {
2048
- return next().catch(function (error) {
2049
- if (context.error !== error || context.result !== undefined) {
2050
- context.original = _objectSpread({}, context);
2051
- context.error = error;
2052
- delete context.result;
2053
- }
2054
- return (0, exports.runHook)(hook, context, 'error').then(function () {
2055
- if (context.result === undefined && context.error !== undefined) {
2056
- throw context.error;
2057
- }
2058
- }).catch(function (error) {
2059
- context.error = error;
2060
- throw context.error;
2061
- });
2062
- });
2063
- };
2061
+ function getServiceOptions(service) {
2062
+ return service[exports.SERVICE];
2064
2063
  }
2065
- exports.fromErrorHook = fromErrorHook;
2066
- function collect(_ref) {
2067
- var _ref$before = _ref.before,
2068
- before = _ref$before === void 0 ? [] : _ref$before,
2069
- _ref$after = _ref.after,
2070
- after = _ref$after === void 0 ? [] : _ref$after,
2071
- _ref$error = _ref.error,
2072
- error = _ref$error === void 0 ? [] : _ref$error;
2073
- var beforeHooks = before.map(fromBeforeHook);
2074
- var afterHooks = _toConsumableArray(after).reverse().map(fromAfterHook);
2075
- var errorHooks = error.length ? [fromErrorHook((0, exports.runHooks)(error))] : [];
2076
- return (0, compose_js_1.compose)([].concat(errorHooks, _toConsumableArray(beforeHooks), _toConsumableArray(afterHooks)));
2064
+ var normalizeServiceOptions = function normalizeServiceOptions(service) {
2065
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2066
+ var _options$methods = options.methods,
2067
+ methods = _options$methods === void 0 ? exports.defaultServiceMethods.filter(function (method) {
2068
+ return typeof service[method] === 'function';
2069
+ }) : _options$methods,
2070
+ _options$events = options.events,
2071
+ events = _options$events === void 0 ? service.events || [] : _options$events;
2072
+ var serviceEvents = options.serviceEvents || exports.defaultServiceEvents.concat(events);
2073
+ return _objectSpread(_objectSpread({}, options), {}, {
2074
+ events: events,
2075
+ methods: methods,
2076
+ serviceEvents: serviceEvents
2077
+ });
2078
+ };
2079
+ exports.normalizeServiceOptions = normalizeServiceOptions;
2080
+ function wrapService(location, service, options) {
2081
+ // Do nothing if this is already an initialized
2082
+ if (service[exports.SERVICE]) {
2083
+ return service;
2084
+ }
2085
+ var protoService = Object.create(service);
2086
+ var serviceOptions = (0, exports.normalizeServiceOptions)(service, options);
2087
+ if (Object.keys(serviceOptions.methods).length === 0 && ![].concat(_toConsumableArray(exports.defaultServiceMethods), ['setup', 'teardown']).some(function (method) {
2088
+ return typeof service[method] === 'function';
2089
+ })) {
2090
+ throw new Error("Invalid service object passed for path `".concat(location, "`"));
2091
+ }
2092
+ Object.defineProperty(protoService, exports.SERVICE, {
2093
+ value: serviceOptions
2094
+ });
2095
+ return protoService;
2077
2096
  }
2078
- exports.collect = collect;
2079
2097
 
2080
2098
  /***/ }),
2081
2099
 
2082
- /***/ "../../node_modules/@feathersjs/hooks/script/utils.js":
2083
- /*!************************************************************!*\
2084
- !*** ../../node_modules/@feathersjs/hooks/script/utils.js ***!
2085
- \************************************************************/
2100
+ /***/ "../feathers/lib/version.js":
2101
+ /*!**********************************!*\
2102
+ !*** ../feathers/lib/version.js ***!
2103
+ \**********************************/
2086
2104
  /***/ (function(__unused_webpack_module, exports) {
2087
2105
 
2088
2106
 
2089
2107
 
2090
- function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, 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 o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
2091
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
2092
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
2093
2108
  Object.defineProperty(exports, "__esModule", ({
2094
2109
  value: true
2095
2110
  }));
2096
- exports.copyFnProperties = exports.copyProperties = void 0;
2097
- function copyProperties(target) {
2098
- for (var _len = arguments.length, originals = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
2099
- originals[_key - 1] = arguments[_key];
2100
- }
2101
- for (var _i = 0, _originals = originals; _i < _originals.length; _i++) {
2102
- var original = _originals[_i];
2103
- var originalProps = Object.keys(original).concat(Object.getOwnPropertySymbols(original));
2104
- var _iterator = _createForOfIteratorHelper(originalProps),
2105
- _step;
2106
- try {
2107
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
2108
- var prop = _step.value;
2109
- var propDescriptor = Object.getOwnPropertyDescriptor(original, prop);
2110
- if (propDescriptor && !Object.prototype.hasOwnProperty.call(target, prop)) {
2111
- Object.defineProperty(target, prop, propDescriptor);
2112
- }
2113
- }
2114
- } catch (err) {
2115
- _iterator.e(err);
2116
- } finally {
2117
- _iterator.f();
2118
- }
2119
- }
2120
- return target;
2121
- }
2122
- exports.copyProperties = copyProperties;
2123
- function copyFnProperties(target, original) {
2124
- var internalProps = ['name', 'length'];
2125
- try {
2126
- for (var _i2 = 0, _internalProps = internalProps; _i2 < _internalProps.length; _i2++) {
2127
- var prop = _internalProps[_i2];
2128
- var value = original[prop];
2129
- Object.defineProperty(target, prop, {
2130
- value: value
2131
- });
2111
+ exports["default"] = 'development';
2112
+
2113
+ /***/ }),
2114
+
2115
+ /***/ "./src/core.ts":
2116
+ /*!*********************!*\
2117
+ !*** ./src/core.ts ***!
2118
+ \*********************/
2119
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
2120
+
2121
+
2122
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
2123
+ if (k2 === undefined) k2 = k;
2124
+ var desc = Object.getOwnPropertyDescriptor(m, k);
2125
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
2126
+ desc = { enumerable: true, get: function() { return m[k]; } };
2132
2127
  }
2133
- } catch (_e) {
2134
- // Avoid IE error
2135
- }
2136
- return target;
2137
- }
2138
- exports.copyFnProperties = copyFnProperties;
2128
+ Object.defineProperty(o, k2, desc);
2129
+ }) : (function(o, m, k, k2) {
2130
+ if (k2 === undefined) k2 = k;
2131
+ o[k2] = m[k];
2132
+ }));
2133
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
2134
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
2135
+ };
2136
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
2137
+ __exportStar(__webpack_require__(/*! @feathersjs/feathers */ "../feathers/lib/index.js"), exports);
2138
+
2139
2139
 
2140
2140
  /***/ })
2141
2141