@elice/material-shared-utils 1.251120.1 → 1.260128.0-rc.0
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/cjs/_virtual/_rollupPluginBabelHelpers.js +177 -376
- package/cjs/_virtual/index.js +5 -0
- package/cjs/_virtual/use-sync-external-store-shim.production.js +5 -0
- package/cjs/hooks/useHelpyLogo.js +3 -7
- package/cjs/index.js +4 -4
- package/cjs/material-config/MaterialConfigContext.d.ts +0 -1
- package/cjs/material-config/MaterialConfigContext.js +2 -2
- package/cjs/material-fetch/useMaterialFetch.d.ts +2 -47
- package/cjs/material-fetch/useMaterialFetch.js +1 -4
- package/cjs/material-fetch/useMaterialFetchRaw.d.ts +1 -1
- package/cjs/material-fetch/useMaterialFetchRaw.js +12 -19
- package/cjs/material-hoc/withMaterial.d.ts +1 -1
- package/cjs/material-hoc/withMaterial.js +0 -1
- package/cjs/node_modules/@tanstack/query-core/build/lib/focusManager.js +93 -0
- package/cjs/node_modules/@tanstack/query-core/build/lib/notifyManager.js +101 -0
- package/cjs/node_modules/@tanstack/query-core/build/lib/onlineManager.js +95 -0
- package/cjs/node_modules/@tanstack/query-core/build/lib/queryObserver.js +571 -0
- package/cjs/node_modules/@tanstack/query-core/build/lib/retryer.js +21 -0
- package/cjs/node_modules/@tanstack/query-core/build/lib/subscribable.js +33 -0
- package/cjs/node_modules/@tanstack/query-core/build/lib/utils.js +154 -0
- package/cjs/node_modules/@tanstack/react-query/build/lib/QueryClientProvider.js +65 -0
- package/cjs/node_modules/@tanstack/react-query/build/lib/QueryErrorResetBoundary.js +46 -0
- package/cjs/node_modules/@tanstack/react-query/build/lib/errorBoundaryUtils.js +52 -0
- package/cjs/node_modules/@tanstack/react-query/build/lib/isRestoring.js +31 -0
- package/cjs/node_modules/@tanstack/react-query/build/lib/suspense.js +39 -0
- package/cjs/node_modules/@tanstack/react-query/build/lib/useBaseQuery.js +94 -0
- package/cjs/node_modules/@tanstack/react-query/build/lib/useQuery.js +14 -0
- package/cjs/node_modules/@tanstack/react-query/build/lib/useSyncExternalStore.js +9 -0
- package/cjs/node_modules/@tanstack/react-query/build/lib/utils.js +12 -0
- package/cjs/node_modules/rxjs/dist/esm5/internal/BehaviorSubject.js +39 -0
- package/cjs/node_modules/rxjs/dist/esm5/internal/Observable.js +105 -0
- package/cjs/node_modules/rxjs/dist/esm5/internal/Subject.js +165 -0
- package/cjs/node_modules/rxjs/dist/esm5/internal/Subscriber.js +157 -0
- package/cjs/node_modules/rxjs/dist/esm5/internal/Subscription.js +148 -0
- package/cjs/node_modules/rxjs/dist/esm5/internal/config.js +6 -0
- package/cjs/node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js +19 -0
- package/cjs/node_modules/rxjs/dist/esm5/internal/symbol/observable.js +5 -0
- package/cjs/node_modules/rxjs/dist/esm5/internal/util/ObjectUnsubscribedError.js +13 -0
- package/cjs/node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js +16 -0
- package/cjs/node_modules/rxjs/dist/esm5/internal/util/arrRemove.js +10 -0
- package/cjs/node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js +14 -0
- package/cjs/node_modules/rxjs/dist/esm5/internal/util/errorContext.js +9 -0
- package/cjs/node_modules/rxjs/dist/esm5/internal/util/identity.js +7 -0
- package/cjs/node_modules/rxjs/dist/esm5/internal/util/isFunction.js +7 -0
- package/cjs/node_modules/rxjs/dist/esm5/internal/util/noop.js +5 -0
- package/cjs/node_modules/rxjs/dist/esm5/internal/util/pipe.js +17 -0
- package/cjs/node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js +13 -0
- package/cjs/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +77 -0
- package/cjs/node_modules/use-sync-external-store/shim/index.js +13 -0
- package/es/_virtual/_rollupPluginBabelHelpers.js +176 -376
- package/es/_virtual/index.js +3 -0
- package/es/_virtual/use-sync-external-store-shim.production.js +3 -0
- package/es/hooks/useCallbackProp.js +3 -3
- package/es/hooks/useDeepClonedCompareEffect.js +2 -2
- package/es/hooks/useHelpyLogo.js +2 -6
- package/es/index.js +2 -2
- package/es/material-config/MaterialConfigContext.d.ts +0 -1
- package/es/material-config/MaterialConfigContext.js +1 -1
- package/es/material-config/MaterialConfigProvider.js +5 -5
- package/es/material-fetch/useMaterialFetch.d.ts +2 -47
- package/es/material-fetch/useMaterialFetch.js +1 -4
- package/es/material-fetch/useMaterialFetchRaw.d.ts +1 -1
- package/es/material-fetch/useMaterialFetchRaw.js +13 -20
- package/es/material-hoc/withMaterial.d.ts +1 -1
- package/es/material-hoc/withMaterial.js +0 -1
- package/es/node_modules/@tanstack/query-core/build/lib/focusManager.js +90 -0
- package/es/node_modules/@tanstack/query-core/build/lib/notifyManager.js +98 -0
- package/es/node_modules/@tanstack/query-core/build/lib/onlineManager.js +92 -0
- package/es/node_modules/@tanstack/query-core/build/lib/queryObserver.js +569 -0
- package/es/node_modules/@tanstack/query-core/build/lib/retryer.js +17 -0
- package/es/node_modules/@tanstack/query-core/build/lib/subscribable.js +31 -0
- package/es/node_modules/@tanstack/query-core/build/lib/utils.js +140 -0
- package/es/node_modules/@tanstack/react-query/build/lib/QueryClientProvider.js +42 -0
- package/es/node_modules/@tanstack/react-query/build/lib/QueryErrorResetBoundary.js +24 -0
- package/es/node_modules/@tanstack/react-query/build/lib/errorBoundaryUtils.js +28 -0
- package/es/node_modules/@tanstack/react-query/build/lib/isRestoring.js +9 -0
- package/es/node_modules/@tanstack/react-query/build/lib/suspense.js +34 -0
- package/es/node_modules/@tanstack/react-query/build/lib/useBaseQuery.js +72 -0
- package/es/node_modules/@tanstack/react-query/build/lib/useQuery.js +12 -0
- package/es/node_modules/@tanstack/react-query/build/lib/useSyncExternalStore.js +7 -0
- package/es/node_modules/@tanstack/react-query/build/lib/utils.js +10 -0
- package/es/node_modules/rxjs/dist/esm5/internal/BehaviorSubject.js +37 -0
- package/es/node_modules/rxjs/dist/esm5/internal/Observable.js +103 -0
- package/es/node_modules/rxjs/dist/esm5/internal/Subject.js +162 -0
- package/es/node_modules/rxjs/dist/esm5/internal/Subscriber.js +153 -0
- package/es/node_modules/rxjs/dist/esm5/internal/Subscription.js +144 -0
- package/es/node_modules/rxjs/dist/esm5/internal/config.js +4 -0
- package/es/node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js +17 -0
- package/es/node_modules/rxjs/dist/esm5/internal/symbol/observable.js +3 -0
- package/es/node_modules/rxjs/dist/esm5/internal/util/ObjectUnsubscribedError.js +11 -0
- package/es/node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js +14 -0
- package/es/node_modules/rxjs/dist/esm5/internal/util/arrRemove.js +8 -0
- package/es/node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js +12 -0
- package/es/node_modules/rxjs/dist/esm5/internal/util/errorContext.js +7 -0
- package/es/node_modules/rxjs/dist/esm5/internal/util/identity.js +5 -0
- package/es/node_modules/rxjs/dist/esm5/internal/util/isFunction.js +5 -0
- package/es/node_modules/rxjs/dist/esm5/internal/util/noop.js +3 -0
- package/es/node_modules/rxjs/dist/esm5/internal/util/pipe.js +15 -0
- package/es/node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js +11 -0
- package/es/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +69 -0
- package/es/node_modules/use-sync-external-store/shim/index.js +11 -0
- package/package.json +6 -4
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tslib = require('tslib');
|
|
4
|
+
var Observable = require('./Observable.js');
|
|
5
|
+
var Subscription = require('./Subscription.js');
|
|
6
|
+
var ObjectUnsubscribedError = require('./util/ObjectUnsubscribedError.js');
|
|
7
|
+
var arrRemove = require('./util/arrRemove.js');
|
|
8
|
+
var errorContext = require('./util/errorContext.js');
|
|
9
|
+
|
|
10
|
+
var Subject = (function (_super) {
|
|
11
|
+
tslib.__extends(Subject, _super);
|
|
12
|
+
function Subject() {
|
|
13
|
+
var _this = _super.call(this) || this;
|
|
14
|
+
_this.closed = false;
|
|
15
|
+
_this.currentObservers = null;
|
|
16
|
+
_this.observers = [];
|
|
17
|
+
_this.isStopped = false;
|
|
18
|
+
_this.hasError = false;
|
|
19
|
+
_this.thrownError = null;
|
|
20
|
+
return _this;
|
|
21
|
+
}
|
|
22
|
+
Subject.prototype.lift = function (operator) {
|
|
23
|
+
var subject = new AnonymousSubject(this, this);
|
|
24
|
+
subject.operator = operator;
|
|
25
|
+
return subject;
|
|
26
|
+
};
|
|
27
|
+
Subject.prototype._throwIfClosed = function () {
|
|
28
|
+
if (this.closed) {
|
|
29
|
+
throw new ObjectUnsubscribedError.ObjectUnsubscribedError();
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
Subject.prototype.next = function (value) {
|
|
33
|
+
var _this = this;
|
|
34
|
+
errorContext.errorContext(function () {
|
|
35
|
+
var e_1, _a;
|
|
36
|
+
_this._throwIfClosed();
|
|
37
|
+
if (!_this.isStopped) {
|
|
38
|
+
if (!_this.currentObservers) {
|
|
39
|
+
_this.currentObservers = Array.from(_this.observers);
|
|
40
|
+
}
|
|
41
|
+
try {
|
|
42
|
+
for (var _b = tslib.__values(_this.currentObservers), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
43
|
+
var observer = _c.value;
|
|
44
|
+
observer.next(value);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
48
|
+
finally {
|
|
49
|
+
try {
|
|
50
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
51
|
+
}
|
|
52
|
+
finally { if (e_1) throw e_1.error; }
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
Subject.prototype.error = function (err) {
|
|
58
|
+
var _this = this;
|
|
59
|
+
errorContext.errorContext(function () {
|
|
60
|
+
_this._throwIfClosed();
|
|
61
|
+
if (!_this.isStopped) {
|
|
62
|
+
_this.hasError = _this.isStopped = true;
|
|
63
|
+
_this.thrownError = err;
|
|
64
|
+
var observers = _this.observers;
|
|
65
|
+
while (observers.length) {
|
|
66
|
+
observers.shift().error(err);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
Subject.prototype.complete = function () {
|
|
72
|
+
var _this = this;
|
|
73
|
+
errorContext.errorContext(function () {
|
|
74
|
+
_this._throwIfClosed();
|
|
75
|
+
if (!_this.isStopped) {
|
|
76
|
+
_this.isStopped = true;
|
|
77
|
+
var observers = _this.observers;
|
|
78
|
+
while (observers.length) {
|
|
79
|
+
observers.shift().complete();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
Subject.prototype.unsubscribe = function () {
|
|
85
|
+
this.isStopped = this.closed = true;
|
|
86
|
+
this.observers = this.currentObservers = null;
|
|
87
|
+
};
|
|
88
|
+
Object.defineProperty(Subject.prototype, "observed", {
|
|
89
|
+
get: function () {
|
|
90
|
+
var _a;
|
|
91
|
+
return ((_a = this.observers) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
92
|
+
},
|
|
93
|
+
enumerable: false,
|
|
94
|
+
configurable: true
|
|
95
|
+
});
|
|
96
|
+
Subject.prototype._trySubscribe = function (subscriber) {
|
|
97
|
+
this._throwIfClosed();
|
|
98
|
+
return _super.prototype._trySubscribe.call(this, subscriber);
|
|
99
|
+
};
|
|
100
|
+
Subject.prototype._subscribe = function (subscriber) {
|
|
101
|
+
this._throwIfClosed();
|
|
102
|
+
this._checkFinalizedStatuses(subscriber);
|
|
103
|
+
return this._innerSubscribe(subscriber);
|
|
104
|
+
};
|
|
105
|
+
Subject.prototype._innerSubscribe = function (subscriber) {
|
|
106
|
+
var _this = this;
|
|
107
|
+
var _a = this, hasError = _a.hasError, isStopped = _a.isStopped, observers = _a.observers;
|
|
108
|
+
if (hasError || isStopped) {
|
|
109
|
+
return Subscription.EMPTY_SUBSCRIPTION;
|
|
110
|
+
}
|
|
111
|
+
this.currentObservers = null;
|
|
112
|
+
observers.push(subscriber);
|
|
113
|
+
return new Subscription.Subscription(function () {
|
|
114
|
+
_this.currentObservers = null;
|
|
115
|
+
arrRemove.arrRemove(observers, subscriber);
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
Subject.prototype._checkFinalizedStatuses = function (subscriber) {
|
|
119
|
+
var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, isStopped = _a.isStopped;
|
|
120
|
+
if (hasError) {
|
|
121
|
+
subscriber.error(thrownError);
|
|
122
|
+
}
|
|
123
|
+
else if (isStopped) {
|
|
124
|
+
subscriber.complete();
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
Subject.prototype.asObservable = function () {
|
|
128
|
+
var observable = new Observable.Observable();
|
|
129
|
+
observable.source = this;
|
|
130
|
+
return observable;
|
|
131
|
+
};
|
|
132
|
+
Subject.create = function (destination, source) {
|
|
133
|
+
return new AnonymousSubject(destination, source);
|
|
134
|
+
};
|
|
135
|
+
return Subject;
|
|
136
|
+
}(Observable.Observable));
|
|
137
|
+
var AnonymousSubject = (function (_super) {
|
|
138
|
+
tslib.__extends(AnonymousSubject, _super);
|
|
139
|
+
function AnonymousSubject(destination, source) {
|
|
140
|
+
var _this = _super.call(this) || this;
|
|
141
|
+
_this.destination = destination;
|
|
142
|
+
_this.source = source;
|
|
143
|
+
return _this;
|
|
144
|
+
}
|
|
145
|
+
AnonymousSubject.prototype.next = function (value) {
|
|
146
|
+
var _a, _b;
|
|
147
|
+
(_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.next) === null || _b === void 0 ? void 0 : _b.call(_a, value);
|
|
148
|
+
};
|
|
149
|
+
AnonymousSubject.prototype.error = function (err) {
|
|
150
|
+
var _a, _b;
|
|
151
|
+
(_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.call(_a, err);
|
|
152
|
+
};
|
|
153
|
+
AnonymousSubject.prototype.complete = function () {
|
|
154
|
+
var _a, _b;
|
|
155
|
+
(_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.complete) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
156
|
+
};
|
|
157
|
+
AnonymousSubject.prototype._subscribe = function (subscriber) {
|
|
158
|
+
var _a, _b;
|
|
159
|
+
return (_b = (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber)) !== null && _b !== void 0 ? _b : Subscription.EMPTY_SUBSCRIPTION;
|
|
160
|
+
};
|
|
161
|
+
return AnonymousSubject;
|
|
162
|
+
}(Subject));
|
|
163
|
+
|
|
164
|
+
exports.AnonymousSubject = AnonymousSubject;
|
|
165
|
+
exports.Subject = Subject;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tslib = require('tslib');
|
|
4
|
+
var isFunction = require('./util/isFunction.js');
|
|
5
|
+
var Subscription = require('./Subscription.js');
|
|
6
|
+
var reportUnhandledError = require('./util/reportUnhandledError.js');
|
|
7
|
+
var noop = require('./util/noop.js');
|
|
8
|
+
|
|
9
|
+
var Subscriber = (function (_super) {
|
|
10
|
+
tslib.__extends(Subscriber, _super);
|
|
11
|
+
function Subscriber(destination) {
|
|
12
|
+
var _this = _super.call(this) || this;
|
|
13
|
+
_this.isStopped = false;
|
|
14
|
+
if (destination) {
|
|
15
|
+
_this.destination = destination;
|
|
16
|
+
if (Subscription.isSubscription(destination)) {
|
|
17
|
+
destination.add(_this);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
_this.destination = EMPTY_OBSERVER;
|
|
22
|
+
}
|
|
23
|
+
return _this;
|
|
24
|
+
}
|
|
25
|
+
Subscriber.create = function (next, error, complete) {
|
|
26
|
+
return new SafeSubscriber(next, error, complete);
|
|
27
|
+
};
|
|
28
|
+
Subscriber.prototype.next = function (value) {
|
|
29
|
+
if (this.isStopped) ;
|
|
30
|
+
else {
|
|
31
|
+
this._next(value);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
Subscriber.prototype.error = function (err) {
|
|
35
|
+
if (this.isStopped) ;
|
|
36
|
+
else {
|
|
37
|
+
this.isStopped = true;
|
|
38
|
+
this._error(err);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
Subscriber.prototype.complete = function () {
|
|
42
|
+
if (this.isStopped) ;
|
|
43
|
+
else {
|
|
44
|
+
this.isStopped = true;
|
|
45
|
+
this._complete();
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
Subscriber.prototype.unsubscribe = function () {
|
|
49
|
+
if (!this.closed) {
|
|
50
|
+
this.isStopped = true;
|
|
51
|
+
_super.prototype.unsubscribe.call(this);
|
|
52
|
+
this.destination = null;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
Subscriber.prototype._next = function (value) {
|
|
56
|
+
this.destination.next(value);
|
|
57
|
+
};
|
|
58
|
+
Subscriber.prototype._error = function (err) {
|
|
59
|
+
try {
|
|
60
|
+
this.destination.error(err);
|
|
61
|
+
}
|
|
62
|
+
finally {
|
|
63
|
+
this.unsubscribe();
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
Subscriber.prototype._complete = function () {
|
|
67
|
+
try {
|
|
68
|
+
this.destination.complete();
|
|
69
|
+
}
|
|
70
|
+
finally {
|
|
71
|
+
this.unsubscribe();
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
return Subscriber;
|
|
75
|
+
}(Subscription.Subscription));
|
|
76
|
+
var ConsumerObserver = (function () {
|
|
77
|
+
function ConsumerObserver(partialObserver) {
|
|
78
|
+
this.partialObserver = partialObserver;
|
|
79
|
+
}
|
|
80
|
+
ConsumerObserver.prototype.next = function (value) {
|
|
81
|
+
var partialObserver = this.partialObserver;
|
|
82
|
+
if (partialObserver.next) {
|
|
83
|
+
try {
|
|
84
|
+
partialObserver.next(value);
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
handleUnhandledError(error);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
ConsumerObserver.prototype.error = function (err) {
|
|
92
|
+
var partialObserver = this.partialObserver;
|
|
93
|
+
if (partialObserver.error) {
|
|
94
|
+
try {
|
|
95
|
+
partialObserver.error(err);
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
handleUnhandledError(error);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
handleUnhandledError(err);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
ConsumerObserver.prototype.complete = function () {
|
|
106
|
+
var partialObserver = this.partialObserver;
|
|
107
|
+
if (partialObserver.complete) {
|
|
108
|
+
try {
|
|
109
|
+
partialObserver.complete();
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
handleUnhandledError(error);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
return ConsumerObserver;
|
|
117
|
+
}());
|
|
118
|
+
var SafeSubscriber = (function (_super) {
|
|
119
|
+
tslib.__extends(SafeSubscriber, _super);
|
|
120
|
+
function SafeSubscriber(observerOrNext, error, complete) {
|
|
121
|
+
var _this = _super.call(this) || this;
|
|
122
|
+
var partialObserver;
|
|
123
|
+
if (isFunction.isFunction(observerOrNext) || !observerOrNext) {
|
|
124
|
+
partialObserver = {
|
|
125
|
+
next: (observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined),
|
|
126
|
+
error: error !== null && error !== void 0 ? error : undefined,
|
|
127
|
+
complete: complete !== null && complete !== void 0 ? complete : undefined,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
{
|
|
132
|
+
partialObserver = observerOrNext;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
_this.destination = new ConsumerObserver(partialObserver);
|
|
136
|
+
return _this;
|
|
137
|
+
}
|
|
138
|
+
return SafeSubscriber;
|
|
139
|
+
}(Subscriber));
|
|
140
|
+
function handleUnhandledError(error) {
|
|
141
|
+
{
|
|
142
|
+
reportUnhandledError.reportUnhandledError(error);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
function defaultErrorHandler(err) {
|
|
146
|
+
throw err;
|
|
147
|
+
}
|
|
148
|
+
var EMPTY_OBSERVER = {
|
|
149
|
+
closed: true,
|
|
150
|
+
next: noop.noop,
|
|
151
|
+
error: defaultErrorHandler,
|
|
152
|
+
complete: noop.noop,
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
exports.EMPTY_OBSERVER = EMPTY_OBSERVER;
|
|
156
|
+
exports.SafeSubscriber = SafeSubscriber;
|
|
157
|
+
exports.Subscriber = Subscriber;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tslib = require('tslib');
|
|
4
|
+
var isFunction = require('./util/isFunction.js');
|
|
5
|
+
var UnsubscriptionError = require('./util/UnsubscriptionError.js');
|
|
6
|
+
var arrRemove = require('./util/arrRemove.js');
|
|
7
|
+
|
|
8
|
+
var Subscription = (function () {
|
|
9
|
+
function Subscription(initialTeardown) {
|
|
10
|
+
this.initialTeardown = initialTeardown;
|
|
11
|
+
this.closed = false;
|
|
12
|
+
this._parentage = null;
|
|
13
|
+
this._finalizers = null;
|
|
14
|
+
}
|
|
15
|
+
Subscription.prototype.unsubscribe = function () {
|
|
16
|
+
var e_1, _a, e_2, _b;
|
|
17
|
+
var errors;
|
|
18
|
+
if (!this.closed) {
|
|
19
|
+
this.closed = true;
|
|
20
|
+
var _parentage = this._parentage;
|
|
21
|
+
if (_parentage) {
|
|
22
|
+
this._parentage = null;
|
|
23
|
+
if (Array.isArray(_parentage)) {
|
|
24
|
+
try {
|
|
25
|
+
for (var _parentage_1 = tslib.__values(_parentage), _parentage_1_1 = _parentage_1.next(); !_parentage_1_1.done; _parentage_1_1 = _parentage_1.next()) {
|
|
26
|
+
var parent_1 = _parentage_1_1.value;
|
|
27
|
+
parent_1.remove(this);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
31
|
+
finally {
|
|
32
|
+
try {
|
|
33
|
+
if (_parentage_1_1 && !_parentage_1_1.done && (_a = _parentage_1.return)) _a.call(_parentage_1);
|
|
34
|
+
}
|
|
35
|
+
finally { if (e_1) throw e_1.error; }
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
_parentage.remove(this);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
var initialFinalizer = this.initialTeardown;
|
|
43
|
+
if (isFunction.isFunction(initialFinalizer)) {
|
|
44
|
+
try {
|
|
45
|
+
initialFinalizer();
|
|
46
|
+
}
|
|
47
|
+
catch (e) {
|
|
48
|
+
errors = e instanceof UnsubscriptionError.UnsubscriptionError ? e.errors : [e];
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
var _finalizers = this._finalizers;
|
|
52
|
+
if (_finalizers) {
|
|
53
|
+
this._finalizers = null;
|
|
54
|
+
try {
|
|
55
|
+
for (var _finalizers_1 = tslib.__values(_finalizers), _finalizers_1_1 = _finalizers_1.next(); !_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()) {
|
|
56
|
+
var finalizer = _finalizers_1_1.value;
|
|
57
|
+
try {
|
|
58
|
+
execFinalizer(finalizer);
|
|
59
|
+
}
|
|
60
|
+
catch (err) {
|
|
61
|
+
errors = errors !== null && errors !== void 0 ? errors : [];
|
|
62
|
+
if (err instanceof UnsubscriptionError.UnsubscriptionError) {
|
|
63
|
+
errors = tslib.__spreadArray(tslib.__spreadArray([], tslib.__read(errors)), tslib.__read(err.errors));
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
errors.push(err);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
72
|
+
finally {
|
|
73
|
+
try {
|
|
74
|
+
if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return)) _b.call(_finalizers_1);
|
|
75
|
+
}
|
|
76
|
+
finally { if (e_2) throw e_2.error; }
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (errors) {
|
|
80
|
+
throw new UnsubscriptionError.UnsubscriptionError(errors);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
Subscription.prototype.add = function (teardown) {
|
|
85
|
+
var _a;
|
|
86
|
+
if (teardown && teardown !== this) {
|
|
87
|
+
if (this.closed) {
|
|
88
|
+
execFinalizer(teardown);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
if (teardown instanceof Subscription) {
|
|
92
|
+
if (teardown.closed || teardown._hasParent(this)) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
teardown._addParent(this);
|
|
96
|
+
}
|
|
97
|
+
(this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
Subscription.prototype._hasParent = function (parent) {
|
|
102
|
+
var _parentage = this._parentage;
|
|
103
|
+
return _parentage === parent || (Array.isArray(_parentage) && _parentage.includes(parent));
|
|
104
|
+
};
|
|
105
|
+
Subscription.prototype._addParent = function (parent) {
|
|
106
|
+
var _parentage = this._parentage;
|
|
107
|
+
this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
|
|
108
|
+
};
|
|
109
|
+
Subscription.prototype._removeParent = function (parent) {
|
|
110
|
+
var _parentage = this._parentage;
|
|
111
|
+
if (_parentage === parent) {
|
|
112
|
+
this._parentage = null;
|
|
113
|
+
}
|
|
114
|
+
else if (Array.isArray(_parentage)) {
|
|
115
|
+
arrRemove.arrRemove(_parentage, parent);
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
Subscription.prototype.remove = function (teardown) {
|
|
119
|
+
var _finalizers = this._finalizers;
|
|
120
|
+
_finalizers && arrRemove.arrRemove(_finalizers, teardown);
|
|
121
|
+
if (teardown instanceof Subscription) {
|
|
122
|
+
teardown._removeParent(this);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
Subscription.EMPTY = (function () {
|
|
126
|
+
var empty = new Subscription();
|
|
127
|
+
empty.closed = true;
|
|
128
|
+
return empty;
|
|
129
|
+
})();
|
|
130
|
+
return Subscription;
|
|
131
|
+
}());
|
|
132
|
+
var EMPTY_SUBSCRIPTION = Subscription.EMPTY;
|
|
133
|
+
function isSubscription(value) {
|
|
134
|
+
return (value instanceof Subscription ||
|
|
135
|
+
(value && 'closed' in value && isFunction.isFunction(value.remove) && isFunction.isFunction(value.add) && isFunction.isFunction(value.unsubscribe)));
|
|
136
|
+
}
|
|
137
|
+
function execFinalizer(finalizer) {
|
|
138
|
+
if (isFunction.isFunction(finalizer)) {
|
|
139
|
+
finalizer();
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
finalizer.unsubscribe();
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
exports.EMPTY_SUBSCRIPTION = EMPTY_SUBSCRIPTION;
|
|
147
|
+
exports.Subscription = Subscription;
|
|
148
|
+
exports.isSubscription = isSubscription;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tslib = require('tslib');
|
|
4
|
+
|
|
5
|
+
var timeoutProvider = {
|
|
6
|
+
setTimeout: function (handler, timeout) {
|
|
7
|
+
var args = [];
|
|
8
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
9
|
+
args[_i - 2] = arguments[_i];
|
|
10
|
+
}
|
|
11
|
+
return setTimeout.apply(void 0, tslib.__spreadArray([handler, timeout], tslib.__read(args)));
|
|
12
|
+
},
|
|
13
|
+
clearTimeout: function (handle) {
|
|
14
|
+
return (clearTimeout)(handle);
|
|
15
|
+
},
|
|
16
|
+
delegate: undefined,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
exports.timeoutProvider = timeoutProvider;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var createErrorClass = require('./createErrorClass.js');
|
|
4
|
+
|
|
5
|
+
var ObjectUnsubscribedError = createErrorClass.createErrorClass(function (_super) {
|
|
6
|
+
return function ObjectUnsubscribedErrorImpl() {
|
|
7
|
+
_super(this);
|
|
8
|
+
this.name = 'ObjectUnsubscribedError';
|
|
9
|
+
this.message = 'object unsubscribed';
|
|
10
|
+
};
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
exports.ObjectUnsubscribedError = ObjectUnsubscribedError;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var createErrorClass = require('./createErrorClass.js');
|
|
4
|
+
|
|
5
|
+
var UnsubscriptionError = createErrorClass.createErrorClass(function (_super) {
|
|
6
|
+
return function UnsubscriptionErrorImpl(errors) {
|
|
7
|
+
_super(this);
|
|
8
|
+
this.message = errors
|
|
9
|
+
? errors.length + " errors occurred during unsubscription:\n" + errors.map(function (err, i) { return i + 1 + ") " + err.toString(); }).join('\n ')
|
|
10
|
+
: '';
|
|
11
|
+
this.name = 'UnsubscriptionError';
|
|
12
|
+
this.errors = errors;
|
|
13
|
+
};
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
exports.UnsubscriptionError = UnsubscriptionError;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function createErrorClass(createImpl) {
|
|
4
|
+
var _super = function (instance) {
|
|
5
|
+
Error.call(instance);
|
|
6
|
+
instance.stack = new Error().stack;
|
|
7
|
+
};
|
|
8
|
+
var ctorFunc = createImpl(_super);
|
|
9
|
+
ctorFunc.prototype = Object.create(Error.prototype);
|
|
10
|
+
ctorFunc.prototype.constructor = ctorFunc;
|
|
11
|
+
return ctorFunc;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
exports.createErrorClass = createErrorClass;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var identity = require('./identity.js');
|
|
4
|
+
|
|
5
|
+
function pipeFromArray(fns) {
|
|
6
|
+
if (fns.length === 0) {
|
|
7
|
+
return identity.identity;
|
|
8
|
+
}
|
|
9
|
+
if (fns.length === 1) {
|
|
10
|
+
return fns[0];
|
|
11
|
+
}
|
|
12
|
+
return function piped(input) {
|
|
13
|
+
return fns.reduce(function (prev, fn) { return fn(prev); }, input);
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
exports.pipeFromArray = pipeFromArray;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var timeoutProvider = require('../scheduler/timeoutProvider.js');
|
|
4
|
+
|
|
5
|
+
function reportUnhandledError(err) {
|
|
6
|
+
timeoutProvider.timeoutProvider.setTimeout(function () {
|
|
7
|
+
{
|
|
8
|
+
throw err;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
exports.reportUnhandledError = reportUnhandledError;
|