@daffodil/external-router 0.66.1 → 0.68.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/driver/in-memory/config.d.ts +1 -1
- package/{esm2020 → esm2022}/driver/in-memory/in-memory.module.mjs +5 -5
- package/{esm2020 → esm2022}/driver/in-memory/in-memory.service.mjs +6 -6
- package/{esm2020 → esm2022}/driver/magento/2.4.1/magento.module.mjs +5 -5
- package/{esm2020 → esm2022}/driver/magento/2.4.1/magento.service.mjs +5 -5
- package/{esm2020 → esm2022}/driver/magento/2.4.2/magento.module.mjs +5 -5
- package/{esm2020 → esm2022}/driver/magento/2.4.2/magento.service.mjs +5 -5
- package/{esm2020 → esm2022}/driver/magento/2.4.3/magento.module.mjs +5 -5
- package/{esm2020 → esm2022}/driver/magento/2.4.3/magento.service.mjs +5 -5
- package/{esm2020 → esm2022}/driver/testing/testing.module.mjs +5 -5
- package/{esm2020 → esm2022}/driver/testing/testing.service.mjs +6 -6
- package/{esm2020 → esm2022}/external-router.module.mjs +5 -5
- package/{esm2020 → esm2022}/router/router.service.mjs +6 -6
- package/{esm2020 → esm2022}/routing/guard/existence.guard.mjs +6 -6
- package/{fesm2020 → fesm2022}/daffodil-external-router-driver-in-memory.mjs +9 -9
- package/{fesm2020 → fesm2022}/daffodil-external-router-driver-in-memory.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/daffodil-external-router-driver-magento-2.4.1.mjs +8 -8
- package/{fesm2020 → fesm2022}/daffodil-external-router-driver-magento-2.4.1.mjs.map +1 -1
- package/{fesm2015 → fesm2022}/daffodil-external-router-driver-magento-2.4.2.mjs +9 -9
- package/{fesm2020 → fesm2022}/daffodil-external-router-driver-magento-2.4.2.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/daffodil-external-router-driver-magento-2.4.3.mjs +8 -8
- package/{fesm2020 → fesm2022}/daffodil-external-router-driver-magento-2.4.3.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/daffodil-external-router-driver-testing.mjs +9 -9
- package/{fesm2020 → fesm2022}/daffodil-external-router-driver-testing.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/daffodil-external-router-routing.mjs +5 -5
- package/fesm2022/daffodil-external-router-routing.mjs.map +1 -0
- package/{fesm2020 → fesm2022}/daffodil-external-router.mjs +9 -9
- package/{fesm2020 → fesm2022}/daffodil-external-router.mjs.map +1 -1
- package/model/insertion-strategy.type.d.ts +1 -1
- package/model/route-type.d.ts +1 -1
- package/model/route-with-data-path.d.ts +1 -1
- package/model/route-with-seo-data.d.ts +1 -1
- package/model/route-with-type.d.ts +1 -1
- package/model/route-without-path.d.ts +1 -1
- package/package.json +1 -1
- package/routing/guard/existence.guard.d.ts +2 -2
- package/fesm2015/daffodil-external-router-driver-in-memory.mjs +0 -97
- package/fesm2015/daffodil-external-router-driver-in-memory.mjs.map +0 -1
- package/fesm2015/daffodil-external-router-driver-magento-2.4.1.mjs +0 -125
- package/fesm2015/daffodil-external-router-driver-magento-2.4.1.mjs.map +0 -1
- package/fesm2015/daffodil-external-router-driver-magento-2.4.2.mjs.map +0 -1
- package/fesm2015/daffodil-external-router-driver-magento-2.4.3.mjs +0 -143
- package/fesm2015/daffodil-external-router-driver-magento-2.4.3.mjs.map +0 -1
- package/fesm2015/daffodil-external-router-driver-magento.mjs.map +0 -1
- package/fesm2015/daffodil-external-router-driver-testing.mjs +0 -101
- package/fesm2015/daffodil-external-router-driver-testing.mjs.map +0 -1
- package/fesm2015/daffodil-external-router-routing.mjs +0 -173
- package/fesm2015/daffodil-external-router-routing.mjs.map +0 -1
- package/fesm2015/daffodil-external-router.mjs +0 -297
- package/fesm2015/daffodil-external-router.mjs.map +0 -1
- package/fesm2020/daffodil-external-router-driver-magento-2.4.2.mjs +0 -122
- package/fesm2020/daffodil-external-router-driver-magento.mjs +0 -22
- package/fesm2020/daffodil-external-router-driver.mjs +0 -30
- package/fesm2020/daffodil-external-router-driver.mjs.map +0 -1
- package/fesm2020/daffodil-external-router-routing.mjs.map +0 -1
- /package/{esm2020 → esm2022}/config.mjs +0 -0
- /package/{esm2020 → esm2022}/daffodil-external-router.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/daffodil-external-router-driver.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/in-memory/config.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/in-memory/daffodil-external-router-driver-in-memory.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/in-memory/index.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/in-memory/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/index.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/interfaces/external-router-driver.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/2.4.1/daffodil-external-router-driver-magento-2.4.1.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/2.4.1/graphql/queries/resolve-url-v2.4.1.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/2.4.1/index.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/2.4.1/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/2.4.1/transforms/resolution-to-resolvable-url.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/2.4.2/daffodil-external-router-driver-magento-2.4.2.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/2.4.2/graphql/queries/resolve-url-v2.4.2.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/2.4.2/index.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/2.4.2/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/2.4.2/transforms/resolution-to-resolvable-url.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/2.4.3/daffodil-external-router-driver-magento-2.4.3.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/2.4.3/graphql/queries/resolve.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/2.4.3/index.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/2.4.3/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/2.4.3/transforms/resolution-to-resolvable-url.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/daffodil-external-router-driver-magento.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/index.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/model/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/model/resolution-types.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/model/route-response.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/model/route.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/model/url-resolver-response.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/model/url-resolver.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/transforms/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/transforms/redirect-to-http.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/not-found-resolution.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/testing/config.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/testing/daffodil-external-router-driver-testing.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/testing/index.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/testing/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/errors/no-wildcard.mjs +0 -0
- /package/{esm2020 → esm2022}/errors/unknown-type.mjs +0 -0
- /package/{esm2020 → esm2022}/model/insertion-strategy.type.mjs +0 -0
- /package/{esm2020 → esm2022}/model/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/model/resolvable-route.mjs +0 -0
- /package/{esm2020 → esm2022}/model/route-data.mjs +0 -0
- /package/{esm2020 → esm2022}/model/route-info.mjs +0 -0
- /package/{esm2020 → esm2022}/model/route-type.mjs +0 -0
- /package/{esm2020 → esm2022}/model/route-with-data-path.mjs +0 -0
- /package/{esm2020 → esm2022}/model/route-with-seo-data.mjs +0 -0
- /package/{esm2020 → esm2022}/model/route-with-type.mjs +0 -0
- /package/{esm2020 → esm2022}/model/route-without-path.mjs +0 -0
- /package/{esm2020 → esm2022}/model/type-route-pair.mjs +0 -0
- /package/{esm2020 → esm2022}/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/router/strategies/insert-data-path.mjs +0 -0
- /package/{esm2020 → esm2022}/router/strategies/insert-route-before-wildcard.mjs +0 -0
- /package/{esm2020 → esm2022}/router/url-matcher/data-path-matcher.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/daffodil-external-router-routing.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/errors/client-error.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/errors/not-found-error.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/errors/permanent-redirect.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/errors/server-error.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/errors/temporary-redirect.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/index.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/processors/process-errors.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/processors/process-redirect.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/token/type-resolvable-routes.token.mjs +0 -0
- /package/{esm2020 → esm2022}/transform/resolved-route-to-route.mjs +0 -0
- /package/{esm2020 → esm2022}/util/extract-daff-path-data.mjs +0 -0
- /package/{fesm2015 → fesm2022}/daffodil-external-router-driver-magento.mjs +0 -0
- /package/{fesm2020 → fesm2022}/daffodil-external-router-driver-magento.mjs.map +0 -0
- /package/{fesm2015 → fesm2022}/daffodil-external-router-driver.mjs +0 -0
- /package/{fesm2015 → fesm2022}/daffodil-external-router-driver.mjs.map +0 -0
@@ -5,4 +5,4 @@ import { Route, Routes } from '@angular/router';
|
|
5
5
|
* so a typical usage should not modify the config beyond simply adding the route
|
6
6
|
* to the desired location.
|
7
7
|
*/
|
8
|
-
export
|
8
|
+
export type DaffExternalRouterInsertionStrategy = (route: Route, routes: Routes) => Routes;
|
package/model/route-type.d.ts
CHANGED
@@ -7,7 +7,7 @@ import { DaffRouteData } from './route-data';
|
|
7
7
|
* {@link daffDataPathUrlMatcher}
|
8
8
|
* {@link daffInsertDataPathStrategy}
|
9
9
|
*/
|
10
|
-
export
|
10
|
+
export type DaffRouteWithDataPath = Route & {
|
11
11
|
data?: {
|
12
12
|
daffPaths?: Record<string, DaffRouteData | Data>;
|
13
13
|
};
|
@@ -7,6 +7,6 @@ import { DaffExternalRouteType } from './route-type';
|
|
7
7
|
* {@link daffDataPathUrlMatcher}
|
8
8
|
* {@link daffInsertDataPathStrategy}
|
9
9
|
*/
|
10
|
-
export
|
10
|
+
export type DaffRouteWithType = Route & {
|
11
11
|
daffExternalRouteType: DaffExternalRouteType;
|
12
12
|
};
|
@@ -4,4 +4,4 @@ import { Route } from '@angular/router';
|
|
4
4
|
* This is useful when defining routes that aren't provided a path initially,
|
5
5
|
* but will be provided with one at a later time, e.g. at runtime.
|
6
6
|
*/
|
7
|
-
export
|
7
|
+
export type DaffRouteWithoutPath = Omit<Route, 'path'>;
|
package/package.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"name":"@daffodil/external-router","nx":{"targets":{"build":{"outputs":["{workspaceRoot}/dist/external-router"]}}},"version":"0.
|
1
|
+
{"name":"@daffodil/external-router","nx":{"targets":{"build":{"outputs":["{workspaceRoot}/dist/external-router"]}}},"version":"0.68.0","description":"A platform-agnostic package that connects the @angular/router with an external routing service (e.g. an API), allowing for runtime route resolution.","repository":{"type":"git","url":"https://github.com/graycoreio/daffodil"},"author":"Graycore LLC","license":"MIT","bugs":{"url":"https://github.com/graycoreio/daffodil/issues"},"homepage":"https://github.com/graycoreio/daffodil","peerDependencies":{"@angular/common":"^17.0.0","@angular/core":"^17.0.0","@angular/router":"^17.0.0","@daffodil/core":"0.68.0","rxjs":"7.8.1"},"optionalDependencies":{"apollo-angular":"^6.0.0","@daffodil/driver":"0.68.0"},"module":"fesm2022/daffodil-external-router.mjs","typings":"index.d.ts","exports":{"./package.json":{"default":"./package.json"},".":{"types":"./index.d.ts","esm2022":"./esm2022/daffodil-external-router.mjs","esm":"./esm2022/daffodil-external-router.mjs","default":"./fesm2022/daffodil-external-router.mjs"},"./driver":{"types":"./driver/index.d.ts","esm2022":"./esm2022/driver/daffodil-external-router-driver.mjs","esm":"./esm2022/driver/daffodil-external-router-driver.mjs","default":"./fesm2022/daffodil-external-router-driver.mjs"},"./routing":{"types":"./routing/index.d.ts","esm2022":"./esm2022/routing/daffodil-external-router-routing.mjs","esm":"./esm2022/routing/daffodil-external-router-routing.mjs","default":"./fesm2022/daffodil-external-router-routing.mjs"},"./driver/in-memory":{"types":"./driver/in-memory/index.d.ts","esm2022":"./esm2022/driver/in-memory/daffodil-external-router-driver-in-memory.mjs","esm":"./esm2022/driver/in-memory/daffodil-external-router-driver-in-memory.mjs","default":"./fesm2022/daffodil-external-router-driver-in-memory.mjs"},"./driver/magento":{"types":"./driver/magento/index.d.ts","esm2022":"./esm2022/driver/magento/daffodil-external-router-driver-magento.mjs","esm":"./esm2022/driver/magento/daffodil-external-router-driver-magento.mjs","default":"./fesm2022/daffodil-external-router-driver-magento.mjs"},"./driver/testing":{"types":"./driver/testing/index.d.ts","esm2022":"./esm2022/driver/testing/daffodil-external-router-driver-testing.mjs","esm":"./esm2022/driver/testing/daffodil-external-router-driver-testing.mjs","default":"./fesm2022/daffodil-external-router-driver-testing.mjs"},"./driver/magento/2.4.1":{"types":"./driver/magento/2.4.1/index.d.ts","esm2022":"./esm2022/driver/magento/2.4.1/daffodil-external-router-driver-magento-2.4.1.mjs","esm":"./esm2022/driver/magento/2.4.1/daffodil-external-router-driver-magento-2.4.1.mjs","default":"./fesm2022/daffodil-external-router-driver-magento-2.4.1.mjs"},"./driver/magento/2.4.2":{"types":"./driver/magento/2.4.2/index.d.ts","esm2022":"./esm2022/driver/magento/2.4.2/daffodil-external-router-driver-magento-2.4.2.mjs","esm":"./esm2022/driver/magento/2.4.2/daffodil-external-router-driver-magento-2.4.2.mjs","default":"./fesm2022/daffodil-external-router-driver-magento-2.4.2.mjs"},"./driver/magento/2.4.3":{"types":"./driver/magento/2.4.3/index.d.ts","esm2022":"./esm2022/driver/magento/2.4.3/daffodil-external-router-driver-magento-2.4.3.mjs","esm":"./esm2022/driver/magento/2.4.3/daffodil-external-router-driver-magento-2.4.3.mjs","default":"./fesm2022/daffodil-external-router-driver-magento-2.4.3.mjs"}},"sideEffects":false,"dependencies":{"tslib":"^2.3.0"}}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { ActivatedRouteSnapshot, Router, RouterStateSnapshot, UrlTree } from '@angular/router';
|
2
2
|
import { Observable } from 'rxjs';
|
3
3
|
import { DaffRoutingUriNormalizer } from '@daffodil/core/routing';
|
4
4
|
import { DaffExternalRouter, DaffExternalRouterConfiguration } from '@daffodil/external-router';
|
@@ -9,7 +9,7 @@ import * as i0 from "@angular/core";
|
|
9
9
|
* of an Angular App and either navigating to a resolved route upon successful resolution
|
10
10
|
* or navigating to the configured route upon a failed resolution.
|
11
11
|
*/
|
12
|
-
export declare class DaffExternalRouterExistenceGuard
|
12
|
+
export declare class DaffExternalRouterExistenceGuard {
|
13
13
|
private driver;
|
14
14
|
private externalRouter;
|
15
15
|
private router;
|
@@ -1,97 +0,0 @@
|
|
1
|
-
import * as i0 from '@angular/core';
|
2
|
-
import { InjectionToken, Injectable, Inject, inject, NgModule } from '@angular/core';
|
3
|
-
import { of } from 'rxjs';
|
4
|
-
import { daffUriTruncateQueryFragment, daffUriTruncateLeadingSlash } from '@daffodil/core/routing';
|
5
|
-
import { DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION, DaffExternalRouterDriver } from '@daffodil/external-router/driver';
|
6
|
-
import { CommonModule } from '@angular/common';
|
7
|
-
|
8
|
-
const defaultConfig = {
|
9
|
-
resolver: () => DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION,
|
10
|
-
};
|
11
|
-
/**
|
12
|
-
* The token used by Daffodil to hold the driver's configuration.
|
13
|
-
*
|
14
|
-
* @docs-private
|
15
|
-
*/
|
16
|
-
const DAFF_EXTERNAL_ROUTER_DRIVER_IN_MEMORY_CONFIG = new InjectionToken('DAFF_EXTERNAL_ROUTER_DRIVER_IN_MEMORY_CONFIG', {
|
17
|
-
providedIn: 'root',
|
18
|
-
factory: () => defaultConfig,
|
19
|
-
});
|
20
|
-
|
21
|
-
/**
|
22
|
-
* The DaffExternalRouterInMemoryDriver is responsible for resolving
|
23
|
-
* a URL using the resolver in the provided configuration.
|
24
|
-
*
|
25
|
-
* @inheritdoc
|
26
|
-
*
|
27
|
-
* @see {@link DaffExternalRouterInMemoryDriver}
|
28
|
-
*/
|
29
|
-
class DaffExternalRouterInMemoryDriver {
|
30
|
-
constructor(configuration) {
|
31
|
-
this.configuration = configuration;
|
32
|
-
}
|
33
|
-
resolve(url) {
|
34
|
-
const truncatedUrl = daffUriTruncateQueryFragment(url);
|
35
|
-
const resolvedUrl = this.configuration.resolver(truncatedUrl);
|
36
|
-
return of((resolvedUrl === null || resolvedUrl === void 0 ? void 0 : resolvedUrl.url) ? Object.assign(Object.assign({}, resolvedUrl), { url: daffUriTruncateLeadingSlash(resolvedUrl.url) }) : DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION);
|
37
|
-
}
|
38
|
-
}
|
39
|
-
/** @nocollapse */ DaffExternalRouterInMemoryDriver.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffExternalRouterInMemoryDriver, deps: [{ token: DAFF_EXTERNAL_ROUTER_DRIVER_IN_MEMORY_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable });
|
40
|
-
/** @nocollapse */ DaffExternalRouterInMemoryDriver.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffExternalRouterInMemoryDriver, providedIn: 'root' });
|
41
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffExternalRouterInMemoryDriver, decorators: [{
|
42
|
-
type: Injectable,
|
43
|
-
args: [{
|
44
|
-
providedIn: 'root',
|
45
|
-
}]
|
46
|
-
}], ctorParameters: function () {
|
47
|
-
return [{ type: undefined, decorators: [{
|
48
|
-
type: Inject,
|
49
|
-
args: [DAFF_EXTERNAL_ROUTER_DRIVER_IN_MEMORY_CONFIG]
|
50
|
-
}] }];
|
51
|
-
} });
|
52
|
-
|
53
|
-
/**
|
54
|
-
* The `DaffExternalRouterDriverInMemoryModule` is an importable NgModule that can
|
55
|
-
* be used to configure the {@link DaffExternalRouterInMemoryDriver}.
|
56
|
-
*/
|
57
|
-
class DaffExternalRouterDriverInMemoryModule {
|
58
|
-
static forRoot(config) {
|
59
|
-
return {
|
60
|
-
ngModule: DaffExternalRouterDriverInMemoryModule,
|
61
|
-
providers: [
|
62
|
-
{
|
63
|
-
provide: DaffExternalRouterDriver,
|
64
|
-
useExisting: DaffExternalRouterInMemoryDriver,
|
65
|
-
},
|
66
|
-
{
|
67
|
-
provide: DAFF_EXTERNAL_ROUTER_DRIVER_IN_MEMORY_CONFIG,
|
68
|
-
// eslint-disable-next-line prefer-arrow/prefer-arrow-functions
|
69
|
-
useFactory() {
|
70
|
-
return config instanceof InjectionToken ? inject(config) : config;
|
71
|
-
},
|
72
|
-
},
|
73
|
-
],
|
74
|
-
};
|
75
|
-
}
|
76
|
-
}
|
77
|
-
/** @nocollapse */ DaffExternalRouterDriverInMemoryModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffExternalRouterDriverInMemoryModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
78
|
-
/** @nocollapse */ DaffExternalRouterDriverInMemoryModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: DaffExternalRouterDriverInMemoryModule, imports: [CommonModule] });
|
79
|
-
/** @nocollapse */ DaffExternalRouterDriverInMemoryModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffExternalRouterDriverInMemoryModule, imports: [CommonModule] });
|
80
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffExternalRouterDriverInMemoryModule, decorators: [{
|
81
|
-
type: NgModule,
|
82
|
-
args: [{
|
83
|
-
declarations: [],
|
84
|
-
imports: [CommonModule],
|
85
|
-
}]
|
86
|
-
}] });
|
87
|
-
|
88
|
-
/*
|
89
|
-
* Public API Surface of @daffodil/external-router/driver/in-memory
|
90
|
-
*/
|
91
|
-
|
92
|
-
/**
|
93
|
-
* Generated bundle index. Do not edit.
|
94
|
-
*/
|
95
|
-
|
96
|
-
export { DaffExternalRouterDriverInMemoryModule, DaffExternalRouterInMemoryDriver };
|
97
|
-
//# sourceMappingURL=daffodil-external-router-driver-in-memory.mjs.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"daffodil-external-router-driver-in-memory.mjs","sources":["../../../libs/external-router/driver/in-memory/src/config.ts","../../../libs/external-router/driver/in-memory/src/in-memory.service.ts","../../../libs/external-router/driver/in-memory/src/in-memory.module.ts","../../../libs/external-router/driver/in-memory/src/public_api.ts","../../../libs/external-router/driver/in-memory/src/daffodil-external-router-driver-in-memory.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nimport { DaffExternallyResolvableUrl } from '@daffodil/external-router';\nimport { DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION } from '@daffodil/external-router/driver';\n\n/**\n * A lookup for a URL.\n * Returns an {@link DaffExternallyResolvableUrl} or\n * {@link DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION} if the URL cannot be resolved\n */\nexport type DaffExternalRouterDriverInMemoryResolver = (url: string) => DaffExternallyResolvableUrl;\n\n/**\n * The configuration for the in-memory driver.\n */\nexport interface DaffExternalRouterDriverInMemoryConfig {\n resolver: DaffExternalRouterDriverInMemoryResolver;\n}\n\nconst defaultConfig: DaffExternalRouterDriverInMemoryConfig = {\n resolver: () => DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION,\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_IN_MEMORY_CONFIG = new InjectionToken<\nDaffExternalRouterDriverInMemoryConfig\n>('DAFF_EXTERNAL_ROUTER_DRIVER_IN_MEMORY_CONFIG', {\n providedIn: 'root',\n factory: () => defaultConfig,\n});\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n Observable,\n of,\n} from 'rxjs';\n\nimport {\n daffUriTruncateLeadingSlash,\n daffUriTruncateQueryFragment,\n} from '@daffodil/core/routing';\nimport { DaffExternallyResolvableUrl } from '@daffodil/external-router';\nimport {\n DaffExternalRouterDriverInterface,\n DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION,\n} from '@daffodil/external-router/driver';\n\nimport {\n DaffExternalRouterDriverInMemoryConfig,\n DAFF_EXTERNAL_ROUTER_DRIVER_IN_MEMORY_CONFIG,\n} from './config';\n\n/**\n * The DaffExternalRouterInMemoryDriver is responsible for resolving\n * a URL using the resolver in the provided configuration.\n *\n * @inheritdoc\n *\n * @see {@link DaffExternalRouterInMemoryDriver}\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffExternalRouterInMemoryDriver\nimplements DaffExternalRouterDriverInterface {\n constructor(\n @Inject(DAFF_EXTERNAL_ROUTER_DRIVER_IN_MEMORY_CONFIG)\n private configuration: DaffExternalRouterDriverInMemoryConfig,\n ) {}\n\n resolve(url: string): Observable<DaffExternallyResolvableUrl> {\n const truncatedUrl = daffUriTruncateQueryFragment(url);\n const resolvedUrl = this.configuration.resolver(truncatedUrl);\n\n return of(resolvedUrl?.url ? {\n ...resolvedUrl,\n url: daffUriTruncateLeadingSlash(resolvedUrl.url),\n } : DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION);\n }\n}\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n InjectionToken,\n inject,\n} from '@angular/core';\n\nimport { DaffExternalRouterDriver } from '@daffodil/external-router/driver';\n\nimport {\n DaffExternalRouterDriverInMemoryConfig,\n DAFF_EXTERNAL_ROUTER_DRIVER_IN_MEMORY_CONFIG,\n} from './config';\nimport { DaffExternalRouterInMemoryDriver } from './in-memory.service';\n\n/**\n * The `DaffExternalRouterDriverInMemoryModule` is an importable NgModule that can\n * be used to configure the {@link DaffExternalRouterInMemoryDriver}.\n */\n@NgModule({\n declarations: [],\n imports: [CommonModule],\n})\nexport class DaffExternalRouterDriverInMemoryModule {\n static forRoot(\n config: DaffExternalRouterDriverInMemoryConfig | InjectionToken<DaffExternalRouterDriverInMemoryConfig>,\n ): ModuleWithProviders<DaffExternalRouterDriverInMemoryModule> {\n return {\n ngModule: DaffExternalRouterDriverInMemoryModule,\n providers: [\n {\n provide: DaffExternalRouterDriver,\n useExisting: DaffExternalRouterInMemoryDriver,\n },\n {\n provide: DAFF_EXTERNAL_ROUTER_DRIVER_IN_MEMORY_CONFIG,\n // eslint-disable-next-line prefer-arrow/prefer-arrow-functions\n useFactory() {\n return config instanceof InjectionToken ? inject(config) : config;\n },\n },\n ],\n };\n }\n}\n","/*\n * Public API Surface of @daffodil/external-router/driver/in-memory\n */\n\nexport { DaffExternalRouterInMemoryDriver } from './in-memory.service';\nexport { DaffExternalRouterDriverInMemoryModule } from './in-memory.module';\n\nexport {\n DaffExternalRouterDriverInMemoryConfig,\n DaffExternalRouterDriverInMemoryResolver,\n} from './config';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AA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A;kBAJlD,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,EAAE;oBAChB,OAAO,EAAE,CAAC,YAAY,CAAC;iBACxB,CAAA;;;ACvBD;;AAEG;;ACFH;;AAEG;;;;"}
|
@@ -1,125 +0,0 @@
|
|
1
|
-
import * as i0 from '@angular/core';
|
2
|
-
import { Injectable, NgModule } from '@angular/core';
|
3
|
-
import { map } from 'rxjs/operators';
|
4
|
-
import { daffUriTruncateLeadingSlash, daffUriTruncateQueryFragment } from '@daffodil/core/routing';
|
5
|
-
import * as i1 from 'apollo-angular';
|
6
|
-
import { gql } from 'apollo-angular';
|
7
|
-
import { DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION, DaffExternalRouterDriver } from '@daffodil/external-router/driver';
|
8
|
-
import { magentoTransformRedirectToHttpCode } from '@daffodil/external-router/driver/magento';
|
9
|
-
import { CommonModule } from '@angular/common';
|
10
|
-
import { DAFF_MAGENTO_CACHEABLE_OPERATIONS } from '@daffodil/driver/magento';
|
11
|
-
|
12
|
-
const DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME = 'MagentoResolveUrlv241';
|
13
|
-
/**
|
14
|
-
* This query retrieves a URL resolution from Magento and informs you about
|
15
|
-
* what type of route the URL is.
|
16
|
-
*/
|
17
|
-
const MagentoResolveUrlv241 = gql `
|
18
|
-
query ${DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME}($url: String!) {
|
19
|
-
urlResolver(url: $url) {
|
20
|
-
id
|
21
|
-
relative_url
|
22
|
-
redirectCode
|
23
|
-
type
|
24
|
-
}
|
25
|
-
}
|
26
|
-
`;
|
27
|
-
|
28
|
-
const transformResolutionToResolvableUrlv241 = (resolution) => {
|
29
|
-
var _a;
|
30
|
-
return (resolution ? {
|
31
|
-
id: (_a = resolution.id) === null || _a === void 0 ? void 0 : _a.toString(),
|
32
|
-
url: daffUriTruncateLeadingSlash(daffUriTruncateQueryFragment(resolution.relative_url)),
|
33
|
-
type: resolution.type,
|
34
|
-
code: magentoTransformRedirectToHttpCode(resolution.redirectCode),
|
35
|
-
} : DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION);
|
36
|
-
};
|
37
|
-
|
38
|
-
/**
|
39
|
-
* The DaffExternalRouterMagentoDriver is responsible for translating an
|
40
|
-
* arbitrary URI into a DaffExternallyResolvableUrl with Magento environments.
|
41
|
-
*
|
42
|
-
* @inheritdoc
|
43
|
-
*/
|
44
|
-
class DaffExternalRouterMagentoDriver {
|
45
|
-
constructor(apollo) {
|
46
|
-
this.apollo = apollo;
|
47
|
-
}
|
48
|
-
resolve(url) {
|
49
|
-
return this.apollo
|
50
|
-
.query({
|
51
|
-
query: MagentoResolveUrlv241,
|
52
|
-
variables: {
|
53
|
-
url: daffUriTruncateQueryFragment(url),
|
54
|
-
},
|
55
|
-
})
|
56
|
-
.pipe(map(response => transformResolutionToResolvableUrlv241(response.data.urlResolver)));
|
57
|
-
}
|
58
|
-
}
|
59
|
-
/** @nocollapse */ DaffExternalRouterMagentoDriver.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffExternalRouterMagentoDriver, deps: [{ token: i1.Apollo }], target: i0.ɵɵFactoryTarget.Injectable });
|
60
|
-
/** @nocollapse */ DaffExternalRouterMagentoDriver.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffExternalRouterMagentoDriver, providedIn: 'root' });
|
61
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffExternalRouterMagentoDriver, decorators: [{
|
62
|
-
type: Injectable,
|
63
|
-
args: [{
|
64
|
-
providedIn: 'root',
|
65
|
-
}]
|
66
|
-
}], ctorParameters: function () { return [{ type: i1.Apollo }]; } });
|
67
|
-
|
68
|
-
/**
|
69
|
-
* The module used to configure the {@link DaffExternalRouterDriver} for usage with Magento.
|
70
|
-
*
|
71
|
-
* ```ts
|
72
|
-
* @NgModule({
|
73
|
-
* declarations: [],
|
74
|
-
* imports: [
|
75
|
-
* ...
|
76
|
-
* DaffExternalRouterDriverMagentoModule.forRoot()
|
77
|
-
* ],
|
78
|
-
* })
|
79
|
-
* export class AppModule{}
|
80
|
-
* ```
|
81
|
-
*
|
82
|
-
* Note that this package depends upon ApolloClient, as the Magento driver uses GraphQl to make it's API calls.
|
83
|
-
*/
|
84
|
-
class DaffExternalRouterDriverMagentoModule {
|
85
|
-
/**
|
86
|
-
* Configures the package for the root injector.
|
87
|
-
*/
|
88
|
-
static forRoot() {
|
89
|
-
return {
|
90
|
-
ngModule: DaffExternalRouterDriverMagentoModule,
|
91
|
-
providers: [
|
92
|
-
{
|
93
|
-
provide: DaffExternalRouterDriver,
|
94
|
-
useExisting: DaffExternalRouterMagentoDriver,
|
95
|
-
},
|
96
|
-
{
|
97
|
-
provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS,
|
98
|
-
useValue: DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME,
|
99
|
-
multi: true,
|
100
|
-
},
|
101
|
-
],
|
102
|
-
};
|
103
|
-
}
|
104
|
-
}
|
105
|
-
/** @nocollapse */ DaffExternalRouterDriverMagentoModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffExternalRouterDriverMagentoModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
106
|
-
/** @nocollapse */ DaffExternalRouterDriverMagentoModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: DaffExternalRouterDriverMagentoModule, imports: [CommonModule] });
|
107
|
-
/** @nocollapse */ DaffExternalRouterDriverMagentoModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffExternalRouterDriverMagentoModule, imports: [CommonModule] });
|
108
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffExternalRouterDriverMagentoModule, decorators: [{
|
109
|
-
type: NgModule,
|
110
|
-
args: [{
|
111
|
-
declarations: [],
|
112
|
-
imports: [CommonModule],
|
113
|
-
}]
|
114
|
-
}] });
|
115
|
-
|
116
|
-
/*
|
117
|
-
* Public API Surface of @daffodil/external-router/driver/magento/2-4-1
|
118
|
-
*/
|
119
|
-
|
120
|
-
/**
|
121
|
-
* Generated bundle index. Do not edit.
|
122
|
-
*/
|
123
|
-
|
124
|
-
export { DaffExternalRouterDriverMagentoModule, DaffExternalRouterMagentoDriver };
|
125
|
-
//# sourceMappingURL=daffodil-external-router-driver-magento-2.4.1.mjs.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"daffodil-external-router-driver-magento-2.4.1.mjs","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"],"names":[],"mappings":";;;;;;;;;;;AAEO,MAAM,mCAAmC,GAAG,uBAAuB,CAAC;AAE3E;;;AAGG;AACI,MAAM,qBAAqB,GAAG,GAAG,CAAA,CAAA;SAC/B,mCAAmC,CAAA;;;;;;;;CAQ3C;;ACNM,MAAM,sCAAsC,GAAG,CACpD,UAA8B,KACC;;AAAC,IAAA,QAAC,UAAU,GAAG;AAC9C,QAAA,EAAE,EAAE,CAAA,EAAA,GAAA,UAAU,CAAC,EAAE,MAAA,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s/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 private 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"],"names":[],"mappings":";;;;;;;;;;;AAEO,MAAM,mCAAmC,GAAG,uBAAuB,CAAC;AAE3E;;;AAGG;AACI,MAAM,qBAAqB,GAAG,GAAG,CAAA,CAAA;SAC/B,mCAAmC,CAAA;;;;;;;;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;AACrB,IAAA,IAAI,EAAE,kCAAkC,CAAC,UAAU,CAAC,YAAY,CAAC;AAClE,CAAA,GAAG,yCAAyC,CAAC;;ACL9C;;;;;AAKG;MAIU,+BAA+B,CAAA;AAE1C,IAAA,WAAA,CACU,MAAc,EAAA;AAAd,QAAA,IAAM,CAAA,MAAA,GAAN,MAAM,CAAQ;KACpB;AAEJ,IAAA,OAAO,CAAC,GAAW,EAAA;QACjB,OAAO,IAAI,CAAC,MAAM;AACf,aAAA,KAAK,CAA6B;AACnC,YAAA,KAAK,EAAE,qBAAqB;AAC5B,YAAA,SAAS,EAAE;gBACT,GAAG;AACJ,aAAA;SACF,CAAC;AACC,aAAA,IAAI,CAAC,GAAG,CAAC,QAAQ,IAAI,sCAAsC,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,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A,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,qCAAqC,YAFtC,YAAY,CAAA,EAAA,CAAA,CAAA;2FAEX,qCAAqC,EAAA,UAAA,EAAA,CAAA;kBAJjD,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,EAAE;oBAChB,OAAO,EAAE,CAAC,YAAY,CAAC;iBACxB,CAAA;;;AC/BD;;AAEG;;ACFH;;AAEG;;;;"}
|
@@ -1,143 +0,0 @@
|
|
1
|
-
import * as i0 from '@angular/core';
|
2
|
-
import { Injectable, NgModule } from '@angular/core';
|
3
|
-
import { map } from 'rxjs/operators';
|
4
|
-
import * as i1 from 'apollo-angular';
|
5
|
-
import { gql } from 'apollo-angular';
|
6
|
-
import { daffUriTruncateLeadingSlash, daffUriTruncateQueryFragment } from '@daffodil/core/routing';
|
7
|
-
import { DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION, DaffExternalRouterDriver } from '@daffodil/external-router/driver';
|
8
|
-
import { magentoTransformRedirectToHttpCode } from '@daffodil/external-router/driver/magento';
|
9
|
-
import { CommonModule } from '@angular/common';
|
10
|
-
import { DAFF_MAGENTO_CACHEABLE_OPERATIONS } from '@daffodil/driver/magento';
|
11
|
-
|
12
|
-
const DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME = 'MagentoResolveUrlv243';
|
13
|
-
/**
|
14
|
-
* This query retrieves a URL resolution from Magento and informs you about
|
15
|
-
* what type of route the URL is.
|
16
|
-
*/
|
17
|
-
const MagentoResolveUrlv243 = gql `
|
18
|
-
query ${DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME}($url: String!) {
|
19
|
-
route(url: $url) {
|
20
|
-
relative_url
|
21
|
-
redirect_code
|
22
|
-
type
|
23
|
-
... on CategoryInterface {
|
24
|
-
uid
|
25
|
-
name
|
26
|
-
meta_description
|
27
|
-
meta_title
|
28
|
-
canonical_url
|
29
|
-
}
|
30
|
-
... on ProductInterface {
|
31
|
-
uid
|
32
|
-
name
|
33
|
-
meta_description
|
34
|
-
meta_title
|
35
|
-
canonical_url
|
36
|
-
}
|
37
|
-
}
|
38
|
-
}
|
39
|
-
`;
|
40
|
-
|
41
|
-
const transformResolutionToResolvableUrlv243 = (resolution) => {
|
42
|
-
var _a, _b;
|
43
|
-
return (resolution ? {
|
44
|
-
id: resolution.uid,
|
45
|
-
url: daffUriTruncateLeadingSlash(daffUriTruncateQueryFragment(resolution.relative_url)),
|
46
|
-
type: resolution.type,
|
47
|
-
code: magentoTransformRedirectToHttpCode(resolution.redirect_code),
|
48
|
-
data: {
|
49
|
-
canonical_url: resolution.canonical_url,
|
50
|
-
title: (_b = (_a = resolution.meta_title) !== null && _a !== void 0 ? _a : resolution.name) !== null && _b !== void 0 ? _b : '',
|
51
|
-
meta_description: resolution.meta_description,
|
52
|
-
},
|
53
|
-
} : DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION);
|
54
|
-
};
|
55
|
-
|
56
|
-
/**
|
57
|
-
* The DaffExternalRouterMagentoDriver is responsible for translating an
|
58
|
-
* arbitrary URI into a DaffExternallyResolvableUrl with Magento environments.
|
59
|
-
*
|
60
|
-
* @inheritdoc
|
61
|
-
*/
|
62
|
-
class DaffExternalRouterMagentoDriver {
|
63
|
-
constructor(apollo) {
|
64
|
-
this.apollo = apollo;
|
65
|
-
}
|
66
|
-
resolve(url) {
|
67
|
-
return this.apollo
|
68
|
-
.query({
|
69
|
-
query: MagentoResolveUrlv243,
|
70
|
-
variables: {
|
71
|
-
url,
|
72
|
-
},
|
73
|
-
})
|
74
|
-
.pipe(map(response => transformResolutionToResolvableUrlv243(response.data.route)));
|
75
|
-
}
|
76
|
-
}
|
77
|
-
/** @nocollapse */ DaffExternalRouterMagentoDriver.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffExternalRouterMagentoDriver, deps: [{ token: i1.Apollo }], target: i0.ɵɵFactoryTarget.Injectable });
|
78
|
-
/** @nocollapse */ DaffExternalRouterMagentoDriver.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffExternalRouterMagentoDriver, providedIn: 'root' });
|
79
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffExternalRouterMagentoDriver, decorators: [{
|
80
|
-
type: Injectable,
|
81
|
-
args: [{
|
82
|
-
providedIn: 'root',
|
83
|
-
}]
|
84
|
-
}], ctorParameters: function () { return [{ type: i1.Apollo }]; } });
|
85
|
-
|
86
|
-
/**
|
87
|
-
* The module used to configure the {@link DaffExternalRouterDriver} for usage with Magento.
|
88
|
-
*
|
89
|
-
* ```ts
|
90
|
-
* @NgModule({
|
91
|
-
* declarations: [],
|
92
|
-
* imports: [
|
93
|
-
* ...
|
94
|
-
* DaffExternalRouterDriverMagentoModule.forRoot()
|
95
|
-
* ],
|
96
|
-
* })
|
97
|
-
* export class AppModule{}
|
98
|
-
* ```
|
99
|
-
*
|
100
|
-
* Note that this package depends upon ApolloClient, as the Magento driver uses GraphQl to make it's API calls.
|
101
|
-
*/
|
102
|
-
class DaffExternalRouterDriverMagentoModule {
|
103
|
-
/**
|
104
|
-
* Configures the package for the root injector.
|
105
|
-
*/
|
106
|
-
static forRoot() {
|
107
|
-
return {
|
108
|
-
ngModule: DaffExternalRouterDriverMagentoModule,
|
109
|
-
providers: [
|
110
|
-
{
|
111
|
-
provide: DaffExternalRouterDriver,
|
112
|
-
useExisting: DaffExternalRouterMagentoDriver,
|
113
|
-
},
|
114
|
-
{
|
115
|
-
provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS,
|
116
|
-
useValue: DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME,
|
117
|
-
multi: true,
|
118
|
-
},
|
119
|
-
],
|
120
|
-
};
|
121
|
-
}
|
122
|
-
}
|
123
|
-
/** @nocollapse */ DaffExternalRouterDriverMagentoModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffExternalRouterDriverMagentoModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
124
|
-
/** @nocollapse */ DaffExternalRouterDriverMagentoModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: DaffExternalRouterDriverMagentoModule, imports: [CommonModule] });
|
125
|
-
/** @nocollapse */ DaffExternalRouterDriverMagentoModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffExternalRouterDriverMagentoModule, imports: [CommonModule] });
|
126
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffExternalRouterDriverMagentoModule, decorators: [{
|
127
|
-
type: NgModule,
|
128
|
-
args: [{
|
129
|
-
declarations: [],
|
130
|
-
imports: [CommonModule],
|
131
|
-
}]
|
132
|
-
}] });
|
133
|
-
|
134
|
-
/*
|
135
|
-
* Public API Surface of @daffodil/external-router/driver/magento/2.4.3
|
136
|
-
*/
|
137
|
-
|
138
|
-
/**
|
139
|
-
* Generated bundle index. Do not edit.
|
140
|
-
*/
|
141
|
-
|
142
|
-
export { DaffExternalRouterDriverMagentoModule, DaffExternalRouterMagentoDriver };
|
143
|
-
//# sourceMappingURL=daffodil-external-router-driver-magento-2.4.3.mjs.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"daffodil-external-router-driver-magento-2.4.3.mjs","sources":["../../../libs/external-router/driver/magento/2.4.3/src/graphql/queries/resolve.ts","../../../libs/external-router/driver/magento/2.4.3/src/transforms/resolution-to-resolvable-url.ts","../../../libs/external-router/driver/magento/2.4.3/src/magento.service.ts","../../../libs/external-router/driver/magento/2.4.3/src/magento.module.ts","../../../libs/external-router/driver/magento/2.4.3/src/public_api.ts","../../../libs/external-router/driver/magento/2.4.3/src/daffodil-external-router-driver-magento-2.4.3.ts"],"sourcesContent":["import { gql } from 'apollo-angular';\n\nexport const DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME = 'MagentoResolveUrlv243';\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 MagentoResolveUrlv243 = gql`\n\tquery ${DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME}($url: String!) {\n\t\troute(url: $url) {\n\t\t\trelative_url\n\t\t\tredirect_code\n\t\t\ttype\n\t\t\t... on CategoryInterface {\n\t\t\t\tuid\n\t\t\t\tname\n\t\t\t\tmeta_description\n\t\t\t\tmeta_title\n\t\t\t\tcanonical_url\n\t\t\t}\n\t\t\t... on ProductInterface {\n\t\t\t\tuid\n\t\t\t\tname\n\t\t\t\tmeta_description\n\t\t\t\tmeta_title\n\t\t\t\tcanonical_url\n\t\t\t}\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 magentoTransformRedirectToHttpCode,\n MagentoRoute,\n} from '@daffodil/external-router/driver/magento';\n\n\nexport const transformResolutionToResolvableUrlv243 = (\n resolution: MagentoRoute,\n): DaffExternallyResolvableUrl => (resolution ? {\n id: resolution.uid,\n url: daffUriTruncateLeadingSlash(daffUriTruncateQueryFragment(resolution.relative_url)),\n type: resolution.type,\n code: magentoTransformRedirectToHttpCode(resolution.redirect_code),\n data: {\n canonical_url: resolution.canonical_url,\n title: resolution.meta_title ?? resolution.name ?? '',\n meta_description: resolution.meta_description,\n },\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 { MagentoRouteResponse } from '@daffodil/external-router/driver/magento';\n\nimport { MagentoResolveUrlv243 } from './graphql/queries/resolve';\nimport { transformResolutionToResolvableUrlv243 } 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 private apollo: Apollo,\n ) {}\n\n resolve(url: string): Observable<DaffExternallyResolvableUrl> {\n return this.apollo\n .query<MagentoRouteResponse>({\n query: MagentoResolveUrlv243,\n variables: {\n url,\n },\n })\n .pipe(map(response => transformResolutionToResolvableUrlv243(response.data.route)));\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';\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.3\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"],"names":[],"mappings":";;;;;;;;;;;AAEO,MAAM,mCAAmC,GAAG,uBAAuB,CAAC;AAE3E;;;AAGG;AACI,MAAM,qBAAqB,GAAG,GAAG,CAAA,CAAA;SAC/B,mCAAmC,CAAA;;;;;;;;;;;;;;;;;;;;;CAqB3C;;AClBM,MAAM,sCAAsC,GAAG,CACpD,UAAwB,KACO;;AAAC,IAAA,QAAC,UAAU,GAAG;QAC9C,EAAE,EAAE,UAAU,CAAC,GAAG;QAClB,GAAG,EAAE,2BAA2B,CAAC,4BAA4B,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;QACvF,IAAI,EAAE,UAAU,CAAC,IAAI;AACrB,QAAA,IAAI,EAAE,kCAAkC,CAAC,UAAU,CAAC,aAAa,CAAC;AAClE,QAAA,IAAI,EAAE;YACJ,aAAa,EAAE,UAAU,CAAC,aAAa;YACvC,KAAK,EAAE,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,UAAU,CAAC,UAAU,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAI,UAAU,CAAC,IAAI,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAI,EAAE;YACrD,gBAAgB,EAAE,UAAU,CAAC,gBAAgB;AAC9C,SAAA;AACF,KAAA,GAAG,yCAAyC,EA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C1C,oBAAA,QAAQ,EAAE,mCAAmC;AAC7C,oBAAA,KAAK,EAAE,IAAI;AACZ,iBAAA;AACF,aAAA;SACF,CAAC;KACH;;qJApBU,qCAAqC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAArC,mBAAA,qCAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,qCAAqC,YAFtC,YAAY,CAAA,EAAA,CAAA,CAAA;AAEX,mBAAA,qCAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,qCAAqC,YAFtC,YAAY,CAAA,EAAA,CAAA,CAAA;2FAEX,qCAAqC,EAAA,UAAA,EAAA,CAAA;kBAJjD,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,EAAE;oBAChB,OAAO,EAAE,CAAC,YAAY,CAAC;iBACxB,CAAA;;;AC/BD;;AAEG;;ACFH;;AAEG;;;;"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"daffodil-external-router-driver-magento.mjs","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 PRODUCT = 'PRODUCT',\n CATEGORY = 'CATEGORY',\n CMS_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":"AAAY,IAAA,gCAIX;AAJD,CAAA,UAAY,+BAA+B,EAAA;AACzC,IAAA,+BAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnB,IAAA,+BAAA,CAAA,UAAA,CAAA,GAAA,UAAqB,CAAA;AACrB,IAAA,+BAAA,CAAA,UAAA,CAAA,GAAA,UAAqB,CAAA;AACvB,CAAC,EAJW,+BAA+B,KAA/B,+BAA+B,GAI1C,EAAA,CAAA,CAAA;;ACJD;;AAEG;MACU,kCAAkC,GAAG,CAAC,IAAY,KAC7D,IAAI,KAAK,CAAC,GAAG,GAAG,GAAG;;ACJrB;;AAEG;;ACFH;;AAEG;;;;"}
|