@daffodil/external-router 0.78.0 → 0.80.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/README.md +116 -7
- package/config.d.ts +1 -10
- package/driver/in-memory/config.d.ts +1 -7
- package/driver/in-memory/in-memory.module.d.ts +2 -0
- package/driver/in-memory/provider.d.ts +6 -0
- package/driver/in-memory/public_api.d.ts +1 -0
- package/driver/interfaces/external-router-driver.interface.d.ts +2 -6
- package/driver/magento/2.4.3/magento.service.d.ts +2 -1
- package/driver/magento/2.4.3/provider.d.ts +5 -0
- package/driver/magento/2.4.3/public_api.d.ts +1 -0
- package/driver/magento/2.4.3/transforms/schema/category/category.d.ts +2 -0
- package/driver/magento/2.4.3/transforms/schema/clientify-url-path.d.ts +1 -0
- package/driver/magento/2.4.3/transforms/schema/product/base.d.ts +2 -0
- package/driver/magento/2.4.3/transforms/schema/product/bundle.d.ts +2 -0
- package/driver/magento/2.4.3/transforms/schema/product/configurable.d.ts +2 -0
- package/driver/magento/2.4.3/transforms/schema/product/product.d.ts +5 -0
- package/driver/magento/2.4.3/transforms/schema/product/simple.d.ts +2 -0
- package/driver/magento/2.4.3/transforms/schema/rescale-rating.d.ts +5 -0
- package/driver/magento/2.4.3/transforms/schema/transform-schema.d.ts +2 -0
- package/driver/magento/2.4.3/transforms/transform-client-urls.d.ts +2 -0
- package/driver/magento/model/category-route-product.d.ts +77 -0
- package/driver/magento/model/category-route.d.ts +41 -0
- package/driver/magento/model/product-route.d.ts +85 -0
- package/driver/magento/model/public_api.d.ts +2 -0
- package/driver/magento/model/routable.d.ts +14 -0
- package/driver/magento/model/route.d.ts +4 -34
- package/driver/public_api.d.ts +1 -1
- package/driver/testing/config.d.ts +3 -9
- package/driver/testing/provider.d.ts +6 -0
- package/driver/testing/public_api.d.ts +1 -0
- package/esm2022/config.mjs +8 -7
- package/esm2022/driver/in-memory/config.mjs +8 -6
- package/esm2022/driver/in-memory/in-memory.module.mjs +8 -15
- package/esm2022/driver/in-memory/provider.mjs +12 -0
- package/esm2022/driver/in-memory/public_api.mjs +2 -1
- package/esm2022/driver/interfaces/external-router-driver.interface.mjs +8 -3
- package/esm2022/driver/magento/2.4.1/magento.module.mjs +5 -12
- package/esm2022/driver/magento/2.4.2/magento.module.mjs +5 -12
- package/esm2022/driver/magento/2.4.3/graphql/queries/resolve.mjs +66 -2
- package/esm2022/driver/magento/2.4.3/magento.module.mjs +5 -12
- package/esm2022/driver/magento/2.4.3/magento.service.mjs +12 -6
- package/esm2022/driver/magento/2.4.3/provider.mjs +13 -0
- package/esm2022/driver/magento/2.4.3/public_api.mjs +2 -1
- package/esm2022/driver/magento/2.4.3/transforms/resolution-to-resolvable-url.mjs +7 -3
- package/esm2022/driver/magento/2.4.3/transforms/schema/category/category.mjs +15 -0
- package/esm2022/driver/magento/2.4.3/transforms/schema/clientify-url-path.mjs +2 -0
- package/esm2022/driver/magento/2.4.3/transforms/schema/product/base.mjs +16 -0
- package/esm2022/driver/magento/2.4.3/transforms/schema/product/bundle.mjs +11 -0
- package/esm2022/driver/magento/2.4.3/transforms/schema/product/configurable.mjs +11 -0
- package/esm2022/driver/magento/2.4.3/transforms/schema/product/product.mjs +20 -0
- package/esm2022/driver/magento/2.4.3/transforms/schema/product/simple.mjs +25 -0
- package/esm2022/driver/magento/2.4.3/transforms/schema/rescale-rating.mjs +6 -0
- package/esm2022/driver/magento/2.4.3/transforms/schema/transform-schema.mjs +13 -0
- package/esm2022/driver/magento/2.4.3/transforms/transform-client-urls.mjs +28 -0
- package/esm2022/driver/magento/model/category-route-product.mjs +2 -0
- package/esm2022/driver/magento/model/category-route.mjs +2 -0
- package/esm2022/driver/magento/model/product-route.mjs +2 -0
- package/esm2022/driver/magento/model/public_api.mjs +1 -1
- package/esm2022/driver/magento/model/routable.mjs +2 -0
- package/esm2022/driver/magento/model/route.mjs +1 -1
- package/esm2022/driver/public_api.mjs +2 -2
- package/esm2022/driver/testing/config.mjs +8 -6
- package/esm2022/driver/testing/provider.mjs +12 -0
- package/esm2022/driver/testing/public_api.mjs +2 -1
- package/esm2022/driver/testing/testing.module.mjs +5 -11
- package/esm2022/driver/testing/testing.service.mjs +13 -11
- package/esm2022/model/public_api.mjs +1 -1
- package/esm2022/model/route-data.mjs +1 -1
- package/esm2022/model/route-with-seo-data.mjs +1 -1
- package/esm2022/provide-external-router.mjs +6 -0
- package/esm2022/public_api.mjs +2 -10
- package/esm2022/routing/guard/external-matcher-type.guard.mjs +43 -0
- package/esm2022/routing/helper/convert-to-path.mjs +7 -0
- package/esm2022/routing/public_api.mjs +2 -2
- package/fesm2022/daffodil-external-router-driver-in-memory.mjs +22 -18
- package/fesm2022/daffodil-external-router-driver-in-memory.mjs.map +1 -1
- package/fesm2022/daffodil-external-router-driver-magento-2.4.1.mjs +4 -11
- package/fesm2022/daffodil-external-router-driver-magento-2.4.1.mjs.map +1 -1
- package/fesm2022/daffodil-external-router-driver-magento-2.4.2.mjs +4 -11
- package/fesm2022/daffodil-external-router-driver-magento-2.4.2.mjs.map +1 -1
- package/fesm2022/daffodil-external-router-driver-magento-2.4.3.mjs +228 -21
- package/fesm2022/daffodil-external-router-driver-magento-2.4.3.mjs.map +1 -1
- package/fesm2022/daffodil-external-router-driver-testing.mjs +31 -25
- package/fesm2022/daffodil-external-router-driver-testing.mjs.map +1 -1
- package/fesm2022/daffodil-external-router-driver.mjs +8 -3
- package/fesm2022/daffodil-external-router-driver.mjs.map +1 -1
- package/fesm2022/daffodil-external-router-routing.mjs +40 -66
- package/fesm2022/daffodil-external-router-routing.mjs.map +1 -1
- package/fesm2022/daffodil-external-router.mjs +10 -282
- package/fesm2022/daffodil-external-router.mjs.map +1 -1
- package/model/public_api.d.ts +2 -5
- package/model/route-data.d.ts +13 -0
- package/model/route-with-seo-data.d.ts +3 -4
- package/package.json +1 -1
- package/provide-external-router.d.ts +3 -0
- package/public_api.d.ts +1 -9
- package/routing/guard/external-matcher-type.guard.d.ts +10 -0
- package/routing/helper/convert-to-path.d.ts +7 -0
- package/routing/public_api.d.ts +1 -1
- package/errors/no-wildcard.d.ts +0 -9
- package/errors/unknown-type.d.ts +0 -9
- package/esm2022/errors/no-wildcard.mjs +0 -12
- package/esm2022/errors/unknown-type.mjs +0 -12
- package/esm2022/external-router.module.mjs +0 -31
- package/esm2022/model/insertion-strategy.type.mjs +0 -2
- package/esm2022/model/route-info.mjs +0 -2
- package/esm2022/model/route-with-data-path.mjs +0 -2
- package/esm2022/model/route-with-type.mjs +0 -2
- package/esm2022/model/route-without-path.mjs +0 -2
- package/esm2022/model/type-route-pair.mjs +0 -2
- package/esm2022/router/router.service.mjs +0 -43
- package/esm2022/router/strategies/insert-data-path.mjs +0 -84
- package/esm2022/router/strategies/insert-route-before-wildcard.mjs +0 -17
- package/esm2022/router/url-matcher/data-path-matcher.mjs +0 -31
- package/esm2022/routing/guard/existence.guard.mjs +0 -77
- package/esm2022/token/type-resolvable-routes.token.mjs +0 -29
- package/esm2022/transform/resolved-route-to-route.mjs +0 -24
- package/esm2022/util/extract-daff-path-data.mjs +0 -9
- package/external-router.module.d.ts +0 -15
- package/model/insertion-strategy.type.d.ts +0 -8
- package/model/route-info.d.ts +0 -9
- package/model/route-with-data-path.d.ts +0 -14
- package/model/route-with-type.d.ts +0 -12
- package/model/route-without-path.d.ts +0 -7
- package/model/type-route-pair.d.ts +0 -26
- package/router/router.service.d.ts +0 -15
- package/router/strategies/insert-data-path.d.ts +0 -40
- package/router/strategies/insert-route-before-wildcard.d.ts +0 -6
- package/router/url-matcher/data-path-matcher.d.ts +0 -20
- package/routing/guard/existence.guard.d.ts +0 -22
- package/token/type-resolvable-routes.token.d.ts +0 -14
- package/transform/resolved-route-to-route.d.ts +0 -7
- package/util/extract-daff-path-data.d.ts +0 -6
package/README.md
CHANGED
@@ -1,25 +1,134 @@
|
|
1
1
|
# @daffodil/external-router
|
2
|
-
`@daffodil/external-router` extends `@angular/router` and allows you to render routes defined in external systems like Wordpress, Magento, Contentful, etc, as if you had defined the routes statically in your Angular `Routes`.
|
3
2
|
|
4
|
-
|
5
|
-
|
3
|
+
`@daffodil/external-router` extends `@angular/router` and allows you to render routes defined in external systems like Wordpress, Magento, Contentful, etc, as if you had defined the routes statically in your Angular `Routes`. This is useful when generating user-friendly routes in external applications and resolving them by their user-friendly URI, such as `/sweatshirts` instead of `/category/6` or `category/sweatshirts.`
|
4
|
+
|
5
|
+
<!-- omit in toc -->
|
6
|
+
|
7
|
+
## Table of Contents
|
8
|
+
|
9
|
+
- [Installation](#installation)
|
10
|
+
- [Usage](#usage)
|
11
|
+
- [Drivers](#drivers)
|
12
|
+
- [Configuration](/libs/external-router/guides/configuration.md)
|
13
|
+
- [Testing](/libs/external-router/guides/testing.md)
|
6
14
|
|
7
15
|
## Installation
|
16
|
+
|
8
17
|
To install `@daffodil/external-router`, use the following commands in your terminal.
|
9
18
|
|
10
19
|
Install with npm:
|
20
|
+
|
11
21
|
```bash
|
12
22
|
npm install @daffodil/external-router --save
|
13
23
|
```
|
14
24
|
|
15
25
|
Install with yarn:
|
26
|
+
|
16
27
|
```bash
|
17
28
|
yarn add @daffodil/external-router
|
18
29
|
```
|
19
30
|
|
20
31
|
## Usage
|
21
|
-
As an example scenario, you could:
|
22
32
|
|
23
|
-
|
24
|
-
|
25
|
-
|
33
|
+
To get started with `@daffodil/external-router`, follow these steps:
|
34
|
+
|
35
|
+
1. Add `provideExternalRouter` to the `providers` of your `appConfig` or `AppModule` :
|
36
|
+
|
37
|
+
```ts
|
38
|
+
import { ApplicationConfig } from '@angular/core';
|
39
|
+
...
|
40
|
+
import { provideExternalRouter } from '@daffodil/external-router';
|
41
|
+
|
42
|
+
export const appConfig: ApplicationConfig = {
|
43
|
+
providers: [
|
44
|
+
provideRouter(routes),
|
45
|
+
provideClientHydration(),
|
46
|
+
provideExternalRouter(),
|
47
|
+
],
|
48
|
+
};
|
49
|
+
```
|
50
|
+
|
51
|
+
2. Configure your [driver of choice](#drivers) (this example uses the [testing driver](/libs/external-router/guides/driver/testing)):
|
52
|
+
|
53
|
+
```ts
|
54
|
+
import { ApplicationConfig, importProvidersFrom } from '@angular/core';
|
55
|
+
import { DaffExternalRouterDriverTestingModule } from '@daffodil/external-router/driver/testing';
|
56
|
+
|
57
|
+
export const appConfig: ApplicationConfig = {
|
58
|
+
providers: [
|
59
|
+
provideRouter(routes),
|
60
|
+
provideClientHydration(),
|
61
|
+
provideExternalRouter(),
|
62
|
+
provideDaffExternalRouterTestingDriver({
|
63
|
+
'test-page': 'TEST_TYPE',
|
64
|
+
'other-page': 'OTHER_TYPE',
|
65
|
+
'another-page': 'OTHER_TYPE',
|
66
|
+
}),
|
67
|
+
],
|
68
|
+
};
|
69
|
+
```
|
70
|
+
|
71
|
+
3. Configure your routes to use the `daffExternalMatcherTypeGuard`
|
72
|
+
|
73
|
+
```ts
|
74
|
+
import { Routes } from '@angular/router';
|
75
|
+
|
76
|
+
import { daffExternalMatcherTypeGuard } from '@daffodil/external-router/routing';
|
77
|
+
|
78
|
+
export const routes: Routes = [
|
79
|
+
{
|
80
|
+
path: '',
|
81
|
+
pathMatch: 'full',
|
82
|
+
component: HomeComponent,
|
83
|
+
},
|
84
|
+
{
|
85
|
+
path: '**',
|
86
|
+
component: TestComponent,
|
87
|
+
canMatch: [daffExternalMatcherTypeGuard('TEST_TYPE')],
|
88
|
+
},
|
89
|
+
{
|
90
|
+
path: '**',
|
91
|
+
component: OtherTypeComponent,
|
92
|
+
canMatch: [daffExternalMatcherTypeGuard('OTHER_TYPE')],
|
93
|
+
},
|
94
|
+
];
|
95
|
+
```
|
96
|
+
|
97
|
+
> You can use whatever type values you would like, just ensure they match the types set in `provideDaffExternalRouterTestingDriver`.
|
98
|
+
> These components are also just examples, you can replace them with whatever components you want.
|
99
|
+
|
100
|
+
4. Add links to your AppComponent:
|
101
|
+
|
102
|
+
```ts
|
103
|
+
@Component({
|
104
|
+
selector: 'app-root',
|
105
|
+
standalone: true,
|
106
|
+
imports: [RouterOutlet, RouterLink],
|
107
|
+
templateUrl: './app.component.html',
|
108
|
+
styleUrl: './app.component.scss',
|
109
|
+
})
|
110
|
+
export class AppComponent {}
|
111
|
+
```
|
112
|
+
|
113
|
+
```html
|
114
|
+
<ul>
|
115
|
+
<li><a routerLink="/">Home</a></li>
|
116
|
+
<li><a routerLink="/test-page">Test</a></li>
|
117
|
+
<li><a routerLink="/other-page">Other Type</a></li>
|
118
|
+
<li><a routerLink="/another-page">Other Type (another)</a></li>
|
119
|
+
</ul>
|
120
|
+
<router-outlet></router-outlet>
|
121
|
+
```
|
122
|
+
|
123
|
+
5. Serve your app.
|
124
|
+
|
125
|
+
You can now navigate to "/test-page", "/other-page", and "/another-page" as if it was defined in your Angular routes.
|
126
|
+
|
127
|
+
## Drivers
|
128
|
+
|
129
|
+
We provide a driver interface along with a few pre-fabricated drivers for you to simply drop into your app and get started with external route resolution.
|
130
|
+
|
131
|
+
- [Testing](/libs/external-router/guides/driver/testing)
|
132
|
+
- [In-Memory](/libs/external-router/guides/driver/in-memory)
|
133
|
+
- [Magento](/libs/external-router/guides/driver/magento)
|
134
|
+
- [BYOD (Bring Your Own Driver)](/libs/external-router/guides/driver/custom)
|
package/config.d.ts
CHANGED
@@ -1,10 +1,5 @@
|
|
1
|
-
import { InjectionToken } from '@angular/core';
|
2
1
|
export declare const daffExternalRouterConfigurationDefault: DaffExternalRouterConfiguration;
|
3
|
-
|
4
|
-
* The token holding the runtime configuration for the behavior of the
|
5
|
-
* `@daffodil/external-router` package.
|
6
|
-
*/
|
7
|
-
export declare const DAFF_EXTERNAL_ROUTER_CONFIG: InjectionToken<DaffExternalRouterConfiguration>;
|
2
|
+
export declare const DAFF_EXTERNAL_ROUTER_CONFIG: import("@angular/core").InjectionToken<DaffExternalRouterConfiguration>, provideDaffExternalRouterConfig: <R extends DaffExternalRouterConfiguration = DaffExternalRouterConfiguration>(config: Partial<R> | import("@angular/core").InjectionToken<Partial<R>>) => import("@angular/core").FactoryProvider;
|
8
3
|
/**
|
9
4
|
* The configuration object for the external router package.
|
10
5
|
*/
|
@@ -13,8 +8,4 @@ export interface DaffExternalRouterConfiguration {
|
|
13
8
|
* The path to redirect to when external route resolution fails.
|
14
9
|
*/
|
15
10
|
failedResolutionPath: string;
|
16
|
-
/**
|
17
|
-
* The path to redirect to when the requested URL is not found.
|
18
|
-
*/
|
19
|
-
notFoundResolutionPath: string;
|
20
11
|
}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import { InjectionToken } from '@angular/core';
|
2
1
|
import { DaffExternallyResolvableUrl } from '@daffodil/external-router';
|
3
2
|
/**
|
4
3
|
* A lookup for a URL.
|
@@ -12,9 +11,4 @@ export type DaffExternalRouterDriverInMemoryResolver = (url: string) => DaffExte
|
|
12
11
|
export interface DaffExternalRouterDriverInMemoryConfig {
|
13
12
|
resolver: DaffExternalRouterDriverInMemoryResolver;
|
14
13
|
}
|
15
|
-
|
16
|
-
* The token used by Daffodil to hold the driver's configuration.
|
17
|
-
*
|
18
|
-
* @docs-private
|
19
|
-
*/
|
20
|
-
export declare const DAFF_EXTERNAL_ROUTER_DRIVER_IN_MEMORY_CONFIG: InjectionToken<DaffExternalRouterDriverInMemoryConfig>;
|
14
|
+
export declare const DAFF_EXTERNAL_ROUTER_DRIVER_IN_MEMORY_CONFIG: import("@angular/core").InjectionToken<DaffExternalRouterDriverInMemoryConfig>, provideDaffExternalRouterDriverInMemoryConfig: <R extends DaffExternalRouterDriverInMemoryConfig = DaffExternalRouterDriverInMemoryConfig>(config: Partial<R> | import("@angular/core").InjectionToken<Partial<R>>) => import("@angular/core").FactoryProvider;
|
@@ -5,6 +5,8 @@ import * as i1 from "@angular/common";
|
|
5
5
|
/**
|
6
6
|
* The `DaffExternalRouterDriverInMemoryModule` is an importable NgModule that can
|
7
7
|
* be used to configure the {@link DaffExternalRouterInMemoryDriver}.
|
8
|
+
*
|
9
|
+
* @deprecated See {@link provideDaffExternalRouterInMemoryDriver } Deprecated in version 0.79.0. Will be removed in version 0.82.0.
|
8
10
|
*/
|
9
11
|
export declare class DaffExternalRouterDriverInMemoryModule {
|
10
12
|
static forRoot(config: DaffExternalRouterDriverInMemoryConfig | InjectionToken<DaffExternalRouterDriverInMemoryConfig>): ModuleWithProviders<DaffExternalRouterDriverInMemoryModule>;
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { EnvironmentProviders, InjectionToken } from '@angular/core';
|
2
|
+
import { DaffExternalRouterDriverInMemoryConfig } from './config';
|
3
|
+
/**
|
4
|
+
* Provides an in-memory implementation of {@link DaffExternalRouterDriver}
|
5
|
+
*/
|
6
|
+
export declare const provideDaffExternalRouterInMemoryDriver: (config?: DaffExternalRouterDriverInMemoryConfig | InjectionToken<DaffExternalRouterDriverInMemoryConfig>) => EnvironmentProviders;
|
@@ -1,3 +1,4 @@
|
|
1
1
|
export { DaffExternalRouterInMemoryDriver } from './in-memory.service';
|
2
2
|
export { DaffExternalRouterDriverInMemoryModule } from './in-memory.module';
|
3
3
|
export { DaffExternalRouterDriverInMemoryConfig, DaffExternalRouterDriverInMemoryResolver, } from './config';
|
4
|
+
export { provideDaffExternalRouterInMemoryDriver } from './provider';
|
@@ -1,12 +1,8 @@
|
|
1
|
-
import { InjectionToken } from '@angular/core';
|
2
1
|
import { Observable } from 'rxjs';
|
3
2
|
import { DaffExternallyResolvableUrl } from '@daffodil/external-router';
|
3
|
+
export declare const DaffExternalRouterDriver: import("@angular/core").InjectionToken<DaffExternalRouterDriverInterface>, provideDaffExternalRouterDriver: <R extends DaffExternalRouterDriverInterface = DaffExternalRouterDriverInterface>(klass: import("@angular/core").Type<R>) => import("@angular/core").ExistingProvider;
|
4
4
|
/**
|
5
|
-
* The
|
6
|
-
*/
|
7
|
-
export declare const DaffExternalRouterDriver: InjectionToken<DaffExternalRouterDriverInterface>;
|
8
|
-
/**
|
9
|
-
* The interface for a @daffodil/external-router driver.
|
5
|
+
* The interface for a `@daffodil/external-router` driver.
|
10
6
|
*
|
11
7
|
* This driver is responsible for translating a URL into a Route consumable by
|
12
8
|
* Daffodil.
|
@@ -11,7 +11,8 @@ import * as i0 from "@angular/core";
|
|
11
11
|
*/
|
12
12
|
export declare class DaffExternalRouterMagentoDriver implements DaffExternalRouterDriverInterface {
|
13
13
|
private apollo;
|
14
|
-
|
14
|
+
private document;
|
15
|
+
constructor(apollo: Apollo, document: Document);
|
15
16
|
resolve(url: string): Observable<DaffExternallyResolvableUrl>;
|
16
17
|
static ɵfac: i0.ɵɵFactoryDeclaration<DaffExternalRouterMagentoDriver, never>;
|
17
18
|
static ɵprov: i0.ɵɵInjectableDeclaration<DaffExternalRouterMagentoDriver>;
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const clientifyUrlPath: <T extends string | null>(path: T, domain: string) => string;
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { MagentoProductRoute } from '@daffodil/external-router/driver/magento';
|
2
|
+
/**
|
3
|
+
* Computes supplementary SEO schema for Magento product routes.
|
4
|
+
*/
|
5
|
+
export declare const transformMagentoProductSchema: (resolution: MagentoProductRoute) => Record<string, unknown>;
|
@@ -0,0 +1,77 @@
|
|
1
|
+
export interface MagentoCategoryRouteProduct {
|
2
|
+
/**
|
3
|
+
* The relative path for the route.
|
4
|
+
*/
|
5
|
+
relative_url: string;
|
6
|
+
/**
|
7
|
+
* The type of route, typically PRODUCT, CATEGORY or CMS_PAGE
|
8
|
+
*/
|
9
|
+
type: 'PRODUCT';
|
10
|
+
/**
|
11
|
+
* The HTTP code for the page.
|
12
|
+
*/
|
13
|
+
redirect_code: number;
|
14
|
+
/**
|
15
|
+
* In v2.4.3 this became the standard field across types
|
16
|
+
*/
|
17
|
+
uid: string;
|
18
|
+
/**
|
19
|
+
* The canonical url of the route.
|
20
|
+
*/
|
21
|
+
canonical_url: string | null;
|
22
|
+
/**
|
23
|
+
* The name of the route
|
24
|
+
*/
|
25
|
+
name: string | null;
|
26
|
+
/**
|
27
|
+
* The title of the route
|
28
|
+
*/
|
29
|
+
meta_title: string | null;
|
30
|
+
/**
|
31
|
+
* The sku of a product.
|
32
|
+
*/
|
33
|
+
sku: string;
|
34
|
+
/**
|
35
|
+
* The number of reviews of a product.
|
36
|
+
*/
|
37
|
+
review_count: number;
|
38
|
+
/**
|
39
|
+
* The rating of a product.
|
40
|
+
*/
|
41
|
+
rating_summary: number;
|
42
|
+
/**
|
43
|
+
* The images of a product.
|
44
|
+
*/
|
45
|
+
image: {
|
46
|
+
url: string;
|
47
|
+
};
|
48
|
+
/**
|
49
|
+
* The price of the item.
|
50
|
+
*/
|
51
|
+
price_range: {
|
52
|
+
maximum_price: {
|
53
|
+
final_price: {
|
54
|
+
currency: string;
|
55
|
+
value: number;
|
56
|
+
};
|
57
|
+
regular_price: {
|
58
|
+
currency: string;
|
59
|
+
value: number;
|
60
|
+
};
|
61
|
+
};
|
62
|
+
minimum_price: {
|
63
|
+
final_price: {
|
64
|
+
currency: string;
|
65
|
+
value: number;
|
66
|
+
};
|
67
|
+
regular_price: {
|
68
|
+
currency: string;
|
69
|
+
value: number;
|
70
|
+
};
|
71
|
+
};
|
72
|
+
};
|
73
|
+
/**
|
74
|
+
* The type of route.
|
75
|
+
*/
|
76
|
+
__typename: string;
|
77
|
+
}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import { MagentoCategoryRouteProduct } from './category-route-product';
|
2
|
+
export interface MagentoCategoryRoute {
|
3
|
+
/**
|
4
|
+
* The relative path for the route.
|
5
|
+
*/
|
6
|
+
relative_url: string;
|
7
|
+
/**
|
8
|
+
* The type of route, typically PRODUCT, CATEGORY or CMS_PAGE
|
9
|
+
*/
|
10
|
+
type: 'CATEGORY';
|
11
|
+
/**
|
12
|
+
* The HTTP code for the page.
|
13
|
+
*/
|
14
|
+
redirect_code: number;
|
15
|
+
/**
|
16
|
+
* In v2.4.3 this became the standard field across types
|
17
|
+
*/
|
18
|
+
uid?: string;
|
19
|
+
/**
|
20
|
+
* The canonical url of the route.
|
21
|
+
*/
|
22
|
+
canonical_url?: string;
|
23
|
+
/**
|
24
|
+
* The meta description of the route
|
25
|
+
*/
|
26
|
+
meta_description?: string;
|
27
|
+
/**
|
28
|
+
* The name of the route
|
29
|
+
*/
|
30
|
+
name?: string;
|
31
|
+
/**
|
32
|
+
* The title of the route
|
33
|
+
*/
|
34
|
+
meta_title?: string;
|
35
|
+
/**
|
36
|
+
* The list of items in the category.
|
37
|
+
*/
|
38
|
+
products: {
|
39
|
+
items: MagentoCategoryRouteProduct[];
|
40
|
+
};
|
41
|
+
}
|
@@ -0,0 +1,85 @@
|
|
1
|
+
export interface MagentoProductRoute {
|
2
|
+
/**
|
3
|
+
* The relative path for the route.
|
4
|
+
*/
|
5
|
+
relative_url: string;
|
6
|
+
/**
|
7
|
+
* The type of route, typically PRODUCT, CATEGORY or CMS_PAGE
|
8
|
+
*/
|
9
|
+
type: 'PRODUCT';
|
10
|
+
/**
|
11
|
+
* The HTTP code for the page.
|
12
|
+
*/
|
13
|
+
redirect_code: number;
|
14
|
+
/**
|
15
|
+
* In v2.4.3 this became the standard field across types
|
16
|
+
*/
|
17
|
+
uid: string;
|
18
|
+
/**
|
19
|
+
* The canonical url of the route.
|
20
|
+
*/
|
21
|
+
canonical_url: string | null;
|
22
|
+
/**
|
23
|
+
* The meta description of the route
|
24
|
+
*/
|
25
|
+
meta_description: string | null;
|
26
|
+
/**
|
27
|
+
* The name of the route
|
28
|
+
*/
|
29
|
+
name: string;
|
30
|
+
/**
|
31
|
+
* The title of the route
|
32
|
+
*/
|
33
|
+
meta_title: string | null;
|
34
|
+
/**
|
35
|
+
* The sku of a product.
|
36
|
+
*/
|
37
|
+
sku: string;
|
38
|
+
/**
|
39
|
+
* The number of reviews of a product.
|
40
|
+
*/
|
41
|
+
review_count: number | null;
|
42
|
+
/**
|
43
|
+
* The rating of a product.
|
44
|
+
*/
|
45
|
+
rating_summary: number | null;
|
46
|
+
/**
|
47
|
+
* The images of a product.
|
48
|
+
*/
|
49
|
+
image?: {
|
50
|
+
url: string;
|
51
|
+
};
|
52
|
+
/**
|
53
|
+
* The type of route.
|
54
|
+
*/
|
55
|
+
__typename: string;
|
56
|
+
/**
|
57
|
+
* The price of the item.
|
58
|
+
*/
|
59
|
+
price_range: {
|
60
|
+
maximum_price: {
|
61
|
+
final_price: {
|
62
|
+
currency: string;
|
63
|
+
value: number;
|
64
|
+
};
|
65
|
+
regular_price: {
|
66
|
+
currency: string;
|
67
|
+
value: number;
|
68
|
+
};
|
69
|
+
};
|
70
|
+
minimum_price: {
|
71
|
+
final_price: {
|
72
|
+
currency: string;
|
73
|
+
value: number;
|
74
|
+
};
|
75
|
+
regular_price: {
|
76
|
+
currency: string;
|
77
|
+
value: number;
|
78
|
+
};
|
79
|
+
};
|
80
|
+
};
|
81
|
+
/**
|
82
|
+
* The stock status of a product.
|
83
|
+
*/
|
84
|
+
stock_status: 'IN_STOCK' | 'OUT_OF_STOCK';
|
85
|
+
}
|
@@ -3,3 +3,5 @@ export { MagentoUrlRewriteEntityTypeEnum } from './resolution-types';
|
|
3
3
|
export { MagentoUrlResolverResponse } from './url-resolver-response';
|
4
4
|
export { MagentoRoute } from './route';
|
5
5
|
export { MagentoRouteResponse } from './route-response';
|
6
|
+
export { MagentoProductRoute } from './product-route';
|
7
|
+
export { MagentoCategoryRoute } from './category-route';
|
@@ -0,0 +1,14 @@
|
|
1
|
+
export interface MagentoRoutable {
|
2
|
+
/**
|
3
|
+
* The relative path for the route.
|
4
|
+
*/
|
5
|
+
relative_url: string;
|
6
|
+
/**
|
7
|
+
* The type of route, typically PRODUCT, CATEGORY or CMS_PAGE
|
8
|
+
*/
|
9
|
+
type: 'UNKNOWN' | null;
|
10
|
+
/**
|
11
|
+
* The HTTP code for the page.
|
12
|
+
*/
|
13
|
+
redirect_code: number;
|
14
|
+
}
|
@@ -1,34 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
relative_url: string;
|
6
|
-
/**
|
7
|
-
* The type of route, typically PRODUCT, CATEGORY or CMS_PAGE
|
8
|
-
*/
|
9
|
-
type: string;
|
10
|
-
/**
|
11
|
-
* The HTTP code for the page.
|
12
|
-
*/
|
13
|
-
redirect_code: number;
|
14
|
-
/**
|
15
|
-
* In v2.4.3 this became the standard field across types
|
16
|
-
*/
|
17
|
-
uid?: string;
|
18
|
-
/**
|
19
|
-
* The canonical url of the route.
|
20
|
-
*/
|
21
|
-
canonical_url?: string;
|
22
|
-
/**
|
23
|
-
* The meta description of the route
|
24
|
-
*/
|
25
|
-
meta_description?: string;
|
26
|
-
/**
|
27
|
-
* The name of the route
|
28
|
-
*/
|
29
|
-
name?: string;
|
30
|
-
/**
|
31
|
-
* The title of the route
|
32
|
-
*/
|
33
|
-
meta_title?: string;
|
34
|
-
}
|
1
|
+
import { MagentoCategoryRoute } from './category-route';
|
2
|
+
import { MagentoProductRoute } from './product-route';
|
3
|
+
import { MagentoRoutable } from './routable';
|
4
|
+
export type MagentoRoute = MagentoRoutable | MagentoProductRoute | MagentoCategoryRoute;
|
package/driver/public_api.d.ts
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
export { DaffExternalRouterDriverInterface, DaffExternalRouterDriver, } from './interfaces/external-router-driver.interface';
|
1
|
+
export { DaffExternalRouterDriverInterface, DaffExternalRouterDriver, provideDaffExternalRouterDriver, } from './interfaces/external-router-driver.interface';
|
2
2
|
export { DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION } from './not-found-resolution';
|
@@ -1,16 +1,10 @@
|
|
1
|
-
import {
|
2
|
-
import { DaffExternalRouteType } from '@daffodil/external-router';
|
1
|
+
import { DaffExternallyResolvableUrl, DaffExternalRouteType } from '@daffodil/external-router';
|
3
2
|
/**
|
4
3
|
* The configuration for the testing driver. It is a dictionary of "url": "type",
|
5
4
|
* pairs, where the URL is a URL-safe routeable path, e.g. "sweatshirts" or "t-shirts"
|
6
5
|
* and the type is a known type to your application, e.g. "CATEGORY".
|
7
6
|
*/
|
8
7
|
export interface DaffExternalRouterDriverTestingConfig {
|
9
|
-
[url: string]: DaffExternalRouteType;
|
8
|
+
[url: string]: DaffExternalRouteType | DaffExternallyResolvableUrl;
|
10
9
|
}
|
11
|
-
|
12
|
-
* The token used by Daffodil to hold the driver's configuration.
|
13
|
-
*
|
14
|
-
* @docs-private
|
15
|
-
*/
|
16
|
-
export declare const DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG: InjectionToken<DaffExternalRouterDriverTestingConfig>;
|
10
|
+
export declare const DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG: import("@angular/core").InjectionToken<DaffExternalRouterDriverTestingConfig>, provideDaffExternalRouterDriverTestingConfig: <R extends DaffExternalRouterDriverTestingConfig = DaffExternalRouterDriverTestingConfig>(config: Partial<R> | import("@angular/core").InjectionToken<Partial<R>>) => import("@angular/core").FactoryProvider;
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { EnvironmentProviders, InjectionToken } from '@angular/core';
|
2
|
+
import { DaffExternalRouterDriverTestingConfig } from './config';
|
3
|
+
/**
|
4
|
+
* Provides a testing implementation of {@link DaffExternalRouterDriver}
|
5
|
+
*/
|
6
|
+
export declare const provideDaffExternalRouterTestingDriver: (config: DaffExternalRouterDriverTestingConfig | InjectionToken<DaffExternalRouterDriverTestingConfig>) => EnvironmentProviders;
|
@@ -1,3 +1,4 @@
|
|
1
1
|
export { DaffExternalRouterTestingDriver } from './testing.service';
|
2
2
|
export { DaffExternalRouterDriverTestingModule } from './testing.module';
|
3
3
|
export { DaffExternalRouterDriverTestingConfig } from './config';
|
4
|
+
export { provideDaffExternalRouterTestingDriver } from './provider';
|
package/esm2022/config.mjs
CHANGED
@@ -1,14 +1,15 @@
|
|
1
|
-
import {
|
1
|
+
import { createConfigInjectionToken } from '@daffodil/core';
|
2
2
|
export const daffExternalRouterConfigurationDefault = {
|
3
3
|
failedResolutionPath: '/',
|
4
|
-
notFoundResolutionPath: '/',
|
5
4
|
};
|
5
|
+
export const {
|
6
6
|
/**
|
7
7
|
* The token holding the runtime configuration for the behavior of the
|
8
8
|
* `@daffodil/external-router` package.
|
9
9
|
*/
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
token: DAFF_EXTERNAL_ROUTER_CONFIG,
|
11
|
+
/**
|
12
|
+
* Provider function for {@link DAFF_EXTERNAL_ROUTER_CONFIG}.
|
13
|
+
*/
|
14
|
+
provider: provideDaffExternalRouterConfig, } = createConfigInjectionToken(daffExternalRouterConfigurationDefault, 'DAFF_EXTERNAL_ROUTER_CONFIG');
|
15
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlnLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vbGlicy9leHRlcm5hbC1yb3V0ZXIvc3JjL2NvbmZpZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsMEJBQTBCLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQztBQUU1RCxNQUFNLENBQUMsTUFBTSxzQ0FBc0MsR0FBb0M7SUFDckYsb0JBQW9CLEVBQUUsR0FBRztDQUMxQixDQUFDO0FBRUYsTUFBTSxDQUFDLE1BQU07QUFDWDs7O0dBR0c7QUFDSCxLQUFLLEVBQUUsMkJBQTJCO0FBQ2xDOztHQUVHO0FBQ0gsUUFBUSxFQUFFLCtCQUErQixHQUMxQyxHQUFHLDBCQUEwQixDQUFrQyxzQ0FBc0MsRUFBRSw2QkFBNkIsQ0FBQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgY3JlYXRlQ29uZmlnSW5qZWN0aW9uVG9rZW4gfSBmcm9tICdAZGFmZm9kaWwvY29yZSc7XG5cbmV4cG9ydCBjb25zdCBkYWZmRXh0ZXJuYWxSb3V0ZXJDb25maWd1cmF0aW9uRGVmYXVsdDogRGFmZkV4dGVybmFsUm91dGVyQ29uZmlndXJhdGlvbiA9IHtcbiAgZmFpbGVkUmVzb2x1dGlvblBhdGg6ICcvJyxcbn07XG5cbmV4cG9ydCBjb25zdCB7XG4gIC8qKlxuICAgKiBUaGUgdG9rZW4gaG9sZGluZyB0aGUgcnVudGltZSBjb25maWd1cmF0aW9uIGZvciB0aGUgYmVoYXZpb3Igb2YgdGhlXG4gICAqIGBAZGFmZm9kaWwvZXh0ZXJuYWwtcm91dGVyYCBwYWNrYWdlLlxuICAgKi9cbiAgdG9rZW46IERBRkZfRVhURVJOQUxfUk9VVEVSX0NPTkZJRyxcbiAgLyoqXG4gICAqIFByb3ZpZGVyIGZ1bmN0aW9uIGZvciB7QGxpbmsgREFGRl9FWFRFUk5BTF9ST1VURVJfQ09ORklHfS5cbiAgICovXG4gIHByb3ZpZGVyOiBwcm92aWRlRGFmZkV4dGVybmFsUm91dGVyQ29uZmlnLFxufSA9IGNyZWF0ZUNvbmZpZ0luamVjdGlvblRva2VuPERhZmZFeHRlcm5hbFJvdXRlckNvbmZpZ3VyYXRpb24+KGRhZmZFeHRlcm5hbFJvdXRlckNvbmZpZ3VyYXRpb25EZWZhdWx0LCAnREFGRl9FWFRFUk5BTF9ST1VURVJfQ09ORklHJyk7XG5cbi8qKlxuICogVGhlIGNvbmZpZ3VyYXRpb24gb2JqZWN0IGZvciB0aGUgZXh0ZXJuYWwgcm91dGVyIHBhY2thZ2UuXG4gKi9cbmV4cG9ydCBpbnRlcmZhY2UgRGFmZkV4dGVybmFsUm91dGVyQ29uZmlndXJhdGlvbiB7XG4gIC8qKlxuICAgKiBUaGUgcGF0aCB0byByZWRpcmVjdCB0byB3aGVuIGV4dGVybmFsIHJvdXRlIHJlc29sdXRpb24gZmFpbHMuXG4gICAqL1xuICBmYWlsZWRSZXNvbHV0aW9uUGF0aDogc3RyaW5nO1xufVxuIl19
|