@feathersjs/client 5.0.39 → 5.0.41

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