@infrab4a/connect 4.2.2 → 4.2.3-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,10 +1,9 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
2
|
import { plainToInstance, instanceToPlain, Expose, Type } from 'class-transformer';
|
|
3
|
-
import
|
|
4
|
-
import { __decorate, __metadata, __rest } from 'tslib';
|
|
3
|
+
import { __decorate, __metadata, __values, __spreadArray, __read, __extends, __rest } from 'tslib';
|
|
5
4
|
import { parseISO } from 'date-fns';
|
|
6
5
|
export { add, addBusinessDays, addDays, addMonths, addYears, endOfDay, format, formatISO9075, parseISO, startOfDay, sub } from 'date-fns';
|
|
7
|
-
import { isNil, isArray
|
|
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';
|
|
8
7
|
export { chunk, each, get, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil, isNumber, isObject, isString, now, omit, pick, set, unset } from 'lodash';
|
|
9
8
|
import { debug } from 'debug';
|
|
10
9
|
import { CustomError } from 'ts-custom-error';
|
|
@@ -463,478 +462,401 @@ __decorate([
|
|
|
463
462
|
__metadata("design:type", Payment)
|
|
464
463
|
], SubscriptionPayment.prototype, "payment", void 0);
|
|
465
464
|
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
return typeof x === 'function';
|
|
465
|
+
function isFunction(value) {
|
|
466
|
+
return typeof value === 'function';
|
|
469
467
|
}
|
|
470
468
|
|
|
471
|
-
|
|
472
|
-
var
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
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);
|
|
490
|
-
}
|
|
491
|
-
|
|
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
|
-
};
|
|
506
|
-
|
|
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';
|
|
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;
|
|
513
478
|
}
|
|
514
479
|
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
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
|
+
: '';
|
|
521
486
|
this.name = 'UnsubscriptionError';
|
|
522
487
|
this.errors = errors;
|
|
523
|
-
|
|
488
|
+
};
|
|
489
|
+
});
|
|
490
|
+
|
|
491
|
+
function arrRemove(arr, item) {
|
|
492
|
+
if (arr) {
|
|
493
|
+
var index = arr.indexOf(item);
|
|
494
|
+
0 <= index && arr.splice(index, 1);
|
|
524
495
|
}
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
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) {
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
var Subscription$1 = (function () {
|
|
499
|
+
function Subscription(initialTeardown) {
|
|
500
|
+
this.initialTeardown = initialTeardown;
|
|
533
501
|
this.closed = false;
|
|
534
|
-
this.
|
|
535
|
-
this.
|
|
536
|
-
if (unsubscribe) {
|
|
537
|
-
this._ctorUnsubscribe = true;
|
|
538
|
-
this._unsubscribe = unsubscribe;
|
|
539
|
-
}
|
|
502
|
+
this._parentage = null;
|
|
503
|
+
this._finalizers = null;
|
|
540
504
|
}
|
|
541
505
|
Subscription.prototype.unsubscribe = function () {
|
|
506
|
+
var e_1, _a, e_2, _b;
|
|
542
507
|
var errors;
|
|
543
|
-
if (this.closed) {
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
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);
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
if (isFunction(_unsubscribe)) {
|
|
560
|
-
if (_ctorUnsubscribe) {
|
|
561
|
-
this._unsubscribe = undefined;
|
|
562
|
-
}
|
|
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)) {
|
|
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)) {
|
|
576
514
|
try {
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
errors = errors || [];
|
|
581
|
-
if (e instanceof UnsubscriptionError) {
|
|
582
|
-
errors = errors.concat(flattenUnsubscriptionErrors(e.errors));
|
|
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);
|
|
583
518
|
}
|
|
584
|
-
|
|
585
|
-
|
|
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);
|
|
586
524
|
}
|
|
525
|
+
finally { if (e_1) throw e_1.error; }
|
|
587
526
|
}
|
|
588
527
|
}
|
|
528
|
+
else {
|
|
529
|
+
_parentage.remove(this);
|
|
530
|
+
}
|
|
589
531
|
}
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
};
|
|
595
|
-
Subscription.prototype.add = function (teardown) {
|
|
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;
|
|
532
|
+
var initialFinalizer = this.initialTeardown;
|
|
533
|
+
if (isFunction(initialFinalizer)) {
|
|
534
|
+
try {
|
|
535
|
+
initialFinalizer();
|
|
606
536
|
}
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
return subscription;
|
|
537
|
+
catch (e) {
|
|
538
|
+
errors = e instanceof UnsubscriptionError ? e.errors : [e];
|
|
610
539
|
}
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
540
|
+
}
|
|
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);
|
|
549
|
+
}
|
|
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
|
+
}
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
}
|
|
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; }
|
|
615
567
|
}
|
|
616
|
-
break;
|
|
617
|
-
default: {
|
|
618
|
-
throw new Error('unrecognized teardown ' + teardown + ' added to Subscription.');
|
|
619
568
|
}
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
if (_parentOrParents === null) {
|
|
623
|
-
subscription._parentOrParents = this;
|
|
624
|
-
}
|
|
625
|
-
else if (_parentOrParents instanceof Subscription) {
|
|
626
|
-
if (_parentOrParents === this) {
|
|
627
|
-
return subscription;
|
|
569
|
+
if (errors) {
|
|
570
|
+
throw new UnsubscriptionError(errors);
|
|
628
571
|
}
|
|
629
|
-
subscription._parentOrParents = [_parentOrParents, this];
|
|
630
|
-
}
|
|
631
|
-
else if (_parentOrParents.indexOf(this) === -1) {
|
|
632
|
-
_parentOrParents.push(this);
|
|
633
572
|
}
|
|
634
|
-
|
|
635
|
-
|
|
573
|
+
};
|
|
574
|
+
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);
|
|
586
|
+
}
|
|
587
|
+
(this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);
|
|
588
|
+
}
|
|
636
589
|
}
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
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;
|
|
640
603
|
}
|
|
641
|
-
else {
|
|
642
|
-
|
|
604
|
+
else if (Array.isArray(_parentage)) {
|
|
605
|
+
arrRemove(_parentage, parent);
|
|
643
606
|
}
|
|
644
|
-
return subscription;
|
|
645
607
|
};
|
|
646
|
-
Subscription.prototype.remove = function (
|
|
647
|
-
var
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
subscriptions.splice(subscriptionIndex, 1);
|
|
652
|
-
}
|
|
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);
|
|
653
613
|
}
|
|
654
614
|
};
|
|
655
|
-
Subscription.EMPTY = (function (
|
|
615
|
+
Subscription.EMPTY = (function () {
|
|
616
|
+
var empty = new Subscription();
|
|
656
617
|
empty.closed = true;
|
|
657
618
|
return empty;
|
|
658
|
-
}(
|
|
619
|
+
})();
|
|
659
620
|
return Subscription;
|
|
660
621
|
}());
|
|
661
|
-
|
|
662
|
-
|
|
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
|
+
});
|
|
663
669
|
}
|
|
664
670
|
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
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) {
|
|
676
697
|
var _this = _super.call(this) || this;
|
|
677
|
-
_this.syncErrorValue = null;
|
|
678
|
-
_this.syncErrorThrown = false;
|
|
679
|
-
_this.syncErrorThrowable = false;
|
|
680
698
|
_this.isStopped = false;
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
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;
|
|
699
|
+
if (destination) {
|
|
700
|
+
_this.destination = destination;
|
|
701
|
+
if (isSubscription(destination)) {
|
|
702
|
+
destination.add(_this);
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
else {
|
|
706
|
+
_this.destination = EMPTY_OBSERVER;
|
|
706
707
|
}
|
|
707
708
|
return _this;
|
|
708
709
|
}
|
|
709
|
-
Subscriber.prototype[rxSubscriber] = function () { return this; };
|
|
710
710
|
Subscriber.create = function (next, error, complete) {
|
|
711
|
-
|
|
712
|
-
subscriber.syncErrorThrowable = false;
|
|
713
|
-
return subscriber;
|
|
711
|
+
return new SafeSubscriber(next, error, complete);
|
|
714
712
|
};
|
|
715
713
|
Subscriber.prototype.next = function (value) {
|
|
716
|
-
if (
|
|
714
|
+
if (this.isStopped) ;
|
|
715
|
+
else {
|
|
717
716
|
this._next(value);
|
|
718
717
|
}
|
|
719
718
|
};
|
|
720
719
|
Subscriber.prototype.error = function (err) {
|
|
721
|
-
if (
|
|
720
|
+
if (this.isStopped) ;
|
|
721
|
+
else {
|
|
722
722
|
this.isStopped = true;
|
|
723
723
|
this._error(err);
|
|
724
724
|
}
|
|
725
725
|
};
|
|
726
726
|
Subscriber.prototype.complete = function () {
|
|
727
|
-
if (
|
|
727
|
+
if (this.isStopped) ;
|
|
728
|
+
else {
|
|
728
729
|
this.isStopped = true;
|
|
729
730
|
this._complete();
|
|
730
731
|
}
|
|
731
732
|
};
|
|
732
733
|
Subscriber.prototype.unsubscribe = function () {
|
|
733
|
-
if (this.closed) {
|
|
734
|
-
|
|
734
|
+
if (!this.closed) {
|
|
735
|
+
this.isStopped = true;
|
|
736
|
+
_super.prototype.unsubscribe.call(this);
|
|
737
|
+
this.destination = null;
|
|
735
738
|
}
|
|
736
|
-
this.isStopped = true;
|
|
737
|
-
_super.prototype.unsubscribe.call(this);
|
|
738
739
|
};
|
|
739
740
|
Subscriber.prototype._next = function (value) {
|
|
740
741
|
this.destination.next(value);
|
|
741
742
|
};
|
|
742
743
|
Subscriber.prototype._error = function (err) {
|
|
743
|
-
|
|
744
|
-
|
|
744
|
+
try {
|
|
745
|
+
this.destination.error(err);
|
|
746
|
+
}
|
|
747
|
+
finally {
|
|
748
|
+
this.unsubscribe();
|
|
749
|
+
}
|
|
745
750
|
};
|
|
746
751
|
Subscriber.prototype._complete = function () {
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
this.unsubscribe();
|
|
754
|
-
this.closed = false;
|
|
755
|
-
this.isStopped = false;
|
|
756
|
-
this._parentOrParents = _parentOrParents;
|
|
757
|
-
return this;
|
|
752
|
+
try {
|
|
753
|
+
this.destination.complete();
|
|
754
|
+
}
|
|
755
|
+
finally {
|
|
756
|
+
this.unsubscribe();
|
|
757
|
+
}
|
|
758
758
|
};
|
|
759
759
|
return Subscriber;
|
|
760
760
|
}(Subscription$1));
|
|
761
|
-
var
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
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;
|
|
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;
|
|
788
768
|
}
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
769
|
+
ConsumerObserver.prototype.next = function (value) {
|
|
770
|
+
var partialObserver = this.partialObserver;
|
|
771
|
+
if (partialObserver.next) {
|
|
772
|
+
try {
|
|
773
|
+
partialObserver.next(value);
|
|
794
774
|
}
|
|
795
|
-
|
|
796
|
-
|
|
775
|
+
catch (error) {
|
|
776
|
+
handleUnhandledError(error);
|
|
797
777
|
}
|
|
798
778
|
}
|
|
799
779
|
};
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
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
|
-
}
|
|
813
|
-
}
|
|
814
|
-
else if (!_parentSubscriber.syncErrorThrowable) {
|
|
815
|
-
this.unsubscribe();
|
|
816
|
-
if (useDeprecatedSynchronousErrorHandling) {
|
|
817
|
-
throw err;
|
|
818
|
-
}
|
|
819
|
-
hostReportError(err);
|
|
780
|
+
ConsumerObserver.prototype.error = function (err) {
|
|
781
|
+
var partialObserver = this.partialObserver;
|
|
782
|
+
if (partialObserver.error) {
|
|
783
|
+
try {
|
|
784
|
+
partialObserver.error(err);
|
|
820
785
|
}
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
_parentSubscriber.syncErrorValue = err;
|
|
824
|
-
_parentSubscriber.syncErrorThrown = true;
|
|
825
|
-
}
|
|
826
|
-
else {
|
|
827
|
-
hostReportError(err);
|
|
828
|
-
}
|
|
829
|
-
this.unsubscribe();
|
|
786
|
+
catch (error) {
|
|
787
|
+
handleUnhandledError(error);
|
|
830
788
|
}
|
|
831
789
|
}
|
|
832
|
-
|
|
833
|
-
|
|
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
|
-
}
|
|
790
|
+
else {
|
|
791
|
+
handleUnhandledError(err);
|
|
851
792
|
}
|
|
852
793
|
};
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
this.unsubscribe();
|
|
859
|
-
if (config.useDeprecatedSynchronousErrorHandling) {
|
|
860
|
-
throw err;
|
|
794
|
+
ConsumerObserver.prototype.complete = function () {
|
|
795
|
+
var partialObserver = this.partialObserver;
|
|
796
|
+
if (partialObserver.complete) {
|
|
797
|
+
try {
|
|
798
|
+
partialObserver.complete();
|
|
861
799
|
}
|
|
862
|
-
|
|
863
|
-
|
|
800
|
+
catch (error) {
|
|
801
|
+
handleUnhandledError(error);
|
|
864
802
|
}
|
|
865
803
|
}
|
|
866
804
|
};
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
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
|
+
};
|
|
873
818
|
}
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
return
|
|
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
|
+
};
|
|
879
829
|
}
|
|
880
830
|
else {
|
|
881
|
-
|
|
882
|
-
return true;
|
|
831
|
+
partialObserver = observerOrNext;
|
|
883
832
|
}
|
|
884
833
|
}
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
var _parentSubscriber = this._parentSubscriber;
|
|
889
|
-
this._context = null;
|
|
890
|
-
this._parentSubscriber = null;
|
|
891
|
-
_parentSubscriber.unsubscribe();
|
|
892
|
-
};
|
|
834
|
+
_this.destination = new ConsumerObserver(partialObserver);
|
|
835
|
+
return _this;
|
|
836
|
+
}
|
|
893
837
|
return SafeSubscriber;
|
|
894
838
|
}(Subscriber));
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
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
|
-
}
|
|
839
|
+
function handleUnhandledError(error) {
|
|
840
|
+
{
|
|
841
|
+
reportUnhandledError(error);
|
|
909
842
|
}
|
|
910
|
-
return true;
|
|
911
843
|
}
|
|
912
|
-
|
|
913
|
-
|
|
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);
|
|
844
|
+
function defaultErrorHandler(err) {
|
|
845
|
+
throw err;
|
|
927
846
|
}
|
|
847
|
+
var EMPTY_OBSERVER = {
|
|
848
|
+
closed: true,
|
|
849
|
+
next: noop,
|
|
850
|
+
error: defaultErrorHandler,
|
|
851
|
+
complete: noop,
|
|
852
|
+
};
|
|
928
853
|
|
|
929
|
-
|
|
930
|
-
var observable = /*@__PURE__*/ (function () { return typeof Symbol === 'function' && Symbol.observable || '@@observable'; })();
|
|
854
|
+
var observable = (function () { return (typeof Symbol === 'function' && Symbol.observable) || '@@observable'; })();
|
|
931
855
|
|
|
932
|
-
/** PURE_IMPORTS_START PURE_IMPORTS_END */
|
|
933
856
|
function identity(x) {
|
|
934
857
|
return x;
|
|
935
858
|
}
|
|
936
859
|
|
|
937
|
-
/** PURE_IMPORTS_START _identity PURE_IMPORTS_END */
|
|
938
860
|
function pipeFromArray(fns) {
|
|
939
861
|
if (fns.length === 0) {
|
|
940
862
|
return identity;
|
|
@@ -947,10 +869,8 @@ function pipeFromArray(fns) {
|
|
|
947
869
|
};
|
|
948
870
|
}
|
|
949
871
|
|
|
950
|
-
|
|
951
|
-
var Observable = /*@__PURE__*/ (function () {
|
|
872
|
+
var Observable = (function () {
|
|
952
873
|
function Observable(subscribe) {
|
|
953
|
-
this._isScalar = false;
|
|
954
874
|
if (subscribe) {
|
|
955
875
|
this._subscribe = subscribe;
|
|
956
876
|
}
|
|
@@ -962,64 +882,52 @@ var Observable = /*@__PURE__*/ (function () {
|
|
|
962
882
|
return observable;
|
|
963
883
|
};
|
|
964
884
|
Observable.prototype.subscribe = function (observerOrNext, error, complete) {
|
|
965
|
-
var
|
|
966
|
-
var
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
throw sink.syncErrorValue;
|
|
980
|
-
}
|
|
981
|
-
}
|
|
982
|
-
}
|
|
983
|
-
return sink;
|
|
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;
|
|
984
899
|
};
|
|
985
900
|
Observable.prototype._trySubscribe = function (sink) {
|
|
986
901
|
try {
|
|
987
902
|
return this._subscribe(sink);
|
|
988
903
|
}
|
|
989
904
|
catch (err) {
|
|
990
|
-
|
|
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
|
-
}
|
|
905
|
+
sink.error(err);
|
|
1000
906
|
}
|
|
1001
907
|
};
|
|
1002
908
|
Observable.prototype.forEach = function (next, promiseCtor) {
|
|
1003
909
|
var _this = this;
|
|
1004
910
|
promiseCtor = getPromiseCtor(promiseCtor);
|
|
1005
911
|
return new promiseCtor(function (resolve, reject) {
|
|
1006
|
-
var
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
}
|
|
1011
|
-
catch (err) {
|
|
1012
|
-
reject(err);
|
|
1013
|
-
if (subscription) {
|
|
1014
|
-
subscription.unsubscribe();
|
|
912
|
+
var subscriber = new SafeSubscriber({
|
|
913
|
+
next: function (value) {
|
|
914
|
+
try {
|
|
915
|
+
next(value);
|
|
1015
916
|
}
|
|
1016
|
-
|
|
1017
|
-
|
|
917
|
+
catch (err) {
|
|
918
|
+
reject(err);
|
|
919
|
+
subscriber.unsubscribe();
|
|
920
|
+
}
|
|
921
|
+
},
|
|
922
|
+
error: reject,
|
|
923
|
+
complete: resolve,
|
|
924
|
+
});
|
|
925
|
+
_this.subscribe(subscriber);
|
|
1018
926
|
});
|
|
1019
927
|
};
|
|
1020
928
|
Observable.prototype._subscribe = function (subscriber) {
|
|
1021
|
-
var
|
|
1022
|
-
return source
|
|
929
|
+
var _a;
|
|
930
|
+
return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber);
|
|
1023
931
|
};
|
|
1024
932
|
Observable.prototype[observable] = function () {
|
|
1025
933
|
return this;
|
|
@@ -1029,9 +937,6 @@ var Observable = /*@__PURE__*/ (function () {
|
|
|
1029
937
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1030
938
|
operations[_i] = arguments[_i];
|
|
1031
939
|
}
|
|
1032
|
-
if (operations.length === 0) {
|
|
1033
|
-
return this;
|
|
1034
|
-
}
|
|
1035
940
|
return pipeFromArray(operations)(this);
|
|
1036
941
|
};
|
|
1037
942
|
Observable.prototype.toPromise = function (promiseCtor) {
|
|
@@ -1039,7 +944,7 @@ var Observable = /*@__PURE__*/ (function () {
|
|
|
1039
944
|
promiseCtor = getPromiseCtor(promiseCtor);
|
|
1040
945
|
return new promiseCtor(function (resolve, reject) {
|
|
1041
946
|
var value;
|
|
1042
|
-
_this.subscribe(function (x) { return value = x; }, function (err) { return reject(err); }, function () { return resolve(value); });
|
|
947
|
+
_this.subscribe(function (x) { return (value = x); }, function (err) { return reject(err); }, function () { return resolve(value); });
|
|
1043
948
|
});
|
|
1044
949
|
};
|
|
1045
950
|
Observable.create = function (subscribe) {
|
|
@@ -1048,155 +953,139 @@ var Observable = /*@__PURE__*/ (function () {
|
|
|
1048
953
|
return Observable;
|
|
1049
954
|
}());
|
|
1050
955
|
function getPromiseCtor(promiseCtor) {
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
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));
|
|
1058
964
|
}
|
|
1059
965
|
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
Error.call(this);
|
|
1064
|
-
this.message = 'object unsubscribed';
|
|
966
|
+
var ObjectUnsubscribedError = createErrorClass(function (_super) {
|
|
967
|
+
return function ObjectUnsubscribedErrorImpl() {
|
|
968
|
+
_super(this);
|
|
1065
969
|
this.name = 'ObjectUnsubscribedError';
|
|
1066
|
-
|
|
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
|
-
}
|
|
970
|
+
this.message = 'object unsubscribed';
|
|
1098
971
|
};
|
|
1099
|
-
|
|
1100
|
-
}(Subscription$1));
|
|
972
|
+
});
|
|
1101
973
|
|
|
1102
|
-
|
|
1103
|
-
|
|
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);
|
|
974
|
+
var Subject = (function (_super) {
|
|
975
|
+
__extends(Subject, _super);
|
|
1114
976
|
function Subject() {
|
|
1115
977
|
var _this = _super.call(this) || this;
|
|
1116
|
-
_this.observers = [];
|
|
1117
978
|
_this.closed = false;
|
|
979
|
+
_this.currentObservers = null;
|
|
980
|
+
_this.observers = [];
|
|
1118
981
|
_this.isStopped = false;
|
|
1119
982
|
_this.hasError = false;
|
|
1120
983
|
_this.thrownError = null;
|
|
1121
984
|
return _this;
|
|
1122
985
|
}
|
|
1123
|
-
Subject.prototype[rxSubscriber] = function () {
|
|
1124
|
-
return new SubjectSubscriber(this);
|
|
1125
|
-
};
|
|
1126
986
|
Subject.prototype.lift = function (operator) {
|
|
1127
987
|
var subject = new AnonymousSubject(this, this);
|
|
1128
988
|
subject.operator = operator;
|
|
1129
989
|
return subject;
|
|
1130
990
|
};
|
|
1131
|
-
Subject.prototype.
|
|
991
|
+
Subject.prototype._throwIfClosed = function () {
|
|
1132
992
|
if (this.closed) {
|
|
1133
993
|
throw new ObjectUnsubscribedError();
|
|
1134
994
|
}
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
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
|
+
}
|
|
1141
1018
|
}
|
|
1142
|
-
}
|
|
1019
|
+
});
|
|
1143
1020
|
};
|
|
1144
1021
|
Subject.prototype.error = function (err) {
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
}
|
|
1157
|
-
this.observers.length = 0;
|
|
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
|
+
});
|
|
1158
1034
|
};
|
|
1159
1035
|
Subject.prototype.complete = function () {
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
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
|
+
});
|
|
1171
1047
|
};
|
|
1172
1048
|
Subject.prototype.unsubscribe = function () {
|
|
1173
|
-
this.isStopped = true;
|
|
1174
|
-
this.
|
|
1175
|
-
this.observers = null;
|
|
1049
|
+
this.isStopped = this.closed = true;
|
|
1050
|
+
this.observers = this.currentObservers = null;
|
|
1176
1051
|
};
|
|
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
|
+
});
|
|
1177
1060
|
Subject.prototype._trySubscribe = function (subscriber) {
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
}
|
|
1181
|
-
else {
|
|
1182
|
-
return _super.prototype._trySubscribe.call(this, subscriber);
|
|
1183
|
-
}
|
|
1061
|
+
this._throwIfClosed();
|
|
1062
|
+
return _super.prototype._trySubscribe.call(this, subscriber);
|
|
1184
1063
|
};
|
|
1185
1064
|
Subject.prototype._subscribe = function (subscriber) {
|
|
1186
|
-
|
|
1187
|
-
|
|
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;
|
|
1188
1074
|
}
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
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);
|
|
1192
1086
|
}
|
|
1193
|
-
else if (
|
|
1087
|
+
else if (isStopped) {
|
|
1194
1088
|
subscriber.complete();
|
|
1195
|
-
return Subscription$1.EMPTY;
|
|
1196
|
-
}
|
|
1197
|
-
else {
|
|
1198
|
-
this.observers.push(subscriber);
|
|
1199
|
-
return new SubjectSubscription(this, subscriber);
|
|
1200
1089
|
}
|
|
1201
1090
|
};
|
|
1202
1091
|
Subject.prototype.asObservable = function () {
|
|
@@ -1209,8 +1098,8 @@ var Subject = /*@__PURE__*/ (function (_super) {
|
|
|
1209
1098
|
};
|
|
1210
1099
|
return Subject;
|
|
1211
1100
|
}(Observable));
|
|
1212
|
-
var AnonymousSubject =
|
|
1213
|
-
|
|
1101
|
+
var AnonymousSubject = (function (_super) {
|
|
1102
|
+
__extends(AnonymousSubject, _super);
|
|
1214
1103
|
function AnonymousSubject(destination, source) {
|
|
1215
1104
|
var _this = _super.call(this) || this;
|
|
1216
1105
|
_this.destination = destination;
|
|
@@ -1218,31 +1107,20 @@ var AnonymousSubject = /*@__PURE__*/ (function (_super) {
|
|
|
1218
1107
|
return _this;
|
|
1219
1108
|
}
|
|
1220
1109
|
AnonymousSubject.prototype.next = function (value) {
|
|
1221
|
-
var
|
|
1222
|
-
|
|
1223
|
-
destination.next(value);
|
|
1224
|
-
}
|
|
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);
|
|
1225
1112
|
};
|
|
1226
1113
|
AnonymousSubject.prototype.error = function (err) {
|
|
1227
|
-
var
|
|
1228
|
-
|
|
1229
|
-
this.destination.error(err);
|
|
1230
|
-
}
|
|
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);
|
|
1231
1116
|
};
|
|
1232
1117
|
AnonymousSubject.prototype.complete = function () {
|
|
1233
|
-
var
|
|
1234
|
-
|
|
1235
|
-
this.destination.complete();
|
|
1236
|
-
}
|
|
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);
|
|
1237
1120
|
};
|
|
1238
1121
|
AnonymousSubject.prototype._subscribe = function (subscriber) {
|
|
1239
|
-
var
|
|
1240
|
-
|
|
1241
|
-
return this.source.subscribe(subscriber);
|
|
1242
|
-
}
|
|
1243
|
-
else {
|
|
1244
|
-
return Subscription$1.EMPTY;
|
|
1245
|
-
}
|
|
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;
|
|
1246
1124
|
};
|
|
1247
1125
|
return AnonymousSubject;
|
|
1248
1126
|
}(Subject));
|
|
@@ -1284,11 +1162,11 @@ class ReflectHelper {
|
|
|
1284
1162
|
}
|
|
1285
1163
|
static first({ key, target, property, own = true }) {
|
|
1286
1164
|
const values = ReflectHelper.get({ key, target, property, own });
|
|
1287
|
-
return isArray
|
|
1165
|
+
return isArray(values) ? first(values) : values;
|
|
1288
1166
|
}
|
|
1289
1167
|
static last({ key, target, property, own = true }) {
|
|
1290
1168
|
const values = ReflectHelper.get({ key, target, property, own });
|
|
1291
|
-
return isArray
|
|
1169
|
+
return isArray(values) ? last(values) : values;
|
|
1292
1170
|
}
|
|
1293
1171
|
static set({ key, target, property, value, propertyDescriptor }) {
|
|
1294
1172
|
Reflect.defineMetadata(key, value, target, property);
|
|
@@ -1314,7 +1192,7 @@ class ReflectHelper {
|
|
|
1314
1192
|
const values = target[property];
|
|
1315
1193
|
let value = values.value;
|
|
1316
1194
|
const propertyDescriptor = values.propertyDescriptor;
|
|
1317
|
-
if (!isArray
|
|
1195
|
+
if (!isArray(value))
|
|
1318
1196
|
value = [value];
|
|
1319
1197
|
return flatten(value.map((val) => {
|
|
1320
1198
|
return {
|
|
@@ -2636,7 +2514,7 @@ const withFirestore = (MixinBase) => {
|
|
|
2636
2514
|
if (iteratee(v, k)) {
|
|
2637
2515
|
unset(value, k);
|
|
2638
2516
|
}
|
|
2639
|
-
else if (isObject
|
|
2517
|
+
else if (isObject(v)) {
|
|
2640
2518
|
omitByRecursivelyInPlace(v, iteratee);
|
|
2641
2519
|
}
|
|
2642
2520
|
});
|
|
@@ -2766,7 +2644,7 @@ const withFindFirestore = (MixinBase) => {
|
|
|
2766
2644
|
(this.fields[firestoreFieldName] === FirestoreFieldType.Array ||
|
|
2767
2645
|
!this.fields[firestoreFieldName]))
|
|
2768
2646
|
return [where(firestoreFieldName, 'array-contains', options.value)];
|
|
2769
|
-
if (isObject
|
|
2647
|
+
if (isObject(options) && isNil(options === null || options === void 0 ? void 0 : options.operator) && isNil(options === null || options === void 0 ? void 0 : options.value)) {
|
|
2770
2648
|
return Object.keys(options).reduce((queries, key) => [
|
|
2771
2649
|
...queries,
|
|
2772
2650
|
...this.buildWhereSentence(`${fieldName.toString()}.${key}`, is(options)[key]),
|
|
@@ -3554,7 +3432,7 @@ AttributeOptionHelper.FindByAttribute = (attributeName, fields) => {
|
|
|
3554
3432
|
var _a;
|
|
3555
3433
|
if (fields.includes(attributeName))
|
|
3556
3434
|
return { columnName: attributeName.toString(), attributeName, to: (value) => value, from: (value) => value };
|
|
3557
|
-
const field = fields.find((columnOption) => isObject
|
|
3435
|
+
const field = fields.find((columnOption) => isObject(columnOption) && Object.keys(columnOption).includes(attributeName.toString()));
|
|
3558
3436
|
const fieldOption = (_a = is(field)) === null || _a === void 0 ? void 0 : _a[attributeName];
|
|
3559
3437
|
if (isNil(fieldOption))
|
|
3560
3438
|
return { columnName: attributeName.toString(), attributeName };
|
|
@@ -3567,7 +3445,7 @@ AttributeOptionHelper.FindColumnOptionFromList = (columnName, fields) => {
|
|
|
3567
3445
|
if (fields.includes(columnName))
|
|
3568
3446
|
return { columnName, attributeName: columnName };
|
|
3569
3447
|
const field = is(fields.find((field) => {
|
|
3570
|
-
if (!isObject
|
|
3448
|
+
if (!isObject(field))
|
|
3571
3449
|
return false;
|
|
3572
3450
|
const columnOption = Object.values(field).find((option) => AttributeOptionHelper.CheckIsColumnOption(option) && option.columnName === columnName ? option : {});
|
|
3573
3451
|
return AttributeOptionHelper.CheckIsColumnOption(columnOption) && (columnOption === null || columnOption === void 0 ? void 0 : columnOption.columnName) === columnName;
|
|
@@ -3643,7 +3521,7 @@ BindFilterQueryHelper.MakeGraphQLWhere = (filter, fields) => Object.keys(filter)
|
|
|
3643
3521
|
BindFilterQueryHelper.BuildWhereSentence = (field, options, fields) => {
|
|
3644
3522
|
const fieldSentenceOptions = AttributeOptionHelper.FindByAttribute(field, fields);
|
|
3645
3523
|
const isNestedField = !Array.isArray(options) &&
|
|
3646
|
-
isObject
|
|
3524
|
+
isObject(options) &&
|
|
3647
3525
|
isNil(options === null || options === void 0 ? void 0 : options.operator) &&
|
|
3648
3526
|
isNil(options === null || options === void 0 ? void 0 : options.value) &&
|
|
3649
3527
|
isNil(fieldSentenceOptions === null || fieldSentenceOptions === void 0 ? void 0 : fieldSentenceOptions.to);
|
|
@@ -3658,7 +3536,7 @@ BindFilterQueryHelper.BuildWhereSentence = (field, options, fields) => {
|
|
|
3658
3536
|
return {
|
|
3659
3537
|
[fieldSentenceOptions.fields[0]]: BindFilterQueryHelper.BuildOperatorSentence(options, fieldSentenceOptions),
|
|
3660
3538
|
};
|
|
3661
|
-
if (!Array.isArray(options) && isObject
|
|
3539
|
+
if (!Array.isArray(options) && isObject(options) && !FilterOptionHelper.CheckIfIsFilterOption(options))
|
|
3662
3540
|
options = Object.values(options)[0];
|
|
3663
3541
|
return Array.isArray(options)
|
|
3664
3542
|
? options.reduce((whereSentence, option) => (Object.assign(Object.assign({}, whereSentence), BindFilterQueryHelper.BuildOperatorSentence(option, fieldSentenceOptions))), {})
|
|
@@ -3708,7 +3586,7 @@ GraphQLFieldHelper.ConvertFieldValueFrom = (data, fields) => Object.keys(data).r
|
|
|
3708
3586
|
return Object.assign(Object.assign({}, result), { [attributeName]: from
|
|
3709
3587
|
? from(data[columnName], data)
|
|
3710
3588
|
: is(data[columnName]).map((value) => GraphQLFieldHelper.ConvertFieldValueFrom(is(value), attributeFields)) });
|
|
3711
|
-
if (isObject
|
|
3589
|
+
if (isObject(data[columnName]))
|
|
3712
3590
|
return Object.assign(Object.assign({}, result), { [attributeName]: !!from
|
|
3713
3591
|
? from(data[columnName])
|
|
3714
3592
|
: GraphQLFieldHelper.ConvertFieldValueFrom(is(data[columnName]), attributeFields) });
|
|
@@ -3735,13 +3613,13 @@ GraphQLFieldHelper.ConvertFieldValueTo = (instance, fields, update = false) => {
|
|
|
3735
3613
|
return Object.assign(Object.assign({}, object), { [foreignColumnName]: (_a = data[attributeName]) === null || _a === void 0 ? void 0 : _a[current] });
|
|
3736
3614
|
}, Object.assign({}, result));
|
|
3737
3615
|
if (update &&
|
|
3738
|
-
isObject
|
|
3616
|
+
isObject(data[attributeName]) &&
|
|
3739
3617
|
!isNil(attributeFields) &&
|
|
3740
3618
|
!isDate(data[attributeName]))
|
|
3741
3619
|
return result;
|
|
3742
3620
|
if (!!columnName &&
|
|
3743
3621
|
Array.isArray(attributeFields) &&
|
|
3744
|
-
isObject
|
|
3622
|
+
isObject(data[attributeName])) {
|
|
3745
3623
|
const converted = !isNil(columnName) && to
|
|
3746
3624
|
? to(instance[attributeName], instance)
|
|
3747
3625
|
: data[attributeName];
|
|
@@ -4571,18 +4449,23 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4571
4449
|
const plainData = this.paramsToPlain({ products });
|
|
4572
4450
|
if (!plainData.products || plainData.products.length <= 0)
|
|
4573
4451
|
return [];
|
|
4452
|
+
const category = await this.get({ id: categoryId.toString() });
|
|
4574
4453
|
await this.mutation('delete_category_product', ['affected_rows'], {
|
|
4575
4454
|
where: {
|
|
4576
4455
|
type: 'category_product_bool_exp',
|
|
4577
4456
|
required: true,
|
|
4578
|
-
value: {
|
|
4457
|
+
value: {
|
|
4458
|
+
category_id: { _in: category.products.filter((productId) => !plainData.products.includes(productId)) },
|
|
4459
|
+
},
|
|
4579
4460
|
},
|
|
4580
4461
|
});
|
|
4581
4462
|
await this.mutation('insert_category_product', ['affected_rows'], {
|
|
4582
4463
|
objects: {
|
|
4583
4464
|
type: '[category_product_insert_input!]',
|
|
4584
4465
|
required: true,
|
|
4585
|
-
value: plainData.products
|
|
4466
|
+
value: plainData.products
|
|
4467
|
+
.filter((productId) => !category.products.includes(productId))
|
|
4468
|
+
.map((productId) => ({ category_id: categoryId, product_id: productId })),
|
|
4586
4469
|
},
|
|
4587
4470
|
});
|
|
4588
4471
|
return plainData.products;
|
|
@@ -4620,15 +4503,14 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4620
4503
|
},
|
|
4621
4504
|
})
|
|
4622
4505
|
.then((res) => res.data);
|
|
4623
|
-
const currentFiltersId = currentFilters.map((f) => f.
|
|
4506
|
+
const currentFiltersId = currentFilters.map((f) => f.filterId);
|
|
4624
4507
|
const filtersUpdatedId = filters.value.map((f) => f.id);
|
|
4625
4508
|
const filterToBeDeleted = currentFiltersId.filter((c) => !filtersUpdatedId.includes(c));
|
|
4626
4509
|
const filterToBeInserted = filtersUpdatedId.filter((c) => !currentFiltersId.includes(c));
|
|
4627
4510
|
for (const filter of filterToBeDeleted) {
|
|
4628
4511
|
const index = currentFilters.findIndex((f) => f.id == filter);
|
|
4629
|
-
if (index != -1)
|
|
4512
|
+
if (index != -1)
|
|
4630
4513
|
currentFilters.splice(index, 1);
|
|
4631
|
-
}
|
|
4632
4514
|
await this.categoryFilterRepository.deleteByCategoryAndFilter(categoryId, filter);
|
|
4633
4515
|
}
|
|
4634
4516
|
for (const filter of filterToBeInserted) {
|
|
@@ -5479,6 +5361,10 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5479
5361
|
throw new NotFoundError(`Category with id ${identifiers.id} is not a wishlist`);
|
|
5480
5362
|
return data;
|
|
5481
5363
|
}
|
|
5364
|
+
async find(params) {
|
|
5365
|
+
const { filters } = params, rest = __rest(params, ["filters"]);
|
|
5366
|
+
return await super.find(Object.assign(Object.assign({}, rest), { filters: Object.assign(Object.assign({}, filters), { isWishlist: { operator: Where.EQUALS, value: true } }) }));
|
|
5367
|
+
}
|
|
5482
5368
|
async update(params) {
|
|
5483
5369
|
const { products, id: checkId, metadata, filters } = params, data = __rest(params, ["products", "id", "metadata", "filters"]);
|
|
5484
5370
|
const plainData = this.paramsToPlain({ id: checkId });
|
|
@@ -5537,19 +5423,24 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5537
5423
|
const plainData = this.paramsToPlain({ products });
|
|
5538
5424
|
if (!plainData.products || plainData.products.length <= 0)
|
|
5539
5425
|
return [];
|
|
5426
|
+
const category = await this.get({ id: categoryId.toString() });
|
|
5427
|
+
await this.categoryFilterRepository.deleteByCategory(categoryId);
|
|
5540
5428
|
await this.mutation('delete_category_product', ['affected_rows'], {
|
|
5541
5429
|
where: {
|
|
5542
5430
|
type: 'category_product_bool_exp',
|
|
5543
5431
|
required: true,
|
|
5544
|
-
value: {
|
|
5432
|
+
value: {
|
|
5433
|
+
category_id: { _in: category.products.filter((productId) => !plainData.products.includes(productId)) },
|
|
5434
|
+
},
|
|
5545
5435
|
},
|
|
5546
5436
|
});
|
|
5547
|
-
await this.categoryFilterRepository.deleteByCategory(categoryId);
|
|
5548
5437
|
await this.mutation('insert_category_product', ['affected_rows'], {
|
|
5549
5438
|
objects: {
|
|
5550
5439
|
type: '[category_product_insert_input!]',
|
|
5551
5440
|
required: true,
|
|
5552
|
-
value: plainData.products
|
|
5441
|
+
value: plainData.products
|
|
5442
|
+
.filter((productId) => !category.products.includes(productId))
|
|
5443
|
+
.map((productId) => ({ category_id: categoryId, product_id: productId })),
|
|
5553
5444
|
},
|
|
5554
5445
|
});
|
|
5555
5446
|
return plainData.products;
|