@reactionary/core 0.1.13 → 0.2.1
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/cache/memory-cache.js +1 -1
- package/decorators/reactionary.decorator.js +50 -16
- package/package.json +1 -1
- package/providers/base.provider.js +0 -15
- package/providers/cart.provider.js +0 -39
- package/providers/inventory.provider.js +1 -8
- package/providers/order.provider.js +0 -1
- package/providers/price.provider.js +0 -7
- package/providers/product.provider.js +0 -7
- package/schemas/errors/generic.error.js +8 -0
- package/schemas/errors/index.js +4 -0
- package/schemas/errors/invalid-input.error.js +8 -0
- package/schemas/errors/invalid-output.error.js +8 -0
- package/schemas/errors/not-found.error.js +8 -0
- package/schemas/index.js +2 -0
- package/schemas/models/base.model.js +1 -14
- package/schemas/mutations/cart.mutation.js +1 -1
- package/schemas/mutations/checkout.mutation.js +4 -4
- package/schemas/result.js +51 -0
- package/src/cache/memory-cache.d.ts +2 -1
- package/src/decorators/reactionary.decorator.d.ts +3 -2
- package/src/providers/base.provider.d.ts +0 -3
- package/src/providers/cart.provider.d.ts +11 -10
- package/src/providers/category.provider.d.ts +6 -6
- package/src/providers/checkout.provider.d.ts +11 -9
- package/src/providers/identity.provider.d.ts +5 -4
- package/src/providers/inventory.provider.d.ts +3 -1
- package/src/providers/order.provider.d.ts +3 -1
- package/src/providers/price.provider.d.ts +3 -3
- package/src/providers/product-search.provider.d.ts +3 -3
- package/src/providers/product.provider.d.ts +5 -3
- package/src/providers/profile.provider.d.ts +3 -2
- package/src/providers/store.provider.d.ts +2 -1
- package/src/schemas/errors/generic.error.d.ts +7 -0
- package/src/schemas/errors/index.d.ts +4 -0
- package/src/schemas/errors/invalid-input.error.d.ts +7 -0
- package/src/schemas/errors/invalid-output.error.d.ts +7 -0
- package/src/schemas/errors/not-found.error.d.ts +7 -0
- package/src/schemas/index.d.ts +2 -0
- package/src/schemas/models/analytics.model.d.ts +1 -9
- package/src/schemas/models/base.model.d.ts +1 -29
- package/src/schemas/models/cart.model.d.ts +0 -7
- package/src/schemas/models/category.model.d.ts +0 -21
- package/src/schemas/models/checkout.model.d.ts +0 -35
- package/src/schemas/models/identity.model.d.ts +0 -42
- package/src/schemas/models/inventory.model.d.ts +0 -7
- package/src/schemas/models/order.model.d.ts +0 -28
- package/src/schemas/models/payment.model.d.ts +0 -14
- package/src/schemas/models/price.model.d.ts +0 -7
- package/src/schemas/models/product-search.model.d.ts +0 -21
- package/src/schemas/models/product.model.d.ts +0 -7
- package/src/schemas/models/profile.model.d.ts +0 -35
- package/src/schemas/models/shipping-method.model.d.ts +0 -14
- package/src/schemas/models/store.model.d.ts +0 -7
- package/src/schemas/mutations/cart.mutation.d.ts +2 -16
- package/src/schemas/mutations/checkout.mutation.d.ts +1 -8
- package/src/schemas/queries/product-search.query.d.ts +0 -7
- package/src/schemas/result.d.ts +55 -0
|
@@ -2,6 +2,8 @@ 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
|
+
import type { Result } from "../schemas/result.js";
|
|
6
|
+
import type { NotFoundError } from "../schemas/index.js";
|
|
5
7
|
export declare abstract class CheckoutProvider extends BaseProvider {
|
|
6
8
|
/**
|
|
7
9
|
* 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,
|
|
@@ -13,7 +15,7 @@ export declare abstract class CheckoutProvider extends BaseProvider {
|
|
|
13
15
|
* @param billingAddress the billing/shipping address to start with. This affects available shipping methods, and may be required by some payment providers.
|
|
14
16
|
* @param reqCtx
|
|
15
17
|
*/
|
|
16
|
-
abstract initiateCheckoutForCart(payload: CheckoutMutationInitiateCheckout): Promise<Checkout
|
|
18
|
+
abstract initiateCheckoutForCart(payload: CheckoutMutationInitiateCheckout): Promise<Result<Checkout>>;
|
|
17
19
|
/**
|
|
18
20
|
* Fetches an existing checkout by its identifier.
|
|
19
21
|
*
|
|
@@ -21,7 +23,7 @@ export declare abstract class CheckoutProvider extends BaseProvider {
|
|
|
21
23
|
* @param payload
|
|
22
24
|
* @param reqCtx
|
|
23
25
|
*/
|
|
24
|
-
abstract getById(payload: CheckoutQueryById): Promise<Checkout
|
|
26
|
+
abstract getById(payload: CheckoutQueryById): Promise<Result<Checkout, NotFoundError>>;
|
|
25
27
|
/**
|
|
26
28
|
* Updates the shipping address for the checkout and recalculates the shipping methods and totals.
|
|
27
29
|
*
|
|
@@ -30,7 +32,7 @@ export declare abstract class CheckoutProvider extends BaseProvider {
|
|
|
30
32
|
* NOTE: Unsure this is really needed.
|
|
31
33
|
* @param shippingAddress The updated shipping address. Note: This may also be the billing address, if your store does not differentiate.
|
|
32
34
|
*/
|
|
33
|
-
abstract setShippingAddress(payload: CheckoutMutationSetShippingAddress): Promise<Checkout
|
|
35
|
+
abstract setShippingAddress(payload: CheckoutMutationSetShippingAddress): Promise<Result<Checkout>>;
|
|
34
36
|
/**
|
|
35
37
|
* 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
38
|
*
|
|
@@ -39,7 +41,7 @@ export declare abstract class CheckoutProvider extends BaseProvider {
|
|
|
39
41
|
* @param checkoutId The checkout you want to get shipping methods for.
|
|
40
42
|
* @param reqCtx
|
|
41
43
|
*/
|
|
42
|
-
abstract getAvailableShippingMethods(payload: CheckoutQueryForAvailableShippingMethods): Promise<ShippingMethod[]
|
|
44
|
+
abstract getAvailableShippingMethods(payload: CheckoutQueryForAvailableShippingMethods): Promise<Result<ShippingMethod[]>>;
|
|
43
45
|
/**
|
|
44
46
|
* Returns all available payment methods for the given checkout. This will typically depend mostly on the billing address and jurisdiction.
|
|
45
47
|
*
|
|
@@ -48,20 +50,20 @@ export declare abstract class CheckoutProvider extends BaseProvider {
|
|
|
48
50
|
* @param checkoutId The checkout you want to get payment methods for.
|
|
49
51
|
* @param reqCtx
|
|
50
52
|
*/
|
|
51
|
-
abstract getAvailablePaymentMethods(payload: CheckoutQueryForAvailablePaymentMethods): Promise<PaymentMethod[]
|
|
53
|
+
abstract getAvailablePaymentMethods(payload: CheckoutQueryForAvailablePaymentMethods): Promise<Result<PaymentMethod[]>>;
|
|
52
54
|
/**
|
|
53
55
|
* Adds a payment instruction to the checkout. This will typically create a payment intent in the payment provider, and return whatever is needed to continue the payment process, e.g. a client secret for Stripe, or a redirect URL for PayPal.
|
|
54
56
|
*
|
|
55
57
|
* Usecase: User has chosen a payment method, and you need to start the payment process.
|
|
56
58
|
*/
|
|
57
|
-
abstract addPaymentInstruction(payload: CheckoutMutationAddPaymentInstruction): Promise<Checkout
|
|
59
|
+
abstract addPaymentInstruction(payload: CheckoutMutationAddPaymentInstruction): Promise<Result<Checkout>>;
|
|
58
60
|
/**
|
|
59
61
|
* 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
62
|
*
|
|
61
63
|
* Usecase: User has decided to change payment method, or has cancelled the payment process.
|
|
62
64
|
* @param paymentInstructionId
|
|
63
65
|
*/
|
|
64
|
-
abstract removePaymentInstruction(payload: CheckoutMutationRemovePaymentInstruction): Promise<Checkout
|
|
66
|
+
abstract removePaymentInstruction(payload: CheckoutMutationRemovePaymentInstruction): Promise<Result<Checkout>>;
|
|
65
67
|
/**
|
|
66
68
|
* Sets the shipping method and optional pickup point for the checkout. The pickup point can be a physical store, a locker, or similar.
|
|
67
69
|
* If it is unset, it means home delivery to the shipping address.
|
|
@@ -72,7 +74,7 @@ export declare abstract class CheckoutProvider extends BaseProvider {
|
|
|
72
74
|
* @param shippingMethodId
|
|
73
75
|
* @param pickupPoint
|
|
74
76
|
*/
|
|
75
|
-
abstract setShippingInstruction(payload: CheckoutMutationSetShippingInstruction): Promise<Checkout
|
|
77
|
+
abstract setShippingInstruction(payload: CheckoutMutationSetShippingInstruction): Promise<Result<Checkout>>;
|
|
76
78
|
/**
|
|
77
79
|
* Finalizes the checkout process. This typically involves creating an order from the checkout and processing payment.
|
|
78
80
|
*
|
|
@@ -81,7 +83,7 @@ export declare abstract class CheckoutProvider extends BaseProvider {
|
|
|
81
83
|
* @param payload
|
|
82
84
|
* @param reqCtx
|
|
83
85
|
*/
|
|
84
|
-
abstract finalizeCheckout(payload: CheckoutMutationFinalizeCheckout): Promise<Checkout
|
|
86
|
+
abstract finalizeCheckout(payload: CheckoutMutationFinalizeCheckout): Promise<Result<Checkout>>;
|
|
85
87
|
getResourceName(): string;
|
|
86
88
|
}
|
|
87
89
|
/**
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
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
|
+
import type { Result } from "../schemas/result.js";
|
|
4
5
|
import { BaseProvider } from "./base.provider.js";
|
|
5
6
|
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
|
|
7
|
+
abstract getSelf(payload: IdentityQuerySelf): Promise<Result<Identity>>;
|
|
8
|
+
abstract login(payload: IdentityMutationLogin): Promise<Result<Identity>>;
|
|
9
|
+
abstract logout(payload: IdentityMutationLogout): Promise<Result<Identity>>;
|
|
10
|
+
abstract register(payload: IdentityMutationRegister): Promise<Result<Identity>>;
|
|
10
11
|
protected getResourceName(): string;
|
|
11
12
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import type { NotFoundError } from '../schemas/index.js';
|
|
1
2
|
import type { InventoryIdentifier } from '../schemas/models/identifiers.model.js';
|
|
2
3
|
import type { Inventory } from '../schemas/models/inventory.model.js';
|
|
3
4
|
import type { InventoryQueryBySKU } from '../schemas/queries/inventory.query.js';
|
|
5
|
+
import type { Result } from '../schemas/result.js';
|
|
4
6
|
import { BaseProvider } from './base.provider.js';
|
|
5
7
|
export declare abstract class InventoryProvider extends BaseProvider {
|
|
6
|
-
abstract getBySKU(payload: InventoryQueryBySKU): Promise<Inventory
|
|
8
|
+
abstract getBySKU(payload: InventoryQueryBySKU): Promise<Result<Inventory, NotFoundError>>;
|
|
7
9
|
protected getResourceName(): string;
|
|
8
10
|
protected createEmptyInventory(key: InventoryIdentifier): Inventory;
|
|
9
11
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { BaseProvider } from './base.provider.js';
|
|
2
2
|
import type { Order } from '../schemas/models/index.js';
|
|
3
3
|
import type { OrderQueryById } from '../schemas/queries/index.js';
|
|
4
|
+
import type { Result } from '../schemas/result.js';
|
|
5
|
+
import type { NotFoundError } from '../schemas/index.js';
|
|
4
6
|
export declare abstract class OrderProvider extends BaseProvider {
|
|
5
7
|
/**
|
|
6
8
|
* Get order by ID.
|
|
@@ -9,7 +11,7 @@ export declare abstract class OrderProvider extends BaseProvider {
|
|
|
9
11
|
* @param payload
|
|
10
12
|
* @param session
|
|
11
13
|
*/
|
|
12
|
-
abstract getById(payload: OrderQueryById): Promise<Order
|
|
14
|
+
abstract getById(payload: OrderQueryById): Promise<Result<Order, NotFoundError>>;
|
|
13
15
|
protected createEmptyOrder(): Order;
|
|
14
16
|
protected getResourceName(): string;
|
|
15
17
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Price } from '../schemas/index.js';
|
|
1
|
+
import type { Price, Result } 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
4
|
export declare abstract class PriceProvider extends BaseProvider {
|
|
@@ -10,7 +10,7 @@ export declare abstract class PriceProvider extends BaseProvider {
|
|
|
10
10
|
* @param payload The SKU to query
|
|
11
11
|
* @param session The session information
|
|
12
12
|
*/
|
|
13
|
-
abstract getListPrice(payload: ListPriceQuery): Promise<Price
|
|
13
|
+
abstract getListPrice(payload: ListPriceQuery): Promise<Result<Price>>;
|
|
14
14
|
/**
|
|
15
15
|
* Get a customer-specific price by SKU.
|
|
16
16
|
*
|
|
@@ -20,7 +20,7 @@ export declare abstract class PriceProvider extends BaseProvider {
|
|
|
20
20
|
* @param payload The SKU to query
|
|
21
21
|
* @param session The session information
|
|
22
22
|
*/
|
|
23
|
-
abstract getCustomerPrice(payload: CustomerPriceQuery): Promise<Price
|
|
23
|
+
abstract getCustomerPrice(payload: CustomerPriceQuery): Promise<Result<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.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { FacetIdentifier, FacetValueIdentifier } from '../index.js';
|
|
1
|
+
import type { FacetIdentifier, FacetValueIdentifier, Result } from '../index.js';
|
|
2
2
|
import type { ProductSearchResult, ProductSearchResultFacet, ProductSearchResultFacetValue, ProductSearchResultItemVariant } from '../schemas/models/product-search.model.js';
|
|
3
3
|
import type { ProductSearchQueryByTerm, ProductSearchQueryCreateNavigationFilter } from '../schemas/queries/product-search.query.js';
|
|
4
4
|
import { BaseProvider } from './base.provider.js';
|
|
5
5
|
export declare abstract class ProductSearchProvider extends BaseProvider {
|
|
6
6
|
protected getResourceName(): string;
|
|
7
|
-
abstract queryByTerm(payload: ProductSearchQueryByTerm): Promise<ProductSearchResult
|
|
7
|
+
abstract queryByTerm(payload: ProductSearchQueryByTerm): Promise<Result<ProductSearchResult>>;
|
|
8
8
|
/**
|
|
9
9
|
* Since each platform has it own way of representing categories and their hierarchy, we leave it to the platform to tell us how to get from a
|
|
10
10
|
* category breadcrumb path to a global category navigation filter that can be applied to product searches.
|
|
@@ -23,7 +23,7 @@ export declare abstract class ProductSearchProvider extends BaseProvider {
|
|
|
23
23
|
*
|
|
24
24
|
* @param categoryPath
|
|
25
25
|
*/
|
|
26
|
-
abstract createCategoryNavigationFilter(payload: ProductSearchQueryCreateNavigationFilter): Promise<FacetValueIdentifier
|
|
26
|
+
abstract createCategoryNavigationFilter(payload: ProductSearchQueryCreateNavigationFilter): Promise<Result<FacetValueIdentifier>>;
|
|
27
27
|
/**
|
|
28
28
|
* Parses a facet value from the search response.
|
|
29
29
|
* @param facetValueIdentifier The identifier for the facet value.
|
|
@@ -1,6 +1,8 @@
|
|
|
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
|
+
import type { Result } from '../schemas/result.js';
|
|
5
|
+
import type { NotFoundError } from '../schemas/index.js';
|
|
4
6
|
export declare abstract class ProductProvider extends BaseProvider {
|
|
5
7
|
/**
|
|
6
8
|
* Get a product by its ID.
|
|
@@ -12,7 +14,7 @@ export declare abstract class ProductProvider extends BaseProvider {
|
|
|
12
14
|
* Marketing will TYPICALLY recommend products, and in some cases maybe HeroVariants of a product.
|
|
13
15
|
* In that case, you would need to resolve the product to its hero variant first, and then get the SKU from there.
|
|
14
16
|
*/
|
|
15
|
-
abstract getById(payload: ProductQueryById): Promise<Product
|
|
17
|
+
abstract getById(payload: ProductQueryById): Promise<Result<Product>>;
|
|
16
18
|
/**
|
|
17
19
|
* Get a product by its slug.
|
|
18
20
|
* @param payload The query payload containing the product slug.
|
|
@@ -20,7 +22,7 @@ export declare abstract class ProductProvider extends BaseProvider {
|
|
|
20
22
|
*
|
|
21
23
|
* Usecase: You are rendering a product detail page, and you need to fetch the product by its slug.
|
|
22
24
|
*/
|
|
23
|
-
abstract getBySlug(payload: ProductQueryBySlug): Promise<Product
|
|
25
|
+
abstract getBySlug(payload: ProductQueryBySlug): Promise<Result<Product, NotFoundError>>;
|
|
24
26
|
/**
|
|
25
27
|
* Get a product by its SKU
|
|
26
28
|
* @param payload
|
|
@@ -30,7 +32,7 @@ export declare abstract class ProductProvider extends BaseProvider {
|
|
|
30
32
|
* 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
33
|
* It might also be used on a quick-order page, or product recommendations from external system.
|
|
32
34
|
*/
|
|
33
|
-
abstract getBySKU(payload: ProductQueryBySKU): Promise<Product
|
|
35
|
+
abstract getBySKU(payload: ProductQueryBySKU): Promise<Result<Product>>;
|
|
34
36
|
protected createEmptyProduct(id: string): Product;
|
|
35
37
|
/**
|
|
36
38
|
* The resource name, used for caching and logging.
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
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
|
+
import type { Result } from '../schemas/result.js';
|
|
4
5
|
import { BaseProvider } from './base.provider.js';
|
|
5
6
|
export declare abstract class ProfileProvider extends BaseProvider {
|
|
6
|
-
abstract getSelf(payload: ProfileQuerySelf): Promise<Profile
|
|
7
|
-
abstract update(payload: ProfileMutationUpdate): Promise<Profile
|
|
7
|
+
abstract getSelf(payload: ProfileQuerySelf): Promise<Result<Profile>>;
|
|
8
|
+
abstract update(payload: ProfileMutationUpdate): Promise<Result<Profile>>;
|
|
8
9
|
protected getResourceName(): string;
|
|
9
10
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Store } from '../schemas/models/store.model.js';
|
|
2
2
|
import type { StoreQueryByProximity } from '../schemas/queries/index.js';
|
|
3
|
+
import type { Result } from '../schemas/result.js';
|
|
3
4
|
import { BaseProvider } from './base.provider.js';
|
|
4
5
|
export declare abstract class StoreProvider extends BaseProvider {
|
|
5
|
-
abstract queryByProximity(payload: StoreQueryByProximity): Promise<Array<Store
|
|
6
|
+
abstract queryByProximity(payload: StoreQueryByProximity): Promise<Result<Array<Store>>>;
|
|
6
7
|
protected getResourceName(): string;
|
|
7
8
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { InferType } from '../../zod-utils.js';
|
|
3
|
+
export declare const GenericErrorSchema: z.ZodObject<{
|
|
4
|
+
type: z.ZodLiteral<"Generic">;
|
|
5
|
+
message: z.ZodString;
|
|
6
|
+
}, z.core.$loose>;
|
|
7
|
+
export type GenericError = InferType<typeof GenericErrorSchema>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { InferType } from '../../zod-utils.js';
|
|
3
|
+
export declare const InvalidInputErrorSchema: z.ZodObject<{
|
|
4
|
+
type: z.ZodLiteral<"InvalidInput">;
|
|
5
|
+
error: z.core.$constructor<z.ZodError<unknown>, z.core.$ZodIssue[]>;
|
|
6
|
+
}, z.core.$loose>;
|
|
7
|
+
export type InvalidInputError = InferType<typeof InvalidInputErrorSchema>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { InferType } from '../../zod-utils.js';
|
|
3
|
+
export declare const InvalidOutputErrorSchema: z.ZodObject<{
|
|
4
|
+
type: z.ZodLiteral<"InvalidOutput">;
|
|
5
|
+
error: z.core.$constructor<z.ZodError<unknown>, z.core.$ZodIssue[]>;
|
|
6
|
+
}, z.core.$loose>;
|
|
7
|
+
export type InvalidOutputError = InferType<typeof InvalidOutputErrorSchema>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { InferType } from '../../zod-utils.js';
|
|
3
|
+
export declare const NotFoundErrorSchema: z.ZodObject<{
|
|
4
|
+
type: z.ZodLiteral<"NotFound">;
|
|
5
|
+
identifier: z.ZodUnknown;
|
|
6
|
+
}, z.core.$loose>;
|
|
7
|
+
export type NotFoundError = InferType<typeof NotFoundErrorSchema>;
|
package/src/schemas/index.d.ts
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
import type { z } from 'zod';
|
|
2
2
|
import type { InferType } from '../../zod-utils.js';
|
|
3
|
-
export declare const AnalyticsEventSchema: z.ZodObject<{
|
|
4
|
-
meta: z.ZodDefault<z.ZodObject<{
|
|
5
|
-
cache: z.ZodDefault<z.ZodObject<{
|
|
6
|
-
hit: z.ZodDefault<z.ZodBoolean>;
|
|
7
|
-
key: z.ZodDefault<z.ZodString>;
|
|
8
|
-
}, z.core.$loose>>;
|
|
9
|
-
placeholder: z.ZodDefault<z.ZodBoolean>;
|
|
10
|
-
}, z.core.$loose>>;
|
|
11
|
-
}, z.core.$loose>;
|
|
3
|
+
export declare const AnalyticsEventSchema: z.ZodObject<{}, z.core.$loose>;
|
|
12
4
|
export type AnalyticsEvent = InferType<typeof AnalyticsEventSchema>;
|
|
@@ -1,25 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { InferType } from '../../zod-utils.js';
|
|
3
|
-
export declare const
|
|
4
|
-
hit: z.ZodDefault<z.ZodBoolean>;
|
|
5
|
-
key: z.ZodDefault<z.ZodString>;
|
|
6
|
-
}, z.core.$loose>;
|
|
7
|
-
export declare const MetaSchema: z.ZodObject<{
|
|
8
|
-
cache: z.ZodDefault<z.ZodObject<{
|
|
9
|
-
hit: z.ZodDefault<z.ZodBoolean>;
|
|
10
|
-
key: z.ZodDefault<z.ZodString>;
|
|
11
|
-
}, z.core.$loose>>;
|
|
12
|
-
placeholder: z.ZodDefault<z.ZodBoolean>;
|
|
13
|
-
}, z.core.$loose>;
|
|
14
|
-
export declare const BaseModelSchema: z.ZodObject<{
|
|
15
|
-
meta: z.ZodDefault<z.ZodObject<{
|
|
16
|
-
cache: z.ZodDefault<z.ZodObject<{
|
|
17
|
-
hit: z.ZodDefault<z.ZodBoolean>;
|
|
18
|
-
key: z.ZodDefault<z.ZodString>;
|
|
19
|
-
}, z.core.$loose>>;
|
|
20
|
-
placeholder: z.ZodDefault<z.ZodBoolean>;
|
|
21
|
-
}, z.core.$loose>>;
|
|
22
|
-
}, z.core.$loose>;
|
|
3
|
+
export declare const BaseModelSchema: z.ZodObject<{}, z.core.$loose>;
|
|
23
4
|
export declare const PaginationOptionsSchema: z.ZodObject<{
|
|
24
5
|
pageNumber: z.ZodDefault<z.ZodNumber>;
|
|
25
6
|
pageSize: z.ZodDefault<z.ZodNumber>;
|
|
@@ -29,13 +10,6 @@ export declare const PaginationOptionsSchema: z.ZodObject<{
|
|
|
29
10
|
*
|
|
30
11
|
**/
|
|
31
12
|
export declare function createPaginatedResponseSchema<ItemType extends z.ZodTypeAny>(itemSchema: ItemType): z.ZodObject<{
|
|
32
|
-
meta: z.ZodDefault<z.ZodObject<{
|
|
33
|
-
cache: z.ZodDefault<z.ZodObject<{
|
|
34
|
-
hit: z.ZodDefault<z.ZodBoolean>;
|
|
35
|
-
key: z.ZodDefault<z.ZodString>;
|
|
36
|
-
}, z.core.$loose>>;
|
|
37
|
-
placeholder: z.ZodDefault<z.ZodBoolean>;
|
|
38
|
-
}, z.core.$loose>>;
|
|
39
13
|
pageNumber: z.ZodNumber;
|
|
40
14
|
pageSize: z.ZodNumber;
|
|
41
15
|
totalCount: z.ZodNumber;
|
|
@@ -55,6 +29,4 @@ export declare const ImageSchema: z.ZodObject<{
|
|
|
55
29
|
}, z.core.$loose>;
|
|
56
30
|
export type Image = InferType<typeof ImageSchema>;
|
|
57
31
|
export type PaginationOptions = InferType<typeof PaginationOptionsSchema>;
|
|
58
|
-
export type CacheInformation = InferType<typeof CacheInformationSchema>;
|
|
59
|
-
export type Meta = InferType<typeof MetaSchema>;
|
|
60
32
|
export type BaseModel = InferType<typeof BaseModelSchema>;
|
|
@@ -759,13 +759,6 @@ export declare const CartItemSchema: z.ZodObject<{
|
|
|
759
759
|
}, z.core.$loose>>;
|
|
760
760
|
}, z.core.$loose>;
|
|
761
761
|
export declare const CartSchema: z.ZodObject<{
|
|
762
|
-
meta: z.ZodDefault<z.ZodObject<{
|
|
763
|
-
cache: z.ZodDefault<z.ZodObject<{
|
|
764
|
-
hit: z.ZodDefault<z.ZodBoolean>;
|
|
765
|
-
key: z.ZodDefault<z.ZodString>;
|
|
766
|
-
}, z.core.$loose>>;
|
|
767
|
-
placeholder: z.ZodDefault<z.ZodBoolean>;
|
|
768
|
-
}, z.core.$loose>>;
|
|
769
762
|
identifier: z.ZodDefault<z.ZodObject<{
|
|
770
763
|
key: z.ZodString;
|
|
771
764
|
}, z.core.$loose>>;
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { InferType } from '../../zod-utils.js';
|
|
3
3
|
export declare const CategorySchema: z.ZodObject<{
|
|
4
|
-
meta: z.ZodDefault<z.ZodObject<{
|
|
5
|
-
cache: z.ZodDefault<z.ZodObject<{
|
|
6
|
-
hit: z.ZodDefault<z.ZodBoolean>;
|
|
7
|
-
key: z.ZodDefault<z.ZodString>;
|
|
8
|
-
}, z.core.$loose>>;
|
|
9
|
-
placeholder: z.ZodDefault<z.ZodBoolean>;
|
|
10
|
-
}, z.core.$loose>>;
|
|
11
4
|
identifier: z.ZodDefault<z.ZodObject<{
|
|
12
5
|
key: z.ZodString;
|
|
13
6
|
}, z.core.$loose>>;
|
|
@@ -26,25 +19,11 @@ export declare const CategorySchema: z.ZodObject<{
|
|
|
26
19
|
}, z.core.$loose>;
|
|
27
20
|
export type Category = InferType<typeof CategorySchema>;
|
|
28
21
|
export declare const CategoryPaginatedResultSchema: z.ZodObject<{
|
|
29
|
-
meta: z.ZodDefault<z.ZodObject<{
|
|
30
|
-
cache: z.ZodDefault<z.ZodObject<{
|
|
31
|
-
hit: z.ZodDefault<z.ZodBoolean>;
|
|
32
|
-
key: z.ZodDefault<z.ZodString>;
|
|
33
|
-
}, z.core.$loose>>;
|
|
34
|
-
placeholder: z.ZodDefault<z.ZodBoolean>;
|
|
35
|
-
}, z.core.$loose>>;
|
|
36
22
|
pageNumber: z.ZodNumber;
|
|
37
23
|
pageSize: z.ZodNumber;
|
|
38
24
|
totalCount: z.ZodNumber;
|
|
39
25
|
totalPages: z.ZodNumber;
|
|
40
26
|
items: z.ZodArray<z.ZodObject<{
|
|
41
|
-
meta: z.ZodDefault<z.ZodObject<{
|
|
42
|
-
cache: z.ZodDefault<z.ZodObject<{
|
|
43
|
-
hit: z.ZodDefault<z.ZodBoolean>;
|
|
44
|
-
key: z.ZodDefault<z.ZodString>;
|
|
45
|
-
}, z.core.$loose>>;
|
|
46
|
-
placeholder: z.ZodDefault<z.ZodBoolean>;
|
|
47
|
-
}, z.core.$loose>>;
|
|
48
27
|
identifier: z.ZodDefault<z.ZodObject<{
|
|
49
28
|
key: z.ZodString;
|
|
50
29
|
}, z.core.$loose>>;
|
|
@@ -763,13 +763,6 @@ export declare const CheckoutItemSchema: z.ZodObject<{
|
|
|
763
763
|
* payments and shipping methods.
|
|
764
764
|
*/
|
|
765
765
|
export declare const CheckoutSchema: z.ZodObject<{
|
|
766
|
-
meta: z.ZodDefault<z.ZodObject<{
|
|
767
|
-
cache: z.ZodDefault<z.ZodObject<{
|
|
768
|
-
hit: z.ZodDefault<z.ZodBoolean>;
|
|
769
|
-
key: z.ZodDefault<z.ZodString>;
|
|
770
|
-
}, z.core.$loose>>;
|
|
771
|
-
placeholder: z.ZodDefault<z.ZodBoolean>;
|
|
772
|
-
}, z.core.$loose>>;
|
|
773
766
|
identifier: z.ZodDefault<z.ZodObject<{
|
|
774
767
|
key: z.ZodString;
|
|
775
768
|
}, z.core.$loose>>;
|
|
@@ -2655,13 +2648,6 @@ export declare const CheckoutSchema: z.ZodObject<{
|
|
|
2655
2648
|
name: z.ZodDefault<z.ZodString>;
|
|
2656
2649
|
description: z.ZodDefault<z.ZodString>;
|
|
2657
2650
|
billingAddress: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
2658
|
-
meta: z.ZodDefault<z.ZodObject<{
|
|
2659
|
-
cache: z.ZodDefault<z.ZodObject<{
|
|
2660
|
-
hit: z.ZodDefault<z.ZodBoolean>;
|
|
2661
|
-
key: z.ZodDefault<z.ZodString>;
|
|
2662
|
-
}, z.core.$loose>>;
|
|
2663
|
-
placeholder: z.ZodDefault<z.ZodBoolean>;
|
|
2664
|
-
}, z.core.$loose>>;
|
|
2665
2651
|
identifier: z.ZodDefault<z.ZodObject<{
|
|
2666
2652
|
nickName: z.ZodString;
|
|
2667
2653
|
}, z.core.$loose>>;
|
|
@@ -2675,13 +2661,6 @@ export declare const CheckoutSchema: z.ZodObject<{
|
|
|
2675
2661
|
countryCode: z.ZodString;
|
|
2676
2662
|
}, z.core.$loose>>>;
|
|
2677
2663
|
shippingAddress: z.ZodOptional<z.ZodObject<{
|
|
2678
|
-
meta: z.ZodDefault<z.ZodObject<{
|
|
2679
|
-
cache: z.ZodDefault<z.ZodObject<{
|
|
2680
|
-
hit: z.ZodDefault<z.ZodBoolean>;
|
|
2681
|
-
key: z.ZodDefault<z.ZodString>;
|
|
2682
|
-
}, z.core.$loose>>;
|
|
2683
|
-
placeholder: z.ZodDefault<z.ZodBoolean>;
|
|
2684
|
-
}, z.core.$loose>>;
|
|
2685
2664
|
identifier: z.ZodDefault<z.ZodObject<{
|
|
2686
2665
|
nickName: z.ZodString;
|
|
2687
2666
|
}, z.core.$loose>>;
|
|
@@ -2695,13 +2674,6 @@ export declare const CheckoutSchema: z.ZodObject<{
|
|
|
2695
2674
|
countryCode: z.ZodString;
|
|
2696
2675
|
}, z.core.$loose>>;
|
|
2697
2676
|
shippingInstruction: z.ZodOptional<z.ZodObject<{
|
|
2698
|
-
meta: z.ZodDefault<z.ZodObject<{
|
|
2699
|
-
cache: z.ZodDefault<z.ZodObject<{
|
|
2700
|
-
hit: z.ZodDefault<z.ZodBoolean>;
|
|
2701
|
-
key: z.ZodDefault<z.ZodString>;
|
|
2702
|
-
}, z.core.$loose>>;
|
|
2703
|
-
placeholder: z.ZodDefault<z.ZodBoolean>;
|
|
2704
|
-
}, z.core.$loose>>;
|
|
2705
2677
|
shippingMethod: z.ZodObject<{
|
|
2706
2678
|
key: z.ZodString;
|
|
2707
2679
|
}, z.core.$loose>;
|
|
@@ -2710,13 +2682,6 @@ export declare const CheckoutSchema: z.ZodObject<{
|
|
|
2710
2682
|
consentForUnattendedDelivery: z.ZodBoolean;
|
|
2711
2683
|
}, z.core.$loose>>;
|
|
2712
2684
|
paymentInstructions: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
2713
|
-
meta: z.ZodDefault<z.ZodObject<{
|
|
2714
|
-
cache: z.ZodDefault<z.ZodObject<{
|
|
2715
|
-
hit: z.ZodDefault<z.ZodBoolean>;
|
|
2716
|
-
key: z.ZodDefault<z.ZodString>;
|
|
2717
|
-
}, z.core.$loose>>;
|
|
2718
|
-
placeholder: z.ZodDefault<z.ZodBoolean>;
|
|
2719
|
-
}, z.core.$loose>>;
|
|
2720
2685
|
identifier: z.ZodObject<{
|
|
2721
2686
|
key: z.ZodString;
|
|
2722
2687
|
}, z.core.$loose>;
|
|
@@ -1,70 +1,28 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { InferType } from '../../zod-utils.js';
|
|
3
3
|
export declare const AnonymousIdentitySchema: z.ZodObject<{
|
|
4
|
-
meta: z.ZodDefault<z.ZodObject<{
|
|
5
|
-
cache: z.ZodDefault<z.ZodObject<{
|
|
6
|
-
hit: z.ZodDefault<z.ZodBoolean>;
|
|
7
|
-
key: z.ZodDefault<z.ZodString>;
|
|
8
|
-
}, z.core.$loose>>;
|
|
9
|
-
placeholder: z.ZodDefault<z.ZodBoolean>;
|
|
10
|
-
}, z.core.$loose>>;
|
|
11
4
|
type: z.ZodLiteral<"Anonymous">;
|
|
12
5
|
}, z.core.$loose>;
|
|
13
6
|
export declare const GuestIdentitySchema: z.ZodObject<{
|
|
14
|
-
meta: z.ZodDefault<z.ZodObject<{
|
|
15
|
-
cache: z.ZodDefault<z.ZodObject<{
|
|
16
|
-
hit: z.ZodDefault<z.ZodBoolean>;
|
|
17
|
-
key: z.ZodDefault<z.ZodString>;
|
|
18
|
-
}, z.core.$loose>>;
|
|
19
|
-
placeholder: z.ZodDefault<z.ZodBoolean>;
|
|
20
|
-
}, z.core.$loose>>;
|
|
21
7
|
id: z.ZodObject<{
|
|
22
8
|
userId: z.ZodString;
|
|
23
9
|
}, z.core.$loose>;
|
|
24
10
|
type: z.ZodLiteral<"Guest">;
|
|
25
11
|
}, z.core.$loose>;
|
|
26
12
|
export declare const RegisteredIdentitySchema: z.ZodObject<{
|
|
27
|
-
meta: z.ZodDefault<z.ZodObject<{
|
|
28
|
-
cache: z.ZodDefault<z.ZodObject<{
|
|
29
|
-
hit: z.ZodDefault<z.ZodBoolean>;
|
|
30
|
-
key: z.ZodDefault<z.ZodString>;
|
|
31
|
-
}, z.core.$loose>>;
|
|
32
|
-
placeholder: z.ZodDefault<z.ZodBoolean>;
|
|
33
|
-
}, z.core.$loose>>;
|
|
34
13
|
id: z.ZodObject<{
|
|
35
14
|
userId: z.ZodString;
|
|
36
15
|
}, z.core.$loose>;
|
|
37
16
|
type: z.ZodLiteral<"Registered">;
|
|
38
17
|
}, z.core.$loose>;
|
|
39
18
|
export declare const IdentitySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
40
|
-
meta: z.ZodDefault<z.ZodObject<{
|
|
41
|
-
cache: z.ZodDefault<z.ZodObject<{
|
|
42
|
-
hit: z.ZodDefault<z.ZodBoolean>;
|
|
43
|
-
key: z.ZodDefault<z.ZodString>;
|
|
44
|
-
}, z.core.$loose>>;
|
|
45
|
-
placeholder: z.ZodDefault<z.ZodBoolean>;
|
|
46
|
-
}, z.core.$loose>>;
|
|
47
19
|
type: z.ZodLiteral<"Anonymous">;
|
|
48
20
|
}, z.core.$loose>, z.ZodObject<{
|
|
49
|
-
meta: z.ZodDefault<z.ZodObject<{
|
|
50
|
-
cache: z.ZodDefault<z.ZodObject<{
|
|
51
|
-
hit: z.ZodDefault<z.ZodBoolean>;
|
|
52
|
-
key: z.ZodDefault<z.ZodString>;
|
|
53
|
-
}, z.core.$loose>>;
|
|
54
|
-
placeholder: z.ZodDefault<z.ZodBoolean>;
|
|
55
|
-
}, z.core.$loose>>;
|
|
56
21
|
id: z.ZodObject<{
|
|
57
22
|
userId: z.ZodString;
|
|
58
23
|
}, z.core.$loose>;
|
|
59
24
|
type: z.ZodLiteral<"Guest">;
|
|
60
25
|
}, z.core.$loose>, z.ZodObject<{
|
|
61
|
-
meta: z.ZodDefault<z.ZodObject<{
|
|
62
|
-
cache: z.ZodDefault<z.ZodObject<{
|
|
63
|
-
hit: z.ZodDefault<z.ZodBoolean>;
|
|
64
|
-
key: z.ZodDefault<z.ZodString>;
|
|
65
|
-
}, z.core.$loose>>;
|
|
66
|
-
placeholder: z.ZodDefault<z.ZodBoolean>;
|
|
67
|
-
}, z.core.$loose>>;
|
|
68
26
|
id: z.ZodObject<{
|
|
69
27
|
userId: z.ZodString;
|
|
70
28
|
}, z.core.$loose>;
|
|
@@ -8,13 +8,6 @@ export declare const InventoryStatusSchema: z.ZodEnum<{
|
|
|
8
8
|
discontinued: "discontinued";
|
|
9
9
|
}>;
|
|
10
10
|
export declare const InventorySchema: z.ZodObject<{
|
|
11
|
-
meta: z.ZodDefault<z.ZodObject<{
|
|
12
|
-
cache: z.ZodDefault<z.ZodObject<{
|
|
13
|
-
hit: z.ZodDefault<z.ZodBoolean>;
|
|
14
|
-
key: z.ZodDefault<z.ZodString>;
|
|
15
|
-
}, z.core.$loose>>;
|
|
16
|
-
placeholder: z.ZodDefault<z.ZodBoolean>;
|
|
17
|
-
}, z.core.$loose>>;
|
|
18
11
|
identifier: z.ZodObject<{
|
|
19
12
|
variant: z.ZodObject<{
|
|
20
13
|
sku: z.ZodString;
|
|
@@ -774,13 +774,6 @@ export declare const OrderItemSchema: z.ZodObject<{
|
|
|
774
774
|
}>;
|
|
775
775
|
}, z.core.$loose>;
|
|
776
776
|
export declare const OrderSchema: z.ZodObject<{
|
|
777
|
-
meta: z.ZodDefault<z.ZodObject<{
|
|
778
|
-
cache: z.ZodDefault<z.ZodObject<{
|
|
779
|
-
hit: z.ZodDefault<z.ZodBoolean>;
|
|
780
|
-
key: z.ZodDefault<z.ZodString>;
|
|
781
|
-
}, z.core.$loose>>;
|
|
782
|
-
placeholder: z.ZodDefault<z.ZodBoolean>;
|
|
783
|
-
}, z.core.$loose>>;
|
|
784
777
|
identifier: z.ZodObject<{
|
|
785
778
|
key: z.ZodString;
|
|
786
779
|
}, z.core.$loose>;
|
|
@@ -2669,13 +2662,6 @@ export declare const OrderSchema: z.ZodObject<{
|
|
|
2669
2662
|
name: z.ZodOptional<z.ZodString>;
|
|
2670
2663
|
description: z.ZodOptional<z.ZodString>;
|
|
2671
2664
|
shippingAddress: z.ZodOptional<z.ZodObject<{
|
|
2672
|
-
meta: z.ZodDefault<z.ZodObject<{
|
|
2673
|
-
cache: z.ZodDefault<z.ZodObject<{
|
|
2674
|
-
hit: z.ZodDefault<z.ZodBoolean>;
|
|
2675
|
-
key: z.ZodDefault<z.ZodString>;
|
|
2676
|
-
}, z.core.$loose>>;
|
|
2677
|
-
placeholder: z.ZodDefault<z.ZodBoolean>;
|
|
2678
|
-
}, z.core.$loose>>;
|
|
2679
2665
|
identifier: z.ZodDefault<z.ZodObject<{
|
|
2680
2666
|
nickName: z.ZodString;
|
|
2681
2667
|
}, z.core.$loose>>;
|
|
@@ -2689,13 +2675,6 @@ export declare const OrderSchema: z.ZodObject<{
|
|
|
2689
2675
|
countryCode: z.ZodString;
|
|
2690
2676
|
}, z.core.$loose>>;
|
|
2691
2677
|
billingAddress: z.ZodOptional<z.ZodObject<{
|
|
2692
|
-
meta: z.ZodDefault<z.ZodObject<{
|
|
2693
|
-
cache: z.ZodDefault<z.ZodObject<{
|
|
2694
|
-
hit: z.ZodDefault<z.ZodBoolean>;
|
|
2695
|
-
key: z.ZodDefault<z.ZodString>;
|
|
2696
|
-
}, z.core.$loose>>;
|
|
2697
|
-
placeholder: z.ZodDefault<z.ZodBoolean>;
|
|
2698
|
-
}, z.core.$loose>>;
|
|
2699
2678
|
identifier: z.ZodDefault<z.ZodObject<{
|
|
2700
2679
|
nickName: z.ZodString;
|
|
2701
2680
|
}, z.core.$loose>>;
|
|
@@ -2922,13 +2901,6 @@ export declare const OrderSchema: z.ZodObject<{
|
|
|
2922
2901
|
Preordered: "Preordered";
|
|
2923
2902
|
}>;
|
|
2924
2903
|
paymentInstructions: z.ZodArray<z.ZodObject<{
|
|
2925
|
-
meta: z.ZodDefault<z.ZodObject<{
|
|
2926
|
-
cache: z.ZodDefault<z.ZodObject<{
|
|
2927
|
-
hit: z.ZodDefault<z.ZodBoolean>;
|
|
2928
|
-
key: z.ZodDefault<z.ZodString>;
|
|
2929
|
-
}, z.core.$loose>>;
|
|
2930
|
-
placeholder: z.ZodDefault<z.ZodBoolean>;
|
|
2931
|
-
}, z.core.$loose>>;
|
|
2932
2904
|
identifier: z.ZodObject<{
|
|
2933
2905
|
key: z.ZodString;
|
|
2934
2906
|
}, z.core.$loose>;
|