From 7bedbb5c090f34d27147beb0b32a7b04355b359d Mon Sep 17 00:00:00 2001 From: Peter Lauck Date: Fri, 4 Oct 2024 19:16:42 +0000 Subject: [PATCH 1/2] feat(core,driver)!: move `DaffInMemoryDataServiceInterface` to `@daffodil/driver/in-memory` BREAKING CHANGE: `DaffInMemoryDataServiceInterface` is now exported from `@daffodil/driver/in-memory` and has been removed from `@daffodil/core/testing` --- .../cart-address/cart-address.service.ts | 2 +- .../cart-billing-address.service.ts | 2 +- .../cart-coupon/cart-coupon.service.ts | 2 +- .../backend/cart-items/cart-items.service.ts | 2 +- .../backend/cart-order/cart-order.service.ts | 2 +- .../cart-payment-methods.service.ts | 2 +- .../cart-payment/cart-payment.service.ts | 2 +- .../src/backend/cart-root.service.ts | 2 +- .../cart-shipping-address.service.ts | 2 +- .../cart-shipping-information.service.ts | 2 +- .../cart-shipping-methods.service.ts | 2 +- .../src/backend/cart/cart.service.ts | 2 +- libs/core/testing/src/public_api.ts | 1 - libs/driver/in-memory/ng-package.json | 6 +++++ .../src/backend/data-service.type.ts} | 15 +++++++++++ .../in-memory/src/backend/public_api.ts | 1 + libs/driver/in-memory/src/index.ts | 1 + libs/driver/in-memory/src/public_api.ts | 1 + libs/driver/tsconfig.json | 26 +++++++++++++++++++ libs/driver/tsconfig.spec.json | 2 +- .../src/backend/geography.service.ts | 2 +- .../in-memory/src/backend/order.service.ts | 2 +- .../in-memory/src/backend/reviews.service.ts | 2 +- 23 files changed, 66 insertions(+), 17 deletions(-) create mode 100644 libs/driver/in-memory/ng-package.json rename libs/{core/testing/src/angular/interfaces/in-memory-data-service.interface.ts => driver/in-memory/src/backend/data-service.type.ts} (76%) create mode 100644 libs/driver/in-memory/src/backend/public_api.ts create mode 100644 libs/driver/in-memory/src/index.ts create mode 100644 libs/driver/in-memory/src/public_api.ts create mode 100644 libs/driver/tsconfig.json diff --git a/libs/cart/driver/in-memory/src/backend/cart-address/cart-address.service.ts b/libs/cart/driver/in-memory/src/backend/cart-address/cart-address.service.ts index c4bf3f5964..a827865240 100644 --- a/libs/cart/driver/in-memory/src/backend/cart-address/cart-address.service.ts +++ b/libs/cart/driver/in-memory/src/backend/cart-address/cart-address.service.ts @@ -8,7 +8,7 @@ import { } from 'angular-in-memory-web-api'; import { DaffCart } from '@daffodil/cart'; -import { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing'; +import { DaffInMemoryDataServiceInterface } from '@daffodil/driver/in-memory'; import { DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK, diff --git a/libs/cart/driver/in-memory/src/backend/cart-billing-address/cart-billing-address.service.ts b/libs/cart/driver/in-memory/src/backend/cart-billing-address/cart-billing-address.service.ts index 7e89688c8f..3ebfa68261 100644 --- a/libs/cart/driver/in-memory/src/backend/cart-billing-address/cart-billing-address.service.ts +++ b/libs/cart/driver/in-memory/src/backend/cart-billing-address/cart-billing-address.service.ts @@ -11,7 +11,7 @@ import { DaffCart, DaffCartAddress, } from '@daffodil/cart'; -import { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing'; +import { DaffInMemoryDataServiceInterface } from '@daffodil/driver/in-memory'; import { DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK, diff --git a/libs/cart/driver/in-memory/src/backend/cart-coupon/cart-coupon.service.ts b/libs/cart/driver/in-memory/src/backend/cart-coupon/cart-coupon.service.ts index 6b475733ce..1e7f7acec9 100644 --- a/libs/cart/driver/in-memory/src/backend/cart-coupon/cart-coupon.service.ts +++ b/libs/cart/driver/in-memory/src/backend/cart-coupon/cart-coupon.service.ts @@ -11,7 +11,7 @@ import { DaffCart, DaffCartCoupon, } from '@daffodil/cart'; -import { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing'; +import { DaffInMemoryDataServiceInterface } from '@daffodil/driver/in-memory'; import { DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK, diff --git a/libs/cart/driver/in-memory/src/backend/cart-items/cart-items.service.ts b/libs/cart/driver/in-memory/src/backend/cart-items/cart-items.service.ts index f4aa7cf068..9c859299b7 100644 --- a/libs/cart/driver/in-memory/src/backend/cart-items/cart-items.service.ts +++ b/libs/cart/driver/in-memory/src/backend/cart-items/cart-items.service.ts @@ -13,7 +13,7 @@ import { DaffCartItemInput, } from '@daffodil/cart'; import { DaffCartItemFactory } from '@daffodil/cart/testing'; -import { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing'; +import { DaffInMemoryDataServiceInterface } from '@daffodil/driver/in-memory'; import { DaffInMemoryBackendProductService } from '@daffodil/product/driver/in-memory'; import { daffCartInMemoryComputeCartItemPrices } from '../../helpers/compute-cart-item-prices'; diff --git a/libs/cart/driver/in-memory/src/backend/cart-order/cart-order.service.ts b/libs/cart/driver/in-memory/src/backend/cart-order/cart-order.service.ts index 74ed229f48..375119024c 100644 --- a/libs/cart/driver/in-memory/src/backend/cart-order/cart-order.service.ts +++ b/libs/cart/driver/in-memory/src/backend/cart-order/cart-order.service.ts @@ -5,7 +5,7 @@ import { } from 'angular-in-memory-web-api'; import { DaffCartOrderResult } from '@daffodil/cart'; -import { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing'; +import { DaffInMemoryDataServiceInterface } from '@daffodil/driver/in-memory'; /** * @inheritdoc diff --git a/libs/cart/driver/in-memory/src/backend/cart-payment-methods/cart-payment-methods.service.ts b/libs/cart/driver/in-memory/src/backend/cart-payment-methods/cart-payment-methods.service.ts index a5d1840721..a3f82fb56c 100644 --- a/libs/cart/driver/in-memory/src/backend/cart-payment-methods/cart-payment-methods.service.ts +++ b/libs/cart/driver/in-memory/src/backend/cart-payment-methods/cart-payment-methods.service.ts @@ -8,7 +8,7 @@ import { DaffCart, DaffCartPaymentMethod, } from '@daffodil/cart'; -import { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing'; +import { DaffInMemoryDataServiceInterface } from '@daffodil/driver/in-memory'; /** * @inheritdoc diff --git a/libs/cart/driver/in-memory/src/backend/cart-payment/cart-payment.service.ts b/libs/cart/driver/in-memory/src/backend/cart-payment/cart-payment.service.ts index 8b6a78d176..ba56b4de18 100644 --- a/libs/cart/driver/in-memory/src/backend/cart-payment/cart-payment.service.ts +++ b/libs/cart/driver/in-memory/src/backend/cart-payment/cart-payment.service.ts @@ -11,7 +11,7 @@ import { DaffCart, DaffCartPaymentMethod, } from '@daffodil/cart'; -import { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing'; +import { DaffInMemoryDataServiceInterface } from '@daffodil/driver/in-memory'; import { DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK, diff --git a/libs/cart/driver/in-memory/src/backend/cart-root.service.ts b/libs/cart/driver/in-memory/src/backend/cart-root.service.ts index 37ea390fc7..ef598d5a27 100644 --- a/libs/cart/driver/in-memory/src/backend/cart-root.service.ts +++ b/libs/cart/driver/in-memory/src/backend/cart-root.service.ts @@ -6,7 +6,7 @@ import { } from 'angular-in-memory-web-api'; import { DaffCart } from '@daffodil/cart'; -import { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing'; +import { DaffInMemoryDataServiceInterface } from '@daffodil/driver/in-memory'; import { DaffInMemoryBackendCartService } from './cart/cart.service'; import { DaffInMemoryBackendCartAddressService } from './cart-address/cart-address.service'; diff --git a/libs/cart/driver/in-memory/src/backend/cart-shipping-address/cart-shipping-address.service.ts b/libs/cart/driver/in-memory/src/backend/cart-shipping-address/cart-shipping-address.service.ts index a8051024e4..599dbf2518 100644 --- a/libs/cart/driver/in-memory/src/backend/cart-shipping-address/cart-shipping-address.service.ts +++ b/libs/cart/driver/in-memory/src/backend/cart-shipping-address/cart-shipping-address.service.ts @@ -11,7 +11,7 @@ import { DaffCart, DaffCartAddress, } from '@daffodil/cart'; -import { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing'; +import { DaffInMemoryDataServiceInterface } from '@daffodil/driver/in-memory'; import { DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK, diff --git a/libs/cart/driver/in-memory/src/backend/cart-shipping-information/cart-shipping-information.service.ts b/libs/cart/driver/in-memory/src/backend/cart-shipping-information/cart-shipping-information.service.ts index 375a51b40e..cd4de5cacc 100644 --- a/libs/cart/driver/in-memory/src/backend/cart-shipping-information/cart-shipping-information.service.ts +++ b/libs/cart/driver/in-memory/src/backend/cart-shipping-information/cart-shipping-information.service.ts @@ -11,7 +11,7 @@ import { DaffCart, DaffCartShippingRate, } from '@daffodil/cart'; -import { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing'; +import { DaffInMemoryDataServiceInterface } from '@daffodil/driver/in-memory'; import { DaffInMemoryBackendProductService } from '@daffodil/product/driver/in-memory'; import { daffCartInMemoryComputeCartTotals } from '../../helpers/compute-cart-totals'; diff --git a/libs/cart/driver/in-memory/src/backend/cart-shipping-methods/cart-shipping-methods.service.ts b/libs/cart/driver/in-memory/src/backend/cart-shipping-methods/cart-shipping-methods.service.ts index bc4a29b18f..39d5f22681 100644 --- a/libs/cart/driver/in-memory/src/backend/cart-shipping-methods/cart-shipping-methods.service.ts +++ b/libs/cart/driver/in-memory/src/backend/cart-shipping-methods/cart-shipping-methods.service.ts @@ -9,7 +9,7 @@ import { DaffCartShippingRate, } from '@daffodil/cart'; import { DaffCartShippingRateFactory } from '@daffodil/cart/testing'; -import { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing'; +import { DaffInMemoryDataServiceInterface } from '@daffodil/driver/in-memory'; /** * @inheritdoc diff --git a/libs/cart/driver/in-memory/src/backend/cart/cart.service.ts b/libs/cart/driver/in-memory/src/backend/cart/cart.service.ts index 297f7f9164..b37a2ddc32 100644 --- a/libs/cart/driver/in-memory/src/backend/cart/cart.service.ts +++ b/libs/cart/driver/in-memory/src/backend/cart/cart.service.ts @@ -11,7 +11,7 @@ import { import { DaffCart } from '@daffodil/cart'; import { DaffCartFactory } from '@daffodil/cart/testing'; -import { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing'; +import { DaffInMemoryDataServiceInterface } from '@daffodil/driver/in-memory'; import { DaffInMemoryBackendProductService } from '@daffodil/product/driver/in-memory'; import { daffCartInMemoryComputeCartTotals } from '../../helpers/compute-cart-totals'; diff --git a/libs/core/testing/src/public_api.ts b/libs/core/testing/src/public_api.ts index de91e8f278..a7120fda92 100644 --- a/libs/core/testing/src/public_api.ts +++ b/libs/core/testing/src/public_api.ts @@ -1,6 +1,5 @@ //@angular/core export { DaffMockCurrencyPipe } from './angular/mocks/pipes/currency'; -export { DaffInMemoryDataServiceInterface } from './angular/interfaces/in-memory-data-service.interface'; //Core export { DaffCoreTestingModule } from './testing.module'; diff --git a/libs/driver/in-memory/ng-package.json b/libs/driver/in-memory/ng-package.json new file mode 100644 index 0000000000..9e480669ca --- /dev/null +++ b/libs/driver/in-memory/ng-package.json @@ -0,0 +1,6 @@ +{ + "$schema": "../../../node_modules/ng-packagr/ng-entrypoint.schema.json", + "lib": { + "entryFile": "src/index.ts" + } +} \ No newline at end of file diff --git a/libs/core/testing/src/angular/interfaces/in-memory-data-service.interface.ts b/libs/driver/in-memory/src/backend/data-service.type.ts similarity index 76% rename from libs/core/testing/src/angular/interfaces/in-memory-data-service.interface.ts rename to libs/driver/in-memory/src/backend/data-service.type.ts index e94110f973..13eebc307c 100644 --- a/libs/core/testing/src/angular/interfaces/in-memory-data-service.interface.ts +++ b/libs/driver/in-memory/src/backend/data-service.type.ts @@ -5,8 +5,23 @@ import { Observable } from 'rxjs'; * An interface for defining in memory services that use the angular in memory web api. */ export interface DaffInMemoryDataServiceInterface { + /** + * The R in CRUD. + */ get?(reqInfo: RequestInfo): Observable; + + /** + * The C in CRUD. + */ post?(reqInfo: RequestInfo): Observable; + + /** + * The U in CRUD. + */ put?(reqInfo: RequestInfo): Observable; + + /** + * The D in CRUD. + */ delete?(reqInfo: RequestInfo): Observable; } diff --git a/libs/driver/in-memory/src/backend/public_api.ts b/libs/driver/in-memory/src/backend/public_api.ts new file mode 100644 index 0000000000..b0f11501aa --- /dev/null +++ b/libs/driver/in-memory/src/backend/public_api.ts @@ -0,0 +1 @@ +export * from './data-service.type'; diff --git a/libs/driver/in-memory/src/index.ts b/libs/driver/in-memory/src/index.ts new file mode 100644 index 0000000000..4aaf8f92ed --- /dev/null +++ b/libs/driver/in-memory/src/index.ts @@ -0,0 +1 @@ +export * from './public_api'; diff --git a/libs/driver/in-memory/src/public_api.ts b/libs/driver/in-memory/src/public_api.ts new file mode 100644 index 0000000000..9717fb0f44 --- /dev/null +++ b/libs/driver/in-memory/src/public_api.ts @@ -0,0 +1 @@ +export * from './backend/public_api'; diff --git a/libs/driver/tsconfig.json b/libs/driver/tsconfig.json new file mode 100644 index 0000000000..3a69f77dc8 --- /dev/null +++ b/libs/driver/tsconfig.json @@ -0,0 +1,26 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "baseUrl": "../..", + "paths": { + "@daffodil/*": [ + "dist/*" + ], + "@daffodil/driver": [ + "libs/driver/src" + ], + "@daffodil/driver/hubspot": [ + "libs/driver/hubspot/src" + ], + "@daffodil/driver/magento": [ + "libs/driver/magento/src" + ], + "@daffodil/driver/magento/testing": [ + "libs/driver/magento/testing/src" + ], + "@daffodil/driver/in-memory": [ + "libs/driver/in-memory/src" + ], + } + } +} diff --git a/libs/driver/tsconfig.spec.json b/libs/driver/tsconfig.spec.json index 9e208380ba..dc2d70b595 100644 --- a/libs/driver/tsconfig.spec.json +++ b/libs/driver/tsconfig.spec.json @@ -1,5 +1,5 @@ { - "extends": "../../tsconfig.json", + "extends": "./tsconfig.json", "compilerOptions": { "outDir": "../../dist/out-tsc/libs/driver", "types": [ diff --git a/libs/geography/driver/in-memory/src/backend/geography.service.ts b/libs/geography/driver/in-memory/src/backend/geography.service.ts index 2d9f57ccdc..9b47a516a2 100644 --- a/libs/geography/driver/in-memory/src/backend/geography.service.ts +++ b/libs/geography/driver/in-memory/src/backend/geography.service.ts @@ -5,7 +5,7 @@ import { STATUS, } from 'angular-in-memory-web-api'; -import { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing'; +import { DaffInMemoryDataServiceInterface } from '@daffodil/driver/in-memory'; import { DaffCountry } from '@daffodil/geography'; import { DaffCountryFactory, diff --git a/libs/order/driver/in-memory/src/backend/order.service.ts b/libs/order/driver/in-memory/src/backend/order.service.ts index 7b440d3425..d2daa65540 100644 --- a/libs/order/driver/in-memory/src/backend/order.service.ts +++ b/libs/order/driver/in-memory/src/backend/order.service.ts @@ -10,7 +10,7 @@ import { daffIdentifiableArrayToDict, DaffSortDirectionEnum, } from '@daffodil/core'; -import { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing'; +import { DaffInMemoryDataServiceInterface } from '@daffodil/driver/in-memory'; import { DaffOrder } from '@daffodil/order'; import { DaffOrderFactory } from '@daffodil/order/testing'; diff --git a/libs/reviews/driver/in-memory/src/backend/reviews.service.ts b/libs/reviews/driver/in-memory/src/backend/reviews.service.ts index bcd271d0a1..b178c9900a 100644 --- a/libs/reviews/driver/in-memory/src/backend/reviews.service.ts +++ b/libs/reviews/driver/in-memory/src/backend/reviews.service.ts @@ -5,7 +5,7 @@ import { STATUS, } from 'angular-in-memory-web-api'; -import { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing'; +import { DaffInMemoryDataServiceInterface } from '@daffodil/driver/in-memory'; import { DaffProductReviews } from '@daffodil/reviews'; import { DaffProductReviewsFactory } from '@daffodil/reviews/testing'; From 1811561d3e7a76fd32dd2012e0129b932b18fcd3 Mon Sep 17 00:00:00 2001 From: Peter Lauck Date: Mon, 7 Oct 2024 13:04:48 +0000 Subject: [PATCH 2/2] fix test --- libs/driver/tsconfig.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/driver/tsconfig.json b/libs/driver/tsconfig.json index 3a69f77dc8..014385a89c 100644 --- a/libs/driver/tsconfig.json +++ b/libs/driver/tsconfig.json @@ -21,6 +21,7 @@ "@daffodil/driver/in-memory": [ "libs/driver/in-memory/src" ], - } + }, + "resolveJsonModule": true } }