@feathersjs/client 5.0.0-pre.22 → 5.0.0-pre.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/core.js +228 -457
- package/dist/core.js.map +1 -1
- package/dist/core.min.js +1 -1
- package/dist/feathers.js +299 -496
- package/dist/feathers.js.map +1 -1
- package/dist/feathers.min.js +1 -1
- package/package.json +17 -17
- package/src/core.ts +1 -1
- package/src/feathers.ts +9 -9
package/dist/core.js
CHANGED
|
@@ -248,22 +248,12 @@ __exportStar(__webpack_require__(/*! ./debug */ "../commons/lib/debug.js"), expo
|
|
|
248
248
|
|
|
249
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); }
|
|
250
250
|
|
|
251
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
252
|
-
|
|
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."); }
|
|
254
|
-
|
|
255
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
256
|
-
|
|
257
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
258
|
-
|
|
259
251
|
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; } } }; }
|
|
260
252
|
|
|
261
253
|
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); }
|
|
262
254
|
|
|
263
255
|
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; }
|
|
264
256
|
|
|
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; }
|
|
266
|
-
|
|
267
257
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
268
258
|
|
|
269
259
|
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); } }
|
|
@@ -272,7 +262,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
272
262
|
|
|
273
263
|
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); }
|
|
274
264
|
|
|
275
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf
|
|
265
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
276
266
|
|
|
277
267
|
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); }; }
|
|
278
268
|
|
|
@@ -282,7 +272,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
|
|
|
282
272
|
|
|
283
273
|
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; } }
|
|
284
274
|
|
|
285
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
275
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
286
276
|
|
|
287
277
|
var __importDefault = this && this.__importDefault || function (mod) {
|
|
288
278
|
return mod && mod.__esModule ? mod : {
|
|
@@ -297,20 +287,24 @@ exports.Feathers = void 0;
|
|
|
297
287
|
|
|
298
288
|
var version_1 = __importDefault(__webpack_require__(/*! ./version */ "../feathers/lib/version.js"));
|
|
299
289
|
|
|
300
|
-
var
|
|
290
|
+
var events_1 = __webpack_require__(/*! events */ "../../node_modules/events/events.js");
|
|
301
291
|
|
|
302
|
-
var
|
|
292
|
+
var commons_1 = __webpack_require__(/*! @feathersjs/commons */ "../commons/lib/index.js");
|
|
303
293
|
|
|
304
|
-
var
|
|
294
|
+
var hooks_1 = __webpack_require__(/*! @feathersjs/hooks */ "../../node_modules/@feathersjs/hooks/script/index.js");
|
|
295
|
+
|
|
296
|
+
var events_2 = __webpack_require__(/*! ./events */ "../feathers/lib/events.js");
|
|
297
|
+
|
|
298
|
+
var hooks_2 = __webpack_require__(/*! ./hooks */ "../feathers/lib/hooks.js");
|
|
305
299
|
|
|
306
300
|
var service_1 = __webpack_require__(/*! ./service */ "../feathers/lib/service.js");
|
|
307
301
|
|
|
308
|
-
var
|
|
302
|
+
var hooks_3 = __webpack_require__(/*! ./hooks */ "../feathers/lib/hooks.js");
|
|
309
303
|
|
|
310
|
-
var debug = (0,
|
|
304
|
+
var debug = (0, commons_1.createDebug)('@feathersjs/feathers');
|
|
311
305
|
|
|
312
|
-
var Feathers = /*#__PURE__*/function (
|
|
313
|
-
_inherits(Feathers,
|
|
306
|
+
var Feathers = /*#__PURE__*/function (_events_1$EventEmitte) {
|
|
307
|
+
_inherits(Feathers, _events_1$EventEmitte);
|
|
314
308
|
|
|
315
309
|
var _super = _createSuper(Feathers);
|
|
316
310
|
|
|
@@ -322,19 +316,23 @@ var Feathers = /*#__PURE__*/function (_dependencies_1$Event) {
|
|
|
322
316
|
_this = _super.call(this);
|
|
323
317
|
_this.services = {};
|
|
324
318
|
_this.settings = {};
|
|
325
|
-
_this.mixins = [
|
|
319
|
+
_this.mixins = [hooks_2.hookMixin, events_2.eventMixin];
|
|
326
320
|
_this.version = version_1.default;
|
|
327
321
|
_this._isSetup = false;
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
(0, dependencies_1.hooks)(_assertThisInitialized(_this), {
|
|
331
|
-
setup: (0, dependencies_1.middleware)().params('server').props({
|
|
322
|
+
(0, hooks_1.hooks)(_assertThisInitialized(_this), {
|
|
323
|
+
setup: (0, hooks_1.middleware)().params('server').props({
|
|
332
324
|
app: _assertThisInitialized(_this)
|
|
333
325
|
}),
|
|
334
|
-
teardown: (0,
|
|
326
|
+
teardown: (0, hooks_1.middleware)().params('server').props({
|
|
335
327
|
app: _assertThisInitialized(_this)
|
|
336
328
|
})
|
|
337
329
|
});
|
|
330
|
+
_this.registerHooks = (0, hooks_3.enableHooks)(_assertThisInitialized(_this));
|
|
331
|
+
|
|
332
|
+
_this.registerHooks({
|
|
333
|
+
around: [events_2.eventHook]
|
|
334
|
+
});
|
|
335
|
+
|
|
338
336
|
return _this;
|
|
339
337
|
}
|
|
340
338
|
|
|
@@ -363,7 +361,7 @@ var Feathers = /*#__PURE__*/function (_dependencies_1$Event) {
|
|
|
363
361
|
}, {
|
|
364
362
|
key: "service",
|
|
365
363
|
value: function service(location) {
|
|
366
|
-
var path = (0,
|
|
364
|
+
var path = (0, commons_1.stripSlashes)(location) || '/';
|
|
367
365
|
var current = this.services[path];
|
|
368
366
|
|
|
369
367
|
if (typeof current === 'undefined') {
|
|
@@ -382,7 +380,7 @@ var Feathers = /*#__PURE__*/function (_dependencies_1$Event) {
|
|
|
382
380
|
throw new Error("'".concat(path, "' is not a valid service path."));
|
|
383
381
|
}
|
|
384
382
|
|
|
385
|
-
var location = (0,
|
|
383
|
+
var location = (0, commons_1.stripSlashes)(path) || '/';
|
|
386
384
|
var subApp = service;
|
|
387
385
|
var isSubApp = typeof subApp.service === 'function' && subApp.services;
|
|
388
386
|
|
|
@@ -430,23 +428,18 @@ var Feathers = /*#__PURE__*/function (_dependencies_1$Event) {
|
|
|
430
428
|
}, {
|
|
431
429
|
key: "hooks",
|
|
432
430
|
value: function hooks(hookMap) {
|
|
433
|
-
var _this3 = this;
|
|
434
|
-
|
|
435
431
|
var untypedMap = hookMap;
|
|
436
432
|
|
|
437
|
-
if (untypedMap.before || untypedMap.after || untypedMap.error) {
|
|
438
|
-
|
|
433
|
+
if (untypedMap.before || untypedMap.after || untypedMap.error || untypedMap.around) {
|
|
434
|
+
// regular hooks for all service methods
|
|
435
|
+
this.registerHooks(untypedMap);
|
|
439
436
|
} else if (untypedMap.setup || untypedMap.teardown) {
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
var _this$appHooks$depend;
|
|
443
|
-
|
|
444
|
-
(_this$appHooks$depend = this.appHooks[dependencies_1.HOOKS]).push.apply(_this$appHooks$depend, _toConsumableArray(hookMap));
|
|
437
|
+
// .setup and .teardown application hooks
|
|
438
|
+
(0, hooks_1.hooks)(this, untypedMap);
|
|
445
439
|
} else {
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
_this3.appHooks[key] = methodHooks.concat(methodHookMap[key]);
|
|
440
|
+
// Other registration formats are just `around` hooks
|
|
441
|
+
this.registerHooks({
|
|
442
|
+
around: untypedMap
|
|
450
443
|
});
|
|
451
444
|
}
|
|
452
445
|
|
|
@@ -455,45 +448,45 @@ var Feathers = /*#__PURE__*/function (_dependencies_1$Event) {
|
|
|
455
448
|
}, {
|
|
456
449
|
key: "setup",
|
|
457
450
|
value: function setup() {
|
|
458
|
-
var
|
|
451
|
+
var _this3 = this;
|
|
459
452
|
|
|
460
453
|
this._isSetup = true;
|
|
461
454
|
return Object.keys(this.services).reduce(function (current, path) {
|
|
462
455
|
return current.then(function () {
|
|
463
|
-
var service =
|
|
456
|
+
var service = _this3.service(path);
|
|
464
457
|
|
|
465
458
|
if (typeof service.setup === 'function') {
|
|
466
459
|
debug("Setting up service for `".concat(path, "`"));
|
|
467
|
-
return service.setup(
|
|
460
|
+
return service.setup(_this3, path);
|
|
468
461
|
}
|
|
469
462
|
});
|
|
470
463
|
}, Promise.resolve()).then(function () {
|
|
471
|
-
return
|
|
464
|
+
return _this3;
|
|
472
465
|
});
|
|
473
466
|
}
|
|
474
467
|
}, {
|
|
475
468
|
key: "teardown",
|
|
476
469
|
value: function teardown() {
|
|
477
|
-
var
|
|
470
|
+
var _this4 = this;
|
|
478
471
|
|
|
479
472
|
this._isSetup = false;
|
|
480
473
|
return Object.keys(this.services).reduce(function (current, path) {
|
|
481
474
|
return current.then(function () {
|
|
482
|
-
var service =
|
|
475
|
+
var service = _this4.service(path);
|
|
483
476
|
|
|
484
477
|
if (typeof service.teardown === 'function') {
|
|
485
478
|
debug("Tearing down service for `".concat(path, "`"));
|
|
486
|
-
return service.teardown(
|
|
479
|
+
return service.teardown(_this4, path);
|
|
487
480
|
}
|
|
488
481
|
});
|
|
489
482
|
}, Promise.resolve()).then(function () {
|
|
490
|
-
return
|
|
483
|
+
return _this4;
|
|
491
484
|
});
|
|
492
485
|
}
|
|
493
486
|
}]);
|
|
494
487
|
|
|
495
488
|
return Feathers;
|
|
496
|
-
}(
|
|
489
|
+
}(events_1.EventEmitter);
|
|
497
490
|
|
|
498
491
|
exports.Feathers = Feathers;
|
|
499
492
|
|
|
@@ -513,59 +506,6 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
513
506
|
|
|
514
507
|
/***/ }),
|
|
515
508
|
|
|
516
|
-
/***/ "../feathers/lib/dependencies.js":
|
|
517
|
-
/*!***************************************!*\
|
|
518
|
-
!*** ../feathers/lib/dependencies.js ***!
|
|
519
|
-
\***************************************/
|
|
520
|
-
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
525
|
-
if (k2 === undefined) k2 = k;
|
|
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);
|
|
538
|
-
} : function (o, m, k, k2) {
|
|
539
|
-
if (k2 === undefined) k2 = k;
|
|
540
|
-
o[k2] = m[k];
|
|
541
|
-
});
|
|
542
|
-
|
|
543
|
-
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
544
|
-
for (var p in m) {
|
|
545
|
-
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
546
|
-
}
|
|
547
|
-
};
|
|
548
|
-
|
|
549
|
-
Object.defineProperty(exports, "__esModule", ({
|
|
550
|
-
value: true
|
|
551
|
-
}));
|
|
552
|
-
exports.EventEmitter = void 0;
|
|
553
|
-
|
|
554
|
-
var events_1 = __webpack_require__(/*! events */ "../../node_modules/events/events.js");
|
|
555
|
-
|
|
556
|
-
Object.defineProperty(exports, "EventEmitter", ({
|
|
557
|
-
enumerable: true,
|
|
558
|
-
get: function get() {
|
|
559
|
-
return events_1.EventEmitter;
|
|
560
|
-
}
|
|
561
|
-
}));
|
|
562
|
-
|
|
563
|
-
__exportStar(__webpack_require__(/*! @feathersjs/commons */ "../commons/lib/index.js"), exports);
|
|
564
|
-
|
|
565
|
-
__exportStar(__webpack_require__(/*! @feathersjs/hooks */ "../../node_modules/@feathersjs/hooks/script/index.js"), exports);
|
|
566
|
-
|
|
567
|
-
/***/ }),
|
|
568
|
-
|
|
569
509
|
/***/ "../feathers/lib/events.js":
|
|
570
510
|
/*!*********************************!*\
|
|
571
511
|
!*** ../feathers/lib/events.js ***!
|
|
@@ -579,7 +519,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
579
519
|
}));
|
|
580
520
|
exports.eventMixin = exports.eventHook = void 0;
|
|
581
521
|
|
|
582
|
-
var
|
|
522
|
+
var events_1 = __webpack_require__(/*! events */ "../../node_modules/events/events.js");
|
|
583
523
|
|
|
584
524
|
var service_1 = __webpack_require__(/*! ./service */ "../feathers/lib/service.js");
|
|
585
525
|
|
|
@@ -607,7 +547,7 @@ function eventMixin(service) {
|
|
|
607
547
|
var isEmitter = typeof service.on === 'function' && typeof service.emit === 'function';
|
|
608
548
|
|
|
609
549
|
if (!isEmitter) {
|
|
610
|
-
Object.assign(service,
|
|
550
|
+
Object.assign(service, events_1.EventEmitter.prototype);
|
|
611
551
|
}
|
|
612
552
|
|
|
613
553
|
return service;
|
|
@@ -617,41 +557,27 @@ exports.eventMixin = eventMixin;
|
|
|
617
557
|
|
|
618
558
|
/***/ }),
|
|
619
559
|
|
|
620
|
-
/***/ "../feathers/lib/hooks
|
|
621
|
-
|
|
622
|
-
!*** ../feathers/lib/hooks
|
|
623
|
-
|
|
560
|
+
/***/ "../feathers/lib/hooks.js":
|
|
561
|
+
/*!********************************!*\
|
|
562
|
+
!*** ../feathers/lib/hooks.js ***!
|
|
563
|
+
\********************************/
|
|
624
564
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
625
565
|
|
|
626
566
|
|
|
627
567
|
|
|
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); }
|
|
629
|
-
|
|
630
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
631
|
-
|
|
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."); }
|
|
633
|
-
|
|
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); }
|
|
635
|
-
|
|
636
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
637
|
-
|
|
638
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
639
|
-
|
|
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; }
|
|
641
|
-
|
|
642
568
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
643
569
|
|
|
644
570
|
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); } }
|
|
645
571
|
|
|
646
572
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
647
573
|
|
|
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); }
|
|
574
|
+
function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
|
|
649
575
|
|
|
650
576
|
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
|
651
577
|
|
|
652
578
|
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); }
|
|
653
579
|
|
|
654
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf
|
|
580
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
655
581
|
|
|
656
582
|
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); }; }
|
|
657
583
|
|
|
@@ -661,57 +587,146 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
|
|
|
661
587
|
|
|
662
588
|
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; } }
|
|
663
589
|
|
|
664
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
590
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
591
|
+
|
|
592
|
+
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; } } }; }
|
|
593
|
+
|
|
594
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
595
|
+
|
|
596
|
+
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."); }
|
|
597
|
+
|
|
598
|
+
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); }
|
|
599
|
+
|
|
600
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
601
|
+
|
|
602
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
603
|
+
|
|
604
|
+
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; }
|
|
605
|
+
|
|
606
|
+
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); }
|
|
665
607
|
|
|
666
608
|
Object.defineProperty(exports, "__esModule", ({
|
|
667
609
|
value: true
|
|
668
610
|
}));
|
|
669
|
-
exports.hookMixin = exports.FeathersHookManager = exports.createContext = exports.
|
|
611
|
+
exports.hookMixin = exports.FeathersHookManager = exports.createContext = exports.enableHooks = exports.convertHookData = exports.collectHooks = void 0;
|
|
670
612
|
|
|
671
|
-
var
|
|
613
|
+
var hooks_1 = __webpack_require__(/*! @feathersjs/hooks */ "../../node_modules/@feathersjs/hooks/script/index.js");
|
|
672
614
|
|
|
673
|
-
var service_1 = __webpack_require__(/*!
|
|
615
|
+
var service_1 = __webpack_require__(/*! ./service */ "../feathers/lib/service.js");
|
|
674
616
|
|
|
675
|
-
|
|
617
|
+
function collectHooks(target, method) {
|
|
618
|
+
return target.__hooks.hooks[method] || [];
|
|
619
|
+
}
|
|
676
620
|
|
|
677
|
-
|
|
621
|
+
exports.collectHooks = collectHooks; // Converts different hook registration formats into the
|
|
622
|
+
// same internal format
|
|
678
623
|
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
}))
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
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;
|
|
624
|
+
function convertHookData(input) {
|
|
625
|
+
var result = {};
|
|
626
|
+
|
|
627
|
+
if (Array.isArray(input)) {
|
|
628
|
+
result.all = input;
|
|
629
|
+
} else if (_typeof(input) !== 'object') {
|
|
630
|
+
result.all = [input];
|
|
631
|
+
} else {
|
|
632
|
+
for (var _i = 0, _Object$keys = Object.keys(input); _i < _Object$keys.length; _i++) {
|
|
633
|
+
var key = _Object$keys[_i];
|
|
634
|
+
var value = input[key];
|
|
635
|
+
result[key] = Array.isArray(value) ? value : [value];
|
|
636
|
+
}
|
|
707
637
|
}
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
638
|
+
|
|
639
|
+
return result;
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
exports.convertHookData = convertHookData;
|
|
643
|
+
var types = ['before', 'after', 'error', 'around'];
|
|
644
|
+
|
|
645
|
+
var isType = function isType(value) {
|
|
646
|
+
return types.includes(value);
|
|
647
|
+
};
|
|
648
|
+
|
|
649
|
+
var createMap = function createMap(input, methods) {
|
|
650
|
+
var map = {};
|
|
651
|
+
Object.keys(input).forEach(function (type) {
|
|
652
|
+
if (!isType(type)) {
|
|
653
|
+
throw new Error("'".concat(type, "' is not a valid hook type"));
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
var data = convertHookData(input[type]);
|
|
657
|
+
Object.keys(data).forEach(function (method) {
|
|
658
|
+
if (method !== 'all' && !methods.includes(method) && !service_1.defaultServiceMethods.includes(method)) {
|
|
659
|
+
throw new Error("'".concat(method, "' is not a valid hook method"));
|
|
660
|
+
}
|
|
661
|
+
});
|
|
662
|
+
map[type] = data;
|
|
663
|
+
});
|
|
664
|
+
return map;
|
|
665
|
+
};
|
|
666
|
+
|
|
667
|
+
var updateStore = function updateStore(store, map) {
|
|
668
|
+
return Object.keys(store.hooks).forEach(function (method) {
|
|
669
|
+
Object.keys(map).forEach(function (key) {
|
|
670
|
+
var _a;
|
|
671
|
+
|
|
672
|
+
var type = key;
|
|
673
|
+
var allHooks = map[type].all || [];
|
|
674
|
+
var methodHooks = map[type][method] || [];
|
|
675
|
+
|
|
676
|
+
if (allHooks.length || methodHooks.length) {
|
|
677
|
+
var list = [].concat(_toConsumableArray(allHooks), _toConsumableArray(methodHooks));
|
|
678
|
+
var hooks = (_a = store[type])[method] || (_a[method] = []);
|
|
679
|
+
hooks.push.apply(hooks, _toConsumableArray(list));
|
|
680
|
+
}
|
|
681
|
+
});
|
|
682
|
+
var collected = (0, hooks_1.collect)({
|
|
683
|
+
before: store.before[method] || [],
|
|
684
|
+
after: store.after[method] || [],
|
|
685
|
+
error: store.error[method] || []
|
|
686
|
+
});
|
|
687
|
+
store.hooks[method] = [].concat(_toConsumableArray(store.around[method] || []), [collected]);
|
|
688
|
+
});
|
|
689
|
+
}; // Add `.hooks` functionality to an object
|
|
690
|
+
|
|
691
|
+
|
|
692
|
+
function enableHooks(object) {
|
|
693
|
+
var methods = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : service_1.defaultServiceMethods;
|
|
694
|
+
var store = {
|
|
695
|
+
around: {},
|
|
696
|
+
before: {},
|
|
697
|
+
after: {},
|
|
698
|
+
error: {},
|
|
699
|
+
hooks: {}
|
|
700
|
+
};
|
|
701
|
+
|
|
702
|
+
var _iterator = _createForOfIteratorHelper(methods),
|
|
703
|
+
_step;
|
|
704
|
+
|
|
705
|
+
try {
|
|
706
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
707
|
+
var method = _step.value;
|
|
708
|
+
store.hooks[method] = [];
|
|
709
|
+
}
|
|
710
|
+
} catch (err) {
|
|
711
|
+
_iterator.e(err);
|
|
712
|
+
} finally {
|
|
713
|
+
_iterator.f();
|
|
713
714
|
}
|
|
714
|
-
|
|
715
|
+
|
|
716
|
+
Object.defineProperty(object, '__hooks', {
|
|
717
|
+
configurable: true,
|
|
718
|
+
value: store,
|
|
719
|
+
writable: true
|
|
720
|
+
});
|
|
721
|
+
return function registerHooks(input) {
|
|
722
|
+
var store = this.__hooks;
|
|
723
|
+
var map = createMap(input, methods);
|
|
724
|
+
updateStore(store, map);
|
|
725
|
+
return this;
|
|
726
|
+
};
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
exports.enableHooks = enableHooks;
|
|
715
730
|
|
|
716
731
|
function createContext(service, method) {
|
|
717
732
|
var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
@@ -726,8 +741,8 @@ function createContext(service, method) {
|
|
|
726
741
|
|
|
727
742
|
exports.createContext = createContext;
|
|
728
743
|
|
|
729
|
-
var FeathersHookManager = /*#__PURE__*/function (
|
|
730
|
-
_inherits(FeathersHookManager,
|
|
744
|
+
var FeathersHookManager = /*#__PURE__*/function (_hooks_1$HookManager) {
|
|
745
|
+
_inherits(FeathersHookManager, _hooks_1$HookManager);
|
|
731
746
|
|
|
732
747
|
var _super = _createSuper(FeathersHookManager);
|
|
733
748
|
|
|
@@ -746,14 +761,12 @@ var FeathersHookManager = /*#__PURE__*/function (_dependencies_1$HookM) {
|
|
|
746
761
|
_createClass(FeathersHookManager, [{
|
|
747
762
|
key: "collectMiddleware",
|
|
748
763
|
value: function collectMiddleware(self, args) {
|
|
749
|
-
var
|
|
750
|
-
var appHooks = app.appHooks[dependencies_1.HOOKS].concat(app.appHooks[this.method] || []);
|
|
751
|
-
var regularAppHooks = (0, regular_1.collectRegularHooks)(this.app, this.method);
|
|
764
|
+
var appHooks = collectHooks(this.app, this.method);
|
|
752
765
|
|
|
753
766
|
var middleware = _get(_getPrototypeOf(FeathersHookManager.prototype), "collectMiddleware", this).call(this, self, args);
|
|
754
767
|
|
|
755
|
-
var
|
|
756
|
-
return [].concat(_toConsumableArray(appHooks), _toConsumableArray(
|
|
768
|
+
var methodHooks = collectHooks(self, this.method);
|
|
769
|
+
return [].concat(_toConsumableArray(appHooks), _toConsumableArray(middleware), _toConsumableArray(methodHooks));
|
|
757
770
|
}
|
|
758
771
|
}, {
|
|
759
772
|
key: "initializeContext",
|
|
@@ -775,23 +788,24 @@ var FeathersHookManager = /*#__PURE__*/function (_dependencies_1$HookM) {
|
|
|
775
788
|
}]);
|
|
776
789
|
|
|
777
790
|
return FeathersHookManager;
|
|
778
|
-
}(
|
|
791
|
+
}(hooks_1.HookManager);
|
|
779
792
|
|
|
780
793
|
exports.FeathersHookManager = FeathersHookManager;
|
|
781
794
|
|
|
782
795
|
function hookMixin(service, path, options) {
|
|
796
|
+
var _this2 = this;
|
|
797
|
+
|
|
783
798
|
if (typeof service.hooks === 'function') {
|
|
784
799
|
return service;
|
|
785
800
|
}
|
|
786
801
|
|
|
787
|
-
var app = this;
|
|
788
802
|
var hookMethods = (0, service_1.getHookMethods)(service, options);
|
|
789
803
|
var serviceMethodHooks = hookMethods.reduce(function (res, method) {
|
|
790
804
|
var _FeathersHookManager;
|
|
791
805
|
|
|
792
806
|
var params = service_1.defaultServiceArguments[method] || ['data', 'params'];
|
|
793
|
-
res[method] = (_FeathersHookManager = new FeathersHookManager(
|
|
794
|
-
app:
|
|
807
|
+
res[method] = (_FeathersHookManager = new FeathersHookManager(_this2, method)).params.apply(_FeathersHookManager, _toConsumableArray(params)).props({
|
|
808
|
+
app: _this2,
|
|
795
809
|
path: path,
|
|
796
810
|
method: method,
|
|
797
811
|
service: service,
|
|
@@ -805,28 +819,29 @@ function hookMixin(service, path, options) {
|
|
|
805
819
|
},
|
|
806
820
|
|
|
807
821
|
set statusCode(value) {
|
|
808
|
-
|
|
822
|
+
this.http = this.http || {};
|
|
823
|
+
this.http.status = value;
|
|
809
824
|
}
|
|
810
825
|
|
|
811
826
|
});
|
|
812
827
|
return res;
|
|
813
828
|
}, {});
|
|
814
|
-
var
|
|
815
|
-
(0,
|
|
829
|
+
var registerHooks = enableHooks(service, hookMethods);
|
|
830
|
+
(0, hooks_1.hooks)(service, serviceMethodHooks);
|
|
816
831
|
|
|
817
832
|
service.hooks = function (hookOptions) {
|
|
818
|
-
var
|
|
833
|
+
var _this3 = this;
|
|
819
834
|
|
|
820
|
-
if (hookOptions.before || hookOptions.after || hookOptions.error) {
|
|
821
|
-
return
|
|
835
|
+
if (hookOptions.before || hookOptions.after || hookOptions.error || hookOptions.around) {
|
|
836
|
+
return registerHooks.call(this, hookOptions);
|
|
822
837
|
}
|
|
823
838
|
|
|
824
839
|
if (Array.isArray(hookOptions)) {
|
|
825
|
-
return (0,
|
|
840
|
+
return (0, hooks_1.hooks)(this, hookOptions);
|
|
826
841
|
}
|
|
827
842
|
|
|
828
843
|
Object.keys(hookOptions).forEach(function (method) {
|
|
829
|
-
var manager = (0,
|
|
844
|
+
var manager = (0, hooks_1.getManager)(_this3[method]);
|
|
830
845
|
|
|
831
846
|
if (!(manager instanceof FeathersHookManager)) {
|
|
832
847
|
throw new Error("Method ".concat(method, " is not a Feathers hooks enabled service method"));
|
|
@@ -844,266 +859,6 @@ exports.hookMixin = hookMixin;
|
|
|
844
859
|
|
|
845
860
|
/***/ }),
|
|
846
861
|
|
|
847
|
-
/***/ "../feathers/lib/hooks/regular.js":
|
|
848
|
-
/*!****************************************!*\
|
|
849
|
-
!*** ../feathers/lib/hooks/regular.js ***!
|
|
850
|
-
\****************************************/
|
|
851
|
-
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
856
|
-
|
|
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."); }
|
|
858
|
-
|
|
859
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
860
|
-
|
|
861
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
862
|
-
|
|
863
|
-
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; } } }; }
|
|
864
|
-
|
|
865
|
-
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); }
|
|
866
|
-
|
|
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; }
|
|
868
|
-
|
|
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); }
|
|
870
|
-
|
|
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; }
|
|
872
|
-
|
|
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; }
|
|
874
|
-
|
|
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; }
|
|
876
|
-
|
|
877
|
-
Object.defineProperty(exports, "__esModule", ({
|
|
878
|
-
value: true
|
|
879
|
-
}));
|
|
880
|
-
exports.enableRegularHooks = exports.convertHookData = exports.collectRegularHooks = exports.fromErrorHooks = exports.fromAfterHooks = exports.fromBeforeHooks = exports.fromErrorHook = exports.fromAfterHook = exports.fromBeforeHook = void 0;
|
|
881
|
-
|
|
882
|
-
var service_1 = __webpack_require__(/*! ../service */ "../feathers/lib/service.js");
|
|
883
|
-
|
|
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;
|
|
888
|
-
|
|
889
|
-
if (res && res !== context) {
|
|
890
|
-
Object.assign(context, res);
|
|
891
|
-
}
|
|
892
|
-
});
|
|
893
|
-
};
|
|
894
|
-
|
|
895
|
-
function fromBeforeHook(hook) {
|
|
896
|
-
return function (context, next) {
|
|
897
|
-
return runHook(hook, context, 'before').then(next);
|
|
898
|
-
};
|
|
899
|
-
}
|
|
900
|
-
|
|
901
|
-
exports.fromBeforeHook = fromBeforeHook;
|
|
902
|
-
|
|
903
|
-
function fromAfterHook(hook) {
|
|
904
|
-
return function (context, next) {
|
|
905
|
-
return next().then(function () {
|
|
906
|
-
return runHook(hook, context, 'after');
|
|
907
|
-
});
|
|
908
|
-
};
|
|
909
|
-
}
|
|
910
|
-
|
|
911
|
-
exports.fromAfterHook = fromAfterHook;
|
|
912
|
-
|
|
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
|
-
}
|
|
921
|
-
|
|
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
|
-
}
|
|
930
|
-
|
|
931
|
-
exports.fromErrorHook = fromErrorHook;
|
|
932
|
-
|
|
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];
|
|
980
|
-
}
|
|
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] = [];
|
|
1014
|
-
}
|
|
1015
|
-
} catch (err) {
|
|
1016
|
-
_iterator.e(err);
|
|
1017
|
-
} finally {
|
|
1018
|
-
_iterator.f();
|
|
1019
|
-
}
|
|
1020
|
-
|
|
1021
|
-
return store;
|
|
1022
|
-
};
|
|
1023
|
-
|
|
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"));
|
|
1041
|
-
}
|
|
1042
|
-
|
|
1043
|
-
var data = convertHookData(input[type]);
|
|
1044
|
-
Object.keys(data).forEach(function (method) {
|
|
1045
|
-
if (method !== 'all' && !methods.includes(method) && !service_1.defaultServiceMethods.includes(method)) {
|
|
1046
|
-
throw new Error("'".concat(method, "' is not a valid hook method"));
|
|
1047
|
-
}
|
|
1048
|
-
});
|
|
1049
|
-
map[type] = data;
|
|
1050
|
-
});
|
|
1051
|
-
return map;
|
|
1052
|
-
};
|
|
1053
|
-
|
|
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
|
-
};
|
|
1062
|
-
|
|
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;
|
|
1068
|
-
|
|
1069
|
-
var type = key;
|
|
1070
|
-
var allHooks = map[type].all || [];
|
|
1071
|
-
var methodHooks = map[type][method] || [];
|
|
1072
|
-
|
|
1073
|
-
if (allHooks.length || methodHooks.length) {
|
|
1074
|
-
var _adapter$hooks;
|
|
1075
|
-
|
|
1076
|
-
var adapter = (_a = store[type])[method] || (_a[method] = (adapted = true, createAdapter(type)));
|
|
1077
|
-
|
|
1078
|
-
(_adapter$hooks = adapter.hooks).push.apply(_adapter$hooks, _toConsumableArray(allHooks).concat(_toConsumableArray(methodHooks)));
|
|
1079
|
-
}
|
|
1080
|
-
});
|
|
1081
|
-
|
|
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
|
|
1089
|
-
|
|
1090
|
-
|
|
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
862
|
/***/ "../feathers/lib/index.js":
|
|
1108
863
|
/*!********************************!*\
|
|
1109
864
|
!*** ../feathers/lib/index.js ***!
|
|
@@ -1148,7 +903,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
1148
903
|
}));
|
|
1149
904
|
exports.Feathers = exports.version = exports.feathers = void 0;
|
|
1150
905
|
|
|
1151
|
-
var
|
|
906
|
+
var commons_1 = __webpack_require__(/*! @feathersjs/commons */ "../commons/lib/index.js");
|
|
1152
907
|
|
|
1153
908
|
var version_1 = __importDefault(__webpack_require__(/*! ./version */ "../feathers/lib/version.js"));
|
|
1154
909
|
|
|
@@ -1168,9 +923,9 @@ function feathers() {
|
|
|
1168
923
|
}
|
|
1169
924
|
|
|
1170
925
|
exports.feathers = feathers;
|
|
1171
|
-
feathers.setDebug =
|
|
926
|
+
feathers.setDebug = commons_1.setDebug;
|
|
1172
927
|
|
|
1173
|
-
__exportStar(__webpack_require__(/*! ./hooks
|
|
928
|
+
__exportStar(__webpack_require__(/*! ./hooks */ "../feathers/lib/hooks.js"), exports);
|
|
1174
929
|
|
|
1175
930
|
__exportStar(__webpack_require__(/*! ./declarations */ "../feathers/lib/declarations.js"), exports);
|
|
1176
931
|
|
|
@@ -1201,9 +956,11 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
1201
956
|
}));
|
|
1202
957
|
exports.wrapService = exports.getServiceOptions = exports.getHookMethods = exports.protectedMethods = exports.defaultEventMap = exports.defaultServiceMethods = exports.defaultServiceArguments = exports.SERVICE = void 0;
|
|
1203
958
|
|
|
1204
|
-
var
|
|
959
|
+
var events_1 = __webpack_require__(/*! events */ "../../node_modules/events/events.js");
|
|
960
|
+
|
|
961
|
+
var commons_1 = __webpack_require__(/*! @feathersjs/commons */ "../commons/lib/index.js");
|
|
1205
962
|
|
|
1206
|
-
exports.SERVICE = (0,
|
|
963
|
+
exports.SERVICE = (0, commons_1.createSymbol)('@feathersjs/service');
|
|
1207
964
|
exports.defaultServiceArguments = {
|
|
1208
965
|
find: ['params'],
|
|
1209
966
|
get: ['id', 'params'],
|
|
@@ -1219,7 +976,7 @@ exports.defaultEventMap = {
|
|
|
1219
976
|
patch: 'patched',
|
|
1220
977
|
remove: 'removed'
|
|
1221
978
|
};
|
|
1222
|
-
exports.protectedMethods = Object.keys(Object.prototype).concat(Object.keys(
|
|
979
|
+
exports.protectedMethods = Object.keys(Object.prototype).concat(Object.keys(events_1.EventEmitter.prototype)).concat(['all', 'around', 'before', 'after', 'error', 'hooks', 'setup', 'teardown', 'publish']);
|
|
1223
980
|
|
|
1224
981
|
function getHookMethods(service, options) {
|
|
1225
982
|
var methods = options.methods;
|
|
@@ -1839,7 +1596,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1839
1596
|
|
|
1840
1597
|
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); }
|
|
1841
1598
|
|
|
1842
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf
|
|
1599
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
1843
1600
|
|
|
1844
1601
|
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); }; }
|
|
1845
1602
|
|
|
@@ -1849,7 +1606,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
|
|
|
1849
1606
|
|
|
1850
1607
|
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; } }
|
|
1851
1608
|
|
|
1852
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
1609
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
1853
1610
|
|
|
1854
1611
|
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); } }
|
|
1855
1612
|
|
|
@@ -2501,7 +2258,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
2501
2258
|
Object.defineProperty(exports, "__esModule", ({
|
|
2502
2259
|
value: true
|
|
2503
2260
|
}));
|
|
2504
|
-
exports.collect = exports.fromErrorHook = exports.fromAfterHook = exports.fromBeforeHook = void 0;
|
|
2261
|
+
exports.collect = exports.fromErrorHook = exports.fromAfterHook = exports.fromBeforeHook = exports.runHooks = exports.runHook = void 0;
|
|
2505
2262
|
|
|
2506
2263
|
var compose_js_1 = __webpack_require__(/*! ./compose.js */ "../../node_modules/@feathersjs/hooks/script/compose.js");
|
|
2507
2264
|
|
|
@@ -2516,9 +2273,23 @@ var runHook = function runHook(hook, context, type) {
|
|
|
2516
2273
|
});
|
|
2517
2274
|
};
|
|
2518
2275
|
|
|
2276
|
+
exports.runHook = runHook;
|
|
2277
|
+
|
|
2278
|
+
var runHooks = function runHooks(hooks) {
|
|
2279
|
+
return function (context) {
|
|
2280
|
+
return hooks.reduce(function (promise, hook) {
|
|
2281
|
+
return promise.then(function () {
|
|
2282
|
+
return (0, exports.runHook)(hook, context);
|
|
2283
|
+
});
|
|
2284
|
+
}, Promise.resolve(context));
|
|
2285
|
+
};
|
|
2286
|
+
};
|
|
2287
|
+
|
|
2288
|
+
exports.runHooks = runHooks;
|
|
2289
|
+
|
|
2519
2290
|
function fromBeforeHook(hook) {
|
|
2520
2291
|
return function (context, next) {
|
|
2521
|
-
return runHook(hook, context, 'before').then(next);
|
|
2292
|
+
return (0, exports.runHook)(hook, context, 'before').then(next);
|
|
2522
2293
|
};
|
|
2523
2294
|
}
|
|
2524
2295
|
|
|
@@ -2527,7 +2298,7 @@ exports.fromBeforeHook = fromBeforeHook;
|
|
|
2527
2298
|
function fromAfterHook(hook) {
|
|
2528
2299
|
return function (context, next) {
|
|
2529
2300
|
return next().then(function () {
|
|
2530
|
-
return runHook(hook, context, 'after');
|
|
2301
|
+
return (0, exports.runHook)(hook, context, 'after');
|
|
2531
2302
|
});
|
|
2532
2303
|
};
|
|
2533
2304
|
}
|
|
@@ -2543,7 +2314,7 @@ function fromErrorHook(hook) {
|
|
|
2543
2314
|
delete context.result;
|
|
2544
2315
|
}
|
|
2545
2316
|
|
|
2546
|
-
return runHook(hook, context, 'error').then(function () {
|
|
2317
|
+
return (0, exports.runHook)(hook, context, 'error').then(function () {
|
|
2547
2318
|
if (context.result === undefined && context.error !== undefined) {
|
|
2548
2319
|
throw context.error;
|
|
2549
2320
|
}
|
|
@@ -2565,8 +2336,8 @@ function collect(_ref) {
|
|
|
2565
2336
|
|
|
2566
2337
|
var afterHooks = _toConsumableArray(after).reverse().map(fromAfterHook);
|
|
2567
2338
|
|
|
2568
|
-
var errorHooks = error.
|
|
2569
|
-
return (0, compose_js_1.compose)([].concat(
|
|
2339
|
+
var errorHooks = error.length ? [fromErrorHook((0, exports.runHooks)(error))] : [];
|
|
2340
|
+
return (0, compose_js_1.compose)([].concat(errorHooks, _toConsumableArray(beforeHooks), _toConsumableArray(afterHooks)));
|
|
2570
2341
|
}
|
|
2571
2342
|
|
|
2572
2343
|
exports.collect = collect;
|