Socket
Socket
Sign inDemoInstall

rxjs

Package Overview
Dependencies
1
Maintainers
3
Versions
165
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.5.4 to 7.5.5

4

dist/cjs/internal/operators/mergeInternals.js

@@ -7,3 +7,3 @@ "use strict";

var OperatorSubscriber_1 = require("./OperatorSubscriber");
function mergeInternals(source, subscriber, project, concurrent, onBeforeNext, expand, innerSubScheduler, additionalTeardown) {
function mergeInternals(source, subscriber, project, concurrent, onBeforeNext, expand, innerSubScheduler, additionalFinalizer) {
var buffer = [];

@@ -62,3 +62,3 @@ var active = 0;

return function () {
additionalTeardown === null || additionalTeardown === void 0 ? void 0 : additionalTeardown();
additionalFinalizer === null || additionalFinalizer === void 0 ? void 0 : additionalFinalizer();
};

@@ -65,0 +65,0 @@ }

@@ -7,10 +7,7 @@ "use strict";

function shareReplay(configOrBufferSize, windowTime, scheduler) {
var _a, _b;
var _a, _b, _c;
var bufferSize;
var refCount = false;
if (configOrBufferSize && typeof configOrBufferSize === 'object') {
bufferSize = (_a = configOrBufferSize.bufferSize) !== null && _a !== void 0 ? _a : Infinity;
windowTime = (_b = configOrBufferSize.windowTime) !== null && _b !== void 0 ? _b : Infinity;
refCount = !!configOrBufferSize.refCount;
scheduler = configOrBufferSize.scheduler;
(_a = configOrBufferSize.bufferSize, bufferSize = _a === void 0 ? Infinity : _a, _b = configOrBufferSize.windowTime, windowTime = _b === void 0 ? Infinity : _b, _c = configOrBufferSize.refCount, refCount = _c === void 0 ? false : _c, scheduler = configOrBufferSize.scheduler);
}

@@ -17,0 +14,0 @@ else {

@@ -56,3 +56,3 @@ "use strict";

}));
startTimer(first != null ? (typeof first === 'number' ? first : +first - scheduler.now()) : each);
!seen && startTimer(first != null ? (typeof first === 'number' ? first : +first - scheduler.now()) : each);
});

@@ -59,0 +59,0 @@ }

@@ -26,9 +26,12 @@ "use strict";

exports.intervalProvider = {
setInterval: function () {
setInterval: function (handler, timeout) {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
for (var _i = 2; _i < arguments.length; _i++) {
args[_i - 2] = arguments[_i];
}
var delegate = exports.intervalProvider.delegate;
return ((delegate === null || delegate === void 0 ? void 0 : delegate.setInterval) || setInterval).apply(void 0, __spreadArray([], __read(args)));
if (delegate === null || delegate === void 0 ? void 0 : delegate.setInterval) {
return delegate.setInterval.apply(delegate, __spreadArray([handler, timeout], __read(args)));
}
return setInterval.apply(void 0, __spreadArray([handler, timeout], __read(args)));
},

@@ -35,0 +38,0 @@ clearInterval: function (handle) {

@@ -26,9 +26,12 @@ "use strict";

exports.timeoutProvider = {
setTimeout: function () {
setTimeout: function (handler, timeout) {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
for (var _i = 2; _i < arguments.length; _i++) {
args[_i - 2] = arguments[_i];
}
var delegate = exports.timeoutProvider.delegate;
return ((delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) || setTimeout).apply(void 0, __spreadArray([], __read(args)));
if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) {
return delegate.setTimeout.apply(delegate, __spreadArray([handler, timeout], __read(args)));
}
return setTimeout.apply(void 0, __spreadArray([handler, timeout], __read(args)));
},

@@ -35,0 +38,0 @@ clearTimeout: function (handle) {

@@ -40,2 +40,3 @@ "use strict";

_this.closed = false;
_this.currentObservers = null;
_this.observers = [];

@@ -63,6 +64,8 @@ _this.isStopped = false;

if (!_this.isStopped) {
var copy = _this.observers.slice();
if (!_this.currentObservers) {
_this.currentObservers = Array.from(_this.observers);
}
try {
for (var copy_1 = __values(copy), copy_1_1 = copy_1.next(); !copy_1_1.done; copy_1_1 = copy_1.next()) {
var observer = copy_1_1.value;
for (var _b = __values(_this.currentObservers), _c = _b.next(); !_c.done; _c = _b.next()) {
var observer = _c.value;
observer.next(value);

@@ -74,3 +77,3 @@ }

try {
if (copy_1_1 && !copy_1_1.done && (_a = copy_1.return)) _a.call(copy_1);
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}

@@ -111,3 +114,3 @@ finally { if (e_1) throw e_1.error; }

this.isStopped = this.closed = true;
this.observers = null;
this.observers = this.currentObservers = null;
};

@@ -132,6 +135,13 @@ Object.defineProperty(Subject.prototype, "observed", {

Subject.prototype._innerSubscribe = function (subscriber) {
var _this = this;
var _a = this, hasError = _a.hasError, isStopped = _a.isStopped, observers = _a.observers;
return hasError || isStopped
? Subscription_1.EMPTY_SUBSCRIPTION
: (observers.push(subscriber), new Subscription_1.Subscription(function () { return arrRemove_1.arrRemove(observers, subscriber); }));
if (hasError || isStopped) {
return Subscription_1.EMPTY_SUBSCRIPTION;
}
this.currentObservers = null;
observers.push(subscriber);
return new Subscription_1.Subscription(function () {
_this.currentObservers = null;
arrRemove_1.arrRemove(observers, subscriber);
});
};

@@ -138,0 +148,0 @@ Subject.prototype._checkFinalizedStatuses = function (subscriber) {

@@ -44,3 +44,3 @@ "use strict";

this._parentage = null;
this._teardowns = null;
this._finalizers = null;
}

@@ -74,6 +74,6 @@ Subscription.prototype.unsubscribe = function () {

}
var initialTeardown = this.initialTeardown;
if (isFunction_1.isFunction(initialTeardown)) {
var initialFinalizer = this.initialTeardown;
if (isFunction_1.isFunction(initialFinalizer)) {
try {
initialTeardown();
initialFinalizer();
}

@@ -84,10 +84,10 @@ catch (e) {

}
var _teardowns = this._teardowns;
if (_teardowns) {
this._teardowns = null;
var _finalizers = this._finalizers;
if (_finalizers) {
this._finalizers = null;
try {
for (var _teardowns_1 = __values(_teardowns), _teardowns_1_1 = _teardowns_1.next(); !_teardowns_1_1.done; _teardowns_1_1 = _teardowns_1.next()) {
var teardown_1 = _teardowns_1_1.value;
for (var _finalizers_1 = __values(_finalizers), _finalizers_1_1 = _finalizers_1.next(); !_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()) {
var finalizer = _finalizers_1_1.value;
try {
execTeardown(teardown_1);
execFinalizer(finalizer);
}

@@ -108,3 +108,3 @@ catch (err) {

try {
if (_teardowns_1_1 && !_teardowns_1_1.done && (_b = _teardowns_1.return)) _b.call(_teardowns_1);
if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return)) _b.call(_finalizers_1);
}

@@ -123,3 +123,3 @@ finally { if (e_2) throw e_2.error; }

if (this.closed) {
execTeardown(teardown);
execFinalizer(teardown);
}

@@ -133,3 +133,3 @@ else {

}
(this._teardowns = (_a = this._teardowns) !== null && _a !== void 0 ? _a : []).push(teardown);
(this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);
}

@@ -156,4 +156,4 @@ }

Subscription.prototype.remove = function (teardown) {
var _teardowns = this._teardowns;
_teardowns && arrRemove_1.arrRemove(_teardowns, teardown);
var _finalizers = this._finalizers;
_finalizers && arrRemove_1.arrRemove(_finalizers, teardown);
if (teardown instanceof Subscription) {

@@ -177,10 +177,10 @@ teardown._removeParent(this);

exports.isSubscription = isSubscription;
function execTeardown(teardown) {
if (isFunction_1.isFunction(teardown)) {
teardown();
function execFinalizer(finalizer) {
if (isFunction_1.isFunction(finalizer)) {
finalizer();
}
else {
teardown.unsubscribe();
finalizer.unsubscribe();
}
}
//# sourceMappingURL=Subscription.js.map
import { innerFrom } from '../observable/innerFrom';
import { executeSchedule } from '../util/executeSchedule';
import { createOperatorSubscriber } from './OperatorSubscriber';
export function mergeInternals(source, subscriber, project, concurrent, onBeforeNext, expand, innerSubScheduler, additionalTeardown) {
export function mergeInternals(source, subscriber, project, concurrent, onBeforeNext, expand, innerSubScheduler, additionalFinalizer) {
const buffer = [];

@@ -55,5 +55,5 @@ let active = 0;

return () => {
additionalTeardown === null || additionalTeardown === void 0 ? void 0 : additionalTeardown();
additionalFinalizer === null || additionalFinalizer === void 0 ? void 0 : additionalFinalizer();
};
}
//# sourceMappingURL=mergeInternals.js.map
import { ReplaySubject } from '../ReplaySubject';
import { share } from './share';
export function shareReplay(configOrBufferSize, windowTime, scheduler) {
var _a, _b;
let bufferSize;
let refCount = false;
if (configOrBufferSize && typeof configOrBufferSize === 'object') {
bufferSize = (_a = configOrBufferSize.bufferSize) !== null && _a !== void 0 ? _a : Infinity;
windowTime = (_b = configOrBufferSize.windowTime) !== null && _b !== void 0 ? _b : Infinity;
refCount = !!configOrBufferSize.refCount;
scheduler = configOrBufferSize.scheduler;
({ bufferSize = Infinity, windowTime = Infinity, refCount = false, scheduler } = configOrBufferSize);
}

@@ -13,0 +9,0 @@ else {

@@ -50,3 +50,3 @@ import { asyncScheduler } from '../scheduler/async';

}));
startTimer(first != null ? (typeof first === 'number' ? first : +first - scheduler.now()) : each);
!seen && startTimer(first != null ? (typeof first === 'number' ? first : +first - scheduler.now()) : each);
});

@@ -53,0 +53,0 @@ }

export const intervalProvider = {
setInterval(...args) {
setInterval(handler, timeout, ...args) {
const { delegate } = intervalProvider;
return ((delegate === null || delegate === void 0 ? void 0 : delegate.setInterval) || setInterval)(...args);
if (delegate === null || delegate === void 0 ? void 0 : delegate.setInterval) {
return delegate.setInterval(handler, timeout, ...args);
}
return setInterval(handler, timeout, ...args);
},

@@ -6,0 +9,0 @@ clearInterval(handle) {

export const timeoutProvider = {
setTimeout(...args) {
setTimeout(handler, timeout, ...args) {
const { delegate } = timeoutProvider;
return ((delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) || setTimeout)(...args);
if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) {
return delegate.setTimeout(handler, timeout, ...args);
}
return setTimeout(handler, timeout, ...args);
},

@@ -6,0 +9,0 @@ clearTimeout(handle) {

@@ -10,2 +10,3 @@ import { Observable } from './Observable';

this.closed = false;
this.currentObservers = null;
this.observers = [];

@@ -30,4 +31,6 @@ this.isStopped = false;

if (!this.isStopped) {
const copy = this.observers.slice();
for (const observer of copy) {
if (!this.currentObservers) {
this.currentObservers = Array.from(this.observers);
}
for (const observer of this.currentObservers) {
observer.next(value);

@@ -65,3 +68,3 @@ }

this.isStopped = this.closed = true;
this.observers = null;
this.observers = this.currentObservers = null;
}

@@ -83,5 +86,11 @@ get observed() {

const { hasError, isStopped, observers } = this;
return hasError || isStopped
? EMPTY_SUBSCRIPTION
: (observers.push(subscriber), new Subscription(() => arrRemove(observers, subscriber)));
if (hasError || isStopped) {
return EMPTY_SUBSCRIPTION;
}
this.currentObservers = null;
observers.push(subscriber);
return new Subscription(() => {
this.currentObservers = null;
arrRemove(observers, subscriber);
});
}

@@ -88,0 +97,0 @@ _checkFinalizedStatuses(subscriber) {

@@ -9,3 +9,3 @@ import { isFunction } from './util/isFunction';

this._parentage = null;
this._teardowns = null;
this._finalizers = null;
}

@@ -28,6 +28,6 @@ unsubscribe() {

}
const { initialTeardown } = this;
if (isFunction(initialTeardown)) {
const { initialTeardown: initialFinalizer } = this;
if (isFunction(initialFinalizer)) {
try {
initialTeardown();
initialFinalizer();
}

@@ -38,8 +38,8 @@ catch (e) {

}
const { _teardowns } = this;
if (_teardowns) {
this._teardowns = null;
for (const teardown of _teardowns) {
const { _finalizers } = this;
if (_finalizers) {
this._finalizers = null;
for (const finalizer of _finalizers) {
try {
execTeardown(teardown);
execFinalizer(finalizer);
}

@@ -66,3 +66,3 @@ catch (err) {

if (this.closed) {
execTeardown(teardown);
execFinalizer(teardown);
}

@@ -76,3 +76,3 @@ else {

}
(this._teardowns = (_a = this._teardowns) !== null && _a !== void 0 ? _a : []).push(teardown);
(this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);
}

@@ -99,4 +99,4 @@ }

remove(teardown) {
const { _teardowns } = this;
_teardowns && arrRemove(_teardowns, teardown);
const { _finalizers } = this;
_finalizers && arrRemove(_finalizers, teardown);
if (teardown instanceof Subscription) {

@@ -117,10 +117,10 @@ teardown._removeParent(this);

}
function execTeardown(teardown) {
if (isFunction(teardown)) {
teardown();
function execFinalizer(finalizer) {
if (isFunction(finalizer)) {
finalizer();
}
else {
teardown.unsubscribe();
finalizer.unsubscribe();
}
}
//# sourceMappingURL=Subscription.js.map
import { innerFrom } from '../observable/innerFrom';
import { executeSchedule } from '../util/executeSchedule';
import { createOperatorSubscriber } from './OperatorSubscriber';
export function mergeInternals(source, subscriber, project, concurrent, onBeforeNext, expand, innerSubScheduler, additionalTeardown) {
export function mergeInternals(source, subscriber, project, concurrent, onBeforeNext, expand, innerSubScheduler, additionalFinalizer) {
var buffer = [];

@@ -58,5 +58,5 @@ var active = 0;

return function () {
additionalTeardown === null || additionalTeardown === void 0 ? void 0 : additionalTeardown();
additionalFinalizer === null || additionalFinalizer === void 0 ? void 0 : additionalFinalizer();
};
}
//# sourceMappingURL=mergeInternals.js.map
import { ReplaySubject } from '../ReplaySubject';
import { share } from './share';
export function shareReplay(configOrBufferSize, windowTime, scheduler) {
var _a, _b;
var _a, _b, _c;
var bufferSize;
var refCount = false;
if (configOrBufferSize && typeof configOrBufferSize === 'object') {
bufferSize = (_a = configOrBufferSize.bufferSize) !== null && _a !== void 0 ? _a : Infinity;
windowTime = (_b = configOrBufferSize.windowTime) !== null && _b !== void 0 ? _b : Infinity;
refCount = !!configOrBufferSize.refCount;
scheduler = configOrBufferSize.scheduler;
(_a = configOrBufferSize.bufferSize, bufferSize = _a === void 0 ? Infinity : _a, _b = configOrBufferSize.windowTime, windowTime = _b === void 0 ? Infinity : _b, _c = configOrBufferSize.refCount, refCount = _c === void 0 ? false : _c, scheduler = configOrBufferSize.scheduler);
}

@@ -13,0 +10,0 @@ else {

@@ -53,3 +53,3 @@ import { asyncScheduler } from '../scheduler/async';

}));
startTimer(first != null ? (typeof first === 'number' ? first : +first - scheduler.now()) : each);
!seen && startTimer(first != null ? (typeof first === 'number' ? first : +first - scheduler.now()) : each);
});

@@ -56,0 +56,0 @@ }

import { __read, __spreadArray } from "tslib";
export var intervalProvider = {
setInterval: function () {
setInterval: function (handler, timeout) {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
for (var _i = 2; _i < arguments.length; _i++) {
args[_i - 2] = arguments[_i];
}
var delegate = intervalProvider.delegate;
return ((delegate === null || delegate === void 0 ? void 0 : delegate.setInterval) || setInterval).apply(void 0, __spreadArray([], __read(args)));
if (delegate === null || delegate === void 0 ? void 0 : delegate.setInterval) {
return delegate.setInterval.apply(delegate, __spreadArray([handler, timeout], __read(args)));
}
return setInterval.apply(void 0, __spreadArray([handler, timeout], __read(args)));
},

@@ -11,0 +14,0 @@ clearInterval: function (handle) {

import { __read, __spreadArray } from "tslib";
export var timeoutProvider = {
setTimeout: function () {
setTimeout: function (handler, timeout) {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
for (var _i = 2; _i < arguments.length; _i++) {
args[_i - 2] = arguments[_i];
}
var delegate = timeoutProvider.delegate;
return ((delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) || setTimeout).apply(void 0, __spreadArray([], __read(args)));
if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) {
return delegate.setTimeout.apply(delegate, __spreadArray([handler, timeout], __read(args)));
}
return setTimeout.apply(void 0, __spreadArray([handler, timeout], __read(args)));
},

@@ -11,0 +14,0 @@ clearTimeout: function (handle) {

@@ -12,2 +12,3 @@ import { __extends, __values } from "tslib";

_this.closed = false;
_this.currentObservers = null;
_this.observers = [];

@@ -35,6 +36,8 @@ _this.isStopped = false;

if (!_this.isStopped) {
var copy = _this.observers.slice();
if (!_this.currentObservers) {
_this.currentObservers = Array.from(_this.observers);
}
try {
for (var copy_1 = __values(copy), copy_1_1 = copy_1.next(); !copy_1_1.done; copy_1_1 = copy_1.next()) {
var observer = copy_1_1.value;
for (var _b = __values(_this.currentObservers), _c = _b.next(); !_c.done; _c = _b.next()) {
var observer = _c.value;
observer.next(value);

@@ -46,3 +49,3 @@ }

try {
if (copy_1_1 && !copy_1_1.done && (_a = copy_1.return)) _a.call(copy_1);
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}

@@ -83,3 +86,3 @@ finally { if (e_1) throw e_1.error; }

this.isStopped = this.closed = true;
this.observers = null;
this.observers = this.currentObservers = null;
};

@@ -104,6 +107,13 @@ Object.defineProperty(Subject.prototype, "observed", {

Subject.prototype._innerSubscribe = function (subscriber) {
var _this = this;
var _a = this, hasError = _a.hasError, isStopped = _a.isStopped, observers = _a.observers;
return hasError || isStopped
? EMPTY_SUBSCRIPTION
: (observers.push(subscriber), new Subscription(function () { return arrRemove(observers, subscriber); }));
if (hasError || isStopped) {
return EMPTY_SUBSCRIPTION;
}
this.currentObservers = null;
observers.push(subscriber);
return new Subscription(function () {
_this.currentObservers = null;
arrRemove(observers, subscriber);
});
};

@@ -110,0 +120,0 @@ Subject.prototype._checkFinalizedStatuses = function (subscriber) {

@@ -10,3 +10,3 @@ import { __read, __spreadArray, __values } from "tslib";

this._parentage = null;
this._teardowns = null;
this._finalizers = null;
}

@@ -40,6 +40,6 @@ Subscription.prototype.unsubscribe = function () {

}
var initialTeardown = this.initialTeardown;
if (isFunction(initialTeardown)) {
var initialFinalizer = this.initialTeardown;
if (isFunction(initialFinalizer)) {
try {
initialTeardown();
initialFinalizer();
}

@@ -50,10 +50,10 @@ catch (e) {

}
var _teardowns = this._teardowns;
if (_teardowns) {
this._teardowns = null;
var _finalizers = this._finalizers;
if (_finalizers) {
this._finalizers = null;
try {
for (var _teardowns_1 = __values(_teardowns), _teardowns_1_1 = _teardowns_1.next(); !_teardowns_1_1.done; _teardowns_1_1 = _teardowns_1.next()) {
var teardown_1 = _teardowns_1_1.value;
for (var _finalizers_1 = __values(_finalizers), _finalizers_1_1 = _finalizers_1.next(); !_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()) {
var finalizer = _finalizers_1_1.value;
try {
execTeardown(teardown_1);
execFinalizer(finalizer);
}

@@ -74,3 +74,3 @@ catch (err) {

try {
if (_teardowns_1_1 && !_teardowns_1_1.done && (_b = _teardowns_1.return)) _b.call(_teardowns_1);
if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return)) _b.call(_finalizers_1);
}

@@ -89,3 +89,3 @@ finally { if (e_2) throw e_2.error; }

if (this.closed) {
execTeardown(teardown);
execFinalizer(teardown);
}

@@ -99,3 +99,3 @@ else {

}
(this._teardowns = (_a = this._teardowns) !== null && _a !== void 0 ? _a : []).push(teardown);
(this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);
}

@@ -122,4 +122,4 @@ }

Subscription.prototype.remove = function (teardown) {
var _teardowns = this._teardowns;
_teardowns && arrRemove(_teardowns, teardown);
var _finalizers = this._finalizers;
_finalizers && arrRemove(_finalizers, teardown);
if (teardown instanceof Subscription) {

@@ -142,10 +142,10 @@ teardown._removeParent(this);

}
function execTeardown(teardown) {
if (isFunction(teardown)) {
teardown();
function execFinalizer(finalizer) {
if (isFunction(finalizer)) {
finalizer();
}
else {
teardown.unsubscribe();
finalizer.unsubscribe();
}
}
//# sourceMappingURL=Subscription.js.map

@@ -156,3 +156,3 @@ import { AnonymousSubject } from '../../Subject';

* `messageFilter` argument will be used to select the appropriate data for
* the resulting Observable. When teardown occurs, either due to
* the resulting Observable. When finalization occurs, either due to
* unsubscription, completion, or error, a message defined by the `unsubMsg`

@@ -165,3 +165,3 @@ * argument will be sent to the server over the WebSocketSubject.

* @param unsubMsg A function to generate the unsubscription message to be
* sent to the server at teardown. This will still be processed by the
* sent to the server at finalization. This will still be processed by the
* serializer in the WebSocketSubject's config.

@@ -168,0 +168,0 @@ * @param messageFilter A predicate for selecting the appropriate messages

import { ObservableInput, OperatorFunction, ObservedValueOf } from '../types';
/** @deprecated Will be removed in v9. Use {@link concatMap} instead: `concatMap(() => result)` */
export declare function concatMapTo<O extends ObservableInput<unknown>>(observable: O): OperatorFunction<unknown, ObservedValueOf<O>>;

@@ -3,0 +4,0 @@ /** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */

import { OperatorFunction } from '../types';
/** @deprecated To be removed in v9. Use {@link map} instead: `map(() => value)`. */
export declare function mapTo<R>(value: R): OperatorFunction<unknown, R>;
/** @deprecated Do not specify explicit type parameters. Signatures with type parameters that cannot be inferred will be removed in v8. */
/**
* @deprecated Do not specify explicit type parameters. Signatures with type parameters
* that cannot be inferred will be removed in v8. `mapTo` itself will be removed in v9,
* use {@link map} instead: `map(() => value)`.
* */
export declare function mapTo<T, R>(value: R): OperatorFunction<T, R>;
//# sourceMappingURL=mapTo.d.ts.map

@@ -17,3 +17,3 @@ import { Observable } from '../Observable';

*/
export declare function mergeInternals<T, R>(source: Observable<T>, subscriber: Subscriber<R>, project: (value: T, index: number) => ObservableInput<R>, concurrent: number, onBeforeNext?: (innerValue: R) => void, expand?: boolean, innerSubScheduler?: SchedulerLike, additionalTeardown?: () => void): () => void;
export declare function mergeInternals<T, R>(source: Observable<T>, subscriber: Subscriber<R>, project: (value: T, index: number) => ObservableInput<R>, concurrent: number, onBeforeNext?: (innerValue: R) => void, expand?: boolean, innerSubScheduler?: SchedulerLike, additionalFinalizer?: () => void): () => void;
//# sourceMappingURL=mergeInternals.d.ts.map
import { OperatorFunction, ObservedValueOf, ObservableInput } from '../types';
/** @deprecated Will be removed in v9. Use {@link mergeMap} instead: `mergeMap(() => result)` */
export declare function mergeMapTo<O extends ObservableInput<unknown>>(innerObservable: O, concurrent?: number): OperatorFunction<unknown, ObservedValueOf<O>>;
/** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */
/**
* @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead.
* Details: https://rxjs.dev/deprecations/resultSelector
*/
export declare function mergeMapTo<T, R, O extends ObservableInput<unknown>>(innerObservable: O, resultSelector: (outerValue: T, innerValue: ObservedValueOf<O>, outerIndex: number, innerIndex: number) => R, concurrent?: number): OperatorFunction<T, R>;
//# sourceMappingURL=mergeMapTo.d.ts.map

@@ -31,4 +31,4 @@ import { Subscriber } from '../Subscriber';

* this handler are sent to the `destination` error handler.
* @param onFinalize Additional teardown logic here. This will only be called on teardown if the
* subscriber itself is not already closed. This is called after all other teardown logic is executed.
* @param onFinalize Additional finalization logic here. This will only be called on finalization if the
* subscriber itself is not already closed. This is called after all other finalization logic is executed.
* @param shouldUnsubscribe An optional check to see if an unsubscribe call should truly unsubscribe.

@@ -35,0 +35,0 @@ * NOTE: This currently **ONLY** exists to support the strange behavior of {@link groupBy}, where unsubscription

@@ -34,4 +34,5 @@ import { Observable } from '../Observable';

* Observable with the exception of a `complete`.
* @deprecated Will be removed in v9 or v10. Use {@link repeat}'s `delay` option instead.
*/
export declare function repeatWhen<T>(notifier: (notifications: Observable<void>) => Observable<any>): MonoTypeOperatorFunction<T>;
//# sourceMappingURL=repeatWhen.d.ts.map
import { MonoTypeOperatorFunction, ObservableInput } from '../types';
/**
* The {@link retry} operator configuration object. `retry` either accepts a `number`
* or an object described by this interface.
*/
export interface RetryConfig {
/**
* The maximum number of times to retry.
* The maximum number of times to retry. If `count` is omitted, `retry` will try to
* resubscribe on errors infinite number of times.
*/

@@ -21,53 +26,4 @@ count?: number;

}
/**
* Returns an Observable that mirrors the source Observable with the exception of an `error`. If the source Observable
* calls `error`, this method will resubscribe to the source Observable for a maximum of `count` resubscriptions (given
* as a number parameter) rather than propagating the `error` call.
*
* ![](retry.png)
*
* Any and all items emitted by the source Observable will be emitted by the resulting Observable, even those emitted
* during failed subscriptions. For example, if an Observable fails at first but emits `[1, 2]` then succeeds the second
* time and emits: `[1, 2, 3, 4, 5]` then the complete stream of emissions and notifications
* would be: `[1, 2, 1, 2, 3, 4, 5, complete]`.
*
* ## Example
*
* ```ts
* import { interval, mergeMap, throwError, of, retry } from 'rxjs';
*
* const source = interval(1000);
* const result = source.pipe(
* mergeMap(val => val > 5 ? throwError(() => 'Error!') : of(val)),
* retry(2) // retry 2 times on error
* );
*
* result.subscribe({
* next: value => console.log(value),
* error: err => console.log(`${ err }: Retried 2 times then quit!`)
* });
*
* // Output:
* // 0..1..2..3..4..5..
* // 0..1..2..3..4..5..
* // 0..1..2..3..4..5..
* // 'Error!: Retried 2 times then quit!'
* ```
*
* @see {@link retryWhen}
*
* @param count - Number of retry attempts before failing.
* @param resetOnSuccess - When set to `true` every successful emission will reset the error count
* @return A function that returns an Observable that will resubscribe to the
* source stream when the source stream errors, at most `count` times.
*/
export declare function retry<T>(count?: number): MonoTypeOperatorFunction<T>;
/**
* Returns an observable that mirrors the source observable unless it errors. If it errors, the source observable
* will be resubscribed to (or "retried") based on the configuration passed here. See documentation
* for {@link RetryConfig} for more details.
*
* @param config - The retry configuration
*/
export declare function retry<T>(config: RetryConfig): MonoTypeOperatorFunction<T>;
//# sourceMappingURL=retry.d.ts.map

@@ -56,4 +56,5 @@ import { Observable } from '../Observable';

* Observable with the exception of an `error`.
* @deprecated: Will be removed in v9 or v10, use {@link retry}'s `delay` option instead.
*/
export declare function retryWhen<T>(notifier: (errors: Observable<any>) => Observable<any>): MonoTypeOperatorFunction<T>;
//# sourceMappingURL=retryWhen.d.ts.map
import { ObservableInput, OperatorFunction, ObservedValueOf } from '../types';
/** @deprecated Will be removed in v9. Use {@link mergeMap} instead: `mergeMap(() => result)` */
export declare function switchMapTo<O extends ObservableInput<unknown>>(observable: O): OperatorFunction<unknown, ObservedValueOf<O>>;

@@ -3,0 +4,0 @@ /** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */

import { ObservableInput, OperatorFunction, SchedulerLike } from '../types';
/**
* If the time of the Date object passed arrives before the first value arrives from the source, it will unsubscribe
* from the source and switch the subscription to another observable.
*
* <span class="informal">Use to switch to a different observable if the first value doesn't arrive by a specific time</span>
*
* Can be used to set a timeout only for the first value, however it's recommended to use the {@link timeout} operator with
* the `first` configuration to get that effect.
*
* @param dueBy The exact time, as a `Date`, at which the timeout will be triggered if the first value does not arrive.
* @param switchTo The observable to switch to when timeout occurs.
* @param scheduler The scheduler to use with time-related operations within this operator. Defaults to {@link asyncScheduler}
* @deprecated Replaced with {@link timeout}. Instead of `timeoutWith(someDate, a$, scheduler)`, use the configuration object `timeout({ first: someDate, with: () => a$, scheduler })`. Will be removed in v8.
*/
/** @deprecated Replaced with {@link timeout}. Instead of `timeoutWith(someDate, a$, scheduler)`, use the configuration object
* `timeout({ first: someDate, with: () => a$, scheduler })`. Will be removed in v8. */
export declare function timeoutWith<T, R>(dueBy: Date, switchTo: ObservableInput<R>, scheduler?: SchedulerLike): OperatorFunction<T, T | R>;
/**
* When the passed timespan elapses before the source emits any given value, it will unsubscribe from the source,
* and switch the subscription to another observable.
*
* <span class="informal">Used to switch to a different observable if your source is being slow</span>
*
* Useful in cases where:
*
* - You want to switch to a different source that may be faster
* - You want to notify a user that the data stream is slow
* - You want to emit a custom error rather than the {@link TimeoutError} emitted
* by the default usage of {@link timeout}.
*
* ## Examples
*
* Fallback to a faster observable
*
* ```ts
* import { interval, timeoutWith } from 'rxjs';
*
* const slow$ = interval(1000);
* const faster$ = interval(500);
*
* slow$
* .pipe(timeoutWith(900, faster$))
* .subscribe(console.log);
* ```
*
* Emit your own custom timeout error
*
* ```ts
* import { interval, timeoutWith, throwError } from 'rxjs';
*
* class CustomTimeoutError extends Error {
* constructor() {
* super('It was too slow');
* this.name = 'CustomTimeoutError';
* }
* }
*
* const slow$ = interval(1000);
*
* slow$
* .pipe(timeoutWith(900, throwError(() => new CustomTimeoutError())))
* .subscribe({
* error: err => console.error(err.message)
* });
* ```
*
* @see {@link timeout}
*
* @param waitFor The time allowed between values from the source before timeout is triggered.
* @param switchTo The observable to switch to when timeout occurs.
* @param scheduler The scheduler to use with time-related operations within this operator. Defaults to {@link asyncScheduler}
* @return A function that returns an Observable that mirrors behaviour of the
* source Observable, unless timeout happens when it starts emitting values
* from the Observable passed as a second parameter.
* @deprecated Replaced with {@link timeout}. Instead of `timeoutWith(100, a$, scheduler)`, use the configuration object `timeout({ each: 100, with: () => a$, scheduler })`. Will be removed in v8.
*/
/** @deprecated Replaced with {@link timeout}. Instead of `timeoutWith(100, a$, scheduler)`, use the configuration object
* `timeout({ each: 100, with: () => a$, scheduler })`. Will be removed in v8. */
export declare function timeoutWith<T, R>(waitFor: number, switchTo: ObservableInput<R>, scheduler?: SchedulerLike): OperatorFunction<T, T | R>;
//# sourceMappingURL=timeoutWith.d.ts.map

@@ -13,2 +13,3 @@ import { Operator } from './Operator';

closed: boolean;
private currentObservers;
/** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */

@@ -15,0 +16,0 @@ observers: Observer<T>[];

@@ -24,8 +24,8 @@ import { SubscriptionLike, TeardownLogic } from './types';

/**
* The list of registered teardowns to execute upon unsubscription. Adding and removing from this
* The list of registered finalizers to execute upon unsubscription. Adding and removing from this
* list occurs in the {@link #add} and {@link #remove} methods.
*/
private _teardowns;
private _finalizers;
/**
* @param initialTeardown A function executed first as part of the teardown
* @param initialTeardown A function executed first as part of the finalization
* process that is kicked off when {@link #unsubscribe} is called.

@@ -42,8 +42,8 @@ */

/**
* Adds a teardown to this subscription, so that teardown will be unsubscribed/called
* Adds a finalizer to this subscription, so that finalization will be unsubscribed/called
* when this subscription is unsubscribed. If this subscription is already {@link #closed},
* because it has already been unsubscribed, then whatever teardown is passed to it
* will automatically be executed (unless the teardown itself is also a closed subscription).
* because it has already been unsubscribed, then whatever finalizer is passed to it
* will automatically be executed (unless the finalizer itself is also a closed subscription).
*
* Closed Subscriptions cannot be added as teardowns to any subscription. Adding a closed
* Closed Subscriptions cannot be added as finalizers to any subscription. Adding a closed
* subscription to a any subscription will result in no operation. (A noop).

@@ -58,3 +58,3 @@ *

*
* @param teardown The teardown logic to add to this subscription.
* @param teardown The finalization logic to add to this subscription.
*/

@@ -82,3 +82,3 @@ add(teardown: TeardownLogic): void;

/**
* Removes a teardown from this subscription that was previously added with the {@link #add} method.
* Removes a finalizer from this subscription that was previously added with the {@link #add} method.
*

@@ -89,8 +89,8 @@ * Note that `Subscription` instances, when unsubscribed, will automatically remove themselves

*
* If you add the same teardown instance of a function or an unsubscribable object to a `Subcription` instance
* If you add the same finalizer instance of a function or an unsubscribable object to a `Subcription` instance
* more than once, you will need to call `remove` the same number of times to remove all instances.
*
* All teardown instances are removed to free up memory upon unsubscription.
* All finalizer instances are removed to free up memory upon unsubscription.
*
* @param teardown The teardown to remove from this subscription
* @param teardown The finalizer to remove from this subscription
*/

@@ -97,0 +97,0 @@ remove(teardown: Exclude<TeardownLogic, void>): void;

{
"name": "rxjs",
"version": "7.5.4",
"version": "7.5.5",
"description": "Reactive Extensions for modern JavaScript",

@@ -19,3 +19,5 @@ "main": "./dist/cjs/index.js",

".": {
"types": "./dist/types/index.d.ts",
"node": "./dist/cjs/index.js",
"require": "./dist/cjs/index.js",
"es2015": "./dist/esm/index.js",

@@ -25,3 +27,5 @@ "default": "./dist/esm5/index.js"

"./ajax": {
"types": "./dist/types/ajax/index.d.ts",
"node": "./dist/cjs/ajax/index.js",
"require": "./dist/cjs/ajax/index.js",
"es2015": "./dist/esm/ajax/index.js",

@@ -31,3 +35,5 @@ "default": "./dist/esm5/ajax/index.js"

"./fetch": {
"types": "./dist/types/fetch/index.d.ts",
"node": "./dist/cjs/fetch/index.js",
"require": "./dist/cjs/fetch/index.js",
"es2015": "./dist/esm/fetch/index.js",

@@ -37,3 +43,5 @@ "default": "./dist/esm5/fetch/index.js"

"./operators": {
"types": "./dist/types/operators/index.d.ts",
"node": "./dist/cjs/operators/index.js",
"require": "./dist/cjs/operators/index.js",
"es2015": "./dist/esm/operators/index.js",

@@ -43,3 +51,5 @@ "default": "./dist/esm5/operators/index.js"

"./testing": {
"types": "./dist/types/testing/index.d.ts",
"node": "./dist/cjs/testing/index.js",
"require": "./dist/cjs/testing/index.js",
"es2015": "./dist/esm/testing/index.js",

@@ -49,3 +59,5 @@ "default": "./dist/esm5/testing/index.js"

"./webSocket": {
"types": "./dist/types/webSocket/index.d.ts",
"node": "./dist/cjs/webSocket/index.js",
"require": "./dist/cjs/webSocket/index.js",
"es2015": "./dist/esm/webSocket/index.js",

@@ -55,3 +67,5 @@ "default": "./dist/esm5/webSocket/index.js"

"./internal/*": {
"types": "./dist/types/internal/*.d.ts",
"node": "./dist/cjs/internal/*.js",
"require": "./dist/cjs/internal/*.js",
"es2015": "./dist/esm/internal/*.js",

@@ -58,0 +72,0 @@ "default": "./dist/esm5/internal/*.js"

@@ -23,3 +23,3 @@ import { createOperatorSubscriber } from '../../operators/OperatorSubscriber';

* Will automatically set up an internal [AbortController](https://developer.mozilla.org/en-US/docs/Web/API/AbortController)
* in order to teardown the internal `fetch` when the subscription tears down.
* in order to finalize the internal `fetch` when the subscription tears down.
*

@@ -118,3 +118,3 @@ * If a `signal` is provided via the `init` argument, it will behave like it usually does with

// let's process it and chain our abort signals, if necessary.
// If a signal is provided, just have it teardown. It's a cancellation token, basically.
// If a signal is provided, just have it finalized. It's a cancellation token, basically.
const { signal: outerSignal } = init;

@@ -121,0 +121,0 @@ if (outerSignal) {

@@ -215,3 +215,3 @@ import { Subject, AnonymousSubject } from '../../Subject';

* `messageFilter` argument will be used to select the appropriate data for
* the resulting Observable. When teardown occurs, either due to
* the resulting Observable. When finalization occurs, either due to
* unsubscription, completion, or error, a message defined by the `unsubMsg`

@@ -224,3 +224,3 @@ * argument will be sent to the server over the WebSocketSubject.

* @param unsubMsg A function to generate the unsubscription message to be
* sent to the server at teardown. This will still be processed by the
* sent to the server at finalization. This will still be processed by the
* serializer in the WebSocketSubject's config.

@@ -227,0 +227,0 @@ * @param messageFilter A predicate for selecting the appropriate messages

@@ -291,3 +291,3 @@ import { innerFrom } from '../observable/innerFrom';

add(handler);
// When we teardown, we want to remove the handler and free up memory.
// When we finalize, we want to remove the handler and free up memory.
return () => remove!(handler);

@@ -294,0 +294,0 @@ });

@@ -76,3 +76,3 @@ import { Observable } from '../Observable';

return () => {
// Ensure buffered values are released on teardown.
// Ensure buffered values are released on finalization.
currentBuffer = null!;

@@ -79,0 +79,0 @@ };

@@ -114,3 +114,3 @@ import { OperatorFunction } from '../types';

() => {
// Clean up our memory when we teardown
// Clean up our memory when we finalize
buffers = null!;

@@ -117,0 +117,0 @@ }

@@ -60,3 +60,3 @@ import { Subscriber } from '../Subscriber';

const openBuffer = () => {
// Make sure to teardown the closing subscription, we only cared
// Make sure to finalize the closing subscription, we only cared
// about one notification.

@@ -90,3 +90,3 @@ closingSubscriber?.unsubscribe();

undefined,
// Release memory on teardown
// Release memory on finalization
() => (buffer = closingSubscriber = null!)

@@ -93,0 +93,0 @@ )

@@ -132,4 +132,4 @@ import { Observable } from '../Observable';

// We have a synchronous error, we need to make sure to
// teardown right away. This ensures that `finalize` is called
// at the right time, and that teardown occurs at the expected
// finalize right away. This ensures that callbacks in the `finalize` operator are called
// at the right time, and that finalization occurs at the expected
// time between the source error and the subscription to the

@@ -136,0 +136,0 @@ // next observable.

@@ -13,4 +13,2 @@ import { combineLatest } from '../observable/combineLatest';

*
* ![](combineLatestAll.png)
*
* `combineLatestAll` takes an Observable of Observables, and collects all Observables from it. Once the outer Observable completes,

@@ -17,0 +15,0 @@ * it subscribes to all collected Observables and combines their values using the {@link combineLatest} strategy, such that:

@@ -5,3 +5,3 @@ import { concatMap } from './concatMap';

/* tslint:disable:max-line-length */
/** @deprecated Will be removed in v9. Use {@link concatMap} instead: `concatMap(() => result)` */
export function concatMapTo<O extends ObservableInput<unknown>>(observable: O): OperatorFunction<unknown, ObservedValueOf<O>>;

@@ -18,3 +18,2 @@ /** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */

): OperatorFunction<T, R>;
/* tslint:enable:max-line-length */

@@ -75,2 +74,3 @@ /**

* value emitted from the source.
* @deprecated Will be removed in v9. Use {@link concatMap} instead: `concatMap(() => result)`
*/

@@ -77,0 +77,0 @@ export function concatMapTo<T, R, O extends ObservableInput<unknown>>(

@@ -113,3 +113,3 @@ import { Subscriber } from '../Subscriber';

() => {
// Teardown.
// Finalization.
lastValue = durationSubscriber = null;

@@ -116,0 +116,0 @@ }

@@ -118,3 +118,3 @@ import { asyncScheduler } from '../scheduler/async';

() => {
// Teardown.
// Finalization.
lastValue = activeTask = null;

@@ -121,0 +121,0 @@ }

@@ -211,3 +211,3 @@ import { Observable } from '../Observable';

// Our duration notified! We can complete the group.
// The group will be removed from the map in the teardown phase.
// The group will be removed from the map in the finalization phase.
group!.complete();

@@ -221,3 +221,3 @@ durationSubscriber?.unsubscribe();

undefined,
// Teardown: Remove this group from our map.
// Finalization: Remove this group from our map.
() => groups.delete(key)

@@ -270,3 +270,3 @@ );

// We can kill the subscription to our source if we now have no more
// active groups subscribed, and a teardown was already attempted on
// active groups subscribed, and a finalization was already attempted on
// the source.

@@ -273,0 +273,0 @@ --activeGroups === 0 && teardownAttempted && groupBySourceSubscriber.unsubscribe();

import { OperatorFunction } from '../types';
import { map } from './map';
/** @deprecated To be removed in v9. Use {@link map} instead: `map(() => value)`. */
export function mapTo<R>(value: R): OperatorFunction<unknown, R>;
/** @deprecated Do not specify explicit type parameters. Signatures with type parameters that cannot be inferred will be removed in v8. */
/**
* @deprecated Do not specify explicit type parameters. Signatures with type parameters
* that cannot be inferred will be removed in v8. `mapTo` itself will be removed in v9,
* use {@link map} instead: `map(() => value)`.
* */
export function mapTo<T, R>(value: R): OperatorFunction<T, R>;

@@ -39,2 +44,3 @@

* every time the source Observable emits.
* @deprecated To be removed in v9. Use {@link map} instead: `map(() => value)`.
*/

@@ -41,0 +47,0 @@ export function mapTo<R>(value: R): OperatorFunction<unknown, R> {

@@ -29,3 +29,3 @@ import { Observable } from '../Observable';

innerSubScheduler?: SchedulerLike,
additionalTeardown?: () => void
additionalFinalizer?: () => void
) {

@@ -145,7 +145,7 @@ // Buffered values, in the event of going over our concurrency limit

// Additional teardown (for when the destination is torn down).
// Other teardown is added implicitly via subscription above.
// Additional finalization (for when the destination is torn down).
// Other finalization is added implicitly via subscription above.
return () => {
additionalTeardown?.();
additionalFinalizer?.();
};
}

@@ -5,3 +5,3 @@ import { OperatorFunction, ObservedValueOf, ObservableInput } from '../types';

/* tslint:disable:max-line-length */
/** @deprecated Will be removed in v9. Use {@link mergeMap} instead: `mergeMap(() => result)` */
export function mergeMapTo<O extends ObservableInput<unknown>>(

@@ -11,3 +11,6 @@ innerObservable: O,

): OperatorFunction<unknown, ObservedValueOf<O>>;
/** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */
/**
* @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead.
* Details: https://rxjs.dev/deprecations/resultSelector
*/
export function mergeMapTo<T, R, O extends ObservableInput<unknown>>(

@@ -59,2 +62,3 @@ innerObservable: O,

* given `innerObservable`.
* @deprecated Will be removed in v9. Use {@link mergeMap} instead: `mergeMap(() => result)`
*/

@@ -61,0 +65,0 @@ export function mergeMapTo<T, R, O extends ObservableInput<unknown>>(

@@ -39,4 +39,4 @@ import { Subscriber } from '../Subscriber';

* this handler are sent to the `destination` error handler.
* @param onFinalize Additional teardown logic here. This will only be called on teardown if the
* subscriber itself is not already closed. This is called after all other teardown logic is executed.
* @param onFinalize Additional finalization logic here. This will only be called on finalization if the
* subscriber itself is not already closed. This is called after all other finalization logic is executed.
* @param shouldUnsubscribe An optional check to see if an unsubscribe call should truly unsubscribe.

@@ -85,3 +85,3 @@ * NOTE: This currently **ONLY** exists to support the strange behavior of {@link groupBy}, where unsubscription

} finally {
// Ensure teardown.
// Ensure finalization.
this.unsubscribe();

@@ -99,3 +99,3 @@ }

} finally {
// Ensure teardown.
// Ensure finalization.
this.unsubscribe();

@@ -102,0 +102,0 @@ }

@@ -40,2 +40,3 @@ import { Observable } from '../Observable';

* Observable with the exception of a `complete`.
* @deprecated Will be removed in v9 or v10. Use {@link repeat}'s `delay` option instead.
*/

@@ -73,3 +74,3 @@ export function repeatWhen<T>(notifier: (notifications: Observable<void>) => Observable<any>): MonoTypeOperatorFunction<T> {

// call hasn't even returned yet. We've arrived here synchronously.
// So we flag that we want to resub, such that we can ensure teardown
// So we flag that we want to resub, such that we can ensure finalization
// happens before we resubscribe.

@@ -76,0 +77,0 @@ syncResub = true;

@@ -9,5 +9,10 @@ import { MonoTypeOperatorFunction, ObservableInput } from '../types';

/**
* The {@link retry} operator configuration object. `retry` either accepts a `number`
* or an object described by this interface.
*/
export interface RetryConfig {
/**
* The maximum number of times to retry.
* The maximum number of times to retry. If `count` is omitted, `retry` will try to
* resubscribe on errors infinite number of times.
*/

@@ -30,14 +35,22 @@ count?: number;

export function retry<T>(count?: number): MonoTypeOperatorFunction<T>;
export function retry<T>(config: RetryConfig): MonoTypeOperatorFunction<T>;
/**
* Returns an Observable that mirrors the source Observable with the exception of an `error`. If the source Observable
* calls `error`, this method will resubscribe to the source Observable for a maximum of `count` resubscriptions (given
* as a number parameter) rather than propagating the `error` call.
* Returns an Observable that mirrors the source Observable with the exception of an `error`.
*
* If the source Observable calls `error`, this method will resubscribe to the source Observable for a maximum of
* `count` resubscriptions rather than propagating the `error` call.
*
* ![](retry.png)
*
* Any and all items emitted by the source Observable will be emitted by the resulting Observable, even those emitted
* during failed subscriptions. For example, if an Observable fails at first but emits `[1, 2]` then succeeds the second
* time and emits: `[1, 2, 3, 4, 5]` then the complete stream of emissions and notifications
* would be: `[1, 2, 1, 2, 3, 4, 5, complete]`.
* The number of retries is determined by the `count` parameter. It can be set either by passing a number to
* `retry` function or by setting `count` property when `retry` is configured using {@link RetryConfig}. If
* `count` is omitted, `retry` will try to resubscribe on errors infinite number of times.
*
* Any and all items emitted by the source Observable will be emitted by the resulting Observable, even those
* emitted during failed subscriptions. For example, if an Observable fails at first but emits `[1, 2]` then
* succeeds the second time and emits: `[1, 2, 3, 4, 5, complete]` then the complete stream of emissions and
* notifications would be: `[1, 2, 1, 2, 3, 4, 5, complete]`.
*
* ## Example

@@ -68,18 +81,6 @@ *

*
* @param count - Number of retry attempts before failing.
* @param resetOnSuccess - When set to `true` every successful emission will reset the error count
* @param configOrCount - Either number of retry attempts before failing or a {@link RetryConfig} object.
* @return A function that returns an Observable that will resubscribe to the
* source stream when the source stream errors, at most `count` times.
*/
export function retry<T>(count?: number): MonoTypeOperatorFunction<T>;
/**
* Returns an observable that mirrors the source observable unless it errors. If it errors, the source observable
* will be resubscribed to (or "retried") based on the configuration passed here. See documentation
* for {@link RetryConfig} for more details.
*
* @param config - The retry configuration
*/
export function retry<T>(config: RetryConfig): MonoTypeOperatorFunction<T>;
export function retry<T>(configOrCount: number | RetryConfig = Infinity): MonoTypeOperatorFunction<T> {

@@ -86,0 +87,0 @@ let config: RetryConfig;

@@ -62,2 +62,3 @@ import { Observable } from '../Observable';

* Observable with the exception of an `error`.
* @deprecated: Will be removed in v9 or v10, use {@link retry}'s `delay` option instead.
*/

@@ -80,3 +81,3 @@ export function retryWhen<T>(notifier: (errors: Observable<any>) => Observable<any>): MonoTypeOperatorFunction<T> {

// call hasn't even returned yet. We've arrived here synchronously.
// So we flag that we want to resub, such that we can ensure teardown
// So we flag that we want to resub, such that we can ensure finalization
// happens before we resubscribe.

@@ -83,0 +84,0 @@ innerSub ? subscribeForRetryWhen() : (syncResub = true)

@@ -194,3 +194,3 @@ import { Observable } from '../Observable';

// Add the teardown directly to the subscriber - instead of returning it -
// Add the finalization directly to the subscriber - instead of returning it -
// so that the handling of the subscriber's unsubscription will be wired

@@ -197,0 +197,0 @@ // up _before_ the subscription to the source occurs. This is done so that

@@ -162,6 +162,3 @@ import { ReplaySubject } from '../ReplaySubject';

if (configOrBufferSize && typeof configOrBufferSize === 'object') {
bufferSize = configOrBufferSize.bufferSize ?? Infinity;
windowTime = configOrBufferSize.windowTime ?? Infinity;
refCount = !!configOrBufferSize.refCount;
scheduler = configOrBufferSize.scheduler;
({ bufferSize = Infinity, windowTime = Infinity, refCount = false, scheduler } = configOrBufferSize);
} else {

@@ -168,0 +165,0 @@ bufferSize = configOrBufferSize ?? Infinity;

@@ -5,3 +5,3 @@ import { switchMap } from './switchMap';

/* tslint:disable:max-line-length */
/** @deprecated Will be removed in v9. Use {@link mergeMap} instead: `mergeMap(() => result)` */
export function switchMapTo<O extends ObservableInput<unknown>>(observable: O): OperatorFunction<unknown, ObservedValueOf<O>>;

@@ -18,3 +18,2 @@ /** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */

): OperatorFunction<T, R>;
/* tslint:enable:max-line-length */

@@ -60,2 +59,3 @@ /**

* Observable.
* @deprecated Will be removed in v9. Use {@link mergeMap} instead: `mergeMap(() => result)`
*/

@@ -62,0 +62,0 @@ export function switchMapTo<T, R, O extends ObservableInput<unknown>>(

@@ -46,3 +46,3 @@ import { ObservableInput, ObservedValueOf, OperatorFunction } from '../types';

return () => {
// Release state on teardown
// Release state on finalization
state = null!;

@@ -49,0 +49,0 @@ };

@@ -75,3 +75,3 @@ import { EMPTY } from '../observable/empty';

() => {
// During teardown release the values in our buffer.
// During finalization release the values in our buffer.
buffer = null!;

@@ -78,0 +78,0 @@ }

@@ -389,6 +389,8 @@ import { asyncScheduler } from '../scheduler/async';

// Intentionally terse code.
// If we've `seen` a value, that means the "first" clause was met already, if it existed.
// it also means that a timer was already started for "each" (in the next handler above).
// If `first` was provided, and it's a number, then use it.
// If `first` was provided and it's not a number, it's a Date, and we get the difference between it and "now".
// If `first` was not provided at all, then our first timer will be the value from `each`.
startTimer(first != null ? (typeof first === 'number' ? first : +first - scheduler!.now()) : each!);
!seen && startTimer(first != null ? (typeof first === 'number' ? first : +first - scheduler!.now()) : each!);
});

@@ -395,0 +397,0 @@ }

@@ -6,17 +6,8 @@ import { async } from '../scheduler/async';

/**
* If the time of the Date object passed arrives before the first value arrives from the source, it will unsubscribe
* from the source and switch the subscription to another observable.
*
* <span class="informal">Use to switch to a different observable if the first value doesn't arrive by a specific time</span>
*
* Can be used to set a timeout only for the first value, however it's recommended to use the {@link timeout} operator with
* the `first` configuration to get that effect.
*
* @param dueBy The exact time, as a `Date`, at which the timeout will be triggered if the first value does not arrive.
* @param switchTo The observable to switch to when timeout occurs.
* @param scheduler The scheduler to use with time-related operations within this operator. Defaults to {@link asyncScheduler}
* @deprecated Replaced with {@link timeout}. Instead of `timeoutWith(someDate, a$, scheduler)`, use the configuration object `timeout({ first: someDate, with: () => a$, scheduler })`. Will be removed in v8.
*/
/** @deprecated Replaced with {@link timeout}. Instead of `timeoutWith(someDate, a$, scheduler)`, use the configuration object
* `timeout({ first: someDate, with: () => a$, scheduler })`. Will be removed in v8. */
export function timeoutWith<T, R>(dueBy: Date, switchTo: ObservableInput<R>, scheduler?: SchedulerLike): OperatorFunction<T, T | R>;
/** @deprecated Replaced with {@link timeout}. Instead of `timeoutWith(100, a$, scheduler)`, use the configuration object
* `timeout({ each: 100, with: () => a$, scheduler })`. Will be removed in v8. */
export function timeoutWith<T, R>(waitFor: number, switchTo: ObservableInput<R>, scheduler?: SchedulerLike): OperatorFunction<T, T | R>;

@@ -27,11 +18,19 @@ /**

*
* <span class="informal">Used to switch to a different observable if your source is being slow</span>
* <span class="informal">Used to switch to a different observable if your source is being slow.</span>
*
* Useful in cases where:
*
* - You want to switch to a different source that may be faster
* - You want to notify a user that the data stream is slow
* - You want to switch to a different source that may be faster.
* - You want to notify a user that the data stream is slow.
* - You want to emit a custom error rather than the {@link TimeoutError} emitted
* by the default usage of {@link timeout}.
*
* If the first parameter is passed as Date and the time of the Date arrives before the first value arrives from the source,
* it will unsubscribe from the source and switch the subscription to another observable.
*
* <span class="informal">Use Date object to switch to a different observable if the first value doesn't arrive by a specific time.</span>
*
* Can be used to set a timeout only for the first value, however it's recommended to use the {@link timeout} operator with
* the `first` configuration to get the same effect.
*
* ## Examples

@@ -75,12 +74,13 @@ *

*
* @param waitFor The time allowed between values from the source before timeout is triggered.
* @param switchTo The observable to switch to when timeout occurs.
* @param due When passed a number, used as the time (in milliseconds) allowed between each value from the source before timeout
* is triggered. When passed a Date, used as the exact time at which the timeout will be triggered if the first value does not arrive.
* @param withObservable The observable to switch to when timeout occurs.
* @param scheduler The scheduler to use with time-related operations within this operator. Defaults to {@link asyncScheduler}
* @return A function that returns an Observable that mirrors behaviour of the
* source Observable, unless timeout happens when it starts emitting values
* from the Observable passed as a second parameter.
* @deprecated Replaced with {@link timeout}. Instead of `timeoutWith(100, a$, scheduler)`, use the configuration object `timeout({ each: 100, with: () => a$, scheduler })`. Will be removed in v8.
* from the `ObservableInput` passed as a second parameter.
* @deprecated Replaced with {@link timeout}. Instead of `timeoutWith(100, a$, scheduler)`, use {@link timeout} with the configuration
* object: `timeout({ each: 100, with: () => a$, scheduler })`. Instead of `timeoutWith(someDate, a$, scheduler)`, use {@link timeout}
* with the configuration object: `timeout({ first: someDate, with: () => a$, scheduler })`. Will be removed in v8.
*/
export function timeoutWith<T, R>(waitFor: number, switchTo: ObservableInput<R>, scheduler?: SchedulerLike): OperatorFunction<T, T | R>;
export function timeoutWith<T, R>(

@@ -87,0 +87,0 @@ due: number | Date,

@@ -193,4 +193,4 @@ import { Subject } from '../Subject';

// Additional teardown. This will be called when the
// destination tears down. Other teardowns are registered implicitly
// Additional finalization. This will be called when the
// destination tears down. Other finalizations are registered implicitly
// above via subscription.

@@ -197,0 +197,0 @@ return () => {

@@ -122,3 +122,3 @@ import { Observable } from '../Observable';

() => {
// Add this teardown so that all window subjects are
// Add this finalization so that all window subjects are
// disposed of. This way, if a user tries to subscribe

@@ -125,0 +125,0 @@ // to a window *after* the outer subscription has been unsubscribed,

@@ -54,3 +54,3 @@ import { Observable } from '../Observable';

// During teardown, if we see this iterator has a `return` method,
// During finalization, if we see this iterator has a `return` method,
// then we know it is a Generator, and not just an Iterator. So we call

@@ -57,0 +57,0 @@ // the `return()` function. This will ensure that any `finally { }` blocks

@@ -18,5 +18,8 @@ type SetIntervalFunction = (handler: () => void, timeout?: number, ...args: any[]) => number;

// the functions can be called without being bound to the provider.
setInterval(...args) {
const { delegate } = intervalProvider;
return (delegate?.setInterval || setInterval)(...args);
setInterval(handler: () => void, timeout?: number, ...args) {
const {delegate} = intervalProvider;
if (delegate?.setInterval) {
return delegate.setInterval(handler, timeout, ...args);
}
return setInterval(handler, timeout, ...args);
},

@@ -23,0 +26,0 @@ clearInterval(handle) {

@@ -18,5 +18,8 @@ type SetTimeoutFunction = (handler: () => void, timeout?: number, ...args: any[]) => number;

// the functions can be called without being bound to the provider.
setTimeout(...args) {
const { delegate } = timeoutProvider;
return (delegate?.setTimeout || setTimeout)(...args);
setTimeout(handler: () => void, timeout?: number, ...args) {
const {delegate} = timeoutProvider;
if (delegate?.setTimeout) {
return delegate.setTimeout(handler, timeout, ...args);
}
return setTimeout(handler, timeout, ...args);
},

@@ -23,0 +26,0 @@ clearTimeout(handle) {

@@ -19,2 +19,5 @@ import { Operator } from './Operator';

closed = false;
private currentObservers: Observer<T>[] | null = null;
/** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */

@@ -62,4 +65,6 @@ observers: Observer<T>[] = [];

if (!this.isStopped) {
const copy = this.observers.slice();
for (const observer of copy) {
if (!this.currentObservers) {
this.currentObservers = Array.from(this.observers);
}
for (const observer of this.currentObservers) {
observer.next(value);

@@ -100,3 +105,3 @@ }

this.isStopped = this.closed = true;
this.observers = null!;
this.observers = this.currentObservers = null!;
}

@@ -124,5 +129,11 @@

const { hasError, isStopped, observers } = this;
return hasError || isStopped
? EMPTY_SUBSCRIPTION
: (observers.push(subscriber), new Subscription(() => arrRemove(observers, subscriber)));
if (hasError || isStopped) {
return EMPTY_SUBSCRIPTION;
}
this.currentObservers = null;
observers.push(subscriber);
return new Subscription(() => {
this.currentObservers = null;
arrRemove(observers, subscriber);
});
}

@@ -129,0 +140,0 @@

@@ -34,9 +34,9 @@ import { isFunction } from './util/isFunction';

/**
* The list of registered teardowns to execute upon unsubscription. Adding and removing from this
* The list of registered finalizers to execute upon unsubscription. Adding and removing from this
* list occurs in the {@link #add} and {@link #remove} methods.
*/
private _teardowns: Exclude<TeardownLogic, void>[] | null = null;
private _finalizers: Exclude<TeardownLogic, void>[] | null = null;
/**
* @param initialTeardown A function executed first as part of the teardown
* @param initialTeardown A function executed first as part of the finalization
* process that is kicked off when {@link #unsubscribe} is called.

@@ -71,6 +71,6 @@ */

const { initialTeardown } = this;
if (isFunction(initialTeardown)) {
const { initialTeardown: initialFinalizer } = this;
if (isFunction(initialFinalizer)) {
try {
initialTeardown();
initialFinalizer();
} catch (e) {

@@ -81,8 +81,8 @@ errors = e instanceof UnsubscriptionError ? e.errors : [e];

const { _teardowns } = this;
if (_teardowns) {
this._teardowns = null;
for (const teardown of _teardowns) {
const { _finalizers } = this;
if (_finalizers) {
this._finalizers = null;
for (const finalizer of _finalizers) {
try {
execTeardown(teardown);
execFinalizer(finalizer);
} catch (err) {

@@ -106,8 +106,8 @@ errors = errors ?? [];

/**
* Adds a teardown to this subscription, so that teardown will be unsubscribed/called
* Adds a finalizer to this subscription, so that finalization will be unsubscribed/called
* when this subscription is unsubscribed. If this subscription is already {@link #closed},
* because it has already been unsubscribed, then whatever teardown is passed to it
* will automatically be executed (unless the teardown itself is also a closed subscription).
* because it has already been unsubscribed, then whatever finalizer is passed to it
* will automatically be executed (unless the finalizer itself is also a closed subscription).
*
* Closed Subscriptions cannot be added as teardowns to any subscription. Adding a closed
* Closed Subscriptions cannot be added as finalizers to any subscription. Adding a closed
* subscription to a any subscription will result in no operation. (A noop).

@@ -122,6 +122,6 @@ *

*
* @param teardown The teardown logic to add to this subscription.
* @param teardown The finalization logic to add to this subscription.
*/
add(teardown: TeardownLogic): void {
// Only add the teardown if it's not undefined
// Only add the finalizer if it's not undefined
// and don't add a subscription to itself.

@@ -131,4 +131,4 @@ if (teardown && teardown !== this) {

// If this subscription is already closed,
// execute whatever teardown is handed to it automatically.
execTeardown(teardown);
// execute whatever finalizer is handed to it automatically.
execFinalizer(teardown);
} else {

@@ -143,3 +143,3 @@ if (teardown instanceof Subscription) {

}
(this._teardowns = this._teardowns ?? []).push(teardown);
(this._finalizers = this._finalizers ?? []).push(teardown);
}

@@ -185,3 +185,3 @@ }

/**
* Removes a teardown from this subscription that was previously added with the {@link #add} method.
* Removes a finalizer from this subscription that was previously added with the {@link #add} method.
*

@@ -192,12 +192,12 @@ * Note that `Subscription` instances, when unsubscribed, will automatically remove themselves

*
* If you add the same teardown instance of a function or an unsubscribable object to a `Subcription` instance
* If you add the same finalizer instance of a function or an unsubscribable object to a `Subcription` instance
* more than once, you will need to call `remove` the same number of times to remove all instances.
*
* All teardown instances are removed to free up memory upon unsubscription.
* All finalizer instances are removed to free up memory upon unsubscription.
*
* @param teardown The teardown to remove from this subscription
* @param teardown The finalizer to remove from this subscription
*/
remove(teardown: Exclude<TeardownLogic, void>): void {
const { _teardowns } = this;
_teardowns && arrRemove(_teardowns, teardown);
const { _finalizers } = this;
_finalizers && arrRemove(_finalizers, teardown);

@@ -219,8 +219,8 @@ if (teardown instanceof Subscription) {

function execTeardown(teardown: Unsubscribable | (() => void)) {
if (isFunction(teardown)) {
teardown();
function execFinalizer(finalizer: Unsubscribable | (() => void)) {
if (isFunction(finalizer)) {
finalizer();
} else {
teardown.unsubscribe();
finalizer.unsubscribe();
}
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc