@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
@@ -105,7 +105,7 @@ const daffTransformResolvedRouteToRoute = (resolvedRoute, availableTypes) => {
105
105
  throw new DaffExternalRouterUnknownRouteTypeError(`Unable to resolve the route '${resolvedRoute.url}'. Its type is '${resolvedRoute.type}' but a matching route wasn't found.`);
106
106
  }
107
107
  return {
108
- route: Object.assign(Object.assign({ path: resolvedRoute.url }, routeType.route), { data: Object.assign({ daffExternalRouteType: resolvedRoute.type }, routeType.route.data) }),
108
+ route: Object.assign(Object.assign({ path: resolvedRoute.url, daffExternalRouteType: resolvedRoute.type }, routeType.route), { data: Object.assign({}, resolvedRoute.data) }),
109
109
  insertionStrategy: routeType.insertionStrategy,
110
110
  };
111
111
  };
@@ -174,8 +174,11 @@ const routeMatchesRouteType = (route, type) => { var _a; return ((_a = route ===
174
174
  *
175
175
  * See {@link DaffRouteWithDataPath}
176
176
  */
177
- const addRouteToDaffPaths = (route, path) => route.data.daffPaths = Object.assign(Object.assign({}, route.data.daffPaths), { [path]: path });
178
- const operateOnRoute = (externalRoute) => (route) => addRouteToDaffPaths(route, externalRoute.path);
177
+ const addRouteToDaffPaths = (route, externalRoute) => {
178
+ route.data.daffPaths = Object.assign(Object.assign({}, route.data.daffPaths), { [externalRoute.path]: externalRoute.data });
179
+ return route;
180
+ };
181
+ const operateOnRoute = (externalRoute) => (route) => addRouteToDaffPaths(route, externalRoute);
179
182
  /**
180
183
  * Traverse the router config tree, halting after the first match.
181
184
  * This traversal is implemented in a pre-order manner. As such, for large
@@ -239,7 +242,7 @@ const traverseRouteTree = (routes = [], matcher, operate) => {
239
242
  * See {@link DaffRouteWithDataPath}
240
243
  *
241
244
  */
242
- const daffInsertDataPathStrategy = (externalRoute, routes) => traverseRouteTree(routes, (route) => { var _a; return routeMatchesRouteType(route, (_a = externalRoute.data) === null || _a === void 0 ? void 0 : _a.daffExternalRouteType); }, operateOnRoute(externalRoute));
245
+ const daffInsertDataPathStrategy = (externalRoute, routes) => traverseRouteTree(routes, (route) => routeMatchesRouteType(route, externalRoute.daffExternalRouteType), operateOnRoute(externalRoute));
243
246
 
244
247
  /**
245
248
  * A UrlMatcher that does an exact match against a path stored in the special
@@ -272,6 +275,16 @@ const daffDataPathUrlMatcher = (segments, group, route) => {
272
275
  return path in paths ? { consumed: segments } : null;
273
276
  };
274
277
 
278
+ /**
279
+ * Extracts a key from DaffPath data based upon the currently activated
280
+ * RouteSnapshot.
281
+ */
282
+ const daffExtractDaffPathData = (snapshot, key) => {
283
+ var _a, _b, _c, _d;
284
+ const pathFromRoot = snapshot.pathFromRoot[snapshot.pathFromRoot.length - 1].url.map((seg) => seg.path).join('/');
285
+ return (_d = (_c = (_b = (_a = snapshot.data) === null || _a === void 0 ? void 0 : _a.daffPaths) === null || _b === void 0 ? void 0 : _b[pathFromRoot]) === null || _c === void 0 ? void 0 : _c[key]) !== null && _d !== void 0 ? _d : null;
286
+ };
287
+
275
288
  /*
276
289
  * Public API Surface of @daffodil/external-router
277
290
  */
@@ -280,5 +293,5 @@ const daffDataPathUrlMatcher = (segments, group, route) => {
280
293
  * Generated bundle index. Do not edit.
281
294
  */
282
295
 
283
- export { DAFF_EXTERNAL_ROUTER_CONFIG, DaffExternalRouter, DaffExternalRouterModule, DaffExternalRouterNoWildcardError, DaffExternalRouterUnknownRouteTypeError, daffDataPathUrlMatcher, daffInsertDataPathStrategy, daffInsertRouteBeforeWildCardStrategy, daffProvideRouteResolvableByType };
296
+ export { DAFF_EXTERNAL_ROUTER_CONFIG, DaffExternalRouter, DaffExternalRouterModule, DaffExternalRouterNoWildcardError, DaffExternalRouterUnknownRouteTypeError, daffDataPathUrlMatcher, daffExtractDaffPathData, daffInsertDataPathStrategy, daffInsertRouteBeforeWildCardStrategy, daffProvideRouteResolvableByType };
284
297
  //# 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,UAA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AC;;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,CAAA,EAAA,GAAA,KAAK,KAAL,IAAA,IAAA,KAAK,KAAL,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,KAAK,CAAE,IAAI,MAAE,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,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,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;gBACT,EAAE,OAAO,EAAE,2BAA2B,EAAE,Q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AG,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClH,IAAA,OAAO,MAAA,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,QAAQ,CAAC,IAAI,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAE,SAAS,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAG,YAAY,CAAC,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAG,GAAG,CAAC,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAI,IAAI,CAAC;AACjE;;ACZA;;AAEG;;ACFH;;AAEG;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"daffodil-external-router-driver-in-memory.mjs","sources":["../../../libs/external-router/driver/in-memory/src/config.ts","../../../libs/external-router/driver/in-memory/src/in-memory.service.ts","../../../libs/external-router/driver/in-memory/src/in-memory.module.ts","../../../libs/external-router/driver/in-memory/src/public_api.ts","../../../libs/external-router/driver/in-memory/src/daffodil-external-router-driver-in-memory.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nimport { DaffExternallyResolvableUrl } from '@daffodil/external-router';\nimport { DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION } from '@daffodil/external-router/driver';\n\n/**\n * A lookup for a URL.\n * Returns an {@link DaffExternallyResolvableUrl} or\n * {@link DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION} if the URL cannot be resolved\n */\nexport type DaffExternalRouterDriverInMemoryResolver = (url: string) => DaffExternallyResolvableUrl;\n\n/**\n * The configuration for the in-memory driver.\n */\nexport interface DaffExternalRouterDriverInMemoryConfig {\n\tresolver: DaffExternalRouterDriverInMemoryResolver;\n}\n\nconst defaultConfig: DaffExternalRouterDriverInMemoryConfig = {\n resolver: () => DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION,\n};\n\n/**\n * The token used by Daffodil to hold the driver's configuration.\n *\n * @docs-private\n */\nexport const DAFF_EXTERNAL_ROUTER_DRIVER_IN_MEMORY_CONFIG = new InjectionToken<\n\tDaffExternalRouterDriverInMemoryConfig\n>('DAFF_EXTERNAL_ROUTER_DRIVER_IN_MEMORY_CONFIG', {\n providedIn: 'root',\n factory: () => defaultConfig,\n});\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n Observable,\n of,\n} from 'rxjs';\n\nimport {\n daffUriTruncateLeadingSlash,\n daffUriTruncateQueryFragment,\n} from '@daffodil/core/routing';\nimport { DaffExternallyResolvableUrl } from '@daffodil/external-router';\nimport {\n DaffExternalRouterDriverInterface,\n DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION,\n} from '@daffodil/external-router/driver';\n\nimport {\n DaffExternalRouterDriverInMemoryConfig,\n DAFF_EXTERNAL_ROUTER_DRIVER_IN_MEMORY_CONFIG,\n} from './config';\n\n/**\n * The DaffExternalRouterInMemoryDriver is responsible for resolving\n * a URL using the resolver in the provided configuration.\n *\n * @inheritdoc\n *\n * @see {@link DaffExternalRouterInMemoryDriver}\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffExternalRouterInMemoryDriver\nimplements DaffExternalRouterDriverInterface {\n constructor(\n\t\t@Inject(DAFF_EXTERNAL_ROUTER_DRIVER_IN_MEMORY_CONFIG)\n\t\tprivate configuration: DaffExternalRouterDriverInMemoryConfig,\n ) {}\n\n resolve(url: string): Observable<DaffExternallyResolvableUrl> {\n const truncatedUrl = daffUriTruncateQueryFragment(url);\n const resolvedUrl = this.configuration.resolver(truncatedUrl);\n\n return of(resolvedUrl?.url ? {\n ...resolvedUrl,\n url: daffUriTruncateLeadingSlash(resolvedUrl.url),\n } : DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION);\n }\n}\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n InjectionToken,\n inject,\n} from '@angular/core';\n\nimport { DaffExternalRouterDriver } from '@daffodil/external-router/driver';\n\nimport {\n DaffExternalRouterDriverInMemoryConfig,\n DAFF_EXTERNAL_ROUTER_DRIVER_IN_MEMORY_CONFIG,\n} from './config';\nimport { DaffExternalRouterInMemoryDriver } from './in-memory.service';\n\n/**\n * The `DaffExternalRouterDriverInMemoryModule` is an importable NgModule that can\n * be used to configure the {@link DaffExternalRouterInMemoryDriver}.\n */\n@NgModule({\n declarations: [],\n imports: [CommonModule],\n})\nexport class DaffExternalRouterDriverInMemoryModule {\n static forRoot(\n config: DaffExternalRouterDriverInMemoryConfig | InjectionToken<DaffExternalRouterDriverInMemoryConfig>,\n ): ModuleWithProviders<DaffExternalRouterDriverInMemoryModule> {\n return {\n ngModule: DaffExternalRouterDriverInMemoryModule,\n providers: [\n {\n provide: DaffExternalRouterDriver,\n useExisting: DaffExternalRouterInMemoryDriver,\n },\n {\n provide: DAFF_EXTERNAL_ROUTER_DRIVER_IN_MEMORY_CONFIG,\n // eslint-disable-next-line prefer-arrow/prefer-arrow-functions\n useFactory() {\n return config instanceof InjectionToken ? inject(config) : config;\n },\n },\n ],\n };\n }\n}\n","/*\n * Public API Surface of @daffodil/external-router/driver/in-memory\n */\n\nexport { DaffExternalRouterInMemoryDriver } from './in-memory.service';\nexport { DaffExternalRouterDriverInMemoryModule } from './in-memory.module';\n\nexport {\n DaffExternalRouterDriverInMemoryConfig,\n DaffExternalRouterDriverInMemoryResolver,\n} from './config';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAmBA,MAAM,aAAa,GAA2C;AAC5D,IAAA,QAAQ,EAAE,MAAM,yCAAyC;CAC1D,CAAC;AAEF;;;;AAIG;AACI,MAAM,4CAA4C,GAAG,IAAI,cAA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ACtBtD;;;AAGG;MAKU,sCAAsC,CAAA;IACjD,OAAO,OAAO,CACZ,MAAuG,EAAA;QAEvG,OAAO;AACL,YAAA,QAAQ,EAAE,sCAAsC;AAChD,YAAA,SAAS,EAAE;AACT,gBAAA;AACE,oBAAA,OAAO,EAAE,wBAAwB;AACjC,oBAAA,WAAW,EAAE,gCAAgC;AAC9C,iBAAA;AACD,gBAAA;AACE,oBAAA,OAAO,EAAE,4CAA4C;;oBAErD,UAAU,GAAA;AACR,wBAAA,OAAO,MAAM,YAAY,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;qBACnE;AACF,iBAAA;AACF,aAAA;SACF,CAAC;KACH;;yKApBU,sCAAsC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAAtC,sCAAA,sCAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,sCAAsC,YAFvC,YAAY,CAAA,EAAA,CAAA,CAAA;0KAEX,sCAAsC,EAAA,OAAA,EAAA,CAFxC,CAAC,YAAY,CAAC,CAAA,EAAA,CAAA,CAAA;2FAEZ,sCAAsC,EAAA,UAAA,EAAA,CAAA;kBAJlD,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,EAAE;oBAChB,OAAO,EAAE,CAAC,YAAY,CAAC;AACxB,iBAAA,CAAA;;;ACvBD;;AAEG;;ACFH;;AAEG;;;;"}
1
+ {"version":3,"file":"daffodil-external-router-driver-in-memory.mjs","sources":["../../../libs/external-router/driver/in-memory/src/config.ts","../../../libs/external-router/driver/in-memory/src/in-memory.service.ts","../../../libs/external-router/driver/in-memory/src/in-memory.module.ts","../../../libs/external-router/driver/in-memory/src/public_api.ts","../../../libs/external-router/driver/in-memory/src/daffodil-external-router-driver-in-memory.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nimport { DaffExternallyResolvableUrl } from '@daffodil/external-router';\nimport { DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION } from '@daffodil/external-router/driver';\n\n/**\n * A lookup for a URL.\n * Returns an {@link DaffExternallyResolvableUrl} or\n * {@link DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION} if the URL cannot be resolved\n */\nexport type DaffExternalRouterDriverInMemoryResolver = (url: string) => DaffExternallyResolvableUrl;\n\n/**\n * The configuration for the in-memory driver.\n */\nexport interface DaffExternalRouterDriverInMemoryConfig {\n resolver: DaffExternalRouterDriverInMemoryResolver;\n}\n\nconst defaultConfig: DaffExternalRouterDriverInMemoryConfig = {\n resolver: () => DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION,\n};\n\n/**\n * The token used by Daffodil to hold the driver's configuration.\n *\n * @docs-private\n */\nexport const DAFF_EXTERNAL_ROUTER_DRIVER_IN_MEMORY_CONFIG = new InjectionToken<\nDaffExternalRouterDriverInMemoryConfig\n>('DAFF_EXTERNAL_ROUTER_DRIVER_IN_MEMORY_CONFIG', {\n providedIn: 'root',\n factory: () => defaultConfig,\n});\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n Observable,\n of,\n} from 'rxjs';\n\nimport {\n daffUriTruncateLeadingSlash,\n daffUriTruncateQueryFragment,\n} from '@daffodil/core/routing';\nimport { DaffExternallyResolvableUrl } from '@daffodil/external-router';\nimport {\n DaffExternalRouterDriverInterface,\n DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION,\n} from '@daffodil/external-router/driver';\n\nimport {\n DaffExternalRouterDriverInMemoryConfig,\n DAFF_EXTERNAL_ROUTER_DRIVER_IN_MEMORY_CONFIG,\n} from './config';\n\n/**\n * The DaffExternalRouterInMemoryDriver is responsible for resolving\n * a URL using the resolver in the provided configuration.\n *\n * @inheritdoc\n *\n * @see {@link DaffExternalRouterInMemoryDriver}\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffExternalRouterInMemoryDriver\nimplements DaffExternalRouterDriverInterface {\n constructor(\n @Inject(DAFF_EXTERNAL_ROUTER_DRIVER_IN_MEMORY_CONFIG)\n private configuration: DaffExternalRouterDriverInMemoryConfig,\n ) {}\n\n resolve(url: string): Observable<DaffExternallyResolvableUrl> {\n const truncatedUrl = daffUriTruncateQueryFragment(url);\n const resolvedUrl = this.configuration.resolver(truncatedUrl);\n\n return of(resolvedUrl?.url ? {\n ...resolvedUrl,\n url: daffUriTruncateLeadingSlash(resolvedUrl.url),\n } : DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION);\n }\n}\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n InjectionToken,\n inject,\n} from '@angular/core';\n\nimport { DaffExternalRouterDriver } from '@daffodil/external-router/driver';\n\nimport {\n DaffExternalRouterDriverInMemoryConfig,\n DAFF_EXTERNAL_ROUTER_DRIVER_IN_MEMORY_CONFIG,\n} from './config';\nimport { DaffExternalRouterInMemoryDriver } from './in-memory.service';\n\n/**\n * The `DaffExternalRouterDriverInMemoryModule` is an importable NgModule that can\n * be used to configure the {@link DaffExternalRouterInMemoryDriver}.\n */\n@NgModule({\n declarations: [],\n imports: [CommonModule],\n})\nexport class DaffExternalRouterDriverInMemoryModule {\n static forRoot(\n config: DaffExternalRouterDriverInMemoryConfig | InjectionToken<DaffExternalRouterDriverInMemoryConfig>,\n ): ModuleWithProviders<DaffExternalRouterDriverInMemoryModule> {\n return {\n ngModule: DaffExternalRouterDriverInMemoryModule,\n providers: [\n {\n provide: DaffExternalRouterDriver,\n useExisting: DaffExternalRouterInMemoryDriver,\n },\n {\n provide: DAFF_EXTERNAL_ROUTER_DRIVER_IN_MEMORY_CONFIG,\n // eslint-disable-next-line prefer-arrow/prefer-arrow-functions\n useFactory() {\n return config instanceof InjectionToken ? inject(config) : config;\n },\n },\n ],\n };\n }\n}\n","/*\n * Public API Surface of @daffodil/external-router/driver/in-memory\n */\n\nexport { DaffExternalRouterInMemoryDriver } from './in-memory.service';\nexport { DaffExternalRouterDriverInMemoryModule } from './in-memory.module';\n\nexport {\n DaffExternalRouterDriverInMemoryConfig,\n DaffExternalRouterDriverInMemoryResolver,\n} from './config';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAmBA,MAAM,aAAa,GAA2C;AAC5D,IAAA,QAAQ,EAAE,MAAM,yCAAyC;CAC1D,CAAC;AAEF;;;;AAIG;AACI,MAAM,4CAA4C,GAAG,IAAI,cAAc,CAE5E,8CAA8C,EAAE;AAChD,IAAA,UAAU,EAAE,MAAM;AAClB,IAAA,OAAO,EAAE,MAAM,aAAa;AAC7B,CAAA,CAAC;;ACTF;;;;;;;AAOG;MAIU,gCAAgC,CAAA;AAE3C,IAAA,WAAA,CAEU,aAAqD,EAAA;QAArD,IAAa,CAAA,aAAA,GAAb,aAAa,CAAwC;KAC3D;AAEJ,IAAA,OAAO,CAAC,GAAW,EAAA;AACjB,QAAA,MAAM,YAAY,GAAG,4BAA4B,CAAC,GAAG,CAAC,CAAC;QACvD,MAAM,WAAW,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;AAE9D,QAAA,OAAO,EAAE,CAAC,WAAW,EAAE,GAAG,GAAG;AAC3B,YAAA,GAAG,WAAW;AACd,YAAA,GAAG,EAAE,2BAA2B,CAAC,WAAW,CAAC,GAAG,CAAC;AAClD,SAAA,GAAG,yCAAyC,CAAC,CAAC;KAChD;;AAfU,sCAAA,gCAAA,CAAA,IAAA,GAAA,EAAA,CAAA,kBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gCAAgC,kBAGjC,4CAA4C,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,e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sCAAsC,EAAA,UAAA,EAAA,CAAA;kBAJlD,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,EAAE;oBAChB,OAAO,EAAE,CAAC,YAAY,CAAC;AACxB,iBAAA,CAAA;;;ACvBD;;AAEG;;ACFH;;AAEG;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"daffodil-external-router-driver-magento-2.4.1.mjs","sources":["../../../libs/external-router/driver/magento/2.4.1/src/graphql/queries/resolve-url-v2.4.1.ts","../../../libs/external-router/driver/magento/2.4.1/src/transforms/resolution-to-resolvable-url.ts","../../../libs/external-router/driver/magento/2.4.1/src/magento.service.ts","../../../libs/external-router/driver/magento/2.4.1/src/magento.module.ts","../../../libs/external-router/driver/magento/2.4.1/src/public_api.ts","../../../libs/external-router/driver/magento/2.4.1/src/daffodil-external-router-driver-magento-2.4.1.ts"],"sourcesContent":["import { gql } from 'apollo-angular';\n\nexport const DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME = 'MagentoResolveUrlv241';\n\n/**\n * This query retrieves a URL resolution from Magento and informs you about\n * what type of route the URL is.\n */\nexport const MagentoResolveUrlv241 = gql`\n\tquery ${DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME}($url: String!) {\n\t\turlResolver(url: $url) {\n\t\t\tid\n\t\t\trelative_url\n\t\t\tredirectCode\n\t\t\ttype\n\t\t}\n\t}\n`;\n","import {\n daffUriTruncateLeadingSlash,\n daffUriTruncateQueryFragment,\n} from '@daffodil/core/routing';\nimport { DaffExternallyResolvableUrl } from '@daffodil/external-router';\nimport { DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION } from '@daffodil/external-router/driver';\nimport {\n MagentoUrlResolver,\n magentoTransformRedirectToHttpCode,\n} from '@daffodil/external-router/driver/magento';\n\nexport const transformResolutionToResolvableUrlv241 = (\n resolution: MagentoUrlResolver,\n): DaffExternallyResolvableUrl => (resolution ? {\n id: resolution.id?.toString(),\n url: daffUriTruncateLeadingSlash(daffUriTruncateQueryFragment(resolution.relative_url)),\n type: resolution.type,\n code: magentoTransformRedirectToHttpCode(resolution.redirectCode),\n} : DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION);\n\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport { Apollo } from 'apollo-angular';\nimport { Observable } from 'rxjs';\nimport { map } from 'rxjs/operators';\n\nimport { daffUriTruncateQueryFragment } from '@daffodil/core/routing';\nimport { DaffExternallyResolvableUrl } from '@daffodil/external-router';\nimport { DaffExternalRouterDriverInterface } from '@daffodil/external-router/driver';\nimport { MagentoUrlResolverResponse } from '@daffodil/external-router/driver/magento';\n\nimport { MagentoResolveUrlv241 } from './graphql/queries/resolve-url-v2.4.1';\nimport { transformResolutionToResolvableUrlv241 } from './transforms/resolution-to-resolvable-url';\n\n/**\n * The DaffExternalRouterMagentoDriver is responsible for translating an\n * arbitrary URI into a DaffExternallyResolvableUrl with Magento environments.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffExternalRouterMagentoDriver\nimplements DaffExternalRouterDriverInterface {\n constructor(private apollo: Apollo) {}\n\n resolve(url: string): Observable<DaffExternallyResolvableUrl> {\n return this.apollo\n .query<MagentoUrlResolverResponse>({\n query: MagentoResolveUrlv241,\n variables: {\n url: daffUriTruncateQueryFragment(url),\n },\n })\n .pipe(map(response => transformResolutionToResolvableUrlv241(response.data.urlResolver)));\n }\n}\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport { DAFF_MAGENTO_CACHEABLE_OPERATIONS } from '@daffodil/driver/magento';\nimport { DaffExternalRouterDriver } from '@daffodil/external-router/driver';\n\nimport { DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME } from './graphql/queries/resolve-url-v2.4.1';\nimport { DaffExternalRouterMagentoDriver } from './magento.service';\n/**\n * The module used to configure the {@link DaffExternalRouterDriver} for usage with Magento.\n *\n * ```ts\n * @NgModule({\n * declarations: [],\n * imports: [\n * ...\n * DaffExternalRouterDriverMagentoModule.forRoot()\n * ],\n * })\n * export class AppModule{}\n * ```\n *\n * Note that this package depends upon ApolloClient, as the Magento driver uses GraphQl to make it's API calls.\n */\n@NgModule({\n declarations: [],\n imports: [CommonModule],\n})\nexport class DaffExternalRouterDriverMagentoModule {\n\n /**\n * Configures the package for the root injector.\n */\n static forRoot(): ModuleWithProviders<DaffExternalRouterDriverMagentoModule> {\n return {\n ngModule: DaffExternalRouterDriverMagentoModule,\n providers: [\n {\n provide: DaffExternalRouterDriver,\n useExisting: DaffExternalRouterMagentoDriver,\n },\n {\n provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS,\n useValue: DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME,\n multi: true,\n },\n ],\n };\n }\n}\n","/*\n * Public API Surface of @daffodil/external-router/driver/magento/2.4.1\n */\n\nexport { DaffExternalRouterMagentoDriver } from './magento.service';\nexport { DaffExternalRouterDriverMagentoModule } from './magento.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;AAEO,MAAM,mCAAmC,GAAG,uBAAuB,CAAC;AAE3E;;;AAGG;AACI,MAAM,qBAAqB,GAAG,GAAG,CAAA,CAAA;SAC/B,mCAAmC,CAAA;;;;;;;;CAQ3C;;ACNM,MAAM,sCAAsC,GAAG,CACpD,UAA8B,MACG,UAAU,GAAG;AAC9C,IAAA,EAAE,EAAE,UAAU,CAAC,EAAE,EAAE,QAAQ,EAAE;IAC7B,GAAG,EAAE,2BAA2B,CAAC,4BAA4B,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;IACvF,IAAI,EAAE,UAAU,CAAC,IAAI;AACrB,IAAA,IAAI,EAAE,kCAAkC,CAAC,UAAU,CAAC,YAAY,CAAC;AAClE,CAAA,GAAG,yCAAyC,CAAC;;ACF9C;;;;;AAKG;MAIU,+BAA+B,CAAA;AAE1C,IAAA,WAAA,CAAoB,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AC7C,oBAAA,KAAK,EAAE,IAAI;AACZ,iBAAA;AACF,aAAA;SACF,CAAC;KACH;;wKApBU,qCAAqC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAArC,sCAAA,qCAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,qCAAqC,YAFtC,YAAY,CAAA,EAAA,CAAA,CAAA;yKAEX,qCAAqC,EAAA,OAAA,EAAA,CAFvC,CAAC,YAAY,CAAC,CAAA,EAAA,CAAA,CAAA;2FAEZ,qCAAqC,EAAA,UAAA,EAAA,CAAA;kBAJjD,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,EAAE;oBAChB,OAAO,EAAE,CAAC,YAAY,CAAC;AACxB,iBAAA,CAAA;;;AC9BD;;AAEG;;ACFH;;AAEG;;;;"}
1
+ {"version":3,"file":"daffodil-external-router-driver-magento-2.4.1.mjs","sources":["../../../libs/external-router/driver/magento/2.4.1/src/graphql/queries/resolve-url-v2.4.1.ts","../../../libs/external-router/driver/magento/2.4.1/src/transforms/resolution-to-resolvable-url.ts","../../../libs/external-router/driver/magento/2.4.1/src/magento.service.ts","../../../libs/external-router/driver/magento/2.4.1/src/magento.module.ts","../../../libs/external-router/driver/magento/2.4.1/src/public_api.ts","../../../libs/external-router/driver/magento/2.4.1/src/daffodil-external-router-driver-magento-2.4.1.ts"],"sourcesContent":["import { gql } from 'apollo-angular';\n\nexport const DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME = 'MagentoResolveUrlv241';\n\n/**\n * This query retrieves a URL resolution from Magento and informs you about\n * what type of route the URL is.\n */\nexport const MagentoResolveUrlv241 = gql`\n\tquery ${DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME}($url: String!) {\n\t\turlResolver(url: $url) {\n\t\t\tid\n\t\t\trelative_url\n\t\t\tredirectCode\n\t\t\ttype\n\t\t}\n\t}\n`;\n","import {\n daffUriTruncateLeadingSlash,\n daffUriTruncateQueryFragment,\n} from '@daffodil/core/routing';\nimport { DaffExternallyResolvableUrl } from '@daffodil/external-router';\nimport { DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION } from '@daffodil/external-router/driver';\nimport {\n MagentoUrlResolver,\n magentoTransformRedirectToHttpCode,\n} from '@daffodil/external-router/driver/magento';\n\nexport const transformResolutionToResolvableUrlv241 = (\n resolution: MagentoUrlResolver,\n): DaffExternallyResolvableUrl => (resolution ? {\n id: resolution.id?.toString(),\n url: daffUriTruncateLeadingSlash(daffUriTruncateQueryFragment(resolution.relative_url)),\n type: resolution.type,\n code: magentoTransformRedirectToHttpCode(resolution.redirectCode),\n} : DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION);\n\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport { Apollo } from 'apollo-angular';\nimport { Observable } from 'rxjs';\nimport { map } from 'rxjs/operators';\n\nimport { daffUriTruncateQueryFragment } from '@daffodil/core/routing';\nimport { DaffExternallyResolvableUrl } from '@daffodil/external-router';\nimport { DaffExternalRouterDriverInterface } from '@daffodil/external-router/driver';\nimport { MagentoUrlResolverResponse } from '@daffodil/external-router/driver/magento';\n\nimport { MagentoResolveUrlv241 } from './graphql/queries/resolve-url-v2.4.1';\nimport { transformResolutionToResolvableUrlv241 } from './transforms/resolution-to-resolvable-url';\n\n/**\n * The DaffExternalRouterMagentoDriver is responsible for translating an\n * arbitrary URI into a DaffExternallyResolvableUrl with Magento environments.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffExternalRouterMagentoDriver\nimplements DaffExternalRouterDriverInterface {\n constructor(private apollo: Apollo) {}\n\n resolve(url: string): Observable<DaffExternallyResolvableUrl> {\n return this.apollo\n .query<MagentoUrlResolverResponse>({\n query: MagentoResolveUrlv241,\n variables: {\n url: daffUriTruncateQueryFragment(url),\n },\n })\n .pipe(map(response => transformResolutionToResolvableUrlv241(response.data.urlResolver)));\n }\n}\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport { DAFF_MAGENTO_CACHEABLE_OPERATIONS } from '@daffodil/driver/magento';\nimport { DaffExternalRouterDriver } from '@daffodil/external-router/driver';\n\nimport { DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME } from './graphql/queries/resolve-url-v2.4.1';\nimport { DaffExternalRouterMagentoDriver } from './magento.service';\n/**\n * The module used to configure the {@link DaffExternalRouterDriver} for usage with Magento.\n *\n * ```ts\n * @NgModule({\n * declarations: [],\n * imports: [\n * ...\n * DaffExternalRouterDriverMagentoModule.forRoot()\n * ],\n * })\n * export class AppModule{}\n * ```\n *\n * Note that this package depends upon ApolloClient, as the Magento driver uses GraphQl to make it's API calls.\n */\n@NgModule({\n declarations: [],\n imports: [CommonModule],\n})\nexport class DaffExternalRouterDriverMagentoModule {\n\n /**\n * Configures the package for the root injector.\n */\n static forRoot(): ModuleWithProviders<DaffExternalRouterDriverMagentoModule> {\n return {\n ngModule: DaffExternalRouterDriverMagentoModule,\n providers: [\n {\n provide: DaffExternalRouterDriver,\n useExisting: DaffExternalRouterMagentoDriver,\n },\n {\n provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS,\n useValue: DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME,\n multi: true,\n },\n ],\n };\n }\n}\n","/*\n * Public API Surface of @daffodil/external-router/driver/magento/2.4.1\n */\n\nexport { DaffExternalRouterMagentoDriver } from './magento.service';\nexport { DaffExternalRouterDriverMagentoModule } from './magento.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;AAEO,MAAM,mCAAmC,GAAG,uBAAuB,CAAC;AAE3E;;;AAGG;AACI,MAAM,qBAAqB,GA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olve-url-v2.4.2.ts","../../../libs/external-router/driver/magento/2.4.2/src/transforms/resolution-to-resolvable-url.ts","../../../libs/external-router/driver/magento/2.4.2/src/magento.service.ts","../../../libs/external-router/driver/magento/2.4.2/src/magento.module.ts","../../../libs/external-router/driver/magento/2.4.2/src/public_api.ts","../../../libs/external-router/driver/magento/2.4.2/src/daffodil-external-router-driver-magento-2.4.2.ts"],"sourcesContent":["import { gql } from 'apollo-angular';\n\nexport const DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME = 'MagentoResolveUrlv242';\n\n/**\n * This query retrieves a URL resolution from Magento and informs you about\n * what type of route the URL is.\n */\nexport const MagentoResolveUrlv242 = gql`\n\tquery ${DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME}($url: String!) {\n\t\turlResolver(url: $url) {\n\t\t\tentity_uid\n\t\t\trelative_url\n\t\t\tredirectCode\n\t\t\ttype\n\t\t}\n\t}\n`;\n","import {\n daffUriTruncateLeadingSlash,\n daffUriTruncateQueryFragment,\n} from '@daffodil/core/routing';\nimport { DaffExternallyResolvableUrl } from '@daffodil/external-router';\nimport { DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION } from '@daffodil/external-router/driver';\nimport {\n MagentoUrlResolver,\n magentoTransformRedirectToHttpCode,\n} from '@daffodil/external-router/driver/magento';\n\n\nexport const transformResolutionToResolvableUrlv242 = (\n resolution: MagentoUrlResolver,\n): DaffExternallyResolvableUrl => (resolution ? {\n id: resolution.entity_uid,\n url: daffUriTruncateLeadingSlash(daffUriTruncateQueryFragment(resolution.relative_url)),\n type: resolution.type,\n code: magentoTransformRedirectToHttpCode(resolution.redirectCode),\n} : DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION);\n","import { Injectable } from '@angular/core';\nimport { Apollo } from 'apollo-angular';\nimport { Observable } from 'rxjs';\nimport { map } from 'rxjs/operators';\n\n\nimport { DaffExternallyResolvableUrl } from '@daffodil/external-router';\nimport { DaffExternalRouterDriverInterface } from '@daffodil/external-router/driver';\nimport { MagentoUrlResolverResponse } from '@daffodil/external-router/driver/magento';\n\nimport { MagentoResolveUrlv242 } from './graphql/queries/resolve-url-v2.4.2';\nimport { transformResolutionToResolvableUrlv242 } from './transforms/resolution-to-resolvable-url';\n\n\n/**\n * The DaffExternalRouterMagentoDriver is responsible for translating an\n * arbitrary URI into a DaffExternallyResolvableUrl with Magento environments.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffExternalRouterMagentoDriver\nimplements DaffExternalRouterDriverInterface {\n constructor(\n\t\tprivate apollo: Apollo,\n ) {}\n\n resolve(url: string): Observable<DaffExternallyResolvableUrl> {\n return this.apollo\n .query<MagentoUrlResolverResponse>({\n query: MagentoResolveUrlv242,\n variables: {\n url,\n },\n })\n .pipe(map(response => transformResolutionToResolvableUrlv242(response.data.urlResolver)));\n }\n}\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport { DAFF_MAGENTO_CACHEABLE_OPERATIONS } from '@daffodil/driver/magento';\nimport { DaffExternalRouterDriver } from '@daffodil/external-router/driver';\n\nimport { DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME } from './graphql/queries/resolve-url-v2.4.2';\nimport { DaffExternalRouterMagentoDriver } from './magento.service';\n\n/**\n * The module used to configure the {@link DaffExternalRouterDriver} for usage with Magento.\n *\n * ```ts\n * @NgModule({\n * declarations: [],\n * imports: [\n * ...\n * DaffExternalRouterDriverMagentoModule.forRoot()\n * ],\n * })\n * export class AppModule{}\n * ```\n *\n * Note that this package depends upon ApolloClient, as the Magento driver uses GraphQl to make it's API calls.\n */\n@NgModule({\n declarations: [],\n imports: [CommonModule],\n})\nexport class DaffExternalRouterDriverMagentoModule {\n\n /**\n * Configures the package for the root injector.\n */\n static forRoot(): ModuleWithProviders<DaffExternalRouterDriverMagentoModule> {\n return {\n ngModule: DaffExternalRouterDriverMagentoModule,\n providers: [\n {\n provide: DaffExternalRouterDriver,\n useExisting: DaffExternalRouterMagentoDriver,\n },\n {\n provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS,\n useValue: DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME,\n multi: true,\n },\n ],\n };\n }\n}\n","/*\n * Public API Surface of @daffodil/external-router/driver/magento/2.4.2\n */\n\nexport { DaffExternalRouterMagentoDriver } from './magento.service';\nexport { DaffExternalRouterDriverMagentoModule } from './magento.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;AAEO,MAAM,mCAAmC,GAAG,uBAAuB,CAAC;AAE3E;;;AAGG;AACI,MAAM,qBAAqB,GAAG,GAAG,CAAA,CAAA;SAC/B,mCAAmC,CAAA;;;;;;;;CAQ3C;;ACLM,MAAM,sCAAsC,GAAG,CACpD,UAA8B,MACG,UAAU,GAAG;IAC9C,EAAE,EAAE,UAAU,CAAC,UAAU;IACzB,GAAG,EAAE,2BAA2B,CAAC,4BAA4B,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;IACvF,IAAI,EAAE,UAAU,CAAC,IAAI;AACrB,IAAA,IAAI,EAAE,kCAAkC,CAAC,UAAU,CAAC,YAAY,CAAC;AAClE,CAAA,GAAG,yCAAyC,CAAC;;ACL9C;;;;;AAKG;MAIU,+BAA+B,CAAA;AAE1C,IAAA,WAAA,CACQ,MAAc,EAAA;QAAd,IAAM,CAAA,MAAA,GAAN,MAAM,CAAQ;KAClB;AAEJ,IAAA,OAAO,CAAC,GAAW,EAAA;QACjB,OAAO,IAAI,CAAC,MAAM;AACf,aAAA,KAAK,CAA6B;AACjC,YAAA,KAAK,EAAE,qBAAqB;AAC5B,YAAA,SAAS,EAAE;gBACT,GAAG;AACJ,aAAA;SACF,CAAC;AACD,aAAA,IAAI,CAAC,GAAG,CAAC,QAAQ,IAAI,sCAAsC,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;KAC7F;;kKAfU,+BA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AC,YAAY,CAAC,CAAA,EAAA,CAAA,CAAA;2FAEZ,qCAAqC,EAAA,UAAA,EAAA,CAAA;kBAJjD,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,EAAE;oBAChB,OAAO,EAAE,CAAC,YAAY,CAAC;AACxB,iBAAA,CAAA;;;AC/BD;;AAEG;;ACFH;;AAEG;;;;"}
1
+ {"version":3,"file":"daffodil-external-router-driver-magento-2.4.2.mjs","sources":["../../../libs/external-router/driver/magento/2.4.2/src/graphql/queries/resolve-url-v2.4.2.ts","../../../libs/external-router/driver/magento/2.4.2/src/transforms/resolution-to-resolvable-url.ts","../../../libs/external-router/driver/magento/2.4.2/src/magento.service.ts","../../../libs/external-router/driver/magento/2.4.2/src/magento.module.ts","../../../libs/external-router/driver/magento/2.4.2/src/public_api.ts","../../../libs/external-router/driver/magento/2.4.2/src/daffodil-external-router-driver-magento-2.4.2.ts"],"sourcesContent":["import { gql } from 'apollo-angular';\n\nexport const DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME = 'MagentoResolveUrlv242';\n\n/**\n * This query retrieves a URL resolution from Magento and informs you about\n * what type of route the URL is.\n */\nexport const MagentoResolveUrlv242 = gql`\n\tquery ${DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME}($url: String!) {\n\t\turlResolver(url: $url) {\n\t\t\tentity_uid\n\t\t\trelative_url\n\t\t\tredirectCode\n\t\t\ttype\n\t\t}\n\t}\n`;\n","import {\n daffUriTruncateLeadingSlash,\n daffUriTruncateQueryFragment,\n} from '@daffodil/core/routing';\nimport { DaffExternallyResolvableUrl } from '@daffodil/external-router';\nimport { DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION } from '@daffodil/external-router/driver';\nimport {\n MagentoUrlResolver,\n magentoTransformRedirectToHttpCode,\n} from '@daffodil/external-router/driver/magento';\n\n\nexport const transformResolutionToResolvableUrlv242 = (\n resolution: MagentoUrlResolver,\n): DaffExternallyResolvableUrl => (resolution ? {\n id: resolution.entity_uid,\n url: daffUriTruncateLeadingSlash(daffUriTruncateQueryFragment(resolution.relative_url)),\n type: resolution.type,\n code: magentoTransformRedirectToHttpCode(resolution.redirectCode),\n} : DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION);\n","import { Injectable } from '@angular/core';\nimport { Apollo } from 'apollo-angular';\nimport { Observable } from 'rxjs';\nimport { map } from 'rxjs/operators';\n\n\nimport { DaffExternallyResolvableUrl } from '@daffodil/external-router';\nimport { DaffExternalRouterDriverInterface } from '@daffodil/external-router/driver';\nimport { MagentoUrlResolverResponse } from '@daffodil/external-router/driver/magento';\n\nimport { MagentoResolveUrlv242 } from './graphql/queries/resolve-url-v2.4.2';\nimport { transformResolutionToResolvableUrlv242 } from './transforms/resolution-to-resolvable-url';\n\n\n/**\n * The DaffExternalRouterMagentoDriver is responsible for translating an\n * arbitrary URI into a DaffExternallyResolvableUrl with Magento environments.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffExternalRouterMagentoDriver\nimplements DaffExternalRouterDriverInterface {\n constructor(\n private apollo: Apollo,\n ) {}\n\n resolve(url: string): Observable<DaffExternallyResolvableUrl> {\n return this.apollo\n .query<MagentoUrlResolverResponse>({\n query: MagentoResolveUrlv242,\n variables: {\n url,\n },\n })\n .pipe(map(response => transformResolutionToResolvableUrlv242(response.data.urlResolver)));\n }\n}\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport { DAFF_MAGENTO_CACHEABLE_OPERATIONS } from '@daffodil/driver/magento';\nimport { DaffExternalRouterDriver } from '@daffodil/external-router/driver';\n\nimport { DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME } from './graphql/queries/resolve-url-v2.4.2';\nimport { DaffExternalRouterMagentoDriver } from './magento.service';\n\n/**\n * The module used to configure the {@link DaffExternalRouterDriver} for usage with Magento.\n *\n * ```ts\n * @NgModule({\n * declarations: [],\n * imports: [\n * ...\n * DaffExternalRouterDriverMagentoModule.forRoot()\n * ],\n * })\n * export class AppModule{}\n * ```\n *\n * Note that this package depends upon ApolloClient, as the Magento driver uses GraphQl to make it's API calls.\n */\n@NgModule({\n declarations: [],\n imports: [CommonModule],\n})\nexport class DaffExternalRouterDriverMagentoModule {\n\n /**\n * Configures the package for the root injector.\n */\n static forRoot(): ModuleWithProviders<DaffExternalRouterDriverMagentoModule> {\n return {\n ngModule: DaffExternalRouterDriverMagentoModule,\n providers: [\n {\n provide: DaffExternalRouterDriver,\n useExisting: DaffExternalRouterMagentoDriver,\n },\n {\n provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS,\n useValue: DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME,\n multi: true,\n },\n ],\n };\n }\n}\n","/*\n * Public API Surface of @daffodil/external-router/driver/magento/2.4.2\n */\n\nexport { DaffExternalRouterMagentoDriver } from './magento.service';\nexport { DaffExternalRouterDriverMagentoModule } from './magento.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;AAEO,MAAM,mCAAmC,GAAG,uBAAuB,CAAC;AAE3E;;;AAGG;AACI,MAAM,qBAAqB,GAAG,GAAG,CAAA,CAAA;SAC/B,mCAAmC,CAAA;;;;;;;;CAQ3C;;ACLM,MAAM,sCAAsC,GAAG,CACpD,UAA8B,MACG,UAAU,GAAG;IAC9C,EAAE,EAAE,UAAU,CAAC,UAAU;IACzB,GAAG,EAAE,2BAA2B,CAAC,4BAA4B,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;IACvF,IAAI,EAAE,UAAU,CAAC,IAAI;AACrB,IAAA,IAAI,EAAE,kCAAkC,CAAC,UAAU,CAAC,YAAY,CAAC;AAClE,CAAA,GAAG,yCAAyC,CAAC;;ACL9C;;;;;AAKG;MAIU,+BAA+B,CAAA;AAE1C,IAAA,WAAA,CACU,MAAc,EAAA;QAAd,IAAM,CAAA,MAAA,GAAN,MAAM,C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EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAArC,sCAAA,qCAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,qCAAqC,YAFtC,YAAY,CAAA,EAAA,CAAA,CAAA;yKAEX,qCAAqC,EAAA,OAAA,EAAA,CAFvC,CAAC,YAAY,CAAC,CAAA,EAAA,CAAA,CAAA;2FAEZ,qCAAqC,EAAA,UAAA,EAAA,CAAA;kBAJjD,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,EAAE;oBAChB,OAAO,EAAE,CAAC,YAAY,CAAC;AACxB,iBAAA,CAAA;;;AC/BD;;AAEG;;ACFH;;AAEG;;;;"}
@@ -0,0 +1,140 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, NgModule } from '@angular/core';
3
+ import * as i1 from 'apollo-angular';
4
+ import { gql } from 'apollo-angular';
5
+ import { map } from 'rxjs/operators';
6
+ import { daffUriTruncateLeadingSlash, daffUriTruncateQueryFragment } from '@daffodil/core/routing';
7
+ import { DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION, DaffExternalRouterDriver } from '@daffodil/external-router/driver';
8
+ import { magentoTransformRedirectToHttpCode } from '@daffodil/external-router/driver/magento';
9
+ import { CommonModule } from '@angular/common';
10
+ import { DAFF_MAGENTO_CACHEABLE_OPERATIONS } from '@daffodil/driver/magento';
11
+
12
+ const DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME = 'MagentoResolveUrlv243';
13
+ /**
14
+ * This query retrieves a URL resolution from Magento and informs you about
15
+ * what type of route the URL is.
16
+ */
17
+ const MagentoResolveUrlv243 = gql `
18
+ query ${DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME}($url: String!) {
19
+ route(url: $url) {
20
+ relative_url
21
+ redirect_code
22
+ type
23
+ ... on CategoryInterface {
24
+ uid
25
+ name
26
+ meta_description
27
+ meta_title
28
+ canonical_url
29
+ }
30
+ ... on ProductInterface {
31
+ uid
32
+ name
33
+ meta_description
34
+ meta_title
35
+ canonical_url
36
+ }
37
+ }
38
+ }
39
+ `;
40
+
41
+ const transformResolutionToResolvableUrlv243 = (resolution) => (resolution ? {
42
+ id: resolution.uid,
43
+ url: daffUriTruncateLeadingSlash(daffUriTruncateQueryFragment(resolution.relative_url)),
44
+ type: resolution.type,
45
+ code: magentoTransformRedirectToHttpCode(resolution.redirect_code),
46
+ data: {
47
+ canonical_url: resolution.canonical_url,
48
+ title: resolution.meta_title ?? resolution.name ?? '',
49
+ meta_description: resolution.meta_description,
50
+ },
51
+ } : DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION);
52
+
53
+ /**
54
+ * The DaffExternalRouterMagentoDriver is responsible for translating an
55
+ * arbitrary URI into a DaffExternallyResolvableUrl with Magento environments.
56
+ *
57
+ * @inheritdoc
58
+ */
59
+ class DaffExternalRouterMagentoDriver {
60
+ constructor(apollo) {
61
+ this.apollo = apollo;
62
+ }
63
+ resolve(url) {
64
+ return this.apollo
65
+ .query({
66
+ query: MagentoResolveUrlv243,
67
+ variables: {
68
+ url,
69
+ },
70
+ })
71
+ .pipe(map(response => transformResolutionToResolvableUrlv243(response.data.route)));
72
+ }
73
+ }
74
+ /** @nocollapse */ /** @nocollapse */ DaffExternalRouterMagentoDriver.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffExternalRouterMagentoDriver, deps: [{ token: i1.Apollo }], target: i0.ɵɵFactoryTarget.Injectable });
75
+ /** @nocollapse */ /** @nocollapse */ DaffExternalRouterMagentoDriver.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffExternalRouterMagentoDriver, providedIn: 'root' });
76
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffExternalRouterMagentoDriver, decorators: [{
77
+ type: Injectable,
78
+ args: [{
79
+ providedIn: 'root',
80
+ }]
81
+ }], ctorParameters: function () { return [{ type: i1.Apollo }]; } });
82
+
83
+ /**
84
+ * The module used to configure the {@link DaffExternalRouterDriver} for usage with Magento.
85
+ *
86
+ * ```ts
87
+ * @NgModule({
88
+ * declarations: [],
89
+ * imports: [
90
+ * ...
91
+ * DaffExternalRouterDriverMagentoModule.forRoot()
92
+ * ],
93
+ * })
94
+ * export class AppModule{}
95
+ * ```
96
+ *
97
+ * Note that this package depends upon ApolloClient, as the Magento driver uses GraphQl to make it's API calls.
98
+ */
99
+ class DaffExternalRouterDriverMagentoModule {
100
+ /**
101
+ * Configures the package for the root injector.
102
+ */
103
+ static forRoot() {
104
+ return {
105
+ ngModule: DaffExternalRouterDriverMagentoModule,
106
+ providers: [
107
+ {
108
+ provide: DaffExternalRouterDriver,
109
+ useExisting: DaffExternalRouterMagentoDriver,
110
+ },
111
+ {
112
+ provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS,
113
+ useValue: DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME,
114
+ multi: true,
115
+ },
116
+ ],
117
+ };
118
+ }
119
+ }
120
+ /** @nocollapse */ /** @nocollapse */ DaffExternalRouterDriverMagentoModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffExternalRouterDriverMagentoModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
121
+ /** @nocollapse */ /** @nocollapse */ DaffExternalRouterDriverMagentoModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffExternalRouterDriverMagentoModule, imports: [CommonModule] });
122
+ /** @nocollapse */ /** @nocollapse */ DaffExternalRouterDriverMagentoModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffExternalRouterDriverMagentoModule, imports: [[CommonModule]] });
123
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffExternalRouterDriverMagentoModule, decorators: [{
124
+ type: NgModule,
125
+ args: [{
126
+ declarations: [],
127
+ imports: [CommonModule],
128
+ }]
129
+ }] });
130
+
131
+ /*
132
+ * Public API Surface of @daffodil/external-router/driver/magento/2.4.3
133
+ */
134
+
135
+ /**
136
+ * Generated bundle index. Do not edit.
137
+ */
138
+
139
+ export { DaffExternalRouterDriverMagentoModule, DaffExternalRouterMagentoDriver };
140
+ //# sourceMappingURL=daffodil-external-router-driver-magento-2.4.3.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daffodil-external-router-driver-magento-2.4.3.mjs","sources":["../../../libs/external-router/driver/magento/2.4.3/src/graphql/queries/resolve.ts","../../../libs/external-router/driver/magento/2.4.3/src/transforms/resolution-to-resolvable-url.ts","../../../libs/external-router/driver/magento/2.4.3/src/magento.service.ts","../../../libs/external-router/driver/magento/2.4.3/src/magento.module.ts","../../../libs/external-router/driver/magento/2.4.3/src/public_api.ts","../../../libs/external-router/driver/magento/2.4.3/src/daffodil-external-router-driver-magento-2.4.3.ts"],"sourcesContent":["import { gql } from 'apollo-angular';\n\nexport const DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME = 'MagentoResolveUrlv243';\n\n/**\n * This query retrieves a URL resolution from Magento and informs you about\n * what type of route the URL is.\n */\nexport const MagentoResolveUrlv243 = gql`\n\tquery ${DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME}($url: String!) {\n\t\troute(url: $url) {\n\t\t\trelative_url\n\t\t\tredirect_code\n\t\t\ttype\n\t\t\t... on CategoryInterface {\n\t\t\t\tuid\n\t\t\t\tname\n\t\t\t\tmeta_description\n\t\t\t\tmeta_title\n\t\t\t\tcanonical_url\n\t\t\t}\n\t\t\t... on ProductInterface {\n\t\t\t\tuid\n\t\t\t\tname\n\t\t\t\tmeta_description\n\t\t\t\tmeta_title\n\t\t\t\tcanonical_url\n\t\t\t}\n\t\t}\n\t}\n`;\n","import {\n daffUriTruncateLeadingSlash,\n daffUriTruncateQueryFragment,\n} from '@daffodil/core/routing';\nimport { DaffExternallyResolvableUrl } from '@daffodil/external-router';\nimport { DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION } from '@daffodil/external-router/driver';\nimport {\n magentoTransformRedirectToHttpCode,\n MagentoRoute,\n} from '@daffodil/external-router/driver/magento';\n\n\nexport const transformResolutionToResolvableUrlv243 = (\n resolution: MagentoRoute,\n): DaffExternallyResolvableUrl => (resolution ? {\n id: resolution.uid,\n url: daffUriTruncateLeadingSlash(daffUriTruncateQueryFragment(resolution.relative_url)),\n type: resolution.type,\n code: magentoTransformRedirectToHttpCode(resolution.redirect_code),\n data: {\n canonical_url: resolution.canonical_url,\n title: resolution.meta_title ?? resolution.name ?? '',\n meta_description: resolution.meta_description,\n },\n} : DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION);\n","import { Injectable } from '@angular/core';\nimport { Apollo } from 'apollo-angular';\nimport { Observable } from 'rxjs';\nimport { map } from 'rxjs/operators';\n\n\nimport { DaffExternallyResolvableUrl } from '@daffodil/external-router';\nimport { DaffExternalRouterDriverInterface } from '@daffodil/external-router/driver';\nimport { MagentoRouteResponse } from '@daffodil/external-router/driver/magento';\n\nimport { MagentoResolveUrlv243 } from './graphql/queries/resolve';\nimport { transformResolutionToResolvableUrlv243 } from './transforms/resolution-to-resolvable-url';\n\n\n/**\n * The DaffExternalRouterMagentoDriver is responsible for translating an\n * arbitrary URI into a DaffExternallyResolvableUrl with Magento environments.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffExternalRouterMagentoDriver\nimplements DaffExternalRouterDriverInterface {\n constructor(\n private apollo: Apollo,\n ) {}\n\n resolve(url: string): Observable<DaffExternallyResolvableUrl> {\n return this.apollo\n .query<MagentoRouteResponse>({\n query: MagentoResolveUrlv243,\n variables: {\n url,\n },\n })\n .pipe(map(response => transformResolutionToResolvableUrlv243(response.data.route)));\n }\n}\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport { DAFF_MAGENTO_CACHEABLE_OPERATIONS } from '@daffodil/driver/magento';\nimport { DaffExternalRouterDriver } from '@daffodil/external-router/driver';\n\nimport { DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME } from './graphql/queries/resolve';\nimport { DaffExternalRouterMagentoDriver } from './magento.service';\n\n/**\n * The module used to configure the {@link DaffExternalRouterDriver} for usage with Magento.\n *\n * ```ts\n * @NgModule({\n * declarations: [],\n * imports: [\n * ...\n * DaffExternalRouterDriverMagentoModule.forRoot()\n * ],\n * })\n * export class AppModule{}\n * ```\n *\n * Note that this package depends upon ApolloClient, as the Magento driver uses GraphQl to make it's API calls.\n */\n@NgModule({\n declarations: [],\n imports: [CommonModule],\n})\nexport class DaffExternalRouterDriverMagentoModule {\n\n /**\n * Configures the package for the root injector.\n */\n static forRoot(): ModuleWithProviders<DaffExternalRouterDriverMagentoModule> {\n return {\n ngModule: DaffExternalRouterDriverMagentoModule,\n providers: [\n {\n provide: DaffExternalRouterDriver,\n useExisting: DaffExternalRouterMagentoDriver,\n },\n {\n provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS,\n useValue: DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME,\n multi: true,\n },\n ],\n };\n }\n}\n","/*\n * Public API Surface of @daffodil/external-router/driver/magento/2.4.3\n */\n\nexport { DaffExternalRouterMagentoDriver } from './magento.service';\nexport { DaffExternalRouterDriverMagentoModule } from './magento.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;AAEO,MAAM,mCAAmC,GAAG,uBAAuB,CAAC;AAE3E;;;AAGG;AACI,MAAM,qBAAqB,GAAG,GAAG,CAA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H;;AAEG;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"daffodil-external-router-driver-magento.mjs","sources":["../../../libs/external-router/driver/magento/src/model/resolution-types.ts","../../../libs/external-router/driver/magento/src/transforms/redirect-to-http.ts","../../../libs/external-router/driver/magento/src/public_api.ts","../../../libs/external-router/driver/magento/src/daffodil-external-router-driver-magento.ts"],"sourcesContent":["export enum MagentoUrlRewriteEntityTypeEnum {\n\tPRODUCT = 'PRODUCT',\n\tCATEGORY = 'CATEGORY',\n\tCMS_PAGE = 'CMS_PAGE',\n}\n","/**\n * Transforms a Magento redirect code to the appropriate HTTP status code.\n */\nexport const magentoTransformRedirectToHttpCode = (code: number): number =>\n code === 0 ? 200 : code;\n","/*\n * Public API Surface of @daffodil/external-router/driver/magento\n */\n\nexport * from './model/public_api';\nexport * from './transforms/public_api';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"IAAY,gCAIX;AAJD,CAAA,UAAY,+BAA+B,EAAA;AAC1C,IAAA,+BAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnB,IAAA,+BAAA,CAAA,UAAA,CAAA,GAAA,UAAqB,CAAA;AACrB,IAAA,+BAAA,CAAA,UAAA,CAAA,GAAA,UAAqB,CAAA;AACtB,CAAC,EAJW,+BAA+B,KAA/B,+BAA+B,GAI1C,EAAA,CAAA,CAAA;;ACJD;;AAEG;MACU,kCAAkC,GAAG,CAAC,IAAY,KAC7D,IAAI,KAAK,CAAC,GAAG,GAAG,GAAG;;ACJrB;;AAEG;;ACFH;;AAEG;;;;"}
1
+ {"version":3,"file":"daffodil-external-router-driver-magento.mjs","sources":["../../../libs/external-router/driver/magento/src/model/resolution-types.ts","../../../libs/external-router/driver/magento/src/transforms/redirect-to-http.ts","../../../libs/external-router/driver/magento/src/public_api.ts","../../../libs/external-router/driver/magento/src/daffodil-external-router-driver-magento.ts"],"sourcesContent":["export enum MagentoUrlRewriteEntityTypeEnum {\n PRODUCT = 'PRODUCT',\n CATEGORY = 'CATEGORY',\n CMS_PAGE = 'CMS_PAGE',\n}\n","/**\n * Transforms a Magento redirect code to the appropriate HTTP status code.\n */\nexport const magentoTransformRedirectToHttpCode = (code: number): number =>\n code === 0 ? 200 : code;\n","/*\n * Public API Surface of @daffodil/external-router/driver/magento\n */\n\nexport * from './model/public_api';\nexport * from './transforms/public_api';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"IAAY,gCAIX;AAJD,CAAA,UAAY,+BAA+B,EAAA;AACzC,IAAA,+BAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnB,IAAA,+BAAA,CAAA,UAAA,CAAA,GAAA,UAAqB,CAAA;AACrB,IAAA,+BAAA,CAAA,UAAA,CAAA,GAAA,UAAqB,CAAA;AACvB,CAAC,EAJW,+BAA+B,KAA/B,+BAA+B,GAI1C,EAAA,CAAA,CAAA;;ACJD;;AAEG;MACU,kCAAkC,GAAG,CAAC,IAAY,KAC7D,IAAI,KAAK,CAAC,GAAG,GAAG,GAAG;;ACJrB;;AAEG;;ACFH;;AAEG;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"daffodil-external-router-driver-testing.mjs","sources":["../../../libs/external-router/driver/testing/src/config.ts","../../../libs/external-router/driver/testing/src/testing.service.ts","../../../libs/external-router/driver/testing/src/testing.module.ts","../../../libs/external-router/driver/testing/src/public_api.ts","../../../libs/external-router/driver/testing/src/daffodil-external-router-driver-testing.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nimport { DaffExternalRouteType } from '@daffodil/external-router';\n\n/**\n * The configuration for the testing driver. It is a dictionary of \"url\": \"type\",\n * pairs, where the URL is a URL-safe routeable path, e.g. \"sweatshirts\" or \"t-shirts\"\n * and the type is a known type to your application, e.g. \"CATEGORY\".\n */\nexport interface DaffExternalRouterDriverTestingConfig {\n\t[url: string]: DaffExternalRouteType;\n}\n\n/**\n * The token used by Daffodil to hold the driver's configuration.\n *\n * @docs-private\n */\nexport const DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG = new InjectionToken<\n\tDaffExternalRouterDriverTestingConfig\n>('DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG', {\n providedIn: 'root',\n factory: () => ({}),\n});\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport * as faker from '@faker-js/faker/locale/en_US';\nimport {\n Observable,\n of,\n throwError,\n} from 'rxjs';\n\nimport {\n daffUriTruncateLeadingSlash,\n daffUriTruncateQueryFragment,\n} from '@daffodil/core/routing';\nimport { DaffExternallyResolvableUrl } from '@daffodil/external-router';\nimport { DaffExternalRouterDriverInterface } from '@daffodil/external-router/driver';\n\nimport {\n DaffExternalRouterDriverTestingConfig,\n DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG,\n} from './config';\n\n/**\n * The DaffExternalRouterTestingDriver is responsible for translating an\n * arbitrary URI into a DaffExternallyResolvableUrl in testing environments.\n *\n * @inheritdoc\n *\n * @see {@link DaffExternalRouterTestingDriver}\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffExternalRouterTestingDriver\nimplements DaffExternalRouterDriverInterface {\n constructor(\n\t\t@Inject(DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG)\n\t\tprivate testingConfiguration: DaffExternalRouterDriverTestingConfig = {},\n ) {}\n\n resolve(url: string): Observable<DaffExternallyResolvableUrl> {\n const truncatedUrl = daffUriTruncateLeadingSlash(daffUriTruncateQueryFragment(url));\n\n if (!this.testingConfiguration[truncatedUrl]) {\n return throwError(`\\\nThe route '${truncatedUrl}' wasn't provided with a matching type by the testing driver. \\\nDid you configure the available route types with DaffExternalRouterDriverTestingModule.forRoot(config)`);\n }\n\n return of({\n id: faker.datatype.uuid(),\n url: truncatedUrl,\n type: this.testingConfiguration[truncatedUrl],\n code: 200,\n });\n }\n}\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport { DaffExternalRouterDriver } from '@daffodil/external-router/driver';\n\nimport {\n DaffExternalRouterDriverTestingConfig,\n DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG,\n} from './config';\nimport { DaffExternalRouterTestingDriver } from './testing.service';\n\n/**\n * The `DaffExternalRouterDriverTestingModule` is an importable NgModule that can\n * be used to configure the {@link DaffExternalRouterTestingDriver}.\n */\n@NgModule({\n declarations: [],\n imports: [CommonModule],\n})\nexport class DaffExternalRouterDriverTestingModule {\n static forRoot(\n config: DaffExternalRouterDriverTestingConfig,\n ): ModuleWithProviders<DaffExternalRouterDriverTestingModule> {\n return {\n ngModule: DaffExternalRouterDriverTestingModule,\n providers: [\n {\n provide: DaffExternalRouterDriver,\n useExisting: DaffExternalRouterTestingDriver,\n },\n {\n provide: DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG,\n useValue: config,\n },\n ],\n };\n }\n}\n","/*\n * Public API Surface of @daffodil/external-router/driver/testing\n */\n\nexport { DaffExternalRouterTestingDriver } from './testing.service';\nexport { DaffExternalRouterDriverTestingModule } from './testing.module';\n\nexport { DaffExternalRouterDriverTestingConfig } from './config';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAaA;;;;AAIG;AACI,MAAM,0CAA0C,GAAG,IAAI,cAAc,CAE1E,4CAA4C,EAAE;AAC9C,IAAA,UAAU,EAAE,MAAM;AAClB,IAAA,OAAO,EAAE,OAAO,EAAE,CAAC;AACpB,CAAA,CAAC;;ACAF;;;;;;;AAOG;MAIU,+BAA+B,CAAA;AAE1C,IAAA,WAAA,CAEQ,uBAA8D,EAAE,EAAA;QAAhE,IAAoB,CAAA,oBAAA,GAApB,oBAAoB,CAA4C;KACpE;AAEJ,IAAA,OAAO,CAAC,GAAW,EAAA;QACjB,MAAM,YAAY,GAAG,2BAA2B,CAAC,4BAA4B,CAAC,GAAG,CAAC,CAAC,CAAC;AAEpF,QAAA,IAAI,CA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BAA+B;AAC7C,iBAAA;AACD,gBAAA;AACE,oBAAA,OAAO,EAAE,0CAA0C;AACnD,oBAAA,QAAQ,EAAE,MAAM;AACjB,iBAAA;AACF,aAAA;SACF,CAAC;KACH;;wKAjBU,qCAAqC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAArC,sCAAA,qCAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,qCAAqC,YAFtC,YAAY,CAAA,EAAA,CAAA,CAAA;yKAEX,qCAAqC,EAAA,OAAA,EAAA,CAFvC,CAAC,YAAY,CAAC,CAAA,EAAA,CAAA,CAAA;2FAEZ,qCAAqC,EAAA,UAAA,EAAA,CAAA;kBAJjD,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,EAAE;oBAChB,OAAO,EAAE,CAAC,YAAY,CAAC;AACxB,iBAAA,CAAA;;;ACrBD;;AAEG;;ACFH;;AAEG;;;;"}
1
+ {"version":3,"file":"daffodil-external-router-driver-testing.mjs","sources":["../../../libs/external-router/driver/testing/src/config.ts","../../../libs/external-router/driver/testing/src/testing.service.ts","../../../libs/external-router/driver/testing/src/testing.module.ts","../../../libs/external-router/driver/testing/src/public_api.ts","../../../libs/external-router/driver/testing/src/daffodil-external-router-driver-testing.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nimport { DaffExternalRouteType } from '@daffodil/external-router';\n\n/**\n * The configuration for the testing driver. It is a dictionary of \"url\": \"type\",\n * pairs, where the URL is a URL-safe routeable path, e.g. \"sweatshirts\" or \"t-shirts\"\n * and the type is a known type to your application, e.g. \"CATEGORY\".\n */\nexport interface DaffExternalRouterDriverTestingConfig {\n [url: string]: DaffExternalRouteType;\n}\n\n/**\n * The token used by Daffodil to hold the driver's configuration.\n *\n * @docs-private\n */\nexport const DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG = new InjectionToken<\nDaffExternalRouterDriverTestingConfig\n>('DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG', {\n providedIn: 'root',\n factory: () => ({}),\n});\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport * as faker from '@faker-js/faker/locale/en_US';\nimport {\n Observable,\n of,\n throwError,\n} from 'rxjs';\n\nimport {\n daffUriTruncateLeadingSlash,\n daffUriTruncateQueryFragment,\n} from '@daffodil/core/routing';\nimport { DaffExternallyResolvableUrl } from '@daffodil/external-router';\nimport { DaffExternalRouterDriverInterface } from '@daffodil/external-router/driver';\n\nimport {\n DaffExternalRouterDriverTestingConfig,\n DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG,\n} from './config';\n\n/**\n * The DaffExternalRouterTestingDriver is responsible for translating an\n * arbitrary URI into a DaffExternallyResolvableUrl in testing environments.\n *\n * @inheritdoc\n *\n * @see {@link DaffExternalRouterTestingDriver}\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffExternalRouterTestingDriver\nimplements DaffExternalRouterDriverInterface {\n constructor(\n @Inject(DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG)\n private testingConfiguration: DaffExternalRouterDriverTestingConfig = {},\n ) {}\n\n resolve(url: string): Observable<DaffExternallyResolvableUrl> {\n const truncatedUrl = daffUriTruncateLeadingSlash(daffUriTruncateQueryFragment(url));\n\n if (!this.testingConfiguration[truncatedUrl]) {\n return throwError(`\\\nThe route '${truncatedUrl}' wasn't provided with a matching type by the testing driver. \\\nDid you configure the available route types with DaffExternalRouterDriverTestingModule.forRoot(config)`);\n }\n\n return of({\n id: faker.datatype.uuid(),\n url: truncatedUrl,\n type: this.testingConfiguration[truncatedUrl],\n code: 200,\n });\n }\n}\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport { DaffExternalRouterDriver } from '@daffodil/external-router/driver';\n\nimport {\n DaffExternalRouterDriverTestingConfig,\n DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG,\n} from './config';\nimport { DaffExternalRouterTestingDriver } from './testing.service';\n\n/**\n * The `DaffExternalRouterDriverTestingModule` is an importable NgModule that can\n * be used to configure the {@link DaffExternalRouterTestingDriver}.\n */\n@NgModule({\n declarations: [],\n imports: [CommonModule],\n})\nexport class DaffExternalRouterDriverTestingModule {\n static forRoot(\n config: DaffExternalRouterDriverTestingConfig,\n ): ModuleWithProviders<DaffExternalRouterDriverTestingModule> {\n return {\n ngModule: DaffExternalRouterDriverTestingModule,\n providers: [\n {\n provide: DaffExternalRouterDriver,\n useExisting: DaffExternalRouterTestingDriver,\n },\n {\n provide: DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG,\n useValue: config,\n },\n ],\n };\n }\n}\n","/*\n * Public API Surface of @daffodil/external-router/driver/testing\n */\n\nexport { DaffExternalRouterTestingDriver } from './testing.service';\nexport { DaffExternalRouterDriverTestingModule } from './testing.module';\n\nexport { DaffExternalRouterDriverTestingConfig } from './config';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAaA;;;;AAIG;AACI,MAAM,0CAA0C,GAAG,IAAI,cAAc,CAE1E,4CAA4C,EAAE;AAC9C,IAAA,UAAU,EAAE,MAAM;AAClB,IAAA,OAAO,EAAE,OAAO,EAAE,CAAC;AACpB,CAAA,CAAC;;ACAF;;;;;;;AAOG;MAIU,+BAA+B,CAAA;AAE1C,IAAA,WAAA,CAEU,uBAA8D,EAAE,EAAA;QAAhE,IAAoB,CAAA,oBAAA,GAApB,oBAAoB,CAA4C;KACtE;AAEJ,IAAA,OAAO,CAAC,GAAW,EAAA;QACjB,MAAM,YAAY,GAAG,2BAA2B,CAAC,4BAA4B,CAAC,GAAG,CAAC,CAAC,CAAC;AAEpF,QAAA,IAAI,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+BAA+B;AAC7C,iBAAA;AACD,gBAAA;AACE,oBAAA,OAAO,EAAE,0CAA0C;AACnD,oBAAA,QAAQ,EAAE,MAAM;AACjB,iBAAA;AACF,aAAA;SACF,CAAC;KACH;;wKAjBU,qCAAqC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAArC,sCAAA,qCAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,qCAAqC,YAFtC,YAAY,CAAA,EAAA,CAAA,CAAA;yKAEX,qCAAqC,EAAA,OAAA,EAAA,CAFvC,CAAC,YAAY,CAAC,CAAA,EAAA,CAAA,CAAA;2FAEZ,qCAAqC,EAAA,UAAA,EAAA,CAAA;kBAJjD,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,EAAE;oBAChB,OAAO,EAAE,CAAC,YAAY,CAAC;AACxB,iBAAA,CAAA;;;ACrBD;;AAEG;;ACFH;;AAEG;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"daffodil-external-router-driver.mjs","sources":["../../../libs/external-router/driver/src/interfaces/external-router-driver.interface.ts","../../../libs/external-router/driver/src/not-found-resolution.ts","../../../libs/external-router/driver/src/public_api.ts","../../../libs/external-router/driver/src/daffodil-external-router-driver.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport { DaffExternallyResolvableUrl } from '@daffodil/external-router';\n\n/**\n * The token for the `@daffodil/external-router` driver.\n */\nexport const DaffExternalRouterDriver = new InjectionToken<\n\tDaffExternalRouterDriverInterface\n>('DaffExternalRouterDriver');\n\n/**\n * The interface for a @daffodil/external-router driver.\n *\n * This driver is responsible for translating a URL into a Route consumable by\n * Daffodil.\n */\nexport interface DaffExternalRouterDriverInterface {\n /**\n * Resolves a URL with a platform.\n * Returns information about the type of URL.\n *\n * @param url The full URL path qualified with file extension and leading slash but without domain. i.e. /full/path/to/thing.html\n */\n\tresolve(url: string): Observable<DaffExternallyResolvableUrl>;\n}\n","import { DaffExternallyResolvableUrl } from '@daffodil/external-router';\n\n/**\n * When a driver fails to find a resolution, it should return a 404.\n * This const represents the standard \"Not Found\" resolution that a driver\n * should return. Drivers are not required to return this value, but may do so\n * if they would like.\n */\nexport const DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION: DaffExternallyResolvableUrl = {\n id: null,\n url: null,\n code: 404,\n type: null,\n};\n","/*\n * Public API Surface of @daffodil/external-router/driver\n */\n\nexport {\n DaffExternalRouterDriverInterface,\n DaffExternalRouterDriver,\n} from './interfaces/external-router-driver.interface';\nexport { DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION } from './not-found-resolution';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAKA;;AAEG;MACU,wBAAwB,GAAG,IAAI,cAAc,CAExD,0BAA0B;;ACR5B;;;;;AAKG;AACU,MAAA,yCAAyC,GAAgC;AACpF,IAAA,EAAE,EAAE,IAAI;AACR,IAAA,GAAG,EAAE,IAAI;AACT,IAAA,IAAI,EAAE,GAAG;AACT,IAAA,IAAI,EAAE,IAAI;;;ACZZ;;AAEG;;ACFH;;AAEG;;;;"}
1
+ {"version":3,"file":"daffodil-external-router-driver.mjs","sources":["../../../libs/external-router/driver/src/interfaces/external-router-driver.interface.ts","../../../libs/external-router/driver/src/not-found-resolution.ts","../../../libs/external-router/driver/src/public_api.ts","../../../libs/external-router/driver/src/daffodil-external-router-driver.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport { DaffExternallyResolvableUrl } from '@daffodil/external-router';\n\n/**\n * The token for the `@daffodil/external-router` driver.\n */\nexport const DaffExternalRouterDriver = new InjectionToken<\nDaffExternalRouterDriverInterface\n>('DaffExternalRouterDriver');\n\n/**\n * The interface for a @daffodil/external-router driver.\n *\n * This driver is responsible for translating a URL into a Route consumable by\n * Daffodil.\n */\nexport interface DaffExternalRouterDriverInterface {\n /**\n * Resolves a URL with a platform.\n * Returns information about the type of URL.\n *\n * @param url The full URL path qualified with file extension and leading slash but without domain. i.e. /full/path/to/thing.html\n */\n resolve(url: string): Observable<DaffExternallyResolvableUrl>;\n}\n","import { DaffExternallyResolvableUrl } from '@daffodil/external-router';\n\n/**\n * When a driver fails to find a resolution, it should return a 404.\n * This const represents the standard \"Not Found\" resolution that a driver\n * should return. Drivers are not required to return this value, but may do so\n * if they would like.\n */\nexport const DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION: DaffExternallyResolvableUrl = {\n id: null,\n url: null,\n code: 404,\n type: null,\n};\n","/*\n * Public API Surface of @daffodil/external-router/driver\n */\n\nexport {\n DaffExternalRouterDriverInterface,\n DaffExternalRouterDriver,\n} from './interfaces/external-router-driver.interface';\nexport { DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION } from './not-found-resolution';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAKA;;AAEG;MACU,wBAAwB,GAAG,IAAI,cAAc,CAExD,0BAA0B;;ACR5B;;;;;AAKG;AACU,MAAA,yCAAyC,GAAgC;AACpF,IAAA,EAAE,EAAE,IAAI;AACR,IAAA,GAAG,EAAE,IAAI;AACT,IAAA,IAAI,EAAE,GAAG;AACT,IAAA,IAAI,EAAE,IAAI;;;ACZZ;;AAEG;;ACFH;;AAEG;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"daffodil-external-router-routing.mjs","sources":["../../../libs/external-router/routing/src/errors/client-error.ts","../../../libs/external-router/routing/src/errors/not-found-error.ts","../../../libs/external-router/routing/src/errors/permanent-redirect.ts","../../../libs/external-router/routing/src/errors/temporary-redirect.ts","../../../libs/external-router/routing/src/errors/server-error.ts","../../../libs/external-router/routing/src/processors/process-errors.ts","../../../libs/external-router/routing/src/processors/process-redirect.ts","../../../libs/external-router/routing/src/guard/existence.guard.ts","../../../libs/external-router/routing/src/public_api.ts","../../../libs/external-router/routing/src/daffodil-external-router-routing.ts"],"sourcesContent":["import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\n/**\n * An error thrown when the driver encounters a 4xx error.\n */\nexport class DaffExternalRouterClientError extends DaffInheritableError\n implements DaffError {\n\tpublic readonly code: string = '4xx_CLIENT_ERROR';\n\n\tconstructor(message?: string) {\n\t super(message);\n\t}\n}\n","import { DaffError } from '@daffodil/core';\n\nimport { DaffExternalRouterClientError } from './client-error';\n\n/**\n * An error thrown when the driver determines that a given url is not resolvable.\n */\nexport class DaffExternalRouterNotFoundError extends DaffExternalRouterClientError\n implements DaffError {\n\tpublic readonly code: string = '404_NOT_FOUND';\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 the driver determines that the url needs to be routed somewhere\n * else permanently.\n */\nexport class DaffExternalRouterPermanentRedirectError extends DaffInheritableError\n implements DaffError {\n\tpublic readonly code: string = '302_PERMANENT_REDIRECT';\n\n\tconstructor(public redirectUrl: string, 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 the driver needs a URI to be temporarily redirected\n * to another location.\n */\nexport class DaffExternalRouterTemporaryRedirectError extends DaffInheritableError\n implements DaffError {\n\tpublic readonly code: string = 'TEMPORARY_REDIRECT';\n\n\tconstructor(public redirectUrl: string, 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 the platform performing url resolution fails.\n */\nexport class DaffExternalRouterServerError extends DaffInheritableError\n implements DaffError {\n\tpublic readonly code: string = '5xx_SERVER_ERROR';\n\n\tconstructor(message?: string) {\n\t super(message);\n\t}\n}\n","import { DaffExternallyResolvableUrl } from '@daffodil/external-router';\n\n\nimport { DaffExternalRouterClientError } from '../errors/client-error';\nimport { DaffExternalRouterNotFoundError } from '../errors/not-found-error';\nimport { DaffExternalRouterServerError } from '../errors/server-error';\n\n/**\n * Processes resolved URLs and throws the appropriate error so that External Router\n * can handle routing errors.\n */\nexport const processErrors = (url: DaffExternallyResolvableUrl): DaffExternallyResolvableUrl => {\n if(url.code === 404 ){\n throw new DaffExternalRouterNotFoundError();\n } else if(url.code >= 400 && url.code < 500) {\n throw new DaffExternalRouterClientError();\n } else if(url.code >= 500) {\n throw new DaffExternalRouterServerError();\n } else {\n return url;\n }\n};\n","import { DaffExternallyResolvableUrl } from '@daffodil/external-router';\n\nimport { DaffExternalRouterPermanentRedirectError } from '../errors/permanent-redirect';\nimport { DaffExternalRouterTemporaryRedirectError } from '../errors/temporary-redirect';\n\n/**\n * Processes resolvedUrls and throws the appropriate error so that External Router\n * can handle redirects.\n */\nexport const processRedirects = (url: DaffExternallyResolvableUrl): DaffExternallyResolvableUrl => {\n if(url.code === 301){\n throw new DaffExternalRouterPermanentRedirectError(url.url);\n } else if(url.code === 302) {\n throw new DaffExternalRouterTemporaryRedirectError(url.url);\n } else {\n return url;\n }\n};\n","import { isPlatformServer } from '@angular/common';\nimport {\n Injectable,\n Inject,\n PLATFORM_ID,\n} from '@angular/core';\nimport {\n CanActivate,\n ActivatedRouteSnapshot,\n Router,\n RouterStateSnapshot,\n UrlTree,\n} from '@angular/router';\nimport {\n Observable,\n of,\n} from 'rxjs';\nimport {\n catchError,\n map,\n switchMap,\n} from 'rxjs/operators';\n\nimport { DaffRoutingUriNormalizer } from '@daffodil/core/routing';\nimport {\n DaffExternalRouter,\n DaffExternalRouterConfiguration,\n DAFF_EXTERNAL_ROUTER_CONFIG,\n DaffExternallyResolvableUrl,\n} from '@daffodil/external-router';\nimport {\n DaffExternalRouterDriverInterface,\n DaffExternalRouterDriver,\n} from '@daffodil/external-router/driver';\n\nimport { DaffExternalRouterNotFoundError } from '../errors/not-found-error';\nimport { DaffExternalRouterPermanentRedirectError } from '../errors/permanent-redirect';\nimport { DaffExternalRouterTemporaryRedirectError } from '../errors/temporary-redirect';\nimport { processErrors } from '../processors/process-errors';\nimport { processRedirects } from '../processors/process-redirect';\n\n/**\n * The DaffExternalRouterExistenceGuard is responsible for guarding the wildcard route\n * of an Angular App and either navigating to a resolved route upon successful resolution\n * or navigating to the configured route upon a failed resolution.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffExternalRouterExistenceGuard implements CanActivate {\n constructor(\n @Inject(DaffExternalRouterDriver)\n private driver: DaffExternalRouterDriverInterface,\n private externalRouter: DaffExternalRouter,\n private router: Router,\n @Inject(DAFF_EXTERNAL_ROUTER_CONFIG)\n private config: DaffExternalRouterConfiguration,\n private urlNormalizer: DaffRoutingUriNormalizer,\n ) { }\n\n canActivate(\n next: ActivatedRouteSnapshot,\n state: RouterStateSnapshot,\n ): Observable<UrlTree | boolean> {\n return this.driver.resolve(this.urlNormalizer.normalize(state.url)).pipe(\n map((resolvedRoute: DaffExternallyResolvableUrl) => processErrors(resolvedRoute)),\n switchMap(resolvedRoute => {\n this.externalRouter.add(resolvedRoute);\n return of(resolvedRoute);\n }),\n map((resolvedRoute: DaffExternallyResolvableUrl) => processRedirects(resolvedRoute)),\n // Note that we have to use state.url as we want to ensure that we keep any fragments or query strings.\n // When we succeed, redirect to the new route, as config has changed since we init'd.\n map(() => this.router.parseUrl(state.url)),\n // When we fail, we need to process errors as dictated by the error type.\n // Handle redirects\n catchError(error => {\n if (\n !(error instanceof DaffExternalRouterPermanentRedirectError) &&\n !(error instanceof DaffExternalRouterTemporaryRedirectError)) {\n throw error;\n }\n\n return of(this.router.parseUrl(error.redirectUrl));\n }),\n // Handle \"404\"\n catchError((error) => {\n if (!(error instanceof DaffExternalRouterNotFoundError)) {\n throw error;\n }\n\n return of(this.router.parseUrl(this.config.notFoundResolutionPath));\n }),\n\n //Otherwise something went horribly wrong and we need to bail out.\n catchError((error) => {\n //TODO(damienwebdev): Add a logging system.\n //This log is intentional until we have a better logging system in place.\n console.log(error);\n return of(this.router.parseUrl(this.config.failedResolutionPath));\n }),\n );\n }\n}\n","/*\n * Public API Surface of @daffodil/external-router/routing\n */\nexport { DaffExternalRouterExistenceGuard } from './guard/existence.guard';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;AAKA;;AAEG;AACG,MAAO,6BAA8B,SAAQ,oBAAoB,CAAA;AAItE,IAAA,WAAA,CAAY,OAAgB,EAAA;QAC1B,KAAK,CAAC,OAAO,CAAC,CAAC;QAHD,IAAI,CAAA,IAAA,GAAW,kBAAkB,CAAC;KAIjD;AACD;;ACXD;;AAEG;AACG,MAAO,+BAAgC,SAAQ,6BAA6B,CAAA;AAIjF,IAAA,WAAA,CAAY,OAAgB,EAAA;QAC1B,KAAK,CAAC,OAAO,CAAC,CAAC;QAHD,IAAI,CAAA,IAAA,GAAW,eAAe,CAAC;KAI9C;AACD;;ACTD;;;AAGG;AACG,MAAO,wCAAyC,SAAQ,oBAAoB,CAAA;IAIjF,WAAmB,CAAA,WAAmB,EAAE,OAAgB,EAAA;QACtD,KAAK,CAAC,OAAO,CAAC,CAAC;QADE,IAAW,CAAA,WAAA,GAAX,WAAW,CAAQ;QAFtB,IAAI,CAAA,IAAA,GAAW,wBAAwB,CAAC;KAIvD;AACD;;ACXD;;;AAGG;AACG,MAAO,wCAAyC,SAAQ,oBAAoB,CAAA;IAIjF,WAAmB,CAAA,WAAmB,EAAE,OAAgB,EAAA;QACtD,KAAK,CAAC,OAAO,CAAC,CAAC;QADE,IAAW,CAAA,WAAA,GAAX,WAAW,CAAQ;QAFtB,IAAI,CAAA,IAAA,GAAW,oBAAoB,CAAC;KAInD;AACD;;ACXD;;AAEG;AACG,MAAO,6BAA8B,SAAQ,oBAAoB,CAAA;AAItE,IAAA,WAAA,CAAY,OAAgB,EAAA;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C;;AAGF,QAAA,UAAU,CAAC,CAAC,KAAK,KAAI;;;AAGnB,YAAA,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACnB,YAAA,OAAO,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC,CAAC;SACnE,CAAC,CACH,CAAC;KACH;;mKArDU,gCAAgC,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAEjC,wBAAwB,EAAA,EAAA,EAAA,KAAA,EAAA,EAAA,CAAA,kBAAA,EAAA,EAAA,EAAA,KAAA,EAAA,EAAA,CAAA,MAAA,EAAA,EAAA,EAAA,KAAA,EAIxB,2BAA2B,EAAA,EAAA,EAAA,KAAA,EAAA,EAAA,CAAA,wBAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAN1B,sCAAA,gCAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gCAAgC,cAF/B,MAAM,EAAA,CAAA,CAAA;2FAEP,gCAAgC,EAAA,UAAA,EAAA,CAAA;kBAH5C,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA,CAAA;;0BAGI,MAAM;2BAAC,wBAAwB,CAAA;;0BAI/B,MAAM;2BAAC,2BAA2B,CAAA;;;ACvDvC;;AAEG;;ACFH;;AAEG;;;;"}
1
+ {"version":3,"file":"daffodil-external-router-routing.mjs","sources":["../../../libs/external-router/routing/src/errors/client-error.ts","../../../libs/external-router/routing/src/errors/not-found-error.ts","../../../libs/external-router/routing/src/errors/permanent-redirect.ts","../../../libs/external-router/routing/src/errors/temporary-redirect.ts","../../../libs/external-router/routing/src/errors/server-error.ts","../../../libs/external-router/routing/src/processors/process-errors.ts","../../../libs/external-router/routing/src/processors/process-redirect.ts","../../../libs/external-router/routing/src/guard/existence.guard.ts","../../../libs/external-router/routing/src/public_api.ts","../../../libs/external-router/routing/src/daffodil-external-router-routing.ts"],"sourcesContent":["import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\n/**\n * An error thrown when the driver encounters a 4xx error.\n */\nexport class DaffExternalRouterClientError extends DaffInheritableError\n implements DaffError {\n public readonly code: string = '4xx_CLIENT_ERROR';\n\n constructor(message?: string) {\n\t super(message);\n }\n}\n","import { DaffError } from '@daffodil/core';\n\nimport { DaffExternalRouterClientError } from './client-error';\n\n/**\n * An error thrown when the driver determines that a given url is not resolvable.\n */\nexport class DaffExternalRouterNotFoundError extends DaffExternalRouterClientError\n implements DaffError {\n public readonly code: string = '404_NOT_FOUND';\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 the driver determines that the url needs to be routed somewhere\n * else permanently.\n */\nexport class DaffExternalRouterPermanentRedirectError extends DaffInheritableError\n implements DaffError {\n public readonly code: string = '302_PERMANENT_REDIRECT';\n\n constructor(public redirectUrl: string, 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 the driver needs a URI to be temporarily redirected\n * to another location.\n */\nexport class DaffExternalRouterTemporaryRedirectError extends DaffInheritableError\n implements DaffError {\n public readonly code: string = 'TEMPORARY_REDIRECT';\n\n constructor(public redirectUrl: string, 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 the platform performing url resolution fails.\n */\nexport class DaffExternalRouterServerError extends DaffInheritableError\n implements DaffError {\n public readonly code: string = '5xx_SERVER_ERROR';\n\n constructor(message?: string) {\n\t super(message);\n }\n}\n","import { DaffExternallyResolvableUrl } from '@daffodil/external-router';\n\n\nimport { DaffExternalRouterClientError } from '../errors/client-error';\nimport { DaffExternalRouterNotFoundError } from '../errors/not-found-error';\nimport { DaffExternalRouterServerError } from '../errors/server-error';\n\n/**\n * Processes resolved URLs and throws the appropriate error so that External Router\n * can handle routing errors.\n */\nexport const processErrors = (url: DaffExternallyResolvableUrl): DaffExternallyResolvableUrl => {\n if(url.code === 404 ){\n throw new DaffExternalRouterNotFoundError();\n } else if(url.code >= 400 && url.code < 500) {\n throw new DaffExternalRouterClientError();\n } else if(url.code >= 500) {\n throw new DaffExternalRouterServerError();\n } else {\n return url;\n }\n};\n","import { DaffExternallyResolvableUrl } from '@daffodil/external-router';\n\nimport { DaffExternalRouterPermanentRedirectError } from '../errors/permanent-redirect';\nimport { DaffExternalRouterTemporaryRedirectError } from '../errors/temporary-redirect';\n\n/**\n * Processes resolvedUrls and throws the appropriate error so that External Router\n * can handle redirects.\n */\nexport const processRedirects = (url: DaffExternallyResolvableUrl): DaffExternallyResolvableUrl => {\n if(url.code === 301){\n throw new DaffExternalRouterPermanentRedirectError(url.url);\n } else if(url.code === 302) {\n throw new DaffExternalRouterTemporaryRedirectError(url.url);\n } else {\n return url;\n }\n};\n","import { isPlatformServer } from '@angular/common';\nimport {\n Injectable,\n Inject,\n PLATFORM_ID,\n} from '@angular/core';\nimport {\n CanActivate,\n ActivatedRouteSnapshot,\n Router,\n RouterStateSnapshot,\n UrlTree,\n} from '@angular/router';\nimport {\n Observable,\n of,\n} from 'rxjs';\nimport {\n catchError,\n map,\n switchMap,\n} from 'rxjs/operators';\n\nimport { DaffRoutingUriNormalizer } from '@daffodil/core/routing';\nimport {\n DaffExternalRouter,\n DaffExternalRouterConfiguration,\n DAFF_EXTERNAL_ROUTER_CONFIG,\n DaffExternallyResolvableUrl,\n} from '@daffodil/external-router';\nimport {\n DaffExternalRouterDriverInterface,\n DaffExternalRouterDriver,\n} from '@daffodil/external-router/driver';\n\nimport { DaffExternalRouterNotFoundError } from '../errors/not-found-error';\nimport { DaffExternalRouterPermanentRedirectError } from '../errors/permanent-redirect';\nimport { DaffExternalRouterTemporaryRedirectError } from '../errors/temporary-redirect';\nimport { processErrors } from '../processors/process-errors';\nimport { processRedirects } from '../processors/process-redirect';\n\n/**\n * The DaffExternalRouterExistenceGuard is responsible for guarding the wildcard route\n * of an Angular App and either navigating to a resolved route upon successful resolution\n * or navigating to the configured route upon a failed resolution.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffExternalRouterExistenceGuard implements CanActivate {\n constructor(\n @Inject(DaffExternalRouterDriver)\n private driver: DaffExternalRouterDriverInterface,\n private externalRouter: DaffExternalRouter,\n private router: Router,\n @Inject(DAFF_EXTERNAL_ROUTER_CONFIG)\n private config: DaffExternalRouterConfiguration,\n private urlNormalizer: DaffRoutingUriNormalizer,\n ) { }\n\n canActivate(\n next: ActivatedRouteSnapshot,\n state: RouterStateSnapshot,\n ): Observable<UrlTree | boolean> {\n return this.driver.resolve(this.urlNormalizer.normalize(state.url)).pipe(\n map((resolvedRoute: DaffExternallyResolvableUrl) => processErrors(resolvedRoute)),\n switchMap(resolvedRoute => {\n this.externalRouter.add(resolvedRoute);\n return of(resolvedRoute);\n }),\n map((resolvedRoute: DaffExternallyResolvableUrl) => processRedirects(resolvedRoute)),\n // Note that we have to use state.url as we want to ensure that we keep any fragments or query strings.\n // When we succeed, redirect to the new route, as config has changed since we init'd.\n map(() => this.router.parseUrl(state.url)),\n // When we fail, we need to process errors as dictated by the error type.\n // Handle redirects\n catchError(error => {\n if (\n !(error instanceof DaffExternalRouterPermanentRedirectError) &&\n !(error instanceof DaffExternalRouterTemporaryRedirectError)) {\n throw error;\n }\n\n return of(this.router.parseUrl(error.redirectUrl));\n }),\n // Handle \"404\"\n catchError((error) => {\n if (!(error instanceof DaffExternalRouterNotFoundError)) {\n throw error;\n }\n\n return of(this.router.parseUrl(this.config.notFoundResolutionPath));\n }),\n\n //Otherwise something went horribly wrong and we need to bail out.\n catchError((error) => {\n //TODO(damienwebdev): Add a logging system.\n //This log is intentional until we have a better logging system in place.\n console.log(error);\n return of(this.router.parseUrl(this.config.failedResolutionPath));\n }),\n );\n }\n}\n","/*\n * Public API Surface of @daffodil/external-router/routing\n */\nexport { DaffExternalRouterExistenceGuard } from './guard/existence.guard';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;AAKA;;AAEG;AACG,MAAO,6BAA8B,SAAQ,oBAAoB,CAAA;AAIrE,IAAA,WAAA,CAAY,OAAgB,EAAA;QAC3B,KAAK,CAAC,OAAO,CAAC,CAAC;QAHA,IAAI,CAAA,IAAA,GAAW,kBAAkB,CAAC;KAIjD;AACF;;ACXD;;AAEG;AACG,MAAO,+BAAgC,SAAQ,6BAA6B,CAAA;AAIhF,IAAA,WAAA,CAAY,OAAgB,EAAA;QAC3B,KAAK,CAAC,OAAO,CAAC,CAAC;QAHA,IAAI,CAAA,IAAA,GAAW,eAAe,CAAC;KAI9C;AACF;;ACTD;;;AAGG;AACG,MAAO,wCAAyC,SAAQ,oBAAoB,CAAA;IAIhF,WAAmB,CAAA,WAAmB,EAAE,OAAgB,EAAA;QACvD,KAAK,CAAC,OAAO,CAAC,CAAC;QADG,IAAW,CAAA,WAAA,GAAX,WAAW,CAAQ;QAFtB,IAAI,CAAA,IAAA,GAAW,wBAAwB,CAAC;KAIvD;AACF;;ACXD;;;AAGG;AACG,MAAO,wCAAyC,SAAQ,oBAAoB,CAAA;IAIhF,WAAmB,CAAA,WAAmB,EAAE,OAAgB,EAAA;QACvD,KAAK,CAAC,OAAO,CAAC,CAAC;QADG,IAAW,CAAA,WAAA,GAAX,WAAW,CAAQ;QAFtB,IAAI,CAAA,IAAA,GAAW,oBAAoB,CAAC;KAInD;AACF;;ACXD;;AAEG;AACG,MAAO,6BAA8B,SAAQ,oBAAoB,CAAA;AAIrE,IAAA,WAAA,CAAY,OAAgB,EAAA;QAC3B,KAAK,CAAC,OAAO,CAAC,CAAC;QAHA,IAAI,CA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