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