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