@daffodil/external-router 0.38.7

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.

Potentially problematic release.


This version of @daffodil/external-router might be problematic. Click here for more details.

Files changed (187) hide show
  1. package/README.md +10 -0
  2. package/bundles/daffodil-external-router-driver-magento-2.4.1.umd.js +490 -0
  3. package/bundles/daffodil-external-router-driver-magento-2.4.1.umd.js.map +1 -0
  4. package/bundles/daffodil-external-router-driver-magento-2.4.1.umd.min.js +16 -0
  5. package/bundles/daffodil-external-router-driver-magento-2.4.1.umd.min.js.map +1 -0
  6. package/bundles/daffodil-external-router-driver-magento-2.4.2.umd.js +487 -0
  7. package/bundles/daffodil-external-router-driver-magento-2.4.2.umd.js.map +1 -0
  8. package/bundles/daffodil-external-router-driver-magento-2.4.2.umd.min.js +16 -0
  9. package/bundles/daffodil-external-router-driver-magento-2.4.2.umd.min.js.map +1 -0
  10. package/bundles/daffodil-external-router-driver-magento.umd.js +69 -0
  11. package/bundles/daffodil-external-router-driver-magento.umd.js.map +1 -0
  12. package/bundles/daffodil-external-router-driver-magento.umd.min.js +2 -0
  13. package/bundles/daffodil-external-router-driver-magento.umd.min.js.map +1 -0
  14. package/bundles/daffodil-external-router-driver-testing.umd.js +155 -0
  15. package/bundles/daffodil-external-router-driver-testing.umd.js.map +1 -0
  16. package/bundles/daffodil-external-router-driver-testing.umd.min.js +2 -0
  17. package/bundles/daffodil-external-router-driver-testing.umd.min.js.map +1 -0
  18. package/bundles/daffodil-external-router-driver.umd.js +79 -0
  19. package/bundles/daffodil-external-router-driver.umd.js.map +1 -0
  20. package/bundles/daffodil-external-router-driver.umd.min.js +2 -0
  21. package/bundles/daffodil-external-router-driver.umd.min.js.map +1 -0
  22. package/bundles/daffodil-external-router-routing.umd.js +644 -0
  23. package/bundles/daffodil-external-router-routing.umd.js.map +1 -0
  24. package/bundles/daffodil-external-router-routing.umd.min.js +16 -0
  25. package/bundles/daffodil-external-router-routing.umd.min.js.map +1 -0
  26. package/bundles/daffodil-external-router.umd.js +794 -0
  27. package/bundles/daffodil-external-router.umd.js.map +1 -0
  28. package/bundles/daffodil-external-router.umd.min.js +16 -0
  29. package/bundles/daffodil-external-router.umd.min.js.map +1 -0
  30. package/config.d.ts +20 -0
  31. package/daffodil-external-router.d.ts +5 -0
  32. package/daffodil-external-router.metadata.json +1 -0
  33. package/driver/daffodil-external-router-driver.d.ts +4 -0
  34. package/driver/daffodil-external-router-driver.metadata.json +1 -0
  35. package/driver/index.d.ts +1 -0
  36. package/driver/interfaces/external-router-driver.interface.d.ts +22 -0
  37. package/driver/magento/2.4.1/daffodil-external-router-driver-magento-2.4.1.d.ts +5 -0
  38. package/driver/magento/2.4.1/daffodil-external-router-driver-magento-2.4.1.metadata.json +1 -0
  39. package/driver/magento/2.4.1/graphql/queries/resolve-url-v2.4.1.d.ts +6 -0
  40. package/driver/magento/2.4.1/index.d.ts +1 -0
  41. package/driver/magento/2.4.1/magento.module.d.ts +23 -0
  42. package/driver/magento/2.4.1/magento.service.d.ts +15 -0
  43. package/driver/magento/2.4.1/package.json +11 -0
  44. package/driver/magento/2.4.1/public_api.d.ts +2 -0
  45. package/driver/magento/2.4.1/transforms/resolution-to-resolvable-url.d.ts +3 -0
  46. package/driver/magento/2.4.2/daffodil-external-router-driver-magento-2.4.2.d.ts +5 -0
  47. package/driver/magento/2.4.2/daffodil-external-router-driver-magento-2.4.2.metadata.json +1 -0
  48. package/driver/magento/2.4.2/graphql/queries/resolve-url-v2.4.2.d.ts +6 -0
  49. package/driver/magento/2.4.2/index.d.ts +1 -0
  50. package/driver/magento/2.4.2/magento.module.d.ts +23 -0
  51. package/driver/magento/2.4.2/magento.service.d.ts +15 -0
  52. package/driver/magento/2.4.2/package.json +11 -0
  53. package/driver/magento/2.4.2/public_api.d.ts +2 -0
  54. package/driver/magento/2.4.2/transforms/resolution-to-resolvable-url.d.ts +3 -0
  55. package/driver/magento/daffodil-external-router-driver-magento.d.ts +4 -0
  56. package/driver/magento/daffodil-external-router-driver-magento.metadata.json +1 -0
  57. package/driver/magento/index.d.ts +1 -0
  58. package/driver/magento/model/public_api.d.ts +3 -0
  59. package/driver/magento/model/resolution-types.d.ts +5 -0
  60. package/driver/magento/model/url-resolver-response.d.ts +4 -0
  61. package/driver/magento/model/url-resolver.d.ts +13 -0
  62. package/driver/magento/package.json +11 -0
  63. package/driver/magento/public_api.d.ts +2 -0
  64. package/driver/magento/transforms/public_api.d.ts +1 -0
  65. package/driver/magento/transforms/redirect-to-http.d.ts +4 -0
  66. package/driver/not-found-resolution.d.ts +8 -0
  67. package/driver/package.json +11 -0
  68. package/driver/public_api.d.ts +2 -0
  69. package/driver/testing/config.d.ts +16 -0
  70. package/driver/testing/daffodil-external-router-driver-testing.d.ts +5 -0
  71. package/driver/testing/daffodil-external-router-driver-testing.metadata.json +1 -0
  72. package/driver/testing/index.d.ts +1 -0
  73. package/driver/testing/package.json +11 -0
  74. package/driver/testing/public_api.d.ts +3 -0
  75. package/driver/testing/testing.module.d.ts +9 -0
  76. package/driver/testing/testing.service.d.ts +17 -0
  77. package/errors/no-wildcard.d.ts +9 -0
  78. package/errors/unknown-type.d.ts +9 -0
  79. package/esm2015/config.js +41 -0
  80. package/esm2015/daffodil-external-router.js +11 -0
  81. package/esm2015/driver/daffodil-external-router-driver.js +10 -0
  82. package/esm2015/driver/index.js +7 -0
  83. package/esm2015/driver/interfaces/external-router-driver.interface.js +30 -0
  84. package/esm2015/driver/magento/2.4.1/daffodil-external-router-driver-magento-2.4.1.js +11 -0
  85. package/esm2015/driver/magento/2.4.1/graphql/queries/resolve-url-v2.4.1.js +24 -0
  86. package/esm2015/driver/magento/2.4.1/index.js +7 -0
  87. package/esm2015/driver/magento/2.4.1/magento.module.js +56 -0
  88. package/esm2015/driver/magento/2.4.1/magento.service.js +63 -0
  89. package/esm2015/driver/magento/2.4.1/public_api.js +11 -0
  90. package/esm2015/driver/magento/2.4.1/transforms/resolution-to-resolvable-url.js +23 -0
  91. package/esm2015/driver/magento/2.4.2/daffodil-external-router-driver-magento-2.4.2.js +11 -0
  92. package/esm2015/driver/magento/2.4.2/graphql/queries/resolve-url-v2.4.2.js +24 -0
  93. package/esm2015/driver/magento/2.4.2/index.js +7 -0
  94. package/esm2015/driver/magento/2.4.2/magento.module.js +56 -0
  95. package/esm2015/driver/magento/2.4.2/magento.service.js +62 -0
  96. package/esm2015/driver/magento/2.4.2/public_api.js +11 -0
  97. package/esm2015/driver/magento/2.4.2/transforms/resolution-to-resolvable-url.js +20 -0
  98. package/esm2015/driver/magento/daffodil-external-router-driver-magento.js +10 -0
  99. package/esm2015/driver/magento/index.js +7 -0
  100. package/esm2015/driver/magento/model/public_api.js +7 -0
  101. package/esm2015/driver/magento/model/resolution-types.js +13 -0
  102. package/esm2015/driver/magento/model/url-resolver-response.js +14 -0
  103. package/esm2015/driver/magento/model/url-resolver.js +28 -0
  104. package/esm2015/driver/magento/public_api.js +11 -0
  105. package/esm2015/driver/magento/transforms/public_api.js +7 -0
  106. package/esm2015/driver/magento/transforms/redirect-to-http.js +15 -0
  107. package/esm2015/driver/not-found-resolution.js +19 -0
  108. package/esm2015/driver/public_api.js +11 -0
  109. package/esm2015/driver/testing/config.js +27 -0
  110. package/esm2015/driver/testing/daffodil-external-router-driver-testing.js +11 -0
  111. package/esm2015/driver/testing/index.js +7 -0
  112. package/esm2015/driver/testing/public_api.js +11 -0
  113. package/esm2015/driver/testing/testing.module.js +42 -0
  114. package/esm2015/driver/testing/testing.service.js +65 -0
  115. package/esm2015/errors/no-wildcard.js +24 -0
  116. package/esm2015/errors/unknown-type.js +24 -0
  117. package/esm2015/external-router.module.js +36 -0
  118. package/esm2015/model/insertion-strategy.type.js +6 -0
  119. package/esm2015/model/public_api.js +6 -0
  120. package/esm2015/model/resolvable-route.js +36 -0
  121. package/esm2015/model/route-info.js +17 -0
  122. package/esm2015/model/route-type.js +6 -0
  123. package/esm2015/model/route-with-data-path.js +6 -0
  124. package/esm2015/model/route-without-path.js +6 -0
  125. package/esm2015/model/type-route-pair.js +34 -0
  126. package/esm2015/public_api.js +19 -0
  127. package/esm2015/router/router.service.js +67 -0
  128. package/esm2015/router/strategies/insert-data-path.js +129 -0
  129. package/esm2015/router/strategies/insert-route-before-wildcard.js +33 -0
  130. package/esm2015/router/url-matcher/data-path-matcher.js +51 -0
  131. package/esm2015/routing/daffodil-external-router-routing.js +10 -0
  132. package/esm2015/routing/errors/client-error.js +23 -0
  133. package/esm2015/routing/errors/not-found-error.js +23 -0
  134. package/esm2015/routing/errors/permanent-redirect.js +28 -0
  135. package/esm2015/routing/errors/server-error.js +23 -0
  136. package/esm2015/routing/errors/temporary-redirect.js +28 -0
  137. package/esm2015/routing/guard/existence.guard.js +149 -0
  138. package/esm2015/routing/index.js +7 -0
  139. package/esm2015/routing/processors/process-errors.js +32 -0
  140. package/esm2015/routing/processors/process-redirect.js +28 -0
  141. package/esm2015/routing/public_api.js +10 -0
  142. package/esm2015/token/type-resolvable-routes.token.js +46 -0
  143. package/esm2015/transform/resolved-route-to-route.js +33 -0
  144. package/external-router.module.d.ts +10 -0
  145. package/fesm2015/daffodil-external-router-driver-magento-2.4.1.js +177 -0
  146. package/fesm2015/daffodil-external-router-driver-magento-2.4.1.js.map +1 -0
  147. package/fesm2015/daffodil-external-router-driver-magento-2.4.2.js +174 -0
  148. package/fesm2015/daffodil-external-router-driver-magento-2.4.2.js.map +1 -0
  149. package/fesm2015/daffodil-external-router-driver-magento.js +59 -0
  150. package/fesm2015/daffodil-external-router-driver-magento.js.map +1 -0
  151. package/fesm2015/daffodil-external-router-driver-testing.js +148 -0
  152. package/fesm2015/daffodil-external-router-driver-testing.js.map +1 -0
  153. package/fesm2015/daffodil-external-router-driver.js +70 -0
  154. package/fesm2015/daffodil-external-router-driver.js.map +1 -0
  155. package/fesm2015/daffodil-external-router-routing.js +336 -0
  156. package/fesm2015/daffodil-external-router-routing.js.map +1 -0
  157. package/fesm2015/daffodil-external-router.js +489 -0
  158. package/fesm2015/daffodil-external-router.js.map +1 -0
  159. package/model/insertion-strategy.type.d.ts +8 -0
  160. package/model/public_api.d.ts +7 -0
  161. package/model/resolvable-route.d.ts +27 -0
  162. package/model/route-info.d.ts +9 -0
  163. package/model/route-type.d.ts +6 -0
  164. package/model/route-with-data-path.d.ts +15 -0
  165. package/model/route-without-path.d.ts +7 -0
  166. package/model/type-route-pair.d.ts +26 -0
  167. package/package.json +37 -0
  168. package/public_api.d.ts +10 -0
  169. package/router/router.service.d.ts +12 -0
  170. package/router/strategies/insert-data-path.d.ts +40 -0
  171. package/router/strategies/insert-route-before-wildcard.d.ts +6 -0
  172. package/router/url-matcher/data-path-matcher.d.ts +20 -0
  173. package/routing/daffodil-external-router-routing.d.ts +4 -0
  174. package/routing/daffodil-external-router-routing.metadata.json +1 -0
  175. package/routing/errors/client-error.d.ts +8 -0
  176. package/routing/errors/not-found-error.d.ts +9 -0
  177. package/routing/errors/permanent-redirect.d.ts +10 -0
  178. package/routing/errors/server-error.d.ts +8 -0
  179. package/routing/errors/temporary-redirect.d.ts +10 -0
  180. package/routing/guard/existence.guard.d.ts +19 -0
  181. package/routing/index.d.ts +1 -0
  182. package/routing/package.json +11 -0
  183. package/routing/processors/process-errors.d.ts +6 -0
  184. package/routing/processors/process-redirect.d.ts +6 -0
  185. package/routing/public_api.d.ts +1 -0
  186. package/token/type-resolvable-routes.token.d.ts +14 -0
  187. package/transform/resolved-route-to-route.d.ts +7 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daffodil-external-router-driver-testing.js","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"],"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/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"],"names":["faker.datatype"],"mappings":";;;;;;;;;;;;;;;;;;oDAWC;;;;;;;MAOY,0CAA0C,GAAG,IAAI,cAAc,CAE1E,4CAA4C,EAAE;IAC9C,UAAU,EAAE,MAAM;IAClB,OAAO;;;IAAE,OAAO,EAAE,CAAC,CAAA;CACpB;;;;;;;;;;;;;;;MCWY,+BAA+B;;;;IAE1C,YAEQ,uBAA8D,EAAE;QAAhE,yBAAoB,GAApB,oBAAoB,CAA4C;KACpE;;;;;IAEJ,OAAO,CAAC,GAAW;;cACX,YAAY,GAAG,2BAA2B,CAAC,4BAA4B,CAAC,GAAG,CAAC,CAAC;QAEnF,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,YAAY,CAAC,EAAE;YAC5C,OAAO,UAAU,CAAC;aACX,YAAY;uGAC8E,CAAC,CAAC;SACpG;QAED,OAAO,EAAE,CAAC;YACR,EAAE,EAAEA,QAAc,CAAC,IAAI,EAAE;YACzB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,IAAI,CAAC,oBAAoB,CAAC,YAAY,CAAC;YAC7C,IAAI,EAAE,GAAG;SACV,CAAC,CAAC;KACJ;;;YAzBF,UAAU,SAAC;gBACV,UAAU,EAAE,MAAM;aACnB;;;;4CAIE,MAAM,SAAC,0CAA0C;;;;;;;;IAAlD,+DACwE;;;;;;;;;;;;MChB7D,qCAAqC;;;;;IAChD,OAAO,OAAO,CACZ,MAA6C;QAE7C,OAAO;YACL,QAAQ,EAAE,qCAAqC;YAC/C,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,wBAAwB;oBACjC,WAAW,EAAE,+BAA+B;iBAC7C;gBACD;oBACE,OAAO,EAAE,0CAA0C;oBACnD,QAAQ,EAAE,MAAM;iBACjB;aACF;SACF,CAAC;KACH;;;YArBF,QAAQ,SAAC;gBACR,YAAY,EAAE,EAAE;gBAChB,OAAO,EAAE,CAAC,YAAY,CAAC;aACxB;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,70 @@
1
+ import { InjectionToken } from '@angular/core';
2
+
3
+ /**
4
+ * @fileoverview added by tsickle
5
+ * Generated from: interfaces/external-router-driver.interface.ts
6
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
7
+ */
8
+ /**
9
+ * The token for the `\@daffodil/external-router` driver.
10
+ * @type {?}
11
+ */
12
+ const DaffExternalRouterDriver = new InjectionToken('DaffExternalRouterDriver');
13
+ /**
14
+ * The interface for a \@daffodil/external-router driver.
15
+ *
16
+ * This driver is responsible for translating a URL into a Route consumable by
17
+ * Daffodil.
18
+ * @record
19
+ */
20
+ function DaffExternalRouterDriverInterface() { }
21
+ if (false) {
22
+ /**
23
+ * Resolves a URL with a platform.
24
+ * Returns information about the type of URL.
25
+ *
26
+ * @param {?} url The full URL path qualified with file extension and leading slash but without domain. i.e. /full/path/to/thing.html
27
+ * @return {?}
28
+ */
29
+ DaffExternalRouterDriverInterface.prototype.resolve = function (url) { };
30
+ }
31
+
32
+ /**
33
+ * @fileoverview added by tsickle
34
+ * Generated from: not-found-resolution.ts
35
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
36
+ */
37
+ /**
38
+ * When a driver fails to find a resolution, it should return a 404.
39
+ * This const represents the standard "Not Found" resolution that a driver
40
+ * should return. Drivers are not required to return this value, but may do so
41
+ * if they would like.
42
+ * @type {?}
43
+ */
44
+ const DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION = {
45
+ id: null,
46
+ url: null,
47
+ code: 404,
48
+ type: null,
49
+ };
50
+
51
+ /**
52
+ * @fileoverview added by tsickle
53
+ * Generated from: public_api.ts
54
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
55
+ */
56
+
57
+ /**
58
+ * @fileoverview added by tsickle
59
+ * Generated from: index.ts
60
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
61
+ */
62
+
63
+ /**
64
+ * @fileoverview added by tsickle
65
+ * Generated from: daffodil-external-router-driver.ts
66
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
67
+ */
68
+
69
+ export { DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION, DaffExternalRouterDriver };
70
+ //# sourceMappingURL=daffodil-external-router-driver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daffodil-external-router-driver.js","sources":["../../../libs/external-router/driver/src/interfaces/external-router-driver.interface.ts","../../../libs/external-router/driver/src/not-found-resolution.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"],"names":[],"mappings":";;;;;;;;;;;MAQa,wBAAwB,GAAG,IAAI,cAAc,CAExD,0BAA0B;;;;;;;;gDAgB3B;;;;;;;;;IADA,yEAA8D;;;;;;;;;;;;;;;MCjBlD,yCAAyC,GAAgC;IACpF,EAAE,EAAE,IAAI;IACR,GAAG,EAAE,IAAI;IACT,IAAI,EAAE,GAAG;IACT,IAAI,EAAE,IAAI;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,336 @@
1
+ import { Injectable, Inject, ɵɵdefineInjectable, ɵɵinject } from '@angular/core';
2
+ import { Router } from '@angular/router';
3
+ import { of } from 'rxjs';
4
+ import { map, switchMap, catchError } from 'rxjs/operators';
5
+ import { DaffRoutingUriNormalizer } from '@daffodil/core/routing';
6
+ import { DaffExternalRouter, DAFF_EXTERNAL_ROUTER_CONFIG } from '@daffodil/external-router';
7
+ import { DaffExternalRouterDriver } from '@daffodil/external-router/driver';
8
+ import { DaffInheritableError } from '@daffodil/core';
9
+
10
+ /**
11
+ * @fileoverview added by tsickle
12
+ * Generated from: errors/client-error.ts
13
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
14
+ */
15
+ /**
16
+ * An error thrown when the driver encounters a 4xx error.
17
+ */
18
+ class DaffExternalRouterClientError extends DaffInheritableError {
19
+ /**
20
+ * @param {?=} message
21
+ */
22
+ constructor(message) {
23
+ super(message);
24
+ this.code = '4xx_CLIENT_ERROR';
25
+ }
26
+ }
27
+ if (false) {
28
+ /** @type {?} */
29
+ DaffExternalRouterClientError.prototype.code;
30
+ }
31
+
32
+ /**
33
+ * @fileoverview added by tsickle
34
+ * Generated from: errors/not-found-error.ts
35
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
36
+ */
37
+ /**
38
+ * An error thrown when the driver determines that a given url is not resolvable.
39
+ */
40
+ class DaffExternalRouterNotFoundError extends DaffExternalRouterClientError {
41
+ /**
42
+ * @param {?=} message
43
+ */
44
+ constructor(message) {
45
+ super(message);
46
+ this.code = '404_NOT_FOUND';
47
+ }
48
+ }
49
+ if (false) {
50
+ /** @type {?} */
51
+ DaffExternalRouterNotFoundError.prototype.code;
52
+ }
53
+
54
+ /**
55
+ * @fileoverview added by tsickle
56
+ * Generated from: errors/permanent-redirect.ts
57
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
58
+ */
59
+ /**
60
+ * An error thrown when the driver determines that the url needs to be routed somewhere
61
+ * else permanently.
62
+ */
63
+ class DaffExternalRouterPermanentRedirectError extends DaffInheritableError {
64
+ /**
65
+ * @param {?} redirectUrl
66
+ * @param {?=} message
67
+ */
68
+ constructor(redirectUrl, message) {
69
+ super(message);
70
+ this.redirectUrl = redirectUrl;
71
+ this.code = '302_PERMANENT_REDIRECT';
72
+ }
73
+ }
74
+ if (false) {
75
+ /** @type {?} */
76
+ DaffExternalRouterPermanentRedirectError.prototype.code;
77
+ /** @type {?} */
78
+ DaffExternalRouterPermanentRedirectError.prototype.redirectUrl;
79
+ }
80
+
81
+ /**
82
+ * @fileoverview added by tsickle
83
+ * Generated from: errors/temporary-redirect.ts
84
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
85
+ */
86
+ /**
87
+ * An error thrown when the driver needs a URI to be temporarily redirected
88
+ * to another location.
89
+ */
90
+ class DaffExternalRouterTemporaryRedirectError extends DaffInheritableError {
91
+ /**
92
+ * @param {?} redirectUrl
93
+ * @param {?=} message
94
+ */
95
+ constructor(redirectUrl, message) {
96
+ super(message);
97
+ this.redirectUrl = redirectUrl;
98
+ this.code = 'TEMPORARY_REDIRECT';
99
+ }
100
+ }
101
+ if (false) {
102
+ /** @type {?} */
103
+ DaffExternalRouterTemporaryRedirectError.prototype.code;
104
+ /** @type {?} */
105
+ DaffExternalRouterTemporaryRedirectError.prototype.redirectUrl;
106
+ }
107
+
108
+ /**
109
+ * @fileoverview added by tsickle
110
+ * Generated from: errors/server-error.ts
111
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
112
+ */
113
+ /**
114
+ * An error thrown when the platform performing url resolution fails.
115
+ */
116
+ class DaffExternalRouterServerError extends DaffInheritableError {
117
+ /**
118
+ * @param {?=} message
119
+ */
120
+ constructor(message) {
121
+ super(message);
122
+ this.code = '5xx_SERVER_ERROR';
123
+ }
124
+ }
125
+ if (false) {
126
+ /** @type {?} */
127
+ DaffExternalRouterServerError.prototype.code;
128
+ }
129
+
130
+ /**
131
+ * @fileoverview added by tsickle
132
+ * Generated from: processors/process-errors.ts
133
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
134
+ */
135
+ /**
136
+ * Processes resolved URLs and throws the appropriate error so that External Router
137
+ * can handle routing errors.
138
+ * @type {?}
139
+ */
140
+ const processErrors = (/**
141
+ * @param {?} url
142
+ * @return {?}
143
+ */
144
+ (url) => {
145
+ if (url.code === 404) {
146
+ throw new DaffExternalRouterNotFoundError();
147
+ }
148
+ else if (url.code >= 400 && url.code < 500) {
149
+ throw new DaffExternalRouterClientError();
150
+ }
151
+ else if (url.code >= 500) {
152
+ throw new DaffExternalRouterServerError();
153
+ }
154
+ else {
155
+ return url;
156
+ }
157
+ });
158
+
159
+ /**
160
+ * @fileoverview added by tsickle
161
+ * Generated from: processors/process-redirect.ts
162
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
163
+ */
164
+ /**
165
+ * Processes resolvedUrls and throws the appropriate error so that External Router
166
+ * can handle redirects.
167
+ * @type {?}
168
+ */
169
+ const processRedirects = (/**
170
+ * @param {?} url
171
+ * @return {?}
172
+ */
173
+ (url) => {
174
+ if (url.code === 301) {
175
+ throw new DaffExternalRouterPermanentRedirectError(url.url);
176
+ }
177
+ else if (url.code === 302) {
178
+ throw new DaffExternalRouterTemporaryRedirectError(url.url);
179
+ }
180
+ else {
181
+ return url;
182
+ }
183
+ });
184
+
185
+ /**
186
+ * @fileoverview added by tsickle
187
+ * Generated from: guard/existence.guard.ts
188
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
189
+ */
190
+ /**
191
+ * The DaffExternalRouterExistenceGuard is responsible for guarding the wildcard route
192
+ * of an Angular App and either navigating to a resolved route upon successful resolution
193
+ * or navigating to the configured route upon a failed resolution.
194
+ */
195
+ class DaffExternalRouterExistenceGuard {
196
+ /**
197
+ * @param {?} driver
198
+ * @param {?} externalRouter
199
+ * @param {?} router
200
+ * @param {?} config
201
+ * @param {?} urlNormalizer
202
+ */
203
+ constructor(driver, externalRouter, router, config, urlNormalizer) {
204
+ this.driver = driver;
205
+ this.externalRouter = externalRouter;
206
+ this.router = router;
207
+ this.config = config;
208
+ this.urlNormalizer = urlNormalizer;
209
+ }
210
+ /**
211
+ * @param {?} next
212
+ * @param {?} state
213
+ * @return {?}
214
+ */
215
+ canActivate(next, state) {
216
+ return this.driver.resolve(this.urlNormalizer.normalize(state.url)).pipe(map((/**
217
+ * @param {?} resolvedRoute
218
+ * @return {?}
219
+ */
220
+ (resolvedRoute) => processErrors(resolvedRoute))), switchMap((/**
221
+ * @param {?} resolvedRoute
222
+ * @return {?}
223
+ */
224
+ resolvedRoute => {
225
+ this.externalRouter.add(resolvedRoute);
226
+ return of(resolvedRoute);
227
+ })), map((/**
228
+ * @param {?} resolvedRoute
229
+ * @return {?}
230
+ */
231
+ (resolvedRoute) => processRedirects(resolvedRoute))),
232
+ // Note that we have to use state.url as we want to ensure that we keep any fragments or query strings.
233
+ // When we succeed, redirect to the new route, as config has changed since we init'd.
234
+ map((/**
235
+ * @return {?}
236
+ */
237
+ () => this.router.parseUrl(state.url))),
238
+ // When we fail, we need to process errors as dictated by the error type.
239
+ // Handle redirects
240
+ catchError((/**
241
+ * @param {?} error
242
+ * @return {?}
243
+ */
244
+ error => {
245
+ if (!(error instanceof DaffExternalRouterPermanentRedirectError) &&
246
+ !(error instanceof DaffExternalRouterTemporaryRedirectError)) {
247
+ throw error;
248
+ }
249
+ return of(this.router.parseUrl(error.redirectUrl));
250
+ })),
251
+ // Handle "404"
252
+ catchError((/**
253
+ * @param {?} error
254
+ * @return {?}
255
+ */
256
+ (error) => {
257
+ if (!(error instanceof DaffExternalRouterNotFoundError)) {
258
+ throw error;
259
+ }
260
+ return of(this.router.parseUrl(this.config.notFoundResolutionPath));
261
+ })),
262
+ //Otherwise something went horribly wrong and we need to bail out.
263
+ catchError((/**
264
+ * @param {?} error
265
+ * @return {?}
266
+ */
267
+ (error) => {
268
+ //TODO(damienwebdev): Add a logging system.
269
+ //This log is intentional until we have a better logging system in place.
270
+ console.log(error);
271
+ return of(this.router.parseUrl(this.config.failedResolutionPath));
272
+ })));
273
+ }
274
+ }
275
+ DaffExternalRouterExistenceGuard.decorators = [
276
+ { type: Injectable, args: [{
277
+ providedIn: 'root',
278
+ },] }
279
+ ];
280
+ /** @nocollapse */
281
+ DaffExternalRouterExistenceGuard.ctorParameters = () => [
282
+ { type: undefined, decorators: [{ type: Inject, args: [DaffExternalRouterDriver,] }] },
283
+ { type: DaffExternalRouter },
284
+ { type: Router },
285
+ { type: undefined, decorators: [{ type: Inject, args: [DAFF_EXTERNAL_ROUTER_CONFIG,] }] },
286
+ { type: DaffRoutingUriNormalizer }
287
+ ];
288
+ /** @nocollapse */ DaffExternalRouterExistenceGuard.ɵprov = ɵɵdefineInjectable({ factory: function DaffExternalRouterExistenceGuard_Factory() { return new DaffExternalRouterExistenceGuard(ɵɵinject(DaffExternalRouterDriver), ɵɵinject(DaffExternalRouter), ɵɵinject(Router), ɵɵinject(DAFF_EXTERNAL_ROUTER_CONFIG), ɵɵinject(DaffRoutingUriNormalizer)); }, token: DaffExternalRouterExistenceGuard, providedIn: "root" });
289
+ if (false) {
290
+ /**
291
+ * @type {?}
292
+ * @private
293
+ */
294
+ DaffExternalRouterExistenceGuard.prototype.driver;
295
+ /**
296
+ * @type {?}
297
+ * @private
298
+ */
299
+ DaffExternalRouterExistenceGuard.prototype.externalRouter;
300
+ /**
301
+ * @type {?}
302
+ * @private
303
+ */
304
+ DaffExternalRouterExistenceGuard.prototype.router;
305
+ /**
306
+ * @type {?}
307
+ * @private
308
+ */
309
+ DaffExternalRouterExistenceGuard.prototype.config;
310
+ /**
311
+ * @type {?}
312
+ * @private
313
+ */
314
+ DaffExternalRouterExistenceGuard.prototype.urlNormalizer;
315
+ }
316
+
317
+ /**
318
+ * @fileoverview added by tsickle
319
+ * Generated from: public_api.ts
320
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
321
+ */
322
+
323
+ /**
324
+ * @fileoverview added by tsickle
325
+ * Generated from: index.ts
326
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
327
+ */
328
+
329
+ /**
330
+ * @fileoverview added by tsickle
331
+ * Generated from: daffodil-external-router-routing.ts
332
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
333
+ */
334
+
335
+ export { DaffExternalRouterExistenceGuard };
336
+ //# sourceMappingURL=daffodil-external-router-routing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daffodil-external-router-routing.js","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"],"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"],"names":[],"mappings":"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"}
@@ -0,0 +1,489 @@
1
+ import { CommonModule } from '@angular/common';
2
+ import { InjectionToken, NgModule, Injectable, Inject, ɵɵdefineInjectable, ɵɵinject } from '@angular/core';
3
+ import { Router } from '@angular/router';
4
+ import { DaffInheritableError } from '@daffodil/core';
5
+ import { daffUriTruncateLeadingSlash } from '@daffodil/core/routing';
6
+
7
+ /**
8
+ * @fileoverview added by tsickle
9
+ * Generated from: config.ts
10
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
11
+ */
12
+ /** @type {?} */
13
+ const daffExternalRouterConfigurationDefault = {
14
+ failedResolutionPath: '/',
15
+ notFoundResolutionPath: '/',
16
+ };
17
+ /**
18
+ * The token holding the runtime configuration for the behavior of the
19
+ * `\@daffodil/external-router` package.
20
+ * @type {?}
21
+ */
22
+ const DAFF_EXTERNAL_ROUTER_CONFIG = new InjectionToken('DAFF_EXTERNAL_ROUTER_CONFIG', {
23
+ providedIn: 'root',
24
+ factory: (/**
25
+ * @return {?}
26
+ */
27
+ () => daffExternalRouterConfigurationDefault),
28
+ });
29
+ /**
30
+ * The configuration object for the external router package.
31
+ * @record
32
+ */
33
+ function DaffExternalRouterConfiguration() { }
34
+ if (false) {
35
+ /**
36
+ * The path to redirect to when external route resolution fails.
37
+ * @type {?}
38
+ */
39
+ DaffExternalRouterConfiguration.prototype.failedResolutionPath;
40
+ /**
41
+ * The path to redirect to when the requested URL is not found.
42
+ * @type {?}
43
+ */
44
+ DaffExternalRouterConfiguration.prototype.notFoundResolutionPath;
45
+ }
46
+
47
+ /**
48
+ * @fileoverview added by tsickle
49
+ * Generated from: token/type-resolvable-routes.token.ts
50
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
51
+ */
52
+ /**
53
+ * A multi-token that allows you to register route "types" that correspond to routes.
54
+ * @type {?}
55
+ */
56
+ const DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE = new InjectionToken('DAFF_EXTERNAL_ROUTER_RESOLVABLE_TYPE_ROUTES', {
57
+ providedIn: 'root',
58
+ factory: (/**
59
+ * @return {?}
60
+ */
61
+ () => []),
62
+ });
63
+ /**
64
+ * A provider used to connect a type to a route to enable dynamic route resolution at runtime.
65
+ * @param {?} typeRoutePair
66
+ * @return {?}
67
+ */
68
+ function daffProvideRouteResolvableByType(typeRoutePair) {
69
+ return {
70
+ provide: DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE,
71
+ multi: true,
72
+ useValue: typeRoutePair,
73
+ };
74
+ }
75
+ /**
76
+ * A multi-provider used to connect an array of types to their respective routes.
77
+ * @param {?} routes
78
+ * @return {?}
79
+ */
80
+ function daffProvideRoutesResolvableByType(routes) {
81
+ return routes.map((/**
82
+ * @param {?} route
83
+ * @return {?}
84
+ */
85
+ (route) => ({
86
+ provide: DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE,
87
+ multi: true,
88
+ useValue: route,
89
+ })));
90
+ }
91
+
92
+ /**
93
+ * @fileoverview added by tsickle
94
+ * Generated from: external-router.module.ts
95
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
96
+ */
97
+ /**
98
+ * The external `DaffExternalRouterModule` allows you to configure the
99
+ * `\@daffodil/external-router` package's behavior.
100
+ */
101
+ class DaffExternalRouterModule {
102
+ /**
103
+ * @param {?} config
104
+ * @param {?=} routes
105
+ * @return {?}
106
+ */
107
+ static forRoot(config, routes = []) {
108
+ return {
109
+ ngModule: DaffExternalRouterModule,
110
+ providers: [
111
+ { provide: DAFF_EXTERNAL_ROUTER_CONFIG, useValue: Object.assign(Object.assign({}, daffExternalRouterConfigurationDefault), config) },
112
+ ...daffProvideRoutesResolvableByType(routes),
113
+ ],
114
+ };
115
+ }
116
+ }
117
+ DaffExternalRouterModule.decorators = [
118
+ { type: NgModule, args: [{
119
+ declarations: [],
120
+ imports: [CommonModule],
121
+ },] }
122
+ ];
123
+
124
+ /**
125
+ * @fileoverview added by tsickle
126
+ * Generated from: model/public_api.ts
127
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
128
+ */
129
+
130
+ /**
131
+ * @fileoverview added by tsickle
132
+ * Generated from: errors/no-wildcard.ts
133
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
134
+ */
135
+ /**
136
+ * An error thrown when there was no wildcard route found in configuration
137
+ * of the Angular Router.
138
+ */
139
+ class DaffExternalRouterNoWildcardError extends DaffInheritableError {
140
+ /**
141
+ * @param {?=} message
142
+ */
143
+ constructor(message) {
144
+ super(message);
145
+ this.code = 'NO_WILDCARD_ROUTE';
146
+ }
147
+ }
148
+ if (false) {
149
+ /** @type {?} */
150
+ DaffExternalRouterNoWildcardError.prototype.code;
151
+ }
152
+
153
+ /**
154
+ * @fileoverview added by tsickle
155
+ * Generated from: errors/unknown-type.ts
156
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
157
+ */
158
+ /**
159
+ * An error thrown when there is a failure matching a configured route to a
160
+ * route type.
161
+ */
162
+ class DaffExternalRouterUnknownRouteTypeError extends DaffInheritableError {
163
+ /**
164
+ * @param {?=} message
165
+ */
166
+ constructor(message) {
167
+ super(message);
168
+ this.code = 'UNKNOWN_ROUTE_TYPE';
169
+ }
170
+ }
171
+ if (false) {
172
+ /** @type {?} */
173
+ DaffExternalRouterUnknownRouteTypeError.prototype.code;
174
+ }
175
+
176
+ /**
177
+ * @fileoverview added by tsickle
178
+ * Generated from: transform/resolved-route-to-route.ts
179
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
180
+ */
181
+ /**
182
+ * Transforms a DaffExternallyResolvableUrl into an Angular Route.
183
+ * @type {?}
184
+ */
185
+ const daffTransformResolvedRouteToRoute = (/**
186
+ * @param {?} resolvedRoute
187
+ * @param {?} availableTypes
188
+ * @return {?}
189
+ */
190
+ (resolvedRoute, availableTypes) => {
191
+ /** @type {?} */
192
+ const routeType = availableTypes
193
+ .filter((/**
194
+ * @param {?} t
195
+ * @return {?}
196
+ */
197
+ t => t.type === resolvedRoute.type))
198
+ .shift();
199
+ if (!routeType) {
200
+ throw new DaffExternalRouterUnknownRouteTypeError(`Unable to resolve the route '${resolvedRoute.url}'. Its type is '${resolvedRoute.type}' but a matching route wasn't found.`);
201
+ }
202
+ return {
203
+ route: Object.assign(Object.assign({ path: resolvedRoute.url }, routeType.route), { data: Object.assign({ daffExternalRouteType: resolvedRoute.type }, routeType.route.data) }),
204
+ insertionStrategy: routeType.insertionStrategy,
205
+ };
206
+ });
207
+
208
+ /**
209
+ * @fileoverview added by tsickle
210
+ * Generated from: router/strategies/insert-route-before-wildcard.ts
211
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
212
+ */
213
+ /**
214
+ * Inserts a Route into Routes right before the wildcard route.
215
+ * If no wildcard is found, it fails fast with a `DaffExternalRouterNoWildcardError`.
216
+ * @type {?}
217
+ */
218
+ const daffInsertRouteBeforeWildCardStrategy = (/**
219
+ * @param {?} route
220
+ * @param {?} routes
221
+ * @return {?}
222
+ */
223
+ (route, routes) => {
224
+ /** @type {?} */
225
+ const index = routes.findIndex((/**
226
+ * @param {?} r
227
+ * @return {?}
228
+ */
229
+ (r) => r.path === '**'));
230
+ if (index === -1) {
231
+ throw new DaffExternalRouterNoWildcardError('No wildcard (**) route was found during route resolution.');
232
+ }
233
+ return [
234
+ ...routes.slice(0, index),
235
+ route,
236
+ ...routes.slice(index),
237
+ ];
238
+ });
239
+
240
+ /**
241
+ * @fileoverview added by tsickle
242
+ * Generated from: router/router.service.ts
243
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
244
+ */
245
+ class DaffExternalRouter {
246
+ /**
247
+ * @param {?} router
248
+ * @param {?} runtimeRoutes
249
+ */
250
+ constructor(router, runtimeRoutes) {
251
+ this.router = router;
252
+ this.runtimeRoutes = runtimeRoutes;
253
+ }
254
+ /**
255
+ * Adds a route to the existing router configuration.
256
+ * @param {?} resolvedRoute
257
+ * @return {?}
258
+ */
259
+ add(resolvedRoute) {
260
+ //Get the route.
261
+ const { route, insertionStrategy, } = daffTransformResolvedRouteToRoute(resolvedRoute, this.runtimeRoutes);
262
+ try {
263
+ //Add it to configuration.
264
+ this.router.config = (insertionStrategy || daffInsertRouteBeforeWildCardStrategy)(route, this.router.config);
265
+ }
266
+ catch (e) {
267
+ if (e instanceof DaffExternalRouterNoWildcardError) {
268
+ throw new DaffExternalRouterNoWildcardError(`${e.message} This usually means you have misconfigured your routes.`);
269
+ }
270
+ throw e;
271
+ }
272
+ }
273
+ }
274
+ DaffExternalRouter.decorators = [
275
+ { type: Injectable, args: [{
276
+ providedIn: 'root',
277
+ },] }
278
+ ];
279
+ /** @nocollapse */
280
+ DaffExternalRouter.ctorParameters = () => [
281
+ { type: Router },
282
+ { type: Array, decorators: [{ type: Inject, args: [DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE,] }] }
283
+ ];
284
+ /** @nocollapse */ DaffExternalRouter.ɵprov = ɵɵdefineInjectable({ factory: function DaffExternalRouter_Factory() { return new DaffExternalRouter(ɵɵinject(Router), ɵɵinject(DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE)); }, token: DaffExternalRouter, providedIn: "root" });
285
+ if (false) {
286
+ /**
287
+ * @type {?}
288
+ * @private
289
+ */
290
+ DaffExternalRouter.prototype.router;
291
+ /**
292
+ * @type {?}
293
+ * @private
294
+ */
295
+ DaffExternalRouter.prototype.runtimeRoutes;
296
+ }
297
+
298
+ /**
299
+ * @fileoverview added by tsickle
300
+ * Generated from: router/strategies/insert-data-path.ts
301
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
302
+ */
303
+ /**
304
+ * Tests whether or not a route matches a specific Daffodil Route type.
305
+ *
306
+ * See {\@link DaffRouteWithDataPath}
307
+ * @type {?}
308
+ */
309
+ const routeMatchesRouteType = (/**
310
+ * @param {?} route
311
+ * @param {?} type
312
+ * @return {?}
313
+ */
314
+ (route, type) => { var _a; return ((_a = route === null || route === void 0 ? void 0 : route.data) === null || _a === void 0 ? void 0 : _a.daffExternalRouteType) === type; });
315
+ const ɵ0 = routeMatchesRouteType;
316
+ /**
317
+ * Adds a path to the `daffPaths` of the given route.
318
+ *
319
+ * See {\@link DaffRouteWithDataPath}
320
+ * @type {?}
321
+ */
322
+ const addRouteToDaffPaths = (/**
323
+ * @param {?} route
324
+ * @param {?} path
325
+ * @return {?}
326
+ */
327
+ (route, path) => route.data.daffPaths = Object.assign(Object.assign({}, route.data.daffPaths), { [path]: path }));
328
+ const ɵ1 = addRouteToDaffPaths;
329
+ /** @type {?} */
330
+ const operateOnRoute = (/**
331
+ * @param {?} externalRoute
332
+ * @return {?}
333
+ */
334
+ (externalRoute) => (/**
335
+ * @param {?} route
336
+ * @return {?}
337
+ */
338
+ (route) => addRouteToDaffPaths(route, externalRoute.path)));
339
+ const ɵ2 = operateOnRoute;
340
+ /**
341
+ * Traverse the router config tree, halting after the first match.
342
+ * This traversal is implemented in a pre-order manner. As such, for large
343
+ * configuration trees, it will be most efficient to place externally routed
344
+ * components at the top of router configuration.
345
+ * @type {?}
346
+ */
347
+ const traverseRouteTree = (/**
348
+ * @param {?=} routes
349
+ * @param {?=} matcher
350
+ * @param {?=} operate
351
+ * @return {?}
352
+ */
353
+ (routes = [], matcher, operate) => {
354
+ if (routes.length === 0) {
355
+ return routes;
356
+ }
357
+ /** @type {?} */
358
+ const stack = [];
359
+ /** @type {?} */
360
+ const treeRoot = { children: routes };
361
+ stack.push(treeRoot);
362
+ while (stack.length) {
363
+ /** @type {?} */
364
+ const route = stack.pop();
365
+ if (matcher(route)) {
366
+ operate(route);
367
+ break;
368
+ }
369
+ if (route.children) {
370
+ stack.push(...route.children.reverse());
371
+ }
372
+ }
373
+ return routes;
374
+ });
375
+ const ɵ3 = traverseRouteTree;
376
+ /**
377
+ * A route insertion strategy that can be used to append external routes onto
378
+ * existing Angular routes. This can be useful when you need to route to
379
+ * an existing lazy-loaded module from multiple externally defined urls.
380
+ *
381
+ * This should be used in combination with the {\@link daffDataPathUrlMatcher} to match lazy-loaded modules with
382
+ * associated external urls.
383
+ *
384
+ * For example, you can provide the insertion strategy in the {\@link DaffExternalRouterModule} as below.
385
+ *
386
+ * ```ts
387
+ * DaffExternalRouterModule.forRoot({}, [
388
+ * {
389
+ * type: 'CATEGORY',
390
+ * insertionStrategy: daffInsertDataPathStrategy,
391
+ * route: {}
392
+ * }
393
+ * ],
394
+ * ```
395
+ *
396
+ * Then, you can match it with an associated route defined in your Routing
397
+ * configuration with the {\@link daffDataPathUrlMatcher}.
398
+ *
399
+ * ```ts
400
+ * export const routes: Routes = [
401
+ * {
402
+ * matcher: daffDataPathUrlMatcher,
403
+ * data: {
404
+ * daffExternalRouteType: "CATEGORY",
405
+ * },
406
+ * loadChildren: () => import('./category/category.module').then((m) => m.MyCategoryModule),
407
+ * }
408
+ * ]
409
+ * ```
410
+ *
411
+ * See {\@link DaffRouteWithDataPath}
412
+ *
413
+ * @type {?}
414
+ */
415
+ const daffInsertDataPathStrategy = (/**
416
+ * @param {?} externalRoute
417
+ * @param {?} routes
418
+ * @return {?}
419
+ */
420
+ (externalRoute, routes) => traverseRouteTree(routes, (/**
421
+ * @param {?} route
422
+ * @return {?}
423
+ */
424
+ (route) => { var _a; return routeMatchesRouteType(route, (_a = externalRoute.data) === null || _a === void 0 ? void 0 : _a.daffExternalRouteType); }), operateOnRoute(externalRoute)));
425
+
426
+ /**
427
+ * @fileoverview added by tsickle
428
+ * Generated from: router/url-matcher/data-path-matcher.ts
429
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
430
+ */
431
+ /**
432
+ * A UrlMatcher that does an exact match against a path stored in the special
433
+ * configuration fields that External Router stores on a Route's data.
434
+ *
435
+ * ```ts
436
+ * export const routes: Routes = [
437
+ * {
438
+ * matcher: daffDataPathUrlMatcher,
439
+ * data: {
440
+ * daffExternalRouteType: "CATEGORY",
441
+ * },
442
+ * loadChildren: () => import('./category/category.module').then((m) => m.ShopCategoryModule),
443
+ * }
444
+ * ]
445
+ * ```
446
+ * {\@link daffInsertDataPathStrategy }
447
+ * {\@link DaffRouteWithDataPath }
448
+ * @type {?}
449
+ */
450
+ const daffDataPathUrlMatcher = (/**
451
+ * @param {?} segments
452
+ * @param {?} group
453
+ * @param {?} route
454
+ * @return {?}
455
+ */
456
+ (segments, group, route) => {
457
+ var _a;
458
+ /** @type {?} */
459
+ const path = daffUriTruncateLeadingSlash(segments.reduce((/**
460
+ * @param {?} acc
461
+ * @param {?} segment
462
+ * @return {?}
463
+ */
464
+ (acc, segment) => acc + '/' + segment.path), ''));
465
+ /** @type {?} */
466
+ const paths = (_a = route === null || route === void 0 ? void 0 : route.data) === null || _a === void 0 ? void 0 : _a.daffPaths;
467
+ // If we don't have any paths, we can safely fail a match.
468
+ if (!paths) {
469
+ return null;
470
+ }
471
+ // Otherwise, look up the path in the dictionary, failing if a match isn't found,
472
+ // but matching the entire segment if a match is found.
473
+ return path in paths ? { consumed: segments } : null;
474
+ });
475
+
476
+ /**
477
+ * @fileoverview added by tsickle
478
+ * Generated from: public_api.ts
479
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
480
+ */
481
+
482
+ /**
483
+ * @fileoverview added by tsickle
484
+ * Generated from: daffodil-external-router.ts
485
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
486
+ */
487
+
488
+ export { DAFF_EXTERNAL_ROUTER_CONFIG, DaffExternalRouter, DaffExternalRouterModule, DaffExternalRouterNoWildcardError, DaffExternalRouterUnknownRouteTypeError, daffDataPathUrlMatcher, daffInsertDataPathStrategy, daffInsertRouteBeforeWildCardStrategy, daffProvideRouteResolvableByType, DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE as ɵa, daffProvideRoutesResolvableByType as ɵb };
489
+ //# sourceMappingURL=daffodil-external-router.js.map