@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
@@ -4,58 +4,30 @@
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.daffodil = global.daffodil || {}, global.daffodil['external-router'] = global.daffodil['external-router'] || {}, global.daffodil['external-router'].driver = global.daffodil['external-router'].driver || {}, global.daffodil['external-router'].driver.testing = {}), global.ng.core, global.faker, global.rxjs, global.routing, global.ng.common, global.daffodil['external-router'].driver));
|
5
5
|
}(this, (function (exports, i0, faker, rxjs, routing, common, driver) { 'use strict';
|
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
|
-
/**
|
13
|
-
* The configuration for the testing driver. It is a dictionary of "url": "type",
|
14
|
-
* pairs, where the URL is a URL-safe routeable path, e.g. "sweatshirts" or "t-shirts"
|
15
|
-
* and the type is a known type to your application, e.g. "CATEGORY".
|
16
|
-
* @record
|
17
|
-
*/
|
18
|
-
function DaffExternalRouterDriverTestingConfig() { }
|
19
7
|
/**
|
20
8
|
* The token used by Daffodil to hold the driver's configuration.
|
21
9
|
*
|
22
|
-
*
|
23
|
-
* @type {?}
|
10
|
+
* @docs-private
|
24
11
|
*/
|
25
12
|
var DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG = new i0.InjectionToken('DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG', {
|
26
13
|
providedIn: 'root',
|
27
|
-
factory: (
|
28
|
-
* @return {?}
|
29
|
-
*/function () { return ({}); }),
|
14
|
+
factory: function () { return ({}); },
|
30
15
|
});
|
31
16
|
|
32
|
-
/**
|
33
|
-
* @fileoverview added by tsickle
|
34
|
-
* Generated from: testing.service.ts
|
35
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
36
|
-
*/
|
37
17
|
/**
|
38
18
|
* The DaffExternalRouterTestingDriver is responsible for translating an
|
39
19
|
* arbitrary URI into a DaffExternallyResolvableUrl in testing environments.
|
40
20
|
*
|
41
|
-
*
|
21
|
+
* @inheritdoc
|
42
22
|
*
|
43
|
-
* @see {
|
23
|
+
* @see {@link DaffExternalRouterTestingDriver}
|
44
24
|
*/
|
45
25
|
var DaffExternalRouterTestingDriver = /** @class */ (function () {
|
46
|
-
/**
|
47
|
-
* @param {?=} testingConfiguration
|
48
|
-
*/
|
49
26
|
function DaffExternalRouterTestingDriver(testingConfiguration) {
|
50
27
|
if (testingConfiguration === void 0) { testingConfiguration = {}; }
|
51
28
|
this.testingConfiguration = testingConfiguration;
|
52
29
|
}
|
53
|
-
/**
|
54
|
-
* @param {?} url
|
55
|
-
* @return {?}
|
56
|
-
*/
|
57
30
|
DaffExternalRouterTestingDriver.prototype.resolve = function (url) {
|
58
|
-
/** @type {?} */
|
59
31
|
var truncatedUrl = routing.daffUriTruncateLeadingSlash(routing.daffUriTruncateQueryFragment(url));
|
60
32
|
if (!this.testingConfiguration[truncatedUrl]) {
|
61
33
|
return rxjs.throwError("The route '" + truncatedUrl + "' wasn't provided with a matching type by the testing driver. Did you configure the available route types with DaffExternalRouterDriverTestingModule.forRoot(config)");
|
@@ -69,6 +41,7 @@
|
|
69
41
|
};
|
70
42
|
return DaffExternalRouterTestingDriver;
|
71
43
|
}());
|
44
|
+
/** @nocollapse */ DaffExternalRouterTestingDriver.ɵprov = i0.ɵɵdefineInjectable({ factory: function DaffExternalRouterTestingDriver_Factory() { return new DaffExternalRouterTestingDriver(i0.ɵɵinject(DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG)); }, token: DaffExternalRouterTestingDriver, providedIn: "root" });
|
72
45
|
DaffExternalRouterTestingDriver.decorators = [
|
73
46
|
{ type: i0.Injectable, args: [{
|
74
47
|
providedIn: 'root',
|
@@ -78,31 +51,14 @@
|
|
78
51
|
DaffExternalRouterTestingDriver.ctorParameters = function () { return [
|
79
52
|
{ type: undefined, decorators: [{ type: i0.Inject, args: [DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG,] }] }
|
80
53
|
]; };
|
81
|
-
/** @nocollapse */ DaffExternalRouterTestingDriver.ɵprov = i0.ɵɵdefineInjectable({ factory: function DaffExternalRouterTestingDriver_Factory() { return new DaffExternalRouterTestingDriver(i0.ɵɵinject(DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG)); }, token: DaffExternalRouterTestingDriver, providedIn: "root" });
|
82
|
-
if (false) {
|
83
|
-
/**
|
84
|
-
* @type {?}
|
85
|
-
* @private
|
86
|
-
*/
|
87
|
-
DaffExternalRouterTestingDriver.prototype.testingConfiguration;
|
88
|
-
}
|
89
54
|
|
90
|
-
/**
|
91
|
-
* @fileoverview added by tsickle
|
92
|
-
* Generated from: testing.module.ts
|
93
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
94
|
-
*/
|
95
55
|
/**
|
96
56
|
* The `DaffExternalRouterDriverTestingModule` is an importable NgModule that can
|
97
|
-
* be used to configure the {
|
57
|
+
* be used to configure the {@link DaffExternalRouterTestingDriver}.
|
98
58
|
*/
|
99
59
|
var DaffExternalRouterDriverTestingModule = /** @class */ (function () {
|
100
60
|
function DaffExternalRouterDriverTestingModule() {
|
101
61
|
}
|
102
|
-
/**
|
103
|
-
* @param {?} config
|
104
|
-
* @return {?}
|
105
|
-
*/
|
106
62
|
DaffExternalRouterDriverTestingModule.forRoot = function (config) {
|
107
63
|
return {
|
108
64
|
ngModule: DaffExternalRouterDriverTestingModule,
|
@@ -127,22 +83,12 @@
|
|
127
83
|
},] }
|
128
84
|
];
|
129
85
|
|
130
|
-
|
131
|
-
*
|
132
|
-
* Generated from: public_api.ts
|
133
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
134
|
-
*/
|
135
|
-
|
136
|
-
/**
|
137
|
-
* @fileoverview added by tsickle
|
138
|
-
* Generated from: index.ts
|
139
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
86
|
+
/*
|
87
|
+
* Public API Surface of @daffodil/external-router/driver/testing
|
140
88
|
*/
|
141
89
|
|
142
90
|
/**
|
143
|
-
*
|
144
|
-
* Generated from: daffodil-external-router-driver-testing.ts
|
145
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
91
|
+
* Generated bundle index. Do not edit.
|
146
92
|
*/
|
147
93
|
|
148
94
|
exports.DaffExternalRouterDriverTestingModule = DaffExternalRouterDriverTestingModule;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"daffodil-external-router-driver-testing.umd.js","sources":["../../../libs/external-router/driver/testing/src/config.ts","../../../libs/external-router/driver/testing/src/testing.service.ts","../../../libs/external-router/driver/testing/src/testing.module.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nimport { DaffExternalRouteType } from '@daffodil/external-router';\n\n/**\n * The configuration for the testing driver. It is a dictionary of \"url\": \"type\",\n * pairs, where the URL is a URL-safe routeable path, e.g. \"sweatshirts\" or \"t-shirts\"\n * and the type is a known type to your application, e.g. \"CATEGORY\".\n */\nexport interface DaffExternalRouterDriverTestingConfig {\n\t[url: string]: DaffExternalRouteType;\n}\n\n/**\n * The token used by Daffodil to hold the driver's configuration.\n *\n * @docs-private\n */\nexport const DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG = new InjectionToken<\n\tDaffExternalRouterDriverTestingConfig\n>('DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG', {\n providedIn: 'root',\n factory: () => ({}),\n});\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport * as faker from 'faker/locale/en_US';\nimport {\n Observable,\n of,\n throwError,\n} from 'rxjs';\n\nimport {\n daffUriTruncateLeadingSlash,\n daffUriTruncateQueryFragment,\n} from '@daffodil/core/routing';\nimport { DaffExternallyResolvableUrl } from '@daffodil/external-router';\nimport { DaffExternalRouterDriverInterface } from '@daffodil/external-router/driver';\n\nimport {\n DaffExternalRouterDriverTestingConfig,\n DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG,\n} from './config';\n\n/**\n * The DaffExternalRouterTestingDriver is responsible for translating an\n * arbitrary URI into a DaffExternallyResolvableUrl in testing environments.\n *\n * @inheritdoc\n *\n * @see {@link DaffExternalRouterTestingDriver}\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffExternalRouterTestingDriver\nimplements DaffExternalRouterDriverInterface {\n constructor(\n\t\t@Inject(DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG)\n\t\tprivate testingConfiguration: DaffExternalRouterDriverTestingConfig = {},\n ) {}\n\n resolve(url: string): Observable<DaffExternallyResolvableUrl> {\n const truncatedUrl = daffUriTruncateLeadingSlash(daffUriTruncateQueryFragment(url));\n\n if (!this.testingConfiguration[truncatedUrl]) {\n return throwError(`\\\nThe route '${truncatedUrl}' wasn't provided with a matching type by the testing driver. \\\nDid you configure the available route types with DaffExternalRouterDriverTestingModule.forRoot(config)`);\n }\n\n return of({\n id: faker.datatype.uuid(),\n url: truncatedUrl,\n type: this.testingConfiguration[truncatedUrl],\n code: 200,\n });\n }\n}\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport { DaffExternalRouterDriver } from '@daffodil/external-router/driver';\n\nimport {\n DaffExternalRouterDriverTestingConfig,\n DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG,\n} from './config';\nimport { DaffExternalRouterTestingDriver } from './testing.service';\n\n/**\n * The `DaffExternalRouterDriverTestingModule` is an importable NgModule that can\n * be used to configure the {@link DaffExternalRouterTestingDriver}.\n */\n@NgModule({\n declarations: [],\n imports: [CommonModule],\n})\nexport class DaffExternalRouterDriverTestingModule {\n static forRoot(\n config: DaffExternalRouterDriverTestingConfig,\n ): ModuleWithProviders<DaffExternalRouterDriverTestingModule> {\n return {\n ngModule: DaffExternalRouterDriverTestingModule,\n providers: [\n {\n provide: DaffExternalRouterDriver,\n useExisting: DaffExternalRouterTestingDriver,\n },\n {\n provide: DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG,\n useValue: config,\n },\n ],\n };\n }\n}\n"],"names":["InjectionToken","daffUriTruncateLeadingSlash","daffUriTruncateQueryFragment","throwError","of","faker.datatype","Injectable","Inject","DaffExternalRouterDriver","NgModule","CommonModule"],"mappings":"
|
1
|
+
{"version":3,"file":"daffodil-external-router-driver-testing.umd.js","sources":["../../../libs/external-router/driver/testing/src/config.ts","../../../libs/external-router/driver/testing/src/testing.service.ts","../../../libs/external-router/driver/testing/src/testing.module.ts","../../../libs/external-router/driver/testing/src/public_api.ts","../../../libs/external-router/driver/testing/src/daffodil-external-router-driver-testing.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nimport { DaffExternalRouteType } from '@daffodil/external-router';\n\n/**\n * The configuration for the testing driver. It is a dictionary of \"url\": \"type\",\n * pairs, where the URL is a URL-safe routeable path, e.g. \"sweatshirts\" or \"t-shirts\"\n * and the type is a known type to your application, e.g. \"CATEGORY\".\n */\nexport interface DaffExternalRouterDriverTestingConfig {\n\t[url: string]: DaffExternalRouteType;\n}\n\n/**\n * The token used by Daffodil to hold the driver's configuration.\n *\n * @docs-private\n */\nexport const DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG = new InjectionToken<\n\tDaffExternalRouterDriverTestingConfig\n>('DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG', {\n providedIn: 'root',\n factory: () => ({}),\n});\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport * as faker from 'faker/locale/en_US';\nimport {\n Observable,\n of,\n throwError,\n} from 'rxjs';\n\nimport {\n daffUriTruncateLeadingSlash,\n daffUriTruncateQueryFragment,\n} from '@daffodil/core/routing';\nimport { DaffExternallyResolvableUrl } from '@daffodil/external-router';\nimport { DaffExternalRouterDriverInterface } from '@daffodil/external-router/driver';\n\nimport {\n DaffExternalRouterDriverTestingConfig,\n DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG,\n} from './config';\n\n/**\n * The DaffExternalRouterTestingDriver is responsible for translating an\n * arbitrary URI into a DaffExternallyResolvableUrl in testing environments.\n *\n * @inheritdoc\n *\n * @see {@link DaffExternalRouterTestingDriver}\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffExternalRouterTestingDriver\nimplements DaffExternalRouterDriverInterface {\n constructor(\n\t\t@Inject(DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG)\n\t\tprivate testingConfiguration: DaffExternalRouterDriverTestingConfig = {},\n ) {}\n\n resolve(url: string): Observable<DaffExternallyResolvableUrl> {\n const truncatedUrl = daffUriTruncateLeadingSlash(daffUriTruncateQueryFragment(url));\n\n if (!this.testingConfiguration[truncatedUrl]) {\n return throwError(`\\\nThe route '${truncatedUrl}' wasn't provided with a matching type by the testing driver. \\\nDid you configure the available route types with DaffExternalRouterDriverTestingModule.forRoot(config)`);\n }\n\n return of({\n id: faker.datatype.uuid(),\n url: truncatedUrl,\n type: this.testingConfiguration[truncatedUrl],\n code: 200,\n });\n }\n}\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport { DaffExternalRouterDriver } from '@daffodil/external-router/driver';\n\nimport {\n DaffExternalRouterDriverTestingConfig,\n DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG,\n} from './config';\nimport { DaffExternalRouterTestingDriver } from './testing.service';\n\n/**\n * The `DaffExternalRouterDriverTestingModule` is an importable NgModule that can\n * be used to configure the {@link DaffExternalRouterTestingDriver}.\n */\n@NgModule({\n declarations: [],\n imports: [CommonModule],\n})\nexport class DaffExternalRouterDriverTestingModule {\n static forRoot(\n config: DaffExternalRouterDriverTestingConfig,\n ): ModuleWithProviders<DaffExternalRouterDriverTestingModule> {\n return {\n ngModule: DaffExternalRouterDriverTestingModule,\n providers: [\n {\n provide: DaffExternalRouterDriver,\n useExisting: DaffExternalRouterTestingDriver,\n },\n {\n provide: DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG,\n useValue: config,\n },\n ],\n };\n }\n}\n","/*\n * Public API Surface of @daffodil/external-router/driver/testing\n */\n\nexport { DaffExternalRouterTestingDriver } from './testing.service';\nexport { DaffExternalRouterDriverTestingModule } from './testing.module';\n\nexport { DaffExternalRouterDriverTestingConfig } from './config';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n\nexport {DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG as ɵa} from './config';"],"names":["InjectionToken","daffUriTruncateLeadingSlash","daffUriTruncateQueryFragment","throwError","of","faker.datatype","Injectable","Inject","DaffExternalRouterDriver","NgModule","CommonModule"],"mappings":";;;;;;IAaA;;;;;QAKa,0CAA0C,GAAG,IAAIA,iBAAc,CAE1E,4CAA4C,EAAE;QAC9C,UAAU,EAAE,MAAM;QAClB,OAAO,EAAE,cAAM,QAAC,EAAE,IAAC;KACpB;;ICAD;;;;;;;;;QAaE,yCAEQ,oBAAgE;YAAhE,qCAAA,EAAA,yBAAgE;YAAhE,yBAAoB,GAApB,oBAAoB,CAA4C;SACpE;QAEJ,iDAAO,GAAP,UAAQ,GAAW;YACjB,IAAM,YAAY,GAAGC,mCAA2B,CAACC,oCAA4B,CAAC,GAAG,CAAC,CAAC,CAAC;YAEpF,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,YAAY,CAAC,EAAE;gBAC5C,OAAOC,eAAU,CAAC,gBACX,YAAY,yKAC8E,CAAC,CAAC;aACpG;YAED,OAAOC,OAAE,CAAC;gBACR,EAAE,EAAEC,cAAc,CAAC,IAAI,EAAE;gBACzB,GAAG,EAAE,YAAY;gBACjB,IAAI,EAAE,IAAI,CAAC,oBAAoB,CAAC,YAAY,CAAC;gBAC7C,IAAI,EAAE,GAAG;aACV,CAAC,CAAC;SACJ;;;;;gBAzBFC,aAAU,SAAC;oBACV,UAAU,EAAE,MAAM;iBACnB;;;;gDAIEC,SAAM,SAAC,0CAA0C;;;ICvBpD;;;;;QAQA;;QACS,6CAAO,GAAd,UACE,MAA6C;YAE7C,OAAO;gBACL,QAAQ,EAAE,qCAAqC;gBAC/C,SAAS,EAAE;oBACT;wBACE,OAAO,EAAEC,+BAAwB;wBACjC,WAAW,EAAE,+BAA+B;qBAC7C;oBACD;wBACE,OAAO,EAAE,0CAA0C;wBACnD,QAAQ,EAAE,MAAM;qBACjB;iBACF;aACF,CAAC;SACH;;;;gBArBFC,WAAQ,SAAC;oBACR,YAAY,EAAE,EAAE;oBAChB,OAAO,EAAE,CAACC,mBAAY,CAAC;iBACxB;;;ICrBD;;;;ICAA;;;;;;;;;;;;;;"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("@angular/core"),require("faker/locale/en_US"),require("rxjs"),require("@daffodil/core/routing"),require("@angular/common"),require("@daffodil/external-router/driver")):"function"==typeof define&&define.amd?define("@daffodil/external-router/driver/testing",["exports","@angular/core","faker/locale/en_US","rxjs","@daffodil/core/routing","@angular/common","@daffodil/external-router/driver"],r):r(((e="undefined"!=typeof globalThis?globalThis:e||self).daffodil=e.daffodil||{},e.daffodil["external-router"]=e.daffodil["external-router"]||{},e.daffodil["external-router"].driver=e.daffodil["external-router"].driver||{},e.daffodil["external-router"].driver.testing={}),e.ng.core,e.faker,e.rxjs,e.routing,e.ng.common,e.daffodil["external-router"].driver)}(this,(function(e,r,o,t,n,i,a){"use strict";var d=new r.InjectionToken("DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG",{providedIn:"root",factory:function(){return{}}}),f=function(){function e(e){void 0===e&&(e={}),this.testingConfiguration=e}return e.prototype.resolve=function(e){var r=n.daffUriTruncateLeadingSlash(n.daffUriTruncateQueryFragment(e));return this.testingConfiguration[r]?t.of({id:o.datatype.uuid(),url:r,type:this.testingConfiguration[r],code:200}):t.throwError("The route '"+r+"' wasn't provided with a matching type by the testing driver. Did you configure the available route types with DaffExternalRouterDriverTestingModule.forRoot(config)")},e}();f.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],f.ctorParameters=function(){return[{type:void 0,decorators:[{type:r.Inject,args:[d]}]}]}
|
1
|
+
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("@angular/core"),require("faker/locale/en_US"),require("rxjs"),require("@daffodil/core/routing"),require("@angular/common"),require("@daffodil/external-router/driver")):"function"==typeof define&&define.amd?define("@daffodil/external-router/driver/testing",["exports","@angular/core","faker/locale/en_US","rxjs","@daffodil/core/routing","@angular/common","@daffodil/external-router/driver"],r):r(((e="undefined"!=typeof globalThis?globalThis:e||self).daffodil=e.daffodil||{},e.daffodil["external-router"]=e.daffodil["external-router"]||{},e.daffodil["external-router"].driver=e.daffodil["external-router"].driver||{},e.daffodil["external-router"].driver.testing={}),e.ng.core,e.faker,e.rxjs,e.routing,e.ng.common,e.daffodil["external-router"].driver)}(this,(function(e,r,o,t,n,i,a){"use strict";var d=new r.InjectionToken("DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG",{providedIn:"root",factory:function(){return{}}}),f=function(){function e(e){void 0===e&&(e={}),this.testingConfiguration=e}return e.prototype.resolve=function(e){var r=n.daffUriTruncateLeadingSlash(n.daffUriTruncateQueryFragment(e));return this.testingConfiguration[r]?t.of({id:o.datatype.uuid(),url:r,type:this.testingConfiguration[r],code:200}):t.throwError("The route '"+r+"' wasn't provided with a matching type by the testing driver. Did you configure the available route types with DaffExternalRouterDriverTestingModule.forRoot(config)")},e}();f.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new f(r.ɵɵinject(d))},token:f,providedIn:"root"}),f.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],f.ctorParameters=function(){return[{type:void 0,decorators:[{type:r.Inject,args:[d]}]}]};var u=function(){function e(){}return e.forRoot=function(r){return{ngModule:e,providers:[{provide:a.DaffExternalRouterDriver,useExisting:f},{provide:d,useValue:r}]}},e}();u.decorators=[{type:r.NgModule,args:[{declarations:[],imports:[i.CommonModule]}]}],e.DaffExternalRouterDriverTestingModule=u,e.DaffExternalRouterTestingDriver=f,e.ɵa=d,Object.defineProperty(e,"__esModule",{value:!0})}));
|
2
2
|
//# sourceMappingURL=daffodil-external-router-driver-testing.umd.min.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../libs/external-router/driver/testing/src/config.ts","../../../libs/external-router/driver/testing/src/testing.service.ts","../../../libs/external-router/driver/testing/src/testing.module.ts"],"names":["DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG","InjectionToken","providedIn","factory","DaffExternalRouterTestingDriver","testingConfiguration","this","prototype","resolve","url","truncatedUrl","daffUriTruncateLeadingSlash","daffUriTruncateQueryFragment","of","id","faker.datatype","uuid","type","code","throwError","Injectable","args","Inject","DaffExternalRouterDriverTestingModule","forRoot","config","ngModule","providers","provide","DaffExternalRouterDriver","useExisting","useValue","NgModule","declarations","imports","CommonModule"],"mappings":"q3BAkBaA,EAA6C,IAAIC,EAAAA,eAE5D,6CAA8C,CAC9CC,WAAY,OACZC,
|
1
|
+
{"version":3,"sources":["../../../libs/external-router/driver/testing/src/config.ts","../../../libs/external-router/driver/testing/src/testing.service.ts","../../../libs/external-router/driver/testing/src/testing.module.ts"],"names":["DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG","InjectionToken","providedIn","factory","DaffExternalRouterTestingDriver","testingConfiguration","this","prototype","resolve","url","truncatedUrl","daffUriTruncateLeadingSlash","daffUriTruncateQueryFragment","of","id","faker.datatype","uuid","type","code","throwError","Injectable","args","Inject","DaffExternalRouterDriverTestingModule","forRoot","config","ngModule","providers","provide","DaffExternalRouterDriver","useExisting","useValue","NgModule","declarations","imports","CommonModule"],"mappings":"q3BAkBaA,EAA6C,IAAIC,EAAAA,eAE5D,6CAA8C,CAC9CC,WAAY,OACZC,QAAS,WAAM,MAAA,mBCcf,SAAAC,EAEQC,QAAA,IAAAA,IAAAA,EAAA,IAAAC,KAAAD,qBAAAA,SAGRD,EAAAG,UAAAC,QAAA,SAAQC,GACN,IAAMC,EAAeC,EAAAA,4BAA4BC,EAAAA,6BAA6BH,IAE9E,OAAKH,KAAKD,qBAAqBK,GAMxBG,EAAAA,GAAG,CACRC,GAAIC,EAAAA,SAAeC,OACnBP,IAAKC,EACLO,KAAMX,KAAKD,qBAAqBK,GAChCQ,KAAM,MATCC,EAAAA,WAAW,cACXT,EAAY,4SAfxBU,EAAAA,WAAUC,KAAA,CAAC,CACVnB,WAAY,6EAKXoB,EAAAA,OAAMD,KAAA,CAACrB,yBCfV,SAAAuB,YACSA,EAAAC,QAAP,SACEC,GAEA,MAAO,CACLC,SAAUH,EACVI,UAAW,CACT,CACEC,QAASC,EAAAA,yBACTC,YAAa1B,GAEf,CACEwB,QAAS5B,EACT+B,SAAUN,+BAjBnBO,EAAAA,SAAQX,KAAA,CAAC,CACRY,aAAc,GACdC,QAAS,CAACC,EAAAA","sourcesContent":["import { InjectionToken } from '@angular/core';\n\nimport { DaffExternalRouteType } from '@daffodil/external-router';\n\n/**\n * The configuration for the testing driver. It is a dictionary of \"url\": \"type\",\n * pairs, where the URL is a URL-safe routeable path, e.g. \"sweatshirts\" or \"t-shirts\"\n * and the type is a known type to your application, e.g. \"CATEGORY\".\n */\nexport interface DaffExternalRouterDriverTestingConfig {\n\t[url: string]: DaffExternalRouteType;\n}\n\n/**\n * The token used by Daffodil to hold the driver's configuration.\n *\n * @docs-private\n */\nexport const DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG = new InjectionToken<\n\tDaffExternalRouterDriverTestingConfig\n>('DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG', {\n providedIn: 'root',\n factory: () => ({}),\n});\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport * as faker from 'faker/locale/en_US';\nimport {\n Observable,\n of,\n throwError,\n} from 'rxjs';\n\nimport {\n daffUriTruncateLeadingSlash,\n daffUriTruncateQueryFragment,\n} from '@daffodil/core/routing';\nimport { DaffExternallyResolvableUrl } from '@daffodil/external-router';\nimport { DaffExternalRouterDriverInterface } from '@daffodil/external-router/driver';\n\nimport {\n DaffExternalRouterDriverTestingConfig,\n DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG,\n} from './config';\n\n/**\n * The DaffExternalRouterTestingDriver is responsible for translating an\n * arbitrary URI into a DaffExternallyResolvableUrl in testing environments.\n *\n * @inheritdoc\n *\n * @see {@link DaffExternalRouterTestingDriver}\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffExternalRouterTestingDriver\nimplements DaffExternalRouterDriverInterface {\n constructor(\n\t\t@Inject(DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG)\n\t\tprivate testingConfiguration: DaffExternalRouterDriverTestingConfig = {},\n ) {}\n\n resolve(url: string): Observable<DaffExternallyResolvableUrl> {\n const truncatedUrl = daffUriTruncateLeadingSlash(daffUriTruncateQueryFragment(url));\n\n if (!this.testingConfiguration[truncatedUrl]) {\n return throwError(`\\\nThe route '${truncatedUrl}' wasn't provided with a matching type by the testing driver. \\\nDid you configure the available route types with DaffExternalRouterDriverTestingModule.forRoot(config)`);\n }\n\n return of({\n id: faker.datatype.uuid(),\n url: truncatedUrl,\n type: this.testingConfiguration[truncatedUrl],\n code: 200,\n });\n }\n}\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport { DaffExternalRouterDriver } from '@daffodil/external-router/driver';\n\nimport {\n DaffExternalRouterDriverTestingConfig,\n DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG,\n} from './config';\nimport { DaffExternalRouterTestingDriver } from './testing.service';\n\n/**\n * The `DaffExternalRouterDriverTestingModule` is an importable NgModule that can\n * be used to configure the {@link DaffExternalRouterTestingDriver}.\n */\n@NgModule({\n declarations: [],\n imports: [CommonModule],\n})\nexport class DaffExternalRouterDriverTestingModule {\n static forRoot(\n config: DaffExternalRouterDriverTestingConfig,\n ): ModuleWithProviders<DaffExternalRouterDriverTestingModule> {\n return {\n ngModule: DaffExternalRouterDriverTestingModule,\n providers: [\n {\n provide: DaffExternalRouterDriver,\n useExisting: DaffExternalRouterTestingDriver,\n },\n {\n provide: DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG,\n useValue: config,\n },\n ],\n };\n }\n}\n"]}
|
@@ -5,45 +5,15 @@
|
|
5
5
|
}(this, (function (exports, core) { 'use strict';
|
6
6
|
|
7
7
|
/**
|
8
|
-
*
|
9
|
-
* Generated from: interfaces/external-router-driver.interface.ts
|
10
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
11
|
-
*/
|
12
|
-
/**
|
13
|
-
* The token for the `\@daffodil/external-router` driver.
|
14
|
-
* @type {?}
|
8
|
+
* The token for the `@daffodil/external-router` driver.
|
15
9
|
*/
|
16
10
|
var DaffExternalRouterDriver = new core.InjectionToken('DaffExternalRouterDriver');
|
17
|
-
/**
|
18
|
-
* The interface for a \@daffodil/external-router driver.
|
19
|
-
*
|
20
|
-
* This driver is responsible for translating a URL into a Route consumable by
|
21
|
-
* Daffodil.
|
22
|
-
* @record
|
23
|
-
*/
|
24
|
-
function DaffExternalRouterDriverInterface() { }
|
25
|
-
if (false) {
|
26
|
-
/**
|
27
|
-
* Resolves a URL with a platform.
|
28
|
-
* Returns information about the type of URL.
|
29
|
-
*
|
30
|
-
* @param {?} url The full URL path qualified with file extension and leading slash but without domain. i.e. /full/path/to/thing.html
|
31
|
-
* @return {?}
|
32
|
-
*/
|
33
|
-
DaffExternalRouterDriverInterface.prototype.resolve = function (url) { };
|
34
|
-
}
|
35
11
|
|
36
|
-
/**
|
37
|
-
* @fileoverview added by tsickle
|
38
|
-
* Generated from: not-found-resolution.ts
|
39
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
40
|
-
*/
|
41
12
|
/**
|
42
13
|
* When a driver fails to find a resolution, it should return a 404.
|
43
14
|
* This const represents the standard "Not Found" resolution that a driver
|
44
15
|
* should return. Drivers are not required to return this value, but may do so
|
45
16
|
* if they would like.
|
46
|
-
* @type {?}
|
47
17
|
*/
|
48
18
|
var DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION = {
|
49
19
|
id: null,
|
@@ -52,22 +22,12 @@
|
|
52
22
|
type: null,
|
53
23
|
};
|
54
24
|
|
55
|
-
|
56
|
-
*
|
57
|
-
* Generated from: public_api.ts
|
58
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
59
|
-
*/
|
60
|
-
|
61
|
-
/**
|
62
|
-
* @fileoverview added by tsickle
|
63
|
-
* Generated from: index.ts
|
64
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
25
|
+
/*
|
26
|
+
* Public API Surface of @daffodil/external-router/driver
|
65
27
|
*/
|
66
28
|
|
67
29
|
/**
|
68
|
-
*
|
69
|
-
* Generated from: daffodil-external-router-driver.ts
|
70
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
30
|
+
* Generated bundle index. Do not edit.
|
71
31
|
*/
|
72
32
|
|
73
33
|
exports.DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION = DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"daffodil-external-router-driver.umd.js","sources":["../../../libs/external-router/driver/src/interfaces/external-router-driver.interface.ts","../../../libs/external-router/driver/src/not-found-resolution.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport { DaffExternallyResolvableUrl } from '@daffodil/external-router';\n\n/**\n * The token for the `@daffodil/external-router` driver.\n */\nexport const DaffExternalRouterDriver = new InjectionToken<\n\tDaffExternalRouterDriverInterface\n>('DaffExternalRouterDriver');\n\n/**\n * The interface for a @daffodil/external-router driver.\n *\n * This driver is responsible for translating a URL into a Route consumable by\n * Daffodil.\n */\nexport interface DaffExternalRouterDriverInterface {\n /**\n * Resolves a URL with a platform.\n * Returns information about the type of URL.\n *\n * @param url The full URL path qualified with file extension and leading slash but without domain. i.e. /full/path/to/thing.html\n */\n\tresolve(url: string): Observable<DaffExternallyResolvableUrl>;\n}\n","import { DaffExternallyResolvableUrl } from '@daffodil/external-router';\n\n/**\n * When a driver fails to find a resolution, it should return a 404.\n * This const represents the standard \"Not Found\" resolution that a driver\n * should return. Drivers are not required to return this value, but may do so\n * if they would like.\n */\nexport const DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION: DaffExternallyResolvableUrl = {\n id: null,\n url: null,\n code: 404,\n type: null,\n};\n"],"names":["InjectionToken"],"mappings":"
|
1
|
+
{"version":3,"file":"daffodil-external-router-driver.umd.js","sources":["../../../libs/external-router/driver/src/interfaces/external-router-driver.interface.ts","../../../libs/external-router/driver/src/not-found-resolution.ts","../../../libs/external-router/driver/src/public_api.ts","../../../libs/external-router/driver/src/daffodil-external-router-driver.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport { DaffExternallyResolvableUrl } from '@daffodil/external-router';\n\n/**\n * The token for the `@daffodil/external-router` driver.\n */\nexport const DaffExternalRouterDriver = new InjectionToken<\n\tDaffExternalRouterDriverInterface\n>('DaffExternalRouterDriver');\n\n/**\n * The interface for a @daffodil/external-router driver.\n *\n * This driver is responsible for translating a URL into a Route consumable by\n * Daffodil.\n */\nexport interface DaffExternalRouterDriverInterface {\n /**\n * Resolves a URL with a platform.\n * Returns information about the type of URL.\n *\n * @param url The full URL path qualified with file extension and leading slash but without domain. i.e. /full/path/to/thing.html\n */\n\tresolve(url: string): Observable<DaffExternallyResolvableUrl>;\n}\n","import { DaffExternallyResolvableUrl } from '@daffodil/external-router';\n\n/**\n * When a driver fails to find a resolution, it should return a 404.\n * This const represents the standard \"Not Found\" resolution that a driver\n * should return. Drivers are not required to return this value, but may do so\n * if they would like.\n */\nexport const DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION: DaffExternallyResolvableUrl = {\n id: null,\n url: null,\n code: 404,\n type: null,\n};\n","/*\n * Public API Surface of @daffodil/external-router/driver\n */\n\nexport {\n DaffExternalRouterDriverInterface,\n DaffExternalRouterDriver,\n} from './interfaces/external-router-driver.interface';\nexport { DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION } from './not-found-resolution';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["InjectionToken"],"mappings":";;;;;;IAKA;;;QAGa,wBAAwB,GAAG,IAAIA,mBAAc,CAExD,0BAA0B;;ICR5B;;;;;;QAMa,yCAAyC,GAAgC;QACpF,EAAE,EAAE,IAAI;QACR,GAAG,EAAE,IAAI;QACT,IAAI,EAAE,GAAG;QACT,IAAI,EAAE,IAAI;;;ICZZ;;;;ICAA;;;;;;;;;;;;;"}
|
@@ -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);
|
@@ -327,9 +327,6 @@
|
|
327
327
|
*/
|
328
328
|
var DaffExternalRouterClientError = /** @class */ (function (_super) {
|
329
329
|
__extends(DaffExternalRouterClientError, _super);
|
330
|
-
/**
|
331
|
-
* @param {?=} message
|
332
|
-
*/
|
333
330
|
function DaffExternalRouterClientError(message) {
|
334
331
|
var _this = _super.call(this, message) || this;
|
335
332
|
_this.code = '4xx_CLIENT_ERROR';
|
@@ -337,19 +334,12 @@
|
|
337
334
|
}
|
338
335
|
return DaffExternalRouterClientError;
|
339
336
|
}(core.DaffInheritableError));
|
340
|
-
if (false) {
|
341
|
-
/** @type {?} */
|
342
|
-
DaffExternalRouterClientError.prototype.code;
|
343
|
-
}
|
344
337
|
|
345
338
|
/**
|
346
339
|
* An error thrown when the driver determines that a given url is not resolvable.
|
347
340
|
*/
|
348
341
|
var DaffExternalRouterNotFoundError = /** @class */ (function (_super) {
|
349
342
|
__extends(DaffExternalRouterNotFoundError, _super);
|
350
|
-
/**
|
351
|
-
* @param {?=} message
|
352
|
-
*/
|
353
343
|
function DaffExternalRouterNotFoundError(message) {
|
354
344
|
var _this = _super.call(this, message) || this;
|
355
345
|
_this.code = '404_NOT_FOUND';
|
@@ -357,10 +347,6 @@
|
|
357
347
|
}
|
358
348
|
return DaffExternalRouterNotFoundError;
|
359
349
|
}(DaffExternalRouterClientError));
|
360
|
-
if (false) {
|
361
|
-
/** @type {?} */
|
362
|
-
DaffExternalRouterNotFoundError.prototype.code;
|
363
|
-
}
|
364
350
|
|
365
351
|
/**
|
366
352
|
* An error thrown when the driver determines that the url needs to be routed somewhere
|
@@ -368,10 +354,6 @@
|
|
368
354
|
*/
|
369
355
|
var DaffExternalRouterPermanentRedirectError = /** @class */ (function (_super) {
|
370
356
|
__extends(DaffExternalRouterPermanentRedirectError, _super);
|
371
|
-
/**
|
372
|
-
* @param {?} redirectUrl
|
373
|
-
* @param {?=} message
|
374
|
-
*/
|
375
357
|
function DaffExternalRouterPermanentRedirectError(redirectUrl, message) {
|
376
358
|
var _this = _super.call(this, message) || this;
|
377
359
|
_this.redirectUrl = redirectUrl;
|
@@ -380,12 +362,6 @@
|
|
380
362
|
}
|
381
363
|
return DaffExternalRouterPermanentRedirectError;
|
382
364
|
}(core.DaffInheritableError));
|
383
|
-
if (false) {
|
384
|
-
/** @type {?} */
|
385
|
-
DaffExternalRouterPermanentRedirectError.prototype.code;
|
386
|
-
/** @type {?} */
|
387
|
-
DaffExternalRouterPermanentRedirectError.prototype.redirectUrl;
|
388
|
-
}
|
389
365
|
|
390
366
|
/**
|
391
367
|
* An error thrown when the driver needs a URI to be temporarily redirected
|
@@ -393,10 +369,6 @@
|
|
393
369
|
*/
|
394
370
|
var DaffExternalRouterTemporaryRedirectError = /** @class */ (function (_super) {
|
395
371
|
__extends(DaffExternalRouterTemporaryRedirectError, _super);
|
396
|
-
/**
|
397
|
-
* @param {?} redirectUrl
|
398
|
-
* @param {?=} message
|
399
|
-
*/
|
400
372
|
function DaffExternalRouterTemporaryRedirectError(redirectUrl, message) {
|
401
373
|
var _this = _super.call(this, message) || this;
|
402
374
|
_this.redirectUrl = redirectUrl;
|
@@ -405,21 +377,12 @@
|
|
405
377
|
}
|
406
378
|
return DaffExternalRouterTemporaryRedirectError;
|
407
379
|
}(core.DaffInheritableError));
|
408
|
-
if (false) {
|
409
|
-
/** @type {?} */
|
410
|
-
DaffExternalRouterTemporaryRedirectError.prototype.code;
|
411
|
-
/** @type {?} */
|
412
|
-
DaffExternalRouterTemporaryRedirectError.prototype.redirectUrl;
|
413
|
-
}
|
414
380
|
|
415
381
|
/**
|
416
382
|
* An error thrown when the platform performing url resolution fails.
|
417
383
|
*/
|
418
384
|
var DaffExternalRouterServerError = /** @class */ (function (_super) {
|
419
385
|
__extends(DaffExternalRouterServerError, _super);
|
420
|
-
/**
|
421
|
-
* @param {?=} message
|
422
|
-
*/
|
423
386
|
function DaffExternalRouterServerError(message) {
|
424
387
|
var _this = _super.call(this, message) || this;
|
425
388
|
_this.code = '5xx_SERVER_ERROR';
|
@@ -427,25 +390,12 @@
|
|
427
390
|
}
|
428
391
|
return DaffExternalRouterServerError;
|
429
392
|
}(core.DaffInheritableError));
|
430
|
-
if (false) {
|
431
|
-
/** @type {?} */
|
432
|
-
DaffExternalRouterServerError.prototype.code;
|
433
|
-
}
|
434
393
|
|
435
|
-
/**
|
436
|
-
* @fileoverview added by tsickle
|
437
|
-
* Generated from: processors/process-errors.ts
|
438
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
439
|
-
*/
|
440
394
|
/**
|
441
395
|
* Processes resolved URLs and throws the appropriate error so that External Router
|
442
396
|
* can handle routing errors.
|
443
|
-
* @type {?}
|
444
397
|
*/
|
445
|
-
var processErrors = (
|
446
|
-
* @param {?} url
|
447
|
-
* @return {?}
|
448
|
-
*/function (url) {
|
398
|
+
var processErrors = function (url) {
|
449
399
|
if (url.code === 404) {
|
450
400
|
throw new DaffExternalRouterNotFoundError();
|
451
401
|
}
|
@@ -458,22 +408,13 @@
|
|
458
408
|
else {
|
459
409
|
return url;
|
460
410
|
}
|
461
|
-
}
|
411
|
+
};
|
462
412
|
|
463
|
-
/**
|
464
|
-
* @fileoverview added by tsickle
|
465
|
-
* Generated from: processors/process-redirect.ts
|
466
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
467
|
-
*/
|
468
413
|
/**
|
469
414
|
* Processes resolvedUrls and throws the appropriate error so that External Router
|
470
415
|
* can handle redirects.
|
471
|
-
* @type {?}
|
472
416
|
*/
|
473
|
-
var processRedirects = (
|
474
|
-
* @param {?} url
|
475
|
-
* @return {?}
|
476
|
-
*/function (url) {
|
417
|
+
var processRedirects = function (url) {
|
477
418
|
if (url.code === 301) {
|
478
419
|
throw new DaffExternalRouterPermanentRedirectError(url.url);
|
479
420
|
}
|
@@ -483,26 +424,14 @@
|
|
483
424
|
else {
|
484
425
|
return url;
|
485
426
|
}
|
486
|
-
}
|
427
|
+
};
|
487
428
|
|
488
|
-
/**
|
489
|
-
* @fileoverview added by tsickle
|
490
|
-
* Generated from: guard/existence.guard.ts
|
491
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
492
|
-
*/
|
493
429
|
/**
|
494
430
|
* The DaffExternalRouterExistenceGuard is responsible for guarding the wildcard route
|
495
431
|
* of an Angular App and either navigating to a resolved route upon successful resolution
|
496
432
|
* or navigating to the configured route upon a failed resolution.
|
497
433
|
*/
|
498
434
|
var DaffExternalRouterExistenceGuard = /** @class */ (function () {
|
499
|
-
/**
|
500
|
-
* @param {?} driver
|
501
|
-
* @param {?} externalRouter
|
502
|
-
* @param {?} router
|
503
|
-
* @param {?} config
|
504
|
-
* @param {?} urlNormalizer
|
505
|
-
*/
|
506
435
|
function DaffExternalRouterExistenceGuard(driver, externalRouter, router, config, urlNormalizer) {
|
507
436
|
this.driver = driver;
|
508
437
|
this.externalRouter = externalRouter;
|
@@ -510,72 +439,42 @@
|
|
510
439
|
this.config = config;
|
511
440
|
this.urlNormalizer = urlNormalizer;
|
512
441
|
}
|
513
|
-
/**
|
514
|
-
* @param {?} next
|
515
|
-
* @param {?} state
|
516
|
-
* @return {?}
|
517
|
-
*/
|
518
442
|
DaffExternalRouterExistenceGuard.prototype.canActivate = function (next, state) {
|
519
443
|
var _this = this;
|
520
|
-
return this.driver.resolve(this.urlNormalizer.normalize(state.url)).pipe(operators.map((
|
521
|
-
* @param {?} resolvedRoute
|
522
|
-
* @return {?}
|
523
|
-
*/function (resolvedRoute) { return processErrors(resolvedRoute); })), operators.switchMap(( /**
|
524
|
-
* @param {?} resolvedRoute
|
525
|
-
* @return {?}
|
526
|
-
*/function (/**
|
527
|
-
* @param {?} resolvedRoute
|
528
|
-
* @return {?}
|
529
|
-
*/ resolvedRoute) {
|
444
|
+
return this.driver.resolve(this.urlNormalizer.normalize(state.url)).pipe(operators.map(function (resolvedRoute) { return processErrors(resolvedRoute); }), operators.switchMap(function (resolvedRoute) {
|
530
445
|
_this.externalRouter.add(resolvedRoute);
|
531
446
|
return rxjs.of(resolvedRoute);
|
532
|
-
})
|
533
|
-
* @param {?} resolvedRoute
|
534
|
-
* @return {?}
|
535
|
-
*/function (resolvedRoute) { return processRedirects(resolvedRoute); })),
|
447
|
+
}), operators.map(function (resolvedRoute) { return processRedirects(resolvedRoute); }),
|
536
448
|
// Note that we have to use state.url as we want to ensure that we keep any fragments or query strings.
|
537
449
|
// When we succeed, redirect to the new route, as config has changed since we init'd.
|
538
|
-
operators.map((
|
539
|
-
* @return {?}
|
540
|
-
*/function () { return _this.router.parseUrl(state.url); })),
|
450
|
+
operators.map(function () { return _this.router.parseUrl(state.url); }),
|
541
451
|
// When we fail, we need to process errors as dictated by the error type.
|
542
452
|
// Handle redirects
|
543
|
-
operators.catchError((
|
544
|
-
* @param {?} error
|
545
|
-
* @return {?}
|
546
|
-
*/function (/**
|
547
|
-
* @param {?} error
|
548
|
-
* @return {?}
|
549
|
-
*/ error) {
|
453
|
+
operators.catchError(function (error) {
|
550
454
|
if (!(error instanceof DaffExternalRouterPermanentRedirectError) &&
|
551
455
|
!(error instanceof DaffExternalRouterTemporaryRedirectError)) {
|
552
456
|
throw error;
|
553
457
|
}
|
554
458
|
return rxjs.of(_this.router.parseUrl(error.redirectUrl));
|
555
|
-
})
|
459
|
+
}),
|
556
460
|
// Handle "404"
|
557
|
-
operators.catchError((
|
558
|
-
* @param {?} error
|
559
|
-
* @return {?}
|
560
|
-
*/function (error) {
|
461
|
+
operators.catchError(function (error) {
|
561
462
|
if (!(error instanceof DaffExternalRouterNotFoundError)) {
|
562
463
|
throw error;
|
563
464
|
}
|
564
465
|
return rxjs.of(_this.router.parseUrl(_this.config.notFoundResolutionPath));
|
565
|
-
})
|
466
|
+
}),
|
566
467
|
//Otherwise something went horribly wrong and we need to bail out.
|
567
|
-
operators.catchError((
|
568
|
-
* @param {?} error
|
569
|
-
* @return {?}
|
570
|
-
*/function (error) {
|
468
|
+
operators.catchError(function (error) {
|
571
469
|
//TODO(damienwebdev): Add a logging system.
|
572
470
|
//This log is intentional until we have a better logging system in place.
|
573
471
|
console.log(error);
|
574
472
|
return rxjs.of(_this.router.parseUrl(_this.config.failedResolutionPath));
|
575
|
-
}))
|
473
|
+
}));
|
576
474
|
};
|
577
475
|
return DaffExternalRouterExistenceGuard;
|
578
476
|
}());
|
477
|
+
/** @nocollapse */ DaffExternalRouterExistenceGuard.ɵprov = i0.ɵɵdefineInjectable({ factory: function DaffExternalRouterExistenceGuard_Factory() { return new DaffExternalRouterExistenceGuard(i0.ɵɵinject(i1.DaffExternalRouterDriver), i0.ɵɵinject(i2.DaffExternalRouter), i0.ɵɵinject(i3.Router), i0.ɵɵinject(i2.DAFF_EXTERNAL_ROUTER_CONFIG), i0.ɵɵinject(i4.DaffRoutingUriNormalizer)); }, token: DaffExternalRouterExistenceGuard, providedIn: "root" });
|
579
478
|
DaffExternalRouterExistenceGuard.decorators = [
|
580
479
|
{ type: i0.Injectable, args: [{
|
581
480
|
providedIn: 'root',
|
@@ -589,51 +488,13 @@
|
|
589
488
|
{ type: undefined, decorators: [{ type: i0.Inject, args: [i2.DAFF_EXTERNAL_ROUTER_CONFIG,] }] },
|
590
489
|
{ type: i4.DaffRoutingUriNormalizer }
|
591
490
|
]; };
|
592
|
-
/** @nocollapse */ DaffExternalRouterExistenceGuard.ɵprov = i0.ɵɵdefineInjectable({ factory: function DaffExternalRouterExistenceGuard_Factory() { return new DaffExternalRouterExistenceGuard(i0.ɵɵinject(i1.DaffExternalRouterDriver), i0.ɵɵinject(i2.DaffExternalRouter), i0.ɵɵinject(i3.Router), i0.ɵɵinject(i2.DAFF_EXTERNAL_ROUTER_CONFIG), i0.ɵɵinject(i4.DaffRoutingUriNormalizer)); }, token: DaffExternalRouterExistenceGuard, providedIn: "root" });
|
593
|
-
if (false) {
|
594
|
-
/**
|
595
|
-
* @type {?}
|
596
|
-
* @private
|
597
|
-
*/
|
598
|
-
DaffExternalRouterExistenceGuard.prototype.driver;
|
599
|
-
/**
|
600
|
-
* @type {?}
|
601
|
-
* @private
|
602
|
-
*/
|
603
|
-
DaffExternalRouterExistenceGuard.prototype.externalRouter;
|
604
|
-
/**
|
605
|
-
* @type {?}
|
606
|
-
* @private
|
607
|
-
*/
|
608
|
-
DaffExternalRouterExistenceGuard.prototype.router;
|
609
|
-
/**
|
610
|
-
* @type {?}
|
611
|
-
* @private
|
612
|
-
*/
|
613
|
-
DaffExternalRouterExistenceGuard.prototype.config;
|
614
|
-
/**
|
615
|
-
* @type {?}
|
616
|
-
* @private
|
617
|
-
*/
|
618
|
-
DaffExternalRouterExistenceGuard.prototype.urlNormalizer;
|
619
|
-
}
|
620
491
|
|
621
|
-
|
622
|
-
*
|
623
|
-
* Generated from: public_api.ts
|
624
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
625
|
-
*/
|
626
|
-
|
627
|
-
/**
|
628
|
-
* @fileoverview added by tsickle
|
629
|
-
* Generated from: index.ts
|
630
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
492
|
+
/*
|
493
|
+
* Public API Surface of @daffodil/external-router/routing
|
631
494
|
*/
|
632
495
|
|
633
496
|
/**
|
634
|
-
*
|
635
|
-
* Generated from: daffodil-external-router-routing.ts
|
636
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
497
|
+
* Generated bundle index. Do not edit.
|
637
498
|
*/
|
638
499
|
|
639
500
|
exports.DaffExternalRouterExistenceGuard = DaffExternalRouterExistenceGuard;
|