@thorprovider/adapters 4.1.0 → 4.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.
@@ -141,3 +141,33 @@ Capabilities are calculated once during provider initialization. Accessing `comm
141
141
 
142
142
  - [Providers Overview](providers-overview.md)
143
143
  - [Services Overview](services-overview.md)
144
+
145
+ ## Per-Provider Capability Matrix
146
+
147
+ ### Stel Order (ERP Adapter)
148
+
149
+ | Capability | Value | Notes |
150
+ |------------|-------|-------|
151
+ | `fetchOrders` | ✅ true | Read sales orders via `/salesOrders` |
152
+ | `listPaymentProviders` | ✅ true | List STEL payment options via `/paymentOptions` |
153
+ | `manageAddresses` | ✅ true | Via client main-address (PUT /clients) |
154
+ | `updateProfile` | ❌ false | No customer self-service (ERP admin only) |
155
+ | `updateEmail` | ❌ false | — |
156
+ | `changePasswordDirect` | ❌ false | No auth system |
157
+ | `changePasswordViaEmail` | ❌ false | No auth system |
158
+ | `deleteAccount` | ❌ false | — |
159
+ | `uploadAvatar` | ❌ false | — |
160
+ | `avatarViaMetadata` | ❌ false | — |
161
+ | `customAttributes` | ❌ false | — |
162
+ | `cancelOrder` | ❌ false | ERP orders are read-only from adapter |
163
+ | `defaultAddress` | ❌ false | — |
164
+ | `applyDiscounts` | ❌ false | No cart/checkout |
165
+ | `shippingCalculation` | ❌ false | No cart/checkout |
166
+ | `guestCheckout` | ❌ false | No cart/checkout |
167
+ | `savedPaymentMethods` | ❌ false | — |
168
+ | `regionSpecificPayments` | ❌ false | Single-company ERP |
169
+ | `wishlist` | ❌ false | — |
170
+ | `advancedSearch` | ❌ false | Client-side text filter only |
171
+ | `facetedFilters` | ❌ false | — |
172
+ | `productReviews` | ❌ false | — |
173
+ | `loyaltyProgram` | ❌ false | — |
@@ -1,23 +1,25 @@
1
- # Getting Started
2
-
3
1
  ---
2
+ title: "Getting started"
3
+ purpose: "Provide a quick setup guide for integrating Thor adapters in mock or live backend mode"
4
+ lastReviewed: "2026-05-01"
4
5
  type: how-to
5
6
  tags: [setup, installation, adapters, medusa, configuration]
6
7
  related:
7
8
  - services-overview.md
8
9
  - providers-overview.md
9
10
  - authentication.md
10
- updated: 2026-02-28
11
11
  ---
12
12
 
13
- Quick setup guide for integrating Thor adapters into our project.
13
+ # Getting Started
14
+
15
+ Quick setup guide for integrating Thor adapters into our project. Start with `mock` for backend-optional development, or configure a real backend immediately.
14
16
 
15
17
  ## Prerequisites
16
18
 
17
19
  - Node.js 18+
18
20
  - Yarn 4+ (PnP mode)
19
- - Access to a Medusa.js v2 backend
20
- - Medusa Publishable API Key
21
+ - Optional: access to a Medusa.js v2 backend
22
+ - Optional: Medusa Publishable API Key
21
23
 
22
24
  ## Quick Example
23
25
 
@@ -25,6 +27,14 @@ Quick setup guide for integrating Thor adapters into our project.
25
27
  import { createProvider } from '@thorprovider/adapters';
26
28
 
27
29
  const commerce = createProvider({
30
+ provider: 'mock',
31
+ config: {
32
+ currencyCode: 'USD',
33
+ },
34
+ });
35
+
36
+ // Or use a real backend
37
+ const liveCommerce = createProvider({
28
38
  provider: 'medusa',
29
39
  config: {
30
40
  baseUrl: process.env.NEXT_PUBLIC_COMMERCE_API_URL!,
@@ -53,6 +63,14 @@ Create a shared instance for our application.
53
63
  import { createProvider } from '@thorprovider/adapters';
54
64
 
55
65
  export const commerce = createProvider({
66
+ provider: 'mock',
67
+ config: {
68
+ debug: process.env.NODE_ENV === 'development',
69
+ },
70
+ });
71
+
72
+ // Switch to a real backend when ready
73
+ export const liveCommerce = createProvider({
56
74
  provider: 'medusa',
57
75
  config: {
58
76
  baseUrl: process.env.NEXT_PUBLIC_COMMERCE_API_URL!,
@@ -64,14 +82,17 @@ export const commerce = createProvider({
64
82
 
65
83
  ### Step 3: Configure Environment Variables
66
84
 
67
- Create `.env.local` to store backend credentials.
85
+ Create `.env.local` to store runtime configuration.
68
86
 
69
87
  ```env
70
- # Backend Configuration
71
- NEXT_PUBLIC_COMMERCE_PROVIDER=medusa
88
+ # Mock-first configuration
89
+ NEXT_PUBLIC_COMMERCE_PROVIDER=mock
90
+ NEXT_PUBLIC_DEFAULT_CURRENCY=USD
91
+
92
+ # Live backend configuration (only required for real providers)
93
+ # NEXT_PUBLIC_COMMERCE_PROVIDER=medusa
72
94
  NEXT_PUBLIC_COMMERCE_API_URL=http://localhost:9000
73
95
  NEXT_PUBLIC_COMMERCE_API_KEY=your_publishable_key_here
74
- NEXT_PUBLIC_DEFAULT_CURRENCY=USD
75
96
  ```
76
97
 
77
98
  ### Step 4: Use in Server Components (Next.js)
@@ -96,7 +117,7 @@ export default async function ProductsPage() {
96
117
  ## ✅ DO's
97
118
 
98
119
  1. **Use Singleton Pattern:** Create one instance of the provider and export it.
99
- 2. **Handle Environment Variables:** Always use `!` or validation to ensure `baseUrl` exists.
120
+ 2. **Handle Environment Variables:** Require `baseUrl` only for real backends.
100
121
  3. **Prefer Server-Side:** Fetch data in Server Components whenever possible.
101
122
  4. **Use TypeScript Types:** Leverage the exported types from `@thorprovider/adapters` for better DX.
102
123
  5. **Configure Debug Mode:** Enable `debug: true` during development to trace API issues.
@@ -1,15 +1,17 @@
1
- # Providers Overview
2
-
3
1
  ---
2
+ title: "Providers overview"
3
+ purpose: "Describe the supported commerce providers and how Thor Adapters abstracts them behind a unified interface"
4
+ lastReviewed: "2026-05-01"
4
5
  type: guide
5
6
  tags: [architecture, providers, medusa, shopify, roadmap]
6
7
  related:
7
8
  - capabilities-system.md
8
9
  - services-overview.md
9
10
  - getting-started.md
10
- updated: 2026-02-28
11
11
  ---
12
12
 
13
+ # Providers Overview
14
+
13
15
  Overview of the e-commerce platforms supported by Thor Adapters and how they are abstracted into a unified interface.
14
16
 
15
17
  ## Overview
@@ -28,6 +30,10 @@ Thor Adapters eliminate these problems by wrapping the data layer in a consisten
28
30
 
29
31
  ## Current Support Matrix
30
32
 
33
+ ### Mock
34
+ **Status:** ✅ Production Ready
35
+ Fixture-backed provider for local development, previews, design-mode storefront work, and backend-optional scaffolds.
36
+
31
37
  ### Medusa (v2.0)
32
38
  **Status:** ✅ Production Ready
33
39
  Our primary integration, highly optimized for headless performance.
@@ -36,6 +42,18 @@ Our primary integration, highly optimized for headless performance.
36
42
  **Status:** 🚧 In Development (Phase 1)
37
43
  Focusing on Storefront API integration for product discovery and cart.
38
44
 
45
+ ### Stel Order
46
+ **Status:** ✅ ERP Adapter (v1)
47
+ Single-company ERP integration for catalog, categories, inventory visibility, customers (STEL clients), sales orders, and payment/delivery option listing.
48
+
49
+ **Scope & Limitations:**
50
+ - **Supported:** Products, categories (aliased as collections), warehouses/inventory, customers, orders, payment methods, delivery options, storefront context
51
+ - **Unsupported:** Cart, checkout, customer auth/profile self-service, discount codes, fulfillment orchestration, recommendations, advanced search
52
+ - **Rate limits:** 60 req/min + low daily limits — designed to minimize API round-trips
53
+ - **Single-company:** No multi-tenant/storefront channel assumptions; `requiresStorefront: false`
54
+ - **No variants:** STEL products are single-SKU; the adapter creates one synthetic variant per product
55
+ - **Client-side search:** STEL has no fulltext search; `getProducts({ query })` filters in-memory after fetch
56
+
39
57
  ### WooCommerce
40
58
  **Status:** 🗓️ Planned
41
59
  Targeting the REST API for hybrid headless setups.
@@ -56,9 +74,11 @@ graph TD
56
74
  B --> C[Medusa Provider]
57
75
  B --> D[Shopify Provider]
58
76
  B --> E[Mock Provider]
77
+ B --> F2[Stel Order Provider]
59
78
  C --> F[Unified Commerce Interface]
60
79
  D --> F
61
80
  E --> F
81
+ F2 --> F
62
82
  ```
63
83
 
64
84
  ## Design Decisions
@@ -63,6 +63,22 @@ Handles customer account management and secure sessions.
63
63
  - Profile and address management
64
64
  - Metadata extensions
65
65
 
66
+ ### 5. ERP Adapters (Stel Order)
67
+ Not all providers are full storefronts. ERP adapters like **Stel Order** expose a subset of services:
68
+
69
+ | Service | Stel Order Support |
70
+ |---------|-------------------|
71
+ | Products & Categories | ✅ Read-only catalog with inventory visibility |
72
+ | Collections | ✅ Aliased from categories |
73
+ | Cart & Checkout | ❌ Not supported (ERP has no cart concept) |
74
+ | Authentication | ❌ Not supported (API-key auth only, no customer login) |
75
+ | Customers (CRM) | ✅ Read + update via STEL clients endpoint |
76
+ | Orders | ✅ Read sales orders; no create/cancel from adapter |
77
+ | Payment Methods | ✅ List STEL payment options |
78
+ | Shipping/Delivery | ✅ List STEL delivery options |
79
+
80
+ Unsupported methods throw `ProviderAPIError` (501) with a clear message explaining the ERP limitation.
81
+
66
82
  ## Service Interactions
67
83
 
68
84
  ```mermaid
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thorprovider/adapters",
3
- "version": "4.1.0",
3
+ "version": "4.2.1",
4
4
  "description": "Framework-agnostic commerce adapters for Thor Commerce ecosystem - Multi-platform support with unified API",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org",
@@ -11,16 +11,18 @@
11
11
  "exports": {
12
12
  ".": {
13
13
  "types": "./dist/index.d.ts",
14
- "development": "./src/index.ts",
15
- "import": "./dist/index.js",
16
- "require": "./dist/index.js"
14
+ "development": "./dist/index.mjs",
15
+ "import": "./dist/index.mjs",
16
+ "require": "./dist/index.js",
17
+ "default": "./dist/index.mjs"
17
18
  }
18
19
  },
19
20
  "scripts": {
20
21
  "build": "tsup",
21
22
  "dev": "tsup --watch",
22
23
  "type-check": "tsc --noEmit",
23
- "test": "echo \"No tests yet\" && exit 0",
24
+ "test": "vitest run --config vitest.config.ts",
25
+ "test:live": "vitest run --config vitest.config.ts src/providers/stelorder/live-smoke.test.ts",
24
26
  "generate:agent-index": "node ../../scripts/generate-package-agents-index.cjs packages/adapters @thorprovider/adapters"
25
27
  },
26
28
  "dependencies": {
@@ -31,8 +33,10 @@
31
33
  "jose": "^6.2.2"
32
34
  },
33
35
  "devDependencies": {
36
+ "msw": "^2.12.3",
34
37
  "tsup": "^8.0.0",
35
- "typescript": "^5.0.0"
38
+ "typescript": "^5.0.0",
39
+ "vitest": "^3.2.4"
36
40
  },
37
41
  "repository": {
38
42
  "type": "git",
@@ -57,6 +57,7 @@ Framework-agnostic business logic SDK for e-commerce operations. Provides unifie
57
57
  ```
58
58
  createProvider() → Provider instance
59
59
  ├── MedusaProvider (complete implementation)
60
+ ├── StelOrderProvider (ERP: catalog, CRM, orders — no cart/checkout/auth)
60
61
  ├── ShopifyProvider (planned)
61
62
  └── Custom providers (extensible)
62
63
  ```
@@ -17,6 +17,8 @@ import { BigCommerceProvider, type BigCommerceProviderConfig } from '../provider
17
17
  import { WooCommerceProvider, type WooCommerceProviderConfig } from '../providers/woocommerce';
18
18
  import { SpreeProvider, type SpreeProviderConfig } from '../providers/spree';
19
19
  import { MagentoProvider, type MagentoProviderConfig } from '../providers/magento';
20
+ import { StelOrderProvider, type StelOrderProviderConfig } from '../providers/stelorder';
21
+ import { MockProvider, type MockProviderConfig } from '../providers/mock';
20
22
  import { ProviderNotFoundError, ConfigurationError } from '../core/errors';
21
23
  import type { ProviderTypeString } from '@thorprovider/types';
22
24
 
@@ -30,7 +32,9 @@ export type ProviderType = ProviderTypeString;
30
32
  * Provider configuration discriminated union
31
33
  */
32
34
  export type ProviderFactoryConfig =
35
+ | { provider: 'mock'; config: MockProviderConfig }
33
36
  | { provider: 'medusa'; config: MedusaProviderConfig }
37
+ | { provider: 'stelorder'; config: StelOrderProviderConfig }
34
38
  | { provider: 'shopify'; config: ShopifyProviderConfig }
35
39
  | { provider: 'bigcommerce'; config: BigCommerceProviderConfig }
36
40
  | { provider: 'woocommerce'; config: WooCommerceProviderConfig }
@@ -73,8 +77,12 @@ export function createProvider(options: ProviderFactoryConfig | RuntimeProviderC
73
77
  const config = options.config as any;
74
78
 
75
79
  switch (options.provider) {
80
+ case 'mock':
81
+ return new MockProvider(config);
76
82
  case 'medusa':
77
83
  return new MedusaProvider(config);
84
+ case 'stelorder':
85
+ return new StelOrderProvider(config);
78
86
  case 'shopify':
79
87
  return new ShopifyProvider(config);
80
88
  case 'bigcommerce':
package/src/index.ts CHANGED
@@ -38,7 +38,9 @@ export {
38
38
  // Capabilities
39
39
  // ============================================
40
40
  export {
41
+ MOCK_CAPABILITIES,
41
42
  MEDUSA_CAPABILITIES,
43
+ STELORDER_CAPABILITIES,
42
44
  SHOPIFY_CAPABILITIES,
43
45
  BIGCOMMERCE_CAPABILITIES,
44
46
  WOOCOMMERCE_CAPABILITIES,
@@ -192,6 +194,10 @@ export {
192
194
  export {
193
195
  MedusaProvider,
194
196
  type MedusaProviderConfig,
197
+ StelOrderProvider,
198
+ type StelOrderProviderConfig,
199
+ MockProvider,
200
+ type MockProviderConfig,
195
201
  ShopifyProvider,
196
202
  type ShopifyProviderConfig,
197
203
  BigCommerceProvider,
@@ -6,6 +6,9 @@
6
6
  export { MedusaProvider } from './medusa';
7
7
  export type { MedusaProviderConfig } from './medusa';
8
8
 
9
+ export { StelOrderProvider } from './stelorder';
10
+ export type { StelOrderProviderConfig } from './stelorder';
11
+
9
12
  export { ShopifyProvider } from './shopify';
10
13
  export type { ShopifyProviderConfig } from './shopify';
11
14
 
@@ -20,3 +23,6 @@ export type { SpreeProviderConfig } from './spree';
20
23
 
21
24
  export { MagentoProvider } from './magento';
22
25
  export type { MagentoProviderConfig } from './magento';
26
+
27
+ export { MockProvider } from './mock';
28
+ export type { MockProviderConfig } from './mock';