diff --git a/libs/category/driver/magento/src/category-driver.module.ts b/libs/category/driver/magento/src/category-driver.module.ts index 8d591a0113..9a4190cd91 100644 --- a/libs/category/driver/magento/src/category-driver.module.ts +++ b/libs/category/driver/magento/src/category-driver.module.ts @@ -5,7 +5,7 @@ import { } from '@angular/core'; import { provideDaffCategoryDriver } from '@daffodil/category/driver'; -import { DAFF_MAGENTO_CACHEABLE_OPERATIONS } from '@daffodil/driver/magento'; +import { provideManyDaffMagentoCacheableOperations } from '@daffodil/driver/magento'; import { DAFF_MAGENTO_GET_FILTER_TYPES_QUERY_NAME } from '@daffodil/product/driver/magento'; import { DaffMagentoCategoryService } from './category.service'; @@ -42,21 +42,11 @@ export class DaffCategoryMagentoDriverModule { DaffMagentoCategoryResponseTransformService, DaffMagentoCategoryTransformerService, DaffMagentoAppliedFiltersTransformService, - { - provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS, - useValue: DAFF_MAGENTO_GET_FILTER_TYPES_QUERY_NAME, - multi: true, - }, - { - provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS, - useValue: DAFF_MAGENTO_GET_CATEGORY_AND_PRODUCTS_QUERY_NAME, - multi: true, - }, - { - provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS, - useValue: DAFF_MAGENTO_RESOLVE_CATEGORY_URL_QUERY_NAME, - multi: true, - }, + provideManyDaffMagentoCacheableOperations( + DAFF_MAGENTO_GET_FILTER_TYPES_QUERY_NAME, + DAFF_MAGENTO_GET_CATEGORY_AND_PRODUCTS_QUERY_NAME, + DAFF_MAGENTO_RESOLVE_CATEGORY_URL_QUERY_NAME, + ), provideMagentoCategoryConfig(config), ], }; diff --git a/libs/external-router/driver/magento/2.4.1/src/magento.module.ts b/libs/external-router/driver/magento/2.4.1/src/magento.module.ts index 96b27bb1ac..f34f4adfc3 100644 --- a/libs/external-router/driver/magento/2.4.1/src/magento.module.ts +++ b/libs/external-router/driver/magento/2.4.1/src/magento.module.ts @@ -4,7 +4,7 @@ import { ModuleWithProviders, } from '@angular/core'; -import { DAFF_MAGENTO_CACHEABLE_OPERATIONS } from '@daffodil/driver/magento'; +import { provideDaffMagentoCacheableOperation } from '@daffodil/driver/magento'; import { provideDaffExternalRouterDriver } from '@daffodil/external-router/driver'; import { DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME } from './graphql/queries/resolve-url-v2.4.1'; @@ -39,11 +39,7 @@ export class DaffExternalRouterDriverMagentoModule { ngModule: DaffExternalRouterDriverMagentoModule, providers: [ provideDaffExternalRouterDriver(DaffExternalRouterMagentoDriver), - { - provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS, - useValue: DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME, - multi: true, - }, + provideDaffMagentoCacheableOperation(DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME), ], }; } diff --git a/libs/external-router/driver/magento/2.4.2/src/magento.module.ts b/libs/external-router/driver/magento/2.4.2/src/magento.module.ts index e1aa4707cb..b6e490364c 100644 --- a/libs/external-router/driver/magento/2.4.2/src/magento.module.ts +++ b/libs/external-router/driver/magento/2.4.2/src/magento.module.ts @@ -4,7 +4,7 @@ import { ModuleWithProviders, } from '@angular/core'; -import { DAFF_MAGENTO_CACHEABLE_OPERATIONS } from '@daffodil/driver/magento'; +import { provideDaffMagentoCacheableOperation } from '@daffodil/driver/magento'; import { provideDaffExternalRouterDriver } from '@daffodil/external-router/driver'; import { DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME } from './graphql/queries/resolve-url-v2.4.2'; @@ -40,11 +40,7 @@ export class DaffExternalRouterDriverMagentoModule { ngModule: DaffExternalRouterDriverMagentoModule, providers: [ provideDaffExternalRouterDriver(DaffExternalRouterMagentoDriver), - { - provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS, - useValue: DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME, - multi: true, - }, + provideDaffMagentoCacheableOperation(DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME), ], }; } diff --git a/libs/external-router/driver/magento/2.4.3/src/magento.module.ts b/libs/external-router/driver/magento/2.4.3/src/magento.module.ts index e0532eceb8..29c52f3958 100644 --- a/libs/external-router/driver/magento/2.4.3/src/magento.module.ts +++ b/libs/external-router/driver/magento/2.4.3/src/magento.module.ts @@ -4,7 +4,7 @@ import { ModuleWithProviders, } from '@angular/core'; -import { DAFF_MAGENTO_CACHEABLE_OPERATIONS } from '@daffodil/driver/magento'; +import { provideDaffMagentoCacheableOperation } from '@daffodil/driver/magento'; import { provideDaffExternalRouterDriver } from '@daffodil/external-router/driver'; import { DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME } from './graphql/queries/resolve'; @@ -40,11 +40,7 @@ export class DaffExternalRouterDriverMagentoModule { ngModule: DaffExternalRouterDriverMagentoModule, providers: [ provideDaffExternalRouterDriver(DaffExternalRouterMagentoDriver), - { - provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS, - useValue: DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME, - multi: true, - }, + provideDaffMagentoCacheableOperation(DAFF_MAGENTO_RESOLVE_URL_QUERY_NAME), ], }; } diff --git a/libs/geography/driver/magento/src/geography-driver.module.ts b/libs/geography/driver/magento/src/geography-driver.module.ts index 385d5373d6..a1a566cca7 100644 --- a/libs/geography/driver/magento/src/geography-driver.module.ts +++ b/libs/geography/driver/magento/src/geography-driver.module.ts @@ -4,7 +4,7 @@ import { ModuleWithProviders, } from '@angular/core'; -import { DAFF_MAGENTO_CACHEABLE_OPERATIONS } from '@daffodil/driver/magento'; +import { provideDaffMagentoCacheableOperation } from '@daffodil/driver/magento'; import { provideDaffGeographyDriver } from '@daffodil/geography/driver'; import { DaffGeographyMagentoService } from './geography.service'; @@ -24,16 +24,8 @@ export class DaffGeographyMagentoDriverModule { ngModule: DaffGeographyMagentoDriverModule, providers: [ provideDaffGeographyDriver(DaffGeographyMagentoService), - { - provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS, - useValue: MAGENTO_GET_COUNTRY_QUERY_NAME, - multi: true, - }, - { - provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS, - useValue: MAGENTO_GET_COUNTRIES_QUERY_NAME, - multi: true, - }, + provideDaffMagentoCacheableOperation(MAGENTO_GET_COUNTRY_QUERY_NAME), + provideDaffMagentoCacheableOperation(MAGENTO_GET_COUNTRIES_QUERY_NAME), ], }; } diff --git a/libs/navigation/driver/magento/src/navigation-driver.module.ts b/libs/navigation/driver/magento/src/navigation-driver.module.ts index c6097a51f9..53d04a5e75 100644 --- a/libs/navigation/driver/magento/src/navigation-driver.module.ts +++ b/libs/navigation/driver/magento/src/navigation-driver.module.ts @@ -4,7 +4,7 @@ import { ModuleWithProviders, } from '@angular/core'; -import { DAFF_MAGENTO_CACHEABLE_OPERATIONS } from '@daffodil/driver/magento'; +import { provideDaffMagentoCacheableOperation } from '@daffodil/driver/magento'; import { provideDaffNavigationDriver, DaffNavigationTransformer, @@ -35,11 +35,7 @@ export class DaffNavigationMagentoDriverModule { useExisting: DaffMagentoNavigationTransformerService, }, provideMagentoNavigationDriverConfig(config), - { - provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS, - useValue: DAFF_MAGENTO_GET_CATEGORY_TREE_QUERY_NAME, - multi: true, - }, + provideDaffMagentoCacheableOperation(DAFF_MAGENTO_GET_CATEGORY_TREE_QUERY_NAME), ], }; } diff --git a/libs/product/driver/magento/src/product-driver.module.ts b/libs/product/driver/magento/src/product-driver.module.ts index 0a5dae3ada..380aa43125 100644 --- a/libs/product/driver/magento/src/product-driver.module.ts +++ b/libs/product/driver/magento/src/product-driver.module.ts @@ -4,7 +4,7 @@ import { ModuleWithProviders, } from '@angular/core'; -import { DAFF_MAGENTO_CACHEABLE_OPERATIONS } from '@daffodil/driver/magento'; +import { provideManyDaffMagentoCacheableOperations } from '@daffodil/driver/magento'; import { provideDaffProductDriver } from '@daffodil/product/driver'; import { MAGENTO_PRODUCT_CONFIG_DEFAULT } from './config/public_api'; @@ -32,21 +32,11 @@ export class DaffProductMagentoDriverModule { ngModule: DaffProductMagentoDriverModule, providers: [ provideDaffProductDriver(DaffMagentoProductService), - { - provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS, - useValue: DAFF_MAGENTO_GET_ALL_PRODUCTS_QUERY_NAME, - multi: true, - }, - { - provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS, - useValue: DAFF_MAGENTO_GET_A_PRODUCT_QUERY_NAME, - multi: true, - }, - { - provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS, - useValue: DAFF_MAGENTO_GET_A_PRODUCT_BY_URL_QUERY_NAME, - multi: true, - }, + provideManyDaffMagentoCacheableOperations( + DAFF_MAGENTO_GET_ALL_PRODUCTS_QUERY_NAME, + DAFF_MAGENTO_GET_A_PRODUCT_QUERY_NAME, + DAFF_MAGENTO_GET_A_PRODUCT_BY_URL_QUERY_NAME, + ), provideMagentoProductConfig(config), ], }; diff --git a/libs/reviews/driver/magento/src/reviews-driver.module.ts b/libs/reviews/driver/magento/src/reviews-driver.module.ts index 37f46c603a..287d8e22de 100644 --- a/libs/reviews/driver/magento/src/reviews-driver.module.ts +++ b/libs/reviews/driver/magento/src/reviews-driver.module.ts @@ -4,7 +4,7 @@ import { ModuleWithProviders, } from '@angular/core'; -import { DAFF_MAGENTO_CACHEABLE_OPERATIONS } from '@daffodil/driver/magento'; +import { provideDaffMagentoCacheableOperation } from '@daffodil/driver/magento'; import { provideDaffProductMagentoExtraProductPreviewFragments, provideDaffProductMagentoExtraProductPreviewTransforms, @@ -35,11 +35,7 @@ export class DaffReviewsMagentoDriverModule { ...provideDaffProductMagentoExtraProductPreviewTransforms( magentoReviewedProductTransform, ), - { - provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS, - useValue: MAGENTO_REVIEWS_LIST_QUERY_NAME, - multi: true, - }, + provideDaffMagentoCacheableOperation(MAGENTO_REVIEWS_LIST_QUERY_NAME), ], }; } diff --git a/libs/search-category/driver/magento/src/driver.module.ts b/libs/search-category/driver/magento/src/driver.module.ts index 3cd585ad3d..9c55876d9b 100644 --- a/libs/search-category/driver/magento/src/driver.module.ts +++ b/libs/search-category/driver/magento/src/driver.module.ts @@ -4,7 +4,7 @@ import { ModuleWithProviders, } from '@angular/core'; -import { DAFF_MAGENTO_CACHEABLE_OPERATIONS } from '@daffodil/driver/magento'; +import { provideDaffMagentoCacheableOperation } from '@daffodil/driver/magento'; import { DAFF_SEARCH_FEDERATED_DRIVERS } from '@daffodil/search/driver/federated'; import { DaffSearchCategoryMagentoDriver } from './category-search.service'; @@ -18,11 +18,7 @@ import { DAFF_MAGENTO_SEARCH_FOR_CATEGORIES_QUERY_NAME } from './queries/categor CommonModule, ], providers: [ - { - provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS, - useValue: DAFF_MAGENTO_SEARCH_FOR_CATEGORIES_QUERY_NAME, - multi: true, - }, + provideDaffMagentoCacheableOperation(DAFF_MAGENTO_SEARCH_FOR_CATEGORIES_QUERY_NAME), ], }) export class DaffSearchCategoryMagentoDriverModule { diff --git a/libs/search-product/driver/magento/src/core.module.ts b/libs/search-product/driver/magento/src/core.module.ts index 1e318b7236..6c0abcd535 100644 --- a/libs/search-product/driver/magento/src/core.module.ts +++ b/libs/search-product/driver/magento/src/core.module.ts @@ -1,10 +1,7 @@ import { CommonModule } from '@angular/common'; -import { - NgModule, - ModuleWithProviders, -} from '@angular/core'; +import { NgModule } from '@angular/core'; -import { DAFF_MAGENTO_CACHEABLE_OPERATIONS } from '@daffodil/driver/magento'; +import { provideDaffMagentoCacheableOperation } from '@daffodil/driver/magento'; import { DAFF_MAGENTO_SEARCH_FOR_PRODUCTS_QUERY_NAME } from './queries/product-search'; @@ -16,11 +13,7 @@ import { DAFF_MAGENTO_SEARCH_FOR_PRODUCTS_QUERY_NAME } from './queries/product-s CommonModule, ], providers: [ - { - provide: DAFF_MAGENTO_CACHEABLE_OPERATIONS, - useValue: DAFF_MAGENTO_SEARCH_FOR_PRODUCTS_QUERY_NAME, - multi: true, - }, + provideDaffMagentoCacheableOperation(DAFF_MAGENTO_SEARCH_FOR_PRODUCTS_QUERY_NAME), ], }) export class DaffSearchProductMagentoCoreModule {}