Creates `Observable` transformation from configuration.

@param strategy The strategy configuration.
function materializedRetryStrategy(strategy) {
    return function (source) {
        switch (strategy.kind) {
            case "ignoreErrorJustComplete":
                return source.pipe(catchError_1.catchError(function (e) {
                    dispatchError(e);
                    return rx.empty();
                }));
            case "ignoreErrorAndReturn":
                return source.pipe(catchError_1.catchError(function (e) {
                    dispatchError(e);
                    return rx.of(strategy.value);
                }));
            case "exponentialBackoff":
                return rx.defer(function () {
                    var counter = 1;
                    return source.pipe(tap_1.tap(function () {
                        counter = 1;
                    }, function () {
                        if (counter * 2 <= strategy.maxBackoffFactor) {
                            counter *= 2;
                        }
                    }), retryWhen_1.retryWhen(function (e) {
                        return e.pipe(switchMap_1.switchMap(function (x) {
                            dispatchError(x);
                            return rx.of(0).pipe(delay_1.delay(strategy.initialTimeout * counter * 1000));
                        }));
                    }));
                });
            case "catchError":
                return source.pipe(catchError_1.catchError(function (e) {
                    dispatchError(e);
                    return rx.of(strategy.handle(e));
                }));
            default:
                return js_extensions_1.unhandledCase(strategy);
        }
    };
}