@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,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { ɵɵdefineInjectable, ɵɵinject, Injectable, NgModule } from '@angular/core';
|
2
2
|
import { gql, Apollo } from 'apollo-angular';
|
3
3
|
import { map } from 'rxjs/operators';
|
4
4
|
import { daffUriTruncateLeadingSlash, daffUriTruncateQueryFragment } from '@daffodil/core/routing';
|
@@ -7,17 +7,10 @@ import { magentoTransformRedirectToHttpCode } from '@daffodil/external-router/dr
|
|
7
7
|
import { CommonModule } from '@angular/common';
|
8
8
|
import { DAFF_MAGENTO_CACHEABLE_OPERATIONS } from '@daffodil/driver/magento';
|
9
9
|
|
10
|
-
/**
|
11
|
-
* @fileoverview added by tsickle
|
12
|
-
* Generated from: graphql/queries/resolve-url-v2.4.1.ts
|
13
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
14
|
-
*/
|
15
|
-
/** @type {?} */
|
16
10
|
const DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME = 'MagentoResolveUrlv241';
|
17
11
|
/**
|
18
12
|
* This query retrieves a URL resolution from Magento and informs you about
|
19
13
|
* what type of route the URL is.
|
20
|
-
* @type {?}
|
21
14
|
*/
|
22
15
|
const MagentoResolveUrlv241 = gql `
|
23
16
|
query ${DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME}($url: String!) {
|
@@ -30,17 +23,7 @@ const MagentoResolveUrlv241 = gql `
|
|
30
23
|
}
|
31
24
|
`;
|
32
25
|
|
33
|
-
|
34
|
-
* @fileoverview added by tsickle
|
35
|
-
* Generated from: transforms/resolution-to-resolvable-url.ts
|
36
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
37
|
-
*/
|
38
|
-
/** @type {?} */
|
39
|
-
const transformResolutionToResolvableUrlv241 = (/**
|
40
|
-
* @param {?} resolution
|
41
|
-
* @return {?}
|
42
|
-
*/
|
43
|
-
(resolution) => {
|
26
|
+
const transformResolutionToResolvableUrlv241 = (resolution) => {
|
44
27
|
var _a;
|
45
28
|
return (resolution ? {
|
46
29
|
id: (_a = resolution.id) === null || _a === void 0 ? void 0 : _a.toString(),
|
@@ -48,30 +31,18 @@ const transformResolutionToResolvableUrlv241 = (/**
|
|
48
31
|
type: resolution.type,
|
49
32
|
code: magentoTransformRedirectToHttpCode(resolution.redirectCode),
|
50
33
|
} : DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION);
|
51
|
-
}
|
34
|
+
};
|
52
35
|
|
53
|
-
/**
|
54
|
-
* @fileoverview added by tsickle
|
55
|
-
* Generated from: magento.service.ts
|
56
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
57
|
-
*/
|
58
36
|
/**
|
59
37
|
* The DaffExternalRouterMagentoDriver is responsible for translating an
|
60
38
|
* arbitrary URI into a DaffExternallyResolvableUrl with Magento environments.
|
61
39
|
*
|
62
|
-
*
|
40
|
+
* @inheritdoc
|
63
41
|
*/
|
64
42
|
class DaffExternalRouterMagentoDriver {
|
65
|
-
/**
|
66
|
-
* @param {?} apollo
|
67
|
-
*/
|
68
43
|
constructor(apollo) {
|
69
44
|
this.apollo = apollo;
|
70
45
|
}
|
71
|
-
/**
|
72
|
-
* @param {?} url
|
73
|
-
* @return {?}
|
74
|
-
*/
|
75
46
|
resolve(url) {
|
76
47
|
return this.apollo
|
77
48
|
.query({
|
@@ -80,13 +51,10 @@ class DaffExternalRouterMagentoDriver {
|
|
80
51
|
url: daffUriTruncateQueryFragment(url),
|
81
52
|
},
|
82
53
|
})
|
83
|
-
.pipe(map((
|
84
|
-
* @param {?} response
|
85
|
-
* @return {?}
|
86
|
-
*/
|
87
|
-
response => transformResolutionToResolvableUrlv241(response.data.urlResolver))));
|
54
|
+
.pipe(map(response => transformResolutionToResolvableUrlv241(response.data.urlResolver)));
|
88
55
|
}
|
89
56
|
}
|
57
|
+
/** @nocollapse */ DaffExternalRouterMagentoDriver.ɵprov = ɵɵdefineInjectable({ factory: function DaffExternalRouterMagentoDriver_Factory() { return new DaffExternalRouterMagentoDriver(ɵɵinject(Apollo)); }, token: DaffExternalRouterMagentoDriver, providedIn: "root" });
|
90
58
|
DaffExternalRouterMagentoDriver.decorators = [
|
91
59
|
{ type: Injectable, args: [{
|
92
60
|
providedIn: 'root',
|
@@ -96,25 +64,12 @@ DaffExternalRouterMagentoDriver.decorators = [
|
|
96
64
|
DaffExternalRouterMagentoDriver.ctorParameters = () => [
|
97
65
|
{ type: Apollo }
|
98
66
|
];
|
99
|
-
/** @nocollapse */ DaffExternalRouterMagentoDriver.ɵprov = ɵɵdefineInjectable({ factory: function DaffExternalRouterMagentoDriver_Factory() { return new DaffExternalRouterMagentoDriver(ɵɵinject(Apollo)); }, token: DaffExternalRouterMagentoDriver, providedIn: "root" });
|
100
|
-
if (false) {
|
101
|
-
/**
|
102
|
-
* @type {?}
|
103
|
-
* @private
|
104
|
-
*/
|
105
|
-
DaffExternalRouterMagentoDriver.prototype.apollo;
|
106
|
-
}
|
107
67
|
|
108
68
|
/**
|
109
|
-
* @
|
110
|
-
* Generated from: magento.module.ts
|
111
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
112
|
-
*/
|
113
|
-
/**
|
114
|
-
* The module used to configure the {\@link DaffExternalRouterDriver} for usage with Magento.
|
69
|
+
* The module used to configure the {@link DaffExternalRouterDriver} for usage with Magento.
|
115
70
|
*
|
116
71
|
* ```ts
|
117
|
-
*
|
72
|
+
* @NgModule({
|
118
73
|
* declarations: [],
|
119
74
|
* imports: [
|
120
75
|
* ...
|
@@ -129,7 +84,6 @@ if (false) {
|
|
129
84
|
class DaffExternalRouterDriverMagentoModule {
|
130
85
|
/**
|
131
86
|
* Configures the package for the root injector.
|
132
|
-
* @return {?}
|
133
87
|
*/
|
134
88
|
static forRoot() {
|
135
89
|
return {
|
@@ -155,22 +109,12 @@ DaffExternalRouterDriverMagentoModule.decorators = [
|
|
155
109
|
},] }
|
156
110
|
];
|
157
111
|
|
158
|
-
|
159
|
-
*
|
160
|
-
* Generated from: public_api.ts
|
161
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
162
|
-
*/
|
163
|
-
|
164
|
-
/**
|
165
|
-
* @fileoverview added by tsickle
|
166
|
-
* Generated from: index.ts
|
167
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
112
|
+
/*
|
113
|
+
* Public API Surface of @daffodil/external-router/driver/magento/2.4.1
|
168
114
|
*/
|
169
115
|
|
170
116
|
/**
|
171
|
-
*
|
172
|
-
* Generated from: daffodil-external-router-driver-magento-2.4.1.ts
|
173
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
117
|
+
* Generated bundle index. Do not edit.
|
174
118
|
*/
|
175
119
|
|
176
120
|
export { DaffExternalRouterDriverMagentoModule, DaffExternalRouterMagentoDriver, DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME as ɵa };
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"daffodil-external-router-driver-magento-2.4.1.js","sources":["../../../libs/external-router/driver/magento/2.4.1/src/graphql/queries/resolve-url-v2.4.1.ts","../../../libs/external-router/driver/magento/2.4.1/src/transforms/resolution-to-resolvable-url.ts","../../../libs/external-router/driver/magento/2.4.1/src/magento.service.ts","../../../libs/external-router/driver/magento/2.4.1/src/magento.module.ts"],"sourcesContent":["import { gql } from 'apollo-angular';\n\nexport const DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME = 'MagentoResolveUrlv241';\n\n/**\n * This query retrieves a URL resolution from Magento and informs you about\n * what type of route the URL is.\n */\nexport const MagentoResolveUrlv241 = gql`\n\tquery ${DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME}($url: String!) {\n\t\turlResolver(url: $url) {\n\t\t\tid\n\t\t\trelative_url\n\t\t\tredirectCode\n\t\t\ttype\n\t\t}\n\t}\n`;\n","import {\n daffUriTruncateLeadingSlash,\n daffUriTruncateQueryFragment,\n} from '@daffodil/core/routing';\nimport { DaffExternallyResolvableUrl } from '@daffodil/external-router';\nimport { DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION } from '@daffodil/external-router/driver';\nimport {\n MagentoUrlResolver,\n magentoTransformRedirectToHttpCode,\n} from '@daffodil/external-router/driver/magento';\n\nexport const transformResolutionToResolvableUrlv241 = (\n resolution: MagentoUrlResolver,\n): DaffExternallyResolvableUrl => (resolution ? {\n id: resolution.id?.toString(),\n url: daffUriTruncateLeadingSlash(daffUriTruncateQueryFragment(resolution.relative_url)),\n type: resolution.type,\n code: magentoTransformRedirectToHttpCode(resolution.redirectCode),\n} : DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION);\n\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport { Apollo } from 'apollo-angular';\nimport { Observable } from 'rxjs';\nimport { map } from 'rxjs/operators';\n\nimport { daffUriTruncateQueryFragment } from '@daffodil/core/routing';\nimport { DaffExternallyResolvableUrl } from '@daffodil/external-router';\nimport { DaffExternalRouterDriverInterface } from '@daffodil/external-router/driver';\nimport { MagentoUrlResolverResponse } from '@daffodil/external-router/driver/magento';\n\nimport { MagentoResolveUrlv241 } from './graphql/queries/resolve-url-v2.4.1';\nimport { transformResolutionToResolvableUrlv241 } from './transforms/resolution-to-resolvable-url';\n\n/**\n * The DaffExternalRouterMagentoDriver is responsible for translating an\n * arbitrary URI into a DaffExternallyResolvableUrl with Magento environments.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffExternalRouterMagentoDriver\nimplements DaffExternalRouterDriverInterface {\n constructor(private apollo: Apollo) {}\n\n resolve(url: string): Observable<DaffExternallyResolvableUrl> {\n return this.apollo\n .query<MagentoUrlResolverResponse>({\n query: MagentoResolveUrlv241,\n variables: {\n url: daffUriTruncateQueryFragment(url),\n },\n })\n .pipe(map(response => transformResolutionToResolvableUrlv241(response.data.urlResolver)));\n }\n}\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport { DAFF_MAGENTO_CACHEABLE_OPERATIONS } from '@daffodil/driver/magento';\nimport { DaffExternalRouterDriver } from '@daffodil/external-router/driver';\n\nimport { DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME } from './graphql/queries/resolve-url-v2.4.1';\nimport { DaffExternalRouterMagentoDriver } from './magento.service';\n/**\n * The module used to configure the {@link DaffExternalRouterDriver} for usage with Magento.\n *\n * ```ts\n * @NgModule({\n * declarations: [],\n * imports: [\n * ...\n * DaffExternalRouterDriverMagentoModule.forRoot()\n * ],\n * })\n * export class AppModule{}\n * ```\n *\n * Note that this package depends upon ApolloClient, as the Magento driver uses GraphQl to make it's API calls.\n */\n@NgModule({\n declarations: [],\n imports: [CommonModule],\n})\nexport class DaffExternalRouterDriverMagentoModule {\n\n /**\n * Configures the package for the root injector.\n */\n static forRoot(): ModuleWithProviders<DaffExternalRouterDriverMagentoModule> {\n return {\n ngModule: DaffExternalRouterDriverMagentoModule,\n providers: [\n {\n provide: DaffExternalRouterDriver,\n useExisting: DaffExternalRouterMagentoDriver,\n },\n {\n provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS,\n useValue: DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME,\n multi: true,\n },\n ],\n };\n }\n}\n"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"daffodil-external-router-driver-magento-2.4.1.js","sources":["../../../libs/external-router/driver/magento/2.4.1/src/graphql/queries/resolve-url-v2.4.1.ts","../../../libs/external-router/driver/magento/2.4.1/src/transforms/resolution-to-resolvable-url.ts","../../../libs/external-router/driver/magento/2.4.1/src/magento.service.ts","../../../libs/external-router/driver/magento/2.4.1/src/magento.module.ts","../../../libs/external-router/driver/magento/2.4.1/src/public_api.ts","../../../libs/external-router/driver/magento/2.4.1/src/daffodil-external-router-driver-magento-2.4.1.ts"],"sourcesContent":["import { gql } from 'apollo-angular';\n\nexport const DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME = 'MagentoResolveUrlv241';\n\n/**\n * This query retrieves a URL resolution from Magento and informs you about\n * what type of route the URL is.\n */\nexport const MagentoResolveUrlv241 = gql`\n\tquery ${DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME}($url: String!) {\n\t\turlResolver(url: $url) {\n\t\t\tid\n\t\t\trelative_url\n\t\t\tredirectCode\n\t\t\ttype\n\t\t}\n\t}\n`;\n","import {\n daffUriTruncateLeadingSlash,\n daffUriTruncateQueryFragment,\n} from '@daffodil/core/routing';\nimport { DaffExternallyResolvableUrl } from '@daffodil/external-router';\nimport { DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION } from '@daffodil/external-router/driver';\nimport {\n MagentoUrlResolver,\n magentoTransformRedirectToHttpCode,\n} from '@daffodil/external-router/driver/magento';\n\nexport const transformResolutionToResolvableUrlv241 = (\n resolution: MagentoUrlResolver,\n): DaffExternallyResolvableUrl => (resolution ? {\n id: resolution.id?.toString(),\n url: daffUriTruncateLeadingSlash(daffUriTruncateQueryFragment(resolution.relative_url)),\n type: resolution.type,\n code: magentoTransformRedirectToHttpCode(resolution.redirectCode),\n} : DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION);\n\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport { Apollo } from 'apollo-angular';\nimport { Observable } from 'rxjs';\nimport { map } from 'rxjs/operators';\n\nimport { daffUriTruncateQueryFragment } from '@daffodil/core/routing';\nimport { DaffExternallyResolvableUrl } from '@daffodil/external-router';\nimport { DaffExternalRouterDriverInterface } from '@daffodil/external-router/driver';\nimport { MagentoUrlResolverResponse } from '@daffodil/external-router/driver/magento';\n\nimport { MagentoResolveUrlv241 } from './graphql/queries/resolve-url-v2.4.1';\nimport { transformResolutionToResolvableUrlv241 } from './transforms/resolution-to-resolvable-url';\n\n/**\n * The DaffExternalRouterMagentoDriver is responsible for translating an\n * arbitrary URI into a DaffExternallyResolvableUrl with Magento environments.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffExternalRouterMagentoDriver\nimplements DaffExternalRouterDriverInterface {\n constructor(private apollo: Apollo) {}\n\n resolve(url: string): Observable<DaffExternallyResolvableUrl> {\n return this.apollo\n .query<MagentoUrlResolverResponse>({\n query: MagentoResolveUrlv241,\n variables: {\n url: daffUriTruncateQueryFragment(url),\n },\n })\n .pipe(map(response => transformResolutionToResolvableUrlv241(response.data.urlResolver)));\n }\n}\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport { DAFF_MAGENTO_CACHEABLE_OPERATIONS } from '@daffodil/driver/magento';\nimport { DaffExternalRouterDriver } from '@daffodil/external-router/driver';\n\nimport { DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME } from './graphql/queries/resolve-url-v2.4.1';\nimport { DaffExternalRouterMagentoDriver } from './magento.service';\n/**\n * The module used to configure the {@link DaffExternalRouterDriver} for usage with Magento.\n *\n * ```ts\n * @NgModule({\n * declarations: [],\n * imports: [\n * ...\n * DaffExternalRouterDriverMagentoModule.forRoot()\n * ],\n * })\n * export class AppModule{}\n * ```\n *\n * Note that this package depends upon ApolloClient, as the Magento driver uses GraphQl to make it's API calls.\n */\n@NgModule({\n declarations: [],\n imports: [CommonModule],\n})\nexport class DaffExternalRouterDriverMagentoModule {\n\n /**\n * Configures the package for the root injector.\n */\n static forRoot(): ModuleWithProviders<DaffExternalRouterDriverMagentoModule> {\n return {\n ngModule: DaffExternalRouterDriverMagentoModule,\n providers: [\n {\n provide: DaffExternalRouterDriver,\n useExisting: DaffExternalRouterMagentoDriver,\n },\n {\n provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS,\n useValue: DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME,\n multi: true,\n },\n ],\n };\n }\n}\n","/*\n * Public API Surface of @daffodil/external-router/driver/magento/2.4.1\n */\n\nexport { DaffExternalRouterMagentoDriver } from './magento.service';\nexport { DaffExternalRouterDriverMagentoModule } from './magento.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n\nexport {DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME as ɵa} from './graphql/queries/resolve-url-v2.4.1';"],"names":[],"mappings":";;;;;;;;;MAEa,mCAAmC,GAAG,wBAAwB;AAE3E;;;;AAIO,MAAM,qBAAqB,GAAG,GAAG,CAAA;SAC/B,mCAAmC;;;;;;;;CAQ3C;;ACNM,MAAM,sCAAsC,GAAG,CACpD,UAA8B;;IACE,QAAC,UAAU,GAAG;QAC9C,EAAE,QAAE,UAAU,CAAC,EAAE,0CAAE,QAAQ,EAAE;QAC7B,GAAG,EAAE,2BAA2B,CAAC,4BAA4B,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;QACvF,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,IAAI,EAAE,kCAAkC,CAAC,UAAU,CAAC,YAAY,CAAC;KAClE,GAAG,yCAAyC,EAAC;CAAA;;ACF9C;;;;;;MASa,+BAA+B;IAE1C,YAAoB,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;KAAI;IAEtC,OAAO,CAAC,GAAW;QACjB,OAAO,IAAI,CAAC,MAAM;aACf,KAAK,CAA6B;YACjC,KAAK,EAAE,qBAAqB;YAC5B,SAAS,EAAE;gBACT,GAAG,EAAE,4BAA4B,CAAC,GAAG,CAAC;aACvC;SACF,CAAC;aACD,IAAI,CAAC,GAAG,CAAC,QAAQ,IAAI,sCAAsC,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;KAC7F;;;;YAhBF,UAAU,SAAC;gBACV,UAAU,EAAE,MAAM;aACnB;;;;YApBQ,MAAM;;;ACOf;;;;;;;;;;;;;;;;MAoBa,qCAAqC;;;;IAKhD,OAAO,OAAO;QACZ,OAAO;YACL,QAAQ,EAAE,qCAAqC;YAC/C,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,wBAAwB;oBACjC,WAAW,EAAE,+BAA+B;iBAC7C;gBACD;oBACE,OAAO,EAAE,iCAAiC;oBAC1C,QAAQ,EAAE,mCAAmC;oBAC7C,KAAK,EAAE,IAAI;iBACZ;aACF;SACF,CAAC;KACH;;;YAxBF,QAAQ,SAAC;gBACR,YAAY,EAAE,EAAE;gBAChB,OAAO,EAAE,CAAC,YAAY,CAAC;aACxB;;;AC9BD;;;;ACAA;;;;;;"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { ɵɵdefineInjectable, ɵɵinject, Injectable, NgModule } from '@angular/core';
|
2
2
|
import { gql, Apollo } from 'apollo-angular';
|
3
3
|
import { map } from 'rxjs/operators';
|
4
4
|
import { daffUriTruncateLeadingSlash, daffUriTruncateQueryFragment } from '@daffodil/core/routing';
|
@@ -7,17 +7,10 @@ import { magentoTransformRedirectToHttpCode } from '@daffodil/external-router/dr
|
|
7
7
|
import { CommonModule } from '@angular/common';
|
8
8
|
import { DAFF_MAGENTO_CACHEABLE_OPERATIONS } from '@daffodil/driver/magento';
|
9
9
|
|
10
|
-
/**
|
11
|
-
* @fileoverview added by tsickle
|
12
|
-
* Generated from: graphql/queries/resolve-url-v2.4.2.ts
|
13
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
14
|
-
*/
|
15
|
-
/** @type {?} */
|
16
10
|
const DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME = 'MagentoResolveUrlv242';
|
17
11
|
/**
|
18
12
|
* This query retrieves a URL resolution from Magento and informs you about
|
19
13
|
* what type of route the URL is.
|
20
|
-
* @type {?}
|
21
14
|
*/
|
22
15
|
const MagentoResolveUrlv242 = gql `
|
23
16
|
query ${DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME}($url: String!) {
|
@@ -30,45 +23,23 @@ const MagentoResolveUrlv242 = gql `
|
|
30
23
|
}
|
31
24
|
`;
|
32
25
|
|
33
|
-
|
34
|
-
* @fileoverview added by tsickle
|
35
|
-
* Generated from: transforms/resolution-to-resolvable-url.ts
|
36
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
37
|
-
*/
|
38
|
-
/** @type {?} */
|
39
|
-
const transformResolutionToResolvableUrlv242 = (/**
|
40
|
-
* @param {?} resolution
|
41
|
-
* @return {?}
|
42
|
-
*/
|
43
|
-
(resolution) => (resolution ? {
|
26
|
+
const transformResolutionToResolvableUrlv242 = (resolution) => (resolution ? {
|
44
27
|
id: resolution.entity_uid,
|
45
28
|
url: daffUriTruncateLeadingSlash(daffUriTruncateQueryFragment(resolution.relative_url)),
|
46
29
|
type: resolution.type,
|
47
30
|
code: magentoTransformRedirectToHttpCode(resolution.redirectCode),
|
48
|
-
} : DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION)
|
31
|
+
} : DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION);
|
49
32
|
|
50
|
-
/**
|
51
|
-
* @fileoverview added by tsickle
|
52
|
-
* Generated from: magento.service.ts
|
53
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
54
|
-
*/
|
55
33
|
/**
|
56
34
|
* The DaffExternalRouterMagentoDriver is responsible for translating an
|
57
35
|
* arbitrary URI into a DaffExternallyResolvableUrl with Magento environments.
|
58
36
|
*
|
59
|
-
*
|
37
|
+
* @inheritdoc
|
60
38
|
*/
|
61
39
|
class DaffExternalRouterMagentoDriver {
|
62
|
-
/**
|
63
|
-
* @param {?} apollo
|
64
|
-
*/
|
65
40
|
constructor(apollo) {
|
66
41
|
this.apollo = apollo;
|
67
42
|
}
|
68
|
-
/**
|
69
|
-
* @param {?} url
|
70
|
-
* @return {?}
|
71
|
-
*/
|
72
43
|
resolve(url) {
|
73
44
|
return this.apollo
|
74
45
|
.query({
|
@@ -77,13 +48,10 @@ class DaffExternalRouterMagentoDriver {
|
|
77
48
|
url,
|
78
49
|
},
|
79
50
|
})
|
80
|
-
.pipe(map((
|
81
|
-
* @param {?} response
|
82
|
-
* @return {?}
|
83
|
-
*/
|
84
|
-
response => transformResolutionToResolvableUrlv242(response.data.urlResolver))));
|
51
|
+
.pipe(map(response => transformResolutionToResolvableUrlv242(response.data.urlResolver)));
|
85
52
|
}
|
86
53
|
}
|
54
|
+
/** @nocollapse */ DaffExternalRouterMagentoDriver.ɵprov = ɵɵdefineInjectable({ factory: function DaffExternalRouterMagentoDriver_Factory() { return new DaffExternalRouterMagentoDriver(ɵɵinject(Apollo)); }, token: DaffExternalRouterMagentoDriver, providedIn: "root" });
|
87
55
|
DaffExternalRouterMagentoDriver.decorators = [
|
88
56
|
{ type: Injectable, args: [{
|
89
57
|
providedIn: 'root',
|
@@ -93,25 +61,12 @@ DaffExternalRouterMagentoDriver.decorators = [
|
|
93
61
|
DaffExternalRouterMagentoDriver.ctorParameters = () => [
|
94
62
|
{ type: Apollo }
|
95
63
|
];
|
96
|
-
/** @nocollapse */ DaffExternalRouterMagentoDriver.ɵprov = ɵɵdefineInjectable({ factory: function DaffExternalRouterMagentoDriver_Factory() { return new DaffExternalRouterMagentoDriver(ɵɵinject(Apollo)); }, token: DaffExternalRouterMagentoDriver, providedIn: "root" });
|
97
|
-
if (false) {
|
98
|
-
/**
|
99
|
-
* @type {?}
|
100
|
-
* @private
|
101
|
-
*/
|
102
|
-
DaffExternalRouterMagentoDriver.prototype.apollo;
|
103
|
-
}
|
104
64
|
|
105
65
|
/**
|
106
|
-
* @
|
107
|
-
* Generated from: magento.module.ts
|
108
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
109
|
-
*/
|
110
|
-
/**
|
111
|
-
* The module used to configure the {\@link DaffExternalRouterDriver} for usage with Magento.
|
66
|
+
* The module used to configure the {@link DaffExternalRouterDriver} for usage with Magento.
|
112
67
|
*
|
113
68
|
* ```ts
|
114
|
-
*
|
69
|
+
* @NgModule({
|
115
70
|
* declarations: [],
|
116
71
|
* imports: [
|
117
72
|
* ...
|
@@ -126,7 +81,6 @@ if (false) {
|
|
126
81
|
class DaffExternalRouterDriverMagentoModule {
|
127
82
|
/**
|
128
83
|
* Configures the package for the root injector.
|
129
|
-
* @return {?}
|
130
84
|
*/
|
131
85
|
static forRoot() {
|
132
86
|
return {
|
@@ -152,22 +106,12 @@ DaffExternalRouterDriverMagentoModule.decorators = [
|
|
152
106
|
},] }
|
153
107
|
];
|
154
108
|
|
155
|
-
|
156
|
-
*
|
157
|
-
* Generated from: public_api.ts
|
158
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
159
|
-
*/
|
160
|
-
|
161
|
-
/**
|
162
|
-
* @fileoverview added by tsickle
|
163
|
-
* Generated from: index.ts
|
164
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
109
|
+
/*
|
110
|
+
* Public API Surface of @daffodil/external-router/driver/magento/2.4.2
|
165
111
|
*/
|
166
112
|
|
167
113
|
/**
|
168
|
-
*
|
169
|
-
* Generated from: daffodil-external-router-driver-magento-2.4.2.ts
|
170
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
114
|
+
* Generated bundle index. Do not edit.
|
171
115
|
*/
|
172
116
|
|
173
117
|
export { DaffExternalRouterDriverMagentoModule, DaffExternalRouterMagentoDriver, DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME as ɵa };
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"daffodil-external-router-driver-magento-2.4.2.js","sources":["../../../libs/external-router/driver/magento/2.4.2/src/graphql/queries/resolve-url-v2.4.2.ts","../../../libs/external-router/driver/magento/2.4.2/src/transforms/resolution-to-resolvable-url.ts","../../../libs/external-router/driver/magento/2.4.2/src/magento.service.ts","../../../libs/external-router/driver/magento/2.4.2/src/magento.module.ts"],"sourcesContent":["import { gql } from 'apollo-angular';\n\nexport const DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME = 'MagentoResolveUrlv242';\n\n/**\n * This query retrieves a URL resolution from Magento and informs you about\n * what type of route the URL is.\n */\nexport const MagentoResolveUrlv242 = gql`\n\tquery ${DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME}($url: String!) {\n\t\turlResolver(url: $url) {\n\t\t\tentity_uid\n\t\t\trelative_url\n\t\t\tredirectCode\n\t\t\ttype\n\t\t}\n\t}\n`;\n","import {\n daffUriTruncateLeadingSlash,\n daffUriTruncateQueryFragment,\n} from '@daffodil/core/routing';\nimport { DaffExternallyResolvableUrl } from '@daffodil/external-router';\nimport { DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION } from '@daffodil/external-router/driver';\nimport {\n MagentoUrlResolver,\n magentoTransformRedirectToHttpCode,\n} from '@daffodil/external-router/driver/magento';\n\n\nexport const transformResolutionToResolvableUrlv242 = (\n resolution: MagentoUrlResolver,\n): DaffExternallyResolvableUrl => (resolution ? {\n id: resolution.entity_uid,\n url: daffUriTruncateLeadingSlash(daffUriTruncateQueryFragment(resolution.relative_url)),\n type: resolution.type,\n code: magentoTransformRedirectToHttpCode(resolution.redirectCode),\n} : DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION);\n","import { Injectable } from '@angular/core';\nimport { Apollo } from 'apollo-angular';\nimport { Observable } from 'rxjs';\nimport { map } from 'rxjs/operators';\n\n\nimport { DaffExternallyResolvableUrl } from '@daffodil/external-router';\nimport { DaffExternalRouterDriverInterface } from '@daffodil/external-router/driver';\nimport { MagentoUrlResolverResponse } from '@daffodil/external-router/driver/magento';\n\nimport { MagentoResolveUrlv242 } from './graphql/queries/resolve-url-v2.4.2';\nimport { transformResolutionToResolvableUrlv242 } from './transforms/resolution-to-resolvable-url';\n\n\n/**\n * The DaffExternalRouterMagentoDriver is responsible for translating an\n * arbitrary URI into a DaffExternallyResolvableUrl with Magento environments.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffExternalRouterMagentoDriver\nimplements DaffExternalRouterDriverInterface {\n constructor(\n\t\tprivate apollo: Apollo,\n ) {}\n\n resolve(url: string): Observable<DaffExternallyResolvableUrl> {\n return this.apollo\n .query<MagentoUrlResolverResponse>({\n query: MagentoResolveUrlv242,\n variables: {\n url,\n },\n })\n .pipe(map(response => transformResolutionToResolvableUrlv242(response.data.urlResolver)));\n }\n}\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport { DAFF_MAGENTO_CACHEABLE_OPERATIONS } from '@daffodil/driver/magento';\nimport { DaffExternalRouterDriver } from '@daffodil/external-router/driver';\n\nimport { DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME } from './graphql/queries/resolve-url-v2.4.2';\nimport { DaffExternalRouterMagentoDriver } from './magento.service';\n\n/**\n * The module used to configure the {@link DaffExternalRouterDriver} for usage with Magento.\n *\n * ```ts\n * @NgModule({\n * declarations: [],\n * imports: [\n * ...\n * DaffExternalRouterDriverMagentoModule.forRoot()\n * ],\n * })\n * export class AppModule{}\n * ```\n *\n * Note that this package depends upon ApolloClient, as the Magento driver uses GraphQl to make it's API calls.\n */\n@NgModule({\n declarations: [],\n imports: [CommonModule],\n})\nexport class DaffExternalRouterDriverMagentoModule {\n\n /**\n * Configures the package for the root injector.\n */\n static forRoot(): ModuleWithProviders<DaffExternalRouterDriverMagentoModule> {\n return {\n ngModule: DaffExternalRouterDriverMagentoModule,\n providers: [\n {\n provide: DaffExternalRouterDriver,\n useExisting: DaffExternalRouterMagentoDriver,\n },\n {\n provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS,\n useValue: DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME,\n multi: true,\n },\n ],\n };\n }\n}\n"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"daffodil-external-router-driver-magento-2.4.2.js","sources":["../../../libs/external-router/driver/magento/2.4.2/src/graphql/queries/resolve-url-v2.4.2.ts","../../../libs/external-router/driver/magento/2.4.2/src/transforms/resolution-to-resolvable-url.ts","../../../libs/external-router/driver/magento/2.4.2/src/magento.service.ts","../../../libs/external-router/driver/magento/2.4.2/src/magento.module.ts","../../../libs/external-router/driver/magento/2.4.2/src/public_api.ts","../../../libs/external-router/driver/magento/2.4.2/src/daffodil-external-router-driver-magento-2.4.2.ts"],"sourcesContent":["import { gql } from 'apollo-angular';\n\nexport const DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME = 'MagentoResolveUrlv242';\n\n/**\n * This query retrieves a URL resolution from Magento and informs you about\n * what type of route the URL is.\n */\nexport const MagentoResolveUrlv242 = gql`\n\tquery ${DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME}($url: String!) {\n\t\turlResolver(url: $url) {\n\t\t\tentity_uid\n\t\t\trelative_url\n\t\t\tredirectCode\n\t\t\ttype\n\t\t}\n\t}\n`;\n","import {\n daffUriTruncateLeadingSlash,\n daffUriTruncateQueryFragment,\n} from '@daffodil/core/routing';\nimport { DaffExternallyResolvableUrl } from '@daffodil/external-router';\nimport { DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION } from '@daffodil/external-router/driver';\nimport {\n MagentoUrlResolver,\n magentoTransformRedirectToHttpCode,\n} from '@daffodil/external-router/driver/magento';\n\n\nexport const transformResolutionToResolvableUrlv242 = (\n resolution: MagentoUrlResolver,\n): DaffExternallyResolvableUrl => (resolution ? {\n id: resolution.entity_uid,\n url: daffUriTruncateLeadingSlash(daffUriTruncateQueryFragment(resolution.relative_url)),\n type: resolution.type,\n code: magentoTransformRedirectToHttpCode(resolution.redirectCode),\n} : DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION);\n","import { Injectable } from '@angular/core';\nimport { Apollo } from 'apollo-angular';\nimport { Observable } from 'rxjs';\nimport { map } from 'rxjs/operators';\n\n\nimport { DaffExternallyResolvableUrl } from '@daffodil/external-router';\nimport { DaffExternalRouterDriverInterface } from '@daffodil/external-router/driver';\nimport { MagentoUrlResolverResponse } from '@daffodil/external-router/driver/magento';\n\nimport { MagentoResolveUrlv242 } from './graphql/queries/resolve-url-v2.4.2';\nimport { transformResolutionToResolvableUrlv242 } from './transforms/resolution-to-resolvable-url';\n\n\n/**\n * The DaffExternalRouterMagentoDriver is responsible for translating an\n * arbitrary URI into a DaffExternallyResolvableUrl with Magento environments.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffExternalRouterMagentoDriver\nimplements DaffExternalRouterDriverInterface {\n constructor(\n\t\tprivate apollo: Apollo,\n ) {}\n\n resolve(url: string): Observable<DaffExternallyResolvableUrl> {\n return this.apollo\n .query<MagentoUrlResolverResponse>({\n query: MagentoResolveUrlv242,\n variables: {\n url,\n },\n })\n .pipe(map(response => transformResolutionToResolvableUrlv242(response.data.urlResolver)));\n }\n}\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport { DAFF_MAGENTO_CACHEABLE_OPERATIONS } from '@daffodil/driver/magento';\nimport { DaffExternalRouterDriver } from '@daffodil/external-router/driver';\n\nimport { DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME } from './graphql/queries/resolve-url-v2.4.2';\nimport { DaffExternalRouterMagentoDriver } from './magento.service';\n\n/**\n * The module used to configure the {@link DaffExternalRouterDriver} for usage with Magento.\n *\n * ```ts\n * @NgModule({\n * declarations: [],\n * imports: [\n * ...\n * DaffExternalRouterDriverMagentoModule.forRoot()\n * ],\n * })\n * export class AppModule{}\n * ```\n *\n * Note that this package depends upon ApolloClient, as the Magento driver uses GraphQl to make it's API calls.\n */\n@NgModule({\n declarations: [],\n imports: [CommonModule],\n})\nexport class DaffExternalRouterDriverMagentoModule {\n\n /**\n * Configures the package for the root injector.\n */\n static forRoot(): ModuleWithProviders<DaffExternalRouterDriverMagentoModule> {\n return {\n ngModule: DaffExternalRouterDriverMagentoModule,\n providers: [\n {\n provide: DaffExternalRouterDriver,\n useExisting: DaffExternalRouterMagentoDriver,\n },\n {\n provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS,\n useValue: DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME,\n multi: true,\n },\n ],\n };\n }\n}\n","/*\n * Public API Surface of @daffodil/external-router/driver/magento/2.4.2\n */\n\nexport { DaffExternalRouterMagentoDriver } from './magento.service';\nexport { DaffExternalRouterDriverMagentoModule } from './magento.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n\nexport {DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME as ɵa} from './graphql/queries/resolve-url-v2.4.2';"],"names":[],"mappings":";;;;;;;;;MAEa,mCAAmC,GAAG,wBAAwB;AAE3E;;;;AAIO,MAAM,qBAAqB,GAAG,GAAG,CAAA;SAC/B,mCAAmC;;;;;;;;CAQ3C;;ACLM,MAAM,sCAAsC,GAAG,CACpD,UAA8B,MACG,UAAU,GAAG;IAC9C,EAAE,EAAE,UAAU,CAAC,UAAU;IACzB,GAAG,EAAE,2BAA2B,CAAC,4BAA4B,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;IACvF,IAAI,EAAE,UAAU,CAAC,IAAI;IACrB,IAAI,EAAE,kCAAkC,CAAC,UAAU,CAAC,YAAY,CAAC;CAClE,GAAG,yCAAyC,CAAC;;ACL9C;;;;;;MASa,+BAA+B;IAE1C,YACQ,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;KAClB;IAEJ,OAAO,CAAC,GAAW;QACjB,OAAO,IAAI,CAAC,MAAM;aACf,KAAK,CAA6B;YACjC,KAAK,EAAE,qBAAqB;YAC5B,SAAS,EAAE;gBACT,GAAG;aACJ;SACF,CAAC;aACD,IAAI,CAAC,GAAG,CAAC,QAAQ,IAAI,sCAAsC,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;KAC7F;;;;YAlBF,UAAU,SAAC;gBACV,UAAU,EAAE,MAAM;aACnB;;;;YArBQ,MAAM;;;ACWf;;;;;;;;;;;;;;;;MAoBa,qCAAqC;;;;IAKhD,OAAO,OAAO;QACZ,OAAO;YACL,QAAQ,EAAE,qCAAqC;YAC/C,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,wBAAwB;oBACjC,WAAW,EAAE,+BAA+B;iBAC7C;gBACD;oBACE,OAAO,EAAE,iCAAiC;oBAC1C,QAAQ,EAAE,mCAAmC;oBAC7C,KAAK,EAAE,IAAI;iBACZ;aACF;SACF,CAAC;KACH;;;YAxBF,QAAQ,SAAC;gBACR,YAAY,EAAE,EAAE;gBAChB,OAAO,EAAE,CAAC,YAAY,CAAC;aACxB;;;AC/BD;;;;ACAA;;;;;;"}
|
@@ -1,58 +1,21 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
const MagentoUrlRewriteEntityTypeEnum = {
|
8
|
-
PRODUCT: "PRODUCT",
|
9
|
-
CATEGORY: "CATEGORY",
|
10
|
-
CMS_PAGE: "CMS_PAGE",
|
11
|
-
};
|
12
|
-
|
13
|
-
/**
|
14
|
-
* @fileoverview added by tsickle
|
15
|
-
* Generated from: model/public_api.ts
|
16
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
17
|
-
*/
|
1
|
+
var MagentoUrlRewriteEntityTypeEnum;
|
2
|
+
(function (MagentoUrlRewriteEntityTypeEnum) {
|
3
|
+
MagentoUrlRewriteEntityTypeEnum["PRODUCT"] = "PRODUCT";
|
4
|
+
MagentoUrlRewriteEntityTypeEnum["CATEGORY"] = "CATEGORY";
|
5
|
+
MagentoUrlRewriteEntityTypeEnum["CMS_PAGE"] = "CMS_PAGE";
|
6
|
+
})(MagentoUrlRewriteEntityTypeEnum || (MagentoUrlRewriteEntityTypeEnum = {}));
|
18
7
|
|
19
|
-
/**
|
20
|
-
* @fileoverview added by tsickle
|
21
|
-
* Generated from: transforms/redirect-to-http.ts
|
22
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
23
|
-
*/
|
24
8
|
/**
|
25
9
|
* Transforms a Magento redirect code to the appropriate HTTP status code.
|
26
|
-
* @type {?}
|
27
|
-
*/
|
28
|
-
const magentoTransformRedirectToHttpCode = (/**
|
29
|
-
* @param {?} code
|
30
|
-
* @return {?}
|
31
10
|
*/
|
32
|
-
(code) => code === 0 ? 200 : code
|
11
|
+
const magentoTransformRedirectToHttpCode = (code) => code === 0 ? 200 : code;
|
33
12
|
|
34
|
-
|
35
|
-
*
|
36
|
-
* Generated from: transforms/public_api.ts
|
37
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
38
|
-
*/
|
39
|
-
|
40
|
-
/**
|
41
|
-
* @fileoverview added by tsickle
|
42
|
-
* Generated from: public_api.ts
|
43
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
44
|
-
*/
|
45
|
-
|
46
|
-
/**
|
47
|
-
* @fileoverview added by tsickle
|
48
|
-
* Generated from: index.ts
|
49
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
13
|
+
/*
|
14
|
+
* Public API Surface of @daffodil/external-router/driver/magento
|
50
15
|
*/
|
51
16
|
|
52
17
|
/**
|
53
|
-
*
|
54
|
-
* Generated from: daffodil-external-router-driver-magento.ts
|
55
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
18
|
+
* Generated bundle index. Do not edit.
|
56
19
|
*/
|
57
20
|
|
58
21
|
export { MagentoUrlRewriteEntityTypeEnum, magentoTransformRedirectToHttpCode };
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"daffodil-external-router-driver-magento.js","sources":["../../../libs/external-router/driver/magento/src/model/resolution-types.ts","../../../libs/external-router/driver/magento/src/transforms/redirect-to-http.ts"],"sourcesContent":["export enum MagentoUrlRewriteEntityTypeEnum {\n\tPRODUCT = 'PRODUCT',\n\tCATEGORY = 'CATEGORY',\n\tCMS_PAGE = 'CMS_PAGE',\n}\n","/**\n * Transforms a Magento redirect code to the appropriate HTTP status code.\n */\nexport const magentoTransformRedirectToHttpCode = (code: number): number =>\n code === 0 ? 200 : code;\n"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"daffodil-external-router-driver-magento.js","sources":["../../../libs/external-router/driver/magento/src/model/resolution-types.ts","../../../libs/external-router/driver/magento/src/transforms/redirect-to-http.ts","../../../libs/external-router/driver/magento/src/public_api.ts","../../../libs/external-router/driver/magento/src/daffodil-external-router-driver-magento.ts"],"sourcesContent":["export enum MagentoUrlRewriteEntityTypeEnum {\n\tPRODUCT = 'PRODUCT',\n\tCATEGORY = 'CATEGORY',\n\tCMS_PAGE = 'CMS_PAGE',\n}\n","/**\n * Transforms a Magento redirect code to the appropriate HTTP status code.\n */\nexport const magentoTransformRedirectToHttpCode = (code: number): number =>\n code === 0 ? 200 : code;\n","/*\n * Public API Surface of @daffodil/external-router/driver/magento\n */\n\nexport * from './model/public_api';\nexport * from './transforms/public_api';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"IAAY;AAAZ,WAAY,+BAA+B;IAC1C,sDAAmB,CAAA;IACnB,wDAAqB,CAAA;IACrB,wDAAqB,CAAA;AACtB,CAAC,EAJW,+BAA+B,KAA/B,+BAA+B;;ACA3C;;;MAGa,kCAAkC,GAAG,CAAC,IAAY,KAC7D,IAAI,KAAK,CAAC,GAAG,GAAG,GAAG;;ACJrB;;;;ACAA;;;;;;"}
|
@@ -1,62 +1,33 @@
|
|
1
|
-
import { InjectionToken,
|
1
|
+
import { InjectionToken, ɵɵdefineInjectable, ɵɵinject, Injectable, Inject, NgModule } from '@angular/core';
|
2
2
|
import { datatype } from 'faker/locale/en_US';
|
3
3
|
import { throwError, of } from 'rxjs';
|
4
4
|
import { daffUriTruncateLeadingSlash, daffUriTruncateQueryFragment } from '@daffodil/core/routing';
|
5
5
|
import { CommonModule } from '@angular/common';
|
6
6
|
import { DaffExternalRouterDriver } from '@daffodil/external-router/driver';
|
7
7
|
|
8
|
-
/**
|
9
|
-
* @fileoverview added by tsickle
|
10
|
-
* Generated from: config.ts
|
11
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
12
|
-
*/
|
13
|
-
/**
|
14
|
-
* The configuration for the testing driver. It is a dictionary of "url": "type",
|
15
|
-
* pairs, where the URL is a URL-safe routeable path, e.g. "sweatshirts" or "t-shirts"
|
16
|
-
* and the type is a known type to your application, e.g. "CATEGORY".
|
17
|
-
* @record
|
18
|
-
*/
|
19
|
-
function DaffExternalRouterDriverTestingConfig() { }
|
20
8
|
/**
|
21
9
|
* The token used by Daffodil to hold the driver's configuration.
|
22
10
|
*
|
23
|
-
*
|
24
|
-
* @type {?}
|
11
|
+
* @docs-private
|
25
12
|
*/
|
26
13
|
const DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG = new InjectionToken('DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG', {
|
27
14
|
providedIn: 'root',
|
28
|
-
factory: (
|
29
|
-
* @return {?}
|
30
|
-
*/
|
31
|
-
() => ({})),
|
15
|
+
factory: () => ({}),
|
32
16
|
});
|
33
17
|
|
34
|
-
/**
|
35
|
-
* @fileoverview added by tsickle
|
36
|
-
* Generated from: testing.service.ts
|
37
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
38
|
-
*/
|
39
18
|
/**
|
40
19
|
* The DaffExternalRouterTestingDriver is responsible for translating an
|
41
20
|
* arbitrary URI into a DaffExternallyResolvableUrl in testing environments.
|
42
21
|
*
|
43
|
-
*
|
22
|
+
* @inheritdoc
|
44
23
|
*
|
45
|
-
* @see {
|
24
|
+
* @see {@link DaffExternalRouterTestingDriver}
|
46
25
|
*/
|
47
26
|
class DaffExternalRouterTestingDriver {
|
48
|
-
/**
|
49
|
-
* @param {?=} testingConfiguration
|
50
|
-
*/
|
51
27
|
constructor(testingConfiguration = {}) {
|
52
28
|
this.testingConfiguration = testingConfiguration;
|
53
29
|
}
|
54
|
-
/**
|
55
|
-
* @param {?} url
|
56
|
-
* @return {?}
|
57
|
-
*/
|
58
30
|
resolve(url) {
|
59
|
-
/** @type {?} */
|
60
31
|
const truncatedUrl = daffUriTruncateLeadingSlash(daffUriTruncateQueryFragment(url));
|
61
32
|
if (!this.testingConfiguration[truncatedUrl]) {
|
62
33
|
return throwError(`\
|
@@ -71,6 +42,7 @@ Did you configure the available route types with DaffExternalRouterDriverTesting
|
|
71
42
|
});
|
72
43
|
}
|
73
44
|
}
|
45
|
+
/** @nocollapse */ DaffExternalRouterTestingDriver.ɵprov = ɵɵdefineInjectable({ factory: function DaffExternalRouterTestingDriver_Factory() { return new DaffExternalRouterTestingDriver(ɵɵinject(DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG)); }, token: DaffExternalRouterTestingDriver, providedIn: "root" });
|
74
46
|
DaffExternalRouterTestingDriver.decorators = [
|
75
47
|
{ type: Injectable, args: [{
|
76
48
|
providedIn: 'root',
|
@@ -80,29 +52,12 @@ DaffExternalRouterTestingDriver.decorators = [
|
|
80
52
|
DaffExternalRouterTestingDriver.ctorParameters = () => [
|
81
53
|
{ type: undefined, decorators: [{ type: Inject, args: [DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG,] }] }
|
82
54
|
];
|
83
|
-
/** @nocollapse */ DaffExternalRouterTestingDriver.ɵprov = ɵɵdefineInjectable({ factory: function DaffExternalRouterTestingDriver_Factory() { return new DaffExternalRouterTestingDriver(ɵɵinject(DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG)); }, token: DaffExternalRouterTestingDriver, providedIn: "root" });
|
84
|
-
if (false) {
|
85
|
-
/**
|
86
|
-
* @type {?}
|
87
|
-
* @private
|
88
|
-
*/
|
89
|
-
DaffExternalRouterTestingDriver.prototype.testingConfiguration;
|
90
|
-
}
|
91
55
|
|
92
|
-
/**
|
93
|
-
* @fileoverview added by tsickle
|
94
|
-
* Generated from: testing.module.ts
|
95
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
96
|
-
*/
|
97
56
|
/**
|
98
57
|
* The `DaffExternalRouterDriverTestingModule` is an importable NgModule that can
|
99
|
-
* be used to configure the {
|
58
|
+
* be used to configure the {@link DaffExternalRouterTestingDriver}.
|
100
59
|
*/
|
101
60
|
class DaffExternalRouterDriverTestingModule {
|
102
|
-
/**
|
103
|
-
* @param {?} config
|
104
|
-
* @return {?}
|
105
|
-
*/
|
106
61
|
static forRoot(config) {
|
107
62
|
return {
|
108
63
|
ngModule: DaffExternalRouterDriverTestingModule,
|
@@ -126,22 +81,12 @@ DaffExternalRouterDriverTestingModule.decorators = [
|
|
126
81
|
},] }
|
127
82
|
];
|
128
83
|
|
129
|
-
|
130
|
-
*
|
131
|
-
* Generated from: public_api.ts
|
132
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
133
|
-
*/
|
134
|
-
|
135
|
-
/**
|
136
|
-
* @fileoverview added by tsickle
|
137
|
-
* Generated from: index.ts
|
138
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
84
|
+
/*
|
85
|
+
* Public API Surface of @daffodil/external-router/driver/testing
|
139
86
|
*/
|
140
87
|
|
141
88
|
/**
|
142
|
-
*
|
143
|
-
* Generated from: daffodil-external-router-driver-testing.ts
|
144
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
89
|
+
* Generated bundle index. Do not edit.
|
145
90
|
*/
|
146
91
|
|
147
92
|
export { DaffExternalRouterDriverTestingModule, DaffExternalRouterTestingDriver, DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG as ɵa };
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"daffodil-external-router-driver-testing.js","sources":["../../../libs/external-router/driver/testing/src/config.ts","../../../libs/external-router/driver/testing/src/testing.service.ts","../../../libs/external-router/driver/testing/src/testing.module.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nimport { DaffExternalRouteType } from '@daffodil/external-router';\n\n/**\n * The configuration for the testing driver. It is a dictionary of \"url\": \"type\",\n * pairs, where the URL is a URL-safe routeable path, e.g. \"sweatshirts\" or \"t-shirts\"\n * and the type is a known type to your application, e.g. \"CATEGORY\".\n */\nexport interface DaffExternalRouterDriverTestingConfig {\n\t[url: string]: DaffExternalRouteType;\n}\n\n/**\n * The token used by Daffodil to hold the driver's configuration.\n *\n * @docs-private\n */\nexport const DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG = new InjectionToken<\n\tDaffExternalRouterDriverTestingConfig\n>('DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG', {\n providedIn: 'root',\n factory: () => ({}),\n});\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport * as faker from 'faker/locale/en_US';\nimport {\n Observable,\n of,\n throwError,\n} from 'rxjs';\n\nimport {\n daffUriTruncateLeadingSlash,\n daffUriTruncateQueryFragment,\n} from '@daffodil/core/routing';\nimport { DaffExternallyResolvableUrl } from '@daffodil/external-router';\nimport { DaffExternalRouterDriverInterface } from '@daffodil/external-router/driver';\n\nimport {\n DaffExternalRouterDriverTestingConfig,\n DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG,\n} from './config';\n\n/**\n * The DaffExternalRouterTestingDriver is responsible for translating an\n * arbitrary URI into a DaffExternallyResolvableUrl in testing environments.\n *\n * @inheritdoc\n *\n * @see {@link DaffExternalRouterTestingDriver}\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffExternalRouterTestingDriver\nimplements DaffExternalRouterDriverInterface {\n constructor(\n\t\t@Inject(DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG)\n\t\tprivate testingConfiguration: DaffExternalRouterDriverTestingConfig = {},\n ) {}\n\n resolve(url: string): Observable<DaffExternallyResolvableUrl> {\n const truncatedUrl = daffUriTruncateLeadingSlash(daffUriTruncateQueryFragment(url));\n\n if (!this.testingConfiguration[truncatedUrl]) {\n return throwError(`\\\nThe route '${truncatedUrl}' wasn't provided with a matching type by the testing driver. \\\nDid you configure the available route types with DaffExternalRouterDriverTestingModule.forRoot(config)`);\n }\n\n return of({\n id: faker.datatype.uuid(),\n url: truncatedUrl,\n type: this.testingConfiguration[truncatedUrl],\n code: 200,\n });\n }\n}\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport { DaffExternalRouterDriver } from '@daffodil/external-router/driver';\n\nimport {\n DaffExternalRouterDriverTestingConfig,\n DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG,\n} from './config';\nimport { DaffExternalRouterTestingDriver } from './testing.service';\n\n/**\n * The `DaffExternalRouterDriverTestingModule` is an importable NgModule that can\n * be used to configure the {@link DaffExternalRouterTestingDriver}.\n */\n@NgModule({\n declarations: [],\n imports: [CommonModule],\n})\nexport class DaffExternalRouterDriverTestingModule {\n static forRoot(\n config: DaffExternalRouterDriverTestingConfig,\n ): ModuleWithProviders<DaffExternalRouterDriverTestingModule> {\n return {\n ngModule: DaffExternalRouterDriverTestingModule,\n providers: [\n {\n provide: DaffExternalRouterDriver,\n useExisting: DaffExternalRouterTestingDriver,\n },\n {\n provide: DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG,\n useValue: config,\n },\n ],\n };\n }\n}\n"],"names":["faker.datatype"],"mappings":"
|
1
|
+
{"version":3,"file":"daffodil-external-router-driver-testing.js","sources":["../../../libs/external-router/driver/testing/src/config.ts","../../../libs/external-router/driver/testing/src/testing.service.ts","../../../libs/external-router/driver/testing/src/testing.module.ts","../../../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":["faker.datatype"],"mappings":";;;;;;;AAaA;;;;;MAKa,0CAA0C,GAAG,IAAI,cAAc,CAE1E,4CAA4C,EAAE;IAC9C,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,OAAO,EAAE,CAAC;CACpB;;ACAD;;;;;;;;MAWa,+BAA+B;IAE1C,YAEQ,uBAA8D,EAAE;QAAhE,yBAAoB,GAApB,oBAAoB,CAA4C;KACpE;IAEJ,OAAO,CAAC,GAAW;QACjB,MAAM,YAAY,GAAG,2BAA2B,CAAC,4BAA4B,CAAC,GAAG,CAAC,CAAC,CAAC;QAEpF,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,YAAY,CAAC,EAAE;YAC5C,OAAO,UAAU,CAAC;aACX,YAAY;uGAC8E,CAAC,CAAC;SACpG;QAED,OAAO,EAAE,CAAC;YACR,EAAE,EAAEA,QAAc,CAAC,IAAI,EAAE;YACzB,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,IAAI,CAAC,oBAAoB,CAAC,YAAY,CAAC;YAC7C,IAAI,EAAE,GAAG;SACV,CAAC,CAAC;KACJ;;;;YAzBF,UAAU,SAAC;gBACV,UAAU,EAAE,MAAM;aACnB;;;;4CAIE,MAAM,SAAC,0CAA0C;;;ACvBpD;;;;MAQa,qCAAqC;IAChD,OAAO,OAAO,CACZ,MAA6C;QAE7C,OAAO;YACL,QAAQ,EAAE,qCAAqC;YAC/C,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,wBAAwB;oBACjC,WAAW,EAAE,+BAA+B;iBAC7C;gBACD;oBACE,OAAO,EAAE,0CAA0C;oBACnD,QAAQ,EAAE,MAAM;iBACjB;aACF;SACF,CAAC;KACH;;;YArBF,QAAQ,SAAC;gBACR,YAAY,EAAE,EAAE;gBAChB,OAAO,EAAE,CAAC,YAAY,CAAC;aACxB;;;ACrBD;;;;ACAA;;;;;;"}
|