@reactionary/magento 0.0.1 → 0.10.18
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/LICENSE +21 -0
- package/capabilities/cart.capability.js +22 -22
- package/capabilities/category.capability.js +10 -9
- package/capabilities/checkout.capability.js +308 -0
- package/capabilities/identity.capability.js +31 -16
- package/capabilities/inventory.capability.js +2 -2
- package/capabilities/order-search.capability.js +150 -0
- package/capabilities/order.capability.js +51 -0
- package/capabilities/price.capability.js +2 -2
- package/capabilities/product-associations.capability.js +118 -0
- package/capabilities/product-recommendations.capability.js +148 -0
- package/capabilities/product-reviews.capability.js +182 -0
- package/capabilities/product-search.capability.js +2 -2
- package/capabilities/product.capability.js +6 -5
- package/capabilities/profile.capability.js +283 -0
- package/core/client.js +324 -24
- package/core/initialize.js +150 -2
- package/core/product-reviews.graphql.js +72 -0
- package/factories/category/category.factory.js +1 -1
- package/factories/checkout/checkout.factory.js +203 -0
- package/factories/index.js +6 -0
- package/factories/order/order.factory.js +115 -0
- package/factories/order-search/order-search.factory.js +79 -0
- package/factories/product/product.factory.js +23 -18
- package/factories/product-associations/product-associations.factory.js +25 -0
- package/factories/product-reviews/product-reviews.factory.js +65 -0
- package/factories/product-search/product-search.factory.js +3 -4
- package/factories/profile/profile.factory.js +61 -0
- package/index.js +9 -0
- package/package.json +11 -6
- package/schema/capabilities.schema.js +16 -2
- package/schema/configuration.schema.js +5 -1
- package/src/capabilities/cart.capability.d.ts +5 -0
- package/src/capabilities/checkout.capability.d.ts +30 -0
- package/src/capabilities/order-search.capability.d.ts +16 -0
- package/src/capabilities/order.capability.d.ts +12 -0
- package/src/capabilities/product-associations.capability.d.ts +23 -0
- package/src/capabilities/product-recommendations.capability.d.ts +24 -0
- package/src/capabilities/product-reviews.capability.d.ts +35 -0
- package/src/capabilities/profile.capability.d.ts +24 -0
- package/src/core/client.d.ts +77 -2
- package/src/core/initialize.types.d.ts +40 -7
- package/src/core/product-reviews.graphql.d.ts +10 -0
- package/src/factories/category/category.factory.d.ts +2 -2
- package/src/factories/checkout/checkout.factory.d.ts +32 -0
- package/src/factories/index.d.ts +6 -0
- package/src/factories/order/order.factory.d.ts +77 -0
- package/src/factories/order-search/order-search.factory.d.ts +43 -0
- package/src/factories/product/product.factory.d.ts +2 -1
- package/src/factories/product-associations/product-associations.factory.d.ts +15 -0
- package/src/factories/product-reviews/product-reviews.factory.d.ts +40 -0
- package/src/factories/profile/profile.factory.d.ts +43 -0
- package/src/index.d.ts +9 -0
- package/src/schema/capabilities.schema.d.ts +50 -2
- package/src/schema/configuration.schema.d.ts +7 -0
- package/src/schema/magento.types.d.ts +219 -0
- package/src/utils/magento-product-lookup.d.ts +15 -0
- package/src/utils/magento-product.d.ts +36 -0
- package/src/utils/magento-review.d.ts +20 -0
- package/utils/magento-product-lookup.js +76 -0
- package/utils/magento-product.js +110 -0
- package/utils/magento-review.js +34 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type Address, type AnyCheckoutSchema, type AnyPaymentMethodSchema, type AnyShippingMethodSchema, type CheckoutFactory, type CheckoutItem, type CheckoutSchema, type CostBreakDown, type Currency, type ItemCostBreakdown, type PaymentInstruction, type PaymentMethodSchema, type RequestContext, type ShippingInstruction, type ShippingMethodSchema } from '@reactionary/core';
|
|
2
|
+
import type * as z from 'zod';
|
|
3
|
+
import type { MagentoConfiguration } from '../../schema/configuration.schema.js';
|
|
4
|
+
import type { MagentoCart, MagentoCartItem, MagentoCartTotals, MagentoCheckoutAddress, MagentoCheckoutState, MagentoStoredPaymentInstruction } from '../../schema/magento.types.js';
|
|
5
|
+
export interface MagentoCheckoutData {
|
|
6
|
+
cart: MagentoCart;
|
|
7
|
+
totals?: MagentoCartTotals;
|
|
8
|
+
state?: MagentoCheckoutState;
|
|
9
|
+
requestedKey?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Builds a stable shipping-method identifier key from a Magento carrier/method
|
|
13
|
+
* pair, and parses it back. Magento identifies a rate by both codes.
|
|
14
|
+
*/
|
|
15
|
+
export declare function encodeShippingMethodKey(carrierCode: string, methodCode: string): string;
|
|
16
|
+
export declare class MagentoCheckoutFactory<TCheckoutSchema extends AnyCheckoutSchema = typeof CheckoutSchema, TShippingMethodSchema extends AnyShippingMethodSchema = typeof ShippingMethodSchema, TPaymentMethodSchema extends AnyPaymentMethodSchema = typeof PaymentMethodSchema> implements CheckoutFactory<TCheckoutSchema, TShippingMethodSchema, TPaymentMethodSchema> {
|
|
17
|
+
readonly checkoutSchema: TCheckoutSchema;
|
|
18
|
+
readonly shippingMethodSchema: TShippingMethodSchema;
|
|
19
|
+
readonly paymentMethodSchema: TPaymentMethodSchema;
|
|
20
|
+
protected readonly config: MagentoConfiguration;
|
|
21
|
+
constructor(checkoutSchema: TCheckoutSchema, shippingMethodSchema: TShippingMethodSchema, paymentMethodSchema: TPaymentMethodSchema, config: MagentoConfiguration);
|
|
22
|
+
protected resolveCurrency(data: MagentoCheckoutData): Currency;
|
|
23
|
+
protected parseAddress(address: MagentoCheckoutAddress): Address;
|
|
24
|
+
protected parseCostBreakdown(data: MagentoCheckoutData, currency: Currency): CostBreakDown;
|
|
25
|
+
protected parseItemPrice(item: MagentoCartItem, currency: Currency): ItemCostBreakdown;
|
|
26
|
+
protected parseCheckoutItem(item: MagentoCartItem, currency: Currency): CheckoutItem;
|
|
27
|
+
protected parsePaymentInstruction(stored: MagentoStoredPaymentInstruction): PaymentInstruction;
|
|
28
|
+
protected parseShippingInstruction(state: MagentoCheckoutState): ShippingInstruction | undefined;
|
|
29
|
+
parseCheckout(_context: RequestContext, data: unknown): z.output<TCheckoutSchema>;
|
|
30
|
+
parseShippingMethod(_context: RequestContext, data: unknown): z.output<TShippingMethodSchema>;
|
|
31
|
+
parsePaymentMethod(_context: RequestContext, data: unknown): z.output<TPaymentMethodSchema>;
|
|
32
|
+
}
|
package/src/factories/index.d.ts
CHANGED
|
@@ -5,3 +5,9 @@ export * from './inventory/inventory.factory.js';
|
|
|
5
5
|
export * from './price/price.factory.js';
|
|
6
6
|
export * from './product/product.factory.js';
|
|
7
7
|
export * from './product-search/product-search.factory.js';
|
|
8
|
+
export * from './profile/profile.factory.js';
|
|
9
|
+
export * from './order-search/order-search.factory.js';
|
|
10
|
+
export * from './order/order.factory.js';
|
|
11
|
+
export * from './checkout/checkout.factory.js';
|
|
12
|
+
export * from './product-associations/product-associations.factory.js';
|
|
13
|
+
export * from './product-reviews/product-reviews.factory.js';
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { type Address, type AnyOrderSchema, type CostBreakDown, type Currency, type Order, type OrderFactory, type OrderItem, type OrderSchema, type PaymentInstruction, type RequestContext, type ShippingMethod } from '@reactionary/core';
|
|
2
|
+
import type * as z from 'zod';
|
|
3
|
+
export interface MagentoOrderDetailAddress {
|
|
4
|
+
firstname?: string;
|
|
5
|
+
lastname?: string;
|
|
6
|
+
street?: string[];
|
|
7
|
+
city?: string;
|
|
8
|
+
region?: string;
|
|
9
|
+
postcode?: string;
|
|
10
|
+
country_id?: string;
|
|
11
|
+
telephone?: string;
|
|
12
|
+
email?: string;
|
|
13
|
+
entity_id?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface MagentoOrderDetailItem {
|
|
16
|
+
item_id: number;
|
|
17
|
+
sku: string;
|
|
18
|
+
name?: string;
|
|
19
|
+
qty_ordered?: number;
|
|
20
|
+
price?: number;
|
|
21
|
+
row_total?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface MagentoOrderDetailPayment {
|
|
24
|
+
method?: string;
|
|
25
|
+
amount_ordered?: number;
|
|
26
|
+
}
|
|
27
|
+
export interface MagentoOrderDetail {
|
|
28
|
+
entity_id: number;
|
|
29
|
+
increment_id?: string;
|
|
30
|
+
customer_id?: number;
|
|
31
|
+
customer_email?: string;
|
|
32
|
+
customer_firstname?: string;
|
|
33
|
+
customer_lastname?: string;
|
|
34
|
+
status?: string;
|
|
35
|
+
state?: string;
|
|
36
|
+
created_at?: string;
|
|
37
|
+
order_currency_code?: string;
|
|
38
|
+
grand_total?: number;
|
|
39
|
+
subtotal?: number;
|
|
40
|
+
shipping_amount?: number;
|
|
41
|
+
discount_amount?: number;
|
|
42
|
+
tax_amount?: number;
|
|
43
|
+
shipping_description?: string;
|
|
44
|
+
items?: MagentoOrderDetailItem[];
|
|
45
|
+
billing_address?: MagentoOrderDetailAddress;
|
|
46
|
+
payment?: MagentoOrderDetailPayment;
|
|
47
|
+
extension_attributes?: {
|
|
48
|
+
shipping_assignments?: Array<{
|
|
49
|
+
shipping?: {
|
|
50
|
+
address?: MagentoOrderDetailAddress;
|
|
51
|
+
method?: string;
|
|
52
|
+
};
|
|
53
|
+
}>;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Fields the confirmation-page use case needs that core's Order schema
|
|
58
|
+
* doesn't declare (no date field at all, no contact info on Address). Order
|
|
59
|
+
* schemas are z.looseObject-based, so these survive orderSchema.parse()
|
|
60
|
+
* unchanged even though the base Order type doesn't know about them.
|
|
61
|
+
*/
|
|
62
|
+
export interface MagentoOrderOutput extends Order {
|
|
63
|
+
orderDate: string;
|
|
64
|
+
incrementId?: string;
|
|
65
|
+
customerEmail?: string;
|
|
66
|
+
customerPhone?: string;
|
|
67
|
+
}
|
|
68
|
+
export declare class MagentoOrderFactory<TOrderSchema extends AnyOrderSchema = typeof OrderSchema> implements OrderFactory<TOrderSchema> {
|
|
69
|
+
readonly orderSchema: TOrderSchema;
|
|
70
|
+
constructor(orderSchema: TOrderSchema);
|
|
71
|
+
protected parseAddress(address?: MagentoOrderDetailAddress): Address | undefined;
|
|
72
|
+
protected parseOrderItem(order: MagentoOrderDetail, item: MagentoOrderDetailItem, currency: Currency): OrderItem;
|
|
73
|
+
protected parseCostBreakdown(order: MagentoOrderDetail, currency: Currency): CostBreakDown;
|
|
74
|
+
protected parsePaymentInstruction(order: MagentoOrderDetail, currency: Currency): PaymentInstruction;
|
|
75
|
+
protected parseShippingMethod(order: MagentoOrderDetail, method: string | undefined, currency: Currency): ShippingMethod | undefined;
|
|
76
|
+
parseOrder(_context: RequestContext, data: unknown): z.output<TOrderSchema>;
|
|
77
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type Address, type AnyOrderSearchResultSchema, type OrderSearchFactory, type OrderSearchQueryByTerm, type OrderSearchResultItem, type OrderSearchResultSchema, type OrderStatus, type RequestContext } from '@reactionary/core';
|
|
2
|
+
import type * as z from 'zod';
|
|
3
|
+
export interface MagentoOrderAddress {
|
|
4
|
+
firstname?: string;
|
|
5
|
+
lastname?: string;
|
|
6
|
+
street?: string[];
|
|
7
|
+
city?: string;
|
|
8
|
+
region?: string;
|
|
9
|
+
region_code?: string;
|
|
10
|
+
postcode?: string;
|
|
11
|
+
country_id?: string;
|
|
12
|
+
entity_id?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface MagentoOrder {
|
|
15
|
+
entity_id: number;
|
|
16
|
+
increment_id?: string;
|
|
17
|
+
customer_id?: number;
|
|
18
|
+
customer_email?: string;
|
|
19
|
+
customer_firstname?: string;
|
|
20
|
+
customer_lastname?: string;
|
|
21
|
+
status?: string;
|
|
22
|
+
state?: string;
|
|
23
|
+
grand_total?: number;
|
|
24
|
+
order_currency_code?: string;
|
|
25
|
+
created_at?: string;
|
|
26
|
+
billing_address?: MagentoOrderAddress;
|
|
27
|
+
}
|
|
28
|
+
export interface MagentoOrderListResponse {
|
|
29
|
+
items?: MagentoOrder[];
|
|
30
|
+
total_count?: number;
|
|
31
|
+
search_criteria?: {
|
|
32
|
+
page_size?: number;
|
|
33
|
+
current_page?: number;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export declare function mapMagentoOrderStatus(status?: string): OrderStatus;
|
|
37
|
+
export declare class MagentoOrderSearchFactory<TOrderSearchResultSchema extends AnyOrderSearchResultSchema = typeof OrderSearchResultSchema> implements OrderSearchFactory<TOrderSearchResultSchema> {
|
|
38
|
+
readonly orderSearchResultSchema: TOrderSearchResultSchema;
|
|
39
|
+
constructor(orderSearchResultSchema: TOrderSearchResultSchema);
|
|
40
|
+
protected parseAddress(address: MagentoOrderAddress): Address;
|
|
41
|
+
protected parseOrderSearchResultItem(_context: RequestContext, order: MagentoOrder): OrderSearchResultItem;
|
|
42
|
+
parseOrderSearchResult(context: RequestContext, data: unknown, query: OrderSearchQueryByTerm): z.output<TOrderSearchResultSchema>;
|
|
43
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AnyProductSchema, type ProductAttribute, type ProductFactory, type ProductSchema, type ProductVariant, type RequestContext } from '@reactionary/core';
|
|
1
|
+
import { type AnyProductSchema, type Image, type ProductAttribute, type ProductFactory, type ProductSchema, type ProductVariant, type RequestContext } from '@reactionary/core';
|
|
2
2
|
import type * as z from 'zod';
|
|
3
3
|
import type { MagentoConfiguration } from '../../schema/configuration.schema.js';
|
|
4
4
|
import type { MagentoProduct } from '../../schema/magento.types.js';
|
|
@@ -8,6 +8,7 @@ export declare class MagentoProductFactory<TProductSchema extends AnyProductSche
|
|
|
8
8
|
constructor(productSchema: TProductSchema, config: MagentoConfiguration);
|
|
9
9
|
parseProduct(_context: RequestContext, data: MagentoProduct): z.output<TProductSchema>;
|
|
10
10
|
protected parseVariant(product: MagentoProduct): ProductVariant;
|
|
11
|
+
protected parseImages(product: MagentoProduct): Image[];
|
|
11
12
|
protected createSynthAttribute(key: string, name: string, value: string): ProductAttribute;
|
|
12
13
|
protected parseAttributes(product: MagentoProduct): Array<ProductAttribute>;
|
|
13
14
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type AnyProductAssociationSchema, type ProductAssociationSchema, type ProductAssociationsFactory, type ProductAssociationsIdentifier, type ProductSearchResultItem, type RequestContext } from '@reactionary/core';
|
|
2
|
+
import type * as z from 'zod';
|
|
3
|
+
import type { MagentoConfiguration } from '../../schema/configuration.schema.js';
|
|
4
|
+
import type { MagentoProduct } from '../../schema/magento.types.js';
|
|
5
|
+
export interface MagentoProductAssociationFactoryInput {
|
|
6
|
+
product: MagentoProduct;
|
|
7
|
+
identifier: ProductAssociationsIdentifier;
|
|
8
|
+
}
|
|
9
|
+
export declare class MagentoProductAssociationsFactory<TProductAssociationSchema extends AnyProductAssociationSchema = typeof ProductAssociationSchema> implements ProductAssociationsFactory<TProductAssociationSchema> {
|
|
10
|
+
readonly productAssociationSchema: TProductAssociationSchema;
|
|
11
|
+
protected readonly config: MagentoConfiguration;
|
|
12
|
+
constructor(productAssociationSchema: TProductAssociationSchema, config: MagentoConfiguration);
|
|
13
|
+
protected parseProduct(_context: RequestContext, product: MagentoProduct): ProductSearchResultItem;
|
|
14
|
+
parseAssociation(context: RequestContext, data: MagentoProductAssociationFactoryInput): z.output<TProductAssociationSchema>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { AnyProductRatingSummarySchema, AnyProductReviewPaginatedSchema, AnyProductReviewSchema, ProductIdentifier, ProductRatingSummarySchema, ProductReviewPaginatedResultSchema, ProductReviewSchema, ProductReviewsFactory, RequestContext } from '@reactionary/core';
|
|
2
|
+
import type * as z from 'zod';
|
|
3
|
+
import type { MagentoProductReview } from '../../schema/magento.types.js';
|
|
4
|
+
export interface MagentoProductRatingSummaryFactoryInput {
|
|
5
|
+
product: ProductIdentifier;
|
|
6
|
+
/** Magento's `rating_summary`, a percentage (0-100). */
|
|
7
|
+
ratingSummary: number | null | undefined;
|
|
8
|
+
/** Magento's `review_count`. */
|
|
9
|
+
reviewCount: number | null | undefined;
|
|
10
|
+
}
|
|
11
|
+
export interface MagentoProductReviewFactoryInput {
|
|
12
|
+
product: ProductIdentifier;
|
|
13
|
+
sku: string;
|
|
14
|
+
review: MagentoProductReview;
|
|
15
|
+
}
|
|
16
|
+
export interface MagentoProductReviewPaginatedFactoryInput {
|
|
17
|
+
product: ProductIdentifier;
|
|
18
|
+
sku: string;
|
|
19
|
+
reviews: MagentoProductReview[];
|
|
20
|
+
totalCount: number;
|
|
21
|
+
pageSize: number;
|
|
22
|
+
pageNumber: number;
|
|
23
|
+
}
|
|
24
|
+
export declare class MagentoProductReviewsFactory<TRatingSummarySchema extends AnyProductRatingSummarySchema = typeof ProductRatingSummarySchema, TReviewSchema extends AnyProductReviewSchema = typeof ProductReviewSchema, TReviewPaginatedSchema extends AnyProductReviewPaginatedSchema = typeof ProductReviewPaginatedResultSchema> implements ProductReviewsFactory<TRatingSummarySchema, TReviewSchema, TReviewPaginatedSchema> {
|
|
25
|
+
readonly ratingSummarySchema: TRatingSummarySchema;
|
|
26
|
+
readonly reviewSchema: TReviewSchema;
|
|
27
|
+
readonly reviewPaginatedSchema: TReviewPaginatedSchema;
|
|
28
|
+
constructor(ratingSummarySchema: TRatingSummarySchema, reviewSchema: TReviewSchema, reviewPaginatedSchema: TReviewPaginatedSchema);
|
|
29
|
+
/**
|
|
30
|
+
* Magento's GraphQL schema offers no per-star breakdown, so the distribution
|
|
31
|
+
* is left undefined rather than reconstructed from the current page.
|
|
32
|
+
*/
|
|
33
|
+
parseRatingSummary(_context: RequestContext, data: MagentoProductRatingSummaryFactoryInput): z.output<TRatingSummarySchema>;
|
|
34
|
+
/**
|
|
35
|
+
* Magento does not expose whether a review came from a confirmed purchase, so
|
|
36
|
+
* `verified` is always false.
|
|
37
|
+
*/
|
|
38
|
+
parseReview(_context: RequestContext, data: MagentoProductReviewFactoryInput): z.output<TReviewSchema>;
|
|
39
|
+
parseReviewPaginatedResult(context: RequestContext, data: MagentoProductReviewPaginatedFactoryInput): z.output<TReviewPaginatedSchema>;
|
|
40
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Address, AnyProfileSchema, ProfileFactory, ProfileSchema, RequestContext } from '@reactionary/core';
|
|
2
|
+
import type * as z from 'zod';
|
|
3
|
+
export interface MagentoAddress {
|
|
4
|
+
id?: number;
|
|
5
|
+
customer_id?: number;
|
|
6
|
+
company?: string;
|
|
7
|
+
firstname?: string;
|
|
8
|
+
lastname?: string;
|
|
9
|
+
street?: string[];
|
|
10
|
+
city?: string;
|
|
11
|
+
region?: {
|
|
12
|
+
region_code?: string;
|
|
13
|
+
region?: string;
|
|
14
|
+
region_id?: number;
|
|
15
|
+
};
|
|
16
|
+
region_id?: number;
|
|
17
|
+
postcode?: string;
|
|
18
|
+
country_id?: string;
|
|
19
|
+
telephone?: string;
|
|
20
|
+
default_billing?: boolean;
|
|
21
|
+
default_shipping?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface MagentoCustomer {
|
|
24
|
+
id: number;
|
|
25
|
+
email: string;
|
|
26
|
+
firstname?: string;
|
|
27
|
+
lastname?: string;
|
|
28
|
+
created_at?: string;
|
|
29
|
+
updated_at?: string;
|
|
30
|
+
default_billing?: string;
|
|
31
|
+
default_shipping?: string;
|
|
32
|
+
addresses?: MagentoAddress[];
|
|
33
|
+
custom_attributes?: {
|
|
34
|
+
attribute_code: string;
|
|
35
|
+
value: string;
|
|
36
|
+
}[];
|
|
37
|
+
}
|
|
38
|
+
export declare class MagentoProfileFactory<TProfileSchema extends AnyProfileSchema = typeof ProfileSchema> implements ProfileFactory<TProfileSchema> {
|
|
39
|
+
readonly profileSchema: TProfileSchema;
|
|
40
|
+
constructor(profileSchema: TProfileSchema);
|
|
41
|
+
parseProfile(context: RequestContext, data: unknown): z.output<TProfileSchema>;
|
|
42
|
+
protected parseAddress(_context: RequestContext, address: MagentoAddress): Address;
|
|
43
|
+
}
|
package/src/index.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ export * from './core/initialize.js';
|
|
|
5
5
|
export * from './core/initialize.types.js';
|
|
6
6
|
export * from './core/client.js';
|
|
7
7
|
export * from './factories/index.js';
|
|
8
|
+
export * from './utils/magento-product.js';
|
|
9
|
+
export * from './utils/magento-review.js';
|
|
8
10
|
export * from './capabilities/product.capability.js';
|
|
9
11
|
export * from './capabilities/product-search.capability.js';
|
|
10
12
|
export * from './capabilities/category.capability.js';
|
|
@@ -12,3 +14,10 @@ export * from './capabilities/inventory.capability.js';
|
|
|
12
14
|
export * from './capabilities/price.capability.js';
|
|
13
15
|
export * from './capabilities/identity.capability.js';
|
|
14
16
|
export * from './capabilities/cart.capability.js';
|
|
17
|
+
export * from './capabilities/profile.capability.js';
|
|
18
|
+
export * from './capabilities/order-search.capability.js';
|
|
19
|
+
export * from './capabilities/order.capability.js';
|
|
20
|
+
export * from './capabilities/checkout.capability.js';
|
|
21
|
+
export * from './capabilities/product-associations.capability.js';
|
|
22
|
+
export * from './capabilities/product-recommendations.capability.js';
|
|
23
|
+
export * from './capabilities/product-reviews.capability.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CartFactory, CartFactoryWithOutput, CartCapability, CategoryFactory, CategoryFactoryWithOutput, CategoryCapability, IdentityCapability, InventoryFactory, InventoryFactoryWithOutput, InventoryCapability, PriceFactory, PriceFactoryWithOutput, PriceCapability, ProductFactory, ProductFactoryWithOutput, ProductCapability, ProductSearchFactory, ProductSearchFactoryWithOutput, ProductSearchCapability, RequestContext, Cache } from '@reactionary/core';
|
|
1
|
+
import type { CartFactory, CartFactoryWithOutput, CartCapability, CategoryFactory, CategoryFactoryWithOutput, CategoryCapability, IdentityCapability, InventoryFactory, InventoryFactoryWithOutput, InventoryCapability, PriceFactory, PriceFactoryWithOutput, PriceCapability, ProductFactory, ProductFactoryWithOutput, ProductCapability, ProductSearchFactory, ProductSearchFactoryWithOutput, ProductSearchCapability, ProfileFactory, ProfileFactoryWithOutput, ProfileCapability, OrderSearchFactory, OrderSearchFactoryWithOutput, OrderSearchCapability, OrderFactory, OrderFactoryWithOutput, OrderCapability, CheckoutFactory, CheckoutFactoryWithOutput, CheckoutCapability, ProductAssociationsFactory, ProductAssociationsFactoryWithOutput, ProductAssociationsCapability, ProductRecommendationsCapability, ProductReviewsFactory, ProductReviewsFactoryWithOutput, ProductReviewsCapability, RequestContext, Cache } from '@reactionary/core';
|
|
2
2
|
import type { MagentoConfiguration } from './configuration.schema.js';
|
|
3
3
|
import type { MagentoClient } from '../core/client.js';
|
|
4
4
|
import * as z from 'zod';
|
|
@@ -37,6 +37,40 @@ export declare const MagentoCapabilitiesSchema: z.ZodObject<{
|
|
|
37
37
|
enabled: z.ZodBoolean;
|
|
38
38
|
capability: z.ZodOptional<z.ZodUnknown>;
|
|
39
39
|
}, z.core.$loose>>>;
|
|
40
|
+
profile: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
41
|
+
enabled: z.ZodBoolean;
|
|
42
|
+
factory: z.ZodOptional<z.ZodUnknown>;
|
|
43
|
+
capability: z.ZodOptional<z.ZodUnknown>;
|
|
44
|
+
}, z.core.$loose>>>;
|
|
45
|
+
orderSearch: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
46
|
+
enabled: z.ZodBoolean;
|
|
47
|
+
factory: z.ZodOptional<z.ZodUnknown>;
|
|
48
|
+
capability: z.ZodOptional<z.ZodUnknown>;
|
|
49
|
+
}, z.core.$loose>>>;
|
|
50
|
+
order: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
51
|
+
enabled: z.ZodBoolean;
|
|
52
|
+
factory: z.ZodOptional<z.ZodUnknown>;
|
|
53
|
+
capability: z.ZodOptional<z.ZodUnknown>;
|
|
54
|
+
}, z.core.$loose>>>;
|
|
55
|
+
checkout: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
56
|
+
enabled: z.ZodBoolean;
|
|
57
|
+
factory: z.ZodOptional<z.ZodUnknown>;
|
|
58
|
+
capability: z.ZodOptional<z.ZodUnknown>;
|
|
59
|
+
}, z.core.$loose>>>;
|
|
60
|
+
productAssociations: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
61
|
+
enabled: z.ZodBoolean;
|
|
62
|
+
factory: z.ZodOptional<z.ZodUnknown>;
|
|
63
|
+
capability: z.ZodOptional<z.ZodUnknown>;
|
|
64
|
+
}, z.core.$loose>>>;
|
|
65
|
+
productRecommendations: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
66
|
+
enabled: z.ZodBoolean;
|
|
67
|
+
capability: z.ZodOptional<z.ZodUnknown>;
|
|
68
|
+
}, z.core.$loose>>>;
|
|
69
|
+
productReviews: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
70
|
+
enabled: z.ZodBoolean;
|
|
71
|
+
factory: z.ZodOptional<z.ZodUnknown>;
|
|
72
|
+
capability: z.ZodOptional<z.ZodUnknown>;
|
|
73
|
+
}, z.core.$loose>>>;
|
|
40
74
|
}, z.core.$loose>;
|
|
41
75
|
export interface MagentoCapabilityFactoryArgs {
|
|
42
76
|
cache: Cache;
|
|
@@ -63,7 +97,14 @@ export type MagentoCategoryCapabilityConfig = MagentoCapabilityConfig<CategoryFa
|
|
|
63
97
|
export type MagentoPriceCapabilityConfig = MagentoCapabilityConfig<PriceFactoryWithOutput<PriceFactory>, PriceCapability>;
|
|
64
98
|
export type MagentoInventoryCapabilityConfig = MagentoCapabilityConfig<InventoryFactoryWithOutput<InventoryFactory>, InventoryCapability>;
|
|
65
99
|
export type MagentoIdentityCapabilityConfig = MagentoDirectCapabilityConfig<IdentityCapability>;
|
|
66
|
-
export type
|
|
100
|
+
export type MagentoProfileCapabilityConfig = MagentoCapabilityConfig<ProfileFactoryWithOutput<ProfileFactory>, ProfileCapability>;
|
|
101
|
+
export type MagentoOrderSearchCapabilityConfig = MagentoCapabilityConfig<OrderSearchFactoryWithOutput<OrderSearchFactory>, OrderSearchCapability>;
|
|
102
|
+
export type MagentoOrderCapabilityConfig = MagentoCapabilityConfig<OrderFactoryWithOutput<OrderFactory>, OrderCapability>;
|
|
103
|
+
export type MagentoCheckoutCapabilityConfig = MagentoCapabilityConfig<CheckoutFactoryWithOutput<CheckoutFactory>, CheckoutCapability>;
|
|
104
|
+
export type MagentoProductAssociationsCapabilityConfig = MagentoCapabilityConfig<ProductAssociationsFactoryWithOutput<ProductAssociationsFactory>, ProductAssociationsCapability>;
|
|
105
|
+
export type MagentoProductRecommendationsCapabilityConfig = MagentoDirectCapabilityConfig<ProductRecommendationsCapability>;
|
|
106
|
+
export type MagentoProductReviewsCapabilityConfig = MagentoCapabilityConfig<ProductReviewsFactoryWithOutput<ProductReviewsFactory>, ProductReviewsCapability>;
|
|
107
|
+
export type MagentoCapabilities<TProductFactory extends ProductFactory = ProductFactory, TProductCapability extends ProductCapability = ProductCapability, TProductSearchFactory extends ProductSearchFactory = ProductSearchFactory, TProductSearchCapability extends ProductSearchCapability = ProductSearchCapability, TCartFactory extends CartFactory = CartFactory, TCartCapability extends CartCapability = CartCapability, TCategoryFactory extends CategoryFactory = CategoryFactory, TCategoryCapability extends CategoryCapability = CategoryCapability, TPriceFactory extends PriceFactory = PriceFactory, TPriceCapability extends PriceCapability = PriceCapability, TInventoryFactory extends InventoryFactory = InventoryFactory, TInventoryCapability extends InventoryCapability = InventoryCapability, TIdentityCapability extends IdentityCapability = IdentityCapability, TProfileFactory extends ProfileFactory = ProfileFactory, TProfileCapability extends ProfileCapability = ProfileCapability, TOrderSearchFactory extends OrderSearchFactory = OrderSearchFactory, TOrderSearchCapability extends OrderSearchCapability = OrderSearchCapability, TOrderFactory extends OrderFactory = OrderFactory, TOrderCapability extends OrderCapability = OrderCapability, TCheckoutFactory extends CheckoutFactory = CheckoutFactory, TCheckoutCapability extends CheckoutCapability = CheckoutCapability, TProductAssociationsFactory extends ProductAssociationsFactory = ProductAssociationsFactory, TProductAssociationsCapability extends ProductAssociationsCapability = ProductAssociationsCapability, TProductRecommendationsCapability extends ProductRecommendationsCapability = ProductRecommendationsCapability, TProductReviewsFactory extends ProductReviewsFactory = ProductReviewsFactory, TProductReviewsCapability extends ProductReviewsCapability = ProductReviewsCapability> = {
|
|
67
108
|
product?: MagentoCapabilityConfig<ProductFactoryWithOutput<TProductFactory>, TProductCapability>;
|
|
68
109
|
productSearch?: MagentoCapabilityConfig<ProductSearchFactoryWithOutput<TProductSearchFactory>, TProductSearchCapability>;
|
|
69
110
|
cart?: MagentoCapabilityConfig<CartFactoryWithOutput<TCartFactory>, TCartCapability>;
|
|
@@ -71,4 +112,11 @@ export type MagentoCapabilities<TProductFactory extends ProductFactory = Product
|
|
|
71
112
|
price?: MagentoCapabilityConfig<PriceFactoryWithOutput<TPriceFactory>, TPriceCapability>;
|
|
72
113
|
inventory?: MagentoCapabilityConfig<InventoryFactoryWithOutput<TInventoryFactory>, TInventoryCapability>;
|
|
73
114
|
identity?: MagentoDirectCapabilityConfig<TIdentityCapability>;
|
|
115
|
+
profile?: MagentoCapabilityConfig<ProfileFactoryWithOutput<TProfileFactory>, TProfileCapability>;
|
|
116
|
+
orderSearch?: MagentoCapabilityConfig<OrderSearchFactoryWithOutput<TOrderSearchFactory>, TOrderSearchCapability>;
|
|
117
|
+
order?: MagentoCapabilityConfig<OrderFactoryWithOutput<TOrderFactory>, TOrderCapability>;
|
|
118
|
+
checkout?: MagentoCapabilityConfig<CheckoutFactoryWithOutput<TCheckoutFactory>, TCheckoutCapability>;
|
|
119
|
+
productAssociations?: MagentoCapabilityConfig<ProductAssociationsFactoryWithOutput<TProductAssociationsFactory>, TProductAssociationsCapability>;
|
|
120
|
+
productRecommendations?: MagentoDirectCapabilityConfig<TProductRecommendationsCapability>;
|
|
121
|
+
productReviews?: MagentoCapabilityConfig<ProductReviewsFactoryWithOutput<TProductReviewsFactory>, TProductReviewsCapability>;
|
|
74
122
|
};
|
|
@@ -3,9 +3,16 @@ export declare const MagentoConfigurationSchema: z.ZodObject<{
|
|
|
3
3
|
adminApiKey: z.ZodString;
|
|
4
4
|
baseUrl: z.ZodString;
|
|
5
5
|
mediaUrl: z.ZodOptional<z.ZodString>;
|
|
6
|
+
mediaSource: z.ZodDefault<z.ZodEnum<{
|
|
7
|
+
EXTERNAL: "EXTERNAL";
|
|
8
|
+
DEFAULT: "DEFAULT";
|
|
9
|
+
}>>;
|
|
6
10
|
defaultCurrency: z.ZodDefault<z.ZodString>;
|
|
7
11
|
rootCategoryId: z.ZodDefault<z.ZodString>;
|
|
8
12
|
allCurrencies: z.ZodArray<z.ZodString>;
|
|
13
|
+
graphqlUrl: z.ZodOptional<z.ZodString>;
|
|
14
|
+
reviewRatingCode: z.ZodOptional<z.ZodString>;
|
|
9
15
|
storeCode: z.ZodDefault<z.ZodString>;
|
|
16
|
+
authStoreCode: z.ZodDefault<z.ZodString>;
|
|
10
17
|
}, z.core.$loose>;
|
|
11
18
|
export type MagentoConfiguration = z.infer<typeof MagentoConfigurationSchema>;
|
|
@@ -25,6 +25,7 @@ export interface MagentoExtensionAttributes {
|
|
|
25
25
|
category_links?: MagentoCategoryLink[];
|
|
26
26
|
website_ids?: number[];
|
|
27
27
|
stock_item?: MagentoStockItem;
|
|
28
|
+
external_id?: string | number;
|
|
28
29
|
[key: string]: unknown;
|
|
29
30
|
}
|
|
30
31
|
export interface MagentoStockItem {
|
|
@@ -198,3 +199,221 @@ export interface MagentoProductSearchResult {
|
|
|
198
199
|
search_criteria?: Record<string, unknown>;
|
|
199
200
|
total_count: number;
|
|
200
201
|
}
|
|
202
|
+
/** The native Magento product link types. */
|
|
203
|
+
export type MagentoProductLinkType = 'related' | 'upsell' | 'crosssell';
|
|
204
|
+
export interface MagentoProductLink {
|
|
205
|
+
sku: string;
|
|
206
|
+
link_type: string;
|
|
207
|
+
linked_product_sku: string;
|
|
208
|
+
linked_product_type?: string;
|
|
209
|
+
position?: number;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* A Magento quote (checkout) address as accepted/returned by the checkout
|
|
213
|
+
* REST endpoints (estimate-shipping-methods, shipping-information, billing-address).
|
|
214
|
+
*/
|
|
215
|
+
export interface MagentoCheckoutAddress {
|
|
216
|
+
id?: number;
|
|
217
|
+
region?: string;
|
|
218
|
+
region_id?: number;
|
|
219
|
+
region_code?: string;
|
|
220
|
+
country_id?: string;
|
|
221
|
+
street?: string[];
|
|
222
|
+
company?: string;
|
|
223
|
+
telephone?: string;
|
|
224
|
+
postcode?: string;
|
|
225
|
+
city?: string;
|
|
226
|
+
firstname?: string;
|
|
227
|
+
lastname?: string;
|
|
228
|
+
email?: string;
|
|
229
|
+
same_as_billing?: number;
|
|
230
|
+
save_in_address_book?: number;
|
|
231
|
+
}
|
|
232
|
+
export interface MagentoShippingMethod {
|
|
233
|
+
carrier_code: string;
|
|
234
|
+
method_code: string;
|
|
235
|
+
carrier_title?: string;
|
|
236
|
+
method_title?: string;
|
|
237
|
+
amount: number;
|
|
238
|
+
base_amount?: number;
|
|
239
|
+
available: boolean;
|
|
240
|
+
error_message?: string;
|
|
241
|
+
price_excl_tax?: number;
|
|
242
|
+
price_incl_tax?: number;
|
|
243
|
+
}
|
|
244
|
+
export interface MagentoPaymentMethod {
|
|
245
|
+
code: string;
|
|
246
|
+
title: string;
|
|
247
|
+
}
|
|
248
|
+
export interface MagentoTotalSegment {
|
|
249
|
+
code: string;
|
|
250
|
+
title?: string;
|
|
251
|
+
value: number | null;
|
|
252
|
+
}
|
|
253
|
+
export interface MagentoCartTotals {
|
|
254
|
+
grand_total?: number;
|
|
255
|
+
base_grand_total?: number;
|
|
256
|
+
subtotal?: number;
|
|
257
|
+
base_subtotal?: number;
|
|
258
|
+
discount_amount?: number;
|
|
259
|
+
base_discount_amount?: number;
|
|
260
|
+
tax_amount?: number;
|
|
261
|
+
base_tax_amount?: number;
|
|
262
|
+
shipping_amount?: number;
|
|
263
|
+
base_shipping_amount?: number;
|
|
264
|
+
quote_currency_code?: string;
|
|
265
|
+
base_currency_code?: string;
|
|
266
|
+
items?: MagentoCartItem[];
|
|
267
|
+
total_segments?: MagentoTotalSegment[];
|
|
268
|
+
}
|
|
269
|
+
export interface MagentoShippingInformationResult {
|
|
270
|
+
payment_methods?: MagentoPaymentMethod[];
|
|
271
|
+
totals?: MagentoCartTotals;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* The payment method payload for placing an order via payment-information.
|
|
275
|
+
*/
|
|
276
|
+
export interface MagentoPaymentMethodPayload {
|
|
277
|
+
method: string;
|
|
278
|
+
po_number?: string;
|
|
279
|
+
additional_data?: Record<string, string> | string[];
|
|
280
|
+
}
|
|
281
|
+
export interface MagentoPlaceOrderPayload {
|
|
282
|
+
email?: string;
|
|
283
|
+
paymentMethod: MagentoPaymentMethodPayload;
|
|
284
|
+
billingAddress?: MagentoCheckoutAddress;
|
|
285
|
+
}
|
|
286
|
+
export interface MagentoShippingInformationPayload {
|
|
287
|
+
addressInformation: {
|
|
288
|
+
shipping_address: MagentoCheckoutAddress;
|
|
289
|
+
billing_address?: MagentoCheckoutAddress;
|
|
290
|
+
shipping_method_code: string;
|
|
291
|
+
shipping_carrier_code: string;
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* A payment instruction the checkout capability keeps in the request session,
|
|
296
|
+
* because Magento does not persist pre-order payment intents on the quote.
|
|
297
|
+
*/
|
|
298
|
+
export interface MagentoStoredPaymentInstruction {
|
|
299
|
+
key: string;
|
|
300
|
+
method: string;
|
|
301
|
+
name: string;
|
|
302
|
+
paymentProcessor: string;
|
|
303
|
+
amountValue: number;
|
|
304
|
+
amountCurrency: string;
|
|
305
|
+
protocolData: Array<{
|
|
306
|
+
key: string;
|
|
307
|
+
value: string;
|
|
308
|
+
}>;
|
|
309
|
+
status: string;
|
|
310
|
+
}
|
|
311
|
+
export interface MagentoStoredShippingInstruction {
|
|
312
|
+
shippingMethodKey: string;
|
|
313
|
+
carrierCode: string;
|
|
314
|
+
methodCode: string;
|
|
315
|
+
instructions: string;
|
|
316
|
+
pickupPoint: string;
|
|
317
|
+
consentForUnattendedDelivery: boolean;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Checkout state the capability persists in the request session to bridge the
|
|
321
|
+
* gap between the reactionary checkout model and Magento's stateless quote flow.
|
|
322
|
+
*/
|
|
323
|
+
export interface MagentoCheckoutState {
|
|
324
|
+
email?: string;
|
|
325
|
+
phone?: string;
|
|
326
|
+
billingAddress?: MagentoCheckoutAddress;
|
|
327
|
+
shippingAddress?: MagentoCheckoutAddress;
|
|
328
|
+
shippingInstruction?: MagentoStoredShippingInstruction;
|
|
329
|
+
paymentInstructions?: MagentoStoredPaymentInstruction[];
|
|
330
|
+
orderId?: string;
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* The Magento REST API exposes no review or rating surface at all, so the
|
|
334
|
+
* product reviews capability talks to the GraphQL endpoint instead. These are
|
|
335
|
+
* the slices of Magento's `ProductReview` schema that the capability consumes.
|
|
336
|
+
*/
|
|
337
|
+
export interface MagentoGraphQLError {
|
|
338
|
+
message: string;
|
|
339
|
+
path?: Array<string | number>;
|
|
340
|
+
extensions?: Record<string, unknown>;
|
|
341
|
+
}
|
|
342
|
+
export interface MagentoGraphQLResponse<TData> {
|
|
343
|
+
data?: TData;
|
|
344
|
+
errors?: MagentoGraphQLError[];
|
|
345
|
+
}
|
|
346
|
+
export interface MagentoProductReviewRatingBreakdown {
|
|
347
|
+
name: string;
|
|
348
|
+
value: string;
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* `average_rating` is a percentage (0-100), not a star count.
|
|
352
|
+
* Magento emits `created_at` as a MySQL datetime in UTC ("2024-05-04 12:00:00").
|
|
353
|
+
*/
|
|
354
|
+
export interface MagentoProductReview {
|
|
355
|
+
average_rating: number;
|
|
356
|
+
created_at: string;
|
|
357
|
+
nickname: string;
|
|
358
|
+
summary: string;
|
|
359
|
+
text: string;
|
|
360
|
+
ratings_breakdown?: MagentoProductReviewRatingBreakdown[];
|
|
361
|
+
}
|
|
362
|
+
export interface MagentoProductReviewsPageInfo {
|
|
363
|
+
page_size?: number;
|
|
364
|
+
current_page?: number;
|
|
365
|
+
total_pages?: number;
|
|
366
|
+
}
|
|
367
|
+
export interface MagentoProductReviews {
|
|
368
|
+
items: MagentoProductReview[];
|
|
369
|
+
page_info?: MagentoProductReviewsPageInfo;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* `rating_summary` is a percentage (0-100) across all approved reviews.
|
|
373
|
+
* There is no rating distribution in the GraphQL schema.
|
|
374
|
+
*/
|
|
375
|
+
export interface MagentoReviewableProduct {
|
|
376
|
+
sku: string;
|
|
377
|
+
rating_summary?: number | null;
|
|
378
|
+
review_count?: number | null;
|
|
379
|
+
reviews?: MagentoProductReviews;
|
|
380
|
+
}
|
|
381
|
+
export interface MagentoProductReviewsQueryResult {
|
|
382
|
+
products?: {
|
|
383
|
+
items?: MagentoReviewableProduct[];
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
export interface MagentoProductReviewRatingValue {
|
|
387
|
+
value_id: string;
|
|
388
|
+
value: string;
|
|
389
|
+
}
|
|
390
|
+
export interface MagentoProductReviewRatingMetadata {
|
|
391
|
+
id: string;
|
|
392
|
+
name: string;
|
|
393
|
+
values: MagentoProductReviewRatingValue[];
|
|
394
|
+
}
|
|
395
|
+
export interface MagentoProductReviewRatingsMetadataQueryResult {
|
|
396
|
+
productReviewRatingsMetadata?: {
|
|
397
|
+
items?: MagentoProductReviewRatingMetadata[];
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* `value_id` is an opaque, store-specific id that has to be looked up through
|
|
402
|
+
* `productReviewRatingsMetadata` — the plain star count is not accepted.
|
|
403
|
+
*/
|
|
404
|
+
export interface MagentoCreateProductReviewRating {
|
|
405
|
+
id: string;
|
|
406
|
+
value_id: string;
|
|
407
|
+
}
|
|
408
|
+
export interface MagentoCreateProductReviewInput {
|
|
409
|
+
sku: string;
|
|
410
|
+
nickname: string;
|
|
411
|
+
summary: string;
|
|
412
|
+
text: string;
|
|
413
|
+
ratings: MagentoCreateProductReviewRating[];
|
|
414
|
+
}
|
|
415
|
+
export interface MagentoCreateProductReviewResult {
|
|
416
|
+
createProductReview?: {
|
|
417
|
+
review?: MagentoProductReview;
|
|
418
|
+
};
|
|
419
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { MagentoClient } from '../core/client.js';
|
|
2
|
+
import type { MagentoCategory, MagentoProduct } from '../schema/magento.types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Reactionary addresses products by their `external_id`, while the Magento
|
|
5
|
+
* catalogue endpoints key off SKU. Falls back to `entity_id` and finally to
|
|
6
|
+
* treating the key as a SKU directly.
|
|
7
|
+
*/
|
|
8
|
+
export declare function resolveProductSku(magentoApi: MagentoClient, key: string): Promise<string | null>;
|
|
9
|
+
export declare function fetchProductsBySkus(magentoApi: MagentoClient, skus: string[]): Promise<MagentoProduct[]>;
|
|
10
|
+
export declare function fetchProductsInCategory(magentoApi: MagentoClient, categoryId: string, limit: number): Promise<MagentoProduct[]>;
|
|
11
|
+
/**
|
|
12
|
+
* Magento has no notion of a product collection, so a collection name is
|
|
13
|
+
* resolved against the category tree by `external_id`, `url_key` and `name`.
|
|
14
|
+
*/
|
|
15
|
+
export declare function findCategoryByName(magentoApi: MagentoClient, collectionName: string): Promise<MagentoCategory | null>;
|