@daffodil/external-router 0.75.0 → 0.77.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 +17 -2
- package/esm2022/config.mjs +1 -1
- package/esm2022/driver/in-memory/config.mjs +1 -1
- package/esm2022/driver/in-memory/in-memory.module.mjs +5 -5
- package/esm2022/driver/in-memory/in-memory.service.mjs +4 -4
- package/esm2022/driver/interfaces/external-router-driver.interface.mjs +1 -1
- package/esm2022/driver/magento/2.4.1/magento.module.mjs +5 -5
- package/esm2022/driver/magento/2.4.1/magento.service.mjs +4 -4
- package/esm2022/driver/magento/2.4.2/magento.module.mjs +5 -5
- package/esm2022/driver/magento/2.4.2/magento.service.mjs +4 -4
- package/esm2022/driver/magento/2.4.3/magento.module.mjs +5 -5
- package/esm2022/driver/magento/2.4.3/magento.service.mjs +4 -4
- package/esm2022/driver/testing/config.mjs +1 -1
- package/esm2022/driver/testing/testing.module.mjs +5 -5
- package/esm2022/driver/testing/testing.service.mjs +4 -4
- package/esm2022/errors/no-wildcard.mjs +1 -1
- package/esm2022/errors/unknown-type.mjs +1 -1
- package/esm2022/external-router.module.mjs +5 -5
- package/esm2022/router/router.service.mjs +4 -4
- package/esm2022/router/strategies/insert-data-path.mjs +1 -1
- package/esm2022/router/strategies/insert-route-before-wildcard.mjs +1 -1
- package/esm2022/router/url-matcher/data-path-matcher.mjs +1 -1
- package/esm2022/routing/errors/client-error.mjs +1 -1
- package/esm2022/routing/errors/not-found-error.mjs +1 -1
- package/esm2022/routing/errors/permanent-redirect.mjs +1 -1
- package/esm2022/routing/errors/server-error.mjs +1 -1
- package/esm2022/routing/errors/temporary-redirect.mjs +1 -1
- package/esm2022/routing/guard/existence.guard.mjs +4 -4
- package/esm2022/routing/processors/process-errors.mjs +1 -1
- package/esm2022/routing/processors/process-redirect.mjs +1 -1
- package/esm2022/token/type-resolvable-routes.token.mjs +1 -1
- package/esm2022/transform/resolved-route-to-route.mjs +1 -1
- package/fesm2022/daffodil-external-router-driver-in-memory.mjs +7 -7
- package/fesm2022/daffodil-external-router-driver-in-memory.mjs.map +1 -1
- package/fesm2022/daffodil-external-router-driver-magento-2.4.1.mjs +7 -7
- 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 +7 -7
- 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 +7 -7
- package/fesm2022/daffodil-external-router-driver-magento-2.4.3.mjs.map +1 -1
- package/fesm2022/daffodil-external-router-driver-testing.mjs +7 -7
- package/fesm2022/daffodil-external-router-driver-testing.mjs.map +1 -1
- package/fesm2022/daffodil-external-router-driver.mjs.map +1 -1
- package/fesm2022/daffodil-external-router-routing.mjs +3 -3
- package/fesm2022/daffodil-external-router-routing.mjs.map +1 -1
- package/fesm2022/daffodil-external-router.mjs +7 -7
- package/fesm2022/daffodil-external-router.mjs.map +1 -1
- package/package.json +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"daffodil-external-router-driver-testing.mjs","sources":["../../../libs/external-router/driver/testing/src/config.ts","../../../libs/external-router/driver/testing/src/testing.service.ts","../../../libs/external-router/driver/testing/src/testing.module.ts","../../../libs/external-router/driver/testing/src/public_api.ts","../../../libs/external-router/driver/testing/src/daffodil-external-router-driver-testing.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nimport { DaffExternalRouteType } from '@daffodil/external-router';\n\n/**\n * The configuration for the testing driver. It is a dictionary of \"url\": \"type\",\n * pairs, where the URL is a URL-safe routeable path, e.g. \"sweatshirts\" or \"t-shirts\"\n * and the type is a known type to your application, e.g. \"CATEGORY\".\n */\nexport interface DaffExternalRouterDriverTestingConfig {\n [url: string]: DaffExternalRouteType;\n}\n\n/**\n * The token used by Daffodil to hold the driver's configuration.\n *\n * @docs-private\n */\nexport const DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG = new InjectionToken<\
|
1
|
+
{"version":3,"file":"daffodil-external-router-driver-testing.mjs","sources":["../../../libs/external-router/driver/testing/src/config.ts","../../../libs/external-router/driver/testing/src/testing.service.ts","../../../libs/external-router/driver/testing/src/testing.module.ts","../../../libs/external-router/driver/testing/src/public_api.ts","../../../libs/external-router/driver/testing/src/daffodil-external-router-driver-testing.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nimport { DaffExternalRouteType } from '@daffodil/external-router';\n\n/**\n * The configuration for the testing driver. It is a dictionary of \"url\": \"type\",\n * pairs, where the URL is a URL-safe routeable path, e.g. \"sweatshirts\" or \"t-shirts\"\n * and the type is a known type to your application, e.g. \"CATEGORY\".\n */\nexport interface DaffExternalRouterDriverTestingConfig {\n [url: string]: DaffExternalRouteType;\n}\n\n/**\n * The token used by Daffodil to hold the driver's configuration.\n *\n * @docs-private\n */\nexport const DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG = new InjectionToken<\n DaffExternalRouterDriverTestingConfig\n>('DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG', {\n providedIn: 'root',\n factory: () => ({}),\n});\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport { faker } from '@faker-js/faker/locale/en_US';\nimport {\n Observable,\n of,\n throwError,\n} from 'rxjs';\n\nimport {\n daffUriTruncateLeadingSlash,\n daffUriTruncateQueryFragment,\n} from '@daffodil/core/routing';\nimport { DaffExternallyResolvableUrl } from '@daffodil/external-router';\nimport { DaffExternalRouterDriverInterface } from '@daffodil/external-router/driver';\n\nimport {\n DaffExternalRouterDriverTestingConfig,\n DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG,\n} from './config';\n\n/**\n * The DaffExternalRouterTestingDriver is responsible for translating an\n * arbitrary URI into a DaffExternallyResolvableUrl in testing environments.\n *\n * @inheritdoc\n *\n * @see {@link DaffExternalRouterTestingDriver}\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffExternalRouterTestingDriver\nimplements DaffExternalRouterDriverInterface {\n constructor(\n @Inject(DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG)\n private testingConfiguration: DaffExternalRouterDriverTestingConfig = {},\n ) {}\n\n resolve(url: string): Observable<DaffExternallyResolvableUrl> {\n const truncatedUrl = daffUriTruncateLeadingSlash(daffUriTruncateQueryFragment(url));\n\n if (!this.testingConfiguration[truncatedUrl]) {\n return throwError(`\\\nThe route '${truncatedUrl}' wasn't provided with a matching type by the testing driver. \\\nDid you configure the available route types with DaffExternalRouterDriverTestingModule.forRoot(config)`);\n }\n\n return of({\n id: faker.datatype.uuid(),\n url: truncatedUrl,\n type: this.testingConfiguration[truncatedUrl],\n code: 200,\n });\n }\n}\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport { DaffExternalRouterDriver } from '@daffodil/external-router/driver';\n\nimport {\n DaffExternalRouterDriverTestingConfig,\n DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG,\n} from './config';\nimport { DaffExternalRouterTestingDriver } from './testing.service';\n\n/**\n * The `DaffExternalRouterDriverTestingModule` is an importable NgModule that can\n * be used to configure the {@link DaffExternalRouterTestingDriver}.\n */\n@NgModule({\n declarations: [],\n imports: [CommonModule],\n})\nexport class DaffExternalRouterDriverTestingModule {\n static forRoot(\n config: DaffExternalRouterDriverTestingConfig,\n ): ModuleWithProviders<DaffExternalRouterDriverTestingModule> {\n return {\n ngModule: DaffExternalRouterDriverTestingModule,\n providers: [\n {\n provide: DaffExternalRouterDriver,\n useExisting: DaffExternalRouterTestingDriver,\n },\n {\n provide: DAFF_EXTERNAL_ROUTER_DRIVER_TESTING_CONFIG,\n useValue: config,\n },\n ],\n };\n }\n}\n","/*\n * Public API Surface of @daffodil/external-router/driver/testing\n */\n\nexport { DaffExternalRouterTestingDriver } from './testing.service';\nexport { DaffExternalRouterDriverTestingModule } from './testing.module';\n\nexport { DaffExternalRouterDriverT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AA,EAAA,CAAA;kBAJjD,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,EAAE;oBAChB,OAAO,EAAE,CAAC,YAAY,CAAC;AACxB,iBAAA,CAAA;;;ACrBD;;AAEG;;ACFH;;AAEG;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"daffodil-external-router-driver.mjs","sources":["../../../libs/external-router/driver/src/interfaces/external-router-driver.interface.ts","../../../libs/external-router/driver/src/not-found-resolution.ts","../../../libs/external-router/driver/src/public_api.ts","../../../libs/external-router/driver/src/daffodil-external-router-driver.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport { DaffExternallyResolvableUrl } from '@daffodil/external-router';\n\n/**\n * The token for the `@daffodil/external-router` driver.\n */\nexport const DaffExternalRouterDriver = new InjectionToken<\
|
1
|
+
{"version":3,"file":"daffodil-external-router-driver.mjs","sources":["../../../libs/external-router/driver/src/interfaces/external-router-driver.interface.ts","../../../libs/external-router/driver/src/not-found-resolution.ts","../../../libs/external-router/driver/src/public_api.ts","../../../libs/external-router/driver/src/daffodil-external-router-driver.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport { DaffExternallyResolvableUrl } from '@daffodil/external-router';\n\n/**\n * The token for the `@daffodil/external-router` driver.\n */\nexport const DaffExternalRouterDriver = new InjectionToken<\n DaffExternalRouterDriverInterface\n>('DaffExternalRouterDriver');\n\n/**\n * The interface for a @daffodil/external-router driver.\n *\n * This driver is responsible for translating a URL into a Route consumable by\n * Daffodil.\n */\nexport interface DaffExternalRouterDriverInterface {\n /**\n * Resolves a URL with a platform.\n * Returns information about the type of URL.\n *\n * @param url The full URL path qualified with file extension and leading slash but without domain. i.e. /full/path/to/thing.html\n */\n resolve(url: string): Observable<DaffExternallyResolvableUrl>;\n}\n","import { DaffExternallyResolvableUrl } from '@daffodil/external-router';\n\n/**\n * When a driver fails to find a resolution, it should return a 404.\n * This const represents the standard \"Not Found\" resolution that a driver\n * should return. Drivers are not required to return this value, but may do so\n * if they would like.\n */\nexport const DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION: DaffExternallyResolvableUrl = {\n id: null,\n url: null,\n code: 404,\n type: null,\n};\n","/*\n * Public API Surface of @daffodil/external-router/driver\n */\n\nexport {\n DaffExternalRouterDriverInterface,\n DaffExternalRouterDriver,\n} from './interfaces/external-router-driver.interface';\nexport { DAFF_EXTERNAL_ROUTER_NOT_FOUND_RESOLUTION } from './not-found-resolution';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAKA;;AAEG;MACU,wBAAwB,GAAG,IAAI,cAAc,CAExD,0BAA0B;;ACR5B;;;;;AAKG;AACU,MAAA,yCAAyC,GAAgC;AACpF,IAAA,EAAE,EAAE,IAAI;AACR,IAAA,GAAG,EAAE,IAAI;AACT,IAAA,IAAI,EAAE,GAAG;AACT,IAAA,IAAI,EAAE,IAAI;;;ACZZ;;AAEG;;ACFH;;AAEG;;;;"}
|
@@ -143,10 +143,10 @@ class DaffExternalRouterExistenceGuard {
|
|
143
143
|
return of(this.router.parseUrl(this.config.failedResolutionPath));
|
144
144
|
}));
|
145
145
|
}
|
146
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
147
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
146
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffExternalRouterExistenceGuard, deps: [{ token: DaffExternalRouterDriver }, { token: i1.DaffExternalRouter }, { token: i2.Router }, { token: DAFF_EXTERNAL_ROUTER_CONFIG }, { token: i3.DaffRoutingUriNormalizer }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
147
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffExternalRouterExistenceGuard, providedIn: 'root' }); }
|
148
148
|
}
|
149
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
149
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffExternalRouterExistenceGuard, decorators: [{
|
150
150
|
type: Injectable,
|
151
151
|
args: [{
|
152
152
|
providedIn: 'root',
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"daffodil-external-router-routing.mjs","sources":["../../../libs/external-router/routing/src/errors/client-error.ts","../../../libs/external-router/routing/src/errors/not-found-error.ts","../../../libs/external-router/routing/src/errors/permanent-redirect.ts","../../../libs/external-router/routing/src/errors/temporary-redirect.ts","../../../libs/external-router/routing/src/errors/server-error.ts","../../../libs/external-router/routing/src/processors/process-errors.ts","../../../libs/external-router/routing/src/processors/process-redirect.ts","../../../libs/external-router/routing/src/guard/existence.guard.ts","../../../libs/external-router/routing/src/public_api.ts","../../../libs/external-router/routing/src/daffodil-external-router-routing.ts"],"sourcesContent":["import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\n/**\n * An error thrown when the driver encounters a 4xx error.\n */\nexport class DaffExternalRouterClientError extends DaffInheritableError\n implements DaffError {\n public readonly code: string = '4xx_CLIENT_ERROR';\n\n constructor(message?: string) {\n\t super(message);\n }\n}\n","import { DaffError } from '@daffodil/core';\n\nimport { DaffExternalRouterClientError } from './client-error';\n\n/**\n * An error thrown when the driver determines that a given url is not resolvable.\n */\nexport class DaffExternalRouterNotFoundError extends DaffExternalRouterClientError\n implements DaffError {\n public readonly code: string = '404_NOT_FOUND';\n\n constructor(message?: string) {\n\t super(message);\n }\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\n/**\n * An error thrown when the driver determines that the url needs to be routed somewhere\n * else permanently.\n */\nexport class DaffExternalRouterPermanentRedirectError extends DaffInheritableError\n implements DaffError {\n public readonly code: string = '302_PERMANENT_REDIRECT';\n\n constructor(public redirectUrl: string, message?: string) {\n\t super(message);\n }\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\n/**\n * An error thrown when the driver needs a URI to be temporarily redirected\n * to another location.\n */\nexport class DaffExternalRouterTemporaryRedirectError extends DaffInheritableError\n implements DaffError {\n public readonly code: string = 'TEMPORARY_REDIRECT';\n\n constructor(public redirectUrl: string, message?: string) {\n\t super(message);\n }\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\n/**\n * An error thrown when the platform performing url resolution fails.\n */\nexport class DaffExternalRouterServerError extends DaffInheritableError\n implements DaffError {\n public readonly code: string = '5xx_SERVER_ERROR';\n\n constructor(message?: string) {\n\t super(message);\n }\n}\n","import { DaffExternallyResolvableUrl } from '@daffodil/external-router';\n\n\nimport { DaffExternalRouterClientError } from '../errors/client-error';\nimport { DaffExternalRouterNotFoundError } from '../errors/not-found-error';\nimport { DaffExternalRouterServerError } from '../errors/server-error';\n\n/**\n * Processes resolved URLs and throws the appropriate error so that External Router\n * can handle routing errors.\n */\nexport const processErrors = (url: DaffExternallyResolvableUrl): DaffExternallyResolvableUrl => {\n if(url.code === 404 ){\n throw new DaffExternalRouterNotFoundError();\n } else if(url.code >= 400 && url.code < 500) {\n throw new DaffExternalRouterClientError();\n } else if(url.code >= 500) {\n throw new DaffExternalRouterServerError();\n } else {\n return url;\n }\n};\n","import { DaffExternallyResolvableUrl } from '@daffodil/external-router';\n\nimport { DaffExternalRouterPermanentRedirectError } from '../errors/permanent-redirect';\nimport { DaffExternalRouterTemporaryRedirectError } from '../errors/temporary-redirect';\n\n/**\n * Processes resolvedUrls and throws the appropriate error so that External Router\n * can handle redirects.\n */\nexport const processRedirects = (url: DaffExternallyResolvableUrl): DaffExternallyResolvableUrl => {\n if(url.code === 301){\n throw new DaffExternalRouterPermanentRedirectError(url.url);\n } else if(url.code === 302) {\n throw new DaffExternalRouterTemporaryRedirectError(url.url);\n } else {\n return url;\n }\n};\n","import { isPlatformServer } from '@angular/common';\nimport {\n Injectable,\n Inject,\n PLATFORM_ID,\n} from '@angular/core';\nimport {\n ActivatedRouteSnapshot,\n Router,\n RouterStateSnapshot,\n UrlTree,\n} from '@angular/router';\nimport {\n Observable,\n of,\n} from 'rxjs';\nimport {\n catchError,\n map,\n switchMap,\n} from 'rxjs/operators';\n\nimport { DaffRoutingUriNormalizer } from '@daffodil/core/routing';\nimport {\n DaffExternalRouter,\n DaffExternalRouterConfiguration,\n DAFF_EXTERNAL_ROUTER_CONFIG,\n DaffExternallyResolvableUrl,\n} from '@daffodil/external-router';\nimport {\n DaffExternalRouterDriverInterface,\n DaffExternalRouterDriver,\n} from '@daffodil/external-router/driver';\n\nimport { DaffExternalRouterNotFoundError } from '../errors/not-found-error';\nimport { DaffExternalRouterPermanentRedirectError } from '../errors/permanent-redirect';\nimport { DaffExternalRouterTemporaryRedirectError } from '../errors/temporary-redirect';\nimport { processErrors } from '../processors/process-errors';\nimport { processRedirects } from '../processors/process-redirect';\n\n/**\n * The DaffExternalRouterExistenceGuard is responsible for guarding the wildcard route\n * of an Angular App and either navigating to a resolved route upon successful resolution\n * or navigating to the configured route upon a failed resolution.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffExternalRouterExistenceGuard {\n constructor(\n @Inject(DaffExternalRouterDriver)\n private driver: DaffExternalRouterDriverInterface,\n private externalRouter: DaffExternalRouter,\n private router: Router,\n @Inject(DAFF_EXTERNAL_ROUTER_CONFIG)\n private config: DaffExternalRouterConfiguration,\n private urlNormalizer: DaffRoutingUriNormalizer,\n ) { }\n\n canActivate(\n next: ActivatedRouteSnapshot,\n state: RouterStateSnapshot,\n ): Observable<UrlTree | boolean> {\n return this.driver.resolve(this.urlNormalizer.normalize(state.url)).pipe(\n map((resolvedRoute: DaffExternallyResolvableUrl) => processErrors(resolvedRoute)),\n switchMap(resolvedRoute => {\n this.externalRouter.add(resolvedRoute);\n return of(resolvedRoute);\n }),\n map((resolvedRoute: DaffExternallyResolvableUrl) => processRedirects(resolvedRoute)),\n // Note that we have to use state.url as we want to ensure that we keep any fragments or query strings.\n // When we succeed, redirect to the new route, as config has changed since we init'd.\n map(() => this.router.parseUrl(state.url)),\n // When we fail, we need to process errors as dictated by the error type.\n // Handle redirects\n catchError(error => {\n if (\n !(error instanceof DaffExternalRouterPermanentRedirectError) &&\n !(error instanceof DaffExternalRouterTemporaryRedirectError)) {\n throw error;\n }\n\n return of(this.router.parseUrl(error.redirectUrl));\n }),\n // Handle \"404\"\n catchError((error) => {\n if (!(error instanceof DaffExternalRouterNotFoundError)) {\n throw error;\n }\n\n return of(this.router.parseUrl(this.config.notFoundResolutionPath));\n }),\n\n //Otherwise something went horribly wrong and we need to bail out.\n catchError((error) => {\n //TODO(damienwebdev): Add a logging system.\n //This log is intentional until we have a better logging system in place.\n console.log(error);\n return of(this.router.parseUrl(this.config.failedResolutionPath));\n }),\n );\n }\n}\n","/*\n * Public API Surface of @daffodil/external-router/routing\n */\nexport { DaffExternalRouterExistenceGuard } from './guard/existence.guard';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;AAKA;;AAEG;AACG,MAAO,6BAA8B,SAAQ,oBAAoB,CAAA;AAIrE,IAAA,WAAA,CAAY,OAAgB,EAAA;QAC3B,KAAK,CAAC,OAAO,CAAC,CAAC;QAHA,IAAI,CAAA,IAAA,GAAW,kBAAkB,CAAC;KAIjD;AACF;;ACXD;;AAEG;AACG,MAAO,+BAAgC,SAAQ,6BAA6B,CAAA;AAIhF,IAAA,WAAA,CAAY,OAAgB,EAAA;QAC3B,KAAK,CAAC,OAAO,CAAC,CAAC;QAHA,IAAI,CAAA,IAAA,GAAW,eAAe,CAAC;KAI9C;AACF;;ACTD;;;AAGG;AACG,MAAO,wCAAyC,SAAQ,oBAAoB,CAAA;IAIhF,WAAmB,CAAA,WA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,EAAA,gCAAgC,cAF/B,MAAM,EAAA,CAAA,CAAA,EAAA;;4FAEP,gCAAgC,EAAA,UAAA,EAAA,CAAA;kBAH5C,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA,CAAA;;0BAGI,MAAM;2BAAC,wBAAwB,CAAA;;0BAI/B,MAAM;2BAAC,2BAA2B,CAAA;;;ACtDvC;;AAEG;;ACFH;;AAEG;;;;"}
|
1
|
+
{"version":3,"file":"daffodil-external-router-routing.mjs","sources":["../../../libs/external-router/routing/src/errors/client-error.ts","../../../libs/external-router/routing/src/errors/not-found-error.ts","../../../libs/external-router/routing/src/errors/permanent-redirect.ts","../../../libs/external-router/routing/src/errors/temporary-redirect.ts","../../../libs/external-router/routing/src/errors/server-error.ts","../../../libs/external-router/routing/src/processors/process-errors.ts","../../../libs/external-router/routing/src/processors/process-redirect.ts","../../../libs/external-router/routing/src/guard/existence.guard.ts","../../../libs/external-router/routing/src/public_api.ts","../../../libs/external-router/routing/src/daffodil-external-router-routing.ts"],"sourcesContent":["import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\n/**\n * An error thrown when the driver encounters a 4xx error.\n */\nexport class DaffExternalRouterClientError extends DaffInheritableError\n implements DaffError {\n public readonly code: string = '4xx_CLIENT_ERROR';\n\n constructor(message?: string) {\n super(message);\n }\n}\n","import { DaffError } from '@daffodil/core';\n\nimport { DaffExternalRouterClientError } from './client-error';\n\n/**\n * An error thrown when the driver determines that a given url is not resolvable.\n */\nexport class DaffExternalRouterNotFoundError extends DaffExternalRouterClientError\n implements DaffError {\n public readonly code: string = '404_NOT_FOUND';\n\n constructor(message?: string) {\n super(message);\n }\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\n/**\n * An error thrown when the driver determines that the url needs to be routed somewhere\n * else permanently.\n */\nexport class DaffExternalRouterPermanentRedirectError extends DaffInheritableError\n implements DaffError {\n public readonly code: string = '302_PERMANENT_REDIRECT';\n\n constructor(public redirectUrl: string, message?: string) {\n super(message);\n }\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\n/**\n * An error thrown when the driver needs a URI to be temporarily redirected\n * to another location.\n */\nexport class DaffExternalRouterTemporaryRedirectError extends DaffInheritableError\n implements DaffError {\n public readonly code: string = 'TEMPORARY_REDIRECT';\n\n constructor(public redirectUrl: string, message?: string) {\n super(message);\n }\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\n/**\n * An error thrown when the platform performing url resolution fails.\n */\nexport class DaffExternalRouterServerError extends DaffInheritableError\n implements DaffError {\n public readonly code: string = '5xx_SERVER_ERROR';\n\n constructor(message?: string) {\n super(message);\n }\n}\n","import { DaffExternallyResolvableUrl } from '@daffodil/external-router';\n\n\nimport { DaffExternalRouterClientError } from '../errors/client-error';\nimport { DaffExternalRouterNotFoundError } from '../errors/not-found-error';\nimport { DaffExternalRouterServerError } from '../errors/server-error';\n\n/**\n * Processes resolved URLs and throws the appropriate error so that External Router\n * can handle routing errors.\n */\nexport const processErrors = (url: DaffExternallyResolvableUrl): DaffExternallyResolvableUrl => {\n if(url.code === 404 ){\n throw new DaffExternalRouterNotFoundError();\n } else if(url.code >= 400 && url.code < 500) {\n throw new DaffExternalRouterClientError();\n } else if(url.code >= 500) {\n throw new DaffExternalRouterServerError();\n } else {\n return url;\n }\n};\n","import { DaffExternallyResolvableUrl } from '@daffodil/external-router';\n\nimport { DaffExternalRouterPermanentRedirectError } from '../errors/permanent-redirect';\nimport { DaffExternalRouterTemporaryRedirectError } from '../errors/temporary-redirect';\n\n/**\n * Processes resolvedUrls and throws the appropriate error so that External Router\n * can handle redirects.\n */\nexport const processRedirects = (url: DaffExternallyResolvableUrl): DaffExternallyResolvableUrl => {\n if(url.code === 301){\n throw new DaffExternalRouterPermanentRedirectError(url.url);\n } else if(url.code === 302) {\n throw new DaffExternalRouterTemporaryRedirectError(url.url);\n } else {\n return url;\n }\n};\n","import { isPlatformServer } from '@angular/common';\nimport {\n Injectable,\n Inject,\n PLATFORM_ID,\n} from '@angular/core';\nimport {\n ActivatedRouteSnapshot,\n Router,\n RouterStateSnapshot,\n UrlTree,\n} from '@angular/router';\nimport {\n Observable,\n of,\n} from 'rxjs';\nimport {\n catchError,\n map,\n switchMap,\n} from 'rxjs/operators';\n\nimport { DaffRoutingUriNormalizer } from '@daffodil/core/routing';\nimport {\n DaffExternalRouter,\n DaffExternalRouterConfiguration,\n DAFF_EXTERNAL_ROUTER_CONFIG,\n DaffExternallyResolvableUrl,\n} from '@daffodil/external-router';\nimport {\n DaffExternalRouterDriverInterface,\n DaffExternalRouterDriver,\n} from '@daffodil/external-router/driver';\n\nimport { DaffExternalRouterNotFoundError } from '../errors/not-found-error';\nimport { DaffExternalRouterPermanentRedirectError } from '../errors/permanent-redirect';\nimport { DaffExternalRouterTemporaryRedirectError } from '../errors/temporary-redirect';\nimport { processErrors } from '../processors/process-errors';\nimport { processRedirects } from '../processors/process-redirect';\n\n/**\n * The DaffExternalRouterExistenceGuard is responsible for guarding the wildcard route\n * of an Angular App and either navigating to a resolved route upon successful resolution\n * or navigating to the configured route upon a failed resolution.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffExternalRouterExistenceGuard {\n constructor(\n @Inject(DaffExternalRouterDriver)\n private driver: DaffExternalRouterDriverInterface,\n private externalRouter: DaffExternalRouter,\n private router: Router,\n @Inject(DAFF_EXTERNAL_ROUTER_CONFIG)\n private config: DaffExternalRouterConfiguration,\n private urlNormalizer: DaffRoutingUriNormalizer,\n ) { }\n\n canActivate(\n next: ActivatedRouteSnapshot,\n state: RouterStateSnapshot,\n ): Observable<UrlTree | boolean> {\n return this.driver.resolve(this.urlNormalizer.normalize(state.url)).pipe(\n map((resolvedRoute: DaffExternallyResolvableUrl) => processErrors(resolvedRoute)),\n switchMap(resolvedRoute => {\n this.externalRouter.add(resolvedRoute);\n return of(resolvedRoute);\n }),\n map((resolvedRoute: DaffExternallyResolvableUrl) => processRedirects(resolvedRoute)),\n // Note that we have to use state.url as we want to ensure that we keep any fragments or query strings.\n // When we succeed, redirect to the new route, as config has changed since we init'd.\n map(() => this.router.parseUrl(state.url)),\n // When we fail, we need to process errors as dictated by the error type.\n // Handle redirects\n catchError(error => {\n if (\n !(error instanceof DaffExternalRouterPermanentRedirectError) &&\n !(error instanceof DaffExternalRouterTemporaryRedirectError)) {\n throw error;\n }\n\n return of(this.router.parseUrl(error.redirectUrl));\n }),\n // Handle \"404\"\n catchError((error) => {\n if (!(error instanceof DaffExternalRouterNotFoundError)) {\n throw error;\n }\n\n return of(this.router.parseUrl(this.config.notFoundResolutionPath));\n }),\n\n //Otherwise something went horribly wrong and we need to bail out.\n catchError((error) => {\n //TODO(damienwebdev): Add a logging system.\n //This log is intentional until we have a better logging system in place.\n console.log(error);\n return of(this.router.parseUrl(this.config.failedResolutionPath));\n }),\n );\n }\n}\n","/*\n * Public API Surface of @daffodil/external-router/routing\n */\nexport { DaffExternalRouterExistenceGuard } from './guard/existence.guard';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;AAKA;;AAEG;AACG,MAAO,6BAA8B,SAAQ,oBAAoB,CAAA;AAIrE,IAAA,WAAA,CAAY,OAAgB,EAAA;QAC1B,KAAK,CAAC,OAAO,CAAC,CAAC;QAHD,IAAI,CAAA,IAAA,GAAW,kBAAkB,CAAC;KAIjD;AACF;;ACXD;;AAEG;AACG,MAAO,+BAAgC,SAAQ,6BAA6B,CAAA;AAIhF,IAAA,WAAA,CAAY,OAAgB,EAAA;QAC1B,KAAK,CAAC,OAAO,CAAC,CAAC;QAHD,IAAI,CAAA,IAAA,GAAW,eAAe,CAAC;KAI9C;AACF;;ACTD;;;AAGG;AACG,MAAO,wCAAyC,SAAQ,oBAAoB,CAAA;IAIhF,WAAmB,CAAA,WAAmB,EAAE,OAAgB,EAAA;QACtD,KAAK,CAAC,OAAO,CAAC,CAAC;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IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA,CAAA;;0BAGI,MAAM;2BAAC,wBAAwB,CAAA;;0BAI/B,MAAM;2BAAC,2BAA2B,CAAA;;;ACtDvC;;AAEG;;ACFH;;AAEG;;;;"}
|
@@ -60,11 +60,11 @@ class DaffExternalRouterModule {
|
|
60
60
|
],
|
61
61
|
};
|
62
62
|
}
|
63
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
64
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
65
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
63
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffExternalRouterModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
64
|
+
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.2", ngImport: i0, type: DaffExternalRouterModule, imports: [CommonModule] }); }
|
65
|
+
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffExternalRouterModule, imports: [CommonModule] }); }
|
66
66
|
}
|
67
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
67
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffExternalRouterModule, decorators: [{
|
68
68
|
type: NgModule,
|
69
69
|
args: [{
|
70
70
|
declarations: [],
|
@@ -155,10 +155,10 @@ class DaffExternalRouter {
|
|
155
155
|
throw e;
|
156
156
|
}
|
157
157
|
}
|
158
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
159
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
158
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffExternalRouter, deps: [{ token: i1.Router }, { token: DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
159
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffExternalRouter, providedIn: 'root' }); }
|
160
160
|
}
|
161
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
161
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffExternalRouter, decorators: [{
|
162
162
|
type: Injectable,
|
163
163
|
args: [{
|
164
164
|
providedIn: 'root',
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"daffodil-external-router.mjs","sources":["../../../libs/external-router/src/config.ts","../../../libs/external-router/src/token/type-resolvable-routes.token.ts","../../../libs/external-router/src/external-router.module.ts","../../../libs/external-router/src/errors/no-wildcard.ts","../../../libs/external-router/src/router/strategies/insert-route-before-wildcard.ts","../../../libs/external-router/src/errors/unknown-type.ts","../../../libs/external-router/src/transform/resolved-route-to-route.ts","../../../libs/external-router/src/router/router.service.ts","../../../libs/external-router/src/router/strategies/insert-data-path.ts","../../../libs/external-router/src/router/url-matcher/data-path-matcher.ts","../../../libs/external-router/src/util/extract-daff-path-data.ts","../../../libs/external-router/src/public_api.ts","../../../libs/external-router/src/daffodil-external-router.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nexport const daffExternalRouterConfigurationDefault: DaffExternalRouterConfiguration = {\n failedResolutionPath: '/',\n notFoundResolutionPath: '/',\n};\n\n/**\n * The token holding the runtime configuration for the behavior of the\n * `@daffodil/external-router` package.\n */\nexport const DAFF_EXTERNAL_ROUTER_CONFIG = new InjectionToken<\nDaffExternalRouterConfiguration\n>('DAFF_EXTERNAL_ROUTER_CONFIG', {\n providedIn: 'root',\n factory: () => daffExternalRouterConfigurationDefault,\n});\n\n/**\n * The configuration object for the external router package.\n */\nexport interface DaffExternalRouterConfiguration {\n /**\n * The path to redirect to when external route resolution fails.\n */\n failedResolutionPath: string;\n\n /**\n * The path to redirect to when the requested URL is not found.\n */\n notFoundResolutionPath: string;\n}\n","import {\n InjectionToken,\n Provider,\n} from '@angular/core';\n\nimport { DaffExternalRouterInsertionStrategy } from '../model/insertion-strategy.type';\nimport { DaffExternalRouteType } from '../model/route-type';\nimport { DaffRouteWithoutPath } from '../model/route-without-path';\nimport { DaffTypeRoutePair } from '../model/type-route-pair';\n\n/**\n * A multi-token that allows you to register route \"types\" that correspond to routes.\n */\nexport const DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE = new InjectionToken<\nDaffTypeRoutePair[]\n>('DAFF_EXTERNAL_ROUTER_RESOLVABLE_TYPE_ROUTES', {\n providedIn: 'root',\n factory: () => [],\n});\n\n/**\n * A provider used to connect a type to a route to enable dynamic route resolution at runtime.\n */\nexport function daffProvideRouteResolvableByType(typeRoutePair: DaffTypeRoutePair): Provider {\n return {\n provide: DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE,\n multi: true,\n useValue: typeRoutePair,\n };\n}\n\n/**\n * A multi-provider used to connect an array of types to their respective routes.\n */\nexport function daffProvideRoutesResolvableByType(routes: DaffTypeRoutePair[]): Provider[] {\n return routes.map((route: DaffTypeRoutePair) => ({\n provide: DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE,\n multi: true,\n useValue: route,\n }));\n}\n","import { CommonModule } from '@angular/common';\nimport {\n ModuleWithProviders,\n NgModule,\n} from '@angular/core';\n\nimport {\n DaffExternalRouterConfiguration,\n DAFF_EXTERNAL_ROUTER_CONFIG,\n daffExternalRouterConfigurationDefault,\n} from './config';\nimport { DaffTypeRoutePair } from './model/type-route-pair';\nimport { daffProvideRoutesResolvableByType } from './token/type-resolvable-routes.token';\n\n/**\n * The external `DaffExternalRouterModule` allows you to configure the\n * `@daffodil/external-router` package's behavior.\n */\n@NgModule({\n declarations: [],\n imports: [CommonModule],\n})\nexport class DaffExternalRouterModule {\n static forRoot(\n config: Partial<DaffExternalRouterConfiguration>,\n routes: DaffTypeRoutePair[] = [],\n ): ModuleWithProviders<DaffExternalRouterModule> {\n return {\n ngModule: DaffExternalRouterModule,\n providers: [\n { provide: DAFF_EXTERNAL_ROUTER_CONFIG, useValue: { ...daffExternalRouterConfigurationDefault, ...config }},\n ...daffProvideRoutesResolvableByType(routes),\n ],\n };\n }\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\n/**\n * An error thrown when there was no wildcard route found in configuration\n * of the Angular Router.\n */\nexport class DaffExternalRouterNoWildcardError extends DaffInheritableError\n implements DaffError {\n public readonly code: string = 'NO_WILDCARD_ROUTE';\n\n constructor(message?: string) {\n\t super(message);\n }\n}\n","import {\n Route,\n Routes,\n} from '@angular/router';\n\nimport { DaffExternalRouterNoWildcardError } from '../../errors/no-wildcard';\nimport { DaffExternalRouterInsertionStrategy } from '../../model/insertion-strategy.type';\n\n/**\n * Inserts a Route into Routes right before the wildcard route.\n * If no wildcard is found, it fails fast with a `DaffExternalRouterNoWildcardError`.\n */\nexport const daffInsertRouteBeforeWildCardStrategy: DaffExternalRouterInsertionStrategy = (\n route: Route,\n routes: Routes,\n): Routes => {\n const index = routes.findIndex((r: Route) => r.path === '**');\n if (index === -1) {\n throw new DaffExternalRouterNoWildcardError(\n 'No wildcard (**) route was found during route resolution.',\n );\n }\n return [\n ...routes.slice(0, index),\n route,\n ...routes.slice(index),\n ];\n};\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\n/**\n * An error thrown when there is a failure matching a configured route to a\n * route type.\n */\nexport class DaffExternalRouterUnknownRouteTypeError extends DaffInheritableError\n implements DaffError {\n public readonly code: string = 'UNKNOWN_ROUTE_TYPE';\n\n constructor(message?: string) {\n\t super(message);\n }\n}\n","import { DaffExternalRouterUnknownRouteTypeError } from '../errors/unknown-type';\nimport { DaffExternallyResolvableUrl } from '../model/resolvable-route';\nimport { DaffRouteInfo } from '../model/route-info';\nimport { DaffTypeRoutePair } from '../model/type-route-pair';\n\n/**\n * Transforms a DaffExternallyResolvableUrl into an Angular Route.\n */\nexport const daffTransformResolvedRouteToRoute = (\n resolvedRoute: DaffExternallyResolvableUrl,\n availableTypes: DaffTypeRoutePair[],\n): DaffRouteInfo => {\n const routeType = availableTypes\n .filter(t => t.type === resolvedRoute.type)\n .shift();\n if (!routeType) {\n throw new DaffExternalRouterUnknownRouteTypeError(\n `Unable to resolve the route '${resolvedRoute.url}'. Its type is '${resolvedRoute.type}' but a matching route wasn't found.`,\n );\n }\n\n return {\n route: {\n path: resolvedRoute.url,\n daffExternalRouteType: resolvedRoute.type,\n ...routeType.route,\n data: {\n ...resolvedRoute.data,\n },\n },\n insertionStrategy: routeType.insertionStrategy,\n };\n};\n","import {\n Inject,\n Injectable,\n} from '@angular/core';\nimport {\n Router,\n Route,\n} from '@angular/router';\n\n\nimport { daffInsertRouteBeforeWildCardStrategy } from './strategies/insert-route-before-wildcard';\nimport { DaffExternalRouterNoWildcardError } from '../errors/no-wildcard';\nimport { DaffExternallyResolvableUrl } from '../model/resolvable-route';\nimport { DaffTypeRoutePair } from '../model/type-route-pair';\nimport { DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE } from '../token/type-resolvable-routes.token';\nimport { daffTransformResolvedRouteToRoute } from '../transform/resolved-route-to-route';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffExternalRouter {\n constructor(\n private router: Router,\n @Inject(DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE)\n private runtimeRoutes: DaffTypeRoutePair[],\n ) { }\n\n /**\n * Adds a route to the existing router configuration.\n */\n add(resolvedRoute: DaffExternallyResolvableUrl) {\n //Get the route.\n const {\n route,\n insertionStrategy,\n } = daffTransformResolvedRouteToRoute(\n resolvedRoute,\n this.runtimeRoutes,\n );\n\n try {\n //Add it to configuration.\n this.router.config = (insertionStrategy || daffInsertRouteBeforeWildCardStrategy)(route, this.router.config);\n } catch (e) {\n if (e instanceof DaffExternalRouterNoWildcardError) {\n throw new DaffExternalRouterNoWildcardError(\n `${e.message} This usually means you have misconfigured your routes.`,\n );\n }\n\n throw e;\n }\n }\n}\n","import {\n Route,\n Routes,\n} from '@angular/router';\n\nimport { DaffExternalRouterInsertionStrategy } from '../../model/insertion-strategy.type';\nimport { DaffExternalRouteType } from '../../model/route-type';\nimport { DaffRouteWithDataPath } from '../../model/route-with-data-path';\nimport { DaffRouteWithSeoData } from '../../model/route-with-seo-data';\nimport { DaffRouteWithType } from '../../model/route-with-type';\n\ntype RouteOperator = (route: Route) => Route;\ntype ExternalRouteOperator = (route: DaffRouteWithDataPath, externalRoute: Route) => Route;\ntype InsertionOperatorFactory = (externalRoute: Route) => RouteOperator;\n\n/**\n * Tests whether or not a route matches a specific Daffodil Route type.\n *\n * See {@link DaffRouteWithDataPath}\n */\nconst routeMatchesRouteType = (route: Route, type: DaffExternalRouteType): boolean => route?.data?.daffExternalRouteType === type;\n\n/**\n * Adds a path to the `daffPaths` of the given route.\n *\n * See {@link DaffRouteWithDataPath}\n */\nconst addRouteToDaffPaths: ExternalRouteOperator =\n (route: DaffRouteWithDataPath, externalRoute: Route) => {\n route.data.daffPaths = {\n ...route.data.daffPaths,\n [externalRoute.path]: externalRoute.data,\n };\n return route;\n };\n\nconst operateOnRoute: InsertionOperatorFactory =\n (externalRoute: Route) => (route: DaffRouteWithDataPath) => addRouteToDaffPaths(route, externalRoute);\n\n/**\n * Traverse the router config tree, halting after the first match.\n * This traversal is implemented in a pre-order manner. As such, for large\n * configuration trees, it will be most efficient to place externally routed\n * components at the top of router configuration.\n */\nconst traverseRouteTree = (routes: Routes = [], matcher: (route: Route) => boolean, operate: RouteOperator): Routes => {\n if(routes.length === 0) {\n return routes;\n }\n\n const stack: Routes = [];\n const treeRoot = { children: routes };\n stack.push(treeRoot);\n\n while(stack.length) {\n const route = stack.pop();\n if(matcher(route)) {\n operate(route);\n break;\n }\n if(route.children){\n stack.push(...route.children.reverse());\n }\n }\n return routes;\n};\n\n/**\n * A route insertion strategy that can be used to append external routes onto\n * existing Angular routes. This can be useful when you need to route to\n * an existing lazy-loaded module from multiple externally defined urls.\n *\n * This should be used in combination with the {@link daffDataPathUrlMatcher} to match lazy-loaded modules with\n * associated external urls.\n *\n * For example, you can provide the insertion strategy in the {@link DaffExternalRouterModule} as below.\n *\n * ```ts\n * DaffExternalRouterModule.forRoot({}, [\n * {\n * type: 'CATEGORY',\n * insertionStrategy: daffInsertDataPathStrategy,\n * route: {}\n * }\n * ],\n * ```\n *\n * Then, you can match it with an associated route defined in your Routing\n * configuration with the {@link daffDataPathUrlMatcher}.\n *\n * ```ts\n * export const routes: Routes = [\n * {\n * matcher: daffDataPathUrlMatcher,\n * data: {\n * daffExternalRouteType: \"CATEGORY\",\n * },\n * loadChildren: () => import('./category/category.module').then((m) => m.MyCategoryModule),\n * }\n * ]\n * ```\n *\n * See {@link DaffRouteWithDataPath}\n *\n */\nexport const daffInsertDataPathStrategy: DaffExternalRouterInsertionStrategy = (externalRoute: DaffRouteWithType & DaffRouteWithSeoData, routes: Routes) => traverseRouteTree(\n routes,\n (route) => routeMatchesRouteType(route, externalRoute.daffExternalRouteType),\n operateOnRoute(externalRoute),\n);\n","import {\n UrlMatcher,\n UrlSegment,\n UrlSegmentGroup,\n} from '@angular/router';\n\nimport { daffUriTruncateLeadingSlash } from '@daffodil/core/routing';\n\nimport { DaffRouteWithDataPath } from '../../model/public_api';\n\n/**\n * A UrlMatcher that does an exact match against a path stored in the special\n * configuration fields that External Router stores on a Route's data.\n *\n * ```ts\n * export const routes: Routes = [\n * {\n * matcher: daffDataPathUrlMatcher,\n * data: {\n * daffExternalRouteType: \"CATEGORY\",\n * },\n * loadChildren: () => import('./category/category.module').then((m) => m.ShopCategoryModule),\n * }\n * ]\n * ```\n * {@link daffInsertDataPathStrategy }\n * {@link DaffRouteWithDataPath }\n */\nexport const daffDataPathUrlMatcher: UrlMatcher = (segments: UrlSegment[], group: UrlSegmentGroup, route: DaffRouteWithDataPath) => {\n const path = daffUriTruncateLeadingSlash(segments.reduce((acc: string, segment) => acc + '/' + segment.path, ''));\n const paths = route?.data?.daffPaths;\n\n // If we don't have any paths, we can safely fail a match.\n if(!paths) {\n return null;\n }\n\n // Otherwise, look up the path in the dictionary, failing if a match isn't found,\n // but matching the entire segment if a match is found.\n return path in paths ? { consumed: segments } : null;\n};\n\n","import {\n ActivatedRouteSnapshot,\n Data,\n} from '@angular/router';\n\n/**\n * Extracts a key from DaffPath data based upon the currently activated\n * RouteSnapshot.\n */\nexport const daffExtractDaffPathData = <T extends Data = Data, K extends keyof T = keyof T>(snapshot: ActivatedRouteSnapshot, key: K): T[K] => {\n const pathFromRoot = snapshot.pathFromRoot.flatMap((route) => route.url).map((seg) => seg.path).join('/');\n return snapshot.data?.daffPaths?.[pathFromRoot]?.[key] ?? null;\n};\n","/*\n * Public API Surface of @daffodil/external-router\n */\n\nexport { DaffExternalRouterModule } from './external-router.module';\n\nexport {\n DAFF_EXTERNAL_ROUTER_CONFIG,\n DaffExternalRouterConfiguration,\n} from './config';\n\nexport { daffProvideRouteResolvableByType } from './token/type-resolvable-routes.token';\n\nexport * from './model/public_api';\n\nexport { DaffExternalRouter } from './router/router.service';\nexport { daffInsertRouteBeforeWildCardStrategy } from './router/strategies/insert-route-before-wildcard';\n\nexport { daffInsertDataPathStrategy } from './router/strategies/insert-data-path';\nexport { daffDataPathUrlMatcher } from './router/url-matcher/data-path-matcher';\n\nexport { DaffExternalRouterNoWildcardError } from './errors/no-wildcard';\nexport { DaffExternalRouterUnknownRouteTypeError } from './errors/unknown-type';\n\nexport { daffExtractDaffPathData } from './util/extract-daff-path-data';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAEO,MAAM,sCAAsC,GAAoC;AACrF,IAAA,oBAAoB,EAAE,GAAG;AACzB,IAAA,sBAAsB,EAAE,GAAG;CAC5B,CAAC;AAEF;;;AAGG;MACU,2BAA2B,GAAG,IAAI,cAAc,CAE3D,6BAA6B,EAAE;AAC/B,IAAA,UAAU,EAAE,MAAM;AAClB,IAAA,OAAO,EAAE,MAAM,sCAAsC;AACtD,CAAA;;ACND;;AAEG;AACI,MAAM,8CAA8C,GAAG,IAAI,cAAc,CAE9E,6CAA6C,EAAE;AAC/C,IAAA,UAAU,EAAE,MAAM;AAClB,IAAA,OAAO,EAAE,MAAM,EAAE;AAClB,CAAA,CAAC,CAAC;AAEH;;AAEG;AACG,SAAU,gCAAgC,CAAC,aAAgC,EAAA;IAC/E,OAAO;AACL,QAAA,OAAO,EAAE,8CAA8C;AACvD,QAAA,KAAK,EAAE,IAAI;AACX,QAAA,QAAQ,EAAE,aAAa;KACxB,CAAC;AACJ,CAAC;AAED;;AAEG;AACG,SAAU,iCAAiC,CAAC,MAA2B,EAAA;IAC3E,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAwB,MAAM;AAC/C,QAAA,OAAO,EAAE,8CAA8C;AACvD,QAAA,KAAK,EAAE,IAAI;AACX,QAAA,QAAQ,EAAE,KAAK;AAChB,KAAA,CAAC,CAAC,CAAC;AACN;;AC1BA;;;AAGG;MAKU,wBAAwB,CAAA;AACnC,IAAA,OAAO,OAAO,CACZ,MAAgD,EAChD,SAA8B,EAAE,EAAA;QAEhC,OAAO;AACL,YAAA,QAAQ,EAAE,wBAAwB;AAClC,YAAA,SAAS,EAAE;AACT,gBAAA,EAAE,OAAO,EAAE,2BAA2B,EAAE,QAAQ,EAAE,EAAE,GAAG,sCAAsC,EAAE,GAAG,MAAM,E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/external-router/src/config.ts","../../../libs/external-router/src/token/type-resolvable-routes.token.ts","../../../libs/external-router/src/external-router.module.ts","../../../libs/external-router/src/errors/no-wildcard.ts","../../../libs/external-router/src/router/strategies/insert-route-before-wildcard.ts","../../../libs/external-router/src/errors/unknown-type.ts","../../../libs/external-router/src/transform/resolved-route-to-route.ts","../../../libs/external-router/src/router/router.service.ts","../../../libs/external-router/src/router/strategies/insert-data-path.ts","../../../libs/external-router/src/router/url-matcher/data-path-matcher.ts","../../../libs/external-router/src/util/extract-daff-path-data.ts","../../../libs/external-router/src/public_api.ts","../../../libs/external-router/src/daffodil-external-router.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nexport const daffExternalRouterConfigurationDefault: DaffExternalRouterConfiguration = {\n failedResolutionPath: '/',\n notFoundResolutionPath: '/',\n};\n\n/**\n * The token holding the runtime configuration for the behavior of the\n * `@daffodil/external-router` package.\n */\nexport const DAFF_EXTERNAL_ROUTER_CONFIG = new InjectionToken<\n DaffExternalRouterConfiguration\n>('DAFF_EXTERNAL_ROUTER_CONFIG', {\n providedIn: 'root',\n factory: () => daffExternalRouterConfigurationDefault,\n});\n\n/**\n * The configuration object for the external router package.\n */\nexport interface DaffExternalRouterConfiguration {\n /**\n * The path to redirect to when external route resolution fails.\n */\n failedResolutionPath: string;\n\n /**\n * The path to redirect to when the requested URL is not found.\n */\n notFoundResolutionPath: string;\n}\n","import {\n InjectionToken,\n Provider,\n} from '@angular/core';\n\nimport { DaffExternalRouterInsertionStrategy } from '../model/insertion-strategy.type';\nimport { DaffExternalRouteType } from '../model/route-type';\nimport { DaffRouteWithoutPath } from '../model/route-without-path';\nimport { DaffTypeRoutePair } from '../model/type-route-pair';\n\n/**\n * A multi-token that allows you to register route \"types\" that correspond to routes.\n */\nexport const DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE = new InjectionToken<\n DaffTypeRoutePair[]\n>('DAFF_EXTERNAL_ROUTER_RESOLVABLE_TYPE_ROUTES', {\n providedIn: 'root',\n factory: () => [],\n});\n\n/**\n * A provider used to connect a type to a route to enable dynamic route resolution at runtime.\n */\nexport function daffProvideRouteResolvableByType(typeRoutePair: DaffTypeRoutePair): Provider {\n return {\n provide: DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE,\n multi: true,\n useValue: typeRoutePair,\n };\n}\n\n/**\n * A multi-provider used to connect an array of types to their respective routes.\n */\nexport function daffProvideRoutesResolvableByType(routes: DaffTypeRoutePair[]): Provider[] {\n return routes.map((route: DaffTypeRoutePair) => ({\n provide: DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE,\n multi: true,\n useValue: route,\n }));\n}\n","import { CommonModule } from '@angular/common';\nimport {\n ModuleWithProviders,\n NgModule,\n} from '@angular/core';\n\nimport {\n DaffExternalRouterConfiguration,\n DAFF_EXTERNAL_ROUTER_CONFIG,\n daffExternalRouterConfigurationDefault,\n} from './config';\nimport { DaffTypeRoutePair } from './model/type-route-pair';\nimport { daffProvideRoutesResolvableByType } from './token/type-resolvable-routes.token';\n\n/**\n * The external `DaffExternalRouterModule` allows you to configure the\n * `@daffodil/external-router` package's behavior.\n */\n@NgModule({\n declarations: [],\n imports: [CommonModule],\n})\nexport class DaffExternalRouterModule {\n static forRoot(\n config: Partial<DaffExternalRouterConfiguration>,\n routes: DaffTypeRoutePair[] = [],\n ): ModuleWithProviders<DaffExternalRouterModule> {\n return {\n ngModule: DaffExternalRouterModule,\n providers: [\n { provide: DAFF_EXTERNAL_ROUTER_CONFIG, useValue: { ...daffExternalRouterConfigurationDefault, ...config }},\n ...daffProvideRoutesResolvableByType(routes),\n ],\n };\n }\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\n/**\n * An error thrown when there was no wildcard route found in configuration\n * of the Angular Router.\n */\nexport class DaffExternalRouterNoWildcardError extends DaffInheritableError\n implements DaffError {\n public readonly code: string = 'NO_WILDCARD_ROUTE';\n\n constructor(message?: string) {\n super(message);\n }\n}\n","import {\n Route,\n Routes,\n} from '@angular/router';\n\nimport { DaffExternalRouterNoWildcardError } from '../../errors/no-wildcard';\nimport { DaffExternalRouterInsertionStrategy } from '../../model/insertion-strategy.type';\n\n/**\n * Inserts a Route into Routes right before the wildcard route.\n * If no wildcard is found, it fails fast with a `DaffExternalRouterNoWildcardError`.\n */\nexport const daffInsertRouteBeforeWildCardStrategy: DaffExternalRouterInsertionStrategy = (\n route: Route,\n routes: Routes,\n): Routes => {\n const index = routes.findIndex((r: Route) => r.path === '**');\n if (index === -1) {\n throw new DaffExternalRouterNoWildcardError(\n 'No wildcard (**) route was found during route resolution.',\n );\n }\n return [\n ...routes.slice(0, index),\n route,\n ...routes.slice(index),\n ];\n};\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\n/**\n * An error thrown when there is a failure matching a configured route to a\n * route type.\n */\nexport class DaffExternalRouterUnknownRouteTypeError extends DaffInheritableError\n implements DaffError {\n public readonly code: string = 'UNKNOWN_ROUTE_TYPE';\n\n constructor(message?: string) {\n super(message);\n }\n}\n","import { DaffExternalRouterUnknownRouteTypeError } from '../errors/unknown-type';\nimport { DaffExternallyResolvableUrl } from '../model/resolvable-route';\nimport { DaffRouteInfo } from '../model/route-info';\nimport { DaffTypeRoutePair } from '../model/type-route-pair';\n\n/**\n * Transforms a DaffExternallyResolvableUrl into an Angular Route.\n */\nexport const daffTransformResolvedRouteToRoute = (\n resolvedRoute: DaffExternallyResolvableUrl,\n availableTypes: DaffTypeRoutePair[],\n): DaffRouteInfo => {\n const routeType = availableTypes\n .filter(t => t.type === resolvedRoute.type)\n .shift();\n if (!routeType) {\n throw new DaffExternalRouterUnknownRouteTypeError(\n `Unable to resolve the route '${resolvedRoute.url}'. Its type is '${resolvedRoute.type}' but a matching route wasn't found.`,\n );\n }\n\n return {\n route: {\n path: resolvedRoute.url,\n daffExternalRouteType: resolvedRoute.type,\n ...routeType.route,\n data: {\n ...resolvedRoute.data,\n },\n },\n insertionStrategy: routeType.insertionStrategy,\n };\n};\n","import {\n Inject,\n Injectable,\n} from '@angular/core';\nimport {\n Router,\n Route,\n} from '@angular/router';\n\n\nimport { daffInsertRouteBeforeWildCardStrategy } from './strategies/insert-route-before-wildcard';\nimport { DaffExternalRouterNoWildcardError } from '../errors/no-wildcard';\nimport { DaffExternallyResolvableUrl } from '../model/resolvable-route';\nimport { DaffTypeRoutePair } from '../model/type-route-pair';\nimport { DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE } from '../token/type-resolvable-routes.token';\nimport { daffTransformResolvedRouteToRoute } from '../transform/resolved-route-to-route';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffExternalRouter {\n constructor(\n private router: Router,\n @Inject(DAFF_EXTERNAL_ROUTER_ROUTES_RESOLVABLE_BY_TYPE)\n private runtimeRoutes: DaffTypeRoutePair[],\n ) { }\n\n /**\n * Adds a route to the existing router configuration.\n */\n add(resolvedRoute: DaffExternallyResolvableUrl) {\n //Get the route.\n const {\n route,\n insertionStrategy,\n } = daffTransformResolvedRouteToRoute(\n resolvedRoute,\n this.runtimeRoutes,\n );\n\n try {\n //Add it to configuration.\n this.router.config = (insertionStrategy || daffInsertRouteBeforeWildCardStrategy)(route, this.router.config);\n } catch (e) {\n if (e instanceof DaffExternalRouterNoWildcardError) {\n throw new DaffExternalRouterNoWildcardError(\n `${e.message} This usually means you have misconfigured your routes.`,\n );\n }\n\n throw e;\n }\n }\n}\n","import {\n Route,\n Routes,\n} from '@angular/router';\n\nimport { DaffExternalRouterInsertionStrategy } from '../../model/insertion-strategy.type';\nimport { DaffExternalRouteType } from '../../model/route-type';\nimport { DaffRouteWithDataPath } from '../../model/route-with-data-path';\nimport { DaffRouteWithSeoData } from '../../model/route-with-seo-data';\nimport { DaffRouteWithType } from '../../model/route-with-type';\n\ntype RouteOperator = (route: Route) => Route;\ntype ExternalRouteOperator = (route: DaffRouteWithDataPath, externalRoute: Route) => Route;\ntype InsertionOperatorFactory = (externalRoute: Route) => RouteOperator;\n\n/**\n * Tests whether or not a route matches a specific Daffodil Route type.\n *\n * See {@link DaffRouteWithDataPath}\n */\nconst routeMatchesRouteType = (route: Route, type: DaffExternalRouteType): boolean => route?.data?.daffExternalRouteType === type;\n\n/**\n * Adds a path to the `daffPaths` of the given route.\n *\n * See {@link DaffRouteWithDataPath}\n */\nconst addRouteToDaffPaths: ExternalRouteOperator =\n (route: DaffRouteWithDataPath, externalRoute: Route) => {\n route.data.daffPaths = {\n ...route.data.daffPaths,\n [externalRoute.path]: externalRoute.data,\n };\n return route;\n };\n\nconst operateOnRoute: InsertionOperatorFactory =\n (externalRoute: Route) => (route: DaffRouteWithDataPath) => addRouteToDaffPaths(route, externalRoute);\n\n/**\n * Traverse the router config tree, halting after the first match.\n * This traversal is implemented in a pre-order manner. As such, for large\n * configuration trees, it will be most efficient to place externally routed\n * components at the top of router configuration.\n */\nconst traverseRouteTree = (routes: Routes = [], matcher: (route: Route) => boolean, operate: RouteOperator): Routes => {\n if(routes.length === 0) {\n return routes;\n }\n\n const stack: Routes = [];\n const treeRoot = { children: routes };\n stack.push(treeRoot);\n\n while(stack.length) {\n const route = stack.pop();\n if(matcher(route)) {\n operate(route);\n break;\n }\n if(route.children){\n stack.push(...route.children.reverse());\n }\n }\n return routes;\n};\n\n/**\n * A route insertion strategy that can be used to append external routes onto\n * existing Angular routes. This can be useful when you need to route to\n * an existing lazy-loaded module from multiple externally defined urls.\n *\n * This should be used in combination with the {@link daffDataPathUrlMatcher} to match lazy-loaded modules with\n * associated external urls.\n *\n * For example, you can provide the insertion strategy in the {@link DaffExternalRouterModule} as below.\n *\n * ```ts\n * DaffExternalRouterModule.forRoot({}, [\n * {\n * type: 'CATEGORY',\n * insertionStrategy: daffInsertDataPathStrategy,\n * route: {}\n * }\n * ],\n * ```\n *\n * Then, you can match it with an associated route defined in your Routing\n * configuration with the {@link daffDataPathUrlMatcher}.\n *\n * ```ts\n * export const routes: Routes = [\n * {\n * matcher: daffDataPathUrlMatcher,\n * data: {\n * daffExternalRouteType: \"CATEGORY\",\n * },\n * loadChildren: () => import('./category/category.module').then((m) => m.MyCategoryModule),\n * }\n * ]\n * ```\n *\n * See {@link DaffRouteWithDataPath}\n *\n */\nexport const daffInsertDataPathStrategy: DaffExternalRouterInsertionStrategy = (externalRoute: DaffRouteWithType & DaffRouteWithSeoData, routes: Routes) => traverseRouteTree(\n routes,\n (route) => routeMatchesRouteType(route, externalRoute.daffExternalRouteType),\n operateOnRoute(externalRoute),\n);\n","import {\n UrlMatcher,\n UrlSegment,\n UrlSegmentGroup,\n} from '@angular/router';\n\nimport { daffUriTruncateLeadingSlash } from '@daffodil/core/routing';\n\nimport { DaffRouteWithDataPath } from '../../model/public_api';\n\n/**\n * A UrlMatcher that does an exact match against a path stored in the special\n * configuration fields that External Router stores on a Route's data.\n *\n * ```ts\n * export const routes: Routes = [\n * {\n * matcher: daffDataPathUrlMatcher,\n * data: {\n * daffExternalRouteType: \"CATEGORY\",\n * },\n * loadChildren: () => import('./category/category.module').then((m) => m.ShopCategoryModule),\n * }\n * ]\n * ```\n * {@link daffInsertDataPathStrategy }\n * {@link DaffRouteWithDataPath }\n */\nexport const daffDataPathUrlMatcher: UrlMatcher = (segments: UrlSegment[], group: UrlSegmentGroup, route: DaffRouteWithDataPath) => {\n const path = daffUriTruncateLeadingSlash(segments.reduce((acc: string, segment) => acc + '/' + segment.path, ''));\n const paths = route?.data?.daffPaths;\n\n // If we don't have any paths, we can safely fail a match.\n if(!paths) {\n return null;\n }\n\n // Otherwise, look up the path in the dictionary, failing if a match isn't found,\n // but matching the entire segment if a match is found.\n return path in paths ? { consumed: segments } : null;\n};\n\n","import {\n ActivatedRouteSnapshot,\n Data,\n} from '@angular/router';\n\n/**\n * Extracts a key from DaffPath data based upon the currently activated\n * RouteSnapshot.\n */\nexport const daffExtractDaffPathData = <T extends Data = Data, K extends keyof T = keyof T>(snapshot: ActivatedRouteSnapshot, key: K): T[K] => {\n const pathFromRoot = snapshot.pathFromRoot.flatMap((route) => route.url).map((seg) => seg.path).join('/');\n return snapshot.data?.daffPaths?.[pathFromRoot]?.[key] ?? null;\n};\n","/*\n * Public API Surface of @daffodil/external-router\n */\n\nexport { DaffExternalRouterModule } from './external-router.module';\n\nexport {\n DAFF_EXTERNAL_ROUTER_CONFIG,\n DaffExternalRouterConfiguration,\n} from './config';\n\nexport { daffProvideRouteResolvableByType } from './token/type-resolvable-routes.token';\n\nexport * from './model/public_api';\n\nexport { DaffExternalRouter } from './router/router.service';\nexport { daffInsertRouteBeforeWildCardStrategy } from './router/strategies/insert-route-before-wildcard';\n\nexport { daffInsertDataPathStrategy } from './router/strategies/insert-data-path';\nexport { daffDataPathUrlMatcher } from './router/url-matcher/data-path-matcher';\n\nexport { DaffExternalRouterNoWildcardError } from './errors/no-wildcard';\nexport { DaffExternalRouterUnknownRouteTypeError } from './errors/unknown-type';\n\nexport { daffExtractDaffPathData } from './util/extract-daff-path-data';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAEO,MAAM,sCAAsC,GAAoC;AACrF,IAAA,oBAAoB,EAAE,GAAG;AACzB,IAAA,sBAAsB,EAAE,GAAG;CAC5B,CAAC;AAEF;;;AAGG;MACU,2BAA2B,GAAG,IAAI,cAAc,CAE3D,6BAA6B,EAAE;AAC/B,IAAA,UAAU,EAAE,MAAM;AAClB,IAAA,OAAO,EAAE,MAAM,sCAAsC;AACtD,CAAA;;ACND;;AAEG;AACI,MAAM,8CAA8C,GAAG,IAAI,cAAc,CAE9E,6CAA6C,EAAE;AAC/C,IAAA,UAAU,EAAE,MAAM;AAClB,IAAA,OAAO,EAAE,MAAM,EAAE;AAClB,CAAA,CAAC,CAAC;AAEH;;AAEG;AACG,SAAU,gCAAgC,CAAC,aAAgC,EAAA;IAC/E,OAAO;AACL,QAAA,OAAO,EAAE,8CAA8C;AACvD,QAAA,KAAK,EAAE,IAAI;AACX,QAAA,QAAQ,EAAE,aAAa;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I,CAAC;AACxD;;ACnCA;;;AAGG;MACU,uBAAuB,GAAG,CAAqD,QAAgC,EAAE,GAAM,KAAU;AAC5I,IAAA,MAAM,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC1G,IAAA,OAAO,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,YAAY,CAAC,GAAG,GAAG,CAAC,IAAI,IAAI,CAAC;AACjE;;ACZA;;AAEG;;ACFH;;AAEG;;;;"}
|
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.77.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":"^18.2.2","@angular/core":"^18.2.2","@angular/router":"^18.2.2","@daffodil/core":"0.77.0","rxjs":"7.8.1"},"optionalDependencies":{"apollo-angular":"^7.1.2","@daffodil/driver":"0.77.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"}}
|