@infrab4a/connect 4.3.0-beta.0 → 4.3.0-beta.1

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/index.esm.js CHANGED
@@ -1,9 +1,10 @@
1
1
  import 'reflect-metadata';
2
2
  import { plainToInstance, instanceToPlain, Expose, Type } from 'class-transformer';
3
- import { __decorate, __metadata, __values, __spreadArray, __read, __extends, __rest } from 'tslib';
3
+ import * as tslib_1 from 'tslib';
4
+ import { __decorate, __metadata, __rest } from 'tslib';
4
5
  import { parseISO } from 'date-fns';
5
6
  export { add, addBusinessDays, addDays, addMonths, addYears, endOfDay, format, formatISO9075, parseISO, startOfDay, sub } from 'date-fns';
6
- import { isNil, isArray, first, last, flatten, compact, get, isString, each, unset, isObject, set, isNumber, isEmpty, chunk, isDate, isBoolean, isInteger, isNaN as isNaN$1, omit } from 'lodash';
7
+ import { isNil, isArray as isArray$1, first, last, flatten, compact, get, isString, each, unset, isObject as isObject$1, set, isNumber, isEmpty, chunk, isDate, isBoolean, isInteger, isNaN as isNaN$1, omit } from 'lodash';
7
8
  export { chunk, each, get, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil, isNumber, isObject, isString, now, omit, pick, set, unset } from 'lodash';
8
9
  import { debug } from 'debug';
9
10
  import { CustomError } from 'ts-custom-error';
@@ -462,401 +463,478 @@ __decorate([
462
463
  __metadata("design:type", Payment)
463
464
  ], SubscriptionPayment.prototype, "payment", void 0);
464
465
 
465
- function isFunction(value) {
466
- return typeof value === 'function';
466
+ /** PURE_IMPORTS_START PURE_IMPORTS_END */
467
+ function isFunction(x) {
468
+ return typeof x === 'function';
467
469
  }
468
470
 
469
- function createErrorClass(createImpl) {
470
- var _super = function (instance) {
471
- Error.call(instance);
472
- instance.stack = new Error().stack;
473
- };
474
- var ctorFunc = createImpl(_super);
475
- ctorFunc.prototype = Object.create(Error.prototype);
476
- ctorFunc.prototype.constructor = ctorFunc;
477
- return ctorFunc;
471
+ /** PURE_IMPORTS_START PURE_IMPORTS_END */
472
+ var _enable_super_gross_mode_that_will_cause_bad_things = false;
473
+ var config = {
474
+ Promise: undefined,
475
+ set useDeprecatedSynchronousErrorHandling(value) {
476
+ if (value) {
477
+ var error = /*@__PURE__*/ new Error();
478
+ /*@__PURE__*/ console.warn('DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n' + error.stack);
479
+ }
480
+ _enable_super_gross_mode_that_will_cause_bad_things = value;
481
+ },
482
+ get useDeprecatedSynchronousErrorHandling() {
483
+ return _enable_super_gross_mode_that_will_cause_bad_things;
484
+ },
485
+ };
486
+
487
+ /** PURE_IMPORTS_START PURE_IMPORTS_END */
488
+ function hostReportError(err) {
489
+ setTimeout(function () { throw err; }, 0);
478
490
  }
479
491
 
480
- var UnsubscriptionError = createErrorClass(function (_super) {
481
- return function UnsubscriptionErrorImpl(errors) {
482
- _super(this);
483
- this.message = errors
484
- ? errors.length + " errors occurred during unsubscription:\n" + errors.map(function (err, i) { return i + 1 + ") " + err.toString(); }).join('\n ')
485
- : '';
486
- this.name = 'UnsubscriptionError';
487
- this.errors = errors;
488
- };
489
- });
492
+ /** PURE_IMPORTS_START _config,_util_hostReportError PURE_IMPORTS_END */
493
+ var empty = {
494
+ closed: true,
495
+ next: function (value) { },
496
+ error: function (err) {
497
+ if (config.useDeprecatedSynchronousErrorHandling) {
498
+ throw err;
499
+ }
500
+ else {
501
+ hostReportError(err);
502
+ }
503
+ },
504
+ complete: function () { }
505
+ };
490
506
 
491
- function arrRemove(arr, item) {
492
- if (arr) {
493
- var index = arr.indexOf(item);
494
- 0 <= index && arr.splice(index, 1);
495
- }
507
+ /** PURE_IMPORTS_START PURE_IMPORTS_END */
508
+ var isArray = /*@__PURE__*/ (function () { return Array.isArray || (function (x) { return x && typeof x.length === 'number'; }); })();
509
+
510
+ /** PURE_IMPORTS_START PURE_IMPORTS_END */
511
+ function isObject(x) {
512
+ return x !== null && typeof x === 'object';
496
513
  }
497
514
 
498
- var Subscription$1 = (function () {
499
- function Subscription(initialTeardown) {
500
- this.initialTeardown = initialTeardown;
515
+ /** PURE_IMPORTS_START PURE_IMPORTS_END */
516
+ var UnsubscriptionErrorImpl = /*@__PURE__*/ (function () {
517
+ function UnsubscriptionErrorImpl(errors) {
518
+ Error.call(this);
519
+ this.message = errors ?
520
+ errors.length + " errors occurred during unsubscription:\n" + errors.map(function (err, i) { return i + 1 + ") " + err.toString(); }).join('\n ') : '';
521
+ this.name = 'UnsubscriptionError';
522
+ this.errors = errors;
523
+ return this;
524
+ }
525
+ UnsubscriptionErrorImpl.prototype = /*@__PURE__*/ Object.create(Error.prototype);
526
+ return UnsubscriptionErrorImpl;
527
+ })();
528
+ var UnsubscriptionError = UnsubscriptionErrorImpl;
529
+
530
+ /** PURE_IMPORTS_START _util_isArray,_util_isObject,_util_isFunction,_util_UnsubscriptionError PURE_IMPORTS_END */
531
+ var Subscription$1 = /*@__PURE__*/ (function () {
532
+ function Subscription(unsubscribe) {
501
533
  this.closed = false;
502
- this._parentage = null;
503
- this._finalizers = null;
534
+ this._parentOrParents = null;
535
+ this._subscriptions = null;
536
+ if (unsubscribe) {
537
+ this._ctorUnsubscribe = true;
538
+ this._unsubscribe = unsubscribe;
539
+ }
504
540
  }
505
541
  Subscription.prototype.unsubscribe = function () {
506
- var e_1, _a, e_2, _b;
507
542
  var errors;
508
- if (!this.closed) {
509
- this.closed = true;
510
- var _parentage = this._parentage;
511
- if (_parentage) {
512
- this._parentage = null;
513
- if (Array.isArray(_parentage)) {
514
- try {
515
- for (var _parentage_1 = __values(_parentage), _parentage_1_1 = _parentage_1.next(); !_parentage_1_1.done; _parentage_1_1 = _parentage_1.next()) {
516
- var parent_1 = _parentage_1_1.value;
517
- parent_1.remove(this);
518
- }
519
- }
520
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
521
- finally {
522
- try {
523
- if (_parentage_1_1 && !_parentage_1_1.done && (_a = _parentage_1.return)) _a.call(_parentage_1);
524
- }
525
- finally { if (e_1) throw e_1.error; }
526
- }
527
- }
528
- else {
529
- _parentage.remove(this);
530
- }
543
+ if (this.closed) {
544
+ return;
545
+ }
546
+ var _a = this, _parentOrParents = _a._parentOrParents, _ctorUnsubscribe = _a._ctorUnsubscribe, _unsubscribe = _a._unsubscribe, _subscriptions = _a._subscriptions;
547
+ this.closed = true;
548
+ this._parentOrParents = null;
549
+ this._subscriptions = null;
550
+ if (_parentOrParents instanceof Subscription) {
551
+ _parentOrParents.remove(this);
552
+ }
553
+ else if (_parentOrParents !== null) {
554
+ for (var index = 0; index < _parentOrParents.length; ++index) {
555
+ var parent_1 = _parentOrParents[index];
556
+ parent_1.remove(this);
531
557
  }
532
- var initialFinalizer = this.initialTeardown;
533
- if (isFunction(initialFinalizer)) {
534
- try {
535
- initialFinalizer();
536
- }
537
- catch (e) {
538
- errors = e instanceof UnsubscriptionError ? e.errors : [e];
539
- }
558
+ }
559
+ if (isFunction(_unsubscribe)) {
560
+ if (_ctorUnsubscribe) {
561
+ this._unsubscribe = undefined;
540
562
  }
541
- var _finalizers = this._finalizers;
542
- if (_finalizers) {
543
- this._finalizers = null;
544
- try {
545
- for (var _finalizers_1 = __values(_finalizers), _finalizers_1_1 = _finalizers_1.next(); !_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()) {
546
- var finalizer = _finalizers_1_1.value;
547
- try {
548
- execFinalizer(finalizer);
563
+ try {
564
+ _unsubscribe.call(this);
565
+ }
566
+ catch (e) {
567
+ errors = e instanceof UnsubscriptionError ? flattenUnsubscriptionErrors(e.errors) : [e];
568
+ }
569
+ }
570
+ if (isArray(_subscriptions)) {
571
+ var index = -1;
572
+ var len = _subscriptions.length;
573
+ while (++index < len) {
574
+ var sub = _subscriptions[index];
575
+ if (isObject(sub)) {
576
+ try {
577
+ sub.unsubscribe();
578
+ }
579
+ catch (e) {
580
+ errors = errors || [];
581
+ if (e instanceof UnsubscriptionError) {
582
+ errors = errors.concat(flattenUnsubscriptionErrors(e.errors));
549
583
  }
550
- catch (err) {
551
- errors = errors !== null && errors !== void 0 ? errors : [];
552
- if (err instanceof UnsubscriptionError) {
553
- errors = __spreadArray(__spreadArray([], __read(errors)), __read(err.errors));
554
- }
555
- else {
556
- errors.push(err);
557
- }
584
+ else {
585
+ errors.push(e);
558
586
  }
559
587
  }
560
588
  }
561
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
562
- finally {
563
- try {
564
- if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return)) _b.call(_finalizers_1);
565
- }
566
- finally { if (e_2) throw e_2.error; }
567
- }
568
- }
569
- if (errors) {
570
- throw new UnsubscriptionError(errors);
571
589
  }
572
590
  }
591
+ if (errors) {
592
+ throw new UnsubscriptionError(errors);
593
+ }
573
594
  };
574
595
  Subscription.prototype.add = function (teardown) {
575
- var _a;
576
- if (teardown && teardown !== this) {
577
- if (this.closed) {
578
- execFinalizer(teardown);
579
- }
580
- else {
581
- if (teardown instanceof Subscription) {
582
- if (teardown.closed || teardown._hasParent(this)) {
583
- return;
584
- }
585
- teardown._addParent(this);
596
+ var subscription = teardown;
597
+ if (!teardown) {
598
+ return Subscription.EMPTY;
599
+ }
600
+ switch (typeof teardown) {
601
+ case 'function':
602
+ subscription = new Subscription(teardown);
603
+ case 'object':
604
+ if (subscription === this || subscription.closed || typeof subscription.unsubscribe !== 'function') {
605
+ return subscription;
606
+ }
607
+ else if (this.closed) {
608
+ subscription.unsubscribe();
609
+ return subscription;
610
+ }
611
+ else if (!(subscription instanceof Subscription)) {
612
+ var tmp = subscription;
613
+ subscription = new Subscription();
614
+ subscription._subscriptions = [tmp];
586
615
  }
587
- (this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);
616
+ break;
617
+ default: {
618
+ throw new Error('unrecognized teardown ' + teardown + ' added to Subscription.');
588
619
  }
589
620
  }
590
- };
591
- Subscription.prototype._hasParent = function (parent) {
592
- var _parentage = this._parentage;
593
- return _parentage === parent || (Array.isArray(_parentage) && _parentage.includes(parent));
594
- };
595
- Subscription.prototype._addParent = function (parent) {
596
- var _parentage = this._parentage;
597
- this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
598
- };
599
- Subscription.prototype._removeParent = function (parent) {
600
- var _parentage = this._parentage;
601
- if (_parentage === parent) {
602
- this._parentage = null;
621
+ var _parentOrParents = subscription._parentOrParents;
622
+ if (_parentOrParents === null) {
623
+ subscription._parentOrParents = this;
624
+ }
625
+ else if (_parentOrParents instanceof Subscription) {
626
+ if (_parentOrParents === this) {
627
+ return subscription;
628
+ }
629
+ subscription._parentOrParents = [_parentOrParents, this];
630
+ }
631
+ else if (_parentOrParents.indexOf(this) === -1) {
632
+ _parentOrParents.push(this);
603
633
  }
604
- else if (Array.isArray(_parentage)) {
605
- arrRemove(_parentage, parent);
634
+ else {
635
+ return subscription;
636
+ }
637
+ var subscriptions = this._subscriptions;
638
+ if (subscriptions === null) {
639
+ this._subscriptions = [subscription];
606
640
  }
641
+ else {
642
+ subscriptions.push(subscription);
643
+ }
644
+ return subscription;
607
645
  };
608
- Subscription.prototype.remove = function (teardown) {
609
- var _finalizers = this._finalizers;
610
- _finalizers && arrRemove(_finalizers, teardown);
611
- if (teardown instanceof Subscription) {
612
- teardown._removeParent(this);
646
+ Subscription.prototype.remove = function (subscription) {
647
+ var subscriptions = this._subscriptions;
648
+ if (subscriptions) {
649
+ var subscriptionIndex = subscriptions.indexOf(subscription);
650
+ if (subscriptionIndex !== -1) {
651
+ subscriptions.splice(subscriptionIndex, 1);
652
+ }
613
653
  }
614
654
  };
615
- Subscription.EMPTY = (function () {
616
- var empty = new Subscription();
655
+ Subscription.EMPTY = (function (empty) {
617
656
  empty.closed = true;
618
657
  return empty;
619
- })();
658
+ }(new Subscription()));
620
659
  return Subscription;
621
660
  }());
622
- var EMPTY_SUBSCRIPTION = Subscription$1.EMPTY;
623
- function isSubscription(value) {
624
- return (value instanceof Subscription$1 ||
625
- (value && 'closed' in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe)));
626
- }
627
- function execFinalizer(finalizer) {
628
- if (isFunction(finalizer)) {
629
- finalizer();
630
- }
631
- else {
632
- finalizer.unsubscribe();
633
- }
634
- }
635
-
636
- var config = {
637
- onUnhandledError: null,
638
- onStoppedNotification: null,
639
- Promise: undefined,
640
- useDeprecatedSynchronousErrorHandling: false,
641
- useDeprecatedNextContext: false,
642
- };
643
-
644
- var timeoutProvider = {
645
- setTimeout: function (handler, timeout) {
646
- var args = [];
647
- for (var _i = 2; _i < arguments.length; _i++) {
648
- args[_i - 2] = arguments[_i];
649
- }
650
- var delegate = timeoutProvider.delegate;
651
- if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) {
652
- return delegate.setTimeout.apply(delegate, __spreadArray([handler, timeout], __read(args)));
653
- }
654
- return setTimeout.apply(void 0, __spreadArray([handler, timeout], __read(args)));
655
- },
656
- clearTimeout: function (handle) {
657
- var delegate = timeoutProvider.delegate;
658
- return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle);
659
- },
660
- delegate: undefined,
661
- };
662
-
663
- function reportUnhandledError(err) {
664
- timeoutProvider.setTimeout(function () {
665
- {
666
- throw err;
667
- }
668
- });
661
+ function flattenUnsubscriptionErrors(errors) {
662
+ return errors.reduce(function (errs, err) { return errs.concat((err instanceof UnsubscriptionError) ? err.errors : err); }, []);
669
663
  }
670
664
 
671
- function noop() { }
672
-
673
- var context = null;
674
- function errorContext(cb) {
675
- if (config.useDeprecatedSynchronousErrorHandling) {
676
- var isRoot = !context;
677
- if (isRoot) {
678
- context = { errorThrown: false, error: null };
679
- }
680
- cb();
681
- if (isRoot) {
682
- var _a = context, errorThrown = _a.errorThrown, error = _a.error;
683
- context = null;
684
- if (errorThrown) {
685
- throw error;
686
- }
687
- }
688
- }
689
- else {
690
- cb();
691
- }
692
- }
693
-
694
- var Subscriber = (function (_super) {
695
- __extends(Subscriber, _super);
696
- function Subscriber(destination) {
665
+ /** PURE_IMPORTS_START PURE_IMPORTS_END */
666
+ var rxSubscriber = /*@__PURE__*/ (function () {
667
+ return typeof Symbol === 'function'
668
+ ? /*@__PURE__*/ Symbol('rxSubscriber')
669
+ : '@@rxSubscriber_' + /*@__PURE__*/ Math.random();
670
+ })();
671
+
672
+ /** PURE_IMPORTS_START tslib,_util_isFunction,_Observer,_Subscription,_internal_symbol_rxSubscriber,_config,_util_hostReportError PURE_IMPORTS_END */
673
+ var Subscriber = /*@__PURE__*/ (function (_super) {
674
+ tslib_1.__extends(Subscriber, _super);
675
+ function Subscriber(destinationOrNext, error, complete) {
697
676
  var _this = _super.call(this) || this;
677
+ _this.syncErrorValue = null;
678
+ _this.syncErrorThrown = false;
679
+ _this.syncErrorThrowable = false;
698
680
  _this.isStopped = false;
699
- if (destination) {
700
- _this.destination = destination;
701
- if (isSubscription(destination)) {
702
- destination.add(_this);
703
- }
704
- }
705
- else {
706
- _this.destination = EMPTY_OBSERVER;
681
+ switch (arguments.length) {
682
+ case 0:
683
+ _this.destination = empty;
684
+ break;
685
+ case 1:
686
+ if (!destinationOrNext) {
687
+ _this.destination = empty;
688
+ break;
689
+ }
690
+ if (typeof destinationOrNext === 'object') {
691
+ if (destinationOrNext instanceof Subscriber) {
692
+ _this.syncErrorThrowable = destinationOrNext.syncErrorThrowable;
693
+ _this.destination = destinationOrNext;
694
+ destinationOrNext.add(_this);
695
+ }
696
+ else {
697
+ _this.syncErrorThrowable = true;
698
+ _this.destination = new SafeSubscriber(_this, destinationOrNext);
699
+ }
700
+ break;
701
+ }
702
+ default:
703
+ _this.syncErrorThrowable = true;
704
+ _this.destination = new SafeSubscriber(_this, destinationOrNext, error, complete);
705
+ break;
707
706
  }
708
707
  return _this;
709
708
  }
709
+ Subscriber.prototype[rxSubscriber] = function () { return this; };
710
710
  Subscriber.create = function (next, error, complete) {
711
- return new SafeSubscriber(next, error, complete);
711
+ var subscriber = new Subscriber(next, error, complete);
712
+ subscriber.syncErrorThrowable = false;
713
+ return subscriber;
712
714
  };
713
715
  Subscriber.prototype.next = function (value) {
714
- if (this.isStopped) ;
715
- else {
716
+ if (!this.isStopped) {
716
717
  this._next(value);
717
718
  }
718
719
  };
719
720
  Subscriber.prototype.error = function (err) {
720
- if (this.isStopped) ;
721
- else {
721
+ if (!this.isStopped) {
722
722
  this.isStopped = true;
723
723
  this._error(err);
724
724
  }
725
725
  };
726
726
  Subscriber.prototype.complete = function () {
727
- if (this.isStopped) ;
728
- else {
727
+ if (!this.isStopped) {
729
728
  this.isStopped = true;
730
729
  this._complete();
731
730
  }
732
731
  };
733
732
  Subscriber.prototype.unsubscribe = function () {
734
- if (!this.closed) {
735
- this.isStopped = true;
736
- _super.prototype.unsubscribe.call(this);
737
- this.destination = null;
733
+ if (this.closed) {
734
+ return;
738
735
  }
736
+ this.isStopped = true;
737
+ _super.prototype.unsubscribe.call(this);
739
738
  };
740
739
  Subscriber.prototype._next = function (value) {
741
740
  this.destination.next(value);
742
741
  };
743
742
  Subscriber.prototype._error = function (err) {
744
- try {
745
- this.destination.error(err);
746
- }
747
- finally {
748
- this.unsubscribe();
749
- }
743
+ this.destination.error(err);
744
+ this.unsubscribe();
750
745
  };
751
746
  Subscriber.prototype._complete = function () {
752
- try {
753
- this.destination.complete();
754
- }
755
- finally {
756
- this.unsubscribe();
757
- }
747
+ this.destination.complete();
748
+ this.unsubscribe();
749
+ };
750
+ Subscriber.prototype._unsubscribeAndRecycle = function () {
751
+ var _parentOrParents = this._parentOrParents;
752
+ this._parentOrParents = null;
753
+ this.unsubscribe();
754
+ this.closed = false;
755
+ this.isStopped = false;
756
+ this._parentOrParents = _parentOrParents;
757
+ return this;
758
758
  };
759
759
  return Subscriber;
760
760
  }(Subscription$1));
761
- var _bind = Function.prototype.bind;
762
- function bind(fn, thisArg) {
763
- return _bind.call(fn, thisArg);
764
- }
765
- var ConsumerObserver = (function () {
766
- function ConsumerObserver(partialObserver) {
767
- this.partialObserver = partialObserver;
761
+ var SafeSubscriber = /*@__PURE__*/ (function (_super) {
762
+ tslib_1.__extends(SafeSubscriber, _super);
763
+ function SafeSubscriber(_parentSubscriber, observerOrNext, error, complete) {
764
+ var _this = _super.call(this) || this;
765
+ _this._parentSubscriber = _parentSubscriber;
766
+ var next;
767
+ var context = _this;
768
+ if (isFunction(observerOrNext)) {
769
+ next = observerOrNext;
770
+ }
771
+ else if (observerOrNext) {
772
+ next = observerOrNext.next;
773
+ error = observerOrNext.error;
774
+ complete = observerOrNext.complete;
775
+ if (observerOrNext !== empty) {
776
+ context = Object.create(observerOrNext);
777
+ if (isFunction(context.unsubscribe)) {
778
+ _this.add(context.unsubscribe.bind(context));
779
+ }
780
+ context.unsubscribe = _this.unsubscribe.bind(_this);
781
+ }
782
+ }
783
+ _this._context = context;
784
+ _this._next = next;
785
+ _this._error = error;
786
+ _this._complete = complete;
787
+ return _this;
768
788
  }
769
- ConsumerObserver.prototype.next = function (value) {
770
- var partialObserver = this.partialObserver;
771
- if (partialObserver.next) {
772
- try {
773
- partialObserver.next(value);
789
+ SafeSubscriber.prototype.next = function (value) {
790
+ if (!this.isStopped && this._next) {
791
+ var _parentSubscriber = this._parentSubscriber;
792
+ if (!config.useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
793
+ this.__tryOrUnsub(this._next, value);
774
794
  }
775
- catch (error) {
776
- handleUnhandledError(error);
795
+ else if (this.__tryOrSetError(_parentSubscriber, this._next, value)) {
796
+ this.unsubscribe();
777
797
  }
778
798
  }
779
799
  };
780
- ConsumerObserver.prototype.error = function (err) {
781
- var partialObserver = this.partialObserver;
782
- if (partialObserver.error) {
783
- try {
784
- partialObserver.error(err);
800
+ SafeSubscriber.prototype.error = function (err) {
801
+ if (!this.isStopped) {
802
+ var _parentSubscriber = this._parentSubscriber;
803
+ var useDeprecatedSynchronousErrorHandling = config.useDeprecatedSynchronousErrorHandling;
804
+ if (this._error) {
805
+ if (!useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
806
+ this.__tryOrUnsub(this._error, err);
807
+ this.unsubscribe();
808
+ }
809
+ else {
810
+ this.__tryOrSetError(_parentSubscriber, this._error, err);
811
+ this.unsubscribe();
812
+ }
785
813
  }
786
- catch (error) {
787
- handleUnhandledError(error);
814
+ else if (!_parentSubscriber.syncErrorThrowable) {
815
+ this.unsubscribe();
816
+ if (useDeprecatedSynchronousErrorHandling) {
817
+ throw err;
818
+ }
819
+ hostReportError(err);
820
+ }
821
+ else {
822
+ if (useDeprecatedSynchronousErrorHandling) {
823
+ _parentSubscriber.syncErrorValue = err;
824
+ _parentSubscriber.syncErrorThrown = true;
825
+ }
826
+ else {
827
+ hostReportError(err);
828
+ }
829
+ this.unsubscribe();
788
830
  }
789
831
  }
790
- else {
791
- handleUnhandledError(err);
832
+ };
833
+ SafeSubscriber.prototype.complete = function () {
834
+ var _this = this;
835
+ if (!this.isStopped) {
836
+ var _parentSubscriber = this._parentSubscriber;
837
+ if (this._complete) {
838
+ var wrappedComplete = function () { return _this._complete.call(_this._context); };
839
+ if (!config.useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
840
+ this.__tryOrUnsub(wrappedComplete);
841
+ this.unsubscribe();
842
+ }
843
+ else {
844
+ this.__tryOrSetError(_parentSubscriber, wrappedComplete);
845
+ this.unsubscribe();
846
+ }
847
+ }
848
+ else {
849
+ this.unsubscribe();
850
+ }
792
851
  }
793
852
  };
794
- ConsumerObserver.prototype.complete = function () {
795
- var partialObserver = this.partialObserver;
796
- if (partialObserver.complete) {
797
- try {
798
- partialObserver.complete();
853
+ SafeSubscriber.prototype.__tryOrUnsub = function (fn, value) {
854
+ try {
855
+ fn.call(this._context, value);
856
+ }
857
+ catch (err) {
858
+ this.unsubscribe();
859
+ if (config.useDeprecatedSynchronousErrorHandling) {
860
+ throw err;
799
861
  }
800
- catch (error) {
801
- handleUnhandledError(error);
862
+ else {
863
+ hostReportError(err);
802
864
  }
803
865
  }
804
866
  };
805
- return ConsumerObserver;
806
- }());
807
- var SafeSubscriber = (function (_super) {
808
- __extends(SafeSubscriber, _super);
809
- function SafeSubscriber(observerOrNext, error, complete) {
810
- var _this = _super.call(this) || this;
811
- var partialObserver;
812
- if (isFunction(observerOrNext) || !observerOrNext) {
813
- partialObserver = {
814
- next: (observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined),
815
- error: error !== null && error !== void 0 ? error : undefined,
816
- complete: complete !== null && complete !== void 0 ? complete : undefined,
817
- };
867
+ SafeSubscriber.prototype.__tryOrSetError = function (parent, fn, value) {
868
+ if (!config.useDeprecatedSynchronousErrorHandling) {
869
+ throw new Error('bad call');
818
870
  }
819
- else {
820
- var context_1;
821
- if (_this && config.useDeprecatedNextContext) {
822
- context_1 = Object.create(observerOrNext);
823
- context_1.unsubscribe = function () { return _this.unsubscribe(); };
824
- partialObserver = {
825
- next: observerOrNext.next && bind(observerOrNext.next, context_1),
826
- error: observerOrNext.error && bind(observerOrNext.error, context_1),
827
- complete: observerOrNext.complete && bind(observerOrNext.complete, context_1),
828
- };
871
+ try {
872
+ fn.call(this._context, value);
873
+ }
874
+ catch (err) {
875
+ if (config.useDeprecatedSynchronousErrorHandling) {
876
+ parent.syncErrorValue = err;
877
+ parent.syncErrorThrown = true;
878
+ return true;
829
879
  }
830
880
  else {
831
- partialObserver = observerOrNext;
881
+ hostReportError(err);
882
+ return true;
832
883
  }
833
884
  }
834
- _this.destination = new ConsumerObserver(partialObserver);
835
- return _this;
836
- }
885
+ return false;
886
+ };
887
+ SafeSubscriber.prototype._unsubscribe = function () {
888
+ var _parentSubscriber = this._parentSubscriber;
889
+ this._context = null;
890
+ this._parentSubscriber = null;
891
+ _parentSubscriber.unsubscribe();
892
+ };
837
893
  return SafeSubscriber;
838
894
  }(Subscriber));
839
- function handleUnhandledError(error) {
840
- {
841
- reportUnhandledError(error);
895
+
896
+ /** PURE_IMPORTS_START _Subscriber PURE_IMPORTS_END */
897
+ function canReportError(observer) {
898
+ while (observer) {
899
+ var _a = observer, closed_1 = _a.closed, destination = _a.destination, isStopped = _a.isStopped;
900
+ if (closed_1 || isStopped) {
901
+ return false;
902
+ }
903
+ else if (destination && destination instanceof Subscriber) {
904
+ observer = destination;
905
+ }
906
+ else {
907
+ observer = null;
908
+ }
842
909
  }
910
+ return true;
843
911
  }
844
- function defaultErrorHandler(err) {
845
- throw err;
912
+
913
+ /** PURE_IMPORTS_START _Subscriber,_symbol_rxSubscriber,_Observer PURE_IMPORTS_END */
914
+ function toSubscriber(nextOrObserver, error, complete) {
915
+ if (nextOrObserver) {
916
+ if (nextOrObserver instanceof Subscriber) {
917
+ return nextOrObserver;
918
+ }
919
+ if (nextOrObserver[rxSubscriber]) {
920
+ return nextOrObserver[rxSubscriber]();
921
+ }
922
+ }
923
+ if (!nextOrObserver && !error && !complete) {
924
+ return new Subscriber(empty);
925
+ }
926
+ return new Subscriber(nextOrObserver, error, complete);
846
927
  }
847
- var EMPTY_OBSERVER = {
848
- closed: true,
849
- next: noop,
850
- error: defaultErrorHandler,
851
- complete: noop,
852
- };
853
928
 
854
- var observable = (function () { return (typeof Symbol === 'function' && Symbol.observable) || '@@observable'; })();
929
+ /** PURE_IMPORTS_START PURE_IMPORTS_END */
930
+ var observable = /*@__PURE__*/ (function () { return typeof Symbol === 'function' && Symbol.observable || '@@observable'; })();
855
931
 
932
+ /** PURE_IMPORTS_START PURE_IMPORTS_END */
856
933
  function identity(x) {
857
934
  return x;
858
935
  }
859
936
 
937
+ /** PURE_IMPORTS_START _identity PURE_IMPORTS_END */
860
938
  function pipeFromArray(fns) {
861
939
  if (fns.length === 0) {
862
940
  return identity;
@@ -869,8 +947,10 @@ function pipeFromArray(fns) {
869
947
  };
870
948
  }
871
949
 
872
- var Observable = (function () {
950
+ /** PURE_IMPORTS_START _util_canReportError,_util_toSubscriber,_symbol_observable,_util_pipe,_config PURE_IMPORTS_END */
951
+ var Observable = /*@__PURE__*/ (function () {
873
952
  function Observable(subscribe) {
953
+ this._isScalar = false;
874
954
  if (subscribe) {
875
955
  this._subscribe = subscribe;
876
956
  }
@@ -882,52 +962,64 @@ var Observable = (function () {
882
962
  return observable;
883
963
  };
884
964
  Observable.prototype.subscribe = function (observerOrNext, error, complete) {
885
- var _this = this;
886
- var subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);
887
- errorContext(function () {
888
- var _a = _this, operator = _a.operator, source = _a.source;
889
- subscriber.add(operator
890
- ?
891
- operator.call(subscriber, source)
892
- : source
893
- ?
894
- _this._subscribe(subscriber)
895
- :
896
- _this._trySubscribe(subscriber));
897
- });
898
- return subscriber;
965
+ var operator = this.operator;
966
+ var sink = toSubscriber(observerOrNext, error, complete);
967
+ if (operator) {
968
+ sink.add(operator.call(sink, this.source));
969
+ }
970
+ else {
971
+ sink.add(this.source || (config.useDeprecatedSynchronousErrorHandling && !sink.syncErrorThrowable) ?
972
+ this._subscribe(sink) :
973
+ this._trySubscribe(sink));
974
+ }
975
+ if (config.useDeprecatedSynchronousErrorHandling) {
976
+ if (sink.syncErrorThrowable) {
977
+ sink.syncErrorThrowable = false;
978
+ if (sink.syncErrorThrown) {
979
+ throw sink.syncErrorValue;
980
+ }
981
+ }
982
+ }
983
+ return sink;
899
984
  };
900
985
  Observable.prototype._trySubscribe = function (sink) {
901
986
  try {
902
987
  return this._subscribe(sink);
903
988
  }
904
989
  catch (err) {
905
- sink.error(err);
990
+ if (config.useDeprecatedSynchronousErrorHandling) {
991
+ sink.syncErrorThrown = true;
992
+ sink.syncErrorValue = err;
993
+ }
994
+ if (canReportError(sink)) {
995
+ sink.error(err);
996
+ }
997
+ else {
998
+ console.warn(err);
999
+ }
906
1000
  }
907
1001
  };
908
1002
  Observable.prototype.forEach = function (next, promiseCtor) {
909
1003
  var _this = this;
910
1004
  promiseCtor = getPromiseCtor(promiseCtor);
911
1005
  return new promiseCtor(function (resolve, reject) {
912
- var subscriber = new SafeSubscriber({
913
- next: function (value) {
914
- try {
915
- next(value);
916
- }
917
- catch (err) {
918
- reject(err);
919
- subscriber.unsubscribe();
1006
+ var subscription;
1007
+ subscription = _this.subscribe(function (value) {
1008
+ try {
1009
+ next(value);
1010
+ }
1011
+ catch (err) {
1012
+ reject(err);
1013
+ if (subscription) {
1014
+ subscription.unsubscribe();
920
1015
  }
921
- },
922
- error: reject,
923
- complete: resolve,
924
- });
925
- _this.subscribe(subscriber);
1016
+ }
1017
+ }, reject, resolve);
926
1018
  });
927
1019
  };
928
1020
  Observable.prototype._subscribe = function (subscriber) {
929
- var _a;
930
- return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber);
1021
+ var source = this.source;
1022
+ return source && source.subscribe(subscriber);
931
1023
  };
932
1024
  Observable.prototype[observable] = function () {
933
1025
  return this;
@@ -937,6 +1029,9 @@ var Observable = (function () {
937
1029
  for (var _i = 0; _i < arguments.length; _i++) {
938
1030
  operations[_i] = arguments[_i];
939
1031
  }
1032
+ if (operations.length === 0) {
1033
+ return this;
1034
+ }
940
1035
  return pipeFromArray(operations)(this);
941
1036
  };
942
1037
  Observable.prototype.toPromise = function (promiseCtor) {
@@ -944,7 +1039,7 @@ var Observable = (function () {
944
1039
  promiseCtor = getPromiseCtor(promiseCtor);
945
1040
  return new promiseCtor(function (resolve, reject) {
946
1041
  var value;
947
- _this.subscribe(function (x) { return (value = x); }, function (err) { return reject(err); }, function () { return resolve(value); });
1042
+ _this.subscribe(function (x) { return value = x; }, function (err) { return reject(err); }, function () { return resolve(value); });
948
1043
  });
949
1044
  };
950
1045
  Observable.create = function (subscribe) {
@@ -953,139 +1048,155 @@ var Observable = (function () {
953
1048
  return Observable;
954
1049
  }());
955
1050
  function getPromiseCtor(promiseCtor) {
956
- var _a;
957
- return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a !== void 0 ? _a : Promise;
958
- }
959
- function isObserver(value) {
960
- return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);
961
- }
962
- function isSubscriber(value) {
963
- return (value && value instanceof Subscriber) || (isObserver(value) && isSubscription(value));
1051
+ if (!promiseCtor) {
1052
+ promiseCtor = config.Promise || Promise;
1053
+ }
1054
+ if (!promiseCtor) {
1055
+ throw new Error('no Promise impl found');
1056
+ }
1057
+ return promiseCtor;
964
1058
  }
965
1059
 
966
- var ObjectUnsubscribedError = createErrorClass(function (_super) {
967
- return function ObjectUnsubscribedErrorImpl() {
968
- _super(this);
969
- this.name = 'ObjectUnsubscribedError';
1060
+ /** PURE_IMPORTS_START PURE_IMPORTS_END */
1061
+ var ObjectUnsubscribedErrorImpl = /*@__PURE__*/ (function () {
1062
+ function ObjectUnsubscribedErrorImpl() {
1063
+ Error.call(this);
970
1064
  this.message = 'object unsubscribed';
1065
+ this.name = 'ObjectUnsubscribedError';
1066
+ return this;
1067
+ }
1068
+ ObjectUnsubscribedErrorImpl.prototype = /*@__PURE__*/ Object.create(Error.prototype);
1069
+ return ObjectUnsubscribedErrorImpl;
1070
+ })();
1071
+ var ObjectUnsubscribedError = ObjectUnsubscribedErrorImpl;
1072
+
1073
+ /** PURE_IMPORTS_START tslib,_Subscription PURE_IMPORTS_END */
1074
+ var SubjectSubscription = /*@__PURE__*/ (function (_super) {
1075
+ tslib_1.__extends(SubjectSubscription, _super);
1076
+ function SubjectSubscription(subject, subscriber) {
1077
+ var _this = _super.call(this) || this;
1078
+ _this.subject = subject;
1079
+ _this.subscriber = subscriber;
1080
+ _this.closed = false;
1081
+ return _this;
1082
+ }
1083
+ SubjectSubscription.prototype.unsubscribe = function () {
1084
+ if (this.closed) {
1085
+ return;
1086
+ }
1087
+ this.closed = true;
1088
+ var subject = this.subject;
1089
+ var observers = subject.observers;
1090
+ this.subject = null;
1091
+ if (!observers || observers.length === 0 || subject.isStopped || subject.closed) {
1092
+ return;
1093
+ }
1094
+ var subscriberIndex = observers.indexOf(this.subscriber);
1095
+ if (subscriberIndex !== -1) {
1096
+ observers.splice(subscriberIndex, 1);
1097
+ }
971
1098
  };
972
- });
1099
+ return SubjectSubscription;
1100
+ }(Subscription$1));
973
1101
 
974
- var Subject = (function (_super) {
975
- __extends(Subject, _super);
1102
+ /** PURE_IMPORTS_START tslib,_Observable,_Subscriber,_Subscription,_util_ObjectUnsubscribedError,_SubjectSubscription,_internal_symbol_rxSubscriber PURE_IMPORTS_END */
1103
+ var SubjectSubscriber = /*@__PURE__*/ (function (_super) {
1104
+ tslib_1.__extends(SubjectSubscriber, _super);
1105
+ function SubjectSubscriber(destination) {
1106
+ var _this = _super.call(this, destination) || this;
1107
+ _this.destination = destination;
1108
+ return _this;
1109
+ }
1110
+ return SubjectSubscriber;
1111
+ }(Subscriber));
1112
+ var Subject = /*@__PURE__*/ (function (_super) {
1113
+ tslib_1.__extends(Subject, _super);
976
1114
  function Subject() {
977
1115
  var _this = _super.call(this) || this;
978
- _this.closed = false;
979
- _this.currentObservers = null;
980
1116
  _this.observers = [];
1117
+ _this.closed = false;
981
1118
  _this.isStopped = false;
982
1119
  _this.hasError = false;
983
1120
  _this.thrownError = null;
984
1121
  return _this;
985
1122
  }
1123
+ Subject.prototype[rxSubscriber] = function () {
1124
+ return new SubjectSubscriber(this);
1125
+ };
986
1126
  Subject.prototype.lift = function (operator) {
987
1127
  var subject = new AnonymousSubject(this, this);
988
1128
  subject.operator = operator;
989
1129
  return subject;
990
1130
  };
991
- Subject.prototype._throwIfClosed = function () {
1131
+ Subject.prototype.next = function (value) {
992
1132
  if (this.closed) {
993
1133
  throw new ObjectUnsubscribedError();
994
1134
  }
995
- };
996
- Subject.prototype.next = function (value) {
997
- var _this = this;
998
- errorContext(function () {
999
- var e_1, _a;
1000
- _this._throwIfClosed();
1001
- if (!_this.isStopped) {
1002
- if (!_this.currentObservers) {
1003
- _this.currentObservers = Array.from(_this.observers);
1004
- }
1005
- try {
1006
- for (var _b = __values(_this.currentObservers), _c = _b.next(); !_c.done; _c = _b.next()) {
1007
- var observer = _c.value;
1008
- observer.next(value);
1009
- }
1010
- }
1011
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1012
- finally {
1013
- try {
1014
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1015
- }
1016
- finally { if (e_1) throw e_1.error; }
1017
- }
1135
+ if (!this.isStopped) {
1136
+ var observers = this.observers;
1137
+ var len = observers.length;
1138
+ var copy = observers.slice();
1139
+ for (var i = 0; i < len; i++) {
1140
+ copy[i].next(value);
1018
1141
  }
1019
- });
1142
+ }
1020
1143
  };
1021
1144
  Subject.prototype.error = function (err) {
1022
- var _this = this;
1023
- errorContext(function () {
1024
- _this._throwIfClosed();
1025
- if (!_this.isStopped) {
1026
- _this.hasError = _this.isStopped = true;
1027
- _this.thrownError = err;
1028
- var observers = _this.observers;
1029
- while (observers.length) {
1030
- observers.shift().error(err);
1031
- }
1032
- }
1033
- });
1145
+ if (this.closed) {
1146
+ throw new ObjectUnsubscribedError();
1147
+ }
1148
+ this.hasError = true;
1149
+ this.thrownError = err;
1150
+ this.isStopped = true;
1151
+ var observers = this.observers;
1152
+ var len = observers.length;
1153
+ var copy = observers.slice();
1154
+ for (var i = 0; i < len; i++) {
1155
+ copy[i].error(err);
1156
+ }
1157
+ this.observers.length = 0;
1034
1158
  };
1035
1159
  Subject.prototype.complete = function () {
1036
- var _this = this;
1037
- errorContext(function () {
1038
- _this._throwIfClosed();
1039
- if (!_this.isStopped) {
1040
- _this.isStopped = true;
1041
- var observers = _this.observers;
1042
- while (observers.length) {
1043
- observers.shift().complete();
1044
- }
1045
- }
1046
- });
1160
+ if (this.closed) {
1161
+ throw new ObjectUnsubscribedError();
1162
+ }
1163
+ this.isStopped = true;
1164
+ var observers = this.observers;
1165
+ var len = observers.length;
1166
+ var copy = observers.slice();
1167
+ for (var i = 0; i < len; i++) {
1168
+ copy[i].complete();
1169
+ }
1170
+ this.observers.length = 0;
1047
1171
  };
1048
1172
  Subject.prototype.unsubscribe = function () {
1049
- this.isStopped = this.closed = true;
1050
- this.observers = this.currentObservers = null;
1173
+ this.isStopped = true;
1174
+ this.closed = true;
1175
+ this.observers = null;
1051
1176
  };
1052
- Object.defineProperty(Subject.prototype, "observed", {
1053
- get: function () {
1054
- var _a;
1055
- return ((_a = this.observers) === null || _a === void 0 ? void 0 : _a.length) > 0;
1056
- },
1057
- enumerable: false,
1058
- configurable: true
1059
- });
1060
1177
  Subject.prototype._trySubscribe = function (subscriber) {
1061
- this._throwIfClosed();
1062
- return _super.prototype._trySubscribe.call(this, subscriber);
1178
+ if (this.closed) {
1179
+ throw new ObjectUnsubscribedError();
1180
+ }
1181
+ else {
1182
+ return _super.prototype._trySubscribe.call(this, subscriber);
1183
+ }
1063
1184
  };
1064
1185
  Subject.prototype._subscribe = function (subscriber) {
1065
- this._throwIfClosed();
1066
- this._checkFinalizedStatuses(subscriber);
1067
- return this._innerSubscribe(subscriber);
1068
- };
1069
- Subject.prototype._innerSubscribe = function (subscriber) {
1070
- var _this = this;
1071
- var _a = this, hasError = _a.hasError, isStopped = _a.isStopped, observers = _a.observers;
1072
- if (hasError || isStopped) {
1073
- return EMPTY_SUBSCRIPTION;
1186
+ if (this.closed) {
1187
+ throw new ObjectUnsubscribedError();
1074
1188
  }
1075
- this.currentObservers = null;
1076
- observers.push(subscriber);
1077
- return new Subscription$1(function () {
1078
- _this.currentObservers = null;
1079
- arrRemove(observers, subscriber);
1080
- });
1081
- };
1082
- Subject.prototype._checkFinalizedStatuses = function (subscriber) {
1083
- var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, isStopped = _a.isStopped;
1084
- if (hasError) {
1085
- subscriber.error(thrownError);
1189
+ else if (this.hasError) {
1190
+ subscriber.error(this.thrownError);
1191
+ return Subscription$1.EMPTY;
1086
1192
  }
1087
- else if (isStopped) {
1193
+ else if (this.isStopped) {
1088
1194
  subscriber.complete();
1195
+ return Subscription$1.EMPTY;
1196
+ }
1197
+ else {
1198
+ this.observers.push(subscriber);
1199
+ return new SubjectSubscription(this, subscriber);
1089
1200
  }
1090
1201
  };
1091
1202
  Subject.prototype.asObservable = function () {
@@ -1098,8 +1209,8 @@ var Subject = (function (_super) {
1098
1209
  };
1099
1210
  return Subject;
1100
1211
  }(Observable));
1101
- var AnonymousSubject = (function (_super) {
1102
- __extends(AnonymousSubject, _super);
1212
+ var AnonymousSubject = /*@__PURE__*/ (function (_super) {
1213
+ tslib_1.__extends(AnonymousSubject, _super);
1103
1214
  function AnonymousSubject(destination, source) {
1104
1215
  var _this = _super.call(this) || this;
1105
1216
  _this.destination = destination;
@@ -1107,20 +1218,31 @@ var AnonymousSubject = (function (_super) {
1107
1218
  return _this;
1108
1219
  }
1109
1220
  AnonymousSubject.prototype.next = function (value) {
1110
- var _a, _b;
1111
- (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.next) === null || _b === void 0 ? void 0 : _b.call(_a, value);
1221
+ var destination = this.destination;
1222
+ if (destination && destination.next) {
1223
+ destination.next(value);
1224
+ }
1112
1225
  };
1113
1226
  AnonymousSubject.prototype.error = function (err) {
1114
- var _a, _b;
1115
- (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.call(_a, err);
1227
+ var destination = this.destination;
1228
+ if (destination && destination.error) {
1229
+ this.destination.error(err);
1230
+ }
1116
1231
  };
1117
1232
  AnonymousSubject.prototype.complete = function () {
1118
- var _a, _b;
1119
- (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.complete) === null || _b === void 0 ? void 0 : _b.call(_a);
1233
+ var destination = this.destination;
1234
+ if (destination && destination.complete) {
1235
+ this.destination.complete();
1236
+ }
1120
1237
  };
1121
1238
  AnonymousSubject.prototype._subscribe = function (subscriber) {
1122
- var _a, _b;
1123
- return (_b = (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber)) !== null && _b !== void 0 ? _b : EMPTY_SUBSCRIPTION;
1239
+ var source = this.source;
1240
+ if (source) {
1241
+ return this.source.subscribe(subscriber);
1242
+ }
1243
+ else {
1244
+ return Subscription$1.EMPTY;
1245
+ }
1124
1246
  };
1125
1247
  return AnonymousSubject;
1126
1248
  }(Subject));
@@ -1162,11 +1284,11 @@ class ReflectHelper {
1162
1284
  }
1163
1285
  static first({ key, target, property, own = true }) {
1164
1286
  const values = ReflectHelper.get({ key, target, property, own });
1165
- return isArray(values) ? first(values) : values;
1287
+ return isArray$1(values) ? first(values) : values;
1166
1288
  }
1167
1289
  static last({ key, target, property, own = true }) {
1168
1290
  const values = ReflectHelper.get({ key, target, property, own });
1169
- return isArray(values) ? last(values) : values;
1291
+ return isArray$1(values) ? last(values) : values;
1170
1292
  }
1171
1293
  static set({ key, target, property, value, propertyDescriptor }) {
1172
1294
  Reflect.defineMetadata(key, value, target, property);
@@ -1192,7 +1314,7 @@ class ReflectHelper {
1192
1314
  const values = target[property];
1193
1315
  let value = values.value;
1194
1316
  const propertyDescriptor = values.propertyDescriptor;
1195
- if (!isArray(value))
1317
+ if (!isArray$1(value))
1196
1318
  value = [value];
1197
1319
  return flatten(value.map((val) => {
1198
1320
  return {
@@ -1885,12 +2007,6 @@ __decorate([
1885
2007
  __metadata("design:type", Array)
1886
2008
  ], Product.prototype, "kitProducts", void 0);
1887
2009
 
1888
- class ProductReviews extends BaseModel {
1889
- static get identifiersFields() {
1890
- return ['id'];
1891
- }
1892
- }
1893
-
1894
2010
  class Variant extends BaseModel {
1895
2011
  static get identifiersFields() {
1896
2012
  return ['id', 'productId'];
@@ -2514,7 +2630,7 @@ const withFirestore = (MixinBase) => {
2514
2630
  if (iteratee(v, k)) {
2515
2631
  unset(value, k);
2516
2632
  }
2517
- else if (isObject(v)) {
2633
+ else if (isObject$1(v)) {
2518
2634
  omitByRecursivelyInPlace(v, iteratee);
2519
2635
  }
2520
2636
  });
@@ -2644,7 +2760,7 @@ const withFindFirestore = (MixinBase) => {
2644
2760
  (this.fields[firestoreFieldName] === FirestoreFieldType.Array ||
2645
2761
  !this.fields[firestoreFieldName]))
2646
2762
  return [where(firestoreFieldName, 'array-contains', options.value)];
2647
- if (isObject(options) && isNil(options === null || options === void 0 ? void 0 : options.operator) && isNil(options === null || options === void 0 ? void 0 : options.value)) {
2763
+ if (isObject$1(options) && isNil(options === null || options === void 0 ? void 0 : options.operator) && isNil(options === null || options === void 0 ? void 0 : options.value)) {
2648
2764
  return Object.keys(options).reduce((queries, key) => [
2649
2765
  ...queries,
2650
2766
  ...this.buildWhereSentence(`${fieldName.toString()}.${key}`, is(options)[key]),
@@ -3432,7 +3548,7 @@ AttributeOptionHelper.FindByAttribute = (attributeName, fields) => {
3432
3548
  var _a;
3433
3549
  if (fields.includes(attributeName))
3434
3550
  return { columnName: attributeName.toString(), attributeName, to: (value) => value, from: (value) => value };
3435
- const field = fields.find((columnOption) => isObject(columnOption) && Object.keys(columnOption).includes(attributeName.toString()));
3551
+ const field = fields.find((columnOption) => isObject$1(columnOption) && Object.keys(columnOption).includes(attributeName.toString()));
3436
3552
  const fieldOption = (_a = is(field)) === null || _a === void 0 ? void 0 : _a[attributeName];
3437
3553
  if (isNil(fieldOption))
3438
3554
  return { columnName: attributeName.toString(), attributeName };
@@ -3445,7 +3561,7 @@ AttributeOptionHelper.FindColumnOptionFromList = (columnName, fields) => {
3445
3561
  if (fields.includes(columnName))
3446
3562
  return { columnName, attributeName: columnName };
3447
3563
  const field = is(fields.find((field) => {
3448
- if (!isObject(field))
3564
+ if (!isObject$1(field))
3449
3565
  return false;
3450
3566
  const columnOption = Object.values(field).find((option) => AttributeOptionHelper.CheckIsColumnOption(option) && option.columnName === columnName ? option : {});
3451
3567
  return AttributeOptionHelper.CheckIsColumnOption(columnOption) && (columnOption === null || columnOption === void 0 ? void 0 : columnOption.columnName) === columnName;
@@ -3521,7 +3637,7 @@ BindFilterQueryHelper.MakeGraphQLWhere = (filter, fields) => Object.keys(filter)
3521
3637
  BindFilterQueryHelper.BuildWhereSentence = (field, options, fields) => {
3522
3638
  const fieldSentenceOptions = AttributeOptionHelper.FindByAttribute(field, fields);
3523
3639
  const isNestedField = !Array.isArray(options) &&
3524
- isObject(options) &&
3640
+ isObject$1(options) &&
3525
3641
  isNil(options === null || options === void 0 ? void 0 : options.operator) &&
3526
3642
  isNil(options === null || options === void 0 ? void 0 : options.value) &&
3527
3643
  isNil(fieldSentenceOptions === null || fieldSentenceOptions === void 0 ? void 0 : fieldSentenceOptions.to);
@@ -3536,7 +3652,7 @@ BindFilterQueryHelper.BuildWhereSentence = (field, options, fields) => {
3536
3652
  return {
3537
3653
  [fieldSentenceOptions.fields[0]]: BindFilterQueryHelper.BuildOperatorSentence(options, fieldSentenceOptions),
3538
3654
  };
3539
- if (!Array.isArray(options) && isObject(options) && !FilterOptionHelper.CheckIfIsFilterOption(options))
3655
+ if (!Array.isArray(options) && isObject$1(options) && !FilterOptionHelper.CheckIfIsFilterOption(options))
3540
3656
  options = Object.values(options)[0];
3541
3657
  return Array.isArray(options)
3542
3658
  ? options.reduce((whereSentence, option) => (Object.assign(Object.assign({}, whereSentence), BindFilterQueryHelper.BuildOperatorSentence(option, fieldSentenceOptions))), {})
@@ -3586,7 +3702,7 @@ GraphQLFieldHelper.ConvertFieldValueFrom = (data, fields) => Object.keys(data).r
3586
3702
  return Object.assign(Object.assign({}, result), { [attributeName]: from
3587
3703
  ? from(data[columnName], data)
3588
3704
  : is(data[columnName]).map((value) => GraphQLFieldHelper.ConvertFieldValueFrom(is(value), attributeFields)) });
3589
- if (isObject(data[columnName]))
3705
+ if (isObject$1(data[columnName]))
3590
3706
  return Object.assign(Object.assign({}, result), { [attributeName]: !!from
3591
3707
  ? from(data[columnName])
3592
3708
  : GraphQLFieldHelper.ConvertFieldValueFrom(is(data[columnName]), attributeFields) });
@@ -3613,13 +3729,13 @@ GraphQLFieldHelper.ConvertFieldValueTo = (instance, fields, update = false) => {
3613
3729
  return Object.assign(Object.assign({}, object), { [foreignColumnName]: (_a = data[attributeName]) === null || _a === void 0 ? void 0 : _a[current] });
3614
3730
  }, Object.assign({}, result));
3615
3731
  if (update &&
3616
- isObject(data[attributeName]) &&
3732
+ isObject$1(data[attributeName]) &&
3617
3733
  !isNil(attributeFields) &&
3618
3734
  !isDate(data[attributeName]))
3619
3735
  return result;
3620
3736
  if (!!columnName &&
3621
3737
  Array.isArray(attributeFields) &&
3622
- isObject(data[attributeName])) {
3738
+ isObject$1(data[attributeName])) {
3623
3739
  const converted = !isNil(columnName) && to
3624
3740
  ? to(instance[attributeName], instance)
3625
3741
  : data[attributeName];
@@ -4714,10 +4830,9 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4714
4830
  howToUse: data.how_to_use,
4715
4831
  brand: data.brand_description,
4716
4832
  ingredients: data.ingredients,
4717
- purpose: data.purpose,
4718
4833
  }),
4719
4834
  bindFindFilter: (filters) => {
4720
- return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, ((filters === null || filters === void 0 ? void 0 : filters.description) && { description: filters.description })), (filters.differentials && { differentials: filters.differentials })), (filters.whoMustUse && {
4835
+ return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, ((filters === null || filters === void 0 ? void 0 : filters.description) && { description: filters.description })), (filters.differentials && { differentials: filters.differentials })), (filters.whoMustUse && {
4721
4836
  who_must_use: filters.whoMustUse,
4722
4837
  })), (filters.howToUse && {
4723
4838
  how_to_use: filters.howToUse,
@@ -4725,13 +4840,11 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4725
4840
  brand_description: filters.brand,
4726
4841
  })), (filters.ingredients && {
4727
4842
  ingredients: filters.ingredients,
4728
- })), (filters.purpose && {
4729
- purpose: filters.purpose,
4730
4843
  }));
4731
4844
  },
4732
- bindPersistData: (descriptionData) => (Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, ((descriptionData === null || descriptionData === void 0 ? void 0 : descriptionData.description) && { description: descriptionData.description })), (descriptionData.differentials && { differentials: descriptionData.differentials })), (descriptionData.whoMustUse && {
4845
+ bindPersistData: (descriptionData) => (Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, ((descriptionData === null || descriptionData === void 0 ? void 0 : descriptionData.description) && { description: descriptionData.description })), (descriptionData.differentials && { differentials: descriptionData.differentials })), (descriptionData.whoMustUse && {
4733
4846
  who_must_use: descriptionData.whoMustUse,
4734
- })), (descriptionData.howToUse && { how_to_use: descriptionData.howToUse })), (descriptionData.brand && { brand_description: descriptionData.brand })), (descriptionData.ingredients && { ingredients: descriptionData.ingredients })), (descriptionData.purpose && { purpose: descriptionData.purpose }))),
4847
+ })), (descriptionData.howToUse && { how_to_use: descriptionData.howToUse })), (descriptionData.brand && { brand_description: descriptionData.brand })), (descriptionData.ingredients && { ingredients: descriptionData.ingredients }))),
4735
4848
  },
4736
4849
  },
4737
4850
  { differentials: { columnName: 'differentials' } },
@@ -4739,7 +4852,6 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4739
4852
  { howToUse: { columnName: 'how_to_use' } },
4740
4853
  { brandDescription: { columnName: 'brand_description' } },
4741
4854
  { ingredients: { columnName: 'ingredients' } },
4742
- { purpose: { columnName: 'purpose' } },
4743
4855
  { hasVariants: { columnName: 'has_variants' } },
4744
4856
  {
4745
4857
  images: {
@@ -5123,41 +5235,6 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
5123
5235
  }
5124
5236
  }
5125
5237
 
5126
- class ProductReviewsHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
5127
- constructor({ endpoint, authOptions, interceptors, }) {
5128
- super({
5129
- tableName: 'product_review',
5130
- model: ProductReviews,
5131
- endpoint,
5132
- authOptions,
5133
- interceptors,
5134
- fields: [
5135
- 'id',
5136
- { productId: { columnName: 'product_id' } },
5137
- 'shop',
5138
- 'rate',
5139
- 'author',
5140
- 'email',
5141
- 'location',
5142
- 'review',
5143
- 'status',
5144
- 'title',
5145
- { personId: { columnName: 'person_id' } },
5146
- 'points',
5147
- { orderId: { columnName: 'order_id' } },
5148
- { createdAt: { columnName: 'created_at' } },
5149
- { updatedAt: { columnName: 'updated_at' } },
5150
- ],
5151
- });
5152
- }
5153
- aproveReview(id) {
5154
- return this.update({ id, status: true });
5155
- }
5156
- disaproveReview(id) {
5157
- return this.update({ id, status: false });
5158
- }
5159
- }
5160
-
5161
5238
  class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
5162
5239
  constructor({ endpoint, authOptions, interceptors, }) {
5163
5240
  super({
@@ -5482,4 +5559,4 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
5482
5559
  }
5483
5560
  }
5484
5561
 
5485
- export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, Campaign, CampaignBanner, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryCollectionChildren, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, ClassNameHelper, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, Debug, DebugDecoratorHelper, DebugHelper, DebugNamespaces, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, FragranceImportances, GenderDestination, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, Log, Logger, NotFoundError, OfficePosition, Order, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductReviews, ProductReviewsHasuraGraphQLRepository, ProductSpents, ProductVariantFirestoreRepository, ProductsIndex, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RoundProductPricesHelper, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, ShopPageName, ShopSettings, ShopSettingsFirestoreRepository, Shops, SignInMethods, SignOut, Status, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionMaterialization, SubscriptionMaterializationFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionSummary, SubscriptionSummaryFirestoreRepository, Trace, UnauthorizedError, UpdateOptionActions, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, WeakPasswordError, Where, Wishlist, WishlistHasuraGraphQLRepository, is, isDebuggable, isUUID, parseDateTime, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
5562
+ export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, Campaign, CampaignBanner, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryCollectionChildren, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, ClassNameHelper, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, Debug, DebugDecoratorHelper, DebugHelper, DebugNamespaces, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, FragranceImportances, GenderDestination, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, Log, Logger, NotFoundError, OfficePosition, Order, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductSpents, ProductVariantFirestoreRepository, ProductsIndex, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RoundProductPricesHelper, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, ShopPageName, ShopSettings, ShopSettingsFirestoreRepository, Shops, SignInMethods, SignOut, Status, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionMaterialization, SubscriptionMaterializationFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionSummary, SubscriptionSummaryFirestoreRepository, Trace, UnauthorizedError, UpdateOptionActions, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, WeakPasswordError, Where, Wishlist, WishlistHasuraGraphQLRepository, is, isDebuggable, isUUID, parseDateTime, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };