@reactionary/provider-fake 0.3.18 → 0.6.2

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.
Files changed (69) hide show
  1. package/core/initialize.js +193 -37
  2. package/core/initialize.types.js +8 -0
  3. package/factories/cart/cart.factory.js +15 -0
  4. package/factories/category/category.factory.js +15 -0
  5. package/factories/checkout/checkout.factory.js +19 -0
  6. package/factories/identity/identity.factory.js +11 -0
  7. package/factories/index.js +14 -0
  8. package/factories/inventory/inventory.factory.js +11 -0
  9. package/factories/order/order.factory.js +11 -0
  10. package/factories/order-search/order-search.factory.js +11 -0
  11. package/factories/price/price.factory.js +11 -0
  12. package/factories/product/product.factory.js +11 -0
  13. package/factories/product-associations/product-associations.factory.js +11 -0
  14. package/factories/product-reviews/product-reviews.factory.js +19 -0
  15. package/factories/product-search/product-search.factory.js +11 -0
  16. package/factories/profile/profile.factory.js +11 -0
  17. package/factories/store/store.factory.js +11 -0
  18. package/index.js +2 -0
  19. package/package.json +2 -2
  20. package/providers/cart.provider.js +7 -6
  21. package/providers/category.provider.js +57 -74
  22. package/providers/checkout.provider.js +15 -10
  23. package/providers/identity.provider.js +15 -17
  24. package/providers/inventory.provider.js +11 -15
  25. package/providers/order-search.provider.js +4 -3
  26. package/providers/order.provider.js +9 -32
  27. package/providers/price.provider.js +9 -15
  28. package/providers/product-associations.provider.js +6 -5
  29. package/providers/product-reviews.provider.js +30 -29
  30. package/providers/product-search.provider.js +14 -29
  31. package/providers/product.provider.js +13 -14
  32. package/providers/profile.provider.js +37 -33
  33. package/providers/store.provider.js +21 -15
  34. package/schema/capabilities.schema.js +21 -0
  35. package/src/core/initialize.d.ts +3 -2
  36. package/src/core/initialize.types.d.ts +113 -0
  37. package/src/factories/cart/cart.factory.d.ts +9 -0
  38. package/src/factories/category/category.factory.d.ts +9 -0
  39. package/src/factories/checkout/checkout.factory.d.ts +11 -0
  40. package/src/factories/identity/identity.factory.d.ts +7 -0
  41. package/src/factories/index.d.ts +14 -0
  42. package/src/factories/inventory/inventory.factory.d.ts +7 -0
  43. package/src/factories/order/order.factory.d.ts +7 -0
  44. package/src/factories/order-search/order-search.factory.d.ts +7 -0
  45. package/src/factories/price/price.factory.d.ts +9 -0
  46. package/src/factories/product/product.factory.d.ts +7 -0
  47. package/src/factories/product-associations/product-associations.factory.d.ts +7 -0
  48. package/src/factories/product-reviews/product-reviews.factory.d.ts +11 -0
  49. package/src/factories/product-search/product-search.factory.d.ts +7 -0
  50. package/src/factories/profile/profile.factory.d.ts +7 -0
  51. package/src/factories/store/store.factory.d.ts +7 -0
  52. package/src/index.d.ts +2 -0
  53. package/src/providers/cart.provider.d.ts +12 -10
  54. package/src/providers/category.provider.d.ts +12 -11
  55. package/src/providers/checkout.provider.d.ts +14 -12
  56. package/src/providers/identity.provider.d.ts +9 -7
  57. package/src/providers/inventory.provider.d.ts +6 -4
  58. package/src/providers/order-search.provider.d.ts +6 -4
  59. package/src/providers/order.provider.d.ts +6 -4
  60. package/src/providers/price.provider.d.ts +7 -5
  61. package/src/providers/product-associations.provider.d.ts +9 -6
  62. package/src/providers/product-reviews.provider.d.ts +8 -7
  63. package/src/providers/product-search.provider.d.ts +6 -9
  64. package/src/providers/product.provider.d.ts +9 -7
  65. package/src/providers/profile.provider.d.ts +14 -20
  66. package/src/providers/store.provider.d.ts +6 -4
  67. package/src/schema/capabilities.schema.d.ts +115 -16
  68. package/src/test/client-builder-product-extension.example.d.ts +1 -0
  69. package/test/client-builder-product-extension.example.js +57 -0
@@ -0,0 +1,14 @@
1
+ export * from './cart/cart.factory.js';
2
+ export * from './category/category.factory.js';
3
+ export * from './checkout/checkout.factory.js';
4
+ export * from './identity/identity.factory.js';
5
+ export * from './inventory/inventory.factory.js';
6
+ export * from './order-search/order-search.factory.js';
7
+ export * from './order/order.factory.js';
8
+ export * from './price/price.factory.js';
9
+ export * from './product-associations/product-associations.factory.js';
10
+ export * from './product-reviews/product-reviews.factory.js';
11
+ export * from './product-search/product-search.factory.js';
12
+ export * from './product/product.factory.js';
13
+ export * from './profile/profile.factory.js';
14
+ export * from './store/store.factory.js';
@@ -0,0 +1,7 @@
1
+ import type { AnyInventorySchema, InventoryFactory, InventorySchema, RequestContext } from '@reactionary/core';
2
+ import type * as z from 'zod';
3
+ export declare class FakeInventoryFactory<TInventorySchema extends AnyInventorySchema = typeof InventorySchema> implements InventoryFactory<TInventorySchema> {
4
+ readonly inventorySchema: TInventorySchema;
5
+ constructor(inventorySchema: TInventorySchema);
6
+ parseInventory(_context: RequestContext, data: unknown): z.output<TInventorySchema>;
7
+ }
@@ -0,0 +1,7 @@
1
+ import type { AnyOrderSchema, OrderFactory, OrderSchema, RequestContext } from '@reactionary/core';
2
+ import type * as z from 'zod';
3
+ export declare class FakeOrderFactory<TOrderSchema extends AnyOrderSchema = typeof OrderSchema> implements OrderFactory<TOrderSchema> {
4
+ readonly orderSchema: TOrderSchema;
5
+ constructor(orderSchema: TOrderSchema);
6
+ parseOrder(_context: RequestContext, data: unknown): z.output<TOrderSchema>;
7
+ }
@@ -0,0 +1,7 @@
1
+ import type { AnyOrderSearchResultSchema, OrderSearchFactory, OrderSearchQueryByTerm, OrderSearchResultSchema, RequestContext } from '@reactionary/core';
2
+ import type * as z from 'zod';
3
+ export declare class FakeOrderSearchFactory<TOrderSearchResultSchema extends AnyOrderSearchResultSchema = typeof OrderSearchResultSchema> implements OrderSearchFactory<TOrderSearchResultSchema> {
4
+ readonly orderSearchResultSchema: TOrderSearchResultSchema;
5
+ constructor(orderSearchResultSchema: TOrderSearchResultSchema);
6
+ parseOrderSearchResult(_context: RequestContext, data: unknown, _query: OrderSearchQueryByTerm): z.output<TOrderSearchResultSchema>;
7
+ }
@@ -0,0 +1,9 @@
1
+ import type { AnyPriceSchema, PriceFactory, PriceSchema, RequestContext } from '@reactionary/core';
2
+ import type * as z from 'zod';
3
+ export declare class FakePriceFactory<TPriceSchema extends AnyPriceSchema = typeof PriceSchema> implements PriceFactory<TPriceSchema> {
4
+ readonly priceSchema: TPriceSchema;
5
+ constructor(priceSchema: TPriceSchema);
6
+ parsePrice(_context: RequestContext, data: unknown, _options?: {
7
+ includeDiscounts: boolean;
8
+ }): z.output<TPriceSchema>;
9
+ }
@@ -0,0 +1,7 @@
1
+ import type { AnyProductSchema, ProductFactory, ProductSchema, RequestContext } from '@reactionary/core';
2
+ import type * as z from 'zod';
3
+ export declare class FakeProductFactory<TProductSchema extends AnyProductSchema = typeof ProductSchema> implements ProductFactory<TProductSchema> {
4
+ readonly productSchema: TProductSchema;
5
+ constructor(productSchema: TProductSchema);
6
+ parseProduct(_context: RequestContext, data: unknown): z.output<TProductSchema>;
7
+ }
@@ -0,0 +1,7 @@
1
+ import type { AnyProductAssociationSchema, ProductAssociationSchema, ProductAssociationsFactory, RequestContext } from '@reactionary/core';
2
+ import type * as z from 'zod';
3
+ export declare class FakeProductAssociationsFactory<TProductAssociationSchema extends AnyProductAssociationSchema = typeof ProductAssociationSchema> implements ProductAssociationsFactory<TProductAssociationSchema> {
4
+ readonly productAssociationSchema: TProductAssociationSchema;
5
+ constructor(productAssociationSchema: TProductAssociationSchema);
6
+ parseAssociation(_context: RequestContext, data: unknown): z.output<TProductAssociationSchema>;
7
+ }
@@ -0,0 +1,11 @@
1
+ import type { AnyProductRatingSummarySchema, AnyProductReviewPaginatedSchema, AnyProductReviewSchema, ProductRatingSummarySchema, ProductReviewPaginatedResultSchema, ProductReviewSchema, ProductReviewsFactory, RequestContext } from '@reactionary/core';
2
+ import type * as z from 'zod';
3
+ export declare class FakeProductReviewsFactory<TRatingSummarySchema extends AnyProductRatingSummarySchema = typeof ProductRatingSummarySchema, TReviewSchema extends AnyProductReviewSchema = typeof ProductReviewSchema, TReviewPaginatedSchema extends AnyProductReviewPaginatedSchema = typeof ProductReviewPaginatedResultSchema> implements ProductReviewsFactory<TRatingSummarySchema, TReviewSchema, TReviewPaginatedSchema> {
4
+ readonly ratingSummarySchema: TRatingSummarySchema;
5
+ readonly reviewSchema: TReviewSchema;
6
+ readonly reviewPaginatedSchema: TReviewPaginatedSchema;
7
+ constructor(ratingSummarySchema: TRatingSummarySchema, reviewSchema: TReviewSchema, reviewPaginatedSchema: TReviewPaginatedSchema);
8
+ parseRatingSummary(_context: RequestContext, data: unknown): z.output<TRatingSummarySchema>;
9
+ parseReview(_context: RequestContext, data: unknown): z.output<TReviewSchema>;
10
+ parseReviewPaginatedResult(_context: RequestContext, data: unknown): z.output<TReviewPaginatedSchema>;
11
+ }
@@ -0,0 +1,7 @@
1
+ import type { AnyProductSearchResultSchema, ProductSearchFactory, ProductSearchQueryByTerm, ProductSearchResultSchema, RequestContext } from '@reactionary/core';
2
+ import type * as z from 'zod';
3
+ export declare class FakeProductSearchFactory<TProductSearchResultSchema extends AnyProductSearchResultSchema = typeof ProductSearchResultSchema> implements ProductSearchFactory<TProductSearchResultSchema> {
4
+ readonly productSearchResultSchema: TProductSearchResultSchema;
5
+ constructor(productSearchResultSchema: TProductSearchResultSchema);
6
+ parseSearchResult(_context: RequestContext, data: unknown, _query: ProductSearchQueryByTerm): z.output<TProductSearchResultSchema>;
7
+ }
@@ -0,0 +1,7 @@
1
+ import type { AnyProfileSchema, ProfileFactory, ProfileSchema, RequestContext } from '@reactionary/core';
2
+ import type * as z from 'zod';
3
+ export declare class FakeProfileFactory<TProfileSchema extends AnyProfileSchema = typeof ProfileSchema> implements ProfileFactory<TProfileSchema> {
4
+ readonly profileSchema: TProfileSchema;
5
+ constructor(profileSchema: TProfileSchema);
6
+ parseProfile(_context: RequestContext, data: unknown): z.output<TProfileSchema>;
7
+ }
@@ -0,0 +1,7 @@
1
+ import type { AnyStoreSchema, RequestContext, StoreFactory, StoreSchema } from '@reactionary/core';
2
+ import type * as z from 'zod';
3
+ export declare class FakeStoreFactory<TStoreSchema extends AnyStoreSchema = typeof StoreSchema> implements StoreFactory<TStoreSchema> {
4
+ readonly storeSchema: TStoreSchema;
5
+ constructor(storeSchema: TStoreSchema);
6
+ parseStore(_context: RequestContext, data: unknown): z.output<TStoreSchema>;
7
+ }
package/src/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  export * from './core/initialize.js';
2
+ export * from './core/initialize.types.js';
2
3
  export * from './providers/index.js';
4
+ export * from './factories/index.js';
3
5
  export * from './schema/capabilities.schema.js';
4
6
  export * from './schema/configuration.schema.js';
@@ -1,20 +1,22 @@
1
- import type { Cart, CartQueryById, CartMutationItemAdd, CartMutationItemRemove, CartMutationItemQuantityChange, RequestContext, Cache, CartIdentifier, CartMutationApplyCoupon, CartMutationChangeCurrency, CartMutationDeleteCart, CartMutationRemoveCoupon, Result, NotFoundError } from '@reactionary/core';
1
+ import type { Cart, CartFactory, CartFactoryCartOutput, CartFactoryWithOutput, CartQueryById, CartMutationItemAdd, CartMutationItemRemove, CartMutationItemQuantityChange, RequestContext, Cache, CartIdentifier, CartMutationApplyCoupon, CartMutationChangeCurrency, CartMutationDeleteCart, CartMutationRemoveCoupon, Result, NotFoundError } from '@reactionary/core';
2
2
  import { CartProvider } from '@reactionary/core';
3
3
  import type { FakeConfiguration } from '../schema/configuration.schema.js';
4
- export declare class FakeCartProvider extends CartProvider {
4
+ import type { FakeCartFactory } from '../factories/cart/cart.factory.js';
5
+ export declare class FakeCartProvider<TFactory extends CartFactory = FakeCartFactory> extends CartProvider<CartFactoryCartOutput<TFactory>, CartIdentifier> {
5
6
  protected config: FakeConfiguration;
7
+ protected factory: CartFactoryWithOutput<TFactory>;
6
8
  private carts;
7
9
  private generator;
8
- constructor(config: FakeConfiguration, cache: Cache, context: RequestContext);
9
- getById(payload: CartQueryById): Promise<Result<Cart, NotFoundError>>;
10
- add(payload: CartMutationItemAdd): Promise<Result<Cart>>;
11
- remove(payload: CartMutationItemRemove): Promise<Result<Cart>>;
12
- changeQuantity(payload: CartMutationItemQuantityChange): Promise<Result<Cart>>;
10
+ constructor(config: FakeConfiguration, cache: Cache, context: RequestContext, factory: CartFactoryWithOutput<TFactory>);
11
+ getById(payload: CartQueryById): Promise<Result<CartFactoryCartOutput<TFactory>, NotFoundError>>;
12
+ add(payload: CartMutationItemAdd): Promise<Result<CartFactoryCartOutput<TFactory>>>;
13
+ remove(payload: CartMutationItemRemove): Promise<Result<CartFactoryCartOutput<TFactory>>>;
14
+ changeQuantity(payload: CartMutationItemQuantityChange): Promise<Result<CartFactoryCartOutput<TFactory>>>;
13
15
  getActiveCartId(): Promise<Result<CartIdentifier, NotFoundError>>;
14
16
  deleteCart(payload: CartMutationDeleteCart): Promise<Result<void>>;
15
- applyCouponCode(payload: CartMutationApplyCoupon): Promise<Result<Cart>>;
16
- removeCouponCode(payload: CartMutationRemoveCoupon): Promise<Result<Cart>>;
17
- changeCurrency(payload: CartMutationChangeCurrency): Promise<Result<Cart>>;
17
+ applyCouponCode(payload: CartMutationApplyCoupon): Promise<Result<CartFactoryCartOutput<TFactory>>>;
18
+ removeCouponCode(payload: CartMutationRemoveCoupon): Promise<Result<CartFactoryCartOutput<TFactory>>>;
19
+ changeCurrency(payload: CartMutationChangeCurrency): Promise<Result<CartFactoryCartOutput<TFactory>>>;
18
20
  protected recalculateCart(cart: Cart): void;
19
21
  protected createEmptyCart(): Cart;
20
22
  }
@@ -1,19 +1,20 @@
1
- import type { Result, NotFoundError, Category, CategoryPaginatedResult, CategoryQueryById, CategoryQueryBySlug, CategoryQueryForBreadcrumb, CategoryQueryForChildCategories, CategoryQueryForTopCategories, RequestContext } from "@reactionary/core";
2
- import { CategoryProvider } from "@reactionary/core";
3
- import type { FakeConfiguration } from "../schema/configuration.schema.js";
4
- import type { Cache as ReactionaryCache } from "@reactionary/core";
1
+ import type { Cache, Category, CategoryFactory, CategoryFactoryCategoryOutput, CategoryFactoryPaginatedOutput, CategoryFactoryWithOutput, CategoryQueryById, CategoryQueryBySlug, CategoryQueryForBreadcrumb, CategoryQueryForChildCategories, CategoryQueryForTopCategories, NotFoundError, RequestContext, Result } from '@reactionary/core';
2
+ import { CategoryProvider } from '@reactionary/core';
3
+ import type { FakeConfiguration } from '../schema/configuration.schema.js';
5
4
  import { Faker } from '@faker-js/faker';
6
- export declare class FakeCategoryProvider extends CategoryProvider {
5
+ import type { FakeCategoryFactory } from '../factories/category/category.factory.js';
6
+ export declare class FakeCategoryProvider<TFactory extends CategoryFactory = FakeCategoryFactory> extends CategoryProvider<CategoryFactoryCategoryOutput<TFactory>, CategoryFactoryPaginatedOutput<TFactory>> {
7
7
  protected config: FakeConfiguration;
8
+ protected factory: CategoryFactoryWithOutput<TFactory>;
8
9
  protected topCategories: Category[];
9
10
  protected childCategories: Map<string, Category[]>;
10
11
  protected allCategories: Map<string, Category>;
11
12
  protected categoryGenerator: Faker;
12
13
  protected generateFakeCategory(parent: Category | undefined, index: number): Category;
13
- constructor(config: FakeConfiguration, cache: ReactionaryCache, context: RequestContext);
14
- getById(payload: CategoryQueryById): Promise<Result<Category, NotFoundError>>;
15
- getBySlug(payload: CategoryQueryBySlug): Promise<Result<Category, NotFoundError>>;
16
- getBreadcrumbPathToCategory(payload: CategoryQueryForBreadcrumb): Promise<Result<Category[]>>;
17
- findChildCategories(payload: CategoryQueryForChildCategories): Promise<Result<CategoryPaginatedResult>>;
18
- findTopCategories(payload: CategoryQueryForTopCategories): Promise<Result<CategoryPaginatedResult>>;
14
+ constructor(config: FakeConfiguration, cache: Cache, context: RequestContext, factory: CategoryFactoryWithOutput<TFactory>);
15
+ getById(payload: CategoryQueryById): Promise<Result<CategoryFactoryCategoryOutput<TFactory>, NotFoundError>>;
16
+ getBySlug(payload: CategoryQueryBySlug): Promise<Result<CategoryFactoryCategoryOutput<TFactory>, NotFoundError>>;
17
+ getBreadcrumbPathToCategory(payload: CategoryQueryForBreadcrumb): Promise<Result<CategoryFactoryCategoryOutput<TFactory>[]>>;
18
+ findTopCategories(_payload: CategoryQueryForTopCategories): Promise<Result<CategoryFactoryPaginatedOutput<TFactory>>>;
19
+ findChildCategories(payload: CategoryQueryForChildCategories): Promise<Result<CategoryFactoryPaginatedOutput<TFactory>>>;
19
20
  }
@@ -1,19 +1,21 @@
1
- import { CheckoutProvider, type Checkout, type CheckoutMutationAddPaymentInstruction, type CheckoutMutationFinalizeCheckout, type CheckoutMutationInitiateCheckout, type CheckoutMutationRemovePaymentInstruction, type CheckoutMutationSetShippingAddress, type CheckoutMutationSetShippingInstruction, type CheckoutQueryById, type CheckoutQueryForAvailablePaymentMethods, type CheckoutQueryForAvailableShippingMethods, type NotFoundError, type PaymentMethod, type RequestContext, type Result, type ShippingMethod, type Cache, type CheckoutIdentifier } from '@reactionary/core';
1
+ import { CheckoutProvider, type CheckoutMutationAddPaymentInstruction, type CheckoutMutationFinalizeCheckout, type CheckoutMutationInitiateCheckout, type CheckoutMutationRemovePaymentInstruction, type CheckoutMutationSetShippingAddress, type CheckoutMutationSetShippingInstruction, type CheckoutQueryById, type CheckoutQueryForAvailablePaymentMethods, type CheckoutQueryForAvailableShippingMethods, type NotFoundError, type RequestContext, type Result, type Cache, type CheckoutIdentifier, type CheckoutFactory, type CheckoutFactoryCheckoutOutput, type CheckoutFactoryPaymentMethodOutput, type CheckoutFactoryShippingMethodOutput, type CheckoutFactoryWithOutput } from '@reactionary/core';
2
2
  import type { FakeConfiguration } from '../schema/configuration.schema.js';
3
3
  import { Faker } from '@faker-js/faker';
4
- export declare class FakeCheckoutProvider extends CheckoutProvider {
4
+ import type { FakeCheckoutFactory } from '../factories/checkout/checkout.factory.js';
5
+ export declare class FakeCheckoutProvider<TFactory extends CheckoutFactory = FakeCheckoutFactory> extends CheckoutProvider<CheckoutFactoryCheckoutOutput<TFactory>, CheckoutFactoryShippingMethodOutput<TFactory>, CheckoutFactoryPaymentMethodOutput<TFactory>> {
5
6
  protected config: FakeConfiguration;
6
7
  protected generator: Faker;
7
- constructor(config: FakeConfiguration, cache: Cache, context: RequestContext);
8
- initiateCheckoutForCart(payload: CheckoutMutationInitiateCheckout): Promise<Result<Checkout>>;
9
- getById(payload: CheckoutQueryById): Promise<Result<Checkout, NotFoundError>>;
10
- setShippingAddress(payload: CheckoutMutationSetShippingAddress): Promise<Result<Checkout>>;
11
- getAvailableShippingMethods(payload: CheckoutQueryForAvailableShippingMethods): Promise<Result<ShippingMethod[]>>;
12
- getAvailablePaymentMethods(payload: CheckoutQueryForAvailablePaymentMethods): Promise<Result<PaymentMethod[]>>;
13
- addPaymentInstruction(payload: CheckoutMutationAddPaymentInstruction): Promise<Result<Checkout>>;
14
- removePaymentInstruction(payload: CheckoutMutationRemovePaymentInstruction): Promise<Result<Checkout>>;
15
- setShippingInstruction(payload: CheckoutMutationSetShippingInstruction): Promise<Result<Checkout>>;
16
- finalizeCheckout(payload: CheckoutMutationFinalizeCheckout): Promise<Result<Checkout>>;
8
+ protected factory: CheckoutFactoryWithOutput<TFactory>;
9
+ constructor(config: FakeConfiguration, cache: Cache, context: RequestContext, factory: CheckoutFactoryWithOutput<TFactory>);
10
+ initiateCheckoutForCart(payload: CheckoutMutationInitiateCheckout): Promise<Result<CheckoutFactoryCheckoutOutput<TFactory>>>;
11
+ getById(payload: CheckoutQueryById): Promise<Result<CheckoutFactoryCheckoutOutput<TFactory>, NotFoundError>>;
12
+ setShippingAddress(payload: CheckoutMutationSetShippingAddress): Promise<Result<CheckoutFactoryCheckoutOutput<TFactory>>>;
13
+ getAvailableShippingMethods(payload: CheckoutQueryForAvailableShippingMethods): Promise<Result<CheckoutFactoryShippingMethodOutput<TFactory>[]>>;
14
+ getAvailablePaymentMethods(payload: CheckoutQueryForAvailablePaymentMethods): Promise<Result<CheckoutFactoryPaymentMethodOutput<TFactory>[]>>;
15
+ addPaymentInstruction(payload: CheckoutMutationAddPaymentInstruction): Promise<Result<CheckoutFactoryCheckoutOutput<TFactory>>>;
16
+ removePaymentInstruction(payload: CheckoutMutationRemovePaymentInstruction): Promise<Result<CheckoutFactoryCheckoutOutput<TFactory>>>;
17
+ setShippingInstruction(payload: CheckoutMutationSetShippingInstruction): Promise<Result<CheckoutFactoryCheckoutOutput<TFactory>>>;
18
+ finalizeCheckout(payload: CheckoutMutationFinalizeCheckout): Promise<Result<CheckoutFactoryCheckoutOutput<TFactory>>>;
17
19
  protected composeBaseCheckout(identifier?: CheckoutIdentifier): {
18
20
  description: string;
19
21
  identifier: CheckoutIdentifier;
@@ -1,11 +1,13 @@
1
- import { type Identity, type IdentityQuerySelf, type IdentityMutationLogin, type IdentityMutationLogout, type RequestContext, type Cache, IdentityProvider, type IdentityMutationRegister, type Result } from '@reactionary/core';
1
+ import { type Cache, type IdentityFactory, type IdentityFactoryOutput, type IdentityFactoryWithOutput, type IdentityMutationLogin, type IdentityMutationLogout, type IdentityMutationRegister, type IdentityQuerySelf, IdentityProvider, type RequestContext, type Result } from '@reactionary/core';
2
2
  import type { FakeConfiguration } from '../schema/configuration.schema.js';
3
- export declare class FakeIdentityProvider extends IdentityProvider {
3
+ import type { FakeIdentityFactory } from '../factories/identity/identity.factory.js';
4
+ export declare class FakeIdentityProvider<TFactory extends IdentityFactory = FakeIdentityFactory> extends IdentityProvider<IdentityFactoryOutput<TFactory>> {
4
5
  protected config: FakeConfiguration;
6
+ protected factory: IdentityFactoryWithOutput<TFactory>;
5
7
  private currentIdentity;
6
- constructor(config: FakeConfiguration, cache: Cache, context: RequestContext);
7
- getSelf(_payload: IdentityQuerySelf): Promise<Result<Identity>>;
8
- login(payload: IdentityMutationLogin): Promise<Result<Identity>>;
9
- logout(_payload: IdentityMutationLogout): Promise<Result<Identity>>;
10
- register(payload: IdentityMutationRegister): Promise<Result<Identity>>;
8
+ constructor(config: FakeConfiguration, cache: Cache, context: RequestContext, factory: IdentityFactoryWithOutput<TFactory>);
9
+ getSelf(_payload: IdentityQuerySelf): Promise<Result<IdentityFactoryOutput<TFactory>>>;
10
+ login(_payload: IdentityMutationLogin): Promise<Result<IdentityFactoryOutput<TFactory>>>;
11
+ logout(_payload: IdentityMutationLogout): Promise<Result<IdentityFactoryOutput<TFactory>>>;
12
+ register(_payload: IdentityMutationRegister): Promise<Result<IdentityFactoryOutput<TFactory>>>;
11
13
  }
@@ -1,8 +1,10 @@
1
- import type { Cache, Inventory, InventoryQueryBySKU, NotFoundError, RequestContext, Result } from '@reactionary/core';
1
+ import type { Cache, InventoryFactory, InventoryFactoryOutput, InventoryFactoryWithOutput, InventoryQueryBySKU, NotFoundError, RequestContext, Result } from '@reactionary/core';
2
2
  import { InventoryProvider } from '@reactionary/core';
3
3
  import type { FakeConfiguration } from '../schema/configuration.schema.js';
4
- export declare class FakeInventoryProvider extends InventoryProvider {
4
+ import type { FakeInventoryFactory } from '../factories/inventory/inventory.factory.js';
5
+ export declare class FakeInventoryProvider<TFactory extends InventoryFactory = FakeInventoryFactory> extends InventoryProvider<InventoryFactoryOutput<TFactory>> {
5
6
  protected config: FakeConfiguration;
6
- constructor(config: FakeConfiguration, cache: Cache, context: RequestContext);
7
- getBySKU(payload: InventoryQueryBySKU): Promise<Result<Inventory, NotFoundError>>;
7
+ protected factory: InventoryFactoryWithOutput<TFactory>;
8
+ constructor(config: FakeConfiguration, cache: Cache, context: RequestContext, factory: InventoryFactoryWithOutput<TFactory>);
9
+ getBySKU(payload: InventoryQueryBySKU): Promise<Result<InventoryFactoryOutput<TFactory>, NotFoundError>>;
8
10
  }
@@ -1,9 +1,11 @@
1
- import { OrderSearchProvider, type Cache, type OrderSearchQueryByTerm, type OrderSearchResult, type RequestContext, type Result } from '@reactionary/core';
1
+ import { OrderSearchProvider, type Cache, type OrderSearchFactory, type OrderSearchFactoryOutput, type OrderSearchFactoryWithOutput, type OrderSearchQueryByTerm, type RequestContext, type Result } from '@reactionary/core';
2
2
  import type { FakeConfiguration } from '../schema/configuration.schema.js';
3
3
  import { Faker } from '@faker-js/faker';
4
- export declare class FakeOrderSearchProvider extends OrderSearchProvider {
4
+ import type { FakeOrderSearchFactory } from '../factories/order-search/order-search.factory.js';
5
+ export declare class FakeOrderSearchProvider<TFactory extends OrderSearchFactory = FakeOrderSearchFactory> extends OrderSearchProvider<OrderSearchFactoryOutput<TFactory>> {
5
6
  protected config: FakeConfiguration;
6
7
  protected generator: Faker;
7
- constructor(config: FakeConfiguration, cache: Cache, context: RequestContext);
8
- queryByTerm(payload: OrderSearchQueryByTerm): Promise<Result<OrderSearchResult>>;
8
+ protected factory: OrderSearchFactoryWithOutput<TFactory>;
9
+ constructor(config: FakeConfiguration, cache: Cache, context: RequestContext, factory: OrderSearchFactoryWithOutput<TFactory>);
10
+ queryByTerm(payload: OrderSearchQueryByTerm): Promise<Result<OrderSearchFactoryOutput<TFactory>>>;
9
11
  }
@@ -1,9 +1,11 @@
1
- import { OrderProvider, type Cache, type NotFoundError, type Order, type OrderQueryById, type RequestContext, type Result } from '@reactionary/core';
1
+ import { OrderProvider, type Cache, type NotFoundError, type OrderFactory, type OrderFactoryOutput, type OrderFactoryWithOutput, type OrderQueryById, type RequestContext, type Result } from '@reactionary/core';
2
2
  import type { FakeConfiguration } from '../schema/configuration.schema.js';
3
3
  import { Faker } from '@faker-js/faker';
4
- export declare class FakeOrderProvider extends OrderProvider {
4
+ import type { FakeOrderFactory } from '../factories/order/order.factory.js';
5
+ export declare class FakeOrderProvider<TFactory extends OrderFactory = FakeOrderFactory> extends OrderProvider<OrderFactoryOutput<TFactory>> {
5
6
  protected config: FakeConfiguration;
6
7
  protected generator: Faker;
7
- constructor(config: FakeConfiguration, cache: Cache, context: RequestContext);
8
- getById(payload: OrderQueryById): Promise<Result<Order, NotFoundError>>;
8
+ protected factory: OrderFactoryWithOutput<TFactory>;
9
+ constructor(config: FakeConfiguration, cache: Cache, context: RequestContext, factory: OrderFactoryWithOutput<TFactory>);
10
+ getById(payload: OrderQueryById): Promise<Result<OrderFactoryOutput<TFactory>, NotFoundError>>;
9
11
  }
@@ -1,11 +1,13 @@
1
- import { type RequestContext, type Cache, PriceProvider, type CustomerPriceQuery, type ListPriceQuery, type Price, type Result } from '@reactionary/core';
1
+ import { PriceProvider, type Cache, type CustomerPriceQuery, type ListPriceQuery, type Price, type PriceFactory, type PriceFactoryOutput, type PriceFactoryWithOutput, type RequestContext, type Result } from '@reactionary/core';
2
2
  import type { FakeConfiguration } from '../schema/configuration.schema.js';
3
3
  import { Faker } from '@faker-js/faker';
4
- export declare class FakePriceProvider extends PriceProvider {
4
+ import type { FakePriceFactory } from '../factories/price/price.factory.js';
5
+ export declare class FakePriceProvider<TFactory extends PriceFactory = FakePriceFactory> extends PriceProvider<PriceFactoryOutput<TFactory>> {
5
6
  protected config: FakeConfiguration;
6
7
  protected faker: Faker;
7
- constructor(config: FakeConfiguration, cache: Cache, context: RequestContext);
8
+ protected factory: PriceFactoryWithOutput<TFactory>;
9
+ constructor(config: FakeConfiguration, cache: Cache, context: RequestContext, factory: PriceFactoryWithOutput<TFactory>);
8
10
  protected createPrice(variantSku: string, mode: 'list' | 'customer'): Price;
9
- getListPrice(payload: ListPriceQuery): Promise<Result<Price>>;
10
- getCustomerPrice(payload: CustomerPriceQuery): Promise<Result<Price>>;
11
+ getListPrice(payload: ListPriceQuery): Promise<Result<PriceFactoryOutput<TFactory>>>;
12
+ getCustomerPrice(payload: CustomerPriceQuery): Promise<Result<PriceFactoryOutput<TFactory>>>;
11
13
  }
@@ -1,12 +1,15 @@
1
- import { ProductAssociationsProvider, type ProductAssociationsGetAccessoriesQuery, type ProductAssociationsGetSparepartsQuery, type ProductAssociationsGetReplacementsQuery, type Result, type ProductAssociation } from '@reactionary/core';
1
+ import { ProductAssociationsProvider, type ProductAssociationsGetAccessoriesQuery, type ProductAssociationsGetSparepartsQuery, type ProductAssociationsGetReplacementsQuery, type Result, type Cache, type RequestContext } from '@reactionary/core';
2
+ import type { ProductAssociationsFactory, ProductAssociationsFactoryOutput, ProductAssociationsFactoryWithOutput } from '@reactionary/core';
2
3
  import type { FakeConfiguration } from '../schema/configuration.schema.js';
3
4
  import { Faker } from '@faker-js/faker';
4
- export declare class FakeProductAssociationsProvider extends ProductAssociationsProvider {
5
+ import type { FakeProductAssociationsFactory } from '../factories/product-associations/product-associations.factory.js';
6
+ export declare class FakeProductAssociationsProvider<TFactory extends ProductAssociationsFactory = FakeProductAssociationsFactory> extends ProductAssociationsProvider<ProductAssociationsFactoryOutput<TFactory>> {
5
7
  protected config: FakeConfiguration;
8
+ protected factory: ProductAssociationsFactoryWithOutput<TFactory>;
6
9
  protected faker: Faker;
7
- constructor(config: FakeConfiguration, cache: any, context: any);
8
- getAccessories(query: ProductAssociationsGetAccessoriesQuery): Promise<Result<ProductAssociation[]>>;
9
- getSpareparts(query: ProductAssociationsGetSparepartsQuery): Promise<Result<ProductAssociation[]>>;
10
- getReplacements(query: ProductAssociationsGetReplacementsQuery): Promise<Result<ProductAssociation[]>>;
10
+ constructor(config: FakeConfiguration, cache: Cache, context: RequestContext, factory: ProductAssociationsFactoryWithOutput<TFactory>);
11
+ getAccessories(query: ProductAssociationsGetAccessoriesQuery): Promise<Result<ProductAssociationsFactoryOutput<TFactory>[]>>;
12
+ getSpareparts(query: ProductAssociationsGetSparepartsQuery): Promise<Result<ProductAssociationsFactoryOutput<TFactory>[]>>;
13
+ getReplacements(query: ProductAssociationsGetReplacementsQuery): Promise<Result<ProductAssociationsFactoryOutput<TFactory>[]>>;
11
14
  private generateFakeAssociatedProducts;
12
15
  }
@@ -1,12 +1,13 @@
1
- import { ProductReviewsProvider } from '@reactionary/core';
2
- import type { ProductReview, ProductRatingSummary, ProductReviewPaginatedResult, ProductReviewsListQuery, ProductReviewsGetRatingSummaryQuery, ProductReviewMutationSubmit, Result, RequestContext, Cache, ProductIdentifier } from '@reactionary/core';
1
+ import { ProductReviewsProvider, type Cache, type ProductIdentifier, type ProductReviewsFactory, type ProductReviewsFactoryRatingOutput, type ProductReviewsFactoryReviewOutput, type ProductReviewsFactoryReviewPaginatedOutput, type ProductReviewsFactoryWithOutput, type ProductReviewsGetRatingSummaryQuery, type ProductReviewsListQuery, type ProductReview, type ProductReviewMutationSubmit, type RequestContext, type Result } from '@reactionary/core';
3
2
  import type { FakeConfiguration } from '../schema/configuration.schema.js';
4
- export declare class FakeProductReviewsProvider extends ProductReviewsProvider {
3
+ import type { FakeProductReviewsFactory } from '../factories/product-reviews/product-reviews.factory.js';
4
+ export declare class FakeProductReviewsProvider<TFactory extends ProductReviewsFactory = FakeProductReviewsFactory> extends ProductReviewsProvider<ProductReviewsFactoryRatingOutput<TFactory>, ProductReviewsFactoryReviewPaginatedOutput<TFactory>, ProductReviewsFactoryReviewOutput<TFactory>> {
5
5
  protected config: FakeConfiguration;
6
+ protected factory: ProductReviewsFactoryWithOutput<TFactory>;
6
7
  private faker;
7
- constructor(config: FakeConfiguration, cache: Cache, context: RequestContext);
8
+ constructor(config: FakeConfiguration, cache: Cache, context: RequestContext, factory: ProductReviewsFactoryWithOutput<TFactory>);
8
9
  protected createReviewsForProduct(productIdentifier: ProductIdentifier): ProductReview[];
9
- getRatingSummary(query: ProductReviewsGetRatingSummaryQuery): Promise<Result<ProductRatingSummary>>;
10
- findReviews(query: ProductReviewsListQuery): Promise<Result<ProductReviewPaginatedResult>>;
11
- submitReview(mutation: ProductReviewMutationSubmit): Promise<Result<ProductReview>>;
10
+ getRatingSummary(query: ProductReviewsGetRatingSummaryQuery): Promise<Result<ProductReviewsFactoryRatingOutput<TFactory>>>;
11
+ findReviews(query: ProductReviewsListQuery): Promise<Result<ProductReviewsFactoryReviewPaginatedOutput<TFactory>>>;
12
+ submitReview(mutation: ProductReviewMutationSubmit): Promise<Result<ProductReviewsFactoryReviewOutput<TFactory>>>;
12
13
  }
@@ -1,13 +1,10 @@
1
- import { ProductSearchProvider } from '@reactionary/core';
2
- import type { ProductSearchResult, ProductSearchResultFacet, Cache as ReactionaryCache, FacetIdentifier, FacetValueIdentifier, ProductSearchResultFacetValue, ProductSearchResultItemVariant, ProductSearchQueryCreateNavigationFilter, Result } from '@reactionary/core';
3
- import type { RequestContext, ProductSearchQueryByTerm } from '@reactionary/core';
1
+ import { ProductSearchProvider, type Cache, type FacetValueIdentifier, type ProductSearchFactory, type ProductSearchFactoryOutput, type ProductSearchFactoryWithOutput, type ProductSearchQueryByTerm, type ProductSearchQueryCreateNavigationFilter, type RequestContext, type Result } from '@reactionary/core';
4
2
  import type { FakeConfiguration } from '../schema/configuration.schema.js';
5
- export declare class FakeSearchProvider extends ProductSearchProvider {
3
+ import type { FakeProductSearchFactory } from '../factories/product-search/product-search.factory.js';
4
+ export declare class FakeSearchProvider<TFactory extends ProductSearchFactory = FakeProductSearchFactory> extends ProductSearchProvider<ProductSearchFactoryOutput<TFactory>> {
6
5
  protected config: FakeConfiguration;
7
- constructor(config: FakeConfiguration, cache: ReactionaryCache, context: RequestContext);
8
- queryByTerm(payload: ProductSearchQueryByTerm): Promise<Result<ProductSearchResult>>;
6
+ protected factory: ProductSearchFactoryWithOutput<TFactory>;
7
+ constructor(config: FakeConfiguration, cache: Cache, context: RequestContext, factory: ProductSearchFactoryWithOutput<TFactory>);
8
+ queryByTerm(payload: ProductSearchQueryByTerm): Promise<Result<ProductSearchFactoryOutput<TFactory>>>;
9
9
  createCategoryNavigationFilter(payload: ProductSearchQueryCreateNavigationFilter): Promise<Result<FacetValueIdentifier>>;
10
- protected parseFacetValue(facetValueIdentifier: FacetValueIdentifier, label: string, count: number): ProductSearchResultFacetValue;
11
- protected parseFacet(facetIdentifier: FacetIdentifier, facetValue: unknown): ProductSearchResultFacet;
12
- protected parseVariant(variant: unknown, product: unknown): ProductSearchResultItemVariant;
13
10
  }
@@ -1,10 +1,12 @@
1
- import { type ProductQueryById, type ProductQueryBySlug, type RequestContext, type Cache as ReactinaryCache, ProductProvider, type ProductQueryBySKU, type Product, type Result, type NotFoundError } from '@reactionary/core';
1
+ import { type Cache, type NotFoundError, type ProductFactory, type ProductFactoryOutput, type ProductFactoryWithOutput, type ProductQueryById, type ProductQueryBySKU, type ProductQueryBySlug, ProductProvider, type RequestContext, type Result } from '@reactionary/core';
2
2
  import type { FakeConfiguration } from '../schema/configuration.schema.js';
3
- export declare class FakeProductProvider extends ProductProvider {
3
+ import type { FakeProductFactory } from '../factories/product/product.factory.js';
4
+ export declare class FakeProductProvider<TFactory extends ProductFactory = FakeProductFactory> extends ProductProvider<ProductFactoryOutput<TFactory>> {
4
5
  protected config: FakeConfiguration;
5
- constructor(config: FakeConfiguration, cache: ReactinaryCache, context: RequestContext);
6
- getById(payload: ProductQueryById): Promise<Result<Product>>;
7
- getBySlug(payload: ProductQueryBySlug): Promise<Result<Product, NotFoundError>>;
8
- getBySKU(payload: ProductQueryBySKU): Promise<Result<Product>>;
9
- protected parseSingle(body: string): Product;
6
+ protected factory: ProductFactoryWithOutput<TFactory>;
7
+ constructor(config: FakeConfiguration, cache: Cache, context: RequestContext, factory: ProductFactoryWithOutput<TFactory>);
8
+ getById(payload: ProductQueryById): Promise<Result<ProductFactoryOutput<TFactory>>>;
9
+ getBySlug(payload: ProductQueryBySlug): Promise<Result<ProductFactoryOutput<TFactory>, NotFoundError>>;
10
+ getBySKU(payload: ProductQueryBySKU): Promise<Result<ProductFactoryOutput<TFactory>>>;
11
+ protected composeSingle(body: string): ProductFactoryOutput<TFactory>;
10
12
  }
@@ -1,24 +1,18 @@
1
- import { ProfileProvider, type Cache, type IdentityIdentifier, type NotFoundError, type Profile, type ProfileMutationAddShippingAddress, type ProfileMutationMakeShippingAddressDefault, type ProfileMutationRemoveShippingAddress, type ProfileMutationSetBillingAddress, type ProfileMutationUpdate, type ProfileMutationUpdateShippingAddress, type ProfileQuerySelf, type RequestContext, type Result } from '@reactionary/core';
1
+ import { ProfileProvider, type Cache, type Address, type IdentityIdentifier, type NotFoundError, type ProfileFactory, type ProfileFactoryOutput, type ProfileFactoryWithOutput, type ProfileMutationAddShippingAddress, type ProfileMutationMakeShippingAddressDefault, type ProfileMutationRemoveShippingAddress, type ProfileMutationSetBillingAddress, type ProfileMutationUpdate, type ProfileMutationUpdateShippingAddress, type ProfileQuerySelf, type RequestContext, type Result } from '@reactionary/core';
2
2
  import type { FakeConfiguration } from '../schema/configuration.schema.js';
3
- export declare class FakeProfileProvider extends ProfileProvider {
3
+ import type { FakeProfileFactory } from '../factories/profile/profile.factory.js';
4
+ export declare class FakeProfileProvider<TFactory extends ProfileFactory = FakeProfileFactory> extends ProfileProvider<ProfileFactoryOutput<TFactory>> {
4
5
  protected config: FakeConfiguration;
6
+ protected factory: ProfileFactoryWithOutput<TFactory>;
5
7
  private generator;
6
- constructor(config: FakeConfiguration, cache: Cache, context: RequestContext);
7
- getById(payload: ProfileQuerySelf): Promise<Result<Profile, NotFoundError>>;
8
- update(payload: ProfileMutationUpdate): Promise<Result<Profile, NotFoundError>>;
9
- addShippingAddress(payload: ProfileMutationAddShippingAddress): Promise<Result<Profile, NotFoundError>>;
10
- updateShippingAddress(payload: ProfileMutationUpdateShippingAddress): Promise<Result<Profile, NotFoundError>>;
11
- removeShippingAddress(payload: ProfileMutationRemoveShippingAddress): Promise<Result<Profile, NotFoundError>>;
12
- makeShippingAddressDefault(payload: ProfileMutationMakeShippingAddressDefault): Promise<Result<Profile, NotFoundError>>;
13
- setBillingAddress(payload: ProfileMutationSetBillingAddress): Promise<Result<Profile, NotFoundError>>;
14
- protected composeBaseProfile(identifier?: IdentityIdentifier): {
15
- alternateShippingAddresses: never[];
16
- createdAt: string;
17
- email: string;
18
- emailVerified: true;
19
- identifier: IdentityIdentifier;
20
- phone: string;
21
- phoneVerified: true;
22
- updatedAt: string;
23
- };
8
+ constructor(config: FakeConfiguration, cache: Cache, context: RequestContext, factory: ProfileFactoryWithOutput<TFactory>);
9
+ getById(payload: ProfileQuerySelf): Promise<Result<ProfileFactoryOutput<TFactory>, NotFoundError>>;
10
+ update(payload: ProfileMutationUpdate): Promise<Result<ProfileFactoryOutput<TFactory>, NotFoundError>>;
11
+ addShippingAddress(payload: ProfileMutationAddShippingAddress): Promise<Result<ProfileFactoryOutput<TFactory>, NotFoundError>>;
12
+ updateShippingAddress(payload: ProfileMutationUpdateShippingAddress): Promise<Result<ProfileFactoryOutput<TFactory>, NotFoundError>>;
13
+ removeShippingAddress(payload: ProfileMutationRemoveShippingAddress): Promise<Result<ProfileFactoryOutput<TFactory>, NotFoundError>>;
14
+ makeShippingAddressDefault(payload: ProfileMutationMakeShippingAddressDefault): Promise<Result<ProfileFactoryOutput<TFactory>, NotFoundError>>;
15
+ setBillingAddress(payload: ProfileMutationSetBillingAddress): Promise<Result<ProfileFactoryOutput<TFactory>, NotFoundError>>;
16
+ protected composeProfile(identifier: IdentityIdentifier): ProfileFactoryOutput<TFactory>;
17
+ protected createEmptyAddress(): Address;
24
18
  }
@@ -1,8 +1,10 @@
1
- import type { Cache, RequestContext, Store, StoreQueryByProximity, Result } from '@reactionary/core';
1
+ import type { Cache, RequestContext, Result, StoreFactory, StoreFactoryOutput, StoreFactoryWithOutput, StoreQueryByProximity } from '@reactionary/core';
2
2
  import { StoreProvider } from '@reactionary/core';
3
3
  import type { FakeConfiguration } from '../schema/configuration.schema.js';
4
- export declare class FakeStoreProvider extends StoreProvider {
4
+ import type { FakeStoreFactory } from '../factories/store/store.factory.js';
5
+ export declare class FakeStoreProvider<TFactory extends StoreFactory = FakeStoreFactory> extends StoreProvider<StoreFactoryOutput<TFactory>> {
5
6
  protected config: FakeConfiguration;
6
- constructor(config: FakeConfiguration, cache: Cache, context: RequestContext);
7
- queryByProximity(payload: StoreQueryByProximity): Promise<Result<Store[]>>;
7
+ protected factory: StoreFactoryWithOutput<TFactory>;
8
+ constructor(config: FakeConfiguration, cache: Cache, context: RequestContext, factory: StoreFactoryWithOutput<TFactory>);
9
+ queryByProximity(payload: StoreQueryByProximity): Promise<Result<StoreFactoryOutput<TFactory>[]>>;
8
10
  }