/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import { EMPTY, from, of, throwError } from 'rxjs'; import { catchError, concatMap, first, map, mapTo, mergeMap, takeLast, tap } from 'rxjs/operators'; import { inheritedParamsDataResolve } from '../router_state'; import { RouteTitleKey } from '../shared'; import { wrapIntoObservable } from '../utils/collection'; import { getClosestRouteInjector } from '../utils/config'; import { getTokenOrFunctionIdentity } from '../utils/preactivation'; import { isEmptyError } from '../utils/type_guards'; export function resolveData(paramsInheritanceStrategy, injector) { return mergeMap(t => { const { targetSnapshot, guards: { canActivateChecks } } = t; if (!canActivateChecks.length) { return of(t); } let canActivateChecksResolved = 0; return from(canActivateChecks) .pipe(concatMap(check => runResolve(check.route, targetSnapshot, paramsInheritanceStrategy, injector)), tap(() => canActivateChecksResolved++), takeLast(1), mergeMap(_ => canActivateChecksResolved === canActivateChecks.length ? of(t) : EMPTY)); }); } function runResolve(futureARS, futureRSS, paramsInheritanceStrategy, injector) { const config = futureARS.routeConfig; const resolve = futureARS._resolve; if (config?.title !== undefined && !hasStaticTitle(config)) { resolve[RouteTitleKey] = config.title; } return resolveNode(resolve, futureARS, futureRSS, injector).pipe(map((resolvedData) => { futureARS._resolvedData = resolvedData; futureARS.data = inheritedParamsDataResolve(futureARS, paramsInheritanceStrategy).resolve; if (config && hasStaticTitle(config)) { futureARS.data[RouteTitleKey] = config.title; } return null; })); } function resolveNode(resolve, futureARS, futureRSS, injector) { const keys = getDataKeys(resolve); if (keys.length === 0) { return of({}); } const data = {}; return from(keys).pipe(mergeMap(key => getResolver(resolve[key], futureARS, futureRSS, injector) .pipe(first(), tap((value) => { data[key] = value; }))), takeLast(1), mapTo(data), catchError((e) => isEmptyError(e) ? EMPTY : throwError(e))); } function getDataKeys(obj) { return [...Object.keys(obj), ...Object.getOwnPropertySymbols(obj)]; } function getResolver(injectionToken, futureARS, futureRSS, injector) { const closestInjector = getClosestRouteInjector(futureARS) ?? injector; const resolver = getTokenOrFunctionIdentity(injectionToken, closestInjector); const resolverValue = resolver.resolve ? resolver.resolve(futureARS, futureRSS) : closestInjector.runInContext(() => resolver(futureARS, futureRSS)); return wrapIntoObservable(resolverValue); } function hasStaticTitle(config) { return typeof config.title === 'string' || config.title === null; } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVzb2x2ZV9kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvcm91dGVyL3NyYy9vcGVyYXRvcnMvcmVzb2x2ZV9kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7R0FNRztBQUdILE9BQU8sRUFBQyxLQUFLLEVBQUUsSUFBSSxFQUF3QyxFQUFFLEVBQUUsVUFBVSxFQUFDLE1BQU0sTUFBTSxDQUFDO0FBQ3ZGLE9BQU8sRUFBQyxVQUFVLEVBQUUsU0FBUyxFQUFFLEtBQUssRUFBRSxHQUFHLEVBQUUsS0FBSyxFQUFFLFFBQVEsRUFBRSxRQUFRLEVBQUUsR0FBRyxFQUFDLE1BQU0sZ0JBQWdCLENBQUM7QUFJakcsT0FBTyxFQUF5QiwwQkFBMEIsRUFBc0IsTUFBTSxpQkFBaUIsQ0FBQztBQUN4RyxPQUFPLEVBQUMsYUFBYSxFQUFDLE1BQU0sV0FBVyxDQUFDO0FBQ3hDLE9BQU8sRUFBQyxrQkFBa0IsRUFBQyxNQUFNLHFCQUFxQixDQUFDO0FBQ3ZELE9BQU8sRUFBQyx1QkFBdUIsRUFBQyxNQUFNLGlCQUFpQixDQUFDO0FBQ3hELE9BQU8sRUFBQywwQkFBMEIsRUFBQyxNQUFNLHdCQUF3QixDQUFDO0FBQ2xFLE9BQU8sRUFBQyxZQUFZLEVBQUMsTUFBTSxzQkFBc0IsQ0FBQztBQUVsRCxNQUFNLFVBQVUsV0FBVyxDQ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