@reactionary/core 0.0.81 → 0.0.83
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/decorators/reactionary.decorator.js +2 -2
- package/initialization.js +0 -17
- package/package.json +1 -1
- package/providers/base.provider.js +1 -29
- package/providers/cart.provider.js +36 -3
- package/providers/inventory.provider.js +3 -2
- package/providers/order.provider.js +39 -3
- package/providers/price.provider.js +19 -12
- package/providers/product.provider.js +34 -11
- package/schemas/models/identifiers.model.js +35 -37
- package/schemas/models/identity.model.js +5 -5
- package/schemas/models/inventory.model.js +7 -5
- package/schemas/models/order.model.js +16 -16
- package/schemas/models/payment.model.js +10 -10
- package/schemas/models/price.model.js +7 -7
- package/schemas/models/product-search.model.js +15 -15
- package/schemas/models/product.model.js +32 -32
- package/schemas/models/profile.model.js +16 -16
- package/schemas/models/shipping-method.model.js +19 -19
- package/schemas/models/store.model.js +7 -4
- package/schemas/mutations/analytics.mutation.js +3 -3
- package/schemas/mutations/cart.mutation.js +19 -19
- package/schemas/mutations/checkout.mutation.js +10 -10
- package/schemas/mutations/profile.mutation.js +2 -2
- package/schemas/queries/cart.query.js +1 -1
- package/schemas/queries/category.query.js +6 -6
- package/schemas/queries/checkout.query.js +3 -3
- package/schemas/queries/inventory.query.js +3 -3
- package/schemas/queries/order.query.js +1 -1
- package/schemas/queries/price.query.js +2 -2
- package/schemas/queries/product-search.query.js +1 -1
- package/schemas/queries/product.query.js +4 -4
- package/schemas/queries/store.query.js +4 -4
- package/src/providers/analytics.provider.d.ts +1 -2
- package/src/providers/base.provider.d.ts +3 -22
- package/src/providers/cart.provider.d.ts +10 -10
- package/src/providers/category.provider.d.ts +7 -7
- package/src/providers/checkout.provider.d.ts +8 -8
- package/src/providers/identity.provider.d.ts +5 -5
- package/src/providers/inventory.provider.d.ts +3 -3
- package/src/providers/order.provider.d.ts +6 -6
- package/src/providers/price.provider.d.ts +5 -5
- package/src/providers/product-search.provider.d.ts +2 -2
- package/src/providers/product.provider.d.ts +5 -12
- package/src/providers/profile.provider.d.ts +3 -3
- package/src/providers/store.provider.d.ts +2 -2
- package/src/schemas/capabilities.schema.d.ts +2 -1
- package/src/schemas/models/analytics.model.d.ts +2 -1
- package/src/schemas/models/base.model.d.ts +6 -5
- package/src/schemas/models/cart.model.d.ts +53 -52
- package/src/schemas/models/category.model.d.ts +7 -6
- package/src/schemas/models/checkout.model.d.ts +94 -93
- package/src/schemas/models/cost.model.d.ts +33 -32
- package/src/schemas/models/currency.model.d.ts +2 -1
- package/src/schemas/models/identifiers.model.d.ts +80 -79
- package/src/schemas/models/identity.model.d.ts +23 -22
- package/src/schemas/models/inventory.model.d.ts +21 -12
- package/src/schemas/models/order.model.d.ts +140 -137
- package/src/schemas/models/payment.model.d.ts +31 -30
- package/src/schemas/models/price.model.d.ts +31 -30
- package/src/schemas/models/product-search.model.d.ts +118 -117
- package/src/schemas/models/product.model.d.ts +137 -136
- package/src/schemas/models/profile.model.d.ts +50 -49
- package/src/schemas/models/shipping-method.model.d.ts +42 -41
- package/src/schemas/models/store.model.d.ts +9 -8
- package/src/schemas/mutations/analytics.mutation.d.ts +48 -47
- package/src/schemas/mutations/base.mutation.d.ts +2 -1
- package/src/schemas/mutations/cart.mutation.d.ts +73 -72
- package/src/schemas/mutations/checkout.mutation.d.ts +96 -95
- package/src/schemas/mutations/identity.mutation.d.ts +4 -3
- package/src/schemas/mutations/profile.mutation.d.ts +4 -3
- package/src/schemas/queries/base.query.d.ts +2 -1
- package/src/schemas/queries/cart.query.d.ts +7 -7
- package/src/schemas/queries/category.query.d.ts +20 -19
- package/src/schemas/queries/checkout.query.d.ts +7 -6
- package/src/schemas/queries/identity.query.d.ts +2 -1
- package/src/schemas/queries/inventory.query.d.ts +8 -7
- package/src/schemas/queries/order.query.d.ts +3 -2
- package/src/schemas/queries/price.query.d.ts +5 -4
- package/src/schemas/queries/product-search.query.d.ts +12 -11
- package/src/schemas/queries/product.query.d.ts +14 -13
- package/src/schemas/queries/profile.query.d.ts +2 -1
- package/src/schemas/queries/store.query.d.ts +6 -5
- package/src/schemas/session.schema.d.ts +1 -1
- package/src/zod-utils.d.ts +5 -0
- package/zod-utils.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Category } from "../schemas/
|
|
1
|
+
import type { Category, CategoryPaginatedResult } from "../schemas/index.js";
|
|
2
2
|
import type { CategoryQueryById, CategoryQueryBySlug, CategoryQueryForBreadcrumb, CategoryQueryForChildCategories, CategoryQueryForTopCategories } from "../schemas/queries/category.query.js";
|
|
3
3
|
import { BaseProvider } from "./base.provider.js";
|
|
4
4
|
/**
|
|
@@ -9,7 +9,7 @@ import { BaseProvider } from "./base.provider.js";
|
|
|
9
9
|
* We only allow fetching one hierachy level at a time, for now. This is to avoid development patterns of "fetch 5000 categories in one go.."
|
|
10
10
|
*
|
|
11
11
|
*/
|
|
12
|
-
export declare abstract class CategoryProvider
|
|
12
|
+
export declare abstract class CategoryProvider extends BaseProvider {
|
|
13
13
|
/**
|
|
14
14
|
* Get a single category by its ID. Cannot return null, because HOW did you come across a categories ID that does not exist?
|
|
15
15
|
*
|
|
@@ -25,7 +25,7 @@ export declare abstract class CategoryProvider<T extends Category = Category> ex
|
|
|
25
25
|
* @param id
|
|
26
26
|
* @param session
|
|
27
27
|
*/
|
|
28
|
-
abstract getById(payload: CategoryQueryById): Promise<
|
|
28
|
+
abstract getById(payload: CategoryQueryById): Promise<Category>;
|
|
29
29
|
/**
|
|
30
30
|
* Gets a single category by its seo slug
|
|
31
31
|
*
|
|
@@ -33,7 +33,7 @@ export declare abstract class CategoryProvider<T extends Category = Category> ex
|
|
|
33
33
|
* @param slug the slug
|
|
34
34
|
* @param session
|
|
35
35
|
*/
|
|
36
|
-
abstract getBySlug(payload: CategoryQueryBySlug): Promise<
|
|
36
|
+
abstract getBySlug(payload: CategoryQueryBySlug): Promise<Category | null>;
|
|
37
37
|
/**
|
|
38
38
|
* Gets the breadcrumb path to the category, i.e. all parents up to the root.
|
|
39
39
|
* The returned order is from root to leaf.
|
|
@@ -42,7 +42,7 @@ export declare abstract class CategoryProvider<T extends Category = Category> ex
|
|
|
42
42
|
* @param id
|
|
43
43
|
* @param session
|
|
44
44
|
*/
|
|
45
|
-
abstract getBreadcrumbPathToCategory(payload: CategoryQueryForBreadcrumb): Promise<
|
|
45
|
+
abstract getBreadcrumbPathToCategory(payload: CategoryQueryForBreadcrumb): Promise<Category[]>;
|
|
46
46
|
/**
|
|
47
47
|
* Finds all child categories of a given category.
|
|
48
48
|
*
|
|
@@ -53,7 +53,7 @@ export declare abstract class CategoryProvider<T extends Category = Category> ex
|
|
|
53
53
|
* @param id The ID of the parent category.
|
|
54
54
|
* @param session The session information.
|
|
55
55
|
*/
|
|
56
|
-
abstract findChildCategories(payload: CategoryQueryForChildCategories): Promise<
|
|
56
|
+
abstract findChildCategories(payload: CategoryQueryForChildCategories): Promise<CategoryPaginatedResult>;
|
|
57
57
|
/**
|
|
58
58
|
* Returns all top categories, i.e. categories without a parent.
|
|
59
59
|
*
|
|
@@ -61,6 +61,6 @@ export declare abstract class CategoryProvider<T extends Category = Category> ex
|
|
|
61
61
|
* @param paginationOptions
|
|
62
62
|
* @param session
|
|
63
63
|
*/
|
|
64
|
-
abstract findTopCategories(payload: CategoryQueryForTopCategories): Promise<
|
|
64
|
+
abstract findTopCategories(payload: CategoryQueryForTopCategories): Promise<CategoryPaginatedResult>;
|
|
65
65
|
protected getResourceName(): string;
|
|
66
66
|
}
|
|
@@ -2,7 +2,7 @@ import type { Checkout, PaymentMethod, ShippingMethod } from "../schemas/models/
|
|
|
2
2
|
import { BaseProvider } from "./base.provider.js";
|
|
3
3
|
import type { CheckoutMutationFinalizeCheckout, CheckoutMutationInitiateCheckout, CheckoutMutationSetShippingAddress, CheckoutMutationAddPaymentInstruction, CheckoutMutationRemovePaymentInstruction, CheckoutMutationSetShippingInstruction } from "../schemas/mutations/checkout.mutation.js";
|
|
4
4
|
import type { CheckoutQueryById, CheckoutQueryForAvailablePaymentMethods, CheckoutQueryForAvailableShippingMethods } from "../schemas/queries/index.js";
|
|
5
|
-
export declare abstract class CheckoutProvider
|
|
5
|
+
export declare abstract class CheckoutProvider extends BaseProvider {
|
|
6
6
|
/**
|
|
7
7
|
* This starts a new checkout session for the given cart. The checkout might duplicate the cart, or just reference it, depending on implementation, but changes to the cart,
|
|
8
8
|
* is not reflected in the checkout, and vice versa. The checkout is a snapshot of the cart at the time of initiation.
|
|
@@ -13,7 +13,7 @@ export declare abstract class CheckoutProvider<T extends Checkout = Checkout> ex
|
|
|
13
13
|
* @param billingAddress the billing/shipping address to start with. This affects available shipping methods, and may be required by some payment providers.
|
|
14
14
|
* @param reqCtx
|
|
15
15
|
*/
|
|
16
|
-
abstract initiateCheckoutForCart(payload: CheckoutMutationInitiateCheckout): Promise<
|
|
16
|
+
abstract initiateCheckoutForCart(payload: CheckoutMutationInitiateCheckout): Promise<Checkout>;
|
|
17
17
|
/**
|
|
18
18
|
* Fetches an existing checkout by its identifier.
|
|
19
19
|
*
|
|
@@ -21,7 +21,7 @@ export declare abstract class CheckoutProvider<T extends Checkout = Checkout> ex
|
|
|
21
21
|
* @param payload
|
|
22
22
|
* @param reqCtx
|
|
23
23
|
*/
|
|
24
|
-
abstract getById(payload: CheckoutQueryById): Promise<
|
|
24
|
+
abstract getById(payload: CheckoutQueryById): Promise<Checkout | null>;
|
|
25
25
|
/**
|
|
26
26
|
* Updates the shipping address for the checkout and recalculates the shipping methods and totals.
|
|
27
27
|
*
|
|
@@ -30,7 +30,7 @@ export declare abstract class CheckoutProvider<T extends Checkout = Checkout> ex
|
|
|
30
30
|
* NOTE: Unsure this is really needed.
|
|
31
31
|
* @param shippingAddress The updated shipping address. Note: This may also be the billing address, if your store does not differentiate.
|
|
32
32
|
*/
|
|
33
|
-
abstract setShippingAddress(payload: CheckoutMutationSetShippingAddress): Promise<
|
|
33
|
+
abstract setShippingAddress(payload: CheckoutMutationSetShippingAddress): Promise<Checkout>;
|
|
34
34
|
/**
|
|
35
35
|
* Returns all available shipping methods for the given checkout. This will typically depend on the shipping address, and possibly also the items in the checkout.
|
|
36
36
|
*
|
|
@@ -54,14 +54,14 @@ export declare abstract class CheckoutProvider<T extends Checkout = Checkout> ex
|
|
|
54
54
|
*
|
|
55
55
|
* Usecase: User has chosen a payment method, and you need to start the payment process.
|
|
56
56
|
*/
|
|
57
|
-
abstract addPaymentInstruction(payload: CheckoutMutationAddPaymentInstruction): Promise<
|
|
57
|
+
abstract addPaymentInstruction(payload: CheckoutMutationAddPaymentInstruction): Promise<Checkout>;
|
|
58
58
|
/**
|
|
59
59
|
* Removes a payment instruction from the checkout. This will typically void the payment intent in the payment provider, and remove the payment instruction from the checkout.
|
|
60
60
|
*
|
|
61
61
|
* Usecase: User has decided to change payment method, or has cancelled the payment process.
|
|
62
62
|
* @param paymentInstructionId
|
|
63
63
|
*/
|
|
64
|
-
abstract removePaymentInstruction(payload: CheckoutMutationRemovePaymentInstruction): Promise<
|
|
64
|
+
abstract removePaymentInstruction(payload: CheckoutMutationRemovePaymentInstruction): Promise<Checkout>;
|
|
65
65
|
/**
|
|
66
66
|
* Sets the shipping method and optional pickup point for the checkout. The pickup point can be a physical store, a locker, or similar.
|
|
67
67
|
* If it is unset, it means home delivery to the shipping address.
|
|
@@ -72,7 +72,7 @@ export declare abstract class CheckoutProvider<T extends Checkout = Checkout> ex
|
|
|
72
72
|
* @param shippingMethodId
|
|
73
73
|
* @param pickupPoint
|
|
74
74
|
*/
|
|
75
|
-
abstract setShippingInstruction(payload: CheckoutMutationSetShippingInstruction): Promise<
|
|
75
|
+
abstract setShippingInstruction(payload: CheckoutMutationSetShippingInstruction): Promise<Checkout>;
|
|
76
76
|
/**
|
|
77
77
|
* Finalizes the checkout process. This typically involves creating an order from the checkout and processing payment.
|
|
78
78
|
*
|
|
@@ -81,7 +81,7 @@ export declare abstract class CheckoutProvider<T extends Checkout = Checkout> ex
|
|
|
81
81
|
* @param payload
|
|
82
82
|
* @param reqCtx
|
|
83
83
|
*/
|
|
84
|
-
abstract finalizeCheckout(payload: CheckoutMutationFinalizeCheckout): Promise<
|
|
84
|
+
abstract finalizeCheckout(payload: CheckoutMutationFinalizeCheckout): Promise<Checkout>;
|
|
85
85
|
getResourceName(): string;
|
|
86
86
|
}
|
|
87
87
|
/**
|
|
@@ -2,10 +2,10 @@ import type { Identity } from "../schemas/models/identity.model.js";
|
|
|
2
2
|
import type { IdentityMutationLogin, IdentityMutationLogout, IdentityMutationRegister } from "../schemas/mutations/identity.mutation.js";
|
|
3
3
|
import type { IdentityQuerySelf } from "../schemas/queries/identity.query.js";
|
|
4
4
|
import { BaseProvider } from "./base.provider.js";
|
|
5
|
-
export declare abstract class IdentityProvider
|
|
6
|
-
abstract getSelf(payload: IdentityQuerySelf): Promise<
|
|
7
|
-
abstract login(payload: IdentityMutationLogin): Promise<
|
|
8
|
-
abstract logout(payload: IdentityMutationLogout): Promise<
|
|
9
|
-
abstract register(payload: IdentityMutationRegister): Promise<
|
|
5
|
+
export declare abstract class IdentityProvider extends BaseProvider {
|
|
6
|
+
abstract getSelf(payload: IdentityQuerySelf): Promise<Identity>;
|
|
7
|
+
abstract login(payload: IdentityMutationLogin): Promise<Identity>;
|
|
8
|
+
abstract logout(payload: IdentityMutationLogout): Promise<Identity>;
|
|
9
|
+
abstract register(payload: IdentityMutationRegister): Promise<Identity>;
|
|
10
10
|
protected getResourceName(): string;
|
|
11
11
|
}
|
|
@@ -2,8 +2,8 @@ import type { InventoryIdentifier } from '../schemas/models/identifiers.model.js
|
|
|
2
2
|
import type { Inventory } from '../schemas/models/inventory.model.js';
|
|
3
3
|
import type { InventoryQueryBySKU } from '../schemas/queries/inventory.query.js';
|
|
4
4
|
import { BaseProvider } from './base.provider.js';
|
|
5
|
-
export declare abstract class InventoryProvider
|
|
6
|
-
abstract getBySKU(payload: InventoryQueryBySKU): Promise<
|
|
5
|
+
export declare abstract class InventoryProvider extends BaseProvider {
|
|
6
|
+
abstract getBySKU(payload: InventoryQueryBySKU): Promise<Inventory>;
|
|
7
7
|
protected getResourceName(): string;
|
|
8
|
-
protected createEmptyInventory(key: InventoryIdentifier):
|
|
8
|
+
protected createEmptyInventory(key: InventoryIdentifier): Inventory;
|
|
9
9
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { BaseProvider } from
|
|
2
|
-
import type { Order } from
|
|
3
|
-
import type { OrderQueryById } from
|
|
4
|
-
export declare abstract class OrderProvider
|
|
1
|
+
import { BaseProvider } from './base.provider.js';
|
|
2
|
+
import type { Order } from '../schemas/models/index.js';
|
|
3
|
+
import type { OrderQueryById } from '../schemas/queries/index.js';
|
|
4
|
+
export declare abstract class OrderProvider extends BaseProvider {
|
|
5
5
|
/**
|
|
6
6
|
* Get order by ID.
|
|
7
7
|
*
|
|
@@ -9,7 +9,7 @@ export declare abstract class OrderProvider<T extends Order = Order> extends Bas
|
|
|
9
9
|
* @param payload
|
|
10
10
|
* @param session
|
|
11
11
|
*/
|
|
12
|
-
abstract getById(payload: OrderQueryById): Promise<
|
|
13
|
-
protected createEmptyOrder():
|
|
12
|
+
abstract getById(payload: OrderQueryById): Promise<Order>;
|
|
13
|
+
protected createEmptyOrder(): Order;
|
|
14
14
|
protected getResourceName(): string;
|
|
15
15
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Price } from '../schemas/
|
|
1
|
+
import type { Price } from '../schemas/index.js';
|
|
2
2
|
import type { CustomerPriceQuery, ListPriceQuery } from '../schemas/queries/price.query.js';
|
|
3
3
|
import { BaseProvider } from './base.provider.js';
|
|
4
|
-
export declare abstract class PriceProvider
|
|
4
|
+
export declare abstract class PriceProvider extends BaseProvider {
|
|
5
5
|
/**
|
|
6
6
|
* Get a list price price by SKU. This is the most general, undiscounted price and is typically
|
|
7
7
|
* used as the "before" price in most ecommerce setups.
|
|
@@ -10,7 +10,7 @@ export declare abstract class PriceProvider<T extends Price = Price> extends Bas
|
|
|
10
10
|
* @param payload The SKU to query
|
|
11
11
|
* @param session The session information
|
|
12
12
|
*/
|
|
13
|
-
abstract getListPrice(payload: ListPriceQuery): Promise<
|
|
13
|
+
abstract getListPrice(payload: ListPriceQuery): Promise<Price>;
|
|
14
14
|
/**
|
|
15
15
|
* Get a customer-specific price by SKU.
|
|
16
16
|
*
|
|
@@ -20,7 +20,7 @@ export declare abstract class PriceProvider<T extends Price = Price> extends Bas
|
|
|
20
20
|
* @param payload The SKU to query
|
|
21
21
|
* @param session The session information
|
|
22
22
|
*/
|
|
23
|
-
abstract getCustomerPrice(payload: CustomerPriceQuery): Promise<
|
|
23
|
+
abstract getCustomerPrice(payload: CustomerPriceQuery): Promise<Price>;
|
|
24
24
|
/**
|
|
25
25
|
* Utility function to create an empty price result, with a value of -1.
|
|
26
26
|
* This is used when no price is found for a given SKU + currency combination.
|
|
@@ -29,6 +29,6 @@ export declare abstract class PriceProvider<T extends Price = Price> extends Bas
|
|
|
29
29
|
* @param currency
|
|
30
30
|
* @returns
|
|
31
31
|
*/
|
|
32
|
-
protected createEmptyPriceResult(sku: string):
|
|
32
|
+
protected createEmptyPriceResult(sku: string): Price;
|
|
33
33
|
protected getResourceName(): string;
|
|
34
34
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { FacetIdentifier, FacetValueIdentifier } from '../index.js';
|
|
2
|
-
import type { ProductSearchResult, ProductSearchResultFacet, ProductSearchResultFacetValue,
|
|
2
|
+
import type { ProductSearchResult, ProductSearchResultFacet, ProductSearchResultFacetValue, ProductSearchResultItemVariant } from '../schemas/models/product-search.model.js';
|
|
3
3
|
import type { ProductSearchQueryByTerm } from '../schemas/queries/product-search.query.js';
|
|
4
4
|
import { BaseProvider } from './base.provider.js';
|
|
5
|
-
export declare abstract class ProductSearchProvider
|
|
5
|
+
export declare abstract class ProductSearchProvider extends BaseProvider {
|
|
6
6
|
protected getResourceName(): string;
|
|
7
7
|
abstract queryByTerm(payload: ProductSearchQueryByTerm): Promise<ProductSearchResult>;
|
|
8
8
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Product } from '../schemas/models/product.model.js';
|
|
2
2
|
import { BaseProvider } from './base.provider.js';
|
|
3
3
|
import type { ProductQueryById, ProductQueryBySKU, ProductQueryBySlug } from '../schemas/queries/product.query.js';
|
|
4
|
-
export declare abstract class ProductProvider
|
|
4
|
+
export declare abstract class ProductProvider extends BaseProvider {
|
|
5
5
|
/**
|
|
6
6
|
* Get a product by its ID.
|
|
7
7
|
* @param payload The query payload containing the product ID.
|
|
@@ -12,7 +12,7 @@ export declare abstract class ProductProvider<T extends Product = Product> exten
|
|
|
12
12
|
* Marketing will TYPICALLY recommend products, and in some cases maybe HeroVariants of a product.
|
|
13
13
|
* In that case, you would need to resolve the product to its hero variant first, and then get the SKU from there.
|
|
14
14
|
*/
|
|
15
|
-
abstract getById(payload: ProductQueryById): Promise<
|
|
15
|
+
abstract getById(payload: ProductQueryById): Promise<Product>;
|
|
16
16
|
/**
|
|
17
17
|
* Get a product by its slug.
|
|
18
18
|
* @param payload The query payload containing the product slug.
|
|
@@ -20,7 +20,7 @@ export declare abstract class ProductProvider<T extends Product = Product> exten
|
|
|
20
20
|
*
|
|
21
21
|
* Usecase: You are rendering a product detail page, and you need to fetch the product by its slug.
|
|
22
22
|
*/
|
|
23
|
-
abstract getBySlug(payload: ProductQueryBySlug): Promise<
|
|
23
|
+
abstract getBySlug(payload: ProductQueryBySlug): Promise<Product | null>;
|
|
24
24
|
/**
|
|
25
25
|
* Get a product by its SKU
|
|
26
26
|
* @param payload
|
|
@@ -30,15 +30,8 @@ export declare abstract class ProductProvider<T extends Product = Product> exten
|
|
|
30
30
|
* and you need to fetch the product details for that SKU. You will get the a Product back, with the variant matching the SKU set as heroSku.
|
|
31
31
|
* It might also be used on a quick-order page, or product recommendations from external system.
|
|
32
32
|
*/
|
|
33
|
-
abstract getBySKU(payload: ProductQueryBySKU): Promise<
|
|
34
|
-
|
|
35
|
-
* Returns a set of Products for each variant. Is a paged response, to ensure we do not build in overfetching from the start.
|
|
36
|
-
*
|
|
37
|
-
* Usecase: You are rendering a variant-list on a b2b PDP page maybe, and it contains 500 variants. You do not want to fetch all 500 variants in one go.
|
|
38
|
-
* @param payload
|
|
39
|
-
* @param reqCtx
|
|
40
|
-
*/
|
|
41
|
-
protected createEmptyProduct(id: string): T;
|
|
33
|
+
abstract getBySKU(payload: ProductQueryBySKU): Promise<Product>;
|
|
34
|
+
protected createEmptyProduct(id: string): Product;
|
|
42
35
|
/**
|
|
43
36
|
* The resource name, used for caching and logging.
|
|
44
37
|
* @returns
|
|
@@ -2,8 +2,8 @@ import type { Profile } from '../schemas/models/index.js';
|
|
|
2
2
|
import type { ProfileMutationUpdate } from '../schemas/mutations/index.js';
|
|
3
3
|
import type { ProfileQuerySelf } from '../schemas/queries/index.js';
|
|
4
4
|
import { BaseProvider } from './base.provider.js';
|
|
5
|
-
export declare abstract class ProfileProvider
|
|
6
|
-
abstract getSelf(payload: ProfileQuerySelf): Promise<
|
|
7
|
-
abstract update(payload: ProfileMutationUpdate): Promise<
|
|
5
|
+
export declare abstract class ProfileProvider extends BaseProvider {
|
|
6
|
+
abstract getSelf(payload: ProfileQuerySelf): Promise<Profile>;
|
|
7
|
+
abstract update(payload: ProfileMutationUpdate): Promise<Profile>;
|
|
8
8
|
protected getResourceName(): string;
|
|
9
9
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Store } from '../schemas/models/store.model.js';
|
|
2
2
|
import type { StoreQueryByProximity } from '../schemas/queries/index.js';
|
|
3
3
|
import { BaseProvider } from './base.provider.js';
|
|
4
|
-
export declare abstract class StoreProvider
|
|
5
|
-
abstract queryByProximity(payload: StoreQueryByProximity): Promise<Array<
|
|
4
|
+
export declare abstract class StoreProvider extends BaseProvider {
|
|
5
|
+
abstract queryByProximity(payload: StoreQueryByProximity): Promise<Array<Store>>;
|
|
6
6
|
protected getResourceName(): string;
|
|
7
7
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import type { InferType } from '../zod-utils.js';
|
|
2
3
|
export declare const CapabilitiesSchema: z.ZodObject<{
|
|
3
4
|
product: z.ZodBoolean;
|
|
4
5
|
productSearch: z.ZodBoolean;
|
|
@@ -13,4 +14,4 @@ export declare const CapabilitiesSchema: z.ZodObject<{
|
|
|
13
14
|
store: z.ZodBoolean;
|
|
14
15
|
profile: z.ZodBoolean;
|
|
15
16
|
}, z.core.$loose>;
|
|
16
|
-
export type Capabilities =
|
|
17
|
+
export type Capabilities = InferType<typeof CapabilitiesSchema>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { z } from 'zod';
|
|
2
|
+
import type { InferType } from '../../zod-utils.js';
|
|
2
3
|
export declare const AnalyticsEventSchema: z.ZodObject<{
|
|
3
4
|
meta: z.ZodDefault<z.ZodObject<{
|
|
4
5
|
cache: z.ZodDefault<z.ZodObject<{
|
|
@@ -8,4 +9,4 @@ export declare const AnalyticsEventSchema: z.ZodObject<{
|
|
|
8
9
|
placeholder: z.ZodDefault<z.ZodBoolean>;
|
|
9
10
|
}, z.core.$loose>>;
|
|
10
11
|
}, z.core.$loose>;
|
|
11
|
-
export type AnalyticsEvent =
|
|
12
|
+
export type AnalyticsEvent = InferType<typeof AnalyticsEventSchema>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import type { InferType } from '../../zod-utils.js';
|
|
2
3
|
export declare const CacheInformationSchema: z.ZodObject<{
|
|
3
4
|
hit: z.ZodDefault<z.ZodBoolean>;
|
|
4
5
|
key: z.ZodDefault<z.ZodString>;
|
|
@@ -19,14 +20,10 @@ export declare const BaseModelSchema: z.ZodObject<{
|
|
|
19
20
|
placeholder: z.ZodDefault<z.ZodBoolean>;
|
|
20
21
|
}, z.core.$loose>>;
|
|
21
22
|
}, z.core.$loose>;
|
|
22
|
-
export type CacheInformation = z.infer<typeof CacheInformationSchema>;
|
|
23
|
-
export type Meta = z.infer<typeof MetaSchema>;
|
|
24
|
-
export type BaseModel = z.infer<typeof BaseModelSchema>;
|
|
25
23
|
export declare const PaginationOptionsSchema: z.ZodObject<{
|
|
26
24
|
pageNumber: z.ZodDefault<z.ZodNumber>;
|
|
27
25
|
pageSize: z.ZodDefault<z.ZodNumber>;
|
|
28
26
|
}, z.core.$loose>;
|
|
29
|
-
export type PaginationOptions = z.infer<typeof PaginationOptionsSchema>;
|
|
30
27
|
/**
|
|
31
28
|
* This seemed like the right way to do it, but we need to be able to pass in the item schema even later than this
|
|
32
29
|
*
|
|
@@ -56,4 +53,8 @@ export declare const ImageSchema: z.ZodObject<{
|
|
|
56
53
|
width: z.ZodOptional<z.ZodNumber>;
|
|
57
54
|
height: z.ZodOptional<z.ZodNumber>;
|
|
58
55
|
}, z.core.$loose>;
|
|
59
|
-
export type Image =
|
|
56
|
+
export type Image = InferType<typeof ImageSchema>;
|
|
57
|
+
export type PaginationOptions = InferType<typeof PaginationOptionsSchema>;
|
|
58
|
+
export type CacheInformation = InferType<typeof CacheInformationSchema>;
|
|
59
|
+
export type Meta = InferType<typeof MetaSchema>;
|
|
60
|
+
export type BaseModel = InferType<typeof BaseModelSchema>;
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import type { InferType } from '../../zod-utils.js';
|
|
2
3
|
export declare const CartItemSchema: z.ZodObject<{
|
|
3
4
|
identifier: z.ZodDefault<z.ZodObject<{
|
|
4
|
-
key: z.
|
|
5
|
+
key: z.ZodString;
|
|
5
6
|
}, z.core.$loose>>;
|
|
6
7
|
product: z.ZodDefault<z.ZodObject<{
|
|
7
|
-
key: z.
|
|
8
|
+
key: z.ZodString;
|
|
8
9
|
}, z.core.$loose>>;
|
|
9
10
|
variant: z.ZodDefault<z.ZodObject<{
|
|
10
|
-
sku: z.
|
|
11
|
+
sku: z.ZodString;
|
|
11
12
|
}, z.core.$loose>>;
|
|
12
13
|
quantity: z.ZodDefault<z.ZodNumber>;
|
|
13
14
|
price: z.ZodDefault<z.ZodObject<{
|
|
14
15
|
unitPrice: z.ZodDefault<z.ZodObject<{
|
|
15
|
-
value: z.
|
|
16
|
-
currency: z.
|
|
16
|
+
value: z.ZodNumber;
|
|
17
|
+
currency: z.ZodEnum<{
|
|
17
18
|
AED: "AED";
|
|
18
19
|
AFN: "AFN";
|
|
19
20
|
ALL: "ALL";
|
|
@@ -195,11 +196,11 @@ export declare const CartItemSchema: z.ZodObject<{
|
|
|
195
196
|
ZAR: "ZAR";
|
|
196
197
|
ZMW: "ZMW";
|
|
197
198
|
ZWL: "ZWL";
|
|
198
|
-
}
|
|
199
|
+
}>;
|
|
199
200
|
}, z.core.$loose>>;
|
|
200
201
|
unitDiscount: z.ZodDefault<z.ZodObject<{
|
|
201
|
-
value: z.
|
|
202
|
-
currency: z.
|
|
202
|
+
value: z.ZodNumber;
|
|
203
|
+
currency: z.ZodEnum<{
|
|
203
204
|
AED: "AED";
|
|
204
205
|
AFN: "AFN";
|
|
205
206
|
ALL: "ALL";
|
|
@@ -381,11 +382,11 @@ export declare const CartItemSchema: z.ZodObject<{
|
|
|
381
382
|
ZAR: "ZAR";
|
|
382
383
|
ZMW: "ZMW";
|
|
383
384
|
ZWL: "ZWL";
|
|
384
|
-
}
|
|
385
|
+
}>;
|
|
385
386
|
}, z.core.$loose>>;
|
|
386
387
|
totalPrice: z.ZodDefault<z.ZodObject<{
|
|
387
|
-
value: z.
|
|
388
|
-
currency: z.
|
|
388
|
+
value: z.ZodNumber;
|
|
389
|
+
currency: z.ZodEnum<{
|
|
389
390
|
AED: "AED";
|
|
390
391
|
AFN: "AFN";
|
|
391
392
|
ALL: "ALL";
|
|
@@ -567,11 +568,11 @@ export declare const CartItemSchema: z.ZodObject<{
|
|
|
567
568
|
ZAR: "ZAR";
|
|
568
569
|
ZMW: "ZMW";
|
|
569
570
|
ZWL: "ZWL";
|
|
570
|
-
}
|
|
571
|
+
}>;
|
|
571
572
|
}, z.core.$loose>>;
|
|
572
573
|
totalDiscount: z.ZodDefault<z.ZodObject<{
|
|
573
|
-
value: z.
|
|
574
|
-
currency: z.
|
|
574
|
+
value: z.ZodNumber;
|
|
575
|
+
currency: z.ZodEnum<{
|
|
575
576
|
AED: "AED";
|
|
576
577
|
AFN: "AFN";
|
|
577
578
|
ALL: "ALL";
|
|
@@ -753,7 +754,7 @@ export declare const CartItemSchema: z.ZodObject<{
|
|
|
753
754
|
ZAR: "ZAR";
|
|
754
755
|
ZMW: "ZMW";
|
|
755
756
|
ZWL: "ZWL";
|
|
756
|
-
}
|
|
757
|
+
}>;
|
|
757
758
|
}, z.core.$loose>>;
|
|
758
759
|
}, z.core.$loose>>;
|
|
759
760
|
}, z.core.$loose>;
|
|
@@ -766,26 +767,26 @@ export declare const CartSchema: z.ZodObject<{
|
|
|
766
767
|
placeholder: z.ZodDefault<z.ZodBoolean>;
|
|
767
768
|
}, z.core.$loose>>;
|
|
768
769
|
identifier: z.ZodDefault<z.ZodObject<{
|
|
769
|
-
key: z.
|
|
770
|
+
key: z.ZodString;
|
|
770
771
|
}, z.core.$loose>>;
|
|
771
772
|
userId: z.ZodDefault<z.ZodObject<{
|
|
772
|
-
userId: z.
|
|
773
|
+
userId: z.ZodString;
|
|
773
774
|
}, z.core.$loose>>;
|
|
774
775
|
items: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
775
776
|
identifier: z.ZodDefault<z.ZodObject<{
|
|
776
|
-
key: z.
|
|
777
|
+
key: z.ZodString;
|
|
777
778
|
}, z.core.$loose>>;
|
|
778
779
|
product: z.ZodDefault<z.ZodObject<{
|
|
779
|
-
key: z.
|
|
780
|
+
key: z.ZodString;
|
|
780
781
|
}, z.core.$loose>>;
|
|
781
782
|
variant: z.ZodDefault<z.ZodObject<{
|
|
782
|
-
sku: z.
|
|
783
|
+
sku: z.ZodString;
|
|
783
784
|
}, z.core.$loose>>;
|
|
784
785
|
quantity: z.ZodDefault<z.ZodNumber>;
|
|
785
786
|
price: z.ZodDefault<z.ZodObject<{
|
|
786
787
|
unitPrice: z.ZodDefault<z.ZodObject<{
|
|
787
|
-
value: z.
|
|
788
|
-
currency: z.
|
|
788
|
+
value: z.ZodNumber;
|
|
789
|
+
currency: z.ZodEnum<{
|
|
789
790
|
AED: "AED";
|
|
790
791
|
AFN: "AFN";
|
|
791
792
|
ALL: "ALL";
|
|
@@ -967,11 +968,11 @@ export declare const CartSchema: z.ZodObject<{
|
|
|
967
968
|
ZAR: "ZAR";
|
|
968
969
|
ZMW: "ZMW";
|
|
969
970
|
ZWL: "ZWL";
|
|
970
|
-
}
|
|
971
|
+
}>;
|
|
971
972
|
}, z.core.$loose>>;
|
|
972
973
|
unitDiscount: z.ZodDefault<z.ZodObject<{
|
|
973
|
-
value: z.
|
|
974
|
-
currency: z.
|
|
974
|
+
value: z.ZodNumber;
|
|
975
|
+
currency: z.ZodEnum<{
|
|
975
976
|
AED: "AED";
|
|
976
977
|
AFN: "AFN";
|
|
977
978
|
ALL: "ALL";
|
|
@@ -1153,11 +1154,11 @@ export declare const CartSchema: z.ZodObject<{
|
|
|
1153
1154
|
ZAR: "ZAR";
|
|
1154
1155
|
ZMW: "ZMW";
|
|
1155
1156
|
ZWL: "ZWL";
|
|
1156
|
-
}
|
|
1157
|
+
}>;
|
|
1157
1158
|
}, z.core.$loose>>;
|
|
1158
1159
|
totalPrice: z.ZodDefault<z.ZodObject<{
|
|
1159
|
-
value: z.
|
|
1160
|
-
currency: z.
|
|
1160
|
+
value: z.ZodNumber;
|
|
1161
|
+
currency: z.ZodEnum<{
|
|
1161
1162
|
AED: "AED";
|
|
1162
1163
|
AFN: "AFN";
|
|
1163
1164
|
ALL: "ALL";
|
|
@@ -1339,11 +1340,11 @@ export declare const CartSchema: z.ZodObject<{
|
|
|
1339
1340
|
ZAR: "ZAR";
|
|
1340
1341
|
ZMW: "ZMW";
|
|
1341
1342
|
ZWL: "ZWL";
|
|
1342
|
-
}
|
|
1343
|
+
}>;
|
|
1343
1344
|
}, z.core.$loose>>;
|
|
1344
1345
|
totalDiscount: z.ZodDefault<z.ZodObject<{
|
|
1345
|
-
value: z.
|
|
1346
|
-
currency: z.
|
|
1346
|
+
value: z.ZodNumber;
|
|
1347
|
+
currency: z.ZodEnum<{
|
|
1347
1348
|
AED: "AED";
|
|
1348
1349
|
AFN: "AFN";
|
|
1349
1350
|
ALL: "ALL";
|
|
@@ -1525,14 +1526,14 @@ export declare const CartSchema: z.ZodObject<{
|
|
|
1525
1526
|
ZAR: "ZAR";
|
|
1526
1527
|
ZMW: "ZMW";
|
|
1527
1528
|
ZWL: "ZWL";
|
|
1528
|
-
}
|
|
1529
|
+
}>;
|
|
1529
1530
|
}, z.core.$loose>>;
|
|
1530
1531
|
}, z.core.$loose>>;
|
|
1531
1532
|
}, z.core.$loose>>>;
|
|
1532
1533
|
price: z.ZodDefault<z.ZodObject<{
|
|
1533
1534
|
totalTax: z.ZodDefault<z.ZodObject<{
|
|
1534
|
-
value: z.
|
|
1535
|
-
currency: z.
|
|
1535
|
+
value: z.ZodNumber;
|
|
1536
|
+
currency: z.ZodEnum<{
|
|
1536
1537
|
AED: "AED";
|
|
1537
1538
|
AFN: "AFN";
|
|
1538
1539
|
ALL: "ALL";
|
|
@@ -1714,11 +1715,11 @@ export declare const CartSchema: z.ZodObject<{
|
|
|
1714
1715
|
ZAR: "ZAR";
|
|
1715
1716
|
ZMW: "ZMW";
|
|
1716
1717
|
ZWL: "ZWL";
|
|
1717
|
-
}
|
|
1718
|
+
}>;
|
|
1718
1719
|
}, z.core.$loose>>;
|
|
1719
1720
|
totalDiscount: z.ZodDefault<z.ZodObject<{
|
|
1720
|
-
value: z.
|
|
1721
|
-
currency: z.
|
|
1721
|
+
value: z.ZodNumber;
|
|
1722
|
+
currency: z.ZodEnum<{
|
|
1722
1723
|
AED: "AED";
|
|
1723
1724
|
AFN: "AFN";
|
|
1724
1725
|
ALL: "ALL";
|
|
@@ -1900,11 +1901,11 @@ export declare const CartSchema: z.ZodObject<{
|
|
|
1900
1901
|
ZAR: "ZAR";
|
|
1901
1902
|
ZMW: "ZMW";
|
|
1902
1903
|
ZWL: "ZWL";
|
|
1903
|
-
}
|
|
1904
|
+
}>;
|
|
1904
1905
|
}, z.core.$loose>>;
|
|
1905
1906
|
totalSurcharge: z.ZodDefault<z.ZodObject<{
|
|
1906
|
-
value: z.
|
|
1907
|
-
currency: z.
|
|
1907
|
+
value: z.ZodNumber;
|
|
1908
|
+
currency: z.ZodEnum<{
|
|
1908
1909
|
AED: "AED";
|
|
1909
1910
|
AFN: "AFN";
|
|
1910
1911
|
ALL: "ALL";
|
|
@@ -2086,11 +2087,11 @@ export declare const CartSchema: z.ZodObject<{
|
|
|
2086
2087
|
ZAR: "ZAR";
|
|
2087
2088
|
ZMW: "ZMW";
|
|
2088
2089
|
ZWL: "ZWL";
|
|
2089
|
-
}
|
|
2090
|
+
}>;
|
|
2090
2091
|
}, z.core.$loose>>;
|
|
2091
2092
|
totalShipping: z.ZodDefault<z.ZodObject<{
|
|
2092
|
-
value: z.
|
|
2093
|
-
currency: z.
|
|
2093
|
+
value: z.ZodNumber;
|
|
2094
|
+
currency: z.ZodEnum<{
|
|
2094
2095
|
AED: "AED";
|
|
2095
2096
|
AFN: "AFN";
|
|
2096
2097
|
ALL: "ALL";
|
|
@@ -2272,11 +2273,11 @@ export declare const CartSchema: z.ZodObject<{
|
|
|
2272
2273
|
ZAR: "ZAR";
|
|
2273
2274
|
ZMW: "ZMW";
|
|
2274
2275
|
ZWL: "ZWL";
|
|
2275
|
-
}
|
|
2276
|
+
}>;
|
|
2276
2277
|
}, z.core.$loose>>;
|
|
2277
2278
|
totalProductPrice: z.ZodDefault<z.ZodObject<{
|
|
2278
|
-
value: z.
|
|
2279
|
-
currency: z.
|
|
2279
|
+
value: z.ZodNumber;
|
|
2280
|
+
currency: z.ZodEnum<{
|
|
2280
2281
|
AED: "AED";
|
|
2281
2282
|
AFN: "AFN";
|
|
2282
2283
|
ALL: "ALL";
|
|
@@ -2458,11 +2459,11 @@ export declare const CartSchema: z.ZodObject<{
|
|
|
2458
2459
|
ZAR: "ZAR";
|
|
2459
2460
|
ZMW: "ZMW";
|
|
2460
2461
|
ZWL: "ZWL";
|
|
2461
|
-
}
|
|
2462
|
+
}>;
|
|
2462
2463
|
}, z.core.$loose>>;
|
|
2463
2464
|
grandTotal: z.ZodDefault<z.ZodObject<{
|
|
2464
|
-
value: z.
|
|
2465
|
-
currency: z.
|
|
2465
|
+
value: z.ZodNumber;
|
|
2466
|
+
currency: z.ZodEnum<{
|
|
2466
2467
|
AED: "AED";
|
|
2467
2468
|
AFN: "AFN";
|
|
2468
2469
|
ALL: "ALL";
|
|
@@ -2644,11 +2645,11 @@ export declare const CartSchema: z.ZodObject<{
|
|
|
2644
2645
|
ZAR: "ZAR";
|
|
2645
2646
|
ZMW: "ZMW";
|
|
2646
2647
|
ZWL: "ZWL";
|
|
2647
|
-
}
|
|
2648
|
+
}>;
|
|
2648
2649
|
}, z.core.$loose>>;
|
|
2649
2650
|
}, z.core.$loose>>;
|
|
2650
2651
|
name: z.ZodDefault<z.ZodString>;
|
|
2651
2652
|
description: z.ZodDefault<z.ZodString>;
|
|
2652
2653
|
}, z.core.$loose>;
|
|
2653
|
-
export type CartItem =
|
|
2654
|
-
export type Cart =
|
|
2654
|
+
export type CartItem = InferType<typeof CartItemSchema>;
|
|
2655
|
+
export type Cart = InferType<typeof CartSchema>;
|