@commercejs/types 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/dist/adapter.d.ts +310 -0
  2. package/dist/adapter.d.ts.map +1 -0
  3. package/dist/adapter.js +12 -0
  4. package/dist/adapter.js.map +1 -0
  5. package/dist/auction.d.ts +59 -0
  6. package/dist/auction.d.ts.map +1 -0
  7. package/dist/auction.js +5 -0
  8. package/dist/auction.js.map +1 -0
  9. package/dist/brand.d.ts +16 -0
  10. package/dist/brand.d.ts.map +1 -0
  11. package/dist/brand.js +5 -0
  12. package/dist/brand.js.map +1 -0
  13. package/dist/cart.d.ts +42 -0
  14. package/dist/cart.d.ts.map +1 -0
  15. package/dist/cart.js +5 -0
  16. package/dist/cart.js.map +1 -0
  17. package/dist/category.d.ts +13 -0
  18. package/dist/category.d.ts.map +1 -0
  19. package/dist/category.js +5 -0
  20. package/dist/category.js.map +1 -0
  21. package/dist/common.d.ts +81 -0
  22. package/dist/common.d.ts.map +1 -0
  23. package/dist/common.js +27 -0
  24. package/dist/common.js.map +1 -0
  25. package/dist/country.d.ts +16 -0
  26. package/dist/country.d.ts.map +1 -0
  27. package/dist/country.js +5 -0
  28. package/dist/country.js.map +1 -0
  29. package/dist/customer.d.ts +48 -0
  30. package/dist/customer.d.ts.map +1 -0
  31. package/dist/customer.js +5 -0
  32. package/dist/customer.js.map +1 -0
  33. package/dist/gift-card.d.ts +64 -0
  34. package/dist/gift-card.d.ts.map +1 -0
  35. package/dist/gift-card.js +5 -0
  36. package/dist/gift-card.js.map +1 -0
  37. package/dist/index.d.ts +27 -0
  38. package/dist/index.d.ts.map +1 -0
  39. package/dist/index.js +6 -0
  40. package/dist/index.js.map +1 -0
  41. package/dist/location.d.ts +56 -0
  42. package/dist/location.d.ts.map +1 -0
  43. package/dist/location.js +5 -0
  44. package/dist/location.js.map +1 -0
  45. package/dist/order-input.d.ts +46 -0
  46. package/dist/order-input.d.ts.map +1 -0
  47. package/dist/order-input.js +9 -0
  48. package/dist/order-input.js.map +1 -0
  49. package/dist/order-status.d.ts +55 -0
  50. package/dist/order-status.d.ts.map +1 -0
  51. package/dist/order-status.js +5 -0
  52. package/dist/order-status.js.map +1 -0
  53. package/dist/order.d.ts +62 -0
  54. package/dist/order.d.ts.map +1 -0
  55. package/dist/order.js +5 -0
  56. package/dist/order.js.map +1 -0
  57. package/dist/payment-provider.d.ts +117 -0
  58. package/dist/payment-provider.d.ts.map +1 -0
  59. package/dist/payment-provider.js +10 -0
  60. package/dist/payment-provider.js.map +1 -0
  61. package/dist/payment.d.ts +22 -0
  62. package/dist/payment.d.ts.map +1 -0
  63. package/dist/payment.js +5 -0
  64. package/dist/payment.js.map +1 -0
  65. package/dist/product.d.ts +162 -0
  66. package/dist/product.d.ts.map +1 -0
  67. package/dist/product.js +5 -0
  68. package/dist/product.js.map +1 -0
  69. package/dist/promotion.d.ts +65 -0
  70. package/dist/promotion.d.ts.map +1 -0
  71. package/dist/promotion.js +5 -0
  72. package/dist/promotion.js.map +1 -0
  73. package/dist/rental.d.ts +84 -0
  74. package/dist/rental.d.ts.map +1 -0
  75. package/dist/rental.js +5 -0
  76. package/dist/rental.js.map +1 -0
  77. package/dist/return.d.ts +64 -0
  78. package/dist/return.d.ts.map +1 -0
  79. package/dist/return.js +5 -0
  80. package/dist/return.js.map +1 -0
  81. package/dist/review.d.ts +31 -0
  82. package/dist/review.d.ts.map +1 -0
  83. package/dist/review.js +5 -0
  84. package/dist/review.js.map +1 -0
  85. package/dist/search.d.ts +38 -0
  86. package/dist/search.d.ts.map +1 -0
  87. package/dist/search.js +5 -0
  88. package/dist/search.js.map +1 -0
  89. package/dist/shipping.d.ts +17 -0
  90. package/dist/shipping.d.ts.map +1 -0
  91. package/dist/shipping.js +5 -0
  92. package/dist/shipping.js.map +1 -0
  93. package/dist/store.d.ts +36 -0
  94. package/dist/store.d.ts.map +1 -0
  95. package/dist/store.js +5 -0
  96. package/dist/store.js.map +1 -0
  97. package/dist/wholesale.d.ts +89 -0
  98. package/dist/wholesale.d.ts.map +1 -0
  99. package/dist/wholesale.js +5 -0
  100. package/dist/wholesale.js.map +1 -0
  101. package/dist/wishlist.d.ts +18 -0
  102. package/dist/wishlist.d.ts.map +1 -0
  103. package/dist/wishlist.js +5 -0
  104. package/dist/wishlist.js.map +1 -0
  105. package/package.json +27 -0
@@ -0,0 +1,310 @@
1
+ import type { PaginatedResult, PaginationParams } from './common.js';
2
+ import type { Product } from './product.js';
3
+ import type { Category } from './category.js';
4
+ import type { Cart } from './cart.js';
5
+ import type { Customer, Address, RegisterInput, UpdateCustomerInput } from './customer.js';
6
+ import type { Order } from './order.js';
7
+ import type { ShippingMethod } from './shipping.js';
8
+ import type { PaymentMethod } from './payment.js';
9
+ import type { SearchParams, SearchResult } from './search.js';
10
+ import type { Wishlist } from './wishlist.js';
11
+ import type { Review, ReviewInput, ReviewSummary } from './review.js';
12
+ import type { StoreInfo } from './store.js';
13
+ import type { Promotion, Coupon } from './promotion.js';
14
+ import type { ReturnRequest, CreateReturnInput } from './return.js';
15
+ import type { CustomerGroup, QuoteRequest, CreateQuoteInput } from './wholesale.js';
16
+ import type { Bid, PlaceBidInput } from './auction.js';
17
+ import type { RentalBooking, CreateRentalBookingInput, AvailabilitySlot } from './rental.js';
18
+ import type { GiftCard, GiftCardTransaction, PurchaseGiftCardInput, RedeemGiftCardInput } from './gift-card.js';
19
+ import type { Brand } from './brand.js';
20
+ import type { Country } from './country.js';
21
+ import type { StoreLocation } from './location.js';
22
+ import type { CreateOrderInput } from './order-input.js';
23
+ import type { OrderStatusInfo, OrderHistoryEntry, UpdateOrderStatusInput } from './order-status.js';
24
+ export interface GetProductParams {
25
+ id?: string;
26
+ slug?: string;
27
+ }
28
+ export interface GetCategoriesParams {
29
+ parentId?: string;
30
+ depth?: number;
31
+ }
32
+ export interface AddToCartInput {
33
+ productId: string;
34
+ variantId?: string;
35
+ quantity: number;
36
+ }
37
+ /**
38
+ * Catalog operations — product and category retrieval.
39
+ *
40
+ * Generic type parameters allow adapters to return enriched types
41
+ * (e.g., SallaProduct extends Product) while keeping the contract satisfied.
42
+ */
43
+ export interface CatalogAdapter<TProduct extends Product = Product, TCategory extends Category = Category, TSearchResult extends SearchResult = SearchResult> {
44
+ /** Fetch a single product by ID or slug */
45
+ getProduct(params: GetProductParams): Promise<TProduct>;
46
+ /** Search / list products with filters and pagination */
47
+ getProducts(params: SearchParams): Promise<TSearchResult>;
48
+ /** Fetch category tree */
49
+ getCategories(params?: GetCategoriesParams): Promise<TCategory[]>;
50
+ }
51
+ /**
52
+ * Cart operations — CRUD for cart items.
53
+ */
54
+ export interface CartAdapter<TCart extends Cart = Cart> {
55
+ /** Create a new empty cart and return it */
56
+ createCart(): Promise<TCart>;
57
+ /** Get an existing cart by ID */
58
+ getCart(cartId: string): Promise<TCart>;
59
+ /** Add an item to the cart */
60
+ addToCart(cartId: string, item: AddToCartInput): Promise<TCart>;
61
+ /** Update cart item quantity */
62
+ updateCartItem(cartId: string, itemId: string, quantity: number): Promise<TCart>;
63
+ /** Remove an item from the cart */
64
+ removeFromCart(cartId: string, itemId: string): Promise<TCart>;
65
+ /** Apply a coupon code to the cart */
66
+ applyCoupon(cartId: string, code: string): Promise<TCart>;
67
+ /** Remove a coupon from the cart */
68
+ removeCoupon(cartId: string): Promise<TCart>;
69
+ }
70
+ /**
71
+ * Checkout operations — shipping, payment, and order placement.
72
+ */
73
+ export interface CheckoutAdapter<TCart extends Cart = Cart, TOrder extends Order = Order> {
74
+ /** List available shipping methods for a cart */
75
+ getShippingMethods(cartId: string): Promise<ShippingMethod[]>;
76
+ /** Set the shipping address */
77
+ setShippingAddress(cartId: string, address: Omit<Address, 'id' | 'isDefault'>): Promise<TCart>;
78
+ /** Set the billing address */
79
+ setBillingAddress(cartId: string, address: Omit<Address, 'id' | 'isDefault'>): Promise<TCart>;
80
+ /** Select a shipping method */
81
+ setShippingMethod(cartId: string, methodId: string): Promise<TCart>;
82
+ /** List available payment methods for a cart */
83
+ getPaymentMethods(cartId: string): Promise<PaymentMethod[]>;
84
+ /** Select a payment method */
85
+ setPaymentMethod(cartId: string, methodId: string): Promise<TCart>;
86
+ /** Place the order (finalize checkout) */
87
+ placeOrder(cartId: string): Promise<TOrder>;
88
+ }
89
+ /**
90
+ * Customer operations — authentication, profile, and address book.
91
+ */
92
+ export interface CustomerAdapter<TCustomer extends Customer = Customer> {
93
+ /** Authenticate a customer */
94
+ login(email: string, password: string): Promise<TCustomer>;
95
+ /** Register a new customer */
96
+ register(input: RegisterInput): Promise<TCustomer>;
97
+ /** Get the currently authenticated customer */
98
+ getCustomer(): Promise<TCustomer>;
99
+ /** Update customer profile */
100
+ updateCustomer(input: UpdateCustomerInput): Promise<TCustomer>;
101
+ /** Logout the current customer */
102
+ logout(): Promise<void>;
103
+ /** Send a password reset email / OTP */
104
+ forgotPassword(email: string): Promise<void>;
105
+ /** Reset password using a token/OTP received via email */
106
+ resetPassword(token: string, newPassword: string): Promise<void>;
107
+ /** Get all saved addresses for the authenticated customer */
108
+ getAddresses(): Promise<Address[]>;
109
+ /** Add a new address to the customer's address book */
110
+ addAddress(address: Omit<Address, 'id'>): Promise<Address>;
111
+ /** Update an existing address */
112
+ updateAddress(addressId: string, address: Partial<Omit<Address, 'id'>>): Promise<Address>;
113
+ /** Delete an address from the address book */
114
+ deleteAddress(addressId: string): Promise<void>;
115
+ }
116
+ /**
117
+ * Order operations — create, read, and list orders.
118
+ *
119
+ * Separated from CustomerAdapter so that order creation can be handled
120
+ * independently (e.g., by a checkout engine that pushes orders to the
121
+ * platform after payment processing).
122
+ */
123
+ export interface OrderAdapter<TOrder extends Order = Order> {
124
+ /** Create a new order from structured input (e.g., after checkout) */
125
+ createOrder(input: CreateOrderInput): Promise<TOrder>;
126
+ /** Get a single order by ID */
127
+ getOrder(orderId: string): Promise<TOrder>;
128
+ /** Get paginated list of orders (optionally filtered by customer) */
129
+ getCustomerOrders(params?: PaginationParams): Promise<PaginatedResult<TOrder>>;
130
+ /** Get all available order statuses (with labels, colors, icons) */
131
+ getOrderStatuses(): Promise<OrderStatusInfo[]>;
132
+ /** Update an order's status */
133
+ updateOrderStatus(orderId: string, input: UpdateOrderStatusInput): Promise<void>;
134
+ /** Cancel an order (convenience — calls updateOrderStatus with 'canceled') */
135
+ cancelOrder(orderId: string, note?: string): Promise<void>;
136
+ /** Duplicate an existing order (reorder) */
137
+ duplicateOrder(orderId: string): Promise<TOrder>;
138
+ /** Get order status change history / timeline */
139
+ getOrderHistory(orderId: string): Promise<OrderHistoryEntry[]>;
140
+ }
141
+ /**
142
+ * Wishlist operations — favorites / saved items.
143
+ */
144
+ export interface WishlistAdapter<TWishlist extends Wishlist = Wishlist> {
145
+ /** Get the authenticated customer's wishlist */
146
+ getWishlist(): Promise<TWishlist>;
147
+ /** Add a product to the wishlist */
148
+ addToWishlist(productId: string, variantId?: string): Promise<TWishlist>;
149
+ /** Remove an item from the wishlist */
150
+ removeFromWishlist(itemId: string): Promise<TWishlist>;
151
+ }
152
+ /**
153
+ * Review operations — product ratings and reviews.
154
+ */
155
+ export interface ReviewAdapter {
156
+ /** Get paginated reviews for a product */
157
+ getProductReviews(productId: string, params?: PaginationParams): Promise<PaginatedResult<Review>>;
158
+ /** Get review summary (average rating, distribution) for a product */
159
+ getReviewSummary(productId: string): Promise<ReviewSummary>;
160
+ /** Submit a new review for a product */
161
+ submitReview(input: ReviewInput): Promise<Review>;
162
+ }
163
+ /**
164
+ * Store operations — store-level metadata.
165
+ */
166
+ export interface StoreAdapter<TStoreInfo extends StoreInfo = StoreInfo> {
167
+ /** Get store information (name, logo, currencies, locales) */
168
+ getStoreInfo(): Promise<TStoreInfo>;
169
+ }
170
+ /**
171
+ * Promotion operations — discounts and coupon validation.
172
+ */
173
+ export interface PromotionAdapter {
174
+ /** Get all currently active promotions */
175
+ getActivePromotions(): Promise<Promotion[]>;
176
+ /** Validate a coupon code and return coupon details */
177
+ validateCoupon(code: string): Promise<Coupon>;
178
+ }
179
+ /**
180
+ * Return operations — return requests and refunds.
181
+ */
182
+ export interface ReturnAdapter {
183
+ /** Create a return request for an order */
184
+ createReturn(input: CreateReturnInput): Promise<ReturnRequest>;
185
+ /** Get paginated list of customer's return requests */
186
+ getReturns(params?: PaginationParams): Promise<PaginatedResult<ReturnRequest>>;
187
+ /** Get a single return request by ID */
188
+ getReturn(returnId: string): Promise<ReturnRequest>;
189
+ /** Cancel a return request (only if status is 'requested') */
190
+ cancelReturn(returnId: string): Promise<ReturnRequest>;
191
+ }
192
+ /**
193
+ * Brand operations — product brand listing.
194
+ */
195
+ export interface BrandAdapter {
196
+ /** Get all product brands */
197
+ getBrands(): Promise<Brand[]>;
198
+ }
199
+ /**
200
+ * Country operations — for address forms and locale resolution.
201
+ */
202
+ export interface CountryAdapter {
203
+ /** Get all countries supported by the store */
204
+ getCountries(): Promise<Country[]>;
205
+ }
206
+ /**
207
+ * Location operations — store branches and pickup points.
208
+ */
209
+ export interface LocationAdapter {
210
+ /** Get all store locations / branches */
211
+ getStoreLocations(): Promise<StoreLocation[]>;
212
+ }
213
+ /**
214
+ * Wholesale / B2B operations — customer groups, quotes, and bulk pricing.
215
+ */
216
+ export interface WholesaleAdapter {
217
+ /** Get all customer groups (wholesale, retail, VIP, etc.) */
218
+ getCustomerGroups(): Promise<CustomerGroup[]>;
219
+ /** Create a request-for-quote */
220
+ createQuote(input: CreateQuoteInput): Promise<QuoteRequest>;
221
+ /** Get paginated list of customer's quote requests */
222
+ getQuotes(params?: PaginationParams): Promise<PaginatedResult<QuoteRequest>>;
223
+ /** Get a single quote by ID */
224
+ getQuote(quoteId: string): Promise<QuoteRequest>;
225
+ /** Accept a quoted price (converts to order) */
226
+ acceptQuote(quoteId: string): Promise<QuoteRequest>;
227
+ /** Reject a quote */
228
+ rejectQuote(quoteId: string): Promise<QuoteRequest>;
229
+ }
230
+ /**
231
+ * Auction operations — bidding on products.
232
+ */
233
+ export interface AuctionAdapter {
234
+ /** Place a bid on an auction product */
235
+ placeBid(input: PlaceBidInput): Promise<Bid>;
236
+ /** Get bid history for a product */
237
+ getBids(productId: string, params?: PaginationParams): Promise<PaginatedResult<Bid>>;
238
+ /** Get the current winning bid for a product */
239
+ getWinningBid(productId: string): Promise<Bid | null>;
240
+ }
241
+ /**
242
+ * Rental / booking operations.
243
+ */
244
+ export interface RentalAdapter {
245
+ /** Check availability for a product in a date range */
246
+ checkAvailability(productId: string, startDate: string, endDate: string): Promise<AvailabilitySlot[]>;
247
+ /** Create a rental booking */
248
+ createBooking(input: CreateRentalBookingInput): Promise<RentalBooking>;
249
+ /** Get customer's bookings */
250
+ getBookings(params?: PaginationParams): Promise<PaginatedResult<RentalBooking>>;
251
+ /** Get a single booking by ID */
252
+ getBooking(bookingId: string): Promise<RentalBooking>;
253
+ /** Cancel a booking */
254
+ cancelBooking(bookingId: string): Promise<RentalBooking>;
255
+ }
256
+ /**
257
+ * Gift card operations.
258
+ */
259
+ export interface GiftCardAdapter {
260
+ /** Purchase a new gift card */
261
+ purchaseGiftCard(input: PurchaseGiftCardInput): Promise<GiftCard>;
262
+ /** Check a gift card balance by code */
263
+ getGiftCardBalance(code: string): Promise<GiftCard>;
264
+ /** Redeem a gift card at checkout (apply to cart) */
265
+ redeemGiftCard(input: RedeemGiftCardInput): Promise<GiftCard>;
266
+ /** Get customer's gift cards */
267
+ getMyGiftCards(): Promise<GiftCard[]>;
268
+ /** Get transaction history for a gift card */
269
+ getGiftCardTransactions(giftCardId: string): Promise<GiftCardTransaction[]>;
270
+ }
271
+ /** Well-known capability domain names */
272
+ export type AdapterDomain = 'catalog' | 'cart' | 'checkout' | 'orders' | 'customers' | 'wishlist' | 'reviews' | 'store' | 'promotions' | 'returns' | 'wholesale' | 'auctions' | 'rentals' | 'gift-cards' | 'brands' | 'countries' | 'locations';
273
+ /**
274
+ * CommerceAdapter — the full contract that platform adapters implement.
275
+ *
276
+ * Composed from domain-specific sub-interfaces. Each adapter (Salla, Zid,
277
+ * Shopify, Medusa, etc.) provides its own implementation, mapping
278
+ * platform-specific API calls and data shapes to the unified types.
279
+ *
280
+ * Adapters MUST implement all sub-interfaces but MAY throw a
281
+ * `CommerceError` with code 'NOT_SUPPORTED' (status 501) for domains
282
+ * the platform doesn't support. Use `capabilities` to check support
283
+ * at runtime before calling.
284
+ *
285
+ * Generic type parameters allow adapters to expose enriched, platform-specific
286
+ * types while remaining compatible with the base interface.
287
+ *
288
+ * @example
289
+ * ```ts
290
+ * // Check before calling optional domain
291
+ * if (adapter.capabilities.includes('cart')) {
292
+ * const cart = await adapter.createCart()
293
+ * }
294
+ *
295
+ * // Adapter with enriched types
296
+ * class SallaAdapter implements CommerceAdapter<SallaProduct, SallaCategory> { ... }
297
+ * ```
298
+ */
299
+ export interface CommerceAdapter<TProduct extends Product = Product, TCategory extends Category = Category, TSearchResult extends SearchResult = SearchResult, TCart extends Cart = Cart, TOrder extends Order = Order, TCustomer extends Customer = Customer, TWishlist extends Wishlist = Wishlist, TStoreInfo extends StoreInfo = StoreInfo> extends CatalogAdapter<TProduct, TCategory, TSearchResult>, CartAdapter<TCart>, CheckoutAdapter<TCart, TOrder>, CustomerAdapter<TCustomer>, OrderAdapter<TOrder>, WishlistAdapter<TWishlist>, ReviewAdapter, StoreAdapter<TStoreInfo>, PromotionAdapter, ReturnAdapter, WholesaleAdapter, AuctionAdapter, RentalAdapter, GiftCardAdapter, BrandAdapter, CountryAdapter, LocationAdapter {
300
+ /** Unique adapter identifier (e.g., "salla", "zid", "shopify") */
301
+ readonly name: string;
302
+ /**
303
+ * Domains this adapter actually supports (i.e., won't throw NOT_SUPPORTED).
304
+ *
305
+ * Consumers should check this before calling methods in optional domains.
306
+ * Required domains like 'catalog' and 'store' should always be listed.
307
+ */
308
+ readonly capabilities: AdapterDomain[];
309
+ }
310
+ //# sourceMappingURL=adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAWA,OAAO,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E,CAAC,CAAA;CAC5E;AAID,yCAAyC;AACzC,MAAM,MAAM,aAAa,GACrB,SAAS,GACT,MAAM,GACN,UAAU,GACV,QAAQ,GACR,WAAW,GACX,UAAU,GACV,SAAS,GACT,OAAO,GACP,YAAY,GACZ,SAAS,GACT,WAAW,GACX,UAAU,GACV,SAAS,GACT,YAAY,GACZ,QAAQ,GACR,WAAW,GACX,WAAW,CAAA;AAIf;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,WAAW,eAAe,CAC9B,QAAQ,SAAS,OAAO,GAAG,OAAO,EAClC,SAAS,SAAS,QAAQ,GAAG,QAAQ,EACrC,aAAa,SAAS,YAAY,GAAG,YAAY,EACjD,KAAK,SAAS,IAAI,GAAG,IAAI,EACzB,MAAM,SAAS,KAAK,GAAG,KAAK,EAC5B,SAAS,SAAS,QAAQ,GAAG,QAAQ,EACrC,SAAS,SAAS,QAAQ,GAAG,QAAQ,EACrC,UAAU,SAAS,SAAS,GAAG,SAAS,CACxC,SACA,cAAc,CAAC,QAAQ,EAAE,SAAS,EAAE,aAAa,CAAC,EAClD,WAAW,CAAC,KAAK,CAAC,EAClB,eAAe,CAAC,KAAK,EAAE,MAAM,CAAC,EAC9B,eAAe,CAAC,SAAS,CAAC,EAC1B,YAAY,CAAC,MAAM,CAAC,EACpB,eAAe,CAAC,SAAS,CAAC,EAC1B,aAAa,EACb,YAAY,CAAC,UAAU,CAAC,EACxB,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,eAAe,EACf,YAAY,EACZ,cAAc,EACd,eAAe;IAEf,kEAAkE;IAClE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IAErB;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,EAAE,aAAa,EAAE,CAAA;CACvC"}
@@ -0,0 +1,12 @@
1
+ // ---------------------------------------------------------------------------
2
+ // Adapter contract — the interface every platform adapter must implement
3
+ // ---------------------------------------------------------------------------
4
+ // Split into domain-specific sub-interfaces (Design Pattern: Interface
5
+ // Segregation) so adapters can implement only the domains they support.
6
+ //
7
+ // The CommerceAdapter type composes all sub-interfaces. For composable
8
+ // setups, consumers can use individual sub-interfaces (CatalogAdapter,
9
+ // OrderAdapter, etc.) and the AdapterCapabilities system.
10
+ // ---------------------------------------------------------------------------
11
+ export {};
12
+ //# sourceMappingURL=adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.js","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,yEAAyE;AACzE,8EAA8E;AAC9E,uEAAuE;AACvE,wEAAwE;AACxE,EAAE;AACF,uEAAuE;AACvE,uEAAuE;AACvE,0DAA0D;AAC1D,8EAA8E"}
@@ -0,0 +1,59 @@
1
+ import type { Id, Maybe, Price } from './common.js';
2
+ /** Type of auction */
3
+ export type AuctionType = 'english' | 'dutch' | 'sealed' | 'reverse';
4
+ /** Auction lifecycle status */
5
+ export type AuctionStatus = 'upcoming' | 'active' | 'ended' | 'sold' | 'cancelled' | 'reserve_not_met';
6
+ /** Auction metadata on a product */
7
+ export interface AuctionProductMeta {
8
+ /** Type of auction */
9
+ auctionType: AuctionType;
10
+ status: AuctionStatus;
11
+ /** Starting / opening price */
12
+ startingPrice: Price;
13
+ /** Reserve price — minimum to sell (null = no reserve) */
14
+ reservePrice: Maybe<Price>;
15
+ /** Minimum bid increment */
16
+ bidIncrement: Price;
17
+ /** Buy-it-now price — skip the auction (null = no buy-it-now) */
18
+ buyNowPrice: Maybe<Price>;
19
+ /** Auction start time (ISO 8601) */
20
+ startsAt: string;
21
+ /** Auction end time (ISO 8601) */
22
+ endsAt: string;
23
+ /** Current highest bid (null if no bids yet) */
24
+ currentBid: Maybe<Price>;
25
+ /** Total number of bids placed */
26
+ bidCount: number;
27
+ /** Whether auto-bidding (proxy bidding) is allowed */
28
+ autoBiddingEnabled: boolean;
29
+ /** ID of the current winning bidder (null if no bids) */
30
+ winningBidderId: Maybe<Id>;
31
+ }
32
+ /** A single bid placed by a customer */
33
+ export interface Bid {
34
+ id: Id;
35
+ /** Product / auction ID */
36
+ productId: Id;
37
+ /** Bidder customer ID */
38
+ bidderId: Id;
39
+ /** Bidder display name */
40
+ bidderName: string;
41
+ /** Bid amount */
42
+ amount: Price;
43
+ /** Maximum amount for auto-bidding (null if not auto-bidding) */
44
+ maxAutoBid: Maybe<Price>;
45
+ /** Whether this is currently the winning bid */
46
+ isWinning: boolean;
47
+ /** Whether this was an auto-bid placed by the system */
48
+ isAutoBid: boolean;
49
+ createdAt: string;
50
+ }
51
+ /** Input for placing a bid */
52
+ export interface PlaceBidInput {
53
+ productId: string;
54
+ /** Bid amount */
55
+ amount: number;
56
+ /** Maximum auto-bid amount (optional — enables proxy bidding) */
57
+ maxAutoBid?: number;
58
+ }
59
+ //# sourceMappingURL=auction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auction.d.ts","sourceRoot":"","sources":["../src/auction.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAEnD,sBAAsB;AACtB,MAAM,MAAM,WAAW,GACnB,SAAS,GACT,OAAO,GACP,QAAQ,GACR,SAAS,CAAA;AAEb,+BAA+B;AAC/B,MAAM,MAAM,aAAa,GACrB,UAAU,GACV,QAAQ,GACR,OAAO,GACP,MAAM,GACN,WAAW,GACX,iBAAiB,CAAA;AAErB,oCAAoC;AACpC,MAAM,WAAW,kBAAkB;IACjC,sBAAsB;IACtB,WAAW,EAAE,WAAW,CAAA;IACxB,MAAM,EAAE,aAAa,CAAA;IACrB,+BAA+B;IAC/B,aAAa,EAAE,KAAK,CAAA;IACpB,0DAA0D;IAC1D,YAAY,EAAE,KAAK,CAAC,KAAK,CAAC,CAAA;IAC1B,4BAA4B;IAC5B,YAAY,EAAE,KAAK,CAAA;IACnB,iEAAiE;IACjE,WAAW,EAAE,KAAK,CAAC,KAAK,CAAC,CAAA;IACzB,oCAAoC;IACpC,QAAQ,EAAE,MAAM,CAAA;IAChB,kCAAkC;IAClC,MAAM,EAAE,MAAM,CAAA;IACd,gDAAgD;IAChD,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC,CAAA;IACxB,kCAAkC;IAClC,QAAQ,EAAE,MAAM,CAAA;IAChB,sDAAsD;IACtD,kBAAkB,EAAE,OAAO,CAAA;IAC3B,yDAAyD;IACzD,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,CAAA;CAC3B;AAED,wCAAwC;AACxC,MAAM,WAAW,GAAG;IAClB,EAAE,EAAE,EAAE,CAAA;IACN,2BAA2B;IAC3B,SAAS,EAAE,EAAE,CAAA;IACb,yBAAyB;IACzB,QAAQ,EAAE,EAAE,CAAA;IACZ,0BAA0B;IAC1B,UAAU,EAAE,MAAM,CAAA;IAClB,iBAAiB;IACjB,MAAM,EAAE,KAAK,CAAA;IACb,iEAAiE;IACjE,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC,CAAA;IACxB,gDAAgD;IAChD,SAAS,EAAE,OAAO,CAAA;IAClB,wDAAwD;IACxD,SAAS,EAAE,OAAO,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,8BAA8B;AAC9B,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAA;IACjB,iBAAiB;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,iEAAiE;IACjE,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB"}
@@ -0,0 +1,5 @@
1
+ // ---------------------------------------------------------------------------
2
+ // Auction / bidding types
3
+ // ---------------------------------------------------------------------------
4
+ export {};
5
+ //# sourceMappingURL=auction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auction.js","sourceRoot":"","sources":["../src/auction.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,0BAA0B;AAC1B,8EAA8E"}
@@ -0,0 +1,16 @@
1
+ import type { Id, LocalizedString, Maybe, Image } from './common.js';
2
+ /** A product brand */
3
+ export interface Brand {
4
+ id: Id;
5
+ /** Display name */
6
+ name: LocalizedString;
7
+ /** URL-friendly slug */
8
+ slug: string;
9
+ /** Brand logo */
10
+ logo: Maybe<Image>;
11
+ /** Brand description */
12
+ description: Maybe<LocalizedString>;
13
+ /** Whether the brand is active/visible */
14
+ isActive: boolean;
15
+ }
16
+ //# sourceMappingURL=brand.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brand.d.ts","sourceRoot":"","sources":["../src/brand.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAAE,EAAE,eAAe,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAEpE,sBAAsB;AACtB,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,EAAE,CAAA;IACN,mBAAmB;IACnB,IAAI,EAAE,eAAe,CAAA;IACrB,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,iBAAiB;IACjB,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,CAAA;IAClB,wBAAwB;IACxB,WAAW,EAAE,KAAK,CAAC,eAAe,CAAC,CAAA;IACnC,0CAA0C;IAC1C,QAAQ,EAAE,OAAO,CAAA;CAClB"}
package/dist/brand.js ADDED
@@ -0,0 +1,5 @@
1
+ // ---------------------------------------------------------------------------
2
+ // Brand types
3
+ // ---------------------------------------------------------------------------
4
+ export {};
5
+ //# sourceMappingURL=brand.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brand.js","sourceRoot":"","sources":["../src/brand.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,cAAc;AACd,8EAA8E"}
package/dist/cart.d.ts ADDED
@@ -0,0 +1,42 @@
1
+ import type { DiscountablePrice, Id, Image, LocalizedString, Maybe, Price } from './common.js';
2
+ import type { Address } from './customer.js';
3
+ import type { ShippingMethod } from './shipping.js';
4
+ import type { PaymentMethod } from './payment.js';
5
+ /** A single item in the cart */
6
+ export interface CartItem {
7
+ id: Id;
8
+ productId: Id;
9
+ variantId: Maybe<Id>;
10
+ name: LocalizedString;
11
+ image: Maybe<Image>;
12
+ quantity: number;
13
+ /** Unit price */
14
+ price: DiscountablePrice;
15
+ /** Quantity × unit price */
16
+ totalPrice: Price;
17
+ }
18
+ /** Aggregated cart totals */
19
+ export interface CartTotals {
20
+ subtotal: Price;
21
+ shipping: Maybe<Price>;
22
+ tax: Maybe<Price>;
23
+ discount: Maybe<Price>;
24
+ total: Price;
25
+ }
26
+ /** Shopping cart */
27
+ export interface Cart {
28
+ id: Id;
29
+ items: CartItem[];
30
+ totals: CartTotals;
31
+ shippingAddress: Maybe<Address>;
32
+ billingAddress: Maybe<Address>;
33
+ shippingMethod: Maybe<ShippingMethod>;
34
+ paymentMethod: Maybe<PaymentMethod>;
35
+ couponCode: Maybe<string>;
36
+ /** Associated customer (null for guest carts) */
37
+ customerId: Maybe<Id>;
38
+ itemCount: number;
39
+ createdAt: string;
40
+ updatedAt: string;
41
+ }
42
+ //# sourceMappingURL=cart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cart.d.ts","sourceRoot":"","sources":["../src/cart.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,EAAE,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAC9F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAEjD,gCAAgC;AAChC,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,EAAE,CAAA;IACN,SAAS,EAAE,EAAE,CAAA;IACb,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,CAAA;IACpB,IAAI,EAAE,eAAe,CAAA;IACrB,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,iBAAiB;IACjB,KAAK,EAAE,iBAAiB,CAAA;IACxB,4BAA4B;IAC5B,UAAU,EAAE,KAAK,CAAA;CAClB;AAED,6BAA6B;AAC7B,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,KAAK,CAAA;IACf,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,CAAA;IACtB,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,CAAA;IACjB,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,CAAA;IACtB,KAAK,EAAE,KAAK,CAAA;CACb;AAED,oBAAoB;AACpB,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,EAAE,CAAA;IACN,KAAK,EAAE,QAAQ,EAAE,CAAA;IACjB,MAAM,EAAE,UAAU,CAAA;IAClB,eAAe,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;IAC/B,cAAc,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;IAC9B,cAAc,EAAE,KAAK,CAAC,cAAc,CAAC,CAAA;IACrC,aAAa,EAAE,KAAK,CAAC,aAAa,CAAC,CAAA;IACnC,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IACzB,iDAAiD;IACjD,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,CAAA;IACrB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;CAClB"}
package/dist/cart.js ADDED
@@ -0,0 +1,5 @@
1
+ // ---------------------------------------------------------------------------
2
+ // Cart domain types
3
+ // ---------------------------------------------------------------------------
4
+ export {};
5
+ //# sourceMappingURL=cart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cart.js","sourceRoot":"","sources":["../src/cart.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,oBAAoB;AACpB,8EAA8E"}
@@ -0,0 +1,13 @@
1
+ import type { Id, Image, LocalizedString, Maybe } from './common.js';
2
+ /** Product category */
3
+ export interface Category {
4
+ id: Id;
5
+ name: LocalizedString;
6
+ slug: string;
7
+ description: Maybe<LocalizedString>;
8
+ image: Maybe<Image>;
9
+ parentId: Maybe<Id>;
10
+ children: Category[];
11
+ productCount: Maybe<number>;
12
+ }
13
+ //# sourceMappingURL=category.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"category.d.ts","sourceRoot":"","sources":["../src/category.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAEpE,uBAAuB;AACvB,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,EAAE,CAAA;IACN,IAAI,EAAE,eAAe,CAAA;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,KAAK,CAAC,eAAe,CAAC,CAAA;IACnC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAA;IACnB,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,CAAA;IACnB,QAAQ,EAAE,QAAQ,EAAE,CAAA;IACpB,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;CAC5B"}
@@ -0,0 +1,5 @@
1
+ // ---------------------------------------------------------------------------
2
+ // Category domain types
3
+ // ---------------------------------------------------------------------------
4
+ export {};
5
+ //# sourceMappingURL=category.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"category.js","sourceRoot":"","sources":["../src/category.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,wBAAwB;AACxB,8EAA8E"}
@@ -0,0 +1,81 @@
1
+ /** Nullable helper — a value that may be null */
2
+ export type Maybe<T> = T | null;
3
+ /** String identifier type for all entities */
4
+ export type Id = string;
5
+ /**
6
+ * Bilingual / multilingual string.
7
+ * Arabic and English are required, additional languages are optional.
8
+ */
9
+ export interface LocalizedString {
10
+ /** Arabic value (required for GCC markets) */
11
+ ar: string;
12
+ /** English value */
13
+ en: string;
14
+ /** Additional languages keyed by ISO 639-1 code */
15
+ [locale: string]: string;
16
+ }
17
+ /** Standard paginated result wrapper */
18
+ export interface PaginatedResult<T> {
19
+ items: T[];
20
+ total: number;
21
+ page: number;
22
+ perPage: number;
23
+ hasMore: boolean;
24
+ }
25
+ /** Pagination input params */
26
+ export interface PaginationParams {
27
+ page?: number;
28
+ perPage?: number;
29
+ }
30
+ /** Monetary amount */
31
+ export interface Price {
32
+ /** Amount in the smallest currency unit (e.g., halalat for SAR) */
33
+ amount: number;
34
+ /** ISO 4217 currency code (e.g., "SAR", "AED", "USD") */
35
+ currency: string;
36
+ /** Human-readable formatted string (e.g., "١٢٫٩٩ ر.س" or "SAR 12.99") */
37
+ formatted: string;
38
+ }
39
+ /** Price that may have a discount applied */
40
+ export interface DiscountablePrice extends Price {
41
+ /** Original amount before discount */
42
+ originalAmount?: number;
43
+ /** Discount percentage (0–100) */
44
+ discountPercent?: number;
45
+ }
46
+ /** Image reference */
47
+ export interface Image {
48
+ url: string;
49
+ alt: string;
50
+ width?: number;
51
+ height?: number;
52
+ }
53
+ /** Recursive partial — allows deep nested partial updates */
54
+ export type DeepPartial<T> = {
55
+ [P in keyof T]?: T[P] extends object ? T[P] extends Array<infer U> ? Array<DeepPartial<U>> : DeepPartial<T[P]> : T[P];
56
+ };
57
+ /** Standardized error codes for all adapter operations */
58
+ export type CommerceErrorCode = 'NOT_FOUND' | 'NOT_SUPPORTED' | 'UNAUTHORIZED' | 'FORBIDDEN' | 'VALIDATION' | 'RATE_LIMIT' | 'PLATFORM_ERROR' | 'NETWORK' | 'TIMEOUT' | 'UNKNOWN';
59
+ /**
60
+ * Typed error class for all commerce operations.
61
+ * Adapters must throw CommerceError (not raw errors)
62
+ * so consumers can handle failures in a typed, platform-agnostic way.
63
+ */
64
+ export declare class CommerceError extends Error {
65
+ readonly code: CommerceErrorCode;
66
+ readonly statusCode?: number | undefined;
67
+ readonly cause?: unknown | undefined;
68
+ readonly name = "CommerceError";
69
+ constructor(message: string, code: CommerceErrorCode, statusCode?: number | undefined, cause?: unknown | undefined);
70
+ }
71
+ /** Type guard — narrows unknown errors to CommerceError */
72
+ export declare function isCommerceError(err: unknown): err is CommerceError;
73
+ /**
74
+ * Tax calculation strategy — allows per-market tax rules.
75
+ * e.g., 15% VAT for KSA, 5% for UAE, 0% for Bahrain.
76
+ */
77
+ export interface TaxStrategy {
78
+ /** Calculate tax for a given subtotal and country code */
79
+ calculate(subtotal: number, currency: string, countryCode: string): Price;
80
+ }
81
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAIA,iDAAiD;AACjD,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;AAE/B,8CAA8C;AAC9C,MAAM,MAAM,EAAE,GAAG,MAAM,CAAA;AAEvB;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,8CAA8C;IAC9C,EAAE,EAAE,MAAM,CAAA;IACV,oBAAoB;IACpB,EAAE,EAAE,MAAM,CAAA;IACV,mDAAmD;IACnD,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;CACzB;AAED,wCAAwC;AACxC,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,KAAK,EAAE,CAAC,EAAE,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,8BAA8B;AAC9B,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,sBAAsB;AACtB,MAAM,WAAW,KAAK;IACpB,mEAAmE;IACnE,MAAM,EAAE,MAAM,CAAA;IACd,yDAAyD;IACzD,QAAQ,EAAE,MAAM,CAAA;IAChB,yE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