@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
@@ -239,7 +239,7 @@
|
|
239
239
|
ar[i] = from[i];
|
240
240
|
}
|
241
241
|
}
|
242
|
-
return to.concat(ar || from);
|
242
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
243
243
|
}
|
244
244
|
function __await(v) {
|
245
245
|
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
@@ -322,64 +322,28 @@
|
|
322
322
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
323
323
|
}
|
324
324
|
|
325
|
-
/**
|
326
|
-
* @fileoverview added by tsickle
|
327
|
-
* Generated from: config.ts
|
328
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
329
|
-
*/
|
330
|
-
/** @type {?} */
|
331
325
|
var daffExternalRouterConfigurationDefault = {
|
332
326
|
failedResolutionPath: '/',
|
333
327
|
notFoundResolutionPath: '/',
|
334
328
|
};
|
335
329
|
/**
|
336
330
|
* The token holding the runtime configuration for the behavior of the
|
337
|
-
*
|
338
|
-
* @type {?}
|
331
|
+
* `@daffodil/external-router` package.
|
339
332
|
*/
|
340
333
|
var DAFF_EXTERNAL_ROUTER_CONFIG = new i0.InjectionToken('DAFF_EXTERNAL_ROUTER_CONFIG', {
|
341
334
|
providedIn: 'root',
|
342
|
-
factory: (
|
343
|
-
* @return {?}
|
344
|
-
*/function () { return daffExternalRouterConfigurationDefault; }),
|
335
|
+
factory: function () { return daffExternalRouterConfigurationDefault; },
|
345
336
|
});
|
346
|
-
/**
|
347
|
-
* The configuration object for the external router package.
|
348
|
-
* @record
|
349
|
-
*/
|
350
|
-
function DaffExternalRouterConfiguration() { }
|
351
|
-
if (false) {
|
352
|
-
/**
|
353
|
-
* The path to redirect to when external route resolution fails.
|
354
|
-
* @type {?}
|
355
|
-
*/
|
356
|
-
DaffExternalRouterConfiguration.prototype.failedResolutionPath;
|
357
|
-
/**
|
358
|
-
* The path to redirect to when the requested URL is not found.
|
359
|
-
* @type {?}
|
360
|
-
*/
|
361
|
-
DaffExternalRouterConfiguration.prototype.notFoundResolutionPath;
|
362
|
-
}
|
363
337
|
|
364
|
-
/**
|
365
|
-
* @fileoverview added by tsickle
|
366
|
-
* Generated from: token/type-resolvable-routes.token.ts
|
367
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
368
|
-
*/
|
369
338
|
/**
|
370
339
|
* A multi-token that allows you to register route "types" that correspond to routes.
|
371
|
-
* @type {?}
|
372
340
|
*/
|
373
341
|
var DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE = new i0.InjectionToken('DAFF_EXTERNAL_ROUTER_RESOLVABLE_TYPE_ROUTES', {
|
374
342
|
providedIn: 'root',
|
375
|
-
factory: (
|
376
|
-
* @return {?}
|
377
|
-
*/function () { return []; }),
|
343
|
+
factory: function () { return []; },
|
378
344
|
});
|
379
345
|
/**
|
380
346
|
* A provider used to connect a type to a route to enable dynamic route resolution at runtime.
|
381
|
-
* @param {?} typeRoutePair
|
382
|
-
* @return {?}
|
383
347
|
*/
|
384
348
|
function daffProvideRouteResolvableByType(typeRoutePair) {
|
385
349
|
return {
|
@@ -390,32 +354,22 @@
|
|
390
354
|
}
|
391
355
|
/**
|
392
356
|
* A multi-provider used to connect an array of types to their respective routes.
|
393
|
-
* @param {?} routes
|
394
|
-
* @return {?}
|
395
357
|
*/
|
396
358
|
function daffProvideRoutesResolvableByType(routes) {
|
397
|
-
return routes.map((
|
398
|
-
* @param {?} route
|
399
|
-
* @return {?}
|
400
|
-
*/function (route) { return ({
|
359
|
+
return routes.map(function (route) { return ({
|
401
360
|
provide: DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE,
|
402
361
|
multi: true,
|
403
362
|
useValue: route,
|
404
|
-
}); })
|
363
|
+
}); });
|
405
364
|
}
|
406
365
|
|
407
366
|
/**
|
408
367
|
* The external `DaffExternalRouterModule` allows you to configure the
|
409
|
-
*
|
368
|
+
* `@daffodil/external-router` package's behavior.
|
410
369
|
*/
|
411
370
|
var DaffExternalRouterModule = /** @class */ (function () {
|
412
371
|
function DaffExternalRouterModule() {
|
413
372
|
}
|
414
|
-
/**
|
415
|
-
* @param {?} config
|
416
|
-
* @param {?=} routes
|
417
|
-
* @return {?}
|
418
|
-
*/
|
419
373
|
DaffExternalRouterModule.forRoot = function (config, routes) {
|
420
374
|
if (routes === void 0) { routes = []; }
|
421
375
|
return {
|
@@ -440,9 +394,6 @@
|
|
440
394
|
*/
|
441
395
|
var DaffExternalRouterNoWildcardError = /** @class */ (function (_super) {
|
442
396
|
__extends(DaffExternalRouterNoWildcardError, _super);
|
443
|
-
/**
|
444
|
-
* @param {?=} message
|
445
|
-
*/
|
446
397
|
function DaffExternalRouterNoWildcardError(message) {
|
447
398
|
var _this = _super.call(this, message) || this;
|
448
399
|
_this.code = 'NO_WILDCARD_ROUTE';
|
@@ -450,10 +401,6 @@
|
|
450
401
|
}
|
451
402
|
return DaffExternalRouterNoWildcardError;
|
452
403
|
}(core.DaffInheritableError));
|
453
|
-
if (false) {
|
454
|
-
/** @type {?} */
|
455
|
-
DaffExternalRouterNoWildcardError.prototype.code;
|
456
|
-
}
|
457
404
|
|
458
405
|
/**
|
459
406
|
* An error thrown when there is a failure matching a configured route to a
|
@@ -461,9 +408,6 @@
|
|
461
408
|
*/
|
462
409
|
var DaffExternalRouterUnknownRouteTypeError = /** @class */ (function (_super) {
|
463
410
|
__extends(DaffExternalRouterUnknownRouteTypeError, _super);
|
464
|
-
/**
|
465
|
-
* @param {?=} message
|
466
|
-
*/
|
467
411
|
function DaffExternalRouterUnknownRouteTypeError(message) {
|
468
412
|
var _this = _super.call(this, message) || this;
|
469
413
|
_this.code = 'UNKNOWN_ROUTE_TYPE';
|
@@ -471,34 +415,13 @@
|
|
471
415
|
}
|
472
416
|
return DaffExternalRouterUnknownRouteTypeError;
|
473
417
|
}(core.DaffInheritableError));
|
474
|
-
if (false) {
|
475
|
-
/** @type {?} */
|
476
|
-
DaffExternalRouterUnknownRouteTypeError.prototype.code;
|
477
|
-
}
|
478
418
|
|
479
|
-
/**
|
480
|
-
* @fileoverview added by tsickle
|
481
|
-
* Generated from: transform/resolved-route-to-route.ts
|
482
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
483
|
-
*/
|
484
419
|
/**
|
485
420
|
* Transforms a DaffExternallyResolvableUrl into an Angular Route.
|
486
|
-
* @type {?}
|
487
421
|
*/
|
488
|
-
var daffTransformResolvedRouteToRoute = (
|
489
|
-
* @param {?} resolvedRoute
|
490
|
-
* @param {?} availableTypes
|
491
|
-
* @return {?}
|
492
|
-
*/function (resolvedRoute, availableTypes) {
|
493
|
-
/** @type {?} */
|
422
|
+
var daffTransformResolvedRouteToRoute = function (resolvedRoute, availableTypes) {
|
494
423
|
var routeType = availableTypes
|
495
|
-
.filter((
|
496
|
-
* @param {?} t
|
497
|
-
* @return {?}
|
498
|
-
*/function (/**
|
499
|
-
* @param {?} t
|
500
|
-
* @return {?}
|
501
|
-
*/ t) { return t.type === resolvedRoute.type; }))
|
424
|
+
.filter(function (t) { return t.type === resolvedRoute.type; })
|
502
425
|
.shift();
|
503
426
|
if (!routeType) {
|
504
427
|
throw new DaffExternalRouterUnknownRouteTypeError("Unable to resolve the route '" + resolvedRoute.url + "'. Its type is '" + resolvedRoute.type + "' but a matching route wasn't found.");
|
@@ -507,49 +430,29 @@
|
|
507
430
|
route: Object.assign(Object.assign({ path: resolvedRoute.url }, routeType.route), { data: Object.assign({ daffExternalRouteType: resolvedRoute.type }, routeType.route.data) }),
|
508
431
|
insertionStrategy: routeType.insertionStrategy,
|
509
432
|
};
|
510
|
-
}
|
433
|
+
};
|
511
434
|
|
512
435
|
/**
|
513
436
|
* Inserts a Route into Routes right before the wildcard route.
|
514
437
|
* If no wildcard is found, it fails fast with a `DaffExternalRouterNoWildcardError`.
|
515
|
-
* @type {?}
|
516
438
|
*/
|
517
|
-
var daffInsertRouteBeforeWildCardStrategy = (
|
518
|
-
|
519
|
-
* @param {?} routes
|
520
|
-
* @return {?}
|
521
|
-
*/function (route, routes) {
|
522
|
-
/** @type {?} */
|
523
|
-
var index = routes.findIndex(( /**
|
524
|
-
* @param {?} r
|
525
|
-
* @return {?}
|
526
|
-
*/function (r) { return r.path === '**'; }));
|
439
|
+
var daffInsertRouteBeforeWildCardStrategy = function (route, routes) {
|
440
|
+
var index = routes.findIndex(function (r) { return r.path === '**'; });
|
527
441
|
if (index === -1) {
|
528
442
|
throw new DaffExternalRouterNoWildcardError('No wildcard (**) route was found during route resolution.');
|
529
443
|
}
|
530
444
|
return __spread(routes.slice(0, index), [
|
531
445
|
route
|
532
446
|
], routes.slice(index));
|
533
|
-
}
|
447
|
+
};
|
534
448
|
|
535
|
-
/**
|
536
|
-
* @fileoverview added by tsickle
|
537
|
-
* Generated from: router/router.service.ts
|
538
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
539
|
-
*/
|
540
449
|
var DaffExternalRouter = /** @class */ (function () {
|
541
|
-
/**
|
542
|
-
* @param {?} router
|
543
|
-
* @param {?} runtimeRoutes
|
544
|
-
*/
|
545
450
|
function DaffExternalRouter(router, runtimeRoutes) {
|
546
451
|
this.router = router;
|
547
452
|
this.runtimeRoutes = runtimeRoutes;
|
548
453
|
}
|
549
454
|
/**
|
550
455
|
* Adds a route to the existing router configuration.
|
551
|
-
* @param {?} resolvedRoute
|
552
|
-
* @return {?}
|
553
456
|
*/
|
554
457
|
DaffExternalRouter.prototype.add = function (resolvedRoute) {
|
555
458
|
//Get the route.
|
@@ -567,6 +470,7 @@
|
|
567
470
|
};
|
568
471
|
return DaffExternalRouter;
|
569
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" });
|
570
474
|
DaffExternalRouter.decorators = [
|
571
475
|
{ type: i0.Injectable, args: [{
|
572
476
|
providedIn: 'root',
|
@@ -577,85 +481,41 @@
|
|
577
481
|
{ type: i1.Router },
|
578
482
|
{ type: Array, decorators: [{ type: i0.Inject, args: [DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE,] }] }
|
579
483
|
]; };
|
580
|
-
/** @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" });
|
581
|
-
if (false) {
|
582
|
-
/**
|
583
|
-
* @type {?}
|
584
|
-
* @private
|
585
|
-
*/
|
586
|
-
DaffExternalRouter.prototype.router;
|
587
|
-
/**
|
588
|
-
* @type {?}
|
589
|
-
* @private
|
590
|
-
*/
|
591
|
-
DaffExternalRouter.prototype.runtimeRoutes;
|
592
|
-
}
|
593
484
|
|
594
|
-
/**
|
595
|
-
* @fileoverview added by tsickle
|
596
|
-
* Generated from: router/strategies/insert-data-path.ts
|
597
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
598
|
-
*/
|
599
485
|
/**
|
600
486
|
* Tests whether or not a route matches a specific Daffodil Route type.
|
601
487
|
*
|
602
|
-
* See {
|
603
|
-
* @type {?}
|
488
|
+
* See {@link DaffRouteWithDataPath}
|
604
489
|
*/
|
605
|
-
var routeMatchesRouteType = (
|
606
|
-
* @param {?} route
|
607
|
-
* @param {?} type
|
608
|
-
* @return {?}
|
609
|
-
*/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; });
|
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; };
|
610
491
|
var ɵ0 = routeMatchesRouteType;
|
611
492
|
/**
|
612
493
|
* Adds a path to the `daffPaths` of the given route.
|
613
494
|
*
|
614
|
-
* See {
|
615
|
-
* @type {?}
|
495
|
+
* See {@link DaffRouteWithDataPath}
|
616
496
|
*/
|
617
|
-
var addRouteToDaffPaths = (
|
618
|
-
* @param {?} route
|
619
|
-
* @param {?} path
|
620
|
-
* @return {?}
|
621
|
-
*/function (route, path) {
|
497
|
+
var addRouteToDaffPaths = function (route, path) {
|
622
498
|
var _b;
|
623
499
|
return route.data.daffPaths = Object.assign(Object.assign({}, route.data.daffPaths), (_b = {}, _b[path] = path, _b));
|
624
|
-
}
|
500
|
+
};
|
625
501
|
var ɵ1 = addRouteToDaffPaths;
|
626
|
-
|
627
|
-
var operateOnRoute = ( /**
|
628
|
-
* @param {?} externalRoute
|
629
|
-
* @return {?}
|
630
|
-
*/function (externalRoute) { return ( /**
|
631
|
-
* @param {?} route
|
632
|
-
* @return {?}
|
633
|
-
*/function (route) { return addRouteToDaffPaths(route, externalRoute.path); }); });
|
502
|
+
var operateOnRoute = function (externalRoute) { return function (route) { return addRouteToDaffPaths(route, externalRoute.path); }; };
|
634
503
|
var ɵ2 = operateOnRoute;
|
635
504
|
/**
|
636
505
|
* Traverse the router config tree, halting after the first match.
|
637
506
|
* This traversal is implemented in a pre-order manner. As such, for large
|
638
507
|
* configuration trees, it will be most efficient to place externally routed
|
639
508
|
* components at the top of router configuration.
|
640
|
-
* @type {?}
|
641
509
|
*/
|
642
|
-
var traverseRouteTree = (
|
643
|
-
* @param {?=} routes
|
644
|
-
* @param {?=} matcher
|
645
|
-
* @param {?=} operate
|
646
|
-
* @return {?}
|
647
|
-
*/function (routes, matcher, operate) {
|
510
|
+
var traverseRouteTree = function (routes, matcher, operate) {
|
648
511
|
if (routes === void 0) { routes = []; }
|
649
512
|
if (routes.length === 0) {
|
650
513
|
return routes;
|
651
514
|
}
|
652
|
-
/** @type {?} */
|
653
515
|
var stack = [];
|
654
|
-
/** @type {?} */
|
655
516
|
var treeRoot = { children: routes };
|
656
517
|
stack.push(treeRoot);
|
657
518
|
while (stack.length) {
|
658
|
-
/** @type {?} */
|
659
519
|
var route = stack.pop();
|
660
520
|
if (matcher(route)) {
|
661
521
|
operate(route);
|
@@ -666,17 +526,17 @@
|
|
666
526
|
}
|
667
527
|
}
|
668
528
|
return routes;
|
669
|
-
}
|
529
|
+
};
|
670
530
|
var ɵ3 = traverseRouteTree;
|
671
531
|
/**
|
672
532
|
* A route insertion strategy that can be used to append external routes onto
|
673
533
|
* existing Angular routes. This can be useful when you need to route to
|
674
534
|
* an existing lazy-loaded module from multiple externally defined urls.
|
675
535
|
*
|
676
|
-
* This should be used in combination with the {
|
536
|
+
* This should be used in combination with the {@link daffDataPathUrlMatcher} to match lazy-loaded modules with
|
677
537
|
* associated external urls.
|
678
538
|
*
|
679
|
-
* For example, you can provide the insertion strategy in the {
|
539
|
+
* For example, you can provide the insertion strategy in the {@link DaffExternalRouterModule} as below.
|
680
540
|
*
|
681
541
|
* ```ts
|
682
542
|
* DaffExternalRouterModule.forRoot({}, [
|
@@ -689,7 +549,7 @@
|
|
689
549
|
* ```
|
690
550
|
*
|
691
551
|
* Then, you can match it with an associated route defined in your Routing
|
692
|
-
* configuration with the {
|
552
|
+
* configuration with the {@link daffDataPathUrlMatcher}.
|
693
553
|
*
|
694
554
|
* ```ts
|
695
555
|
* export const routes: Routes = [
|
@@ -703,24 +563,11 @@
|
|
703
563
|
* ]
|
704
564
|
* ```
|
705
565
|
*
|
706
|
-
* See {
|
566
|
+
* See {@link DaffRouteWithDataPath}
|
707
567
|
*
|
708
|
-
* @type {?}
|
709
568
|
*/
|
710
|
-
var daffInsertDataPathStrategy = (
|
711
|
-
* @param {?} externalRoute
|
712
|
-
* @param {?} routes
|
713
|
-
* @return {?}
|
714
|
-
*/function (externalRoute, routes) { return traverseRouteTree(routes, ( /**
|
715
|
-
* @param {?} route
|
716
|
-
* @return {?}
|
717
|
-
*/function (route) { var _a; return routeMatchesRouteType(route, (_a = externalRoute.data) === null || _a === void 0 ? void 0 : _a.daffExternalRouteType); }), operateOnRoute(externalRoute)); });
|
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)); };
|
718
570
|
|
719
|
-
/**
|
720
|
-
* @fileoverview added by tsickle
|
721
|
-
* Generated from: router/url-matcher/data-path-matcher.ts
|
722
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
723
|
-
*/
|
724
571
|
/**
|
725
572
|
* A UrlMatcher that does an exact match against a path stored in the special
|
726
573
|
* configuration fields that External Router stores on a Route's data.
|
@@ -736,24 +583,12 @@
|
|
736
583
|
* }
|
737
584
|
* ]
|
738
585
|
* ```
|
739
|
-
* {
|
740
|
-
* {
|
741
|
-
* @type {?}
|
586
|
+
* {@link daffInsertDataPathStrategy }
|
587
|
+
* {@link DaffRouteWithDataPath }
|
742
588
|
*/
|
743
|
-
var daffDataPathUrlMatcher = (
|
744
|
-
* @param {?} segments
|
745
|
-
* @param {?} group
|
746
|
-
* @param {?} route
|
747
|
-
* @return {?}
|
748
|
-
*/function (segments, group, route) {
|
589
|
+
var daffDataPathUrlMatcher = function (segments, group, route) {
|
749
590
|
var _a;
|
750
|
-
|
751
|
-
var path = routing.daffUriTruncateLeadingSlash(segments.reduce(( /**
|
752
|
-
* @param {?} acc
|
753
|
-
* @param {?} segment
|
754
|
-
* @return {?}
|
755
|
-
*/function (acc, segment) { return acc + '/' + segment.path; }), ''));
|
756
|
-
/** @type {?} */
|
591
|
+
var path = routing.daffUriTruncateLeadingSlash(segments.reduce(function (acc, segment) { return acc + '/' + segment.path; }, ''));
|
757
592
|
var paths = (_a = route === null || route === void 0 ? void 0 : route.data) === null || _a === void 0 ? void 0 : _a.daffPaths;
|
758
593
|
// If we don't have any paths, we can safely fail a match.
|
759
594
|
if (!paths) {
|
@@ -762,18 +597,14 @@
|
|
762
597
|
// Otherwise, look up the path in the dictionary, failing if a match isn't found,
|
763
598
|
// but matching the entire segment if a match is found.
|
764
599
|
return path in paths ? { consumed: segments } : null;
|
765
|
-
}
|
600
|
+
};
|
766
601
|
|
767
|
-
|
768
|
-
*
|
769
|
-
* Generated from: public_api.ts
|
770
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
602
|
+
/*
|
603
|
+
* Public API Surface of @daffodil/external-router
|
771
604
|
*/
|
772
605
|
|
773
606
|
/**
|
774
|
-
*
|
775
|
-
* Generated from: daffodil-external-router.ts
|
776
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
607
|
+
* Generated bundle index. Do not edit.
|
777
608
|
*/
|
778
609
|
|
779
610
|
exports.DAFF_EXTERNAL_ROUTER_CONFIG = DAFF_EXTERNAL_ROUTER_CONFIG;
|