@daffodil/external-router 0.73.0 → 0.75.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * Generated bundle index. Do not edit.
3
3
  */
4
- export * from './public_api';
5
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGFmZm9kaWwtZXh0ZXJuYWwtcm91dGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vbGlicy9leHRlcm5hbC1yb3V0ZXIvc3JjL2RhZmZvZGlsLWV4dGVybmFsLXJvdXRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUVILGNBQWMsY0FBYyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBHZW5lcmF0ZWQgYnVuZGxlIGluZGV4LiBEbyBub3QgZWRpdC5cbiAqL1xuXG5leHBvcnQgKiBmcm9tICcuL3B1YmxpY19hcGknO1xuIl19
4
+ export * from './index';
5
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGFmZm9kaWwtZXh0ZXJuYWwtcm91dGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vbGlicy9leHRlcm5hbC1yb3V0ZXIvc3JjL2RhZmZvZGlsLWV4dGVybmFsLXJvdXRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUVILGNBQWMsU0FBUyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBHZW5lcmF0ZWQgYnVuZGxlIGluZGV4LiBEbyBub3QgZWRpdC5cbiAqL1xuXG5leHBvcnQgKiBmcm9tICcuL2luZGV4JztcbiJdfQ==
@@ -0,0 +1,2 @@
1
+ export * from './public_api';
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9saWJzL2V4dGVybmFsLXJvdXRlci9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyxjQUFjLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICcuL3B1YmxpY19hcGknO1xuIl19
@@ -3,7 +3,7 @@
3
3
  * RouteSnapshot.
4
4
  */
5
5
  export const daffExtractDaffPathData = (snapshot, key) => {
6
- const pathFromRoot = snapshot.pathFromRoot[snapshot.pathFromRoot.length - 1].url.map((seg) => seg.path).join('/');
6
+ const pathFromRoot = snapshot.pathFromRoot.flatMap((route) => route.url).map((seg) => seg.path).join('/');
7
7
  return snapshot.data?.daffPaths?.[pathFromRoot]?.[key] ?? null;
8
8
  };
9
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXh0cmFjdC1kYWZmLXBhdGgtZGF0YS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL2xpYnMvZXh0ZXJuYWwtcm91dGVyL3NyYy91dGlsL2V4dHJhY3QtZGFmZi1wYXRoLWRhdGEudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBS0E7OztHQUdHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sdUJBQXVCLEdBQUcsQ0FBcUQsUUFBZ0MsRUFBRSxHQUFNLEVBQVEsRUFBRTtJQUM1SSxNQUFNLFlBQVksR0FBRyxRQUFRLENBQUMsWUFBWSxDQUFDLFFBQVEsQ0FBQyxZQUFZLENBQUMsTUFBTSxHQUFHLENBQUMsQ0FBQyxDQUFDLEdBQUcsQ0FBQyxHQUFHLENBQUMsQ0FBQyxHQUFHLEVBQUUsRUFBRSxDQUFDLEdBQUcsQ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bnN0IHBhdGhGcm9tUm9vdCA9IHNuYXBzaG90LnBhdGhGcm9tUm9vdC5mbGF0TWFwKChyb3V0ZSkgPT4gcm91dGUudXJsKS5tYXAoKHNlZykgPT4gc2VnLnBhdGgpLmpvaW4oJy8nKTtcbiAgcmV0dXJuIHNuYXBzaG90LmRhdGE/LmRhZmZQYXRocz8uW3BhdGhGcm9tUm9vdF0/LltrZXldID8/IG51bGw7XG59O1xuIl19
@@ -287,7 +287,7 @@ const daffDataPathUrlMatcher = (segments, group, route) => {
287
287
  * RouteSnapshot.
288
288
  */
289
289
  const daffExtractDaffPathData = (snapshot, key) => {
290
- const pathFromRoot = snapshot.pathFromRoot[snapshot.pathFromRoot.length - 1].url.map((seg) => seg.path).join('/');
290
+ const pathFromRoot = snapshot.pathFromRoot.flatMap((route) => route.url).map((seg) => seg.path).join('/');
291
291
  return snapshot.data?.daffPaths?.[pathFromRoot]?.[key] ?? null;
292
292
  };
293
293
 
@@ -1 +1 @@
1
- {"version":3,"file":"daffodil-external-router.mjs","sources":["../../../libs/external-router/src/config.ts","../../../libs/external-router/src/token/type-resolvable-routes.token.ts","../../../libs/external-router/src/external-router.module.ts","../../../libs/external-router/src/errors/no-wildcard.ts","../../../libs/external-router/src/router/strategies/insert-route-before-wildcard.ts","../../../libs/external-router/src/errors/unknown-type.ts","../../../libs/external-router/src/transform/resolved-route-to-route.ts","../../../libs/external-router/src/router/router.service.ts","../../../libs/external-router/src/router/strategies/insert-data-path.ts","../../../libs/external-router/src/router/url-matcher/data-path-matcher.ts","../../../libs/external-router/src/util/extract-daff-path-data.ts","../../../libs/external-router/src/public_api.ts","../../../libs/external-router/src/daffodil-external-router.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nexport const daffExternalRouterConfigurationDefault: DaffExternalRouterConfiguration = {\n failedResolutionPath: '/',\n notFoundResolutionPath: '/',\n};\n\n/**\n * The token holding the runtime configuration for the behavior of the\n * `@daffodil/external-router` package.\n */\nexport const DAFF_EXTERNAL_ROUTER_CONFIG = new InjectionToken<\nDaffExternalRouterConfiguration\n>('DAFF_EXTERNAL_ROUTER_CONFIG', {\n providedIn: 'root',\n factory: () => daffExternalRouterConfigurationDefault,\n});\n\n/**\n * The configuration object for the external router package.\n */\nexport interface DaffExternalRouterConfiguration {\n /**\n * The path to redirect to when external route resolution fails.\n */\n failedResolutionPath: string;\n\n /**\n * The path to redirect to when the requested URL is not found.\n */\n notFoundResolutionPath: string;\n}\n","import {\n InjectionToken,\n Provider,\n} from '@angular/core';\n\nimport { DaffExternalRouterInsertionStrategy } from '../model/insertion-strategy.type';\nimport { DaffExternalRouteType } from '../model/route-type';\nimport { DaffRouteWithoutPath } from '../model/route-without-path';\nimport { DaffTypeRoutePair } from '../model/type-route-pair';\n\n/**\n * A multi-token that allows you to register route \"types\" that correspond to routes.\n */\nexport const DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE = new InjectionToken<\nDaffTypeRoutePair[]\n>('DAFF_EXTERNAL_ROUTER_RESOLVABLE_TYPE_ROUTES', {\n providedIn: 'root',\n factory: () => [],\n});\n\n/**\n * A provider used to connect a type to a route to enable dynamic route resolution at runtime.\n */\nexport function daffProvideRouteResolvableByType(typeRoutePair: DaffTypeRoutePair): Provider {\n return {\n provide: DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE,\n multi: true,\n useValue: typeRoutePair,\n };\n}\n\n/**\n * A multi-provider used to connect an array of types to their respective routes.\n */\nexport function daffProvideRoutesResolvableByType(routes: DaffTypeRoutePair[]): Provider[] {\n return routes.map((route: DaffTypeRoutePair) => ({\n provide: DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE,\n multi: true,\n useValue: route,\n }));\n}\n","import { CommonModule } from '@angular/common';\nimport {\n ModuleWithProviders,\n NgModule,\n} from '@angular/core';\n\nimport {\n DaffExternalRouterConfiguration,\n DAFF_EXTERNAL_ROUTER_CONFIG,\n daffExternalRouterConfigurationDefault,\n} from './config';\nimport { DaffTypeRoutePair } from './model/type-route-pair';\nimport { daffProvideRoutesResolvableByType } from './token/type-resolvable-routes.token';\n\n/**\n * The external `DaffExternalRouterModule` allows you to configure the\n * `@daffodil/external-router` package's behavior.\n */\n@NgModule({\n declarations: [],\n imports: [CommonModule],\n})\nexport class DaffExternalRouterModule {\n static forRoot(\n config: Partial<DaffExternalRouterConfiguration>,\n routes: DaffTypeRoutePair[] = [],\n ): ModuleWithProviders<DaffExternalRouterModule> {\n return {\n ngModule: DaffExternalRouterModule,\n providers: [\n { provide: DAFF_EXTERNAL_ROUTER_CONFIG, useValue: { ...daffExternalRouterConfigurationDefault, ...config }},\n ...daffProvideRoutesResolvableByType(routes),\n ],\n };\n }\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\n/**\n * An error thrown when there was no wildcard route found in configuration\n * of the Angular Router.\n */\nexport class DaffExternalRouterNoWildcardError extends DaffInheritableError\n implements DaffError {\n public readonly code: string = 'NO_WILDCARD_ROUTE';\n\n constructor(message?: string) {\n\t super(message);\n }\n}\n","import {\n Route,\n Routes,\n} from '@angular/router';\n\nimport { DaffExternalRouterNoWildcardError } from '../../errors/no-wildcard';\nimport { DaffExternalRouterInsertionStrategy } from '../../model/insertion-strategy.type';\n\n/**\n * Inserts a Route into Routes right before the wildcard route.\n * If no wildcard is found, it fails fast with a `DaffExternalRouterNoWildcardError`.\n */\nexport const daffInsertRouteBeforeWildCardStrategy: DaffExternalRouterInsertionStrategy = (\n route: Route,\n routes: Routes,\n): Routes => {\n const index = routes.findIndex((r: Route) => r.path === '**');\n if (index === -1) {\n throw new DaffExternalRouterNoWildcardError(\n 'No wildcard (**) route was found during route resolution.',\n );\n }\n return [\n ...routes.slice(0, index),\n route,\n ...routes.slice(index),\n ];\n};\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\n/**\n * An error thrown when there is a failure matching a configured route to a\n * route type.\n */\nexport class DaffExternalRouterUnknownRouteTypeError extends DaffInheritableError\n implements DaffError {\n public readonly code: string = 'UNKNOWN_ROUTE_TYPE';\n\n constructor(message?: string) {\n\t super(message);\n }\n}\n","import { DaffExternalRouterUnknownRouteTypeError } from '../errors/unknown-type';\nimport { DaffExternallyResolvableUrl } from '../model/resolvable-route';\nimport { DaffRouteInfo } from '../model/route-info';\nimport { DaffTypeRoutePair } from '../model/type-route-pair';\n\n/**\n * Transforms a DaffExternallyResolvableUrl into an Angular Route.\n */\nexport const daffTransformResolvedRouteToRoute = (\n resolvedRoute: DaffExternallyResolvableUrl,\n availableTypes: DaffTypeRoutePair[],\n): DaffRouteInfo => {\n const routeType = availableTypes\n .filter(t => t.type === resolvedRoute.type)\n .shift();\n if (!routeType) {\n throw new DaffExternalRouterUnknownRouteTypeError(\n `Unable to resolve the route '${resolvedRoute.url}'. Its type is '${resolvedRoute.type}' but a matching route wasn't found.`,\n );\n }\n\n return {\n route: {\n path: resolvedRoute.url,\n daffExternalRouteType: resolvedRoute.type,\n ...routeType.route,\n data: {\n ...resolvedRoute.data,\n },\n },\n insertionStrategy: routeType.insertionStrategy,\n };\n};\n","import {\n Inject,\n Injectable,\n} from '@angular/core';\nimport {\n Router,\n Route,\n} from '@angular/router';\n\n\nimport { daffInsertRouteBeforeWildCardStrategy } from './strategies/insert-route-before-wildcard';\nimport { DaffExternalRouterNoWildcardError } from '../errors/no-wildcard';\nimport { DaffExternallyResolvableUrl } from '../model/resolvable-route';\nimport { DaffTypeRoutePair } from '../model/type-route-pair';\nimport { DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE } from '../token/type-resolvable-routes.token';\nimport { daffTransformResolvedRouteToRoute } from '../transform/resolved-route-to-route';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffExternalRouter {\n constructor(\n private router: Router,\n @Inject(DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE)\n private runtimeRoutes: DaffTypeRoutePair[],\n ) { }\n\n /**\n * Adds a route to the existing router configuration.\n */\n add(resolvedRoute: DaffExternallyResolvableUrl) {\n //Get the route.\n const {\n route,\n insertionStrategy,\n } = daffTransformResolvedRouteToRoute(\n resolvedRoute,\n this.runtimeRoutes,\n );\n\n try {\n //Add it to configuration.\n this.router.config = (insertionStrategy || daffInsertRouteBeforeWildCardStrategy)(route, this.router.config);\n } catch (e) {\n if (e instanceof DaffExternalRouterNoWildcardError) {\n throw new DaffExternalRouterNoWildcardError(\n `${e.message} This usually means you have misconfigured your routes.`,\n );\n }\n\n throw e;\n }\n }\n}\n","import {\n Route,\n Routes,\n} from '@angular/router';\n\nimport { DaffExternalRouterInsertionStrategy } from '../../model/insertion-strategy.type';\nimport { DaffExternalRouteType } from '../../model/route-type';\nimport { DaffRouteWithDataPath } from '../../model/route-with-data-path';\nimport { DaffRouteWithSeoData } from '../../model/route-with-seo-data';\nimport { DaffRouteWithType } from '../../model/route-with-type';\n\ntype RouteOperator = (route: Route) => Route;\ntype ExternalRouteOperator = (route: DaffRouteWithDataPath, externalRoute: Route) => Route;\ntype InsertionOperatorFactory = (externalRoute: Route) => RouteOperator;\n\n/**\n * Tests whether or not a route matches a specific Daffodil Route type.\n *\n * See {@link DaffRouteWithDataPath}\n */\nconst routeMatchesRouteType = (route: Route, type: DaffExternalRouteType): boolean => route?.data?.daffExternalRouteType === type;\n\n/**\n * Adds a path to the `daffPaths` of the given route.\n *\n * See {@link DaffRouteWithDataPath}\n */\nconst addRouteToDaffPaths: ExternalRouteOperator =\n (route: DaffRouteWithDataPath, externalRoute: Route) => {\n route.data.daffPaths = {\n ...route.data.daffPaths,\n [externalRoute.path]: externalRoute.data,\n };\n return route;\n };\n\nconst operateOnRoute: InsertionOperatorFactory =\n (externalRoute: Route) => (route: DaffRouteWithDataPath) => addRouteToDaffPaths(route, externalRoute);\n\n/**\n * Traverse the router config tree, halting after the first match.\n * This traversal is implemented in a pre-order manner. As such, for large\n * configuration trees, it will be most efficient to place externally routed\n * components at the top of router configuration.\n */\nconst traverseRouteTree = (routes: Routes = [], matcher: (route: Route) => boolean, operate: RouteOperator): Routes => {\n if(routes.length === 0) {\n return routes;\n }\n\n const stack: Routes = [];\n const treeRoot = { children: routes };\n stack.push(treeRoot);\n\n while(stack.length) {\n const route = stack.pop();\n if(matcher(route)) {\n operate(route);\n break;\n }\n if(route.children){\n stack.push(...route.children.reverse());\n }\n }\n return routes;\n};\n\n/**\n * A route insertion strategy that can be used to append external routes onto\n * existing Angular routes. This can be useful when you need to route to\n * an existing lazy-loaded module from multiple externally defined urls.\n *\n * This should be used in combination with the {@link daffDataPathUrlMatcher} to match lazy-loaded modules with\n * associated external urls.\n *\n * For example, you can provide the insertion strategy in the {@link DaffExternalRouterModule} as below.\n *\n * ```ts\n * DaffExternalRouterModule.forRoot({}, [\n * {\n * type: 'CATEGORY',\n * insertionStrategy: daffInsertDataPathStrategy,\n * route: {}\n * }\n * ],\n * ```\n *\n * Then, you can match it with an associated route defined in your Routing\n * configuration with the {@link daffDataPathUrlMatcher}.\n *\n * ```ts\n * export const routes: Routes = [\n * {\n * matcher: daffDataPathUrlMatcher,\n * data: {\n * daffExternalRouteType: \"CATEGORY\",\n * },\n * loadChildren: () => import('./category/category.module').then((m) => m.MyCategoryModule),\n * }\n * ]\n * ```\n *\n * See {@link DaffRouteWithDataPath}\n *\n */\nexport const daffInsertDataPathStrategy: DaffExternalRouterInsertionStrategy = (externalRoute: DaffRouteWithType & DaffRouteWithSeoData, routes: Routes) => traverseRouteTree(\n routes,\n (route) => routeMatchesRouteType(route, externalRoute.daffExternalRouteType),\n operateOnRoute(externalRoute),\n);\n","import {\n UrlMatcher,\n UrlSegment,\n UrlSegmentGroup,\n} from '@angular/router';\n\nimport { daffUriTruncateLeadingSlash } from '@daffodil/core/routing';\n\nimport { DaffRouteWithDataPath } from '../../model/public_api';\n\n/**\n * A UrlMatcher that does an exact match against a path stored in the special\n * configuration fields that External Router stores on a Route's data.\n *\n * ```ts\n * export const routes: Routes = [\n * {\n * matcher: daffDataPathUrlMatcher,\n * data: {\n * daffExternalRouteType: \"CATEGORY\",\n * },\n * loadChildren: () => import('./category/category.module').then((m) => m.ShopCategoryModule),\n * }\n * ]\n * ```\n * {@link daffInsertDataPathStrategy }\n * {@link DaffRouteWithDataPath }\n */\nexport const daffDataPathUrlMatcher: UrlMatcher = (segments: UrlSegment[], group: UrlSegmentGroup, route: DaffRouteWithDataPath) => {\n const path = daffUriTruncateLeadingSlash(segments.reduce((acc: string, segment) => acc + '/' + segment.path, ''));\n const paths = route?.data?.daffPaths;\n\n // If we don't have any paths, we can safely fail a match.\n if(!paths) {\n return null;\n }\n\n // Otherwise, look up the path in the dictionary, failing if a match isn't found,\n // but matching the entire segment if a match is found.\n return path in paths ? { consumed: segments } : null;\n};\n\n","import {\n ActivatedRouteSnapshot,\n Data,\n} from '@angular/router';\n\n/**\n * Extracts a key from DaffPath data based upon the currently activated\n * RouteSnapshot.\n */\nexport const daffExtractDaffPathData = <T extends Data = Data, K extends keyof T = keyof T>(snapshot: ActivatedRouteSnapshot, key: K): T[K] => {\n const pathFromRoot = snapshot.pathFromRoot[snapshot.pathFromRoot.length - 1].url.map((seg) => seg.path).join('/');\n return snapshot.data?.daffPaths?.[pathFromRoot]?.[key] ?? null;\n};\n","/*\n * Public API Surface of @daffodil/external-router\n */\n\nexport { DaffExternalRouterModule } from './external-router.module';\n\nexport {\n DAFF_EXTERNAL_ROUTER_CONFIG,\n DaffExternalRouterConfiguration,\n} from './config';\n\nexport { daffProvideRouteResolvableByType } from './token/type-resolvable-routes.token';\n\nexport * from './model/public_api';\n\nexport { DaffExternalRouter } from './router/router.service';\nexport { daffInsertRouteBeforeWildCardStrategy } from './router/strategies/insert-route-before-wildcard';\n\nexport { daffInsertDataPathStrategy } from './router/strategies/insert-data-path';\nexport { daffDataPathUrlMatcher } from './router/url-matcher/data-path-matcher';\n\nexport { DaffExternalRouterNoWildcardError } from './errors/no-wildcard';\nexport { DaffExternalRouterUnknownRouteTypeError } from './errors/unknown-type';\n\nexport { daffExtractDaffPathData } from './util/extract-daff-path-data';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;AAEO,MAAM,sCAAsC,GAAoC;AACrF,IAAA,oBAAoB,EAAE,GAAG;AACzB,IAAA,sBAAsB,EAAE,GAAG;CAC5B,CAAC;AAEF;;;AAGG;MACU,2BAA2B,GAAG,IAAI,cAAc,CAE3D,6BAA6B,EAAE;AAC/B,IAAA,UAAU,EAAE,MAAM;AAClB,IAAA,OAAO,EAAE,MAAM,sCAAsC;AACtD,CAAA;;ACND;;AAEG;AACI,MAAM,8CAA8C,GAAG,IAAI,cAAc,CAE9E,6CAA6C,EAAE;AAC/C,IAAA,UAAU,EAAE,MAAM;AAClB,IAAA,OAAO,EAAE,MAAM,EAAE;AAClB,CAAA,CAAC,CAAC;AAEH;;AAEG;AACG,SAAU,gCAAgC,CAAC,aAAgC,EAAA;IAC/E,OAAO;AACL,QAAA,OAAO,EAAE,8CAA8C;AACvD,QAAA,KAAK,EAAE,IAAI;AACX,QAAA,QAAQ,EAAE,aAAa;KACxB,CAAC;AACJ,CAAC;AAED;;AAEG;AACG,SAAU,iCAAiC,CAAC,MAA2B,EAAA;IAC3E,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAwB,MAAM;AAC/C,QAAA,OAAO,EAAE,8CAA8C;AACvD,QAAA,KAAK,EAAE,IAAI;AACX,QAAA,QAAQ,EAAE,KAAK;AAChB,KAAA,CAAC,CAAC,CAAC;AACN;;AC1BA;;;AAGG;MAKU,wBAAwB,CAAA;AACnC,IAAA,OAAO,OAAO,CACZ,MAAgD,EAChD,SAA8B,EAAE,EAAA;QAEhC,OAAO;AACL,YAAA,QAAQ,EAAE,wBAAwB;AAClC,YAAA,SAAS,EAAE;AACT,gBAAA,EAAE,OAAO,EAAE,2BAA2B,EAAE,QAAQ,EAAE,EAAE,GAAG,sCAAsC,EAAE,GAAG,MAAM,EAAE,EAAC;gBAC3G,GAAG,iCAAiC,CAAC,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;;;;;;;;;;;;;;;AAqCG;AACI,MAAM,0BAA0B,GAAwC,CAAC,aAAuD,EAAE,MAAc,KAAK,iBAAiB,CAC3K,MAAM,EACN,CAAC,KAAK,KAAK,qBAAqB,CAAC,KAAK,EAAE,aAAa,CAAC,qBAAqB,CAAC,EAC5E,cAAc,CAAC,aAAa,CAAC;;AClG/B;;;;;;;;;;;;;;;;;AAiBG;AACU,MAAA,sBAAsB,GAAe,CAAC,QAAsB,EAAE,KAAsB,EAAE,KAA4B,KAAI;IACjI,MAAM,IAAI,GAAG,2BAA2B,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAW,EAAE,OAAO,KAAK,GAAG,GAAG,GAAG,GAAG,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;AAClH,IAAA,MAAM,KAAK,GAAG,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC;;IAGrC,IAAG,CAAC,KAAK,EAAE;AACT,QAAA,OAAO,IAAI,CAAC;AACb,KAAA;;;AAID,IAAA,OAAO,IAAI,IAAI,KAAK,GAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;AACxD;;ACnCA;;;AAGG;MACU,uBAAuB,GAAG,CAAqD,QAAgC,EAAE,GAAM,KAAU;AAC5I,IAAA,MAAM,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClH,IAAA,OAAO,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,YAAY,CAAC,GAAG,GAAG,CAAC,IAAI,IAAI,CAAC;AACjE;;ACZA;;AAEG;;ACFH;;AAEG;;;;"}
1
+ {"version":3,"file":"daffodil-external-router.mjs","sources":["../../../libs/external-router/src/config.ts","../../../libs/external-router/src/token/type-resolvable-routes.token.ts","../../../libs/external-router/src/external-router.module.ts","../../../libs/external-router/src/errors/no-wildcard.ts","../../../libs/external-router/src/router/strategies/insert-route-before-wildcard.ts","../../../libs/external-router/src/errors/unknown-type.ts","../../../libs/external-router/src/transform/resolved-route-to-route.ts","../../../libs/external-router/src/router/router.service.ts","../../../libs/external-router/src/router/strategies/insert-data-path.ts","../../../libs/external-router/src/router/url-matcher/data-path-matcher.ts","../../../libs/external-router/src/util/extract-daff-path-data.ts","../../../libs/external-router/src/public_api.ts","../../../libs/external-router/src/daffodil-external-router.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nexport const daffExternalRouterConfigurationDefault: DaffExternalRouterConfiguration = {\n failedResolutionPath: '/',\n notFoundResolutionPath: '/',\n};\n\n/**\n * The token holding the runtime configuration for the behavior of the\n * `@daffodil/external-router` package.\n */\nexport const DAFF_EXTERNAL_ROUTER_CONFIG = new InjectionToken<\nDaffExternalRouterConfiguration\n>('DAFF_EXTERNAL_ROUTER_CONFIG', {\n providedIn: 'root',\n factory: () => daffExternalRouterConfigurationDefault,\n});\n\n/**\n * The configuration object for the external router package.\n */\nexport interface DaffExternalRouterConfiguration {\n /**\n * The path to redirect to when external route resolution fails.\n */\n failedResolutionPath: string;\n\n /**\n * The path to redirect to when the requested URL is not found.\n */\n notFoundResolutionPath: string;\n}\n","import {\n InjectionToken,\n Provider,\n} from '@angular/core';\n\nimport { DaffExternalRouterInsertionStrategy } from '../model/insertion-strategy.type';\nimport { DaffExternalRouteType } from '../model/route-type';\nimport { DaffRouteWithoutPath } from '../model/route-without-path';\nimport { DaffTypeRoutePair } from '../model/type-route-pair';\n\n/**\n * A multi-token that allows you to register route \"types\" that correspond to routes.\n */\nexport const DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE = new InjectionToken<\nDaffTypeRoutePair[]\n>('DAFF_EXTERNAL_ROUTER_RESOLVABLE_TYPE_ROUTES', {\n providedIn: 'root',\n factory: () => [],\n});\n\n/**\n * A provider used to connect a type to a route to enable dynamic route resolution at runtime.\n */\nexport function daffProvideRouteResolvableByType(typeRoutePair: DaffTypeRoutePair): Provider {\n return {\n provide: DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE,\n multi: true,\n useValue: typeRoutePair,\n };\n}\n\n/**\n * A multi-provider used to connect an array of types to their respective routes.\n */\nexport function daffProvideRoutesResolvableByType(routes: DaffTypeRoutePair[]): Provider[] {\n return routes.map((route: DaffTypeRoutePair) => ({\n provide: DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE,\n multi: true,\n useValue: route,\n }));\n}\n","import { CommonModule } from '@angular/common';\nimport {\n ModuleWithProviders,\n NgModule,\n} from '@angular/core';\n\nimport {\n DaffExternalRouterConfiguration,\n DAFF_EXTERNAL_ROUTER_CONFIG,\n daffExternalRouterConfigurationDefault,\n} from './config';\nimport { DaffTypeRoutePair } from './model/type-route-pair';\nimport { daffProvideRoutesResolvableByType } from './token/type-resolvable-routes.token';\n\n/**\n * The external `DaffExternalRouterModule` allows you to configure the\n * `@daffodil/external-router` package's behavior.\n */\n@NgModule({\n declarations: [],\n imports: [CommonModule],\n})\nexport class DaffExternalRouterModule {\n static forRoot(\n config: Partial<DaffExternalRouterConfiguration>,\n routes: DaffTypeRoutePair[] = [],\n ): ModuleWithProviders<DaffExternalRouterModule> {\n return {\n ngModule: DaffExternalRouterModule,\n providers: [\n { provide: DAFF_EXTERNAL_ROUTER_CONFIG, useValue: { ...daffExternalRouterConfigurationDefault, ...config }},\n ...daffProvideRoutesResolvableByType(routes),\n ],\n };\n }\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\n/**\n * An error thrown when there was no wildcard route found in configuration\n * of the Angular Router.\n */\nexport class DaffExternalRouterNoWildcardError extends DaffInheritableError\n implements DaffError {\n public readonly code: string = 'NO_WILDCARD_ROUTE';\n\n constructor(message?: string) {\n\t super(message);\n }\n}\n","import {\n Route,\n Routes,\n} from '@angular/router';\n\nimport { DaffExternalRouterNoWildcardError } from '../../errors/no-wildcard';\nimport { DaffExternalRouterInsertionStrategy } from '../../model/insertion-strategy.type';\n\n/**\n * Inserts a Route into Routes right before the wildcard route.\n * If no wildcard is found, it fails fast with a `DaffExternalRouterNoWildcardError`.\n */\nexport const daffInsertRouteBeforeWildCardStrategy: DaffExternalRouterInsertionStrategy = (\n route: Route,\n routes: Routes,\n): Routes => {\n const index = routes.findIndex((r: Route) => r.path === '**');\n if (index === -1) {\n throw new DaffExternalRouterNoWildcardError(\n 'No wildcard (**) route was found during route resolution.',\n );\n }\n return [\n ...routes.slice(0, index),\n route,\n ...routes.slice(index),\n ];\n};\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\n/**\n * An error thrown when there is a failure matching a configured route to a\n * route type.\n */\nexport class DaffExternalRouterUnknownRouteTypeError extends DaffInheritableError\n implements DaffError {\n public readonly code: string = 'UNKNOWN_ROUTE_TYPE';\n\n constructor(message?: string) {\n\t super(message);\n }\n}\n","import { DaffExternalRouterUnknownRouteTypeError } from '../errors/unknown-type';\nimport { DaffExternallyResolvableUrl } from '../model/resolvable-route';\nimport { DaffRouteInfo } from '../model/route-info';\nimport { DaffTypeRoutePair } from '../model/type-route-pair';\n\n/**\n * Transforms a DaffExternallyResolvableUrl into an Angular Route.\n */\nexport const daffTransformResolvedRouteToRoute = (\n resolvedRoute: DaffExternallyResolvableUrl,\n availableTypes: DaffTypeRoutePair[],\n): DaffRouteInfo => {\n const routeType = availableTypes\n .filter(t => t.type === resolvedRoute.type)\n .shift();\n if (!routeType) {\n throw new DaffExternalRouterUnknownRouteTypeError(\n `Unable to resolve the route '${resolvedRoute.url}'. Its type is '${resolvedRoute.type}' but a matching route wasn't found.`,\n );\n }\n\n return {\n route: {\n path: resolvedRoute.url,\n daffExternalRouteType: resolvedRoute.type,\n ...routeType.route,\n data: {\n ...resolvedRoute.data,\n },\n },\n insertionStrategy: routeType.insertionStrategy,\n };\n};\n","import {\n Inject,\n Injectable,\n} from '@angular/core';\nimport {\n Router,\n Route,\n} from '@angular/router';\n\n\nimport { daffInsertRouteBeforeWildCardStrategy } from './strategies/insert-route-before-wildcard';\nimport { DaffExternalRouterNoWildcardError } from '../errors/no-wildcard';\nimport { DaffExternallyResolvableUrl } from '../model/resolvable-route';\nimport { DaffTypeRoutePair } from '../model/type-route-pair';\nimport { DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE } from '../token/type-resolvable-routes.token';\nimport { daffTransformResolvedRouteToRoute } from '../transform/resolved-route-to-route';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffExternalRouter {\n constructor(\n private router: Router,\n @Inject(DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE)\n private runtimeRoutes: DaffTypeRoutePair[],\n ) { }\n\n /**\n * Adds a route to the existing router configuration.\n */\n add(resolvedRoute: DaffExternallyResolvableUrl) {\n //Get the route.\n const {\n route,\n insertionStrategy,\n } = daffTransformResolvedRouteToRoute(\n resolvedRoute,\n this.runtimeRoutes,\n );\n\n try {\n //Add it to configuration.\n this.router.config = (insertionStrategy || daffInsertRouteBeforeWildCardStrategy)(route, this.router.config);\n } catch (e) {\n if (e instanceof DaffExternalRouterNoWildcardError) {\n throw new DaffExternalRouterNoWildcardError(\n `${e.message} This usually means you have misconfigured your routes.`,\n );\n }\n\n throw e;\n }\n }\n}\n","import {\n Route,\n Routes,\n} from '@angular/router';\n\nimport { DaffExternalRouterInsertionStrategy } from '../../model/insertion-strategy.type';\nimport { DaffExternalRouteType } from '../../model/route-type';\nimport { DaffRouteWithDataPath } from '../../model/route-with-data-path';\nimport { DaffRouteWithSeoData } from '../../model/route-with-seo-data';\nimport { DaffRouteWithType } from '../../model/route-with-type';\n\ntype RouteOperator = (route: Route) => Route;\ntype ExternalRouteOperator = (route: DaffRouteWithDataPath, externalRoute: Route) => Route;\ntype InsertionOperatorFactory = (externalRoute: Route) => RouteOperator;\n\n/**\n * Tests whether or not a route matches a specific Daffodil Route type.\n *\n * See {@link DaffRouteWithDataPath}\n */\nconst routeMatchesRouteType = (route: Route, type: DaffExternalRouteType): boolean => route?.data?.daffExternalRouteType === type;\n\n/**\n * Adds a path to the `daffPaths` of the given route.\n *\n * See {@link DaffRouteWithDataPath}\n */\nconst addRouteToDaffPaths: ExternalRouteOperator =\n (route: DaffRouteWithDataPath, externalRoute: Route) => {\n route.data.daffPaths = {\n ...route.data.daffPaths,\n [externalRoute.path]: externalRoute.data,\n };\n return route;\n };\n\nconst operateOnRoute: InsertionOperatorFactory =\n (externalRoute: Route) => (route: DaffRouteWithDataPath) => addRouteToDaffPaths(route, externalRoute);\n\n/**\n * Traverse the router config tree, halting after the first match.\n * This traversal is implemented in a pre-order manner. As such, for large\n * configuration trees, it will be most efficient to place externally routed\n * components at the top of router configuration.\n */\nconst traverseRouteTree = (routes: Routes = [], matcher: (route: Route) => boolean, operate: RouteOperator): Routes => {\n if(routes.length === 0) {\n return routes;\n }\n\n const stack: Routes = [];\n const treeRoot = { children: routes };\n stack.push(treeRoot);\n\n while(stack.length) {\n const route = stack.pop();\n if(matcher(route)) {\n operate(route);\n break;\n }\n if(route.children){\n stack.push(...route.children.reverse());\n }\n }\n return routes;\n};\n\n/**\n * A route insertion strategy that can be used to append external routes onto\n * existing Angular routes. This can be useful when you need to route to\n * an existing lazy-loaded module from multiple externally defined urls.\n *\n * This should be used in combination with the {@link daffDataPathUrlMatcher} to match lazy-loaded modules with\n * associated external urls.\n *\n * For example, you can provide the insertion strategy in the {@link DaffExternalRouterModule} as below.\n *\n * ```ts\n * DaffExternalRouterModule.forRoot({}, [\n * {\n * type: 'CATEGORY',\n * insertionStrategy: daffInsertDataPathStrategy,\n * route: {}\n * }\n * ],\n * ```\n *\n * Then, you can match it with an associated route defined in your Routing\n * configuration with the {@link daffDataPathUrlMatcher}.\n *\n * ```ts\n * export const routes: Routes = [\n * {\n * matcher: daffDataPathUrlMatcher,\n * data: {\n * daffExternalRouteType: \"CATEGORY\",\n * },\n * loadChildren: () => import('./category/category.module').then((m) => m.MyCategoryModule),\n * }\n * ]\n * ```\n *\n * See {@link DaffRouteWithDataPath}\n *\n */\nexport const daffInsertDataPathStrategy: DaffExternalRouterInsertionStrategy = (externalRoute: DaffRouteWithType & DaffRouteWithSeoData, routes: Routes) => traverseRouteTree(\n routes,\n (route) => routeMatchesRouteType(route, externalRoute.daffExternalRouteType),\n operateOnRoute(externalRoute),\n);\n","import {\n UrlMatcher,\n UrlSegment,\n UrlSegmentGroup,\n} from '@angular/router';\n\nimport { daffUriTruncateLeadingSlash } from '@daffodil/core/routing';\n\nimport { DaffRouteWithDataPath } from '../../model/public_api';\n\n/**\n * A UrlMatcher that does an exact match against a path stored in the special\n * configuration fields that External Router stores on a Route's data.\n *\n * ```ts\n * export const routes: Routes = [\n * {\n * matcher: daffDataPathUrlMatcher,\n * data: {\n * daffExternalRouteType: \"CATEGORY\",\n * },\n * loadChildren: () => import('./category/category.module').then((m) => m.ShopCategoryModule),\n * }\n * ]\n * ```\n * {@link daffInsertDataPathStrategy }\n * {@link DaffRouteWithDataPath }\n */\nexport const daffDataPathUrlMatcher: UrlMatcher = (segments: UrlSegment[], group: UrlSegmentGroup, route: DaffRouteWithDataPath) => {\n const path = daffUriTruncateLeadingSlash(segments.reduce((acc: string, segment) => acc + '/' + segment.path, ''));\n const paths = route?.data?.daffPaths;\n\n // If we don't have any paths, we can safely fail a match.\n if(!paths) {\n return null;\n }\n\n // Otherwise, look up the path in the dictionary, failing if a match isn't found,\n // but matching the entire segment if a match is found.\n return path in paths ? { consumed: segments } : null;\n};\n\n","import {\n ActivatedRouteSnapshot,\n Data,\n} from '@angular/router';\n\n/**\n * Extracts a key from DaffPath data based upon the currently activated\n * RouteSnapshot.\n */\nexport const daffExtractDaffPathData = <T extends Data = Data, K extends keyof T = keyof T>(snapshot: ActivatedRouteSnapshot, key: K): T[K] => {\n const pathFromRoot = snapshot.pathFromRoot.flatMap((route) => route.url).map((seg) => seg.path).join('/');\n return snapshot.data?.daffPaths?.[pathFromRoot]?.[key] ?? null;\n};\n","/*\n * Public API Surface of @daffodil/external-router\n */\n\nexport { DaffExternalRouterModule } from './external-router.module';\n\nexport {\n DAFF_EXTERNAL_ROUTER_CONFIG,\n DaffExternalRouterConfiguration,\n} from './config';\n\nexport { daffProvideRouteResolvableByType } from './token/type-resolvable-routes.token';\n\nexport * from './model/public_api';\n\nexport { DaffExternalRouter } from './router/router.service';\nexport { daffInsertRouteBeforeWildCardStrategy } from './router/strategies/insert-route-before-wildcard';\n\nexport { daffInsertDataPathStrategy } from './router/strategies/insert-data-path';\nexport { daffDataPathUrlMatcher } from './router/url-matcher/data-path-matcher';\n\nexport { DaffExternalRouterNoWildcardError } from './errors/no-wildcard';\nexport { DaffExternalRouterUnknownRouteTypeError } from './errors/unknown-type';\n\nexport { daffExtractDaffPathData } from './util/extract-daff-path-data';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAEO,MAAM,sCAAsC,GAAoC;AACrF,IAAA,oBAAoB,EAAE,GAAG;AACzB,IAAA,sBAAsB,EAAE,GAAG;CAC5B,CAAC;AAEF;;;AAGG;MACU,2BAA2B,GAAG,IAAI,cAAc,CAE3D,6BAA6B,EAAE;AAC/B,IAAA,UAAU,EAAE,MAAM;AAClB,IAAA,OAAO,EAAE,MAAM,sCAAsC;AACtD,CAAA;;ACND;;AAEG;AACI,MAAM,8CAA8C,GAAG,IAAI,cAAc,CAE9E,6CAA6C,EAAE;AAC/C,IAAA,UAAU,EAAE,MAAM;AAClB,IAAA,OAAO,EAAE,MAAM,EAAE;AAClB,CAAA,CAAC,CAAC;AAEH;;AAEG;AACG,SAAU,gCAAgC,CAAC,aAAgC,EAAA;IAC/E,OAAO;AACL,QAAA,OAAO,EAAE,8CAA8C;AACvD,QAAA,KAAK,EAAE,IAAI;AACX,QAAA,QAAQ,EAAE,aAAa;KACxB,CAAC;AACJ,CAAC;AAED;;AAE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AAG,IAAI,CAAC;AACxD;;ACnCA;;;AAGG;MACU,uBAAuB,GAAG,CAAqD,QAAgC,EAAE,GAAM,KAAU;AAC5I,IAAA,MAAM,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC1G,IAAA,OAAO,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,YAAY,CAAC,GAAG,GAAG,CAAC,IAAI,IAAI,CAAC;AACjE;;ACZA;;AAEG;;ACFH;;AAEG;;;;"}
package/index.d.ts CHANGED
@@ -1,5 +1 @@
1
- /**
2
- * Generated bundle index. Do not edit.
3
- */
4
- /// <amd-module name="@daffodil/external-router" />
5
1
  export * from './public_api';
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@daffodil/external-router","nx":{"targets":{"build":{"outputs":["{workspaceRoot}/dist/external-router"]}}},"version":"0.73.0","description":"A platform-agnostic package that connects the @angular/router with an external routing service (e.g. an API), allowing for runtime route resolution.","repository":{"type":"git","url":"https://github.com/graycoreio/daffodil"},"author":"Graycore LLC","license":"MIT","bugs":{"url":"https://github.com/graycoreio/daffodil/issues"},"homepage":"https://github.com/graycoreio/daffodil","peerDependencies":{"@angular/common":"^17.0.0","@angular/core":"^17.0.0","@angular/router":"^17.0.0","@daffodil/core":"0.73.0","rxjs":"7.8.1"},"optionalDependencies":{"apollo-angular":"^6.0.0","@daffodil/driver":"0.73.0"},"module":"fesm2022/daffodil-external-router.mjs","typings":"index.d.ts","exports":{"./package.json":{"default":"./package.json"},".":{"types":"./index.d.ts","esm2022":"./esm2022/daffodil-external-router.mjs","esm":"./esm2022/daffodil-external-router.mjs","default":"./fesm2022/daffodil-external-router.mjs"},"./driver":{"types":"./driver/index.d.ts","esm2022":"./esm2022/driver/daffodil-external-router-driver.mjs","esm":"./esm2022/driver/daffodil-external-router-driver.mjs","default":"./fesm2022/daffodil-external-router-driver.mjs"},"./routing":{"types":"./routing/index.d.ts","esm2022":"./esm2022/routing/daffodil-external-router-routing.mjs","esm":"./esm2022/routing/daffodil-external-router-routing.mjs","default":"./fesm2022/daffodil-external-router-routing.mjs"},"./driver/in-memory":{"types":"./driver/in-memory/index.d.ts","esm2022":"./esm2022/driver/in-memory/daffodil-external-router-driver-in-memory.mjs","esm":"./esm2022/driver/in-memory/daffodil-external-router-driver-in-memory.mjs","default":"./fesm2022/daffodil-external-router-driver-in-memory.mjs"},"./driver/magento":{"types":"./driver/magento/index.d.ts","esm2022":"./esm2022/driver/magento/daffodil-external-router-driver-magento.mjs","esm":"./esm2022/driver/magento/daffodil-external-router-driver-magento.mjs","default":"./fesm2022/daffodil-external-router-driver-magento.mjs"},"./driver/testing":{"types":"./driver/testing/index.d.ts","esm2022":"./esm2022/driver/testing/daffodil-external-router-driver-testing.mjs","esm":"./esm2022/driver/testing/daffodil-external-router-driver-testing.mjs","default":"./fesm2022/daffodil-external-router-driver-testing.mjs"},"./driver/magento/2.4.1":{"types":"./driver/magento/2.4.1/index.d.ts","esm2022":"./esm2022/driver/magento/2.4.1/daffodil-external-router-driver-magento-2.4.1.mjs","esm":"./esm2022/driver/magento/2.4.1/daffodil-external-router-driver-magento-2.4.1.mjs","default":"./fesm2022/daffodil-external-router-driver-magento-2.4.1.mjs"},"./driver/magento/2.4.2":{"types":"./driver/magento/2.4.2/index.d.ts","esm2022":"./esm2022/driver/magento/2.4.2/daffodil-external-router-driver-magento-2.4.2.mjs","esm":"./esm2022/driver/magento/2.4.2/daffodil-external-router-driver-magento-2.4.2.mjs","default":"./fesm2022/daffodil-external-router-driver-magento-2.4.2.mjs"},"./driver/magento/2.4.3":{"types":"./driver/magento/2.4.3/index.d.ts","esm2022":"./esm2022/driver/magento/2.4.3/daffodil-external-router-driver-magento-2.4.3.mjs","esm":"./esm2022/driver/magento/2.4.3/daffodil-external-router-driver-magento-2.4.3.mjs","default":"./fesm2022/daffodil-external-router-driver-magento-2.4.3.mjs"}},"sideEffects":false,"dependencies":{"tslib":"^2.3.0"}}
1
+ {"name":"@daffodil/external-router","nx":{"targets":{"build":{"outputs":["{workspaceRoot}/dist/external-router"]}}},"version":"0.75.0","description":"A platform-agnostic package that connects the @angular/router with an external routing service (e.g. an API), allowing for runtime route resolution.","repository":{"type":"git","url":"https://github.com/graycoreio/daffodil"},"author":"Graycore LLC","license":"MIT","bugs":{"url":"https://github.com/graycoreio/daffodil/issues"},"homepage":"https://github.com/graycoreio/daffodil","peerDependencies":{"@angular/common":"^17.0.0","@angular/core":"^17.0.0","@angular/router":"^17.0.0","@daffodil/core":"0.75.0","rxjs":"7.8.1"},"optionalDependencies":{"apollo-angular":"^6.0.0","@daffodil/driver":"0.75.0"},"module":"fesm2022/daffodil-external-router.mjs","typings":"index.d.ts","exports":{"./package.json":{"default":"./package.json"},".":{"types":"./index.d.ts","esm2022":"./esm2022/daffodil-external-router.mjs","esm":"./esm2022/daffodil-external-router.mjs","default":"./fesm2022/daffodil-external-router.mjs"},"./driver":{"types":"./driver/index.d.ts","esm2022":"./esm2022/driver/daffodil-external-router-driver.mjs","esm":"./esm2022/driver/daffodil-external-router-driver.mjs","default":"./fesm2022/daffodil-external-router-driver.mjs"},"./routing":{"types":"./routing/index.d.ts","esm2022":"./esm2022/routing/daffodil-external-router-routing.mjs","esm":"./esm2022/routing/daffodil-external-router-routing.mjs","default":"./fesm2022/daffodil-external-router-routing.mjs"},"./driver/in-memory":{"types":"./driver/in-memory/index.d.ts","esm2022":"./esm2022/driver/in-memory/daffodil-external-router-driver-in-memory.mjs","esm":"./esm2022/driver/in-memory/daffodil-external-router-driver-in-memory.mjs","default":"./fesm2022/daffodil-external-router-driver-in-memory.mjs"},"./driver/magento":{"types":"./driver/magento/index.d.ts","esm2022":"./esm2022/driver/magento/daffodil-external-router-driver-magento.mjs","esm":"./esm2022/driver/magento/daffodil-external-router-driver-magento.mjs","default":"./fesm2022/daffodil-external-router-driver-magento.mjs"},"./driver/testing":{"types":"./driver/testing/index.d.ts","esm2022":"./esm2022/driver/testing/daffodil-external-router-driver-testing.mjs","esm":"./esm2022/driver/testing/daffodil-external-router-driver-testing.mjs","default":"./fesm2022/daffodil-external-router-driver-testing.mjs"},"./driver/magento/2.4.1":{"types":"./driver/magento/2.4.1/index.d.ts","esm2022":"./esm2022/driver/magento/2.4.1/daffodil-external-router-driver-magento-2.4.1.mjs","esm":"./esm2022/driver/magento/2.4.1/daffodil-external-router-driver-magento-2.4.1.mjs","default":"./fesm2022/daffodil-external-router-driver-magento-2.4.1.mjs"},"./driver/magento/2.4.2":{"types":"./driver/magento/2.4.2/index.d.ts","esm2022":"./esm2022/driver/magento/2.4.2/daffodil-external-router-driver-magento-2.4.2.mjs","esm":"./esm2022/driver/magento/2.4.2/daffodil-external-router-driver-magento-2.4.2.mjs","default":"./fesm2022/daffodil-external-router-driver-magento-2.4.2.mjs"},"./driver/magento/2.4.3":{"types":"./driver/magento/2.4.3/index.d.ts","esm2022":"./esm2022/driver/magento/2.4.3/daffodil-external-router-driver-magento-2.4.3.mjs","esm":"./esm2022/driver/magento/2.4.3/daffodil-external-router-driver-magento-2.4.3.mjs","default":"./fesm2022/daffodil-external-router-driver-magento-2.4.3.mjs"}},"sideEffects":false,"dependencies":{"tslib":"^2.3.0"}}