@feathersjs/client 5.0.0-pre.30 → 5.0.0-pre.32
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/CHANGELOG.md +8 -0
- package/dist/core.js +57 -435
- package/dist/core.js.map +1 -1
- package/dist/core.min.js +1 -1
- package/dist/feathers.js +117 -873
- package/dist/feathers.js.map +1 -1
- package/dist/feathers.min.js +1 -1
- package/package.json +11 -11
package/dist/core.js
CHANGED
|
@@ -25,33 +25,26 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
25
25
|
}));
|
|
26
26
|
exports.createDebug = exports.setDebug = exports.noopDebug = void 0;
|
|
27
27
|
var debuggers = {};
|
|
28
|
-
|
|
29
28
|
function noopDebug() {
|
|
30
29
|
return function () {};
|
|
31
30
|
}
|
|
32
|
-
|
|
33
31
|
exports.noopDebug = noopDebug;
|
|
34
32
|
var defaultInitializer = noopDebug;
|
|
35
|
-
|
|
36
33
|
function setDebug(debug) {
|
|
37
34
|
defaultInitializer = debug;
|
|
38
35
|
Object.keys(debuggers).forEach(function (name) {
|
|
39
36
|
debuggers[name] = debug(name);
|
|
40
37
|
});
|
|
41
38
|
}
|
|
42
|
-
|
|
43
39
|
exports.setDebug = setDebug;
|
|
44
|
-
|
|
45
40
|
function createDebug(name) {
|
|
46
41
|
if (!debuggers[name]) {
|
|
47
42
|
debuggers[name] = defaultInitializer(name);
|
|
48
43
|
}
|
|
49
|
-
|
|
50
44
|
return function () {
|
|
51
45
|
return debuggers[name].apply(debuggers, arguments);
|
|
52
46
|
};
|
|
53
47
|
}
|
|
54
|
-
|
|
55
48
|
exports.createDebug = createDebug;
|
|
56
49
|
|
|
57
50
|
/***/ }),
|
|
@@ -65,25 +58,16 @@ exports.createDebug = createDebug;
|
|
|
65
58
|
|
|
66
59
|
|
|
67
60
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
68
|
-
|
|
69
61
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
70
|
-
|
|
71
62
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
72
|
-
|
|
73
63
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
74
|
-
|
|
75
64
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
76
|
-
|
|
77
65
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
78
|
-
|
|
79
66
|
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
80
|
-
|
|
81
67
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
82
|
-
|
|
83
68
|
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
84
69
|
if (k2 === undefined) k2 = k;
|
|
85
70
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
86
|
-
|
|
87
71
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
88
72
|
desc = {
|
|
89
73
|
enumerable: true,
|
|
@@ -92,30 +76,26 @@ var __createBinding = this && this.__createBinding || (Object.create ? function
|
|
|
92
76
|
}
|
|
93
77
|
};
|
|
94
78
|
}
|
|
95
|
-
|
|
96
79
|
Object.defineProperty(o, k2, desc);
|
|
97
80
|
} : function (o, m, k, k2) {
|
|
98
81
|
if (k2 === undefined) k2 = k;
|
|
99
82
|
o[k2] = m[k];
|
|
100
83
|
});
|
|
101
|
-
|
|
102
84
|
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
103
85
|
for (var p in m) {
|
|
104
86
|
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
105
87
|
}
|
|
106
88
|
};
|
|
107
|
-
|
|
108
89
|
Object.defineProperty(exports, "__esModule", ({
|
|
109
90
|
value: true
|
|
110
91
|
}));
|
|
111
|
-
exports.createSymbol = exports.isPromise = exports._ = exports.stripSlashes = void 0;
|
|
112
|
-
|
|
92
|
+
exports.createSymbol = exports.isPromise = exports._ = exports.stripSlashes = void 0;
|
|
93
|
+
// Removes all leading and trailing slashes from a path
|
|
113
94
|
function stripSlashes(name) {
|
|
114
95
|
return name.replace(/^(\/+)|(\/+)$/g, '');
|
|
115
96
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
97
|
+
exports.stripSlashes = stripSlashes;
|
|
98
|
+
// A set of lodash-y utility functions that use ES6
|
|
119
99
|
exports._ = {
|
|
120
100
|
each: function each(obj, callback) {
|
|
121
101
|
if (obj && typeof obj.forEach === 'function') {
|
|
@@ -131,9 +111,8 @@ exports._ = {
|
|
|
131
111
|
return [value[key], key];
|
|
132
112
|
}).some(function (_ref) {
|
|
133
113
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
114
|
+
val = _ref2[0],
|
|
115
|
+
key = _ref2[1];
|
|
137
116
|
return callback(val, key);
|
|
138
117
|
});
|
|
139
118
|
},
|
|
@@ -142,9 +121,8 @@ exports._ = {
|
|
|
142
121
|
return [value[key], key];
|
|
143
122
|
}).every(function (_ref3) {
|
|
144
123
|
var _ref4 = _slicedToArray(_ref3, 2),
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
124
|
+
val = _ref4[0],
|
|
125
|
+
key = _ref4[1];
|
|
148
126
|
return callback(val, key);
|
|
149
127
|
});
|
|
150
128
|
},
|
|
@@ -174,16 +152,13 @@ exports._ = {
|
|
|
174
152
|
for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
175
153
|
rest[_key - 1] = arguments[_key];
|
|
176
154
|
}
|
|
177
|
-
|
|
178
155
|
return Object.assign.apply(Object, [first].concat(rest));
|
|
179
156
|
},
|
|
180
157
|
omit: function omit(obj) {
|
|
181
158
|
var result = exports._.extend({}, obj);
|
|
182
|
-
|
|
183
159
|
for (var _len2 = arguments.length, keys = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
184
160
|
keys[_key2 - 1] = arguments[_key2];
|
|
185
161
|
}
|
|
186
|
-
|
|
187
162
|
keys.forEach(function (key) {
|
|
188
163
|
return delete result[key];
|
|
189
164
|
});
|
|
@@ -193,12 +168,10 @@ exports._ = {
|
|
|
193
168
|
for (var _len3 = arguments.length, keys = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
194
169
|
keys[_key3 - 1] = arguments[_key3];
|
|
195
170
|
}
|
|
196
|
-
|
|
197
171
|
return keys.reduce(function (result, key) {
|
|
198
172
|
if (source[key] !== undefined) {
|
|
199
173
|
result[key] = source[key];
|
|
200
174
|
}
|
|
201
|
-
|
|
202
175
|
return result;
|
|
203
176
|
}, {});
|
|
204
177
|
},
|
|
@@ -210,30 +183,24 @@ exports._ = {
|
|
|
210
183
|
if (!target[key]) {
|
|
211
184
|
Object.assign(target, _defineProperty({}, key, {}));
|
|
212
185
|
}
|
|
213
|
-
|
|
214
186
|
exports._.merge(target[key], source[key]);
|
|
215
187
|
} else {
|
|
216
188
|
Object.assign(target, _defineProperty({}, key, source[key]));
|
|
217
189
|
}
|
|
218
190
|
});
|
|
219
191
|
}
|
|
220
|
-
|
|
221
192
|
return target;
|
|
222
193
|
}
|
|
223
|
-
};
|
|
224
|
-
|
|
194
|
+
};
|
|
195
|
+
// Duck-checks if an object looks like a promise
|
|
225
196
|
function isPromise(result) {
|
|
226
197
|
return exports._.isObject(result) && typeof result.then === 'function';
|
|
227
198
|
}
|
|
228
|
-
|
|
229
199
|
exports.isPromise = isPromise;
|
|
230
|
-
|
|
231
200
|
function createSymbol(name) {
|
|
232
201
|
return typeof Symbol !== 'undefined' ? Symbol(name) : name;
|
|
233
202
|
}
|
|
234
|
-
|
|
235
203
|
exports.createSymbol = createSymbol;
|
|
236
|
-
|
|
237
204
|
__exportStar(__webpack_require__(/*! ./debug */ "../commons/lib/debug.js"), exports);
|
|
238
205
|
|
|
239
206
|
/***/ }),
|
|
@@ -247,78 +214,46 @@ __exportStar(__webpack_require__(/*! ./debug */ "../commons/lib/debug.js"), expo
|
|
|
247
214
|
|
|
248
215
|
|
|
249
216
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
250
|
-
|
|
251
217
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
252
|
-
|
|
253
218
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
254
|
-
|
|
255
219
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
256
|
-
|
|
257
220
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
258
|
-
|
|
259
221
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
260
|
-
|
|
261
222
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
262
|
-
|
|
263
223
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
264
|
-
|
|
265
224
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
266
|
-
|
|
267
225
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
268
|
-
|
|
269
226
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
270
|
-
|
|
271
227
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
272
|
-
|
|
273
228
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
274
|
-
|
|
275
229
|
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
276
|
-
|
|
277
230
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
278
|
-
|
|
279
231
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
280
|
-
|
|
281
232
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
282
|
-
|
|
283
233
|
var __importDefault = this && this.__importDefault || function (mod) {
|
|
284
234
|
return mod && mod.__esModule ? mod : {
|
|
285
235
|
"default": mod
|
|
286
236
|
};
|
|
287
237
|
};
|
|
288
|
-
|
|
289
238
|
Object.defineProperty(exports, "__esModule", ({
|
|
290
239
|
value: true
|
|
291
240
|
}));
|
|
292
241
|
exports.Feathers = void 0;
|
|
293
|
-
|
|
294
242
|
var version_1 = __importDefault(__webpack_require__(/*! ./version */ "../feathers/lib/version.js"));
|
|
295
|
-
|
|
296
243
|
var events_1 = __webpack_require__(/*! events */ "../../node_modules/events/events.js");
|
|
297
|
-
|
|
298
244
|
var commons_1 = __webpack_require__(/*! @feathersjs/commons */ "../commons/lib/index.js");
|
|
299
|
-
|
|
300
245
|
var hooks_1 = __webpack_require__(/*! @feathersjs/hooks */ "../../node_modules/@feathersjs/hooks/script/index.js");
|
|
301
|
-
|
|
302
246
|
var events_2 = __webpack_require__(/*! ./events */ "../feathers/lib/events.js");
|
|
303
|
-
|
|
304
247
|
var hooks_2 = __webpack_require__(/*! ./hooks */ "../feathers/lib/hooks.js");
|
|
305
|
-
|
|
306
248
|
var service_1 = __webpack_require__(/*! ./service */ "../feathers/lib/service.js");
|
|
307
|
-
|
|
308
249
|
var hooks_3 = __webpack_require__(/*! ./hooks */ "../feathers/lib/hooks.js");
|
|
309
|
-
|
|
310
250
|
var debug = (0, commons_1.createDebug)('@feathersjs/feathers');
|
|
311
|
-
|
|
312
251
|
var Feathers = /*#__PURE__*/function (_events_1$EventEmitte) {
|
|
313
252
|
_inherits(Feathers, _events_1$EventEmitte);
|
|
314
|
-
|
|
315
253
|
var _super = _createSuper(Feathers);
|
|
316
|
-
|
|
317
254
|
function Feathers() {
|
|
318
255
|
var _this;
|
|
319
|
-
|
|
320
256
|
_classCallCheck(this, Feathers);
|
|
321
|
-
|
|
322
257
|
_this = _super.call(this);
|
|
323
258
|
_this.services = {};
|
|
324
259
|
_this.settings = {};
|
|
@@ -326,14 +261,11 @@ var Feathers = /*#__PURE__*/function (_events_1$EventEmitte) {
|
|
|
326
261
|
_this.version = version_1.default;
|
|
327
262
|
_this._isSetup = false;
|
|
328
263
|
_this.registerHooks = (0, hooks_3.enableHooks)(_assertThisInitialized(_this));
|
|
329
|
-
|
|
330
264
|
_this.registerHooks({
|
|
331
265
|
around: [events_2.eventHook]
|
|
332
266
|
});
|
|
333
|
-
|
|
334
267
|
return _this;
|
|
335
268
|
}
|
|
336
|
-
|
|
337
269
|
_createClass(Feathers, [{
|
|
338
270
|
key: "get",
|
|
339
271
|
value: function get(name) {
|
|
@@ -361,24 +293,20 @@ var Feathers = /*#__PURE__*/function (_events_1$EventEmitte) {
|
|
|
361
293
|
value: function service(location) {
|
|
362
294
|
var path = (0, commons_1.stripSlashes)(location) || '/';
|
|
363
295
|
var current = this.services[path];
|
|
364
|
-
|
|
365
296
|
if (typeof current === 'undefined') {
|
|
366
297
|
this.use(path, this.defaultService(path));
|
|
367
298
|
return this.service(path);
|
|
368
299
|
}
|
|
369
|
-
|
|
370
300
|
return current;
|
|
371
301
|
}
|
|
372
302
|
}, {
|
|
373
303
|
key: "_setup",
|
|
374
304
|
value: function _setup() {
|
|
375
305
|
var _this2 = this;
|
|
376
|
-
|
|
377
306
|
this._isSetup = true;
|
|
378
307
|
return Object.keys(this.services).reduce(function (current, path) {
|
|
379
308
|
return current.then(function () {
|
|
380
309
|
var service = _this2.service(path);
|
|
381
|
-
|
|
382
310
|
if (typeof service.setup === 'function') {
|
|
383
311
|
debug("Setting up service for `".concat(path, "`"));
|
|
384
312
|
return service.setup(_this2, path);
|
|
@@ -402,12 +330,10 @@ var Feathers = /*#__PURE__*/function (_events_1$EventEmitte) {
|
|
|
402
330
|
key: "_teardown",
|
|
403
331
|
value: function _teardown() {
|
|
404
332
|
var _this3 = this;
|
|
405
|
-
|
|
406
333
|
this._isSetup = false;
|
|
407
334
|
return Object.keys(this.services).reduce(function (current, path) {
|
|
408
335
|
return current.then(function () {
|
|
409
336
|
var service = _this3.service(path);
|
|
410
|
-
|
|
411
337
|
if (typeof service.teardown === 'function') {
|
|
412
338
|
debug("Tearing down service for `".concat(path, "`"));
|
|
413
339
|
return service.teardown(_this3, path);
|
|
@@ -431,32 +357,25 @@ var Feathers = /*#__PURE__*/function (_events_1$EventEmitte) {
|
|
|
431
357
|
key: "use",
|
|
432
358
|
value: function use(path, service, options) {
|
|
433
359
|
var _this4 = this;
|
|
434
|
-
|
|
435
360
|
if (typeof path !== 'string') {
|
|
436
361
|
throw new Error("'".concat(path, "' is not a valid service path."));
|
|
437
362
|
}
|
|
438
|
-
|
|
439
363
|
var location = (0, commons_1.stripSlashes)(path) || '/';
|
|
440
364
|
var subApp = service;
|
|
441
365
|
var isSubApp = typeof subApp.service === 'function' && subApp.services;
|
|
442
|
-
|
|
443
366
|
if (isSubApp) {
|
|
444
367
|
Object.keys(subApp.services).forEach(function (subPath) {
|
|
445
368
|
return _this4.use("".concat(location, "/").concat(subPath), subApp.service(subPath));
|
|
446
369
|
});
|
|
447
370
|
return this;
|
|
448
371
|
}
|
|
449
|
-
|
|
450
372
|
var protoService = (0, service_1.wrapService)(location, service, options);
|
|
451
373
|
var serviceOptions = (0, service_1.getServiceOptions)(protoService);
|
|
452
|
-
|
|
453
374
|
var _iterator = _createForOfIteratorHelper(service_1.protectedMethods),
|
|
454
|
-
|
|
455
|
-
|
|
375
|
+
_step;
|
|
456
376
|
try {
|
|
457
377
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
458
378
|
var name = _step.value;
|
|
459
|
-
|
|
460
379
|
if (serviceOptions.methods.includes(name)) {
|
|
461
380
|
throw new Error("'".concat(name, "' on service '").concat(location, "' is not allowed as a custom method name"));
|
|
462
381
|
}
|
|
@@ -466,19 +385,17 @@ var Feathers = /*#__PURE__*/function (_events_1$EventEmitte) {
|
|
|
466
385
|
} finally {
|
|
467
386
|
_iterator.f();
|
|
468
387
|
}
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
388
|
+
debug("Registering new service at `".concat(location, "`"));
|
|
389
|
+
// Add all the mixins
|
|
472
390
|
this.mixins.forEach(function (fn) {
|
|
473
391
|
return fn.call(_this4, protoService, location, serviceOptions);
|
|
474
392
|
});
|
|
475
|
-
this.services[location] = protoService;
|
|
476
|
-
|
|
393
|
+
this.services[location] = protoService;
|
|
394
|
+
// If we ran setup already, set this service up explicitly, this will not `await`
|
|
477
395
|
if (this._isSetup && typeof protoService.setup === 'function') {
|
|
478
396
|
debug("Setting up service for `".concat(location, "`"));
|
|
479
397
|
protoService.setup(this, location);
|
|
480
398
|
}
|
|
481
|
-
|
|
482
399
|
return this;
|
|
483
400
|
}
|
|
484
401
|
}, {
|
|
@@ -492,19 +409,15 @@ var Feathers = /*#__PURE__*/function (_events_1$EventEmitte) {
|
|
|
492
409
|
case 0:
|
|
493
410
|
path = (0, commons_1.stripSlashes)(location) || '/';
|
|
494
411
|
service = this.services[path];
|
|
495
|
-
|
|
496
412
|
if (!(service && typeof service.teardown === 'function')) {
|
|
497
413
|
_context.next = 5;
|
|
498
414
|
break;
|
|
499
415
|
}
|
|
500
|
-
|
|
501
416
|
_context.next = 5;
|
|
502
417
|
return service.teardown(this, path);
|
|
503
|
-
|
|
504
418
|
case 5:
|
|
505
419
|
delete this.services[path];
|
|
506
420
|
return _context.abrupt("return", service);
|
|
507
|
-
|
|
508
421
|
case 7:
|
|
509
422
|
case "end":
|
|
510
423
|
return _context.stop();
|
|
@@ -512,18 +425,15 @@ var Feathers = /*#__PURE__*/function (_events_1$EventEmitte) {
|
|
|
512
425
|
}
|
|
513
426
|
}, _callee, this);
|
|
514
427
|
}));
|
|
515
|
-
|
|
516
428
|
function unuse(_x) {
|
|
517
429
|
return _unuse.apply(this, arguments);
|
|
518
430
|
}
|
|
519
|
-
|
|
520
431
|
return unuse;
|
|
521
432
|
}()
|
|
522
433
|
}, {
|
|
523
434
|
key: "hooks",
|
|
524
435
|
value: function hooks(hookMap) {
|
|
525
436
|
var untypedMap = hookMap;
|
|
526
|
-
|
|
527
437
|
if (untypedMap.before || untypedMap.after || untypedMap.error || untypedMap.around) {
|
|
528
438
|
// regular hooks for all service methods
|
|
529
439
|
this.registerHooks(untypedMap);
|
|
@@ -536,14 +446,11 @@ var Feathers = /*#__PURE__*/function (_events_1$EventEmitte) {
|
|
|
536
446
|
around: untypedMap
|
|
537
447
|
});
|
|
538
448
|
}
|
|
539
|
-
|
|
540
449
|
return this;
|
|
541
450
|
}
|
|
542
451
|
}]);
|
|
543
|
-
|
|
544
452
|
return Feathers;
|
|
545
453
|
}(events_1.EventEmitter);
|
|
546
|
-
|
|
547
454
|
exports.Feathers = Feathers;
|
|
548
455
|
|
|
549
456
|
/***/ }),
|
|
@@ -574,15 +481,11 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
574
481
|
value: true
|
|
575
482
|
}));
|
|
576
483
|
exports.eventMixin = exports.eventHook = void 0;
|
|
577
|
-
|
|
578
484
|
var events_1 = __webpack_require__(/*! events */ "../../node_modules/events/events.js");
|
|
579
|
-
|
|
580
485
|
var service_1 = __webpack_require__(/*! ./service */ "../feathers/lib/service.js");
|
|
581
|
-
|
|
582
486
|
function eventHook(context, next) {
|
|
583
487
|
var _ref = (0, service_1.getServiceOptions)(context.self),
|
|
584
|
-
|
|
585
|
-
|
|
488
|
+
events = _ref.events;
|
|
586
489
|
var defaultEvent = service_1.defaultEventMap[context.method] || null;
|
|
587
490
|
context.event = defaultEvent;
|
|
588
491
|
return next().then(function () {
|
|
@@ -596,19 +499,14 @@ function eventHook(context, next) {
|
|
|
596
499
|
}
|
|
597
500
|
});
|
|
598
501
|
}
|
|
599
|
-
|
|
600
502
|
exports.eventHook = eventHook;
|
|
601
|
-
|
|
602
503
|
function eventMixin(service) {
|
|
603
504
|
var isEmitter = typeof service.on === 'function' && typeof service.emit === 'function';
|
|
604
|
-
|
|
605
505
|
if (!isEmitter) {
|
|
606
506
|
Object.assign(service, events_1.EventEmitter.prototype);
|
|
607
507
|
}
|
|
608
|
-
|
|
609
508
|
return service;
|
|
610
509
|
}
|
|
611
|
-
|
|
612
510
|
exports.eventMixin = eventMixin;
|
|
613
511
|
|
|
614
512
|
/***/ }),
|
|
@@ -622,63 +520,38 @@ exports.eventMixin = eventMixin;
|
|
|
622
520
|
|
|
623
521
|
|
|
624
522
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
625
|
-
|
|
626
523
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
627
|
-
|
|
628
524
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
629
|
-
|
|
630
525
|
function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
|
|
631
|
-
|
|
632
526
|
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
|
633
|
-
|
|
634
527
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
635
|
-
|
|
636
528
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
637
|
-
|
|
638
529
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
639
|
-
|
|
640
530
|
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
641
|
-
|
|
642
531
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
643
|
-
|
|
644
532
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
645
|
-
|
|
646
533
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
647
|
-
|
|
648
534
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
649
|
-
|
|
650
535
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
651
|
-
|
|
652
536
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
653
|
-
|
|
654
537
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
655
|
-
|
|
656
538
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
657
|
-
|
|
658
539
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
659
|
-
|
|
660
540
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
661
|
-
|
|
662
541
|
Object.defineProperty(exports, "__esModule", ({
|
|
663
542
|
value: true
|
|
664
543
|
}));
|
|
665
544
|
exports.hookMixin = exports.FeathersHookManager = exports.createContext = exports.enableHooks = exports.collectHooks = exports.convertHookData = void 0;
|
|
666
|
-
|
|
667
545
|
var hooks_1 = __webpack_require__(/*! @feathersjs/hooks */ "../../node_modules/@feathersjs/hooks/script/index.js");
|
|
668
|
-
|
|
669
546
|
var service_1 = __webpack_require__(/*! ./service */ "../feathers/lib/service.js");
|
|
670
|
-
|
|
671
547
|
var types = ['before', 'after', 'error', 'around'];
|
|
672
|
-
|
|
673
548
|
var isType = function isType(value) {
|
|
674
549
|
return types.includes(value);
|
|
675
|
-
};
|
|
550
|
+
};
|
|
551
|
+
// Converts different hook registration formats into the
|
|
676
552
|
// same internal format
|
|
677
|
-
|
|
678
|
-
|
|
679
553
|
function convertHookData(input) {
|
|
680
554
|
var result = {};
|
|
681
|
-
|
|
682
555
|
if (Array.isArray(input)) {
|
|
683
556
|
result.all = input;
|
|
684
557
|
} else if (_typeof(input) !== 'object') {
|
|
@@ -690,21 +563,17 @@ function convertHookData(input) {
|
|
|
690
563
|
result[key] = Array.isArray(value) ? value : [value];
|
|
691
564
|
}
|
|
692
565
|
}
|
|
693
|
-
|
|
694
566
|
return result;
|
|
695
567
|
}
|
|
696
|
-
|
|
697
568
|
exports.convertHookData = convertHookData;
|
|
698
|
-
|
|
699
569
|
function collectHooks(target, method) {
|
|
700
570
|
var _target$__hooks = target.__hooks,
|
|
701
|
-
|
|
702
|
-
|
|
571
|
+
collected = _target$__hooks.collected,
|
|
572
|
+
around = _target$__hooks.around;
|
|
703
573
|
return [].concat(_toConsumableArray(around.all || []), _toConsumableArray(around[method] || []), _toConsumableArray(collected.all || []), _toConsumableArray(collected[method] || []));
|
|
704
574
|
}
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
575
|
+
exports.collectHooks = collectHooks;
|
|
576
|
+
// Add `.hooks` functionality to an object
|
|
708
577
|
function enableHooks(object) {
|
|
709
578
|
var store = {
|
|
710
579
|
around: {},
|
|
@@ -724,7 +593,6 @@ function enableHooks(object) {
|
|
|
724
593
|
if (!isType(type)) {
|
|
725
594
|
throw new Error("'".concat(type, "' is not a valid hook type"));
|
|
726
595
|
}
|
|
727
|
-
|
|
728
596
|
map[type] = convertHookData(input[type]);
|
|
729
597
|
return map;
|
|
730
598
|
}, {});
|
|
@@ -732,11 +600,9 @@ function enableHooks(object) {
|
|
|
732
600
|
types.forEach(function (type) {
|
|
733
601
|
return Object.keys(map[type]).forEach(function (method) {
|
|
734
602
|
var _a;
|
|
735
|
-
|
|
736
603
|
var mapHooks = map[type][method];
|
|
737
604
|
var storeHooks = (_a = store[type])[method] || (_a[method] = []);
|
|
738
605
|
storeHooks.push.apply(storeHooks, _toConsumableArray(mapHooks));
|
|
739
|
-
|
|
740
606
|
if (store.before[method] || store.after[method] || store.error[method]) {
|
|
741
607
|
var collected = (0, hooks_1.collect)({
|
|
742
608
|
before: store.before[method] || [],
|
|
@@ -750,46 +616,33 @@ function enableHooks(object) {
|
|
|
750
616
|
return this;
|
|
751
617
|
};
|
|
752
618
|
}
|
|
753
|
-
|
|
754
619
|
exports.enableHooks = enableHooks;
|
|
755
|
-
|
|
756
620
|
function createContext(service, method) {
|
|
757
621
|
var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
758
622
|
var createContext = service[method].createContext;
|
|
759
|
-
|
|
760
623
|
if (typeof createContext !== 'function') {
|
|
761
624
|
throw new Error("Can not create context for method ".concat(method));
|
|
762
625
|
}
|
|
763
|
-
|
|
764
626
|
return createContext(data);
|
|
765
627
|
}
|
|
766
|
-
|
|
767
628
|
exports.createContext = createContext;
|
|
768
|
-
|
|
769
629
|
var FeathersHookManager = /*#__PURE__*/function (_hooks_1$HookManager) {
|
|
770
630
|
_inherits(FeathersHookManager, _hooks_1$HookManager);
|
|
771
|
-
|
|
772
631
|
var _super = _createSuper(FeathersHookManager);
|
|
773
|
-
|
|
774
632
|
function FeathersHookManager(app, method) {
|
|
775
633
|
var _this;
|
|
776
|
-
|
|
777
634
|
_classCallCheck(this, FeathersHookManager);
|
|
778
|
-
|
|
779
635
|
_this = _super.call(this);
|
|
780
636
|
_this.app = app;
|
|
781
637
|
_this.method = method;
|
|
782
638
|
_this._middleware = [];
|
|
783
639
|
return _this;
|
|
784
640
|
}
|
|
785
|
-
|
|
786
641
|
_createClass(FeathersHookManager, [{
|
|
787
642
|
key: "collectMiddleware",
|
|
788
643
|
value: function collectMiddleware(self, args) {
|
|
789
644
|
var appHooks = collectHooks(this.app, this.method);
|
|
790
|
-
|
|
791
645
|
var middleware = _get(_getPrototypeOf(FeathersHookManager.prototype), "collectMiddleware", this).call(this, self, args);
|
|
792
|
-
|
|
793
646
|
var methodHooks = collectHooks(self, this.method);
|
|
794
647
|
return [].concat(_toConsumableArray(appHooks), _toConsumableArray(middleware), _toConsumableArray(methodHooks));
|
|
795
648
|
}
|
|
@@ -797,7 +650,6 @@ var FeathersHookManager = /*#__PURE__*/function (_hooks_1$HookManager) {
|
|
|
797
650
|
key: "initializeContext",
|
|
798
651
|
value: function initializeContext(self, args, context) {
|
|
799
652
|
var ctx = _get(_getPrototypeOf(FeathersHookManager.prototype), "initializeContext", this).call(this, self, args, context);
|
|
800
|
-
|
|
801
653
|
ctx.params = ctx.params || {};
|
|
802
654
|
return ctx;
|
|
803
655
|
}
|
|
@@ -805,29 +657,21 @@ var FeathersHookManager = /*#__PURE__*/function (_hooks_1$HookManager) {
|
|
|
805
657
|
key: "middleware",
|
|
806
658
|
value: function middleware(mw) {
|
|
807
659
|
var _this$_middleware;
|
|
808
|
-
|
|
809
660
|
(_this$_middleware = this._middleware).push.apply(_this$_middleware, _toConsumableArray(mw));
|
|
810
|
-
|
|
811
661
|
return this;
|
|
812
662
|
}
|
|
813
663
|
}]);
|
|
814
|
-
|
|
815
664
|
return FeathersHookManager;
|
|
816
665
|
}(hooks_1.HookManager);
|
|
817
|
-
|
|
818
666
|
exports.FeathersHookManager = FeathersHookManager;
|
|
819
|
-
|
|
820
667
|
function hookMixin(service, path, options) {
|
|
821
668
|
var _this2 = this;
|
|
822
|
-
|
|
823
669
|
if (typeof service.hooks === 'function') {
|
|
824
670
|
return service;
|
|
825
671
|
}
|
|
826
|
-
|
|
827
672
|
var hookMethods = (0, service_1.getHookMethods)(service, options);
|
|
828
673
|
var serviceMethodHooks = hookMethods.reduce(function (res, method) {
|
|
829
674
|
var _FeathersHookManager;
|
|
830
|
-
|
|
831
675
|
var params = service_1.defaultServiceArguments[method] || ['data', 'params'];
|
|
832
676
|
res[method] = (_FeathersHookManager = new FeathersHookManager(_this2, method)).params.apply(_FeathersHookManager, _toConsumableArray(params)).props({
|
|
833
677
|
app: _this2,
|
|
@@ -836,50 +680,38 @@ function hookMixin(service, path, options) {
|
|
|
836
680
|
service: service,
|
|
837
681
|
event: null,
|
|
838
682
|
type: null,
|
|
839
|
-
|
|
840
683
|
get statusCode() {
|
|
841
684
|
var _a;
|
|
842
|
-
|
|
843
685
|
return (_a = this.http) === null || _a === void 0 ? void 0 : _a.status;
|
|
844
686
|
},
|
|
845
|
-
|
|
846
687
|
set statusCode(value) {
|
|
847
688
|
this.http = this.http || {};
|
|
848
689
|
this.http.status = value;
|
|
849
690
|
}
|
|
850
|
-
|
|
851
691
|
});
|
|
852
692
|
return res;
|
|
853
693
|
}, {});
|
|
854
694
|
var registerHooks = enableHooks(service);
|
|
855
695
|
(0, hooks_1.hooks)(service, serviceMethodHooks);
|
|
856
|
-
|
|
857
696
|
service.hooks = function (hookOptions) {
|
|
858
697
|
var _this3 = this;
|
|
859
|
-
|
|
860
698
|
if (hookOptions.before || hookOptions.after || hookOptions.error || hookOptions.around) {
|
|
861
699
|
return registerHooks.call(this, hookOptions);
|
|
862
700
|
}
|
|
863
|
-
|
|
864
701
|
if (Array.isArray(hookOptions)) {
|
|
865
702
|
return (0, hooks_1.hooks)(this, hookOptions);
|
|
866
703
|
}
|
|
867
|
-
|
|
868
704
|
Object.keys(hookOptions).forEach(function (method) {
|
|
869
705
|
var manager = (0, hooks_1.getManager)(_this3[method]);
|
|
870
|
-
|
|
871
706
|
if (!(manager instanceof FeathersHookManager)) {
|
|
872
707
|
throw new Error("Method ".concat(method, " is not a Feathers hooks enabled service method"));
|
|
873
708
|
}
|
|
874
|
-
|
|
875
709
|
manager.middleware(hookOptions[method]);
|
|
876
710
|
});
|
|
877
711
|
return this;
|
|
878
712
|
};
|
|
879
|
-
|
|
880
713
|
return service;
|
|
881
714
|
}
|
|
882
|
-
|
|
883
715
|
exports.hookMixin = hookMixin;
|
|
884
716
|
|
|
885
717
|
/***/ }),
|
|
@@ -895,7 +727,6 @@ exports.hookMixin = hookMixin;
|
|
|
895
727
|
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
896
728
|
if (k2 === undefined) k2 = k;
|
|
897
729
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
898
|
-
|
|
899
730
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
900
731
|
desc = {
|
|
901
732
|
enumerable: true,
|
|
@@ -904,58 +735,43 @@ var __createBinding = this && this.__createBinding || (Object.create ? function
|
|
|
904
735
|
}
|
|
905
736
|
};
|
|
906
737
|
}
|
|
907
|
-
|
|
908
738
|
Object.defineProperty(o, k2, desc);
|
|
909
739
|
} : function (o, m, k, k2) {
|
|
910
740
|
if (k2 === undefined) k2 = k;
|
|
911
741
|
o[k2] = m[k];
|
|
912
742
|
});
|
|
913
|
-
|
|
914
743
|
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
915
744
|
for (var p in m) {
|
|
916
745
|
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
917
746
|
}
|
|
918
747
|
};
|
|
919
|
-
|
|
920
748
|
var __importDefault = this && this.__importDefault || function (mod) {
|
|
921
749
|
return mod && mod.__esModule ? mod : {
|
|
922
750
|
"default": mod
|
|
923
751
|
};
|
|
924
752
|
};
|
|
925
|
-
|
|
926
753
|
Object.defineProperty(exports, "__esModule", ({
|
|
927
754
|
value: true
|
|
928
755
|
}));
|
|
929
756
|
exports.Feathers = exports.version = exports.feathers = void 0;
|
|
930
|
-
|
|
931
757
|
var commons_1 = __webpack_require__(/*! @feathersjs/commons */ "../commons/lib/index.js");
|
|
932
|
-
|
|
933
758
|
var version_1 = __importDefault(__webpack_require__(/*! ./version */ "../feathers/lib/version.js"));
|
|
934
|
-
|
|
935
759
|
exports.version = version_1.default;
|
|
936
|
-
|
|
937
760
|
var application_1 = __webpack_require__(/*! ./application */ "../feathers/lib/application.js");
|
|
938
|
-
|
|
939
761
|
Object.defineProperty(exports, "Feathers", ({
|
|
940
762
|
enumerable: true,
|
|
941
763
|
get: function get() {
|
|
942
764
|
return application_1.Feathers;
|
|
943
765
|
}
|
|
944
766
|
}));
|
|
945
|
-
|
|
946
767
|
function feathers() {
|
|
947
768
|
return new application_1.Feathers();
|
|
948
769
|
}
|
|
949
|
-
|
|
950
770
|
exports.feathers = feathers;
|
|
951
771
|
feathers.setDebug = commons_1.setDebug;
|
|
952
|
-
|
|
953
772
|
__exportStar(__webpack_require__(/*! ./hooks */ "../feathers/lib/hooks.js"), exports);
|
|
954
|
-
|
|
955
773
|
__exportStar(__webpack_require__(/*! ./declarations */ "../feathers/lib/declarations.js"), exports);
|
|
956
|
-
|
|
957
774
|
__exportStar(__webpack_require__(/*! ./service */ "../feathers/lib/service.js"), exports);
|
|
958
|
-
|
|
959
775
|
if (true) {
|
|
960
776
|
module.exports = Object.assign(feathers, module.exports);
|
|
961
777
|
}
|
|
@@ -971,20 +787,14 @@ if (true) {
|
|
|
971
787
|
|
|
972
788
|
|
|
973
789
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
974
|
-
|
|
975
790
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
976
|
-
|
|
977
791
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
978
|
-
|
|
979
792
|
Object.defineProperty(exports, "__esModule", ({
|
|
980
793
|
value: true
|
|
981
794
|
}));
|
|
982
795
|
exports.wrapService = exports.getServiceOptions = exports.getHookMethods = exports.protectedMethods = exports.defaultEventMap = exports.defaultServiceMethods = exports.defaultServiceArguments = exports.SERVICE = void 0;
|
|
983
|
-
|
|
984
796
|
var events_1 = __webpack_require__(/*! events */ "../../node_modules/events/events.js");
|
|
985
|
-
|
|
986
797
|
var commons_1 = __webpack_require__(/*! @feathersjs/commons */ "../commons/lib/index.js");
|
|
987
|
-
|
|
988
798
|
exports.SERVICE = (0, commons_1.createSymbol)('@feathersjs/service');
|
|
989
799
|
exports.defaultServiceArguments = {
|
|
990
800
|
find: ['params'],
|
|
@@ -994,7 +804,7 @@ exports.defaultServiceArguments = {
|
|
|
994
804
|
patch: ['id', 'data', 'params'],
|
|
995
805
|
remove: ['id', 'params']
|
|
996
806
|
};
|
|
997
|
-
exports.defaultServiceMethods =
|
|
807
|
+
exports.defaultServiceMethods = ['find', 'get', 'create', 'update', 'patch', 'remove'];
|
|
998
808
|
exports.defaultEventMap = {
|
|
999
809
|
create: 'created',
|
|
1000
810
|
update: 'updated',
|
|
@@ -1002,60 +812,49 @@ exports.defaultEventMap = {
|
|
|
1002
812
|
remove: 'removed'
|
|
1003
813
|
};
|
|
1004
814
|
exports.protectedMethods = Object.keys(Object.prototype).concat(Object.keys(events_1.EventEmitter.prototype)).concat(['all', 'around', 'before', 'after', 'error', 'hooks', 'setup', 'teardown', 'publish']);
|
|
1005
|
-
|
|
1006
815
|
function getHookMethods(service, options) {
|
|
1007
816
|
var methods = options.methods;
|
|
1008
817
|
return exports.defaultServiceMethods.filter(function (m) {
|
|
1009
818
|
return typeof service[m] === 'function' && !methods.includes(m);
|
|
1010
819
|
}).concat(methods);
|
|
1011
820
|
}
|
|
1012
|
-
|
|
1013
821
|
exports.getHookMethods = getHookMethods;
|
|
1014
|
-
|
|
1015
822
|
function getServiceOptions(service) {
|
|
1016
823
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1017
824
|
var existingOptions = service[exports.SERVICE];
|
|
1018
|
-
|
|
1019
825
|
if (existingOptions) {
|
|
1020
826
|
return existingOptions;
|
|
1021
827
|
}
|
|
1022
|
-
|
|
1023
828
|
var _options$methods = options.methods,
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
829
|
+
methods = _options$methods === void 0 ? exports.defaultServiceMethods.filter(function (method) {
|
|
830
|
+
return typeof service[method] === 'function';
|
|
831
|
+
}) : _options$methods,
|
|
832
|
+
_options$events = options.events,
|
|
833
|
+
events = _options$events === void 0 ? service.events || [] : _options$events;
|
|
1029
834
|
var _options$serviceEvent = options.serviceEvents,
|
|
1030
|
-
|
|
835
|
+
serviceEvents = _options$serviceEvent === void 0 ? Object.values(exports.defaultEventMap).concat(events) : _options$serviceEvent;
|
|
1031
836
|
return _objectSpread(_objectSpread({}, options), {}, {
|
|
1032
837
|
events: events,
|
|
1033
838
|
methods: methods,
|
|
1034
839
|
serviceEvents: serviceEvents
|
|
1035
840
|
});
|
|
1036
841
|
}
|
|
1037
|
-
|
|
1038
842
|
exports.getServiceOptions = getServiceOptions;
|
|
1039
|
-
|
|
1040
843
|
function wrapService(location, service, options) {
|
|
1041
844
|
// Do nothing if this is already an initialized
|
|
1042
845
|
if (service[exports.SERVICE]) {
|
|
1043
846
|
return service;
|
|
1044
847
|
}
|
|
1045
|
-
|
|
1046
848
|
var protoService = Object.create(service);
|
|
1047
849
|
var serviceOptions = getServiceOptions(service, options);
|
|
1048
|
-
|
|
1049
850
|
if (Object.keys(serviceOptions.methods).length === 0 && typeof service.setup !== 'function') {
|
|
1050
851
|
throw new Error("Invalid service object passed for path `".concat(location, "`"));
|
|
1051
852
|
}
|
|
1052
|
-
|
|
1053
853
|
Object.defineProperty(protoService, exports.SERVICE, {
|
|
1054
854
|
value: serviceOptions
|
|
1055
855
|
});
|
|
1056
856
|
return protoService;
|
|
1057
857
|
}
|
|
1058
|
-
|
|
1059
858
|
exports.wrapService = wrapService;
|
|
1060
859
|
|
|
1061
860
|
/***/ }),
|
|
@@ -1618,44 +1417,28 @@ __exportStar(__webpack_require__(/*! @feathersjs/feathers */ "../feathers/lib/in
|
|
|
1618
1417
|
|
|
1619
1418
|
|
|
1620
1419
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
1621
|
-
|
|
1622
1420
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
1623
|
-
|
|
1624
1421
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
1625
|
-
|
|
1626
1422
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
1627
|
-
|
|
1628
1423
|
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
1629
|
-
|
|
1630
1424
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
1631
|
-
|
|
1632
1425
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
1633
|
-
|
|
1634
1426
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
1635
|
-
|
|
1636
1427
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
1637
|
-
|
|
1638
1428
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
1639
|
-
|
|
1640
1429
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1641
|
-
|
|
1642
1430
|
Object.defineProperty(exports, "__esModule", ({
|
|
1643
1431
|
value: true
|
|
1644
1432
|
}));
|
|
1645
1433
|
exports.setMiddleware = exports.getMiddleware = exports.setManager = exports.getManager = exports.convertOptions = exports.HookManager = exports.BaseHookContext = exports.HOOKS = void 0;
|
|
1646
|
-
|
|
1647
1434
|
var utils_js_1 = __webpack_require__(/*! ./utils.js */ "../../node_modules/@feathersjs/hooks/script/utils.js");
|
|
1648
|
-
|
|
1649
1435
|
exports.HOOKS = Symbol('@feathersjs/hooks');
|
|
1650
1436
|
/**
|
|
1651
1437
|
* The base hook context.
|
|
1652
1438
|
*/
|
|
1653
|
-
|
|
1654
1439
|
var BaseHookContext = /*#__PURE__*/_createClass(function BaseHookContext() {
|
|
1655
1440
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1656
|
-
|
|
1657
1441
|
_classCallCheck(this, BaseHookContext);
|
|
1658
|
-
|
|
1659
1442
|
Object.defineProperty(this, "self", {
|
|
1660
1443
|
enumerable: true,
|
|
1661
1444
|
configurable: true,
|
|
@@ -1664,13 +1447,10 @@ var BaseHookContext = /*#__PURE__*/_createClass(function BaseHookContext() {
|
|
|
1664
1447
|
});
|
|
1665
1448
|
Object.assign(this, data);
|
|
1666
1449
|
});
|
|
1667
|
-
|
|
1668
1450
|
exports.BaseHookContext = BaseHookContext;
|
|
1669
|
-
|
|
1670
1451
|
var HookManager = /*#__PURE__*/function () {
|
|
1671
1452
|
function HookManager() {
|
|
1672
1453
|
_classCallCheck(this, HookManager);
|
|
1673
|
-
|
|
1674
1454
|
Object.defineProperty(this, "_parent", {
|
|
1675
1455
|
enumerable: true,
|
|
1676
1456
|
configurable: true,
|
|
@@ -1702,7 +1482,6 @@ var HookManager = /*#__PURE__*/function () {
|
|
|
1702
1482
|
value: void 0
|
|
1703
1483
|
});
|
|
1704
1484
|
}
|
|
1705
|
-
|
|
1706
1485
|
_createClass(HookManager, [{
|
|
1707
1486
|
key: "parent",
|
|
1708
1487
|
value: function parent(_parent) {
|
|
@@ -1719,13 +1498,10 @@ var HookManager = /*#__PURE__*/function () {
|
|
|
1719
1498
|
key: "getMiddleware",
|
|
1720
1499
|
value: function getMiddleware() {
|
|
1721
1500
|
var _this$_parent;
|
|
1722
|
-
|
|
1723
1501
|
var previous = (_this$_parent = this._parent) === null || _this$_parent === void 0 ? void 0 : _this$_parent.getMiddleware();
|
|
1724
|
-
|
|
1725
1502
|
if (previous && this._middleware) {
|
|
1726
1503
|
return previous.concat(this._middleware);
|
|
1727
1504
|
}
|
|
1728
|
-
|
|
1729
1505
|
return previous || this._middleware;
|
|
1730
1506
|
}
|
|
1731
1507
|
}, {
|
|
@@ -1733,11 +1509,9 @@ var HookManager = /*#__PURE__*/function () {
|
|
|
1733
1509
|
value: function collectMiddleware(self, _args) {
|
|
1734
1510
|
var otherMiddleware = getMiddleware(self);
|
|
1735
1511
|
var middleware = this.getMiddleware();
|
|
1736
|
-
|
|
1737
1512
|
if (otherMiddleware && middleware) {
|
|
1738
1513
|
return otherMiddleware.concat(middleware);
|
|
1739
1514
|
}
|
|
1740
|
-
|
|
1741
1515
|
return otherMiddleware || middleware || [];
|
|
1742
1516
|
}
|
|
1743
1517
|
}, {
|
|
@@ -1746,7 +1520,6 @@ var HookManager = /*#__PURE__*/function () {
|
|
|
1746
1520
|
if (!this._props) {
|
|
1747
1521
|
this._props = {};
|
|
1748
1522
|
}
|
|
1749
|
-
|
|
1750
1523
|
(0, utils_js_1.copyProperties)(this._props, _props);
|
|
1751
1524
|
return this;
|
|
1752
1525
|
}
|
|
@@ -1754,13 +1527,10 @@ var HookManager = /*#__PURE__*/function () {
|
|
|
1754
1527
|
key: "getProps",
|
|
1755
1528
|
value: function getProps() {
|
|
1756
1529
|
var _this$_parent2;
|
|
1757
|
-
|
|
1758
1530
|
var previous = (_this$_parent2 = this._parent) === null || _this$_parent2 === void 0 ? void 0 : _this$_parent2.getProps();
|
|
1759
|
-
|
|
1760
1531
|
if (previous && this._props) {
|
|
1761
1532
|
return (0, utils_js_1.copyProperties)({}, previous, this._props);
|
|
1762
1533
|
}
|
|
1763
|
-
|
|
1764
1534
|
return previous || this._props || null;
|
|
1765
1535
|
}
|
|
1766
1536
|
}, {
|
|
@@ -1769,7 +1539,6 @@ var HookManager = /*#__PURE__*/function () {
|
|
|
1769
1539
|
for (var _len = arguments.length, _params = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1770
1540
|
_params[_key] = arguments[_key];
|
|
1771
1541
|
}
|
|
1772
|
-
|
|
1773
1542
|
this._params = _params;
|
|
1774
1543
|
return this;
|
|
1775
1544
|
}
|
|
@@ -1777,13 +1546,10 @@ var HookManager = /*#__PURE__*/function () {
|
|
|
1777
1546
|
key: "getParams",
|
|
1778
1547
|
value: function getParams() {
|
|
1779
1548
|
var _this$_parent3;
|
|
1780
|
-
|
|
1781
1549
|
var previous = (_this$_parent3 = this._parent) === null || _this$_parent3 === void 0 ? void 0 : _this$_parent3.getParams();
|
|
1782
|
-
|
|
1783
1550
|
if (previous && this._params) {
|
|
1784
1551
|
return previous.concat(this._params);
|
|
1785
1552
|
}
|
|
1786
|
-
|
|
1787
1553
|
return previous || this._params;
|
|
1788
1554
|
}
|
|
1789
1555
|
}, {
|
|
@@ -1796,48 +1562,36 @@ var HookManager = /*#__PURE__*/function () {
|
|
|
1796
1562
|
key: "getDefaults",
|
|
1797
1563
|
value: function getDefaults(self, args, context) {
|
|
1798
1564
|
var _this$_parent4;
|
|
1799
|
-
|
|
1800
1565
|
var defaults = typeof this._defaults === 'function' ? this._defaults(self, args, context) : null;
|
|
1801
1566
|
var previous = (_this$_parent4 = this._parent) === null || _this$_parent4 === void 0 ? void 0 : _this$_parent4.getDefaults(self, args, context);
|
|
1802
|
-
|
|
1803
1567
|
if (previous && defaults) {
|
|
1804
1568
|
return Object.assign({}, previous, defaults);
|
|
1805
1569
|
}
|
|
1806
|
-
|
|
1807
1570
|
return previous || defaults;
|
|
1808
1571
|
}
|
|
1809
1572
|
}, {
|
|
1810
1573
|
key: "getContextClass",
|
|
1811
1574
|
value: function getContextClass() {
|
|
1812
1575
|
var Base = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : BaseHookContext;
|
|
1813
|
-
|
|
1814
1576
|
var ContextClass = /*#__PURE__*/function (_Base) {
|
|
1815
1577
|
_inherits(ContextClass, _Base);
|
|
1816
|
-
|
|
1817
1578
|
var _super = _createSuper(ContextClass);
|
|
1818
|
-
|
|
1819
1579
|
function ContextClass(data) {
|
|
1820
1580
|
var _this;
|
|
1821
|
-
|
|
1822
1581
|
_classCallCheck(this, ContextClass);
|
|
1823
|
-
|
|
1824
1582
|
_this = _super.call(this, data);
|
|
1825
1583
|
(0, utils_js_1.copyToSelf)(_assertThisInitialized(_this));
|
|
1826
1584
|
return _this;
|
|
1827
1585
|
}
|
|
1828
|
-
|
|
1829
1586
|
return _createClass(ContextClass);
|
|
1830
1587
|
}(Base);
|
|
1831
|
-
|
|
1832
1588
|
var params = this.getParams();
|
|
1833
1589
|
var props = this.getProps();
|
|
1834
|
-
|
|
1835
1590
|
if (params) {
|
|
1836
1591
|
params.forEach(function (name, index) {
|
|
1837
1592
|
if ((props === null || props === void 0 ? void 0 : props[name]) !== undefined) {
|
|
1838
1593
|
throw new Error("Hooks can not have a property and param named '".concat(name, "'. Use .defaults instead."));
|
|
1839
1594
|
}
|
|
1840
|
-
|
|
1841
1595
|
Object.defineProperty(ContextClass.prototype, name, {
|
|
1842
1596
|
enumerable: true,
|
|
1843
1597
|
get: function get() {
|
|
@@ -1849,11 +1603,9 @@ var HookManager = /*#__PURE__*/function () {
|
|
|
1849
1603
|
});
|
|
1850
1604
|
});
|
|
1851
1605
|
}
|
|
1852
|
-
|
|
1853
1606
|
if (props) {
|
|
1854
1607
|
(0, utils_js_1.copyProperties)(ContextClass.prototype, props);
|
|
1855
1608
|
}
|
|
1856
|
-
|
|
1857
1609
|
return ContextClass;
|
|
1858
1610
|
}
|
|
1859
1611
|
}, {
|
|
@@ -1861,70 +1613,51 @@ var HookManager = /*#__PURE__*/function () {
|
|
|
1861
1613
|
value: function initializeContext(self, args, context) {
|
|
1862
1614
|
var ctx = this._parent ? this._parent.initializeContext(self, args, context) : context;
|
|
1863
1615
|
var defaults = this.getDefaults(self, args, ctx);
|
|
1864
|
-
|
|
1865
1616
|
if (self) {
|
|
1866
1617
|
ctx.self = self;
|
|
1867
1618
|
}
|
|
1868
|
-
|
|
1869
1619
|
ctx.arguments = args;
|
|
1870
|
-
|
|
1871
1620
|
if (defaults) {
|
|
1872
1621
|
for (var _i = 0, _Object$keys = Object.keys(defaults); _i < _Object$keys.length; _i++) {
|
|
1873
1622
|
var name = _Object$keys[_i];
|
|
1874
|
-
|
|
1875
1623
|
if (ctx[name] === undefined) {
|
|
1876
1624
|
ctx[name] = defaults[name];
|
|
1877
1625
|
}
|
|
1878
1626
|
}
|
|
1879
1627
|
}
|
|
1880
|
-
|
|
1881
1628
|
return ctx;
|
|
1882
1629
|
}
|
|
1883
1630
|
}]);
|
|
1884
|
-
|
|
1885
1631
|
return HookManager;
|
|
1886
1632
|
}();
|
|
1887
|
-
|
|
1888
1633
|
exports.HookManager = HookManager;
|
|
1889
|
-
|
|
1890
1634
|
function convertOptions() {
|
|
1891
1635
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
1892
|
-
|
|
1893
1636
|
if (!options) {
|
|
1894
1637
|
return new HookManager();
|
|
1895
1638
|
}
|
|
1896
|
-
|
|
1897
1639
|
return Array.isArray(options) ? new HookManager().middleware(options) : options;
|
|
1898
1640
|
}
|
|
1899
|
-
|
|
1900
1641
|
exports.convertOptions = convertOptions;
|
|
1901
|
-
|
|
1902
1642
|
function getManager(target) {
|
|
1903
1643
|
return target && target[exports.HOOKS] || null;
|
|
1904
1644
|
}
|
|
1905
|
-
|
|
1906
1645
|
exports.getManager = getManager;
|
|
1907
|
-
|
|
1908
1646
|
function setManager(target, manager) {
|
|
1909
1647
|
var parent = getManager(target);
|
|
1910
1648
|
target[exports.HOOKS] = manager.parent(parent);
|
|
1911
1649
|
return target;
|
|
1912
1650
|
}
|
|
1913
|
-
|
|
1914
1651
|
exports.setManager = setManager;
|
|
1915
|
-
|
|
1916
1652
|
function getMiddleware(target) {
|
|
1917
1653
|
var manager = getManager(target);
|
|
1918
1654
|
return manager ? manager.getMiddleware() : null;
|
|
1919
1655
|
}
|
|
1920
|
-
|
|
1921
1656
|
exports.getMiddleware = getMiddleware;
|
|
1922
|
-
|
|
1923
1657
|
function setMiddleware(target, middleware) {
|
|
1924
1658
|
var manager = new HookManager().middleware(middleware);
|
|
1925
1659
|
return setManager(target, manager);
|
|
1926
1660
|
}
|
|
1927
|
-
|
|
1928
1661
|
exports.setMiddleware = setMiddleware;
|
|
1929
1662
|
|
|
1930
1663
|
/***/ }),
|
|
@@ -1938,28 +1671,21 @@ exports.setMiddleware = setMiddleware;
|
|
|
1938
1671
|
|
|
1939
1672
|
|
|
1940
1673
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
1941
|
-
|
|
1942
1674
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
1943
|
-
|
|
1944
1675
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
1945
|
-
|
|
1946
1676
|
Object.defineProperty(exports, "__esModule", ({
|
|
1947
1677
|
value: true
|
|
1948
1678
|
}));
|
|
1949
1679
|
exports.compose = void 0;
|
|
1950
|
-
|
|
1951
1680
|
function compose(middleware) {
|
|
1952
1681
|
if (!Array.isArray(middleware)) {
|
|
1953
1682
|
throw new TypeError('Middleware stack must be an array!');
|
|
1954
1683
|
}
|
|
1955
|
-
|
|
1956
1684
|
var _iterator = _createForOfIteratorHelper(middleware),
|
|
1957
|
-
|
|
1958
|
-
|
|
1685
|
+
_step;
|
|
1959
1686
|
try {
|
|
1960
1687
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
1961
1688
|
var fn = _step.value;
|
|
1962
|
-
|
|
1963
1689
|
if (typeof fn !== 'function') {
|
|
1964
1690
|
throw new TypeError('Middleware must be composed of functions!');
|
|
1965
1691
|
}
|
|
@@ -1969,28 +1695,22 @@ function compose(middleware) {
|
|
|
1969
1695
|
} finally {
|
|
1970
1696
|
_iterator.f();
|
|
1971
1697
|
}
|
|
1972
|
-
|
|
1973
1698
|
return function (context, next) {
|
|
1974
1699
|
// last called middleware #
|
|
1975
1700
|
var index = -1;
|
|
1976
1701
|
return dispatch.call(this, 0);
|
|
1977
|
-
|
|
1978
1702
|
function dispatch(i) {
|
|
1979
1703
|
if (i <= index) {
|
|
1980
1704
|
return Promise.reject(new Error('next() called multiple times'));
|
|
1981
1705
|
}
|
|
1982
|
-
|
|
1983
1706
|
index = i;
|
|
1984
1707
|
var fn = middleware[i];
|
|
1985
|
-
|
|
1986
1708
|
if (i === middleware.length) {
|
|
1987
1709
|
fn = next;
|
|
1988
1710
|
}
|
|
1989
|
-
|
|
1990
1711
|
if (!fn) {
|
|
1991
1712
|
return Promise.resolve();
|
|
1992
1713
|
}
|
|
1993
|
-
|
|
1994
1714
|
try {
|
|
1995
1715
|
return Promise.resolve(fn.call(this, context, dispatch.bind(this, i + 1)));
|
|
1996
1716
|
} catch (err) {
|
|
@@ -1999,7 +1719,6 @@ function compose(middleware) {
|
|
|
1999
1719
|
}
|
|
2000
1720
|
};
|
|
2001
1721
|
}
|
|
2002
|
-
|
|
2003
1722
|
exports.compose = compose;
|
|
2004
1723
|
|
|
2005
1724
|
/***/ }),
|
|
@@ -2016,56 +1735,45 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
2016
1735
|
value: true
|
|
2017
1736
|
}));
|
|
2018
1737
|
exports.hookDecorator = exports.objectHooks = exports.functionHooks = exports.getOriginal = void 0;
|
|
2019
|
-
|
|
2020
1738
|
var compose_js_1 = __webpack_require__(/*! ./compose.js */ "../../node_modules/@feathersjs/hooks/script/compose.js");
|
|
2021
|
-
|
|
2022
1739
|
var base_js_1 = __webpack_require__(/*! ./base.js */ "../../node_modules/@feathersjs/hooks/script/base.js");
|
|
2023
|
-
|
|
2024
1740
|
var utils_js_1 = __webpack_require__(/*! ./utils.js */ "../../node_modules/@feathersjs/hooks/script/utils.js");
|
|
2025
|
-
|
|
2026
1741
|
function getOriginal(fn) {
|
|
2027
1742
|
return typeof fn.original === 'function' ? getOriginal(fn.original) : fn;
|
|
2028
1743
|
}
|
|
2029
|
-
|
|
2030
1744
|
exports.getOriginal = getOriginal;
|
|
2031
|
-
|
|
2032
1745
|
function functionHooks(fn, managerOrMiddleware) {
|
|
2033
1746
|
if (typeof fn !== 'function') {
|
|
2034
1747
|
throw new Error('Can not apply hooks to non-function');
|
|
2035
1748
|
}
|
|
2036
|
-
|
|
2037
1749
|
var manager = (0, base_js_1.convertOptions)(managerOrMiddleware);
|
|
2038
|
-
|
|
2039
1750
|
var wrapper = function wrapper() {
|
|
2040
1751
|
var _this = this;
|
|
2041
|
-
|
|
2042
1752
|
var Context = wrapper.Context,
|
|
2043
|
-
|
|
2044
|
-
|
|
1753
|
+
original = wrapper.original;
|
|
1754
|
+
// If we got passed an existing HookContext instance, we want to return it as well
|
|
2045
1755
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2046
1756
|
args[_key] = arguments[_key];
|
|
2047
1757
|
}
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
1758
|
+
var returnContext = args[args.length - 1] instanceof Context;
|
|
1759
|
+
// Use existing context or default
|
|
1760
|
+
var base = returnContext ? args.pop() : new Context();
|
|
1761
|
+
// Initialize the context
|
|
1762
|
+
var context = manager.initializeContext(this, args, base);
|
|
1763
|
+
// Assemble the hook chain
|
|
1764
|
+
var hookChain = [
|
|
1765
|
+
// Return `ctx.result` or the context
|
|
2056
1766
|
function (ctx, next) {
|
|
2057
1767
|
return next().then(function () {
|
|
2058
1768
|
return returnContext ? ctx : ctx.result;
|
|
2059
1769
|
});
|
|
2060
|
-
}];
|
|
2061
|
-
|
|
1770
|
+
}];
|
|
1771
|
+
// Create the hook chain by calling the `collectMiddleware function
|
|
2062
1772
|
var mw = manager.collectMiddleware(this, args);
|
|
2063
|
-
|
|
2064
1773
|
if (mw) {
|
|
2065
1774
|
Array.prototype.push.apply(hookChain, mw);
|
|
2066
|
-
}
|
|
2067
|
-
|
|
2068
|
-
|
|
1775
|
+
}
|
|
1776
|
+
// Runs the actual original method if `ctx.result` is not already set
|
|
2069
1777
|
hookChain.push(function (ctx, next) {
|
|
2070
1778
|
if (!Object.prototype.hasOwnProperty.call(context, 'result')) {
|
|
2071
1779
|
return Promise.resolve(original.apply(_this, ctx.arguments)).then(function (result) {
|
|
@@ -2073,12 +1781,10 @@ function functionHooks(fn, managerOrMiddleware) {
|
|
|
2073
1781
|
return next();
|
|
2074
1782
|
});
|
|
2075
1783
|
}
|
|
2076
|
-
|
|
2077
1784
|
return next();
|
|
2078
1785
|
});
|
|
2079
1786
|
return (0, compose_js_1.compose)(hookChain).call(this, context);
|
|
2080
1787
|
};
|
|
2081
|
-
|
|
2082
1788
|
(0, utils_js_1.copyFnProperties)(wrapper, fn);
|
|
2083
1789
|
(0, utils_js_1.copyProperties)(wrapper, fn);
|
|
2084
1790
|
(0, base_js_1.setManager)(wrapper, manager);
|
|
@@ -2091,58 +1797,44 @@ function functionHooks(fn, managerOrMiddleware) {
|
|
|
2091
1797
|
}
|
|
2092
1798
|
});
|
|
2093
1799
|
}
|
|
2094
|
-
|
|
2095
1800
|
exports.functionHooks = functionHooks;
|
|
2096
|
-
|
|
2097
1801
|
function objectHooks(obj, hooks) {
|
|
2098
1802
|
if (Array.isArray(hooks)) {
|
|
2099
1803
|
return (0, base_js_1.setMiddleware)(obj, hooks);
|
|
2100
1804
|
}
|
|
2101
|
-
|
|
2102
1805
|
for (var _i = 0, _Object$keys = Object.keys(hooks); _i < _Object$keys.length; _i++) {
|
|
2103
1806
|
var method = _Object$keys[_i];
|
|
2104
1807
|
var target = typeof obj[method] === 'function' ? obj : obj.prototype;
|
|
2105
1808
|
var fn = target && target[method];
|
|
2106
|
-
|
|
2107
1809
|
if (typeof fn !== 'function') {
|
|
2108
1810
|
throw new Error("Can not apply hooks. '".concat(method, "' is not a function"));
|
|
2109
1811
|
}
|
|
2110
|
-
|
|
2111
1812
|
var manager = (0, base_js_1.convertOptions)(hooks[method]);
|
|
2112
1813
|
target[method] = functionHooks(fn, manager.props({
|
|
2113
1814
|
method: method
|
|
2114
1815
|
}));
|
|
2115
1816
|
}
|
|
2116
|
-
|
|
2117
1817
|
return obj;
|
|
2118
1818
|
}
|
|
2119
|
-
|
|
2120
1819
|
exports.objectHooks = objectHooks;
|
|
2121
|
-
|
|
2122
1820
|
var hookDecorator = function hookDecorator(managerOrMiddleware) {
|
|
2123
1821
|
var wrapper = function wrapper(_target, method, descriptor) {
|
|
2124
1822
|
var manager = (0, base_js_1.convertOptions)(managerOrMiddleware);
|
|
2125
|
-
|
|
2126
1823
|
if (!descriptor) {
|
|
2127
1824
|
(0, base_js_1.setManager)(_target.prototype, manager);
|
|
2128
1825
|
return _target;
|
|
2129
1826
|
}
|
|
2130
|
-
|
|
2131
1827
|
var fn = descriptor.value;
|
|
2132
|
-
|
|
2133
1828
|
if (typeof fn !== 'function') {
|
|
2134
1829
|
throw new Error("Can not apply hooks. '".concat(method, "' is not a function"));
|
|
2135
1830
|
}
|
|
2136
|
-
|
|
2137
1831
|
descriptor.value = functionHooks(fn, manager.props({
|
|
2138
1832
|
method: method
|
|
2139
1833
|
}));
|
|
2140
1834
|
return descriptor;
|
|
2141
1835
|
};
|
|
2142
|
-
|
|
2143
1836
|
return wrapper;
|
|
2144
1837
|
};
|
|
2145
|
-
|
|
2146
1838
|
exports.hookDecorator = hookDecorator;
|
|
2147
1839
|
|
|
2148
1840
|
/***/ }),
|
|
@@ -2156,17 +1848,11 @@ exports.hookDecorator = hookDecorator;
|
|
|
2156
1848
|
|
|
2157
1849
|
|
|
2158
1850
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2159
|
-
|
|
2160
1851
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
2161
|
-
|
|
2162
1852
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
2163
|
-
|
|
2164
1853
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
2165
|
-
|
|
2166
1854
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
2167
|
-
|
|
2168
1855
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
2169
|
-
|
|
2170
1856
|
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
2171
1857
|
if (k2 === undefined) k2 = k;
|
|
2172
1858
|
Object.defineProperty(o, k2, {
|
|
@@ -2179,77 +1865,57 @@ var __createBinding = this && this.__createBinding || (Object.create ? function
|
|
|
2179
1865
|
if (k2 === undefined) k2 = k;
|
|
2180
1866
|
o[k2] = m[k];
|
|
2181
1867
|
});
|
|
2182
|
-
|
|
2183
1868
|
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
2184
1869
|
for (var p in m) {
|
|
2185
1870
|
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
2186
1871
|
}
|
|
2187
1872
|
};
|
|
2188
|
-
|
|
2189
1873
|
Object.defineProperty(exports, "__esModule", ({
|
|
2190
1874
|
value: true
|
|
2191
1875
|
}));
|
|
2192
1876
|
exports.hooks = exports.middleware = void 0;
|
|
2193
|
-
|
|
2194
1877
|
var base_js_1 = __webpack_require__(/*! ./base.js */ "../../node_modules/@feathersjs/hooks/script/base.js");
|
|
2195
|
-
|
|
2196
1878
|
var hooks_js_1 = __webpack_require__(/*! ./hooks.js */ "../../node_modules/@feathersjs/hooks/script/hooks.js");
|
|
2197
|
-
|
|
2198
1879
|
__exportStar(__webpack_require__(/*! ./hooks.js */ "../../node_modules/@feathersjs/hooks/script/hooks.js"), exports);
|
|
2199
|
-
|
|
2200
1880
|
__exportStar(__webpack_require__(/*! ./compose.js */ "../../node_modules/@feathersjs/hooks/script/compose.js"), exports);
|
|
2201
|
-
|
|
2202
1881
|
__exportStar(__webpack_require__(/*! ./base.js */ "../../node_modules/@feathersjs/hooks/script/base.js"), exports);
|
|
2203
|
-
|
|
2204
1882
|
__exportStar(__webpack_require__(/*! ./regular.js */ "../../node_modules/@feathersjs/hooks/script/regular.js"), exports);
|
|
2205
1883
|
/**
|
|
2206
1884
|
* Initializes a hook settings object with the given middleware.
|
|
2207
1885
|
* @param mw The list of middleware
|
|
2208
1886
|
* @param options Middleware options (params, default, props)
|
|
2209
1887
|
*/
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
1888
|
function middleware(mw, options) {
|
|
2213
1889
|
var manager = new base_js_1.HookManager().middleware(mw);
|
|
2214
|
-
|
|
2215
1890
|
if (options) {
|
|
2216
1891
|
if (options.params) {
|
|
2217
1892
|
manager.params.apply(manager, _toConsumableArray(options.params));
|
|
2218
1893
|
}
|
|
2219
|
-
|
|
2220
1894
|
if (options.defaults) {
|
|
2221
1895
|
manager.defaults(options.defaults);
|
|
2222
1896
|
}
|
|
2223
|
-
|
|
2224
1897
|
if (options.props) {
|
|
2225
1898
|
manager.props(options.props);
|
|
2226
1899
|
}
|
|
2227
1900
|
}
|
|
2228
|
-
|
|
2229
1901
|
return manager;
|
|
2230
1902
|
}
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
1903
|
+
exports.middleware = middleware;
|
|
1904
|
+
// Fallthrough to actual implementation
|
|
2234
1905
|
function hooks() {
|
|
2235
1906
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2236
1907
|
args[_key] = arguments[_key];
|
|
2237
1908
|
}
|
|
2238
|
-
|
|
2239
1909
|
var target = args[0],
|
|
2240
|
-
|
|
2241
|
-
|
|
1910
|
+
_hooks = args[1];
|
|
2242
1911
|
if (typeof target === 'function' && (_hooks instanceof base_js_1.HookManager || Array.isArray(_hooks) || args.length === 1)) {
|
|
2243
1912
|
return (0, hooks_js_1.functionHooks)(target, _hooks);
|
|
2244
1913
|
}
|
|
2245
|
-
|
|
2246
1914
|
if (args.length === 2) {
|
|
2247
1915
|
return (0, hooks_js_1.objectHooks)(target, _hooks);
|
|
2248
1916
|
}
|
|
2249
|
-
|
|
2250
1917
|
return (0, hooks_js_1.hookDecorator)(target);
|
|
2251
1918
|
}
|
|
2252
|
-
|
|
2253
1919
|
exports.hooks = hooks;
|
|
2254
1920
|
|
|
2255
1921
|
/***/ }),
|
|
@@ -2263,43 +1929,29 @@ exports.hooks = hooks;
|
|
|
2263
1929
|
|
|
2264
1930
|
|
|
2265
1931
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2266
|
-
|
|
2267
1932
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
2268
|
-
|
|
2269
1933
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
2270
|
-
|
|
2271
1934
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
2272
|
-
|
|
2273
1935
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
2274
|
-
|
|
2275
1936
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
2276
|
-
|
|
2277
1937
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2278
|
-
|
|
2279
1938
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
2280
|
-
|
|
2281
1939
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2282
|
-
|
|
2283
1940
|
Object.defineProperty(exports, "__esModule", ({
|
|
2284
1941
|
value: true
|
|
2285
1942
|
}));
|
|
2286
1943
|
exports.collect = exports.fromErrorHook = exports.fromAfterHook = exports.fromBeforeHook = exports.runHooks = exports.runHook = void 0;
|
|
2287
|
-
|
|
2288
1944
|
var compose_js_1 = __webpack_require__(/*! ./compose.js */ "../../node_modules/@feathersjs/hooks/script/compose.js");
|
|
2289
|
-
|
|
2290
1945
|
var runHook = function runHook(hook, context, type) {
|
|
2291
1946
|
if (type) context.type = type;
|
|
2292
1947
|
return Promise.resolve(hook.call(context.self, context)).then(function (res) {
|
|
2293
1948
|
if (type) context.type = null;
|
|
2294
|
-
|
|
2295
1949
|
if (res && res !== context) {
|
|
2296
1950
|
Object.assign(context, res);
|
|
2297
1951
|
}
|
|
2298
1952
|
});
|
|
2299
1953
|
};
|
|
2300
|
-
|
|
2301
1954
|
exports.runHook = runHook;
|
|
2302
|
-
|
|
2303
1955
|
var runHooks = function runHooks(hooks) {
|
|
2304
1956
|
return function (context) {
|
|
2305
1957
|
return hooks.reduce(function (promise, hook) {
|
|
@@ -2309,17 +1961,13 @@ var runHooks = function runHooks(hooks) {
|
|
|
2309
1961
|
}, Promise.resolve(context));
|
|
2310
1962
|
};
|
|
2311
1963
|
};
|
|
2312
|
-
|
|
2313
1964
|
exports.runHooks = runHooks;
|
|
2314
|
-
|
|
2315
1965
|
function fromBeforeHook(hook) {
|
|
2316
1966
|
return function (context, next) {
|
|
2317
1967
|
return (0, exports.runHook)(hook, context, 'before').then(next);
|
|
2318
1968
|
};
|
|
2319
1969
|
}
|
|
2320
|
-
|
|
2321
1970
|
exports.fromBeforeHook = fromBeforeHook;
|
|
2322
|
-
|
|
2323
1971
|
function fromAfterHook(hook) {
|
|
2324
1972
|
return function (context, next) {
|
|
2325
1973
|
return next().then(function () {
|
|
@@ -2327,9 +1975,7 @@ function fromAfterHook(hook) {
|
|
|
2327
1975
|
});
|
|
2328
1976
|
};
|
|
2329
1977
|
}
|
|
2330
|
-
|
|
2331
1978
|
exports.fromAfterHook = fromAfterHook;
|
|
2332
|
-
|
|
2333
1979
|
function fromErrorHook(hook) {
|
|
2334
1980
|
return function (context, next) {
|
|
2335
1981
|
return next().catch(function (error) {
|
|
@@ -2338,7 +1984,6 @@ function fromErrorHook(hook) {
|
|
|
2338
1984
|
context.error = error;
|
|
2339
1985
|
delete context.result;
|
|
2340
1986
|
}
|
|
2341
|
-
|
|
2342
1987
|
return (0, exports.runHook)(hook, context, 'error').then(function () {
|
|
2343
1988
|
if (context.result === undefined && context.error !== undefined) {
|
|
2344
1989
|
throw context.error;
|
|
@@ -2347,24 +1992,19 @@ function fromErrorHook(hook) {
|
|
|
2347
1992
|
});
|
|
2348
1993
|
};
|
|
2349
1994
|
}
|
|
2350
|
-
|
|
2351
1995
|
exports.fromErrorHook = fromErrorHook;
|
|
2352
|
-
|
|
2353
1996
|
function collect(_ref) {
|
|
2354
1997
|
var _ref$before = _ref.before,
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
1998
|
+
before = _ref$before === void 0 ? [] : _ref$before,
|
|
1999
|
+
_ref$after = _ref.after,
|
|
2000
|
+
after = _ref$after === void 0 ? [] : _ref$after,
|
|
2001
|
+
_ref$error = _ref.error,
|
|
2002
|
+
error = _ref$error === void 0 ? [] : _ref$error;
|
|
2360
2003
|
var beforeHooks = before.map(fromBeforeHook);
|
|
2361
|
-
|
|
2362
2004
|
var afterHooks = _toConsumableArray(after).reverse().map(fromAfterHook);
|
|
2363
|
-
|
|
2364
2005
|
var errorHooks = error.length ? [fromErrorHook((0, exports.runHooks)(error))] : [];
|
|
2365
2006
|
return (0, compose_js_1.compose)([].concat(errorHooks, _toConsumableArray(beforeHooks), _toConsumableArray(afterHooks)));
|
|
2366
2007
|
}
|
|
2367
|
-
|
|
2368
2008
|
exports.collect = collect;
|
|
2369
2009
|
|
|
2370
2010
|
/***/ }),
|
|
@@ -2378,31 +2018,24 @@ exports.collect = collect;
|
|
|
2378
2018
|
|
|
2379
2019
|
|
|
2380
2020
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
2381
|
-
|
|
2382
2021
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
2383
|
-
|
|
2384
2022
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
2385
|
-
|
|
2386
2023
|
Object.defineProperty(exports, "__esModule", ({
|
|
2387
2024
|
value: true
|
|
2388
2025
|
}));
|
|
2389
2026
|
exports.copyFnProperties = exports.copyProperties = exports.copyToSelf = void 0;
|
|
2390
|
-
var proto = Object.prototype;
|
|
2027
|
+
var proto = Object.prototype;
|
|
2028
|
+
// These are non-standard but offer a more reliable prototype based
|
|
2391
2029
|
// lookup for properties
|
|
2392
|
-
|
|
2393
2030
|
var hasProtoDefinitions = typeof proto.__lookupGetter__ === 'function' && typeof proto.__defineGetter__ === 'function' && typeof proto.__defineSetter__ === 'function';
|
|
2394
|
-
|
|
2395
2031
|
function copyToSelf(target) {
|
|
2396
2032
|
// tslint:disable-next-line
|
|
2397
2033
|
for (var key in target) {
|
|
2398
2034
|
if (!Object.hasOwnProperty.call(target, key)) {
|
|
2399
2035
|
var getter = hasProtoDefinitions ? target.constructor.prototype.__lookupGetter__(key) : Object.getOwnPropertyDescriptor(target, key);
|
|
2400
|
-
|
|
2401
2036
|
if (hasProtoDefinitions && getter) {
|
|
2402
2037
|
target.__defineGetter__(key, getter);
|
|
2403
|
-
|
|
2404
2038
|
var setter = target.constructor.prototype.__lookupSetter__(key);
|
|
2405
|
-
|
|
2406
2039
|
if (setter) {
|
|
2407
2040
|
target.__defineSetter__(key, setter);
|
|
2408
2041
|
}
|
|
@@ -2414,26 +2047,20 @@ function copyToSelf(target) {
|
|
|
2414
2047
|
}
|
|
2415
2048
|
}
|
|
2416
2049
|
}
|
|
2417
|
-
|
|
2418
2050
|
exports.copyToSelf = copyToSelf;
|
|
2419
|
-
|
|
2420
2051
|
function copyProperties(target) {
|
|
2421
2052
|
for (var _len = arguments.length, originals = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
2422
2053
|
originals[_key - 1] = arguments[_key];
|
|
2423
2054
|
}
|
|
2424
|
-
|
|
2425
2055
|
for (var _i = 0, _originals = originals; _i < _originals.length; _i++) {
|
|
2426
2056
|
var original = _originals[_i];
|
|
2427
2057
|
var originalProps = Object.keys(original).concat(Object.getOwnPropertySymbols(original));
|
|
2428
|
-
|
|
2429
2058
|
var _iterator = _createForOfIteratorHelper(originalProps),
|
|
2430
|
-
|
|
2431
|
-
|
|
2059
|
+
_step;
|
|
2432
2060
|
try {
|
|
2433
2061
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
2434
2062
|
var prop = _step.value;
|
|
2435
2063
|
var propDescriptor = Object.getOwnPropertyDescriptor(original, prop);
|
|
2436
|
-
|
|
2437
2064
|
if (propDescriptor && !Object.prototype.hasOwnProperty.call(target, prop)) {
|
|
2438
2065
|
Object.defineProperty(target, prop, propDescriptor);
|
|
2439
2066
|
}
|
|
@@ -2444,15 +2071,11 @@ function copyProperties(target) {
|
|
|
2444
2071
|
_iterator.f();
|
|
2445
2072
|
}
|
|
2446
2073
|
}
|
|
2447
|
-
|
|
2448
2074
|
return target;
|
|
2449
2075
|
}
|
|
2450
|
-
|
|
2451
2076
|
exports.copyProperties = copyProperties;
|
|
2452
|
-
|
|
2453
2077
|
function copyFnProperties(target, original) {
|
|
2454
2078
|
var internalProps = ['name', 'length'];
|
|
2455
|
-
|
|
2456
2079
|
try {
|
|
2457
2080
|
for (var _i2 = 0, _internalProps = internalProps; _i2 < _internalProps.length; _i2++) {
|
|
2458
2081
|
var prop = _internalProps[_i2];
|
|
@@ -2461,12 +2084,11 @@ function copyFnProperties(target, original) {
|
|
|
2461
2084
|
value: value
|
|
2462
2085
|
});
|
|
2463
2086
|
}
|
|
2464
|
-
} catch (_e) {
|
|
2087
|
+
} catch (_e) {
|
|
2088
|
+
// Avoid IE error
|
|
2465
2089
|
}
|
|
2466
|
-
|
|
2467
2090
|
return target;
|
|
2468
2091
|
}
|
|
2469
|
-
|
|
2470
2092
|
exports.copyFnProperties = copyFnProperties;
|
|
2471
2093
|
|
|
2472
2094
|
/***/ })
|