@daffodil/external-router 0.38.9 → 0.39.3
Sign up to get free protection for your applications and to get access to all the features.
- package/bundles/daffodil-external-router-driver-in-memory.umd.js +100 -0
- package/bundles/daffodil-external-router-driver-in-memory.umd.js.map +1 -0
- package/bundles/daffodil-external-router-driver-in-memory.umd.min.js +2 -0
- package/bundles/daffodil-external-router-driver-in-memory.umd.min.js.map +1 -0
- package/bundles/daffodil-external-router-driver-magento-2.4.1.umd.js +11 -63
- package/bundles/daffodil-external-router-driver-magento-2.4.1.umd.js.map +1 -1
- package/bundles/daffodil-external-router-driver-magento-2.4.1.umd.min.js +1 -1
- package/bundles/daffodil-external-router-driver-magento-2.4.1.umd.min.js.map +1 -1
- package/bundles/daffodil-external-router-driver-magento-2.4.2.umd.js +11 -63
- package/bundles/daffodil-external-router-driver-magento-2.4.2.umd.js.map +1 -1
- package/bundles/daffodil-external-router-driver-magento-2.4.2.umd.min.js +1 -1
- package/bundles/daffodil-external-router-driver-magento-2.4.2.umd.min.js.map +1 -1
- package/bundles/daffodil-external-router-driver-magento.umd.js +9 -47
- package/bundles/daffodil-external-router-driver-magento.umd.js.map +1 -1
- package/bundles/daffodil-external-router-driver-magento.umd.min.js +1 -1
- package/bundles/daffodil-external-router-driver-magento.umd.min.js.map +1 -1
- package/bundles/daffodil-external-router-driver-testing.umd.js +9 -63
- package/bundles/daffodil-external-router-driver-testing.umd.js.map +1 -1
- package/bundles/daffodil-external-router-driver-testing.umd.min.js +1 -1
- package/bundles/daffodil-external-router-driver-testing.umd.min.js.map +1 -1
- package/bundles/daffodil-external-router-driver.umd.js +4 -44
- package/bundles/daffodil-external-router-driver.umd.js.map +1 -1
- package/bundles/daffodil-external-router-routing.umd.js +18 -157
- package/bundles/daffodil-external-router-routing.umd.js.map +1 -1
- package/bundles/daffodil-external-router-routing.umd.min.js +1 -1
- package/bundles/daffodil-external-router-routing.umd.min.js.map +1 -1
- package/bundles/daffodil-external-router.umd.js +35 -204
- package/bundles/daffodil-external-router.umd.js.map +1 -1
- package/bundles/daffodil-external-router.umd.min.js +2 -2
- package/bundles/daffodil-external-router.umd.min.js.map +1 -1
- package/driver/in-memory/config.d.ts +20 -0
- package/driver/in-memory/daffodil-external-router-driver-in-memory.d.ts +5 -0
- package/driver/in-memory/daffodil-external-router-driver-in-memory.metadata.json +1 -0
- package/driver/in-memory/in-memory.module.d.ts +9 -0
- package/driver/in-memory/in-memory.service.d.ts +17 -0
- package/driver/in-memory/index.d.ts +1 -0
- package/driver/in-memory/package.json +11 -0
- package/driver/in-memory/public_api.d.ts +3 -0
- package/driver/magento/2.4.1/package.json +1 -1
- package/driver/magento/2.4.2/package.json +1 -1
- package/driver/magento/package.json +1 -1
- package/driver/package.json +1 -1
- package/driver/testing/package.json +1 -1
- package/esm2015/config.js +3 -30
- package/esm2015/daffodil-external-router.js +2 -7
- package/esm2015/driver/daffodil-external-router-driver.js +2 -7
- package/esm2015/driver/in-memory/config.js +17 -0
- package/esm2015/driver/in-memory/daffodil-external-router-driver-in-memory.js +6 -0
- package/esm2015/driver/in-memory/in-memory.module.js +36 -0
- package/esm2015/driver/in-memory/in-memory.service.js +36 -0
- package/esm2015/driver/in-memory/index.js +2 -0
- package/esm2015/driver/in-memory/public_api.js +6 -0
- package/esm2015/driver/index.js +2 -7
- package/esm2015/driver/interfaces/external-router-driver.interface.js +2 -26
- package/esm2015/driver/magento/2.4.1/daffodil-external-router-driver-magento-2.4.1.js +2 -7
- package/esm2015/driver/magento/2.4.1/graphql/queries/resolve-url-v2.4.1.js +1 -8
- package/esm2015/driver/magento/2.4.1/index.js +2 -7
- package/esm2015/driver/magento/2.4.1/magento.module.js +3 -9
- package/esm2015/driver/magento/2.4.1/magento.service.js +4 -27
- package/esm2015/driver/magento/2.4.1/public_api.js +1 -6
- package/esm2015/driver/magento/2.4.1/transforms/resolution-to-resolvable-url.js +3 -13
- package/esm2015/driver/magento/2.4.2/daffodil-external-router-driver-magento-2.4.2.js +2 -7
- package/esm2015/driver/magento/2.4.2/graphql/queries/resolve-url-v2.4.2.js +1 -8
- package/esm2015/driver/magento/2.4.2/index.js +2 -7
- package/esm2015/driver/magento/2.4.2/magento.module.js +3 -9
- package/esm2015/driver/magento/2.4.2/magento.service.js +4 -27
- package/esm2015/driver/magento/2.4.2/public_api.js +1 -6
- package/esm2015/driver/magento/2.4.2/transforms/resolution-to-resolvable-url.js +3 -13
- package/esm2015/driver/magento/daffodil-external-router-driver-magento.js +2 -7
- package/esm2015/driver/magento/index.js +2 -7
- package/esm2015/driver/magento/model/public_api.js +1 -6
- package/esm2015/driver/magento/model/resolution-types.js +7 -13
- package/esm2015/driver/magento/model/url-resolver-response.js +2 -14
- package/esm2015/driver/magento/model/url-resolver.js +2 -28
- package/esm2015/driver/magento/public_api.js +3 -8
- package/esm2015/driver/magento/transforms/public_api.js +1 -6
- package/esm2015/driver/magento/transforms/redirect-to-http.js +2 -12
- package/esm2015/driver/not-found-resolution.js +1 -7
- package/esm2015/driver/public_api.js +1 -6
- package/esm2015/driver/testing/config.js +3 -19
- package/esm2015/driver/testing/daffodil-external-router-driver-testing.js +2 -7
- package/esm2015/driver/testing/index.js +2 -7
- package/esm2015/driver/testing/public_api.js +1 -6
- package/esm2015/driver/testing/testing.module.js +2 -11
- package/esm2015/driver/testing/testing.service.js +4 -24
- package/esm2015/errors/no-wildcard.js +1 -13
- package/esm2015/errors/unknown-type.js +1 -13
- package/esm2015/external-router.module.js +2 -12
- package/esm2015/model/insertion-strategy.type.js +2 -6
- package/esm2015/model/public_api.js +2 -6
- package/esm2015/model/resolvable-route.js +2 -36
- package/esm2015/model/route-info.js +2 -17
- package/esm2015/model/route-type.js +2 -6
- package/esm2015/model/route-with-data-path.js +2 -6
- package/esm2015/model/route-without-path.js +2 -6
- package/esm2015/model/type-route-pair.js +2 -34
- package/esm2015/public_api.js +2 -7
- package/esm2015/router/router.service.js +2 -25
- package/esm2015/router/strategies/insert-data-path.js +13 -59
- package/esm2015/router/strategies/insert-route-before-wildcard.js +4 -20
- package/esm2015/router/url-matcher/data-path-matcher.js +6 -25
- package/esm2015/routing/daffodil-external-router-routing.js +2 -7
- package/esm2015/routing/errors/client-error.js +1 -13
- package/esm2015/routing/errors/not-found-error.js +1 -13
- package/esm2015/routing/errors/permanent-redirect.js +1 -16
- package/esm2015/routing/errors/server-error.js +1 -13
- package/esm2015/routing/errors/temporary-redirect.js +1 -16
- package/esm2015/routing/guard/existence.guard.js +11 -82
- package/esm2015/routing/index.js +2 -7
- package/esm2015/routing/processors/process-errors.js +3 -13
- package/esm2015/routing/processors/process-redirect.js +3 -13
- package/esm2015/routing/public_api.js +1 -6
- package/esm2015/token/type-resolvable-routes.token.js +4 -21
- package/esm2015/transform/resolved-route-to-route.js +4 -20
- package/fesm2015/daffodil-external-router-driver-in-memory.js +90 -0
- package/fesm2015/daffodil-external-router-driver-in-memory.js.map +1 -0
- package/fesm2015/daffodil-external-router-driver-magento-2.4.1.js +11 -67
- package/fesm2015/daffodil-external-router-driver-magento-2.4.1.js.map +1 -1
- package/fesm2015/daffodil-external-router-driver-magento-2.4.2.js +11 -67
- package/fesm2015/daffodil-external-router-driver-magento-2.4.2.js.map +1 -1
- package/fesm2015/daffodil-external-router-driver-magento.js +10 -47
- package/fesm2015/daffodil-external-router-driver-magento.js.map +1 -1
- package/fesm2015/daffodil-external-router-driver-testing.js +10 -65
- package/fesm2015/daffodil-external-router-driver-testing.js.map +1 -1
- package/fesm2015/daffodil-external-router-driver.js +4 -44
- package/fesm2015/daffodil-external-router-driver.js.map +1 -1
- package/fesm2015/daffodil-external-router-routing.js +18 -185
- package/fesm2015/daffodil-external-router-routing.js.map +1 -1
- package/fesm2015/daffodil-external-router.js +34 -242
- package/fesm2015/daffodil-external-router.js.map +1 -1
- package/package.json +3 -3
- package/routing/package.json +1 -1
@@ -1,69 +1,31 @@
|
|
1
1
|
import { CommonModule } from '@angular/common';
|
2
|
-
import { InjectionToken, NgModule,
|
2
|
+
import { InjectionToken, NgModule, ɵɵdefineInjectable, ɵɵinject, Injectable, Inject } from '@angular/core';
|
3
3
|
import { Router } from '@angular/router';
|
4
4
|
import { DaffInheritableError } from '@daffodil/core';
|
5
5
|
import { daffUriTruncateLeadingSlash } from '@daffodil/core/routing';
|
6
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
7
|
const daffExternalRouterConfigurationDefault = {
|
14
8
|
failedResolutionPath: '/',
|
15
9
|
notFoundResolutionPath: '/',
|
16
10
|
};
|
17
11
|
/**
|
18
12
|
* The token holding the runtime configuration for the behavior of the
|
19
|
-
*
|
20
|
-
* @type {?}
|
13
|
+
* `@daffodil/external-router` package.
|
21
14
|
*/
|
22
15
|
const DAFF_EXTERNAL_ROUTER_CONFIG = new InjectionToken('DAFF_EXTERNAL_ROUTER_CONFIG', {
|
23
16
|
providedIn: 'root',
|
24
|
-
factory: (
|
25
|
-
* @return {?}
|
26
|
-
*/
|
27
|
-
() => daffExternalRouterConfigurationDefault),
|
17
|
+
factory: () => daffExternalRouterConfigurationDefault,
|
28
18
|
});
|
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
19
|
|
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
20
|
/**
|
53
21
|
* A multi-token that allows you to register route "types" that correspond to routes.
|
54
|
-
* @type {?}
|
55
22
|
*/
|
56
23
|
const DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE = new InjectionToken('DAFF_EXTERNAL_ROUTER_RESOLVABLE_TYPE_ROUTES', {
|
57
24
|
providedIn: 'root',
|
58
|
-
factory: (
|
59
|
-
* @return {?}
|
60
|
-
*/
|
61
|
-
() => []),
|
25
|
+
factory: () => [],
|
62
26
|
});
|
63
27
|
/**
|
64
28
|
* A provider used to connect a type to a route to enable dynamic route resolution at runtime.
|
65
|
-
* @param {?} typeRoutePair
|
66
|
-
* @return {?}
|
67
29
|
*/
|
68
30
|
function daffProvideRouteResolvableByType(typeRoutePair) {
|
69
31
|
return {
|
@@ -74,36 +36,20 @@ function daffProvideRouteResolvableByType(typeRoutePair) {
|
|
74
36
|
}
|
75
37
|
/**
|
76
38
|
* A multi-provider used to connect an array of types to their respective routes.
|
77
|
-
* @param {?} routes
|
78
|
-
* @return {?}
|
79
39
|
*/
|
80
40
|
function daffProvideRoutesResolvableByType(routes) {
|
81
|
-
return routes.map((
|
82
|
-
* @param {?} route
|
83
|
-
* @return {?}
|
84
|
-
*/
|
85
|
-
(route) => ({
|
41
|
+
return routes.map((route) => ({
|
86
42
|
provide: DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE,
|
87
43
|
multi: true,
|
88
44
|
useValue: route,
|
89
|
-
}))
|
45
|
+
}));
|
90
46
|
}
|
91
47
|
|
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
48
|
/**
|
98
49
|
* The external `DaffExternalRouterModule` allows you to configure the
|
99
|
-
*
|
50
|
+
* `@daffodil/external-router` package's behavior.
|
100
51
|
*/
|
101
52
|
class DaffExternalRouterModule {
|
102
|
-
/**
|
103
|
-
* @param {?} config
|
104
|
-
* @param {?=} routes
|
105
|
-
* @return {?}
|
106
|
-
*/
|
107
53
|
static forRoot(config, routes = []) {
|
108
54
|
return {
|
109
55
|
ngModule: DaffExternalRouterModule,
|
@@ -121,80 +67,34 @@ DaffExternalRouterModule.decorators = [
|
|
121
67
|
},] }
|
122
68
|
];
|
123
69
|
|
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
70
|
/**
|
136
71
|
* An error thrown when there was no wildcard route found in configuration
|
137
72
|
* of the Angular Router.
|
138
73
|
*/
|
139
74
|
class DaffExternalRouterNoWildcardError extends DaffInheritableError {
|
140
|
-
/**
|
141
|
-
* @param {?=} message
|
142
|
-
*/
|
143
75
|
constructor(message) {
|
144
76
|
super(message);
|
145
77
|
this.code = 'NO_WILDCARD_ROUTE';
|
146
78
|
}
|
147
79
|
}
|
148
|
-
if (false) {
|
149
|
-
/** @type {?} */
|
150
|
-
DaffExternalRouterNoWildcardError.prototype.code;
|
151
|
-
}
|
152
80
|
|
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
81
|
/**
|
159
82
|
* An error thrown when there is a failure matching a configured route to a
|
160
83
|
* route type.
|
161
84
|
*/
|
162
85
|
class DaffExternalRouterUnknownRouteTypeError extends DaffInheritableError {
|
163
|
-
/**
|
164
|
-
* @param {?=} message
|
165
|
-
*/
|
166
86
|
constructor(message) {
|
167
87
|
super(message);
|
168
88
|
this.code = 'UNKNOWN_ROUTE_TYPE';
|
169
89
|
}
|
170
90
|
}
|
171
|
-
if (false) {
|
172
|
-
/** @type {?} */
|
173
|
-
DaffExternalRouterUnknownRouteTypeError.prototype.code;
|
174
|
-
}
|
175
91
|
|
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
92
|
/**
|
182
93
|
* Transforms a DaffExternallyResolvableUrl into an Angular Route.
|
183
|
-
* @type {?}
|
184
|
-
*/
|
185
|
-
const daffTransformResolvedRouteToRoute = (/**
|
186
|
-
* @param {?} resolvedRoute
|
187
|
-
* @param {?} availableTypes
|
188
|
-
* @return {?}
|
189
94
|
*/
|
190
|
-
(resolvedRoute, availableTypes) => {
|
191
|
-
/** @type {?} */
|
95
|
+
const daffTransformResolvedRouteToRoute = (resolvedRoute, availableTypes) => {
|
192
96
|
const routeType = availableTypes
|
193
|
-
.filter(
|
194
|
-
* @param {?} t
|
195
|
-
* @return {?}
|
196
|
-
*/
|
197
|
-
t => t.type === resolvedRoute.type))
|
97
|
+
.filter(t => t.type === resolvedRoute.type)
|
198
98
|
.shift();
|
199
99
|
if (!routeType) {
|
200
100
|
throw new DaffExternalRouterUnknownRouteTypeError(`Unable to resolve the route '${resolvedRoute.url}'. Its type is '${resolvedRoute.type}' but a matching route wasn't found.`);
|
@@ -203,30 +103,14 @@ const daffTransformResolvedRouteToRoute = (/**
|
|
203
103
|
route: Object.assign(Object.assign({ path: resolvedRoute.url }, routeType.route), { data: Object.assign({ daffExternalRouteType: resolvedRoute.type }, routeType.route.data) }),
|
204
104
|
insertionStrategy: routeType.insertionStrategy,
|
205
105
|
};
|
206
|
-
}
|
106
|
+
};
|
207
107
|
|
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
108
|
/**
|
214
109
|
* Inserts a Route into Routes right before the wildcard route.
|
215
110
|
* If no wildcard is found, it fails fast with a `DaffExternalRouterNoWildcardError`.
|
216
|
-
* @type {?}
|
217
111
|
*/
|
218
|
-
const daffInsertRouteBeforeWildCardStrategy = (
|
219
|
-
|
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 === '**'));
|
112
|
+
const daffInsertRouteBeforeWildCardStrategy = (route, routes) => {
|
113
|
+
const index = routes.findIndex((r) => r.path === '**');
|
230
114
|
if (index === -1) {
|
231
115
|
throw new DaffExternalRouterNoWildcardError('No wildcard (**) route was found during route resolution.');
|
232
116
|
}
|
@@ -235,26 +119,15 @@ const daffInsertRouteBeforeWildCardStrategy = (/**
|
|
235
119
|
route,
|
236
120
|
...routes.slice(index),
|
237
121
|
];
|
238
|
-
}
|
122
|
+
};
|
239
123
|
|
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
124
|
class DaffExternalRouter {
|
246
|
-
/**
|
247
|
-
* @param {?} router
|
248
|
-
* @param {?} runtimeRoutes
|
249
|
-
*/
|
250
125
|
constructor(router, runtimeRoutes) {
|
251
126
|
this.router = router;
|
252
127
|
this.runtimeRoutes = runtimeRoutes;
|
253
128
|
}
|
254
129
|
/**
|
255
130
|
* Adds a route to the existing router configuration.
|
256
|
-
* @param {?} resolvedRoute
|
257
|
-
* @return {?}
|
258
131
|
*/
|
259
132
|
add(resolvedRoute) {
|
260
133
|
//Get the route.
|
@@ -271,6 +144,7 @@ class DaffExternalRouter {
|
|
271
144
|
}
|
272
145
|
}
|
273
146
|
}
|
147
|
+
/** @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" });
|
274
148
|
DaffExternalRouter.decorators = [
|
275
149
|
{ type: Injectable, args: [{
|
276
150
|
providedIn: 'root',
|
@@ -281,86 +155,37 @@ DaffExternalRouter.ctorParameters = () => [
|
|
281
155
|
{ type: Router },
|
282
156
|
{ type: Array, decorators: [{ type: Inject, args: [DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE,] }] }
|
283
157
|
];
|
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
158
|
|
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
159
|
/**
|
304
160
|
* Tests whether or not a route matches a specific Daffodil Route type.
|
305
161
|
*
|
306
|
-
* See {
|
307
|
-
* @type {?}
|
308
|
-
*/
|
309
|
-
const routeMatchesRouteType = (/**
|
310
|
-
* @param {?} route
|
311
|
-
* @param {?} type
|
312
|
-
* @return {?}
|
162
|
+
* See {@link DaffRouteWithDataPath}
|
313
163
|
*/
|
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; }
|
164
|
+
const routeMatchesRouteType = (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
165
|
const ɵ0 = routeMatchesRouteType;
|
316
166
|
/**
|
317
167
|
* Adds a path to the `daffPaths` of the given route.
|
318
168
|
*
|
319
|
-
* See {
|
320
|
-
* @type {?}
|
169
|
+
* See {@link DaffRouteWithDataPath}
|
321
170
|
*/
|
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 }));
|
171
|
+
const addRouteToDaffPaths = (route, path) => route.data.daffPaths = Object.assign(Object.assign({}, route.data.daffPaths), { [path]: path });
|
328
172
|
const ɵ1 = addRouteToDaffPaths;
|
329
|
-
|
330
|
-
const operateOnRoute = (/**
|
331
|
-
* @param {?} externalRoute
|
332
|
-
* @return {?}
|
333
|
-
*/
|
334
|
-
(externalRoute) => (/**
|
335
|
-
* @param {?} route
|
336
|
-
* @return {?}
|
337
|
-
*/
|
338
|
-
(route) => addRouteToDaffPaths(route, externalRoute.path)));
|
173
|
+
const operateOnRoute = (externalRoute) => (route) => addRouteToDaffPaths(route, externalRoute.path);
|
339
174
|
const ɵ2 = operateOnRoute;
|
340
175
|
/**
|
341
176
|
* Traverse the router config tree, halting after the first match.
|
342
177
|
* This traversal is implemented in a pre-order manner. As such, for large
|
343
178
|
* configuration trees, it will be most efficient to place externally routed
|
344
179
|
* 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
180
|
*/
|
353
|
-
(routes = [], matcher, operate) => {
|
181
|
+
const traverseRouteTree = (routes = [], matcher, operate) => {
|
354
182
|
if (routes.length === 0) {
|
355
183
|
return routes;
|
356
184
|
}
|
357
|
-
/** @type {?} */
|
358
185
|
const stack = [];
|
359
|
-
/** @type {?} */
|
360
186
|
const treeRoot = { children: routes };
|
361
187
|
stack.push(treeRoot);
|
362
188
|
while (stack.length) {
|
363
|
-
/** @type {?} */
|
364
189
|
const route = stack.pop();
|
365
190
|
if (matcher(route)) {
|
366
191
|
operate(route);
|
@@ -371,17 +196,17 @@ const traverseRouteTree = (/**
|
|
371
196
|
}
|
372
197
|
}
|
373
198
|
return routes;
|
374
|
-
}
|
199
|
+
};
|
375
200
|
const ɵ3 = traverseRouteTree;
|
376
201
|
/**
|
377
202
|
* A route insertion strategy that can be used to append external routes onto
|
378
203
|
* existing Angular routes. This can be useful when you need to route to
|
379
204
|
* an existing lazy-loaded module from multiple externally defined urls.
|
380
205
|
*
|
381
|
-
* This should be used in combination with the {
|
206
|
+
* This should be used in combination with the {@link daffDataPathUrlMatcher} to match lazy-loaded modules with
|
382
207
|
* associated external urls.
|
383
208
|
*
|
384
|
-
* For example, you can provide the insertion strategy in the {
|
209
|
+
* For example, you can provide the insertion strategy in the {@link DaffExternalRouterModule} as below.
|
385
210
|
*
|
386
211
|
* ```ts
|
387
212
|
* DaffExternalRouterModule.forRoot({}, [
|
@@ -394,7 +219,7 @@ const ɵ3 = traverseRouteTree;
|
|
394
219
|
* ```
|
395
220
|
*
|
396
221
|
* Then, you can match it with an associated route defined in your Routing
|
397
|
-
* configuration with the {
|
222
|
+
* configuration with the {@link daffDataPathUrlMatcher}.
|
398
223
|
*
|
399
224
|
* ```ts
|
400
225
|
* export const routes: Routes = [
|
@@ -408,26 +233,11 @@ const ɵ3 = traverseRouteTree;
|
|
408
233
|
* ]
|
409
234
|
* ```
|
410
235
|
*
|
411
|
-
* See {
|
236
|
+
* See {@link DaffRouteWithDataPath}
|
412
237
|
*
|
413
|
-
* @type {?}
|
414
238
|
*/
|
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)));
|
239
|
+
const daffInsertDataPathStrategy = (externalRoute, routes) => traverseRouteTree(routes, (route) => { var _a; return routeMatchesRouteType(route, (_a = externalRoute.data) === null || _a === void 0 ? void 0 : _a.daffExternalRouteType); }, operateOnRoute(externalRoute));
|
425
240
|
|
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
241
|
/**
|
432
242
|
* A UrlMatcher that does an exact match against a path stored in the special
|
433
243
|
* configuration fields that External Router stores on a Route's data.
|
@@ -443,26 +253,12 @@ const daffInsertDataPathStrategy = (/**
|
|
443
253
|
* }
|
444
254
|
* ]
|
445
255
|
* ```
|
446
|
-
* {
|
447
|
-
* {
|
448
|
-
* @type {?}
|
449
|
-
*/
|
450
|
-
const daffDataPathUrlMatcher = (/**
|
451
|
-
* @param {?} segments
|
452
|
-
* @param {?} group
|
453
|
-
* @param {?} route
|
454
|
-
* @return {?}
|
256
|
+
* {@link daffInsertDataPathStrategy }
|
257
|
+
* {@link DaffRouteWithDataPath }
|
455
258
|
*/
|
456
|
-
(segments, group, route) => {
|
259
|
+
const daffDataPathUrlMatcher = (segments, group, route) => {
|
457
260
|
var _a;
|
458
|
-
|
459
|
-
const path = daffUriTruncateLeadingSlash(segments.reduce((/**
|
460
|
-
* @param {?} acc
|
461
|
-
* @param {?} segment
|
462
|
-
* @return {?}
|
463
|
-
*/
|
464
|
-
(acc, segment) => acc + '/' + segment.path), ''));
|
465
|
-
/** @type {?} */
|
261
|
+
const path = daffUriTruncateLeadingSlash(segments.reduce((acc, segment) => acc + '/' + segment.path, ''));
|
466
262
|
const paths = (_a = route === null || route === void 0 ? void 0 : route.data) === null || _a === void 0 ? void 0 : _a.daffPaths;
|
467
263
|
// If we don't have any paths, we can safely fail a match.
|
468
264
|
if (!paths) {
|
@@ -471,18 +267,14 @@ const daffDataPathUrlMatcher = (/**
|
|
471
267
|
// Otherwise, look up the path in the dictionary, failing if a match isn't found,
|
472
268
|
// but matching the entire segment if a match is found.
|
473
269
|
return path in paths ? { consumed: segments } : null;
|
474
|
-
}
|
270
|
+
};
|
475
271
|
|
476
|
-
|
477
|
-
*
|
478
|
-
* Generated from: public_api.ts
|
479
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
272
|
+
/*
|
273
|
+
* Public API Surface of @daffodil/external-router
|
480
274
|
*/
|
481
275
|
|
482
276
|
/**
|
483
|
-
*
|
484
|
-
* Generated from: daffodil-external-router.ts
|
485
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
277
|
+
* Generated bundle index. Do not edit.
|
486
278
|
*/
|
487
279
|
|
488
280
|
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 };
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"daffodil-external-router.js","sources":["../../../libs/external-router/src/config.ts","../../../libs/external-router/src/token/type-resolvable-routes.token.ts","../../../libs/external-router/src/external-router.module.ts","../../../libs/external-router/src/errors/no-wildcard.ts","../../../libs/external-router/src/errors/unknown-type.ts","../../../libs/external-router/src/transform/resolved-route-to-route.ts","../../../libs/external-router/src/router/strategies/insert-route-before-wildcard.ts","../../../libs/external-router/src/router/router.service.ts","../../../libs/external-router/src/router/strategies/insert-data-path.ts","../../../libs/external-router/src/router/url-matcher/data-path-matcher.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nexport const daffExternalRouterConfigurationDefault: DaffExternalRouterConfiguration = {\n failedResolutionPath: '/',\n notFoundResolutionPath: '/',\n};\n\n/**\n * The token holding the runtime configuration for the behavior of the\n * `@daffodil/external-router` package.\n */\nexport const DAFF_EXTERNAL_ROUTER_CONFIG = new InjectionToken<\n\tDaffExternalRouterConfiguration\n>('DAFF_EXTERNAL_ROUTER_CONFIG', {\n providedIn: 'root',\n factory: () => daffExternalRouterConfigurationDefault,\n});\n\n/**\n * The configuration object for the external router package.\n */\nexport interface DaffExternalRouterConfiguration {\n\t/**\n\t * The path to redirect to when external route resolution fails.\n\t */\n\tfailedResolutionPath: string;\n\n\t/**\n\t * The path to redirect to when the requested URL is not found.\n\t */\n\tnotFoundResolutionPath: string;\n}\n","import {\n InjectionToken,\n Provider,\n} from '@angular/core';\n\nimport { DaffExternalRouterInsertionStrategy } from '../model/insertion-strategy.type';\nimport { DaffExternalRouteType } from '../model/route-type';\nimport { DaffRouteWithoutPath } from '../model/route-without-path';\nimport { DaffTypeRoutePair } from '../model/type-route-pair';\n\n/**\n * A multi-token that allows you to register route \"types\" that correspond to routes.\n */\nexport const DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE = new InjectionToken<\n\tDaffTypeRoutePair[]\n>('DAFF_EXTERNAL_ROUTER_RESOLVABLE_TYPE_ROUTES', {\n providedIn: 'root',\n factory: () => [],\n});\n\n/**\n * A provider used to connect a type to a route to enable dynamic route resolution at runtime.\n */\nexport function daffProvideRouteResolvableByType(typeRoutePair: DaffTypeRoutePair): Provider {\n return {\n provide: DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE,\n multi: true,\n useValue: typeRoutePair,\n };\n}\n\n/**\n * A multi-provider used to connect an array of types to their respective routes.\n */\nexport function daffProvideRoutesResolvableByType(routes: DaffTypeRoutePair[]): Provider[] {\n return routes.map((route: DaffTypeRoutePair) => ({\n provide: DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE,\n multi: true,\n useValue: route,\n }));\n}\n","import { CommonModule } from '@angular/common';\nimport {\n ModuleWithProviders,\n NgModule,\n} from '@angular/core';\n\nimport {\n DaffExternalRouterConfiguration,\n DAFF_EXTERNAL_ROUTER_CONFIG,\n daffExternalRouterConfigurationDefault,\n} from './config';\nimport { DaffTypeRoutePair } from './model/type-route-pair';\nimport { daffProvideRoutesResolvableByType } from './token/type-resolvable-routes.token';\n\n/**\n * The external `DaffExternalRouterModule` allows you to configure the\n * `@daffodil/external-router` package's behavior.\n */\n@NgModule({\n declarations: [],\n imports: [CommonModule],\n})\nexport class DaffExternalRouterModule {\n static forRoot(\n config: Partial<DaffExternalRouterConfiguration>,\n routes: DaffTypeRoutePair[] = [],\n ): ModuleWithProviders<DaffExternalRouterModule> {\n return {\n ngModule: DaffExternalRouterModule,\n providers: [\n { provide: DAFF_EXTERNAL_ROUTER_CONFIG, useValue: { ...daffExternalRouterConfigurationDefault, ...config }},\n ...daffProvideRoutesResolvableByType(routes),\n ],\n };\n }\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\n/**\n * An error thrown when there was no wildcard route found in configuration\n * of the Angular Router.\n */\nexport class DaffExternalRouterNoWildcardError extends DaffInheritableError\n implements DaffError {\n\tpublic readonly code: string = 'NO_WILDCARD_ROUTE';\n\n\tconstructor(message?: string) {\n\t super(message);\n\t}\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\n/**\n * An error thrown when there is a failure matching a configured route to a\n * route type.\n */\nexport class DaffExternalRouterUnknownRouteTypeError extends DaffInheritableError\n implements DaffError {\n\tpublic readonly code: string = 'UNKNOWN_ROUTE_TYPE';\n\n\tconstructor(message?: string) {\n\t super(message);\n\t}\n}\n","import { DaffExternalRouterUnknownRouteTypeError } from '../errors/unknown-type';\nimport { DaffExternallyResolvableUrl } from '../model/resolvable-route';\nimport { DaffRouteInfo } from '../model/route-info';\nimport { DaffTypeRoutePair } from '../model/type-route-pair';\n\n/**\n * Transforms a DaffExternallyResolvableUrl into an Angular Route.\n */\nexport const daffTransformResolvedRouteToRoute = (\n resolvedRoute: DaffExternallyResolvableUrl,\n availableTypes: DaffTypeRoutePair[],\n): DaffRouteInfo => {\n const routeType = availableTypes\n .filter(t => t.type === resolvedRoute.type)\n .shift();\n if (!routeType) {\n throw new DaffExternalRouterUnknownRouteTypeError(\n `Unable to resolve the route '${resolvedRoute.url}'. Its type is '${resolvedRoute.type}' but a matching route wasn't found.`,\n );\n }\n\n return {\n route: {\n path: resolvedRoute.url,\n ...routeType.route,\n data: {\n daffExternalRouteType: resolvedRoute.type,\n ...routeType.route.data,\n },\n },\n insertionStrategy: routeType.insertionStrategy,\n };\n};\n","import {\n Route,\n Routes,\n} from '@angular/router';\n\nimport { DaffExternalRouterNoWildcardError } from '../../errors/no-wildcard';\nimport { DaffExternalRouterInsertionStrategy } from '../../model/insertion-strategy.type';\n\n/**\n * Inserts a Route into Routes right before the wildcard route.\n * If no wildcard is found, it fails fast with a `DaffExternalRouterNoWildcardError`.\n */\nexport const daffInsertRouteBeforeWildCardStrategy: DaffExternalRouterInsertionStrategy = (\n route: Route,\n routes: Routes,\n): Routes => {\n const index = routes.findIndex((r: Route) => r.path === '**');\n if (index === -1) {\n throw new DaffExternalRouterNoWildcardError(\n 'No wildcard (**) route was found during route resolution.',\n );\n }\n return [\n ...routes.slice(0, index),\n route,\n ...routes.slice(index),\n ];\n};\n","import {\n Inject,\n Injectable,\n} from '@angular/core';\nimport {\n Router,\n Route,\n} from '@angular/router';\n\n\nimport { DaffExternalRouterNoWildcardError } from '../errors/no-wildcard';\nimport { DaffExternallyResolvableUrl } from '../model/resolvable-route';\nimport { DaffTypeRoutePair } from '../model/type-route-pair';\nimport { DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE } from '../token/type-resolvable-routes.token';\nimport { daffTransformResolvedRouteToRoute } from '../transform/resolved-route-to-route';\nimport { daffInsertRouteBeforeWildCardStrategy } from './strategies/insert-route-before-wildcard';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffExternalRouter {\n constructor(\n private router: Router,\n @Inject(DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE)\n private runtimeRoutes: DaffTypeRoutePair[],\n ) { }\n\n /**\n * Adds a route to the existing router configuration.\n */\n add(resolvedRoute: DaffExternallyResolvableUrl) {\n //Get the route.\n const {\n route,\n insertionStrategy,\n } = daffTransformResolvedRouteToRoute(\n resolvedRoute,\n this.runtimeRoutes,\n );\n\n try {\n //Add it to configuration.\n this.router.config = (insertionStrategy || daffInsertRouteBeforeWildCardStrategy)(route, this.router.config);\n } catch (e) {\n if (e instanceof DaffExternalRouterNoWildcardError) {\n throw new DaffExternalRouterNoWildcardError(\n `${e.message} This usually means you have misconfigured your routes.`,\n );\n }\n\n throw e;\n }\n }\n}\n","import {\n Route,\n Routes,\n} from '@angular/router';\n\nimport { DaffExternalRouterInsertionStrategy } from '../../model/insertion-strategy.type';\nimport { DaffExternalRouteType } from '../../model/route-type';\nimport { DaffRouteWithDataPath } from '../../model/route-with-data-path';\n\n/**\n * Tests whether or not a route matches a specific Daffodil Route type.\n *\n * See {@link DaffRouteWithDataPath}\n */\nconst routeMatchesRouteType = (route: DaffRouteWithDataPath, type: DaffExternalRouteType): boolean => route?.data?.daffExternalRouteType === type;\n\n/**\n * Adds a path to the `daffPaths` of the given route.\n *\n * See {@link DaffRouteWithDataPath}\n */\nconst addRouteToDaffPaths:\n (route: DaffRouteWithDataPath, path: string) => Route =\n (route: DaffRouteWithDataPath, path: string) => route.data.daffPaths = {\n ...route.data.daffPaths,\n [path]: path,\n };\n\nconst operateOnRoute = (externalRoute: Route): (route: Route) => Route =>\n (route: DaffRouteWithDataPath) => addRouteToDaffPaths(route, externalRoute.path);\n\n/**\n * Traverse the router config tree, halting after the first match.\n * This traversal is implemented in a pre-order manner. As such, for large\n * configuration trees, it will be most efficient to place externally routed\n * components at the top of router configuration.\n */\nconst traverseRouteTree = (routes: Routes = [], matcher: (route: Route) => boolean, operate: (route: Route) => void): Routes => {\n if(routes.length === 0) {\n return routes;\n }\n\n const stack: Routes = [];\n const treeRoot = { children: routes };\n stack.push(treeRoot);\n\n while(stack.length) {\n const route = stack.pop();\n if(matcher(route)) {\n operate(route);\n break;\n }\n if(route.children){\n stack.push(...route.children.reverse());\n }\n }\n return routes;\n};\n\n/**\n * A route insertion strategy that can be used to append external routes onto\n * existing Angular routes. This can be useful when you need to route to\n * an existing lazy-loaded module from multiple externally defined urls.\n *\n * This should be used in combination with the {@link daffDataPathUrlMatcher} to match lazy-loaded modules with\n * associated external urls.\n *\n * For example, you can provide the insertion strategy in the {@link DaffExternalRouterModule} as below.\n *\n * ```ts\n * DaffExternalRouterModule.forRoot({}, [\n * {\n * type: 'CATEGORY',\n * insertionStrategy: daffInsertDataPathStrategy,\n * route: {}\n * }\n * ],\n * ```\n *\n * Then, you can match it with an associated route defined in your Routing\n * configuration with the {@link daffDataPathUrlMatcher}.\n *\n * ```ts\n * export const routes: Routes = [\n * {\n * matcher: daffDataPathUrlMatcher,\n * data: {\n * daffExternalRouteType: \"CATEGORY\",\n * },\n * loadChildren: () => import('./category/category.module').then((m) => m.MyCategoryModule),\n * }\n * ]\n * ```\n *\n * See {@link DaffRouteWithDataPath}\n *\n */\nexport const daffInsertDataPathStrategy: DaffExternalRouterInsertionStrategy = (externalRoute: DaffRouteWithDataPath, routes: Routes) => traverseRouteTree(\n routes,\n (route) => routeMatchesRouteType(route, externalRoute.data?.daffExternalRouteType),\n operateOnRoute(externalRoute),\n);\n","import {\n UrlMatcher,\n UrlSegment,\n UrlSegmentGroup,\n} from '@angular/router';\n\nimport { daffUriTruncateLeadingSlash } from '@daffodil/core/routing';\n\nimport { DaffRouteWithDataPath } from '../../model/public_api';\n\n/**\n * A UrlMatcher that does an exact match against a path stored in the special\n * configuration fields that External Router stores on a Route's data.\n *\n * ```ts\n * export const routes: Routes = [\n * {\n * matcher: daffDataPathUrlMatcher,\n * data: {\n * daffExternalRouteType: \"CATEGORY\",\n * },\n * loadChildren: () => import('./category/category.module').then((m) => m.ShopCategoryModule),\n * }\n * ]\n * ```\n * {@link daffInsertDataPathStrategy }\n * {@link DaffRouteWithDataPath }\n */\nexport const daffDataPathUrlMatcher: UrlMatcher = (segments: UrlSegment[], group: UrlSegmentGroup, route: DaffRouteWithDataPath) => {\n const path = daffUriTruncateLeadingSlash(segments.reduce((acc: string, segment) => acc + '/' + segment.path, ''));\n const paths = route?.data?.daffPaths;\n\n // If we don't have any paths, we can safely fail a match.\n if(!paths) {\n return null;\n }\n\n // Otherwise, look up the path in the dictionary, failing if a match isn't found,\n // but matching the entire segment if a match is found.\n return path in paths ? { consumed: segments } : null;\n};\n\n"],"names":[],"mappings":";;;;;;;;;;;;MAEa,sCAAsC,GAAoC;IACrF,oBAAoB,EAAE,GAAG;IACzB,sBAAsB,EAAE,GAAG;CAC5B;;;;;;MAMY,2BAA2B,GAAG,IAAI,cAAc,CAE3D,6BAA6B,EAAE;IAC/B,UAAU,EAAE,MAAM;IAClB,OAAO;;;IAAE,MAAM,sCAAsC,CAAA;CACtD;;;;;8CAeA;;;;;;IANA,+DAA6B;;;;;IAK7B,iEAA+B;;;;;;;;;;;;MCjBnB,8CAA8C,GAAG,IAAI,cAAc,CAE9E,6CAA6C,EAAE;IAC/C,UAAU,EAAE,MAAM;IAClB,OAAO;;;IAAE,MAAM,EAAE,CAAA;CAClB;;;;;;SAKe,gCAAgC,CAAC,aAAgC;IAC/E,OAAO;QACL,OAAO,EAAE,8CAA8C;QACvD,KAAK,EAAE,IAAI;QACX,QAAQ,EAAE,aAAa;KACxB,CAAC;AACJ,CAAC;;;;;;SAKe,iCAAiC,CAAC,MAA2B;IAC3E,OAAO,MAAM,CAAC,GAAG;;;;IAAC,CAAC,KAAwB,MAAM;QAC/C,OAAO,EAAE,8CAA8C;QACvD,KAAK,EAAE,IAAI;QACX,QAAQ,EAAE,KAAK;KAChB,CAAC,EAAC,CAAC;AACN;;;;;;;;;;;MClBa,wBAAwB;;;;;;IACnC,OAAO,OAAO,CACZ,MAAgD,EAChD,SAA8B,EAAE;QAEhC,OAAO;YACL,QAAQ,EAAE,wBAAwB;YAClC,SAAS,EAAE;gBACT,EAAE,OAAO,EAAE,2BAA2B,EAAE,QAAQ,kCAAO,sCAAsC,GAAK,MAAM,CAAE,EAAC;gBAC3G,GAAG,iCAAiC,CAAC,MAAM,CAAC;aAC7C;SACF,CAAC;KACH;;;YAhBF,QAAQ,SAAC;gBACR,YAAY,EAAE,EAAE;gBAChB,OAAO,EAAE,CAAC,YAAY,CAAC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I,GAAE,EAAE,CAAC,CAAC;;UAC3G,KAAK,SAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,0CAAE,SAAS;;IAGpC,IAAG,CAAC,KAAK,EAAE;QACT,OAAO,IAAI,CAAC;KACb;;;IAID,OAAO,IAAI,IAAI,KAAK,GAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;AACxD,CAAC;;;;;;;;;;;;;;;;"}
|
1
|
+
{"version":3,"file":"daffodil-external-router.js","sources":["../../../libs/external-router/src/config.ts","../../../libs/external-router/src/token/type-resolvable-routes.token.ts","../../../libs/external-router/src/external-router.module.ts","../../../libs/external-router/src/errors/no-wildcard.ts","../../../libs/external-router/src/errors/unknown-type.ts","../../../libs/external-router/src/transform/resolved-route-to-route.ts","../../../libs/external-router/src/router/strategies/insert-route-before-wildcard.ts","../../../libs/external-router/src/router/router.service.ts","../../../libs/external-router/src/router/strategies/insert-data-path.ts","../../../libs/external-router/src/router/url-matcher/data-path-matcher.ts","../../../libs/external-router/src/public_api.ts","../../../libs/external-router/src/daffodil-external-router.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nexport const daffExternalRouterConfigurationDefault: DaffExternalRouterConfiguration = {\n failedResolutionPath: '/',\n notFoundResolutionPath: '/',\n};\n\n/**\n * The token holding the runtime configuration for the behavior of the\n * `@daffodil/external-router` package.\n */\nexport const DAFF_EXTERNAL_ROUTER_CONFIG = new InjectionToken<\n\tDaffExternalRouterConfiguration\n>('DAFF_EXTERNAL_ROUTER_CONFIG', {\n providedIn: 'root',\n factory: () => daffExternalRouterConfigurationDefault,\n});\n\n/**\n * The configuration object for the external router package.\n */\nexport interface DaffExternalRouterConfiguration {\n\t/**\n\t * The path to redirect to when external route resolution fails.\n\t */\n\tfailedResolutionPath: string;\n\n\t/**\n\t * The path to redirect to when the requested URL is not found.\n\t */\n\tnotFoundResolutionPath: string;\n}\n","import {\n InjectionToken,\n Provider,\n} from '@angular/core';\n\nimport { DaffExternalRouterInsertionStrategy } from '../model/insertion-strategy.type';\nimport { DaffExternalRouteType } from '../model/route-type';\nimport { DaffRouteWithoutPath } from '../model/route-without-path';\nimport { DaffTypeRoutePair } from '../model/type-route-pair';\n\n/**\n * A multi-token that allows you to register route \"types\" that correspond to routes.\n */\nexport const DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE = new InjectionToken<\n\tDaffTypeRoutePair[]\n>('DAFF_EXTERNAL_ROUTER_RESOLVABLE_TYPE_ROUTES', {\n providedIn: 'root',\n factory: () => [],\n});\n\n/**\n * A provider used to connect a type to a route to enable dynamic route resolution at runtime.\n */\nexport function daffProvideRouteResolvableByType(typeRoutePair: DaffTypeRoutePair): Provider {\n return {\n provide: DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE,\n multi: true,\n useValue: typeRoutePair,\n };\n}\n\n/**\n * A multi-provider used to connect an array of types to their respective routes.\n */\nexport function daffProvideRoutesResolvableByType(routes: DaffTypeRoutePair[]): Provider[] {\n return routes.map((route: DaffTypeRoutePair) => ({\n provide: DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE,\n multi: true,\n useValue: route,\n }));\n}\n","import { CommonModule } from '@angular/common';\nimport {\n ModuleWithProviders,\n NgModule,\n} from '@angular/core';\n\nimport {\n DaffExternalRouterConfiguration,\n DAFF_EXTERNAL_ROUTER_CONFIG,\n daffExternalRouterConfigurationDefault,\n} from './config';\nimport { DaffTypeRoutePair } from './model/type-route-pair';\nimport { daffProvideRoutesResolvableByType } from './token/type-resolvable-routes.token';\n\n/**\n * The external `DaffExternalRouterModule` allows you to configure the\n * `@daffodil/external-router` package's behavior.\n */\n@NgModule({\n declarations: [],\n imports: [CommonModule],\n})\nexport class DaffExternalRouterModule {\n static forRoot(\n config: Partial<DaffExternalRouterConfiguration>,\n routes: DaffTypeRoutePair[] = [],\n ): ModuleWithProviders<DaffExternalRouterModule> {\n return {\n ngModule: DaffExternalRouterModule,\n providers: [\n { provide: DAFF_EXTERNAL_ROUTER_CONFIG, useValue: { ...daffExternalRouterConfigurationDefault, ...config }},\n ...daffProvideRoutesResolvableByType(routes),\n ],\n };\n }\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\n/**\n * An error thrown when there was no wildcard route found in configuration\n * of the Angular Router.\n */\nexport class DaffExternalRouterNoWildcardError extends DaffInheritableError\n implements DaffError {\n\tpublic readonly code: string = 'NO_WILDCARD_ROUTE';\n\n\tconstructor(message?: string) {\n\t super(message);\n\t}\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\n/**\n * An error thrown when there is a failure matching a configured route to a\n * route type.\n */\nexport class DaffExternalRouterUnknownRouteTypeError extends DaffInheritableError\n implements DaffError {\n\tpublic readonly code: string = 'UNKNOWN_ROUTE_TYPE';\n\n\tconstructor(message?: string) {\n\t super(message);\n\t}\n}\n","import { DaffExternalRouterUnknownRouteTypeError } from '../errors/unknown-type';\nimport { DaffExternallyResolvableUrl } from '../model/resolvable-route';\nimport { DaffRouteInfo } from '../model/route-info';\nimport { DaffTypeRoutePair } from '../model/type-route-pair';\n\n/**\n * Transforms a DaffExternallyResolvableUrl into an Angular Route.\n */\nexport const daffTransformResolvedRouteToRoute = (\n resolvedRoute: DaffExternallyResolvableUrl,\n availableTypes: DaffTypeRoutePair[],\n): DaffRouteInfo => {\n const routeType = availableTypes\n .filter(t => t.type === resolvedRoute.type)\n .shift();\n if (!routeType) {\n throw new DaffExternalRouterUnknownRouteTypeError(\n `Unable to resolve the route '${resolvedRoute.url}'. Its type is '${resolvedRoute.type}' but a matching route wasn't found.`,\n );\n }\n\n return {\n route: {\n path: resolvedRoute.url,\n ...routeType.route,\n data: {\n daffExternalRouteType: resolvedRoute.type,\n ...routeType.route.data,\n },\n },\n insertionStrategy: routeType.insertionStrategy,\n };\n};\n","import {\n Route,\n Routes,\n} from '@angular/router';\n\nimport { DaffExternalRouterNoWildcardError } from '../../errors/no-wildcard';\nimport { DaffExternalRouterInsertionStrategy } from '../../model/insertion-strategy.type';\n\n/**\n * Inserts a Route into Routes right before the wildcard route.\n * If no wildcard is found, it fails fast with a `DaffExternalRouterNoWildcardError`.\n */\nexport const daffInsertRouteBeforeWildCardStrategy: DaffExternalRouterInsertionStrategy = (\n route: Route,\n routes: Routes,\n): Routes => {\n const index = routes.findIndex((r: Route) => r.path === '**');\n if (index === -1) {\n throw new DaffExternalRouterNoWildcardError(\n 'No wildcard (**) route was found during route resolution.',\n );\n }\n return [\n ...routes.slice(0, index),\n route,\n ...routes.slice(index),\n ];\n};\n","import {\n Inject,\n Injectable,\n} from '@angular/core';\nimport {\n Router,\n Route,\n} from '@angular/router';\n\n\nimport { DaffExternalRouterNoWildcardError } from '../errors/no-wildcard';\nimport { DaffExternallyResolvableUrl } from '../model/resolvable-route';\nimport { DaffTypeRoutePair } from '../model/type-route-pair';\nimport { DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE } from '../token/type-resolvable-routes.token';\nimport { daffTransformResolvedRouteToRoute } from '../transform/resolved-route-to-route';\nimport { daffInsertRouteBeforeWildCardStrategy } from './strategies/insert-route-before-wildcard';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffExternalRouter {\n constructor(\n private router: Router,\n @Inject(DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE)\n private runtimeRoutes: DaffTypeRoutePair[],\n ) { }\n\n /**\n * Adds a route to the existing router configuration.\n */\n add(resolvedRoute: DaffExternallyResolvableUrl) {\n //Get the route.\n const {\n route,\n insertionStrategy,\n } = daffTransformResolvedRouteToRoute(\n resolvedRoute,\n this.runtimeRoutes,\n );\n\n try {\n //Add it to configuration.\n this.router.config = (insertionStrategy || daffInsertRouteBeforeWildCardStrategy)(route, this.router.config);\n } catch (e) {\n if (e instanceof DaffExternalRouterNoWildcardError) {\n throw new DaffExternalRouterNoWildcardError(\n `${e.message} This usually means you have misconfigured your routes.`,\n );\n }\n\n throw e;\n }\n }\n}\n","import {\n Route,\n Routes,\n} from '@angular/router';\n\nimport { DaffExternalRouterInsertionStrategy } from '../../model/insertion-strategy.type';\nimport { DaffExternalRouteType } from '../../model/route-type';\nimport { DaffRouteWithDataPath } from '../../model/route-with-data-path';\n\n/**\n * Tests whether or not a route matches a specific Daffodil Route type.\n *\n * See {@link DaffRouteWithDataPath}\n */\nconst routeMatchesRouteType = (route: DaffRouteWithDataPath, type: DaffExternalRouteType): boolean => route?.data?.daffExternalRouteType === type;\n\n/**\n * Adds a path to the `daffPaths` of the given route.\n *\n * See {@link DaffRouteWithDataPath}\n */\nconst addRouteToDaffPaths:\n (route: DaffRouteWithDataPath, path: string) => Route =\n (route: DaffRouteWithDataPath, path: string) => route.data.daffPaths = {\n ...route.data.daffPaths,\n [path]: path,\n };\n\nconst operateOnRoute = (externalRoute: Route): (route: Route) => Route =>\n (route: DaffRouteWithDataPath) => addRouteToDaffPaths(route, externalRoute.path);\n\n/**\n * Traverse the router config tree, halting after the first match.\n * This traversal is implemented in a pre-order manner. As such, for large\n * configuration trees, it will be most efficient to place externally routed\n * components at the top of router configuration.\n */\nconst traverseRouteTree = (routes: Routes = [], matcher: (route: Route) => boolean, operate: (route: Route) => void): Routes => {\n if(routes.length === 0) {\n return routes;\n }\n\n const stack: Routes = [];\n const treeRoot = { children: routes };\n stack.push(treeRoot);\n\n while(stack.length) {\n const route = stack.pop();\n if(matcher(route)) {\n operate(route);\n break;\n }\n if(route.children){\n stack.push(...route.children.reverse());\n }\n }\n return routes;\n};\n\n/**\n * A route insertion strategy that can be used to append external routes onto\n * existing Angular routes. This can be useful when you need to route to\n * an existing lazy-loaded module from multiple externally defined urls.\n *\n * This should be used in combination with the {@link daffDataPathUrlMatcher} to match lazy-loaded modules with\n * associated external urls.\n *\n * For example, you can provide the insertion strategy in the {@link DaffExternalRouterModule} as below.\n *\n * ```ts\n * DaffExternalRouterModule.forRoot({}, [\n * {\n * type: 'CATEGORY',\n * insertionStrategy: daffInsertDataPathStrategy,\n * route: {}\n * }\n * ],\n * ```\n *\n * Then, you can match it with an associated route defined in your Routing\n * configuration with the {@link daffDataPathUrlMatcher}.\n *\n * ```ts\n * export const routes: Routes = [\n * {\n * matcher: daffDataPathUrlMatcher,\n * data: {\n * daffExternalRouteType: \"CATEGORY\",\n * },\n * loadChildren: () => import('./category/category.module').then((m) => m.MyCategoryModule),\n * }\n * ]\n * ```\n *\n * See {@link DaffRouteWithDataPath}\n *\n */\nexport const daffInsertDataPathStrategy: DaffExternalRouterInsertionStrategy = (externalRoute: DaffRouteWithDataPath, routes: Routes) => traverseRouteTree(\n routes,\n (route) => routeMatchesRouteType(route, externalRoute.data?.daffExternalRouteType),\n operateOnRoute(externalRoute),\n);\n","import {\n UrlMatcher,\n UrlSegment,\n UrlSegmentGroup,\n} from '@angular/router';\n\nimport { daffUriTruncateLeadingSlash } from '@daffodil/core/routing';\n\nimport { DaffRouteWithDataPath } from '../../model/public_api';\n\n/**\n * A UrlMatcher that does an exact match against a path stored in the special\n * configuration fields that External Router stores on a Route's data.\n *\n * ```ts\n * export const routes: Routes = [\n * {\n * matcher: daffDataPathUrlMatcher,\n * data: {\n * daffExternalRouteType: \"CATEGORY\",\n * },\n * loadChildren: () => import('./category/category.module').then((m) => m.ShopCategoryModule),\n * }\n * ]\n * ```\n * {@link daffInsertDataPathStrategy }\n * {@link DaffRouteWithDataPath }\n */\nexport const daffDataPathUrlMatcher: UrlMatcher = (segments: UrlSegment[], group: UrlSegmentGroup, route: DaffRouteWithDataPath) => {\n const path = daffUriTruncateLeadingSlash(segments.reduce((acc: string, segment) => acc + '/' + segment.path, ''));\n const paths = route?.data?.daffPaths;\n\n // If we don't have any paths, we can safely fail a match.\n if(!paths) {\n return null;\n }\n\n // Otherwise, look up the path in the dictionary, failing if a match isn't found,\n // but matching the entire segment if a match is found.\n return path in paths ? { consumed: segments } : null;\n};\n\n","/*\n * Public API Surface of @daffodil/external-router\n */\n\nexport { DaffExternalRouterModule } from './external-router.module';\n\nexport {\n DAFF_EXTERNAL_ROUTER_CONFIG,\n DaffExternalRouterConfiguration,\n} from './config';\n\nexport { daffProvideRouteResolvableByType } from './token/type-resolvable-routes.token';\n\nexport * from './model/public_api';\n\nexport { DaffExternalRouter } from './router/router.service';\nexport { daffInsertRouteBeforeWildCardStrategy } from './router/strategies/insert-route-before-wildcard';\n\nexport { daffInsertDataPathStrategy } from './router/strategies/insert-data-path';\nexport { daffDataPathUrlMatcher } from './router/url-matcher/data-path-matcher';\n\nexport { DaffExternalRouterNoWildcardError } from './errors/no-wildcard';\nexport { DaffExternalRouterUnknownRouteTypeError } from './errors/unknown-type';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n\nexport {DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE as ɵa,daffProvideRoutesResolvableByType as ɵb} from './token/type-resolvable-routes.token';"],"names":[],"mappings":";;;;;;AAEO,MAAM,sCAAsC,GAAoC;IACrF,oBAAoB,EAAE,GAAG;IACzB,sBAAsB,EAAE,GAAG;CAC5B,CAAC;AAEF;;;;MAIa,2BAA2B,GAAG,IAAI,cAAc,CAE3D,6BAA6B,EAAE;IAC/B,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,MAAM,sCAAsC;CACtD;;ACND;;;MAGa,8CAA8C,GAAG,IAAI,cAAc,CAE9E,6CAA6C,EAAE;IAC/C,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,MAAM,EAAE;CAClB,EAAE;AAEH;;;SAGgB,gCAAgC,CAAC,aAAgC;IAC/E,OAAO;QACL,OAAO,EAAE,8CAA8C;QACvD,KAAK,EAAE,IAAI;QACX,QAAQ,EAAE,aAAa;KACxB,CAAC;AACJ,CAAC;AAED;;;SAGgB,iCAAiC,CAAC,MAA2B;IAC3E,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAwB,MAAM;QAC/C,OAAO,EAAE,8CAA8C;QACvD,KAAK,EAAE,IAAI;QACX,QAAQ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AK,QAAE,aAAa,CAAC,IAAI,0CAAE,qBAAqB,CAAC,CAAA,EAAA,EAClF,cAAc,CAAC,aAAa,CAAC;;AC1F/B;;;;;;;;;;;;;;;;;;MAkBa,sBAAsB,GAAe,CAAC,QAAsB,EAAE,KAAsB,EAAE,KAA4B;;IAC7H,MAAM,IAAI,GAAG,2BAA2B,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAW,EAAE,OAAO,KAAK,GAAG,GAAG,GAAG,GAAG,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;IAClH,MAAM,KAAK,SAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,0CAAE,SAAS,CAAC;;IAGrC,IAAG,CAAC,KAAK,EAAE;QACT,OAAO,IAAI,CAAC;KACb;;;IAID,OAAO,IAAI,IAAI,KAAK,GAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;AACxD;;ACxCA;;;;ACAA;;;;;;"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@daffodil/external-router",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.39.3",
|
4
4
|
"description": "A platform-agnostic package that connects the @angular/router with an external routing service (e.g. an API), allowing for runtime route resolution.",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -16,12 +16,12 @@
|
|
16
16
|
"@angular/common": "^11.0.0",
|
17
17
|
"@angular/core": "^11.0.0",
|
18
18
|
"@angular/router": "^11.0.0",
|
19
|
-
"@daffodil/core": "0.
|
19
|
+
"@daffodil/core": "0.39.3",
|
20
20
|
"rxjs": "6.6.3"
|
21
21
|
},
|
22
22
|
"optionalDependencies": {
|
23
23
|
"apollo-angular": "^2.4.0",
|
24
|
-
"@daffodil/driver": "0.
|
24
|
+
"@daffodil/driver": "0.39.3"
|
25
25
|
},
|
26
26
|
"main": "bundles/daffodil-external-router.umd.js",
|
27
27
|
"module": "fesm2015/daffodil-external-router.js",
|
package/routing/package.json
CHANGED