@reactionary/core 0.0.48 → 0.0.51
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/package.json +2 -2
- package/providers/checkout.provider.js +6 -0
- package/providers/index.js +2 -1
- package/providers/order.provider.js +15 -0
- package/schemas/capabilities.schema.js +2 -1
- package/schemas/models/cart.model.js +3 -24
- package/schemas/models/checkout.model.js +44 -0
- package/schemas/models/cost.model.js +20 -0
- package/schemas/models/identifiers.model.js +12 -0
- package/schemas/models/identity.model.js +6 -3
- package/schemas/models/index.js +4 -0
- package/schemas/models/order.model.js +37 -0
- package/schemas/models/payment.model.js +1 -10
- package/schemas/models/product.model.js +5 -2
- package/schemas/models/shipping-method.model.js +24 -2
- package/schemas/mutations/checkout.mutation.js +36 -0
- package/schemas/mutations/index.js +1 -1
- package/schemas/queries/checkout.query.js +16 -0
- package/schemas/queries/index.js +2 -1
- package/schemas/queries/order.query.js +8 -0
- package/schemas/queries/product.query.js +5 -0
- package/src/client/client.d.ts +2 -2
- package/src/providers/checkout.provider.d.ts +135 -0
- package/src/providers/index.d.ts +2 -1
- package/src/providers/order.provider.d.ts +16 -0
- package/src/providers/product.provider.d.ts +2 -1
- package/src/schemas/capabilities.schema.d.ts +2 -1
- package/src/schemas/models/cart.model.d.ts +0 -2106
- package/src/schemas/models/checkout.model.d.ts +2930 -0
- package/src/schemas/models/cost.model.d.ts +1867 -0
- package/src/schemas/models/identifiers.model.d.ts +13 -1
- package/src/schemas/models/identity.model.d.ts +12 -6
- package/src/schemas/models/index.d.ts +4 -0
- package/src/schemas/models/order.model.d.ts +3144 -0
- package/src/schemas/models/payment.model.d.ts +1 -438
- package/src/schemas/models/product.model.d.ts +2 -2
- package/src/schemas/models/shipping-method.model.d.ts +50 -0
- package/src/schemas/mutations/{cart-payment.mutation.d.ts → checkout.mutation.d.ts} +75 -7
- package/src/schemas/mutations/index.d.ts +1 -1
- package/src/schemas/queries/checkout.query.d.ts +19 -0
- package/src/schemas/queries/index.d.ts +2 -1
- package/src/schemas/queries/order.query.d.ts +7 -0
- package/src/schemas/queries/product.query.d.ts +6 -0
- package/src/schemas/session.schema.d.ts +6 -3
- package/providers/cart-payment.provider.js +0 -9
- package/schemas/mutations/cart-payment.mutation.js +0 -15
- package/schemas/queries/cart-payment.query.js +0 -11
- package/src/providers/cart-payment.provider.d.ts +0 -42
- package/src/schemas/queries/cart-payment.query.d.ts +0 -16
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseProvider } from "./base.provider";
|
|
2
|
+
import type { RequestContext } from "../schemas/session.schema";
|
|
3
|
+
import type { Order } from "../schemas/models";
|
|
4
|
+
import type { OrderQueryById } from "../schemas/queries";
|
|
5
|
+
export declare abstract class OrderProvider<T extends Order = Order> extends BaseProvider<T> {
|
|
6
|
+
/**
|
|
7
|
+
* Get order by ID.
|
|
8
|
+
*
|
|
9
|
+
* Usecase: Fetch order after checkout, to check if we are fully paid and can continue to order confirmation page.
|
|
10
|
+
* @param payload
|
|
11
|
+
* @param session
|
|
12
|
+
*/
|
|
13
|
+
abstract getById(payload: OrderQueryById, reqCtx: RequestContext): Promise<T>;
|
|
14
|
+
protected createEmptyOrder(): T;
|
|
15
|
+
protected getResourceName(): string;
|
|
16
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { Product } from '../schemas/models/product.model';
|
|
2
2
|
import { BaseProvider } from './base.provider';
|
|
3
3
|
import type { RequestContext } from '../schemas/session.schema';
|
|
4
|
-
import type { ProductQueryById, ProductQueryBySlug } from '../schemas/queries/product.query';
|
|
4
|
+
import type { ProductQueryById, ProductQueryBySKU, ProductQueryBySlug } from '../schemas/queries/product.query';
|
|
5
5
|
export declare abstract class ProductProvider<T extends Product = Product> extends BaseProvider<T> {
|
|
6
6
|
abstract getById(payload: ProductQueryById, reqCtx: RequestContext): Promise<T>;
|
|
7
7
|
abstract getBySlug(payload: ProductQueryBySlug, reqCtx: RequestContext): Promise<T | null>;
|
|
8
|
+
abstract getBySKU(payload: ProductQueryBySKU | ProductQueryBySKU[], reqCtx: RequestContext): Promise<T>;
|
|
8
9
|
protected createEmptyProduct(id: string): T;
|
|
9
10
|
/**
|
|
10
11
|
* The resource name, used for caching and logging.
|
|
@@ -5,7 +5,8 @@ export declare const CapabilitiesSchema: z.ZodObject<{
|
|
|
5
5
|
analytics: z.ZodBoolean;
|
|
6
6
|
identity: z.ZodBoolean;
|
|
7
7
|
cart: z.ZodBoolean;
|
|
8
|
-
|
|
8
|
+
checkout: z.ZodBoolean;
|
|
9
|
+
order: z.ZodBoolean;
|
|
9
10
|
inventory: z.ZodBoolean;
|
|
10
11
|
price: z.ZodBoolean;
|
|
11
12
|
category: z.ZodBoolean;
|