@daffodil/external-router 0.39.13 → 0.40.1

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 (201) hide show
  1. package/daffodil-external-router.d.ts +1 -1
  2. package/driver/daffodil-external-router-driver.d.ts +1 -0
  3. package/driver/in-memory/daffodil-external-router-driver-in-memory.d.ts +1 -1
  4. package/driver/in-memory/in-memory.module.d.ts +5 -0
  5. package/driver/in-memory/in-memory.service.d.ts +3 -0
  6. package/driver/in-memory/package.json +5 -6
  7. package/driver/magento/2.4.1/daffodil-external-router-driver-magento-2.4.1.d.ts +1 -1
  8. package/driver/magento/2.4.1/graphql/queries/resolve-url-v2.4.1.d.ts +1 -1
  9. package/driver/magento/2.4.1/magento.module.d.ts +5 -0
  10. package/driver/magento/2.4.1/magento.service.d.ts +4 -1
  11. package/driver/magento/2.4.1/package.json +5 -6
  12. package/driver/magento/2.4.2/daffodil-external-router-driver-magento-2.4.2.d.ts +1 -1
  13. package/driver/magento/2.4.2/graphql/queries/resolve-url-v2.4.2.d.ts +1 -1
  14. package/driver/magento/2.4.2/magento.module.d.ts +5 -0
  15. package/driver/magento/2.4.2/magento.service.d.ts +4 -1
  16. package/driver/magento/2.4.2/package.json +5 -6
  17. package/driver/magento/daffodil-external-router-driver-magento.d.ts +1 -0
  18. package/driver/magento/package.json +5 -6
  19. package/driver/package.json +5 -6
  20. package/driver/testing/daffodil-external-router-driver-testing.d.ts +1 -1
  21. package/driver/testing/package.json +5 -6
  22. package/driver/testing/testing.module.d.ts +5 -0
  23. package/driver/testing/testing.service.d.ts +3 -0
  24. package/{esm2015/config.js → esm2020/config.mjs} +0 -0
  25. package/esm2020/daffodil-external-router.mjs +5 -0
  26. package/{esm2015/driver/daffodil-external-router-driver.js → esm2020/driver/daffodil-external-router-driver.mjs} +0 -0
  27. package/esm2020/driver/in-memory/config.mjs +15 -0
  28. package/{esm2015/driver/in-memory/daffodil-external-router-driver-in-memory.js → esm2020/driver/in-memory/daffodil-external-router-driver-in-memory.mjs} +1 -2
  29. package/esm2020/driver/in-memory/in-memory.module.mjs +41 -0
  30. package/esm2020/driver/in-memory/in-memory.service.mjs +39 -0
  31. package/{esm2015/driver/in-memory/index.js → esm2020/driver/in-memory/index.mjs} +0 -0
  32. package/{esm2015/driver/in-memory/public_api.js → esm2020/driver/in-memory/public_api.mjs} +0 -0
  33. package/{esm2015/driver/index.js → esm2020/driver/index.mjs} +0 -0
  34. package/{esm2015/driver/interfaces/external-router-driver.interface.js → esm2020/driver/interfaces/external-router-driver.interface.mjs} +0 -0
  35. package/esm2020/driver/magento/2.4.1/daffodil-external-router-driver-magento-2.4.1.mjs +5 -0
  36. package/{esm2015/driver/magento/2.4.1/graphql/queries/resolve-url-v2.4.1.js → esm2020/driver/magento/2.4.1/graphql/queries/resolve-url-v2.4.1.mjs} +2 -2
  37. package/{esm2015/driver/magento/2.4.1/index.js → esm2020/driver/magento/2.4.1/index.mjs} +0 -0
  38. package/esm2020/driver/magento/2.4.1/magento.module.mjs +55 -0
  39. package/esm2020/driver/magento/2.4.1/magento.service.mjs +38 -0
  40. package/{esm2015/driver/magento/2.4.1/public_api.js → esm2020/driver/magento/2.4.1/public_api.mjs} +0 -0
  41. package/esm2020/driver/magento/2.4.1/transforms/resolution-to-resolvable-url.mjs +10 -0
  42. package/esm2020/driver/magento/2.4.2/daffodil-external-router-driver-magento-2.4.2.mjs +5 -0
  43. package/{esm2015/driver/magento/2.4.2/graphql/queries/resolve-url-v2.4.2.js → esm2020/driver/magento/2.4.2/graphql/queries/resolve-url-v2.4.2.mjs} +2 -2
  44. package/{esm2015/driver/magento/2.4.2/index.js → esm2020/driver/magento/2.4.2/index.mjs} +0 -0
  45. package/esm2020/driver/magento/2.4.2/magento.module.mjs +55 -0
  46. package/esm2020/driver/magento/2.4.2/magento.service.mjs +37 -0
  47. package/{esm2015/driver/magento/2.4.2/public_api.js → esm2020/driver/magento/2.4.2/public_api.mjs} +0 -0
  48. package/{esm2015/driver/magento/2.4.2/transforms/resolution-to-resolvable-url.js → esm2020/driver/magento/2.4.2/transforms/resolution-to-resolvable-url.mjs} +0 -0
  49. package/{esm2015/driver/magento/daffodil-external-router-driver-magento.js → esm2020/driver/magento/daffodil-external-router-driver-magento.mjs} +0 -0
  50. package/{esm2015/driver/magento/index.js → esm2020/driver/magento/index.mjs} +0 -0
  51. package/{esm2015/driver/magento/model/public_api.js → esm2020/driver/magento/model/public_api.mjs} +0 -0
  52. package/{esm2015/driver/magento/model/resolution-types.js → esm2020/driver/magento/model/resolution-types.mjs} +0 -0
  53. package/{esm2015/driver/magento/model/url-resolver-response.js → esm2020/driver/magento/model/url-resolver-response.mjs} +0 -0
  54. package/{esm2015/driver/magento/model/url-resolver.js → esm2020/driver/magento/model/url-resolver.mjs} +0 -0
  55. package/{esm2015/driver/magento/public_api.js → esm2020/driver/magento/public_api.mjs} +0 -0
  56. package/{esm2015/driver/magento/transforms/public_api.js → esm2020/driver/magento/transforms/public_api.mjs} +0 -0
  57. package/{esm2015/driver/magento/transforms/redirect-to-http.js → esm2020/driver/magento/transforms/redirect-to-http.mjs} +0 -0
  58. package/{esm2015/driver/not-found-resolution.js → esm2020/driver/not-found-resolution.mjs} +0 -0
  59. package/{esm2015/driver/public_api.js → esm2020/driver/public_api.mjs} +0 -0
  60. package/{esm2015/driver/testing/config.js → esm2020/driver/testing/config.mjs} +0 -0
  61. package/esm2020/driver/testing/daffodil-external-router-driver-testing.mjs +5 -0
  62. package/{esm2015/driver/testing/index.js → esm2020/driver/testing/index.mjs} +0 -0
  63. package/{esm2015/driver/testing/public_api.js → esm2020/driver/testing/public_api.mjs} +0 -0
  64. package/esm2020/driver/testing/testing.module.mjs +38 -0
  65. package/esm2020/driver/testing/testing.service.mjs +45 -0
  66. package/{esm2015/errors/no-wildcard.js → esm2020/errors/no-wildcard.mjs} +0 -0
  67. package/{esm2015/errors/unknown-type.js → esm2020/errors/unknown-type.mjs} +0 -0
  68. package/esm2020/external-router.module.mjs +31 -0
  69. package/{esm2015/model/insertion-strategy.type.js → esm2020/model/insertion-strategy.type.mjs} +0 -0
  70. package/{esm2015/model/public_api.js → esm2020/model/public_api.mjs} +0 -0
  71. package/{esm2015/model/resolvable-route.js → esm2020/model/resolvable-route.mjs} +0 -0
  72. package/{esm2015/model/route-info.js → esm2020/model/route-info.mjs} +0 -0
  73. package/{esm2015/model/route-type.js → esm2020/model/route-type.mjs} +0 -0
  74. package/{esm2015/model/route-with-data-path.js → esm2020/model/route-with-data-path.mjs} +0 -0
  75. package/{esm2015/model/route-without-path.js → esm2020/model/route-without-path.mjs} +0 -0
  76. package/{esm2015/model/type-route-pair.js → esm2020/model/type-route-pair.mjs} +0 -0
  77. package/{esm2015/public_api.js → esm2020/public_api.mjs} +0 -0
  78. package/esm2020/router/router.service.mjs +43 -0
  79. package/esm2020/router/strategies/insert-data-path.mjs +81 -0
  80. package/{esm2015/router/strategies/insert-route-before-wildcard.js → esm2020/router/strategies/insert-route-before-wildcard.mjs} +0 -0
  81. package/esm2020/router/url-matcher/data-path-matcher.mjs +31 -0
  82. package/{esm2015/routing/daffodil-external-router-routing.js → esm2020/routing/daffodil-external-router-routing.mjs} +0 -0
  83. package/{esm2015/routing/errors/client-error.js → esm2020/routing/errors/client-error.mjs} +0 -0
  84. package/{esm2015/routing/errors/not-found-error.js → esm2020/routing/errors/not-found-error.mjs} +0 -0
  85. package/{esm2015/routing/errors/permanent-redirect.js → esm2020/routing/errors/permanent-redirect.mjs} +0 -0
  86. package/{esm2015/routing/errors/server-error.js → esm2020/routing/errors/server-error.mjs} +0 -0
  87. package/{esm2015/routing/errors/temporary-redirect.js → esm2020/routing/errors/temporary-redirect.mjs} +0 -0
  88. package/esm2020/routing/guard/existence.guard.mjs +77 -0
  89. package/{esm2015/routing/index.js → esm2020/routing/index.mjs} +0 -0
  90. package/{esm2015/routing/processors/process-errors.js → esm2020/routing/processors/process-errors.mjs} +0 -0
  91. package/{esm2015/routing/processors/process-redirect.js → esm2020/routing/processors/process-redirect.mjs} +0 -0
  92. package/{esm2015/routing/public_api.js → esm2020/routing/public_api.mjs} +0 -0
  93. package/{esm2015/token/type-resolvable-routes.token.js → esm2020/token/type-resolvable-routes.token.mjs} +0 -0
  94. package/esm2020/transform/resolved-route-to-route.mjs +24 -0
  95. package/external-router.module.d.ts +5 -0
  96. package/fesm2015/{daffodil-external-router-driver-in-memory.js → daffodil-external-router-driver-in-memory.mjs} +28 -21
  97. package/fesm2015/daffodil-external-router-driver-in-memory.mjs.map +1 -0
  98. package/fesm2015/{daffodil-external-router-driver-magento-2.4.1.js → daffodil-external-router-driver-magento-2.4.1.mjs} +24 -20
  99. package/fesm2015/daffodil-external-router-driver-magento-2.4.1.mjs.map +1 -0
  100. package/fesm2015/{daffodil-external-router-driver-magento-2.4.2.js → daffodil-external-router-driver-magento-2.4.2.mjs} +24 -20
  101. package/fesm2015/daffodil-external-router-driver-magento-2.4.2.mjs.map +1 -0
  102. package/fesm2015/{daffodil-external-router-driver-magento.js → daffodil-external-router-driver-magento.mjs} +1 -1
  103. package/fesm2015/daffodil-external-router-driver-magento.mjs.map +1 -0
  104. package/fesm2015/daffodil-external-router-driver-testing.mjs +101 -0
  105. package/fesm2015/daffodil-external-router-driver-testing.mjs.map +1 -0
  106. package/fesm2015/{daffodil-external-router-driver.js → daffodil-external-router-driver.mjs} +1 -1
  107. package/fesm2015/daffodil-external-router-driver.mjs.map +1 -0
  108. package/fesm2015/daffodil-external-router-routing.mjs +173 -0
  109. package/fesm2015/daffodil-external-router-routing.mjs.map +1 -0
  110. package/fesm2015/{daffodil-external-router.js → daffodil-external-router.mjs} +28 -25
  111. package/fesm2015/daffodil-external-router.mjs.map +1 -0
  112. package/fesm2020/daffodil-external-router-driver-in-memory.mjs +98 -0
  113. package/fesm2020/daffodil-external-router-driver-in-memory.mjs.map +1 -0
  114. package/fesm2020/daffodil-external-router-driver-magento-2.4.1.mjs +122 -0
  115. package/fesm2020/daffodil-external-router-driver-magento-2.4.1.mjs.map +1 -0
  116. package/fesm2020/daffodil-external-router-driver-magento-2.4.2.mjs +122 -0
  117. package/fesm2020/daffodil-external-router-driver-magento-2.4.2.mjs.map +1 -0
  118. package/fesm2020/daffodil-external-router-driver-magento.mjs +22 -0
  119. package/fesm2020/daffodil-external-router-driver-magento.mjs.map +1 -0
  120. package/fesm2020/daffodil-external-router-driver-testing.mjs +99 -0
  121. package/fesm2020/daffodil-external-router-driver-testing.mjs.map +1 -0
  122. package/fesm2020/daffodil-external-router-driver.mjs +30 -0
  123. package/fesm2020/daffodil-external-router-driver.mjs.map +1 -0
  124. package/{fesm2015/daffodil-external-router-routing.js → fesm2020/daffodil-external-router-routing.mjs} +21 -19
  125. package/fesm2020/daffodil-external-router-routing.mjs.map +1 -0
  126. package/fesm2020/daffodil-external-router.mjs +291 -0
  127. package/fesm2020/daffodil-external-router.mjs.map +1 -0
  128. package/package.json +82 -14
  129. package/router/router.service.d.ts +3 -0
  130. package/routing/daffodil-external-router-routing.d.ts +1 -0
  131. package/routing/guard/existence.guard.d.ts +3 -0
  132. package/routing/package.json +5 -6
  133. package/bundles/daffodil-external-router-driver-in-memory.umd.js +0 -100
  134. package/bundles/daffodil-external-router-driver-in-memory.umd.js.map +0 -1
  135. package/bundles/daffodil-external-router-driver-in-memory.umd.min.js +0 -2
  136. package/bundles/daffodil-external-router-driver-in-memory.umd.min.js.map +0 -1
  137. package/bundles/daffodil-external-router-driver-magento-2.4.1.umd.js +0 -438
  138. package/bundles/daffodil-external-router-driver-magento-2.4.1.umd.js.map +0 -1
  139. package/bundles/daffodil-external-router-driver-magento-2.4.1.umd.min.js +0 -16
  140. package/bundles/daffodil-external-router-driver-magento-2.4.1.umd.min.js.map +0 -1
  141. package/bundles/daffodil-external-router-driver-magento-2.4.2.umd.js +0 -435
  142. package/bundles/daffodil-external-router-driver-magento-2.4.2.umd.js.map +0 -1
  143. package/bundles/daffodil-external-router-driver-magento-2.4.2.umd.min.js +0 -16
  144. package/bundles/daffodil-external-router-driver-magento-2.4.2.umd.min.js.map +0 -1
  145. package/bundles/daffodil-external-router-driver-magento.umd.js +0 -31
  146. package/bundles/daffodil-external-router-driver-magento.umd.js.map +0 -1
  147. package/bundles/daffodil-external-router-driver-magento.umd.min.js +0 -2
  148. package/bundles/daffodil-external-router-driver-magento.umd.min.js.map +0 -1
  149. package/bundles/daffodil-external-router-driver-testing.umd.js +0 -101
  150. package/bundles/daffodil-external-router-driver-testing.umd.js.map +0 -1
  151. package/bundles/daffodil-external-router-driver-testing.umd.min.js +0 -2
  152. package/bundles/daffodil-external-router-driver-testing.umd.min.js.map +0 -1
  153. package/bundles/daffodil-external-router-driver.umd.js +0 -39
  154. package/bundles/daffodil-external-router-driver.umd.js.map +0 -1
  155. package/bundles/daffodil-external-router-driver.umd.min.js +0 -2
  156. package/bundles/daffodil-external-router-driver.umd.min.js.map +0 -1
  157. package/bundles/daffodil-external-router-routing.umd.js +0 -505
  158. package/bundles/daffodil-external-router-routing.umd.js.map +0 -1
  159. package/bundles/daffodil-external-router-routing.umd.min.js +0 -16
  160. package/bundles/daffodil-external-router-routing.umd.min.js.map +0 -1
  161. package/bundles/daffodil-external-router.umd.js +0 -625
  162. package/bundles/daffodil-external-router.umd.js.map +0 -1
  163. package/bundles/daffodil-external-router.umd.min.js +0 -16
  164. package/bundles/daffodil-external-router.umd.min.js.map +0 -1
  165. package/daffodil-external-router.metadata.json +0 -1
  166. package/driver/daffodil-external-router-driver.metadata.json +0 -1
  167. package/driver/in-memory/daffodil-external-router-driver-in-memory.metadata.json +0 -1
  168. package/driver/magento/2.4.1/daffodil-external-router-driver-magento-2.4.1.metadata.json +0 -1
  169. package/driver/magento/2.4.2/daffodil-external-router-driver-magento-2.4.2.metadata.json +0 -1
  170. package/driver/magento/daffodil-external-router-driver-magento.metadata.json +0 -1
  171. package/driver/testing/daffodil-external-router-driver-testing.metadata.json +0 -1
  172. package/esm2015/daffodil-external-router.js +0 -6
  173. package/esm2015/driver/in-memory/config.js +0 -17
  174. package/esm2015/driver/in-memory/in-memory.module.js +0 -36
  175. package/esm2015/driver/in-memory/in-memory.service.js +0 -36
  176. package/esm2015/driver/magento/2.4.1/daffodil-external-router-driver-magento-2.4.1.js +0 -6
  177. package/esm2015/driver/magento/2.4.1/magento.module.js +0 -50
  178. package/esm2015/driver/magento/2.4.1/magento.service.js +0 -40
  179. package/esm2015/driver/magento/2.4.1/transforms/resolution-to-resolvable-url.js +0 -13
  180. package/esm2015/driver/magento/2.4.2/daffodil-external-router-driver-magento-2.4.2.js +0 -6
  181. package/esm2015/driver/magento/2.4.2/magento.module.js +0 -50
  182. package/esm2015/driver/magento/2.4.2/magento.service.js +0 -39
  183. package/esm2015/driver/testing/daffodil-external-router-driver-testing.js +0 -6
  184. package/esm2015/driver/testing/testing.module.js +0 -33
  185. package/esm2015/driver/testing/testing.service.js +0 -45
  186. package/esm2015/external-router.module.js +0 -26
  187. package/esm2015/router/router.service.js +0 -44
  188. package/esm2015/router/strategies/insert-data-path.js +0 -83
  189. package/esm2015/router/url-matcher/data-path-matcher.js +0 -32
  190. package/esm2015/routing/guard/existence.guard.js +0 -78
  191. package/esm2015/transform/resolved-route-to-route.js +0 -17
  192. package/fesm2015/daffodil-external-router-driver-in-memory.js.map +0 -1
  193. package/fesm2015/daffodil-external-router-driver-magento-2.4.1.js.map +0 -1
  194. package/fesm2015/daffodil-external-router-driver-magento-2.4.2.js.map +0 -1
  195. package/fesm2015/daffodil-external-router-driver-magento.js.map +0 -1
  196. package/fesm2015/daffodil-external-router-driver-testing.js +0 -93
  197. package/fesm2015/daffodil-external-router-driver-testing.js.map +0 -1
  198. package/fesm2015/daffodil-external-router-driver.js.map +0 -1
  199. package/fesm2015/daffodil-external-router-routing.js.map +0 -1
  200. package/fesm2015/daffodil-external-router.js.map +0 -1
  201. package/routing/daffodil-external-router-routing.metadata.json +0 -1
@@ -1,625 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@angular/router'), require('@daffodil/core'), require('@daffodil/core/routing')) :
3
- typeof define === 'function' && define.amd ? define('@daffodil/external-router', ['exports', '@angular/common', '@angular/core', '@angular/router', '@daffodil/core', '@daffodil/core/routing'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.daffodil = global.daffodil || {}, global.daffodil['external-router'] = {}), global.ng.common, global.ng.core, global.ng.router, global.core, global.routing));
5
- }(this, (function (exports, common, i0, i1, core, routing) { 'use strict';
6
-
7
- /*! *****************************************************************************
8
- Copyright (c) Microsoft Corporation.
9
-
10
- Permission to use, copy, modify, and/or distribute this software for any
11
- purpose with or without fee is hereby granted.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
14
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
16
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
18
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19
- PERFORMANCE OF THIS SOFTWARE.
20
- ***************************************************************************** */
21
- /* global Reflect, Promise */
22
- var extendStatics = function (d, b) {
23
- extendStatics = Object.setPrototypeOf ||
24
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
25
- function (d, b) { for (var p in b)
26
- if (Object.prototype.hasOwnProperty.call(b, p))
27
- d[p] = b[p]; };
28
- return extendStatics(d, b);
29
- };
30
- function __extends(d, b) {
31
- if (typeof b !== "function" && b !== null)
32
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
33
- extendStatics(d, b);
34
- function __() { this.constructor = d; }
35
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
36
- }
37
- var __assign = function () {
38
- __assign = Object.assign || function __assign(t) {
39
- for (var s, i = 1, n = arguments.length; i < n; i++) {
40
- s = arguments[i];
41
- for (var p in s)
42
- if (Object.prototype.hasOwnProperty.call(s, p))
43
- t[p] = s[p];
44
- }
45
- return t;
46
- };
47
- return __assign.apply(this, arguments);
48
- };
49
- function __rest(s, e) {
50
- var t = {};
51
- for (var p in s)
52
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
53
- t[p] = s[p];
54
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
55
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
56
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
57
- t[p[i]] = s[p[i]];
58
- }
59
- return t;
60
- }
61
- function __decorate(decorators, target, key, desc) {
62
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
63
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
64
- r = Reflect.decorate(decorators, target, key, desc);
65
- else
66
- for (var i = decorators.length - 1; i >= 0; i--)
67
- if (d = decorators[i])
68
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
69
- return c > 3 && r && Object.defineProperty(target, key, r), r;
70
- }
71
- function __param(paramIndex, decorator) {
72
- return function (target, key) { decorator(target, key, paramIndex); };
73
- }
74
- function __metadata(metadataKey, metadataValue) {
75
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
76
- return Reflect.metadata(metadataKey, metadataValue);
77
- }
78
- function __awaiter(thisArg, _arguments, P, generator) {
79
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
80
- return new (P || (P = Promise))(function (resolve, reject) {
81
- function fulfilled(value) { try {
82
- step(generator.next(value));
83
- }
84
- catch (e) {
85
- reject(e);
86
- } }
87
- function rejected(value) { try {
88
- step(generator["throw"](value));
89
- }
90
- catch (e) {
91
- reject(e);
92
- } }
93
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
94
- step((generator = generator.apply(thisArg, _arguments || [])).next());
95
- });
96
- }
97
- function __generator(thisArg, body) {
98
- var _ = { label: 0, sent: function () { if (t[0] & 1)
99
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
100
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
101
- function verb(n) { return function (v) { return step([n, v]); }; }
102
- function step(op) {
103
- if (f)
104
- throw new TypeError("Generator is already executing.");
105
- while (_)
106
- try {
107
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
108
- return t;
109
- if (y = 0, t)
110
- op = [op[0] & 2, t.value];
111
- switch (op[0]) {
112
- case 0:
113
- case 1:
114
- t = op;
115
- break;
116
- case 4:
117
- _.label++;
118
- return { value: op[1], done: false };
119
- case 5:
120
- _.label++;
121
- y = op[1];
122
- op = [0];
123
- continue;
124
- case 7:
125
- op = _.ops.pop();
126
- _.trys.pop();
127
- continue;
128
- default:
129
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
130
- _ = 0;
131
- continue;
132
- }
133
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
134
- _.label = op[1];
135
- break;
136
- }
137
- if (op[0] === 6 && _.label < t[1]) {
138
- _.label = t[1];
139
- t = op;
140
- break;
141
- }
142
- if (t && _.label < t[2]) {
143
- _.label = t[2];
144
- _.ops.push(op);
145
- break;
146
- }
147
- if (t[2])
148
- _.ops.pop();
149
- _.trys.pop();
150
- continue;
151
- }
152
- op = body.call(thisArg, _);
153
- }
154
- catch (e) {
155
- op = [6, e];
156
- y = 0;
157
- }
158
- finally {
159
- f = t = 0;
160
- }
161
- if (op[0] & 5)
162
- throw op[1];
163
- return { value: op[0] ? op[1] : void 0, done: true };
164
- }
165
- }
166
- var __createBinding = Object.create ? (function (o, m, k, k2) {
167
- if (k2 === undefined)
168
- k2 = k;
169
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
170
- }) : (function (o, m, k, k2) {
171
- if (k2 === undefined)
172
- k2 = k;
173
- o[k2] = m[k];
174
- });
175
- function __exportStar(m, o) {
176
- for (var p in m)
177
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
178
- __createBinding(o, m, p);
179
- }
180
- function __values(o) {
181
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
182
- if (m)
183
- return m.call(o);
184
- if (o && typeof o.length === "number")
185
- return {
186
- next: function () {
187
- if (o && i >= o.length)
188
- o = void 0;
189
- return { value: o && o[i++], done: !o };
190
- }
191
- };
192
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
193
- }
194
- function __read(o, n) {
195
- var m = typeof Symbol === "function" && o[Symbol.iterator];
196
- if (!m)
197
- return o;
198
- var i = m.call(o), r, ar = [], e;
199
- try {
200
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
201
- ar.push(r.value);
202
- }
203
- catch (error) {
204
- e = { error: error };
205
- }
206
- finally {
207
- try {
208
- if (r && !r.done && (m = i["return"]))
209
- m.call(i);
210
- }
211
- finally {
212
- if (e)
213
- throw e.error;
214
- }
215
- }
216
- return ar;
217
- }
218
- /** @deprecated */
219
- function __spread() {
220
- for (var ar = [], i = 0; i < arguments.length; i++)
221
- ar = ar.concat(__read(arguments[i]));
222
- return ar;
223
- }
224
- /** @deprecated */
225
- function __spreadArrays() {
226
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
227
- s += arguments[i].length;
228
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
229
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
230
- r[k] = a[j];
231
- return r;
232
- }
233
- function __spreadArray(to, from, pack) {
234
- if (pack || arguments.length === 2)
235
- for (var i = 0, l = from.length, ar; i < l; i++) {
236
- if (ar || !(i in from)) {
237
- if (!ar)
238
- ar = Array.prototype.slice.call(from, 0, i);
239
- ar[i] = from[i];
240
- }
241
- }
242
- return to.concat(ar || Array.prototype.slice.call(from));
243
- }
244
- function __await(v) {
245
- return this instanceof __await ? (this.v = v, this) : new __await(v);
246
- }
247
- function __asyncGenerator(thisArg, _arguments, generator) {
248
- if (!Symbol.asyncIterator)
249
- throw new TypeError("Symbol.asyncIterator is not defined.");
250
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
251
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
252
- function verb(n) { if (g[n])
253
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
254
- function resume(n, v) { try {
255
- step(g[n](v));
256
- }
257
- catch (e) {
258
- settle(q[0][3], e);
259
- } }
260
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
261
- function fulfill(value) { resume("next", value); }
262
- function reject(value) { resume("throw", value); }
263
- function settle(f, v) { if (f(v), q.shift(), q.length)
264
- resume(q[0][0], q[0][1]); }
265
- }
266
- function __asyncDelegator(o) {
267
- var i, p;
268
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
269
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
270
- }
271
- function __asyncValues(o) {
272
- if (!Symbol.asyncIterator)
273
- throw new TypeError("Symbol.asyncIterator is not defined.");
274
- var m = o[Symbol.asyncIterator], i;
275
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
276
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
277
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
278
- }
279
- function __makeTemplateObject(cooked, raw) {
280
- if (Object.defineProperty) {
281
- Object.defineProperty(cooked, "raw", { value: raw });
282
- }
283
- else {
284
- cooked.raw = raw;
285
- }
286
- return cooked;
287
- }
288
- ;
289
- var __setModuleDefault = Object.create ? (function (o, v) {
290
- Object.defineProperty(o, "default", { enumerable: true, value: v });
291
- }) : function (o, v) {
292
- o["default"] = v;
293
- };
294
- function __importStar(mod) {
295
- if (mod && mod.__esModule)
296
- return mod;
297
- var result = {};
298
- if (mod != null)
299
- for (var k in mod)
300
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
301
- __createBinding(result, mod, k);
302
- __setModuleDefault(result, mod);
303
- return result;
304
- }
305
- function __importDefault(mod) {
306
- return (mod && mod.__esModule) ? mod : { default: mod };
307
- }
308
- function __classPrivateFieldGet(receiver, state, kind, f) {
309
- if (kind === "a" && !f)
310
- throw new TypeError("Private accessor was defined without a getter");
311
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
312
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
313
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
314
- }
315
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
316
- if (kind === "m")
317
- throw new TypeError("Private method is not writable");
318
- if (kind === "a" && !f)
319
- throw new TypeError("Private accessor was defined without a setter");
320
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
321
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
322
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
323
- }
324
-
325
- var daffExternalRouterConfigurationDefault = {
326
- failedResolutionPath: '/',
327
- notFoundResolutionPath: '/',
328
- };
329
- /**
330
- * The token holding the runtime configuration for the behavior of the
331
- * `@daffodil/external-router` package.
332
- */
333
- var DAFF_EXTERNAL_ROUTER_CONFIG = new i0.InjectionToken('DAFF_EXTERNAL_ROUTER_CONFIG', {
334
- providedIn: 'root',
335
- factory: function () { return daffExternalRouterConfigurationDefault; },
336
- });
337
-
338
- /**
339
- * A multi-token that allows you to register route "types" that correspond to routes.
340
- */
341
- var DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE = new i0.InjectionToken('DAFF_EXTERNAL_ROUTER_RESOLVABLE_TYPE_ROUTES', {
342
- providedIn: 'root',
343
- factory: function () { return []; },
344
- });
345
- /**
346
- * A provider used to connect a type to a route to enable dynamic route resolution at runtime.
347
- */
348
- function daffProvideRouteResolvableByType(typeRoutePair) {
349
- return {
350
- provide: DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE,
351
- multi: true,
352
- useValue: typeRoutePair,
353
- };
354
- }
355
- /**
356
- * A multi-provider used to connect an array of types to their respective routes.
357
- */
358
- function daffProvideRoutesResolvableByType(routes) {
359
- return routes.map(function (route) { return ({
360
- provide: DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE,
361
- multi: true,
362
- useValue: route,
363
- }); });
364
- }
365
-
366
- /**
367
- * The external `DaffExternalRouterModule` allows you to configure the
368
- * `@daffodil/external-router` package's behavior.
369
- */
370
- var DaffExternalRouterModule = /** @class */ (function () {
371
- function DaffExternalRouterModule() {
372
- }
373
- DaffExternalRouterModule.forRoot = function (config, routes) {
374
- if (routes === void 0) { routes = []; }
375
- return {
376
- ngModule: DaffExternalRouterModule,
377
- providers: __spread([
378
- { provide: DAFF_EXTERNAL_ROUTER_CONFIG, useValue: Object.assign(Object.assign({}, daffExternalRouterConfigurationDefault), config) }
379
- ], daffProvideRoutesResolvableByType(routes)),
380
- };
381
- };
382
- return DaffExternalRouterModule;
383
- }());
384
- DaffExternalRouterModule.decorators = [
385
- { type: i0.NgModule, args: [{
386
- declarations: [],
387
- imports: [common.CommonModule],
388
- },] }
389
- ];
390
-
391
- /**
392
- * An error thrown when there was no wildcard route found in configuration
393
- * of the Angular Router.
394
- */
395
- var DaffExternalRouterNoWildcardError = /** @class */ (function (_super) {
396
- __extends(DaffExternalRouterNoWildcardError, _super);
397
- function DaffExternalRouterNoWildcardError(message) {
398
- var _this = _super.call(this, message) || this;
399
- _this.code = 'NO_WILDCARD_ROUTE';
400
- return _this;
401
- }
402
- return DaffExternalRouterNoWildcardError;
403
- }(core.DaffInheritableError));
404
-
405
- /**
406
- * An error thrown when there is a failure matching a configured route to a
407
- * route type.
408
- */
409
- var DaffExternalRouterUnknownRouteTypeError = /** @class */ (function (_super) {
410
- __extends(DaffExternalRouterUnknownRouteTypeError, _super);
411
- function DaffExternalRouterUnknownRouteTypeError(message) {
412
- var _this = _super.call(this, message) || this;
413
- _this.code = 'UNKNOWN_ROUTE_TYPE';
414
- return _this;
415
- }
416
- return DaffExternalRouterUnknownRouteTypeError;
417
- }(core.DaffInheritableError));
418
-
419
- /**
420
- * Transforms a DaffExternallyResolvableUrl into an Angular Route.
421
- */
422
- var daffTransformResolvedRouteToRoute = function (resolvedRoute, availableTypes) {
423
- var routeType = availableTypes
424
- .filter(function (t) { return t.type === resolvedRoute.type; })
425
- .shift();
426
- if (!routeType) {
427
- throw new DaffExternalRouterUnknownRouteTypeError("Unable to resolve the route '" + resolvedRoute.url + "'. Its type is '" + resolvedRoute.type + "' but a matching route wasn't found.");
428
- }
429
- return {
430
- route: Object.assign(Object.assign({ path: resolvedRoute.url }, routeType.route), { data: Object.assign({ daffExternalRouteType: resolvedRoute.type }, routeType.route.data) }),
431
- insertionStrategy: routeType.insertionStrategy,
432
- };
433
- };
434
-
435
- /**
436
- * Inserts a Route into Routes right before the wildcard route.
437
- * If no wildcard is found, it fails fast with a `DaffExternalRouterNoWildcardError`.
438
- */
439
- var daffInsertRouteBeforeWildCardStrategy = function (route, routes) {
440
- var index = routes.findIndex(function (r) { return r.path === '**'; });
441
- if (index === -1) {
442
- throw new DaffExternalRouterNoWildcardError('No wildcard (**) route was found during route resolution.');
443
- }
444
- return __spread(routes.slice(0, index), [
445
- route
446
- ], routes.slice(index));
447
- };
448
-
449
- var DaffExternalRouter = /** @class */ (function () {
450
- function DaffExternalRouter(router, runtimeRoutes) {
451
- this.router = router;
452
- this.runtimeRoutes = runtimeRoutes;
453
- }
454
- /**
455
- * Adds a route to the existing router configuration.
456
- */
457
- DaffExternalRouter.prototype.add = function (resolvedRoute) {
458
- //Get the route.
459
- var _a = daffTransformResolvedRouteToRoute(resolvedRoute, this.runtimeRoutes), route = _a.route, insertionStrategy = _a.insertionStrategy;
460
- try {
461
- //Add it to configuration.
462
- this.router.config = (insertionStrategy || daffInsertRouteBeforeWildCardStrategy)(route, this.router.config);
463
- }
464
- catch (e) {
465
- if (e instanceof DaffExternalRouterNoWildcardError) {
466
- throw new DaffExternalRouterNoWildcardError(e.message + " This usually means you have misconfigured your routes.");
467
- }
468
- throw e;
469
- }
470
- };
471
- return DaffExternalRouter;
472
- }());
473
- /** @nocollapse */ DaffExternalRouter.ɵprov = i0.ɵɵdefineInjectable({ factory: function DaffExternalRouter_Factory() { return new DaffExternalRouter(i0.ɵɵinject(i1.Router), i0.ɵɵinject(DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE)); }, token: DaffExternalRouter, providedIn: "root" });
474
- DaffExternalRouter.decorators = [
475
- { type: i0.Injectable, args: [{
476
- providedIn: 'root',
477
- },] }
478
- ];
479
- /** @nocollapse */
480
- DaffExternalRouter.ctorParameters = function () { return [
481
- { type: i1.Router },
482
- { type: Array, decorators: [{ type: i0.Inject, args: [DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE,] }] }
483
- ]; };
484
-
485
- /**
486
- * Tests whether or not a route matches a specific Daffodil Route type.
487
- *
488
- * See {@link DaffRouteWithDataPath}
489
- */
490
- var routeMatchesRouteType = function (route, type) { var _a; return ((_a = route === null || route === void 0 ? void 0 : route.data) === null || _a === void 0 ? void 0 : _a.daffExternalRouteType) === type; };
491
- var ɵ0 = routeMatchesRouteType;
492
- /**
493
- * Adds a path to the `daffPaths` of the given route.
494
- *
495
- * See {@link DaffRouteWithDataPath}
496
- */
497
- var addRouteToDaffPaths = function (route, path) {
498
- var _b;
499
- return route.data.daffPaths = Object.assign(Object.assign({}, route.data.daffPaths), (_b = {}, _b[path] = path, _b));
500
- };
501
- var ɵ1 = addRouteToDaffPaths;
502
- var operateOnRoute = function (externalRoute) { return function (route) { return addRouteToDaffPaths(route, externalRoute.path); }; };
503
- var ɵ2 = operateOnRoute;
504
- /**
505
- * Traverse the router config tree, halting after the first match.
506
- * This traversal is implemented in a pre-order manner. As such, for large
507
- * configuration trees, it will be most efficient to place externally routed
508
- * components at the top of router configuration.
509
- */
510
- var traverseRouteTree = function (routes, matcher, operate) {
511
- if (routes === void 0) { routes = []; }
512
- if (routes.length === 0) {
513
- return routes;
514
- }
515
- var stack = [];
516
- var treeRoot = { children: routes };
517
- stack.push(treeRoot);
518
- while (stack.length) {
519
- var route = stack.pop();
520
- if (matcher(route)) {
521
- operate(route);
522
- break;
523
- }
524
- if (route.children) {
525
- stack.push.apply(stack, __spread(route.children.reverse()));
526
- }
527
- }
528
- return routes;
529
- };
530
- var ɵ3 = traverseRouteTree;
531
- /**
532
- * A route insertion strategy that can be used to append external routes onto
533
- * existing Angular routes. This can be useful when you need to route to
534
- * an existing lazy-loaded module from multiple externally defined urls.
535
- *
536
- * This should be used in combination with the {@link daffDataPathUrlMatcher} to match lazy-loaded modules with
537
- * associated external urls.
538
- *
539
- * For example, you can provide the insertion strategy in the {@link DaffExternalRouterModule} as below.
540
- *
541
- * ```ts
542
- * DaffExternalRouterModule.forRoot({}, [
543
- * {
544
- * type: 'CATEGORY',
545
- * insertionStrategy: daffInsertDataPathStrategy,
546
- * route: {}
547
- * }
548
- * ],
549
- * ```
550
- *
551
- * Then, you can match it with an associated route defined in your Routing
552
- * configuration with the {@link daffDataPathUrlMatcher}.
553
- *
554
- * ```ts
555
- * export const routes: Routes = [
556
- * {
557
- * matcher: daffDataPathUrlMatcher,
558
- * data: {
559
- * daffExternalRouteType: "CATEGORY",
560
- * },
561
- * loadChildren: () => import('./category/category.module').then((m) => m.MyCategoryModule),
562
- * }
563
- * ]
564
- * ```
565
- *
566
- * See {@link DaffRouteWithDataPath}
567
- *
568
- */
569
- var daffInsertDataPathStrategy = function (externalRoute, routes) { return traverseRouteTree(routes, function (route) { var _a; return routeMatchesRouteType(route, (_a = externalRoute.data) === null || _a === void 0 ? void 0 : _a.daffExternalRouteType); }, operateOnRoute(externalRoute)); };
570
-
571
- /**
572
- * A UrlMatcher that does an exact match against a path stored in the special
573
- * configuration fields that External Router stores on a Route's data.
574
- *
575
- * ```ts
576
- * export const routes: Routes = [
577
- * {
578
- * matcher: daffDataPathUrlMatcher,
579
- * data: {
580
- * daffExternalRouteType: "CATEGORY",
581
- * },
582
- * loadChildren: () => import('./category/category.module').then((m) => m.ShopCategoryModule),
583
- * }
584
- * ]
585
- * ```
586
- * {@link daffInsertDataPathStrategy }
587
- * {@link DaffRouteWithDataPath }
588
- */
589
- var daffDataPathUrlMatcher = function (segments, group, route) {
590
- var _a;
591
- var path = routing.daffUriTruncateLeadingSlash(segments.reduce(function (acc, segment) { return acc + '/' + segment.path; }, ''));
592
- var paths = (_a = route === null || route === void 0 ? void 0 : route.data) === null || _a === void 0 ? void 0 : _a.daffPaths;
593
- // If we don't have any paths, we can safely fail a match.
594
- if (!paths) {
595
- return null;
596
- }
597
- // Otherwise, look up the path in the dictionary, failing if a match isn't found,
598
- // but matching the entire segment if a match is found.
599
- return path in paths ? { consumed: segments } : null;
600
- };
601
-
602
- /*
603
- * Public API Surface of @daffodil/external-router
604
- */
605
-
606
- /**
607
- * Generated bundle index. Do not edit.
608
- */
609
-
610
- exports.DAFF_EXTERNAL_ROUTER_CONFIG = DAFF_EXTERNAL_ROUTER_CONFIG;
611
- exports.DaffExternalRouter = DaffExternalRouter;
612
- exports.DaffExternalRouterModule = DaffExternalRouterModule;
613
- exports.DaffExternalRouterNoWildcardError = DaffExternalRouterNoWildcardError;
614
- exports.DaffExternalRouterUnknownRouteTypeError = DaffExternalRouterUnknownRouteTypeError;
615
- exports.daffDataPathUrlMatcher = daffDataPathUrlMatcher;
616
- exports.daffInsertDataPathStrategy = daffInsertDataPathStrategy;
617
- exports.daffInsertRouteBeforeWildCardStrategy = daffInsertRouteBeforeWildCardStrategy;
618
- exports.daffProvideRouteResolvableByType = daffProvideRouteResolvableByType;
619
- exports.ɵa = DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE;
620
- exports.ɵb = daffProvideRoutesResolvableByType;
621
-
622
- Object.defineProperty(exports, '__esModule', { value: true });
623
-
624
- })));
625
- //# sourceMappingURL=daffodil-external-router.umd.js.map