@daffodil/external-router 0.94.1 → 0.95.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/fesm2022/daffodil-external-router-driver-in-memory.mjs +70 -88
- package/fesm2022/daffodil-external-router-driver-in-memory.mjs.map +1 -1
- package/fesm2022/daffodil-external-router-driver-magento-2.4.1.mjs +117 -118
- 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 +117 -118
- 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 +216 -266
- package/fesm2022/daffodil-external-router-driver-magento-2.4.3.mjs.map +1 -1
- package/fesm2022/daffodil-external-router-driver-magento-auto.mjs +7 -0
- package/fesm2022/daffodil-external-router-driver-magento-auto.mjs.map +1 -0
- package/fesm2022/daffodil-external-router-driver-magento.mjs +6 -18
- package/fesm2022/daffodil-external-router-driver-magento.mjs.map +1 -1
- package/fesm2022/daffodil-external-router-driver-shopify.mjs +49 -39
- package/fesm2022/daffodil-external-router-driver-shopify.mjs.map +1 -1
- package/fesm2022/daffodil-external-router-driver-testing.mjs +118 -115
- package/fesm2022/daffodil-external-router-driver-testing.mjs.map +1 -1
- package/fesm2022/daffodil-external-router-driver.mjs +8 -32
- package/fesm2022/daffodil-external-router-driver.mjs.map +1 -1
- package/fesm2022/daffodil-external-router-routing.mjs +31 -66
- package/fesm2022/daffodil-external-router-routing.mjs.map +1 -1
- package/fesm2022/daffodil-external-router.mjs +37 -81
- package/fesm2022/daffodil-external-router.mjs.map +1 -1
- package/package.json +1 -1
- package/types/daffodil-external-router-driver-in-memory.d.ts +15 -21
- package/types/daffodil-external-router-driver-magento-2.4.1.d.ts +29 -25
- package/types/daffodil-external-router-driver-magento-2.4.2.d.ts +29 -25
- package/types/daffodil-external-router-driver-magento-2.4.3.d.ts +25 -28
- package/types/daffodil-external-router-driver-magento-auto.d.ts +1 -0
- package/types/daffodil-external-router-driver-magento.d.ts +251 -263
- package/types/daffodil-external-router-driver-shopify.d.ts +10 -14
- package/types/daffodil-external-router-driver-testing.d.ts +22 -27
- package/types/daffodil-external-router-driver.d.ts +12 -19
- package/types/daffodil-external-router-routing.d.ts +4 -7
- package/types/daffodil-external-router.d.ts +72 -86
|
@@ -1,32 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
declare const DaffExternalRouterDriver: _angular_core.InjectionToken<DaffExternalRouterDriverInterface>;
|
|
6
|
-
declare const provideDaffExternalRouterDriver: <R extends DaffExternalRouterDriverInterface = DaffExternalRouterDriverInterface>(klass: _angular_core.Type<R>) => _angular_core.ExistingProvider;
|
|
1
|
+
import { Observable } from "rxjs";
|
|
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;
|
|
7
4
|
/**
|
|
8
5
|
* The interface for a `@daffodil/external-router` driver.
|
|
9
6
|
*
|
|
10
7
|
* This driver is responsible for translating a URL into a Route consumable by
|
|
11
8
|
* Daffodil.
|
|
12
9
|
*/
|
|
13
|
-
interface DaffExternalRouterDriverInterface {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
10
|
+
export interface DaffExternalRouterDriverInterface {
|
|
11
|
+
/**
|
|
12
|
+
* Resolves a URL with a platform.
|
|
13
|
+
* Returns information about the type of URL.
|
|
14
|
+
*
|
|
15
|
+
* @param url The full URL path qualified with file extension and leading slash but without domain. i.e. /full/path/to/thing.html
|
|
16
|
+
*/
|
|
17
|
+
resolve(url: string): Observable<DaffExternallyResolvableUrl>;
|
|
21
18
|
}
|
|
22
|
-
|
|
23
19
|
/**
|
|
24
20
|
* When a driver fails to find a resolution, it should return a 404.
|
|
25
21
|
* This const represents the standard "Not Found" resolution that a driver
|
|
26
22
|
* should return. Drivers are not required to return this value, but may do so
|
|
27
23
|
* if they would like.
|
|
28
24
|
*/
|
|
29
|
-
declare const DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION: DaffExternallyResolvableUrl;
|
|
30
|
-
|
|
31
|
-
export { DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION, DaffExternalRouterDriver, provideDaffExternalRouterDriver };
|
|
32
|
-
export type { DaffExternalRouterDriverInterface };
|
|
25
|
+
export declare const DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION: DaffExternallyResolvableUrl;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import { UrlSegment, UrlTree } from
|
|
2
|
-
import { Observable } from
|
|
3
|
-
import { DaffRouteWithSeoData } from
|
|
4
|
-
|
|
1
|
+
import { UrlSegment, UrlTree } from "@angular/router";
|
|
2
|
+
import { Observable } from "rxjs";
|
|
3
|
+
import { DaffRouteWithSeoData } from "@daffodil/external-router";
|
|
5
4
|
/**
|
|
6
5
|
* A `canMatch` guard function that will resolve a route externally, allowing Angular to match it.
|
|
7
6
|
*
|
|
8
7
|
* Depending on the resolution result, the route's data will contain `daffSeoData` with supplemental search engine data
|
|
9
8
|
* about the route. The data on the route is cumulative. If other data properties are set, they will be merged alongside daffSeoData.
|
|
10
9
|
*/
|
|
11
|
-
declare const daffExternalMatcherTypeGuard: (type: string) => (route: DaffRouteWithSeoData, segments: Array<UrlSegment>) => Observable<boolean | UrlTree>;
|
|
12
|
-
|
|
13
|
-
export { daffExternalMatcherTypeGuard };
|
|
10
|
+
export declare const daffExternalMatcherTypeGuard: (type: string) => (route: DaffRouteWithSeoData, segments: Array<UrlSegment>) => Observable<boolean | UrlTree>;
|
|
@@ -1,48 +1,43 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
declare const DAFF_EXTERNAL_ROUTER_CONFIG: _angular_core.InjectionToken<DaffExternalRouterConfiguration>;
|
|
1
|
+
import { DaffError, DaffIdentifiable, DaffInheritableError } from "@daffodil/core";
|
|
2
|
+
import { Route } from "@angular/router";
|
|
3
|
+
import { EnvironmentProviders } from "@angular/core";
|
|
4
|
+
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;
|
|
7
5
|
/**
|
|
8
6
|
* The configuration object for the external router package.
|
|
9
7
|
*/
|
|
10
|
-
interface DaffExternalRouterConfiguration {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
export interface DaffExternalRouterConfiguration {
|
|
9
|
+
/**
|
|
10
|
+
* The path to redirect to when external route resolution fails.
|
|
11
|
+
*/
|
|
12
|
+
failedResolutionPath: string;
|
|
15
13
|
}
|
|
16
|
-
|
|
17
14
|
/**
|
|
18
15
|
* Data associated with a route.
|
|
19
16
|
*/
|
|
20
|
-
interface DaffRouteData {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
17
|
+
export interface DaffRouteData {
|
|
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 title of the route.
|
|
28
|
+
*/
|
|
29
|
+
title?: string;
|
|
30
|
+
/**
|
|
31
|
+
* An associated schema for the route. See {@link Schema} for full capabilities.
|
|
32
|
+
*/
|
|
33
|
+
schema?: Record<string, unknown>;
|
|
37
34
|
}
|
|
38
|
-
|
|
39
35
|
/**
|
|
40
36
|
* The routing type of a particular route. E.g. if there's a category
|
|
41
37
|
* called "Sweatshirts" with an externally resolved URL of "/sweatshirts"
|
|
42
38
|
* Then, this type could be something like "CATEGORY".
|
|
43
39
|
*/
|
|
44
|
-
type DaffExternalRouteType = string;
|
|
45
|
-
|
|
40
|
+
export type DaffExternalRouteType = string;
|
|
46
41
|
/**
|
|
47
42
|
* A `DaffExternallyResolvableUrl` describes the relationship between a "type" of route
|
|
48
43
|
* as determined by an external platform and a URI.
|
|
@@ -56,83 +51,74 @@ type DaffExternalRouteType = string;
|
|
|
56
51
|
* }
|
|
57
52
|
* ```
|
|
58
53
|
*/
|
|
59
|
-
interface DaffExternallyResolvableUrl extends DaffIdentifiable {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
54
|
+
export interface DaffExternallyResolvableUrl extends DaffIdentifiable {
|
|
55
|
+
/**
|
|
56
|
+
* The URL that will be used for the path of the route inserted
|
|
57
|
+
* into the Angular routing config.
|
|
58
|
+
* Should not contain URL fragments, query parameters, or leading slashes.
|
|
59
|
+
*/
|
|
60
|
+
url: string;
|
|
61
|
+
/**
|
|
62
|
+
* The type of the route
|
|
63
|
+
*
|
|
64
|
+
* @see {@link DaffExternalRouteType}
|
|
65
|
+
*/
|
|
66
|
+
type: DaffExternalRouteType;
|
|
67
|
+
/**
|
|
68
|
+
* The HTTP status code for the resolvable route.
|
|
69
|
+
*/
|
|
70
|
+
code: number;
|
|
71
|
+
/**
|
|
72
|
+
* Additional route data. Note that this is not guaranteed to come from
|
|
73
|
+
* the driver, its only available when the driver makes it available.
|
|
74
|
+
*/
|
|
75
|
+
data?: DaffRouteData;
|
|
81
76
|
}
|
|
82
|
-
|
|
83
77
|
/**
|
|
84
78
|
* A type that describes the special data that Daffodil will store for SEO purposes on
|
|
85
79
|
* an external resolved route.
|
|
86
80
|
*/
|
|
87
|
-
type DaffRouteWithSeoData = Route & {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
81
|
+
export type DaffRouteWithSeoData = Route & {
|
|
82
|
+
data: Record<string, any> & {
|
|
83
|
+
daffSeoData: DaffRouteData;
|
|
84
|
+
};
|
|
91
85
|
};
|
|
92
|
-
|
|
93
|
-
declare const provideExternalRouter: (config?: Partial<DaffExternalRouterConfiguration>) => EnvironmentProviders;
|
|
94
|
-
|
|
86
|
+
export declare const provideExternalRouter: (config?: Partial<DaffExternalRouterConfiguration>) => EnvironmentProviders;
|
|
95
87
|
/**
|
|
96
88
|
* Represents a 4xx client error encountered during external URL resolution.
|
|
97
89
|
*/
|
|
98
|
-
declare class DaffExternalRouterClientError extends DaffInheritableError implements DaffError {
|
|
99
|
-
|
|
100
|
-
|
|
90
|
+
export declare class DaffExternalRouterClientError extends DaffInheritableError implements DaffError {
|
|
91
|
+
readonly code: string;
|
|
92
|
+
constructor(message?: string);
|
|
101
93
|
}
|
|
102
|
-
|
|
103
94
|
/**
|
|
104
95
|
* Indicates that a URL could not be resolved by an external router driver.
|
|
105
96
|
*/
|
|
106
|
-
declare class DaffExternalRouterNotFoundError extends DaffExternalRouterClientError implements DaffError {
|
|
107
|
-
|
|
108
|
-
|
|
97
|
+
export declare class DaffExternalRouterNotFoundError extends DaffExternalRouterClientError implements DaffError {
|
|
98
|
+
readonly code = "404_NOT_FOUND";
|
|
99
|
+
constructor(message?: string);
|
|
109
100
|
}
|
|
110
|
-
|
|
111
101
|
/**
|
|
112
102
|
* Signals that the resolved URL should permanently redirect to another location.
|
|
113
103
|
*/
|
|
114
|
-
declare class DaffExternalRouterPermanentRedirectError extends DaffInheritableError implements DaffError {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
104
|
+
export declare class DaffExternalRouterPermanentRedirectError extends DaffInheritableError implements DaffError {
|
|
105
|
+
readonly redirectUrl: string;
|
|
106
|
+
readonly code: string;
|
|
107
|
+
constructor(redirectUrl: string, message?: string);
|
|
118
108
|
}
|
|
119
|
-
|
|
120
109
|
/**
|
|
121
110
|
* Indicates that the external routing platform experienced a server-side failure.
|
|
122
111
|
*/
|
|
123
|
-
declare class DaffExternalRouterServerError extends DaffInheritableError implements DaffError {
|
|
124
|
-
|
|
125
|
-
|
|
112
|
+
export declare class DaffExternalRouterServerError extends DaffInheritableError implements DaffError {
|
|
113
|
+
readonly code: string;
|
|
114
|
+
constructor(message?: string);
|
|
126
115
|
}
|
|
127
|
-
|
|
128
116
|
/**
|
|
129
117
|
* Signals that the resolved URL should temporarily redirect to another location.
|
|
130
118
|
*/
|
|
131
|
-
declare class DaffExternalRouterTemporaryRedirectError extends DaffInheritableError implements DaffError {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
119
|
+
export declare class DaffExternalRouterTemporaryRedirectError extends DaffInheritableError implements DaffError {
|
|
120
|
+
readonly redirectUrl: string;
|
|
121
|
+
readonly code: string;
|
|
122
|
+
constructor(redirectUrl: string, message?: string);
|
|
135
123
|
}
|
|
136
|
-
|
|
137
|
-
export { DAFF_EXTERNAL_ROUTER_CONFIG, DaffExternalRouterClientError, DaffExternalRouterNotFoundError, DaffExternalRouterPermanentRedirectError, DaffExternalRouterServerError, DaffExternalRouterTemporaryRedirectError, provideExternalRouter };
|
|
138
|
-
export type { DaffExternalRouteType, DaffExternalRouterConfiguration, DaffExternallyResolvableUrl, DaffRouteData, DaffRouteWithSeoData };
|
|
124
|
+
export { DAFF_EXTERNAL_ROUTER_CONFIG };
|