UNPKG

@akanass/ng-universal-transfer-http

Version:

TransferHttpCacheModule installs a Http interceptor that avoids duplicate HttpClient requests on the client

1,054 lines (1,045 loc) 40.2 kB
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common/http'), require('@angular/platform-browser'), require('@angular/common'), require('create-hash'), require('flatted/esm'), require('rxjs'), require('rxjs/operators')) : typeof define === 'function' && define.amd ? define('@akanass/ng-universal-transfer-http', ['exports', '@angular/core', '@angular/common/http', '@angular/platform-browser', '@angular/common', 'create-hash', 'flatted/esm', 'rxjs', 'rxjs/operators'], factory) : (global = global || self, factory((global.akanass = global.akanass || {}, global.akanass['ng-universal-transfer-http'] = {}), global.ng.core, global.ng.common.http, global.ng.platformBrowser, global.ng.common, global.createHash, global.esm, global.rxjs, global.rxjs.operators)); }(this, function (exports, core, http, platformBrowser, common, createHash, esm, rxjs, operators) { 'use strict'; createHash = createHash && createHash.hasOwnProperty('default') ? createHash['default'] : createHash; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var NG_UNIVERSAL_TRANSFER_HTTP_CONFIG = new core.InjectionToken('ng_universal_transfer_http_config'); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var TransferHttpCacheConfigService = /** @class */ (function () { /** * Class constructor */ function TransferHttpCacheConfigService(_transferHttpCacheConfig) { this._transferHttpCacheConfig = _transferHttpCacheConfig; this._config = { prodMode: true }; if (this._transferHttpCacheConfig !== null) { Object.assign(this._config, this._transferHttpCacheConfig); } } Object.defineProperty(TransferHttpCacheConfigService.prototype, "config", { /** * Returns private property _config */ get: /** * Returns private property _config * @return {?} */ function () { return this._config; }, enumerable: true, configurable: true }); TransferHttpCacheConfigService.decorators = [ { type: core.Injectable } ]; /** @nocollapse */ TransferHttpCacheConfigService.ctorParameters = function () { return [ { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [NG_UNIVERSAL_TRANSFER_HTTP_CONFIG,] }] } ]; }; return TransferHttpCacheConfigService; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var TransferHttpCacheInterceptor = /** @class */ (function () { /** * Class constructor */ function TransferHttpCacheInterceptor(_appRef, _transferState, _platformId, _configService) { this._appRef = _appRef; this._transferState = _transferState; this._platformId = _platformId; this._configService = _configService; this._id = 0; this._serverStateDataStoreKey = platformBrowser.makeStateKey('server_state_data'); this._lastIdStoreKey = platformBrowser.makeStateKey('server_state_last_id'); this._isCacheActivatedStoreKey = platformBrowser.makeStateKey('is_cache_activated'); this._initCacheProcess(); } /** * Initialize cache process */ /** * Initialize cache process * @private * @return {?} */ TransferHttpCacheInterceptor.prototype._initCacheProcess = /** * Initialize cache process * @private * @return {?} */ function () { var _this = this; // initialize cache flag for the current platform rxjs.of(rxjs.of(common.isPlatformServer(this._platformId))) .pipe(operators.flatMap((/** * @param {?} isServer * @return {?} */ function (isServer) { return rxjs.merge(isServer .pipe(operators.filter((/** * @param {?} _ * @return {?} */ function (_) { return !!_; })), operators.tap((/** * @param {?} _ * @return {?} */ function (_) { return _this._isCacheActivated = _; })), operators.tap((/** * @param {?} _ * @return {?} */ function (_) { return _this._transferState.set(_this._isCacheActivatedStoreKey, _); }))), isServer .pipe(operators.filter((/** * @param {?} _ * @return {?} */ function (_) { return !_; })), operators.tap((/** * @param {?} _ * @return {?} */ function (_) { return _this._transferState.hasKey(_this._isCacheActivatedStoreKey) ? _this._isCacheActivated = _this._transferState.get(_this._isCacheActivatedStoreKey, true) : _this._isCacheActivated = _; })))); })), operators.flatMap((/** * @return {?} */ function () { // Stop using the cache if the application has stabilized, indicating initial rendering is complete // or if we are in development mode. return rxjs.merge(rxjs.of(_this._configService.config.prodMode) .pipe(operators.filter((/** * @param {?} _ * @return {?} */ function (_) { return !_; })), operators.tap((/** * @return {?} */ function () { return console.log('TransferHttpCacheModule is in the development mode. ' + 'Enable the production mode with Server Side Rendering.'); }))), _this._appRef.isStable .pipe(operators.filter((/** * @param {?} _ * @return {?} */ function (_) { return !!_; })))) .pipe(operators.first()); }))).subscribe((/** * @return {?} */ function () { return _this._isCacheActivated = false; })); }; /** * Interceptor process */ /** * Interceptor process * @param {?} req * @param {?} next * @return {?} */ TransferHttpCacheInterceptor.prototype.intercept = /** * Interceptor process * @param {?} req * @param {?} next * @return {?} */ function (req, next) { var _this = this; return rxjs.of(rxjs.of(this._isCacheActivated)) .pipe(operators.flatMap((/** * @param {?} isCacheActivated * @return {?} */ function (isCacheActivated) { return rxjs.merge(isCacheActivated .pipe(operators.filter((/** * @param {?} _ * @return {?} */ function (_) { return !_; })), operators.flatMap((/** * @return {?} */ function () { return next.handle(req) .pipe(operators.tap((/** * @return {?} */ function () { return _this._cleanServerState(); }))); }))), isCacheActivated .pipe(operators.filter((/** * @param {?} _ * @return {?} */ function (_) { return !!_; })), operators.flatMap((/** * @return {?} */ function () { return _this._transferStateProcess(req, next); })))); }))); }; /** * Function to clean all data in server state */ /** * Function to clean all data in server state * @private * @return {?} */ TransferHttpCacheInterceptor.prototype._cleanServerState = /** * Function to clean all data in server state * @private * @return {?} */ function () { var _this = this; rxjs.merge(this._getLastId(false) .pipe(operators.tap((/** * @return {?} */ function () { return _this._transferState.remove(_this._lastIdStoreKey); }))), this._getServerStateData(false) .pipe(operators.tap((/** * @param {?} _ * @return {?} */ function (_) { return _.forEach((/** * @param {?} __ * @return {?} */ function (__) { return _this._transferState.remove(platformBrowser.makeStateKey(_this._createHash(__.reqKey + "_" + __.id))); })); })), operators.tap((/** * @return {?} */ function () { return _this._transferState.remove(_this._serverStateDataStoreKey); }))), rxjs.of(rxjs.of(this._transferState.hasKey(this._isCacheActivatedStoreKey))) .pipe(operators.flatMap((/** * @param {?} hasKey * @return {?} */ function (hasKey) { return hasKey .pipe(operators.filter((/** * @param {?} _ * @return {?} */ function (_) { return !!_; })), operators.tap((/** * @return {?} */ function () { return _this._transferState.remove(_this._isCacheActivatedStoreKey); }))); })))) .subscribe((/** * @return {?} */ function () { return undefined; }), (/** * @param {?} e * @return {?} */ function (e) { throw (e); })); }; /** * Transfer state process */ /** * Transfer state process * @private * @param {?} req * @param {?} next * @return {?} */ TransferHttpCacheInterceptor.prototype._transferStateProcess = /** * Transfer state process * @private * @param {?} req * @param {?} next * @return {?} */ function (req, next) { var _this = this; return this._createKey(req) .pipe(operators.flatMap((/** * @param {?} storeKey * @return {?} */ function (storeKey) { return rxjs.of(rxjs.of(_this._transferState.hasKey(storeKey))) .pipe(operators.flatMap((/** * @param {?} hasKey * @return {?} */ function (hasKey) { return rxjs.merge(_this._hasKeyProcess(hasKey, storeKey), _this._hasNotKeyProcess(req, next, hasKey, storeKey)); }))); }))); }; /** * Creates transfer state key's store */ /** * Creates transfer state key's store * @private * @param {?} req * @return {?} */ TransferHttpCacheInterceptor.prototype._createKey = /** * Creates transfer state key's store * @private * @param {?} req * @return {?} */ function (req) { var _this = this; this._id++; return rxjs.of(rxjs.of(common.isPlatformServer(this._platformId))) .pipe(operators.flatMap((/** * @param {?} isServer * @return {?} */ function (isServer) { return rxjs.merge(isServer .pipe(operators.filter((/** * @param {?} _ * @return {?} */ function (_) { return !!_; })), operators.flatMap((/** * @return {?} */ function () { return _this._serverKey(req); }))), isServer .pipe(operators.filter((/** * @param {?} _ * @return {?} */ function (_) { return !_; })), operators.flatMap((/** * @return {?} */ function () { return _this._clientKey(req); })))); }))); }; /** * Function to get state data and create client key for current request */ /** * Function to get state data and create client key for current request * @private * @param {?} req * @return {?} */ TransferHttpCacheInterceptor.prototype._clientKey = /** * Function to get state data and create client key for current request * @private * @param {?} req * @return {?} */ function (req) { var _this = this; return this._requestFormatted(req) .pipe(operators.map((/** * @param {?} _ * @return {?} */ function (_) { return _this._createHash(esm.stringify(_)); })), operators.flatMap((/** * @param {?} reqKey * @return {?} */ function (reqKey) { return _this._getServerStateData() .pipe(operators.flatMap((/** * @param {?} _ * @return {?} */ function (_) { return rxjs.from(_); })), operators.filter((/** * @param {?} _ * @return {?} */ function (_) { return _.reqKey === reqKey; })), operators.defaultIfEmpty(undefined), operators.flatMap((/** * @param {?} _ * @return {?} */ function (_) { return !!_ ? rxjs.of(_) : rxjs.throwError(new Error('Request missing in server state data')); })), operators.flatMap((/** * @param {?} serverState * @return {?} */ function (serverState) { return _this._getLastId() .pipe(operators.flatMap((/** * @param {?} _ * @return {?} */ function (_) { return !_ || _this._id > _ ? rxjs.throwError(new Error('Wrong id for server state data')) : rxjs.of(_this._id); })), operators.map((/** * @param {?} _ * @return {?} */ function (_) { return _ === serverState.id ? _ : serverState.id; })), operators.map((/** * @param {?} id * @return {?} */ function (id) { return _this._createHash(reqKey + "_" + id); })), operators.map((/** * @param {?} key * @return {?} */ function (key) { return platformBrowser.makeStateKey(key); }))); }))); }))); }; /** * Function to get last id from server */ /** * Function to get last id from server * @private * @param {?=} _throwError * @return {?} */ TransferHttpCacheInterceptor.prototype._getLastId = /** * Function to get last id from server * @private * @param {?=} _throwError * @return {?} */ function (_throwError) { var _this = this; if (_throwError === void 0) { _throwError = true; } return rxjs.of(this._lastIdStoreKey) .pipe(operators.flatMap((/** * @param {?} storeKey * @return {?} */ function (storeKey) { return rxjs.of(rxjs.of(_this._transferState.hasKey(storeKey))) .pipe(operators.flatMap((/** * @param {?} hasKey * @return {?} */ function (hasKey) { return rxjs.merge(hasKey .pipe(operators.filter((/** * @param {?} _ * @return {?} */ function (_) { return !_; })), operators.flatMap((/** * @return {?} */ function () { return rxjs.of(_throwError) .pipe(operators.filter((/** * @param {?} __ * @return {?} */ function (__) { return !!__; })), operators.flatMap((/** * @return {?} */ function () { return rxjs.throwError(new Error('Missing server state last id')); }))); }))), hasKey .pipe(operators.filter((/** * @param {?} _ * @return {?} */ function (_) { return !!_; })), operators.map((/** * @return {?} */ function () { return _this._transferState.get(storeKey, 0); })))); }))); }))); }; /** * Function to get server state data */ /** * Function to get server state data * @private * @param {?=} _throwError * @return {?} */ TransferHttpCacheInterceptor.prototype._getServerStateData = /** * Function to get server state data * @private * @param {?=} _throwError * @return {?} */ function (_throwError) { var _this = this; if (_throwError === void 0) { _throwError = true; } return rxjs.of(this._serverStateDataStoreKey) .pipe(operators.flatMap((/** * @param {?} storeKey * @return {?} */ function (storeKey) { return rxjs.of(rxjs.of(_this._transferState.hasKey(storeKey))) .pipe(operators.flatMap((/** * @param {?} hasKey * @return {?} */ function (hasKey) { return rxjs.merge(hasKey .pipe(operators.filter((/** * @param {?} _ * @return {?} */ function (_) { return !_; })), operators.flatMap((/** * @return {?} */ function () { return rxjs.of(_throwError) .pipe(operators.filter((/** * @param {?} __ * @return {?} */ function (__) { return !!__; })), operators.flatMap((/** * @return {?} */ function () { return rxjs.throwError(new Error('Missing server state data')); }))); }))), hasKey .pipe(operators.filter((/** * @param {?} _ * @return {?} */ function (_) { return !!_; })), operators.map((/** * @return {?} */ function () { return _this._transferState.get(storeKey, (/** @type {?} */ ([]))); })))); }))); }))); }; /** * Function to create server key and store state data for current request */ /** * Function to create server key and store state data for current request * @private * @param {?} req * @return {?} */ TransferHttpCacheInterceptor.prototype._serverKey = /** * Function to create server key and store state data for current request * @private * @param {?} req * @return {?} */ function (req) { var _this = this; return this._requestFormatted(req) .pipe(operators.map((/** * @param {?} _ * @return {?} */ function (_) { return _this._createHash(esm.stringify(_)); })), operators.tap((/** * @param {?} reqKey * @return {?} */ function (reqKey) { return _this._storeServerStateData(reqKey); })), operators.map((/** * @param {?} reqKey * @return {?} */ function (reqKey) { return _this._createHash(reqKey + "_" + _this._id); })), operators.map((/** * @param {?} key * @return {?} */ function (key) { return platformBrowser.makeStateKey(key); }))); }; /** * Function to store server state data */ /** * Function to store server state data * @private * @param {?} reqKey * @return {?} */ TransferHttpCacheInterceptor.prototype._storeServerStateData = /** * Function to store server state data * @private * @param {?} reqKey * @return {?} */ function (reqKey) { var _this = this; rxjs.of(this._serverStateDataStoreKey) .pipe(operators.flatMap((/** * @param {?} storeKey * @return {?} */ function (storeKey) { return rxjs.of(rxjs.of(_this._transferState.hasKey(storeKey))) .pipe(operators.flatMap((/** * @param {?} hasKey * @return {?} */ function (hasKey) { return rxjs.merge(hasKey .pipe(operators.filter((/** * @param {?} _ * @return {?} */ function (_) { return !_; })), operators.map((/** * @return {?} */ function () { return (/** @type {?} */ ([])); }))), hasKey .pipe(operators.filter((/** * @param {?} _ * @return {?} */ function (_) { return !!_; })), operators.map((/** * @return {?} */ function () { return _this._transferState.get(storeKey, (/** @type {?} */ ([]))); })), operators.flatMap((/** * @param {?} serverStateData * @return {?} */ function (serverStateData) { return !!serverStateData.find((/** * @param {?} _ * @return {?} */ function (_) { return _.reqKey === reqKey; })) ? rxjs.throwError(new Error('Request already stored in server state data')) : rxjs.of(serverStateData); })))); })), operators.tap((/** * @return {?} */ function () { return _this._transferState.set(_this._lastIdStoreKey, _this._id); }))); }))) .subscribe((/** * @param {?} serverStateData * @return {?} */ function (serverStateData) { return _this._transferState.set(_this._serverStateDataStoreKey, serverStateData.concat({ id: _this._id, reqKey: reqKey })); }), (/** * @param {?} e * @return {?} */ function (e) { throw (e); })); }; /** * Process when key exists in transfer state */ /** * Process when key exists in transfer state * @private * @param {?} hasKey * @param {?} storeKey * @return {?} */ TransferHttpCacheInterceptor.prototype._hasKeyProcess = /** * Process when key exists in transfer state * @private * @param {?} hasKey * @param {?} storeKey * @return {?} */ function (hasKey, storeKey) { var _this = this; return hasKey .pipe(operators.filter((/** * @param {?} _ * @return {?} */ function (_) { return !!_; })), operators.map((/** * @return {?} */ function () { return rxjs.of(_this._transferState.get(storeKey, (/** @type {?} */ ({})))); })), operators.flatMap((/** * @param {?} obs * @return {?} */ function (obs) { return rxjs.merge(obs .pipe(operators.filter((/** * @param {?} _ * @return {?} */ function (_) { return _.status < 400; })), operators.map((/** * @param {?} response * @return {?} */ function (response) { return new http.HttpResponse({ body: response.body, headers: new http.HttpHeaders(response.headers), status: response.status, statusText: response.statusText, url: response.url, }); }))), obs .pipe(operators.filter((/** * @param {?} _ * @return {?} */ function (_) { return _.status >= 400; })), operators.flatMap((/** * @param {?} response * @return {?} */ function (response) { return rxjs.throwError(new http.HttpErrorResponse({ error: response.error, headers: new http.HttpHeaders(response.headers), status: response.status, statusText: response.statusText, url: response.url, })); })))); }))); }; /** * Process when key doesn't exist in transfer state */ /** * Process when key doesn't exist in transfer state * @private * @param {?} req * @param {?} next * @param {?} hasKey * @param {?} storeKey * @return {?} */ TransferHttpCacheInterceptor.prototype._hasNotKeyProcess = /** * Process when key doesn't exist in transfer state * @private * @param {?} req * @param {?} next * @param {?} hasKey * @param {?} storeKey * @return {?} */ function (req, next, hasKey, storeKey) { var _this = this; return hasKey .pipe(operators.filter((/** * @param {?} _ * @return {?} */ function (_) { return !_; })), operators.flatMap((/** * @return {?} */ function () { return next.handle(req) .pipe(operators.tap((/** * @param {?} event * @return {?} */ function (event) { return rxjs.of(event) .pipe(operators.filter((/** * @param {?} evt * @return {?} */ function (evt) { return evt instanceof http.HttpResponse; }))) .subscribe((/** * @param {?} evt * @return {?} */ function (evt) { return _this._transferState.set(storeKey, { body: evt.body, headers: _this._getHeadersMap(evt.headers), status: evt.status, statusText: evt.statusText, // tslint:disable-next-line:no-non-null-assertion url: (/** @type {?} */ (evt.url)), }); })); }), (/** * @param {?} error * @return {?} */ function (error) { return rxjs.of(error) .pipe(operators.filter((/** * @param {?} err * @return {?} */ function (err) { return err instanceof http.HttpErrorResponse; }))) .subscribe((/** * @param {?} err * @return {?} */ function (err) { return _this._transferState.set(storeKey, { error: err.error, headers: _this._getHeadersMap(err.headers), status: err.status, statusText: err.statusText, // tslint:disable-next-line:no-non-null-assertion url: (/** @type {?} */ (err.url)), }); })); }))); }))); }; /** * Creates Headers Map */ /** * Creates Headers Map * @private * @param {?} headers * @return {?} */ TransferHttpCacheInterceptor.prototype._getHeadersMap = /** * Creates Headers Map * @private * @param {?} headers * @return {?} */ function (headers) { // tslint:disable-next-line:no-non-null-assertion return headers.keys().reduce((/** * @param {?} acc * @param {?} curr * @return {?} */ function (acc, curr) { var _a; return Object.assign(acc, (_a = {}, _a[curr] = (/** @type {?} */ (headers.getAll(curr))), _a)); }), {}); }; /** * Function to create sha256 hash */ /** * Function to create sha256 hash * @private * @param {?} data * @return {?} */ TransferHttpCacheInterceptor.prototype._createHash = /** * Function to create sha256 hash * @private * @param {?} data * @return {?} */ function (data) { return createHash('sha256').update(data).digest('hex'); }; /** * Returns HttpRequest with value of header inside url & urlWithParams */ /** * Returns HttpRequest with value of header inside url & urlWithParams * @private * @param {?} req * @param {?} headerName * @return {?} */ TransferHttpCacheInterceptor.prototype._replaceWithHeader = /** * Returns HttpRequest with value of header inside url & urlWithParams * @private * @param {?} req * @param {?} headerName * @return {?} */ function (req, headerName) { var _this = this; return rxjs.of(rxjs.of(this._getHeadersMap(req.headers)[headerName])) .pipe(operators.flatMap((/** * @param {?} obs * @return {?} */ function (obs) { return rxjs.merge(obs.pipe(operators.filter((/** * @param {?} _ * @return {?} */ function (_) { return !!_ && !!_.length; })), operators.map((/** * @param {?} _ * @return {?} */ function (_) { return rxjs.of(_[_.length - 1]); })), operators.flatMap((/** * @param {?} o * @return {?} */ function (o) { return rxjs.merge(o.pipe(operators.filter((/** * @param {?} _ * @return {?} */ function (_) { return !!_; })), operators.flatMap((/** * @param {?} headerValue * @return {?} */ function (headerValue) { return rxjs.merge(_this._formatUrlWithHeaderValue(req.url, headerValue), _this._formatUrlWithHeaderValue(req.urlWithParams, headerValue)).pipe(operators.toArray(), operators.map((/** * @param {?} _ * @return {?} */ function (_) { return (/** @type {?} */ (Object.assign({}, req, { url: _[0], urlWithParams: _[1] }))); }))); }))), o.pipe(operators.filter((/** * @param {?} _ * @return {?} */ function (_) { return !_; })), operators.flatMap((/** * @return {?} */ function () { return rxjs.throwError(new Error("Missing header '" + headerName + "' value inside request to generate state key")); })))); }))), obs.pipe(operators.filter((/** * @param {?} _ * @return {?} */ function (_) { return !_ || !_.length; })), operators.flatMap((/** * @return {?} */ function () { return rxjs.throwError(new Error("Missing header '" + headerName + "' value inside request to generate state key")); })))); }))); }; /** * Replace url with header value */ /** * Replace url with header value * @private * @param {?} url * @param {?} headerValue * @return {?} */ TransferHttpCacheInterceptor.prototype._formatUrlWithHeaderValue = /** * Replace url with header value * @private * @param {?} url * @param {?} headerValue * @return {?} */ function (url, headerValue) { return rxjs.of(url) .pipe(operators.map((/** * @param {?} _ * @return {?} */ function (_) { return _.split('://')[1].split('/'); })), operators.map((/** * @param {?} _ * @return {?} */ function (_) { return _.map((/** * @param {?} s * @param {?} i * @return {?} */ function (s, i) { return i === 0 ? headerValue : s; })); })), operators.map((/** * @param {?} _ * @return {?} */ function (_) { return _.join('/'); }))); }; /** * Returns the good request object to create hash */ /** * Returns the good request object to create hash * @private * @param {?} req * @return {?} */ TransferHttpCacheInterceptor.prototype._requestFormatted = /** * Returns the good request object to create hash * @private * @param {?} req * @return {?} */ function (req) { var _this = this; return rxjs.of(rxjs.of(this._configService.config.headerNameToOverrideUrlInKeyCachingGeneration)) .pipe(operators.flatMap((/** * @param {?} obs * @return {?} */ function (obs) { return rxjs.merge(obs.pipe(operators.filter((/** * @param {?} _ * @return {?} */ function (_) { return !!_; })), operators.flatMap((/** * @param {?} _ * @return {?} */ function (_) { return _this._replaceWithHeader(req, _); }))), obs.pipe(operators.filter((/** * @param {?} _ * @return {?} */ function (_) { return !_; })), operators.map((/** * @return {?} */ function () { return req; })))); }))); }; TransferHttpCacheInterceptor.decorators = [ { type: core.Injectable } ]; /** @nocollapse */ TransferHttpCacheInterceptor.ctorParameters = function () { return [ { type: core.ApplicationRef }, { type: platformBrowser.TransferState }, { type: undefined, decorators: [{ type: core.Inject, args: [core.PLATFORM_ID,] }] }, { type: TransferHttpCacheConfigService } ]; }; return TransferHttpCacheInterceptor; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var TransferHttpCacheModule = /** @class */ (function () { function TransferHttpCacheModule() { } /** * @param {?} config * @return {?} */ TransferHttpCacheModule.withConfig = /** * @param {?} config * @return {?} */ function (config) { return { ngModule: TransferHttpCacheModule, providers: [{ provide: NG_UNIVERSAL_TRANSFER_HTTP_CONFIG, useValue: config }] }; }; TransferHttpCacheModule.decorators = [ { type: core.NgModule, args: [{ imports: [platformBrowser.BrowserTransferStateModule], providers: [ TransferHttpCacheConfigService, { provide: http.HTTP_INTERCEPTORS, useClass: TransferHttpCacheInterceptor, multi: true }, ], },] } ]; return TransferHttpCacheModule; }()); exports.TransferHttpCacheModule = TransferHttpCacheModule; exports.ɵa = TransferHttpCacheConfigService; exports.ɵb = NG_UNIVERSAL_TRANSFER_HTTP_CONFIG; exports.ɵc = TransferHttpCacheInterceptor; Object.defineProperty(exports, '__esModule', { value: true }); })); //# sourceMappingURL=akanass-ng-universal-transfer-http.umd.js.map