@daffodil/external-router 0.41.0 → 0.42.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.
Files changed (81) hide show
  1. package/driver/magento/2.4.3/daffodil-external-router-driver-magento-2.4.3.d.ts +5 -0
  2. package/driver/magento/2.4.3/graphql/queries/resolve.d.ts +6 -0
  3. package/driver/magento/2.4.3/index.d.ts +1 -0
  4. package/driver/magento/2.4.3/magento.module.d.ts +28 -0
  5. package/driver/magento/2.4.3/magento.service.d.ts +18 -0
  6. package/driver/magento/2.4.3/package.json +10 -0
  7. package/driver/magento/2.4.3/public_api.d.ts +2 -0
  8. package/driver/magento/2.4.3/transforms/resolution-to-resolvable-url.d.ts +3 -0
  9. package/driver/magento/model/public_api.d.ts +2 -0
  10. package/driver/magento/model/route-response.d.ts +4 -0
  11. package/driver/magento/model/route.d.ts +34 -0
  12. package/esm2020/config.mjs +1 -1
  13. package/esm2020/driver/in-memory/config.mjs +1 -1
  14. package/esm2020/driver/in-memory/in-memory.service.mjs +1 -1
  15. package/esm2020/driver/interfaces/external-router-driver.interface.mjs +1 -1
  16. package/esm2020/driver/magento/2.4.1/magento.service.mjs +1 -1
  17. package/esm2020/driver/magento/2.4.2/magento.service.mjs +1 -1
  18. package/esm2020/driver/magento/2.4.3/daffodil-external-router-driver-magento-2.4.3.mjs +5 -0
  19. package/esm2020/driver/magento/2.4.3/graphql/queries/resolve.mjs +30 -0
  20. package/esm2020/driver/magento/2.4.3/index.mjs +2 -0
  21. package/esm2020/driver/magento/2.4.3/magento.module.mjs +55 -0
  22. package/esm2020/driver/magento/2.4.3/magento.service.mjs +37 -0
  23. package/esm2020/driver/magento/2.4.3/public_api.mjs +6 -0
  24. package/esm2020/driver/magento/2.4.3/transforms/resolution-to-resolvable-url.mjs +15 -0
  25. package/esm2020/driver/magento/model/public_api.mjs +1 -1
  26. package/esm2020/driver/magento/model/resolution-types.mjs +1 -1
  27. package/esm2020/driver/magento/model/route-response.mjs +2 -0
  28. package/esm2020/driver/magento/model/route.mjs +2 -0
  29. package/esm2020/driver/magento/model/url-resolver.mjs +1 -1
  30. package/esm2020/driver/testing/config.mjs +1 -1
  31. package/esm2020/driver/testing/testing.service.mjs +1 -1
  32. package/esm2020/errors/no-wildcard.mjs +1 -1
  33. package/esm2020/errors/unknown-type.mjs +1 -1
  34. package/esm2020/model/resolvable-route.mjs +1 -1
  35. package/esm2020/model/route-data.mjs +2 -0
  36. package/esm2020/model/route-info.mjs +1 -1
  37. package/esm2020/model/route-with-data-path.mjs +1 -1
  38. package/esm2020/model/route-with-seo-data.mjs +2 -0
  39. package/esm2020/model/route-with-type.mjs +2 -0
  40. package/esm2020/model/type-route-pair.mjs +1 -1
  41. package/esm2020/public_api.mjs +2 -1
  42. package/esm2020/router/strategies/insert-data-path.mjs +9 -6
  43. package/esm2020/routing/errors/client-error.mjs +1 -1
  44. package/esm2020/routing/errors/not-found-error.mjs +1 -1
  45. package/esm2020/routing/errors/permanent-redirect.mjs +1 -1
  46. package/esm2020/routing/errors/server-error.mjs +1 -1
  47. package/esm2020/routing/errors/temporary-redirect.mjs +1 -1
  48. package/esm2020/token/type-resolvable-routes.token.mjs +1 -1
  49. package/esm2020/transform/resolved-route-to-route.mjs +3 -3
  50. package/esm2020/util/extract-daff-path-data.mjs +9 -0
  51. package/fesm2015/daffodil-external-router-driver-in-memory.mjs.map +1 -1
  52. package/fesm2015/daffodil-external-router-driver-magento-2.4.1.mjs.map +1 -1
  53. package/fesm2015/daffodil-external-router-driver-magento-2.4.2.mjs.map +1 -1
  54. package/fesm2015/daffodil-external-router-driver-magento-2.4.3.mjs +143 -0
  55. package/fesm2015/daffodil-external-router-driver-magento-2.4.3.mjs.map +1 -0
  56. package/fesm2015/daffodil-external-router-driver-magento.mjs.map +1 -1
  57. package/fesm2015/daffodil-external-router-driver-testing.mjs.map +1 -1
  58. package/fesm2015/daffodil-external-router-driver.mjs.map +1 -1
  59. package/fesm2015/daffodil-external-router-routing.mjs.map +1 -1
  60. package/fesm2015/daffodil-external-router.mjs +18 -5
  61. package/fesm2015/daffodil-external-router.mjs.map +1 -1
  62. package/fesm2020/daffodil-external-router-driver-in-memory.mjs.map +1 -1
  63. package/fesm2020/daffodil-external-router-driver-magento-2.4.1.mjs.map +1 -1
  64. package/fesm2020/daffodil-external-router-driver-magento-2.4.2.mjs.map +1 -1
  65. package/fesm2020/daffodil-external-router-driver-magento-2.4.3.mjs +140 -0
  66. package/fesm2020/daffodil-external-router-driver-magento-2.4.3.mjs.map +1 -0
  67. package/fesm2020/daffodil-external-router-driver-magento.mjs.map +1 -1
  68. package/fesm2020/daffodil-external-router-driver-testing.mjs.map +1 -1
  69. package/fesm2020/daffodil-external-router-driver.mjs.map +1 -1
  70. package/fesm2020/daffodil-external-router-routing.mjs.map +1 -1
  71. package/fesm2020/daffodil-external-router.mjs +20 -8
  72. package/fesm2020/daffodil-external-router.mjs.map +1 -1
  73. package/model/resolvable-route.d.ts +11 -0
  74. package/model/route-data.d.ts +8 -0
  75. package/model/route-info.d.ts +2 -2
  76. package/model/route-with-data-path.d.ts +3 -4
  77. package/model/route-with-seo-data.d.ts +12 -0
  78. package/model/route-with-type.d.ts +12 -0
  79. package/package.json +11 -3
  80. package/public_api.d.ts +1 -0
  81. package/util/extract-daff-path-data.d.ts +6 -0
@@ -107,10 +107,10 @@ const daffTransformResolvedRouteToRoute = (resolvedRoute, availableTypes) => {
107
107
  return {
108
108
  route: {
109
109
  path: resolvedRoute.url,
110
+ daffExternalRouteType: resolvedRoute.type,
110
111
  ...routeType.route,
111
112
  data: {
112
- daffExternalRouteType: resolvedRoute.type,
113
- ...routeType.route.data,
113
+ ...resolvedRoute.data,
114
114
  },
115
115
  },
116
116
  insertionStrategy: routeType.insertionStrategy,
@@ -179,11 +179,14 @@ const routeMatchesRouteType = (route, type) => route?.data?.daffExternalRouteTyp
179
179
  *
180
180
  * See {@link DaffRouteWithDataPath}
181
181
  */
182
- const addRouteToDaffPaths = (route, path) => route.data.daffPaths = {
183
- ...route.data.daffPaths,
184
- [path]: path,
182
+ const addRouteToDaffPaths = (route, externalRoute) => {
183
+ route.data.daffPaths = {
184
+ ...route.data.daffPaths,
185
+ [externalRoute.path]: externalRoute.data,
186
+ };
187
+ return route;
185
188
  };
186
- const operateOnRoute = (externalRoute) => (route) => addRouteToDaffPaths(route, externalRoute.path);
189
+ const operateOnRoute = (externalRoute) => (route) => addRouteToDaffPaths(route, externalRoute);
187
190
  /**
188
191
  * Traverse the router config tree, halting after the first match.
189
192
  * This traversal is implemented in a pre-order manner. As such, for large
@@ -247,7 +250,7 @@ const traverseRouteTree = (routes = [], matcher, operate) => {
247
250
  * See {@link DaffRouteWithDataPath}
248
251
  *
249
252
  */
250
- const daffInsertDataPathStrategy = (externalRoute, routes) => traverseRouteTree(routes, (route) => routeMatchesRouteType(route, externalRoute.data?.daffExternalRouteType), operateOnRoute(externalRoute));
253
+ const daffInsertDataPathStrategy = (externalRoute, routes) => traverseRouteTree(routes, (route) => routeMatchesRouteType(route, externalRoute.daffExternalRouteType), operateOnRoute(externalRoute));
251
254
 
252
255
  /**
253
256
  * A UrlMatcher that does an exact match against a path stored in the special
@@ -279,6 +282,15 @@ const daffDataPathUrlMatcher = (segments, group, route) => {
279
282
  return path in paths ? { consumed: segments } : null;
280
283
  };
281
284
 
285
+ /**
286
+ * Extracts a key from DaffPath data based upon the currently activated
287
+ * RouteSnapshot.
288
+ */
289
+ const daffExtractDaffPathData = (snapshot, key) => {
290
+ const pathFromRoot = snapshot.pathFromRoot[snapshot.pathFromRoot.length - 1].url.map((seg) => seg.path).join('/');
291
+ return snapshot.data?.daffPaths?.[pathFromRoot]?.[key] ?? null;
292
+ };
293
+
282
294
  /*
283
295
  * Public API Surface of @daffodil/external-router
284
296
  */
@@ -287,5 +299,5 @@ const daffDataPathUrlMatcher = (segments, group, route) => {
287
299
  * Generated bundle index. Do not edit.
288
300
  */
289
301
 
290
- export { DAFF_EXTERNAL_ROUTER_CONFIG, DaffExternalRouter, DaffExternalRouterModule, DaffExternalRouterNoWildcardError, DaffExternalRouterUnknownRouteTypeError, daffDataPathUrlMatcher, daffInsertDataPathStrategy, daffInsertRouteBeforeWildCardStrategy, daffProvideRouteResolvableByType };
302
+ export { DAFF_EXTERNAL_ROUTER_CONFIG, DaffExternalRouter, DaffExternalRouterModule, DaffExternalRouterNoWildcardError, DaffExternalRouterUnknownRouteTypeError, daffDataPathUrlMatcher, daffExtractDaffPathData, daffInsertDataPathStrategy, daffInsertRouteBeforeWildCardStrategy, daffProvideRouteResolvableByType };
291
303
  //# sourceMappingURL=daffodil-external-router.mjs.map
@@ -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/errors/unknown-type.ts","../../../libs/external-router/src/transform/resolved-route-to-route.ts","../../../libs/external-router/src/router/strategies/insert-route-before-wildcard.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/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<\n\tDaffExternalRouterConfiguration\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\t/**\n\t * The path to redirect to when external route resolution fails.\n\t */\n\tfailedResolutionPath: string;\n\n\t/**\n\t * The path to redirect to when the requested URL is not found.\n\t */\n\tnotFoundResolutionPath: 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<\n\tDaffTypeRoutePair[]\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\tpublic readonly code: string = 'NO_WILDCARD_ROUTE';\n\n\tconstructor(message?: string) {\n\t super(message);\n\t}\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\tpublic readonly code: string = 'UNKNOWN_ROUTE_TYPE';\n\n\tconstructor(message?: string) {\n\t super(message);\n\t}\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 ...routeType.route,\n data: {\n daffExternalRouteType: resolvedRoute.type,\n ...routeType.route.data,\n },\n },\n insertionStrategy: routeType.insertionStrategy,\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 Inject,\n Injectable,\n} from '@angular/core';\nimport {\n Router,\n Route,\n} from '@angular/router';\n\n\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';\nimport { daffInsertRouteBeforeWildCardStrategy } from './strategies/insert-route-before-wildcard';\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';\n\n/**\n * Tests whether or not a route matches a specific Daffodil Route type.\n *\n * See {@link DaffRouteWithDataPath}\n */\nconst routeMatchesRouteType = (route: DaffRouteWithDataPath, 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:\n (route: DaffRouteWithDataPath, path: string) => Route =\n (route: DaffRouteWithDataPath, path: string) => route.data.daffPaths = {\n ...route.data.daffPaths,\n [path]: path,\n };\n\nconst operateOnRoute = (externalRoute: Route): (route: Route) => Route =>\n (route: DaffRouteWithDataPath) => addRouteToDaffPaths(route, externalRoute.path);\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: (route: Route) => void): 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: DaffRouteWithDataPath, routes: Routes) => traverseRouteTree(\n routes,\n (route) => routeMatchesRouteType(route, externalRoute.data?.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","/*\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","/**\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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B,OAAO,CAAC,KAAK,CAAC,CAAC;YACf,MAAM;AACP,SAAA;QACD,IAAG,KAAK,CAAC,QAAQ,EAAC;YAChB,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;AACzC,SAAA;AACF,KAAA;AACD,IAAA,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCG;AACU,MAAA,0BAA0B,GAAwC,CAAC,aAAoC,EAAE,MAAc,KAAK,iBAAiB,CACxJ,MAAM,EACN,CAAC,KAAK,KAAK,qBAAqB,CAAC,KAAK,EAAE,aAAa,CAAC,IAAI,EAAE,qBAAqB,CAAC,EAClF,cAAc,CAAC,aAAa,CAAC;;AC1F/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;;ACxCA;;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/errors/unknown-type.ts","../../../libs/external-router/src/transform/resolved-route-to-route.ts","../../../libs/external-router/src/router/strategies/insert-route-before-wildcard.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 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 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 Inject,\n Injectable,\n} from '@angular/core';\nimport {\n Router,\n Route,\n} from '@angular/router';\n\n\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';\nimport { daffInsertRouteBeforeWildCardStrategy } from './strategies/insert-route-before-wildcard';\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>(snapshot: ActivatedRouteSnapshot, key: keyof T): unknown => {\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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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,4 +1,5 @@
1
1
  import { DaffIdentifiable } from '@daffodil/core';
2
+ import { DaffRouteData } from './route-data';
2
3
  import { DaffExternalRouteType } from './route-type';
3
4
  /**
4
5
  * A `DaffExternallyResolvableUrl` describes the relationship between a "type" of route
@@ -19,9 +20,19 @@ export interface DaffExternallyResolvableUrl extends DaffIdentifiable {
19
20
  * Should not contain URL fragments, query parameters, or leading slashes.
20
21
  */
21
22
  url: string;
23
+ /**
24
+ * The type of the route
25
+ *
26
+ * @see {@link DaffExternalRouteType}
27
+ */
22
28
  type: DaffExternalRouteType;
23
29
  /**
24
30
  * The HTTP status code for the resolvable route.
25
31
  */
26
32
  code: number;
33
+ /**
34
+ * Additional route data. Note that this is not guaranteed to come from
35
+ * the driver, its only available when the driver makes it available.
36
+ */
37
+ data?: DaffRouteData;
27
38
  }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Data associated with a route.
3
+ */
4
+ export interface DaffRouteData {
5
+ canonical_url?: string;
6
+ meta_description?: string;
7
+ title?: string;
8
+ }
@@ -1,9 +1,9 @@
1
1
  import { DaffExternalRouterInsertionStrategy } from './insertion-strategy.type';
2
- import { DaffRouteWithDataPath } from './route-with-data-path';
2
+ import { DaffRouteWithType } from './route-with-type';
3
3
  /**
4
4
  * An object containing the info needed to insert a route into a configuration.
5
5
  */
6
6
  export interface DaffRouteInfo {
7
- route: DaffRouteWithDataPath;
7
+ route: DaffRouteWithType;
8
8
  insertionStrategy?: DaffExternalRouterInsertionStrategy;
9
9
  }
@@ -1,5 +1,5 @@
1
- import { Route } from '@angular/router';
2
- import { DaffExternalRouteType } from './route-type';
1
+ import { Data, Route } from '@angular/router';
2
+ import { DaffRouteData } from './route-data';
3
3
  /**
4
4
  * A type that describes the special data that Daffodil will look for when attempting
5
5
  * to match a route based upon path data stored in the `data` key of a route.
@@ -9,7 +9,6 @@ import { DaffExternalRouteType } from './route-type';
9
9
  */
10
10
  export declare type DaffRouteWithDataPath = Route & {
11
11
  data?: {
12
- daffExternalRouteType?: DaffExternalRouteType;
13
- daffPaths?: Record<string, string>;
12
+ daffPaths?: Record<string, DaffRouteData | Data>;
14
13
  };
15
14
  };
@@ -0,0 +1,12 @@
1
+ import { Route } from '@angular/router';
2
+ import { DaffRouteData } from './route-data';
3
+ /**
4
+ * A type that describes the special data that Daffodil will store for SEO purposes on
5
+ * an external resolved route.
6
+ *
7
+ * {@link daffDataPathUrlMatcher}
8
+ * {@link daffInsertDataPathStrategy}
9
+ */
10
+ export declare type DaffRouteWithSeoData = Route & {
11
+ data: DaffRouteData;
12
+ };
@@ -0,0 +1,12 @@
1
+ import { Route } from '@angular/router';
2
+ import { DaffExternalRouteType } from './route-type';
3
+ /**
4
+ * A type that describes the special data that Daffodil will look for when attempting
5
+ * to match a route based upon path data stored in the `data` key of a route.
6
+ *
7
+ * {@link daffDataPathUrlMatcher}
8
+ * {@link daffInsertDataPathStrategy}
9
+ */
10
+ export declare type DaffRouteWithType = Route & {
11
+ daffExternalRouteType: DaffExternalRouteType;
12
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@daffodil/external-router",
3
- "version": "0.41.0",
3
+ "version": "0.42.0",
4
4
  "description": "A platform-agnostic package that connects the @angular/router with an external routing service (e.g. an API), allowing for runtime route resolution.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -16,12 +16,12 @@
16
16
  "@angular/common": "^13.0.0",
17
17
  "@angular/core": "^13.0.0",
18
18
  "@angular/router": "^13.0.0",
19
- "@daffodil/core": "0.41.0",
19
+ "@daffodil/core": "0.42.0",
20
20
  "rxjs": "7.5.5"
21
21
  },
22
22
  "optionalDependencies": {
23
23
  "apollo-angular": "^3.0.1",
24
- "@daffodil/driver": "0.41.0"
24
+ "@daffodil/driver": "0.42.0"
25
25
  },
26
26
  "module": "fesm2015/daffodil-external-router.mjs",
27
27
  "es2020": "fesm2020/daffodil-external-router.mjs",
@@ -65,6 +65,14 @@
65
65
  "node": "./fesm2015/daffodil-external-router-driver-magento-2.4.2.mjs",
66
66
  "default": "./fesm2020/daffodil-external-router-driver-magento-2.4.2.mjs"
67
67
  },
68
+ "./driver/magento/2.4.3": {
69
+ "types": "./driver/magento/2.4.3/daffodil-external-router-driver-magento-2.4.3.d.ts",
70
+ "esm2020": "./esm2020/driver/magento/2.4.3/daffodil-external-router-driver-magento-2.4.3.mjs",
71
+ "es2020": "./fesm2020/daffodil-external-router-driver-magento-2.4.3.mjs",
72
+ "es2015": "./fesm2015/daffodil-external-router-driver-magento-2.4.3.mjs",
73
+ "node": "./fesm2015/daffodil-external-router-driver-magento-2.4.3.mjs",
74
+ "default": "./fesm2020/daffodil-external-router-driver-magento-2.4.3.mjs"
75
+ },
68
76
  "./driver/magento": {
69
77
  "types": "./driver/magento/daffodil-external-router-driver-magento.d.ts",
70
78
  "esm2020": "./esm2020/driver/magento/daffodil-external-router-driver-magento.mjs",
package/public_api.d.ts CHANGED
@@ -8,3 +8,4 @@ export { daffInsertDataPathStrategy } from './router/strategies/insert-data-path
8
8
  export { daffDataPathUrlMatcher } from './router/url-matcher/data-path-matcher';
9
9
  export { DaffExternalRouterNoWildcardError } from './errors/no-wildcard';
10
10
  export { DaffExternalRouterUnknownRouteTypeError } from './errors/unknown-type';
11
+ export { daffExtractDaffPathData } from './util/extract-daff-path-data';
@@ -0,0 +1,6 @@
1
+ import { ActivatedRouteSnapshot, Data } from '@angular/router';
2
+ /**
3
+ * Extracts a key from DaffPath data based upon the currently activated
4
+ * RouteSnapshot.
5
+ */
6
+ export declare const daffExtractDaffPathData: <T extends Data = Data>(snapshot: ActivatedRouteSnapshot, key: keyof T) => unknown;