@thorprovider/adapters 4.2.0 → 4.2.2

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 (48) hide show
  1. package/.turbo/turbo-build.log +18 -18
  2. package/.turbo/turbo-test.log +1 -0
  3. package/.turbo/turbo-type-check.log +0 -0
  4. package/AGENTS.md +1 -1
  5. package/CHANGELOG.md +12 -0
  6. package/PROVIDER_IMPLEMENTATION_ANALYSIS.md +659 -0
  7. package/README.md +22 -3
  8. package/dist/.tsbuildinfo +1 -1
  9. package/dist/index.d.mts +140 -2
  10. package/dist/index.d.ts +140 -2
  11. package/dist/index.js +1075 -0
  12. package/dist/index.js.map +1 -1
  13. package/dist/index.mjs +1070 -0
  14. package/dist/index.mjs.map +1 -1
  15. package/docs/RETRY_SOLUTION_SUMMARY.md +26 -11
  16. package/docs/authentication.md +89 -62
  17. package/docs/capabilities-system.md +100 -38
  18. package/docs/category-customization.md +37 -29
  19. package/docs/fetch-reliability-solution.md +127 -278
  20. package/docs/getting-started.md +43 -29
  21. package/docs/profile-management.md +68 -38
  22. package/docs/providers-overview.md +14 -0
  23. package/docs/services-overview.md +20 -2
  24. package/docs/update-documentation.md +10 -8
  25. package/package.json +11 -6
  26. package/publish.log +93 -0
  27. package/quick-reference.md +1 -0
  28. package/src/factory/index.ts +4 -0
  29. package/src/index.ts +7 -0
  30. package/src/providers/index.ts +3 -0
  31. package/src/providers/medusa/admin.test.ts +404 -0
  32. package/src/providers/medusa/admin.ts +442 -0
  33. package/src/providers/medusa/auth.test.ts +95 -0
  34. package/src/providers/medusa/index.test.ts +392 -0
  35. package/src/providers/medusa/live-smoke.test.ts +412 -0
  36. package/src/providers/stelorder/client.test-helpers.ts +3 -0
  37. package/src/providers/stelorder/client.test.ts +58 -0
  38. package/src/providers/stelorder/client.ts +326 -0
  39. package/src/providers/stelorder/index.test.ts +48 -0
  40. package/src/providers/stelorder/index.ts +685 -0
  41. package/src/providers/stelorder/live-smoke.test.ts +54 -0
  42. package/src/providers/stelorder/transforms.test.ts +103 -0
  43. package/src/providers/stelorder/transforms.ts +631 -0
  44. package/src/resilience/README.md +70 -48
  45. package/src/types/capabilities.types.ts +51 -0
  46. package/vitest.config.ts +13 -0
  47. package/vitest.live.config.ts +18 -0
  48. package/vitest.setup.ts +6 -0
@@ -1,26 +1,32 @@
1
- # Profile Management
2
-
3
1
  ---
2
+ title: Profile Management
3
+ purpose: Guide for managing customer profiles using capability-aware patterns for cross-backend compatibility
4
4
  type: how-to
5
5
  tags: [profile, account, customer, metadata, avatar]
6
6
  related:
7
7
  - authentication.md
8
8
  - capabilities-system.md
9
9
  - services-overview.md
10
- updated: 2026-02-28
10
+ updated: 2026-05-03
11
11
  ---
12
12
 
13
+ # Profile Management
14
+
13
15
  Guide for managing customer profiles using capability-aware patterns for cross-backend compatibility.
14
16
 
15
17
  ## Prerequisites
16
18
 
17
19
  - [Authentication set up](authentication.md)
18
- - User logged in to access profile features
20
+ - User logged in (`commerce.auth` available and `isAuthenticated()` returns `true`)
19
21
 
20
22
  ## Quick Example
21
23
 
22
24
  ```typescript
23
- import { commerce } from '@/lib/commerce';
25
+ import { createProvider } from '@thorprovider/adapters';
26
+
27
+ const commerce = createProvider({ provider: 'medusa', config: { ... } });
28
+
29
+ if (!commerce.auth) throw new Error('Auth not available');
24
30
 
25
31
  // Simple profile update
26
32
  const updated = await commerce.auth.updateCustomer({
@@ -41,6 +47,10 @@ const { updateEmail, updateProfile, deleteAccount } = commerce.capabilities;
41
47
  if (updateEmail) {
42
48
  // Render email update field
43
49
  }
50
+
51
+ if (updateProfile) {
52
+ // Render name/phone fields
53
+ }
44
54
  ```
45
55
 
46
56
  ### Step 2: Retrieve Current Profile
@@ -48,6 +58,8 @@ if (updateEmail) {
48
58
  Fetch the customer object to populate your forms.
49
59
 
50
60
  ```typescript
61
+ if (!commerce.auth) return;
62
+
51
63
  const customer = await commerce.auth.getCurrentCustomer();
52
64
  ```
53
65
 
@@ -56,18 +68,24 @@ const customer = await commerce.auth.getCurrentCustomer();
56
68
  Handle updates carefully, checking for specific field support.
57
69
 
58
70
  ```typescript
59
- async function handleUpdate(formData) {
60
- const updateData = {};
61
-
71
+ async function handleUpdate(formData: {
72
+ firstName: string;
73
+ lastName: string;
74
+ email?: string;
75
+ }) {
76
+ if (!commerce.auth) throw new Error('Auth not available');
77
+
78
+ const updateData: Record<string, unknown> = {};
79
+
62
80
  if (commerce.capabilities.updateProfile) {
63
81
  updateData.first_name = formData.firstName;
64
82
  updateData.last_name = formData.lastName;
65
83
  }
66
-
67
- if (commerce.capabilities.updateEmail) {
84
+
85
+ if (commerce.capabilities.updateEmail && formData.email) {
68
86
  updateData.email = formData.email;
69
87
  }
70
-
88
+
71
89
  return await commerce.auth.updateCustomer(updateData);
72
90
  }
73
91
  ```
@@ -78,42 +96,54 @@ Handle password changes based on whether the backend supports direct or email-ba
78
96
 
79
97
  ```typescript
80
98
  if (commerce.capabilities.changePasswordDirect) {
99
+ // Direct password change (Shopify, Spree, Magento)
81
100
  await commerce.auth.updateCustomer({
82
- current_password: 'old',
83
- password: 'new',
101
+ password: 'NewPassword123!',
84
102
  });
103
+ } else if (commerce.capabilities.changePasswordViaEmail) {
104
+ // Email-based reset (Medusa v2)
105
+ await commerce.auth.requestPasswordReset(customer.email);
85
106
  }
86
107
  ```
87
108
 
88
- ## ✅ DO's
89
-
90
- 1. **Check Capabilities First:** Avoid rendering buttons for features the backend doesn't support.
91
- 2. **Use Metadata for Extensions:** Store extra info like `avatar_url` or `notifications` in `customer.metadata`.
92
- 3. **Handle Errors explicitly:** Distinguish between `EMAIL_TAKEN` and generic update errors.
93
- 4. **Validate on Client:** Use patterns/regex for phone and email before sending to the adapter.
94
- 5. **Protect UI with Loading States:** Backend operations can take time; show a spinner.
95
-
96
- ## ❌ DONT's
109
+ ### Step 5: Account Deletion
97
110
 
98
- 1. **Don't assume all backends are equal:** Medusa v2 has different capabilities than Shopify or WooCommerce.
99
- 2. **Don't hardcode profile fields:** Use the `Customer` interface from `@thorprovider/adapters`.
100
- 3. **Don't ignore account deletion:** Provide a way for users to delete their account if `deleteAccount` is true.
101
- 4. **Don't send sensitive data in metadata:** Metadata is often visible to the user and sometimes less secure.
102
- 5. **Don't forget to re-fetch profile:** After a successful update, the local customer state should be refreshed.
111
+ ```typescript
112
+ if (commerce.capabilities.deleteAccount && commerce.auth) {
113
+ await commerce.auth.deleteCustomerAccount();
114
+ }
115
+ ```
103
116
 
104
- ## Common Patterns
117
+ ## Avatar Management
105
118
 
106
- ### Metadata-based Avatar Management
107
- Since many backends don't support native avatars, use an external service (S3/Cloudinary) and store the URL in metadata.
119
+ Most backends don't support native avatar uploads. Use an external service (S3, Cloudinary) and store the URL in metadata.
108
120
 
109
121
  ```typescript
110
- await commerce.auth.updateCustomer({
111
- metadata: { avatar_url: 'https://...' }
112
- });
122
+ // Check capability first
123
+ if (commerce.capabilities.avatarViaMetadata && commerce.auth) {
124
+ await commerce.auth.updateCustomer({
125
+ metadata: { avatar_url: 'https://cdn.example.com/avatars/user-123.jpg' },
126
+ });
127
+ }
113
128
  ```
114
129
 
115
- ### Adaptive Profile Form
116
- Render only the fields supported by the current provider.
130
+ > ⚠️ **Backend Disparity:** `uploadAvatar` (native file upload) is `false` for all current providers. Use `avatarViaMetadata` instead.
131
+
132
+ ## ✅ DO's
133
+
134
+ 1. **Check `commerce.capabilities` first:** Avoid rendering buttons for features the backend doesn't support.
135
+ 2. **Use metadata for extensions:** Store extra info like `avatar_url` or notification preferences in `customer.metadata`.
136
+ 3. **Handle errors explicitly:** Distinguish between `EMAIL_TAKEN` and generic update errors.
137
+ 4. **Validate on client:** Use patterns/regex for phone and email before sending to the adapter.
138
+ 5. **Re-fetch after update:** After a successful update, refresh the local customer state.
139
+
140
+ ## ❌ DONT's
141
+
142
+ 1. **Don't assume all backends are equal:** Medusa v2 has different capabilities than Shopify or WooCommerce.
143
+ 2. **Don't hardcode profile fields:** Use the `UpdateCustomerData` type from `@thorprovider/adapters`.
144
+ 3. **Don't ignore account deletion:** Provide a way for users to delete their account if `deleteAccount` is `true`.
145
+ 4. **Don't send sensitive data in metadata:** Metadata is often visible to the user and may be less secure.
146
+ 5. **Don't call `commerce.auth.updateCustomer` without checking `commerce.auth`:** It may be undefined.
117
147
 
118
148
  ## Common Errors & Solutions
119
149
 
@@ -128,16 +158,16 @@ Render only the fields supported by the current provider.
128
158
  ## Common Pitfalls
129
159
 
130
160
  > ⚠️ **Pitfall 1: Metadata Overwrites**
131
- > Some backends overwrite the entire metadata object instead of merging. Always fetch the current ones first if you want to preserve existing fields.
161
+ > Some backends overwrite the entire metadata object instead of merging. Always fetch the current metadata first if you want to preserve existing fields.
132
162
 
133
163
  > ⚠️ **Pitfall 2: Password Complexity**
134
- > Backends have different password requirements. Let the backend validate and handle the error message.
164
+ > Backends have different password requirements. Let the backend validate and surface the error message.
135
165
 
136
166
  ## Troubleshooting
137
167
 
138
168
  | Issue | Solution |
139
169
  |-------|----------|
140
- | Profile data not saving | Check if the user session is still active |
170
+ | Profile data not saving | Check if the user session is still active (`isAuthenticated()`) |
141
171
  | Metadata field missing | Ensure the key exists in the backend's allowed metadata list |
142
172
  | 403 Forbidden | User might not have permission to update their own profile |
143
173
 
@@ -42,6 +42,18 @@ Our primary integration, highly optimized for headless performance.
42
42
  **Status:** 🚧 In Development (Phase 1)
43
43
  Focusing on Storefront API integration for product discovery and cart.
44
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
+
45
57
  ### WooCommerce
46
58
  **Status:** 🗓️ Planned
47
59
  Targeting the REST API for hybrid headless setups.
@@ -62,9 +74,11 @@ graph TD
62
74
  B --> C[Medusa Provider]
63
75
  B --> D[Shopify Provider]
64
76
  B --> E[Mock Provider]
77
+ B --> F2[Stel Order Provider]
65
78
  C --> F[Unified Commerce Interface]
66
79
  D --> F
67
80
  E --> F
81
+ F2 --> F
68
82
  ```
69
83
 
70
84
  ## Design Decisions
@@ -1,6 +1,6 @@
1
- # Services Overview
2
-
3
1
  ---
2
+ title: Services Overview
3
+ purpose: Overview of adapter services and provider capabilities
4
4
  type: guide
5
5
  tags: [architecture, services, commerce, api, architecture]
6
6
  related:
@@ -10,6 +10,8 @@ related:
10
10
  updated: 2026-02-28
11
11
  ---
12
12
 
13
+ # Services Overview
14
+
13
15
  Overview of the functional services provided by Thor adapters and how they interact to provide a unified e-commerce interface.
14
16
 
15
17
  ## Overview
@@ -63,6 +65,22 @@ Handles customer account management and secure sessions.
63
65
  - Profile and address management
64
66
  - Metadata extensions
65
67
 
68
+ ### 5. ERP Adapters (Stel Order)
69
+ Not all providers are full storefronts. ERP adapters like **Stel Order** expose a subset of services:
70
+
71
+ | Service | Stel Order Support |
72
+ |---------|-------------------|
73
+ | Products & Categories | ✅ Read-only catalog with inventory visibility |
74
+ | Collections | ✅ Aliased from categories |
75
+ | Cart & Checkout | ❌ Not supported (ERP has no cart concept) |
76
+ | Authentication | ❌ Not supported (API-key auth only, no customer login) |
77
+ | Customers (CRM) | ✅ Read + update via STEL clients endpoint |
78
+ | Orders | ✅ Read sales orders; no create/cancel from adapter |
79
+ | Payment Methods | ✅ List STEL payment options |
80
+ | Shipping/Delivery | ✅ List STEL delivery options |
81
+
82
+ Unsupported methods throw `ProviderAPIError` (501) with a clear message explaining the ERP limitation.
83
+
66
84
  ## Service Interactions
67
85
 
68
86
  ```mermaid
@@ -1,23 +1,25 @@
1
- # Update Documentation
2
-
3
1
  ---
2
+ title: Update Documentation
3
+ purpose: Guidelines for updating @thorprovider/adapters documentation correctly
4
4
  type: how-to
5
5
  tags: [documentation, maintenance, adapters, standards, copilot]
6
6
  related:
7
7
  - ../../../docs/templates/README.md
8
- - ../../../docs/update-documentation.md
9
- updated: 2026-02-28
8
+ - ../../../docs/standards/documentation.md
9
+ updated: 2026-05-23
10
10
  ---
11
11
 
12
+ # Update Documentation
13
+
12
14
  **Specific guidelines for updating @thorprovider/adapters documentation.**
13
15
 
14
- Global guidelines: [docs/update-documentation.md](../../../docs/update-documentation.md)
16
+ Global guidelines: [docs/standards/documentation.md](../../../docs/standards/documentation.md)
15
17
 
16
18
  ## Prerequisites
17
19
 
18
- - Read [global guidelines](../../../docs/update-documentation.md) for doc types and templates
20
+ - Read [global guidelines](../../../docs/standards/documentation.md) for doc types and templates
19
21
  - Understand the [Providers System](providers-overview.md) and [Capabilities System](capabilities-system.md)
20
- - Ensure understanding of the [Adapter Strategy](../../ARCHITECTURE.md) (Strategy Pattern)
22
+ - Ensure understanding of the [Architecture Overview](../../../docs/architecture/overview.md) (Strategy Pattern)
21
23
 
22
24
  ## Step-by-Step Process for Adapters
23
25
 
@@ -109,5 +111,5 @@ async function performTask() {
109
111
 
110
112
  ## Next Steps
111
113
 
112
- - [global update-documentation.md](../../../docs/update-documentation.md)
114
+ - [global documentation standards](../../../docs/standards/documentation.md)
113
115
  - [How-to: Getting Started](getting-started.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thorprovider/adapters",
3
- "version": "4.2.0",
3
+ "version": "4.2.2",
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,19 @@
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.live.config.ts src/providers/stelorder/live-smoke.test.ts",
26
+ "test:live:medusa": "vitest run --config vitest.live.config.ts src/providers/medusa/live-smoke.test.ts",
24
27
  "generate:agent-index": "node ../../scripts/generate-package-agents-index.cjs packages/adapters @thorprovider/adapters"
25
28
  },
26
29
  "dependencies": {
@@ -31,8 +34,10 @@
31
34
  "jose": "^6.2.2"
32
35
  },
33
36
  "devDependencies": {
37
+ "msw": "^2.12.3",
34
38
  "tsup": "^8.0.0",
35
- "typescript": "^5.0.0"
39
+ "typescript": "^5.0.0",
40
+ "vitest": "^3.2.4"
36
41
  },
37
42
  "repository": {
38
43
  "type": "git",
package/publish.log ADDED
@@ -0,0 +1,93 @@
1
+ npm warn Unknown project config "network-concurrency". This will stop working in the next major version of npm.
2
+ npm warn publish npm auto-corrected some errors in your package.json when publishing. Please run "npm pkg fix" to address these errors.
3
+ npm warn publish errors corrected:
4
+ npm warn publish "repository.url" was normalized to "git+https://github.com/thorprovider/thor-commerce.git"
5
+ npm notice
6
+ npm notice 📦 @thor/adapters@3.0.1
7
+ npm notice Tarball Contents
8
+ npm notice 629B AGENTS.md
9
+ npm notice 9.1kB CHANGELOG.md
10
+ npm notice 19.2kB README.md
11
+ npm notice 73.6kB dist/index.d.mts
12
+ npm notice 73.6kB dist/index.d.ts
13
+ npm notice 191.6kB dist/index.js
14
+ npm notice 377.7kB dist/index.js.map
15
+ npm notice 187.4kB dist/index.mjs
16
+ npm notice 377.4kB dist/index.mjs.map
17
+ npm notice 4.7kB docs/authentication.md
18
+ npm notice 4.3kB docs/capabilities-system.md
19
+ npm notice 9.9kB docs/category-customization.md
20
+ npm notice 11.0kB docs/fetch-reliability-solution.md
21
+ npm notice 4.4kB docs/getting-started.md
22
+ npm notice 7.8kB docs/multi-tenant-channel-scoping.md
23
+ npm notice 4.5kB docs/profile-management.md
24
+ npm notice 3.7kB docs/providers-overview.md
25
+ npm notice 2.1kB docs/RETRY_SOLUTION_SUMMARY.md
26
+ npm notice 5.2kB docs/services-overview.md
27
+ npm notice 4.0kB docs/update-documentation.md
28
+ npm notice 1.2kB package.json
29
+ npm notice 6.3kB quick-reference.md
30
+ npm notice 2.5kB src/admin/AdminAuthService.ts
31
+ npm notice 2.4kB src/admin/AdminSessionService.ts
32
+ npm notice 414B src/admin/index.ts
33
+ npm notice 4.2kB src/admin/MetricsService.ts
34
+ npm notice 2.5kB src/backend/BackendMetadataAdapter.ts
35
+ npm notice 3.5kB src/backend/factory.ts
36
+ npm notice 312B src/backend/index.ts
37
+ npm notice 3.9kB src/backend/medusa/MedusaMetadataAdapter.ts
38
+ npm notice 6.3kB src/core/errors.js
39
+ npm notice 3.5kB src/core/errors.ts
40
+ npm notice 11.3kB src/core/fetch-utils.js
41
+ npm notice 6.0kB src/core/fetch-utils.ts
42
+ npm notice 141B src/core/index.ts
43
+ npm notice 2.3kB src/core/logger.js
44
+ npm notice 1.1kB src/core/logger.ts
45
+ npm notice 2.0kB src/factory/index.ts
46
+ npm notice 4.5kB src/index.ts
47
+ npm notice 2.7kB src/lib/money-transform.ts
48
+ npm notice 6.2kB src/metadata/channel-scope-validation.js
49
+ npm notice 5.1kB src/metadata/channel-scope-validation.ts
50
+ npm notice 7.6kB src/metadata/channel-scope.js
51
+ npm notice 8.2kB src/metadata/channel-scope.ts
52
+ npm notice 3.3kB src/metadata/index.js
53
+ npm notice 810B src/metadata/index.ts
54
+ npm notice 148B src/providers/index.ts
55
+ npm notice 30.0kB src/providers/medusa/auth.js
56
+ npm notice 15.1kB src/providers/medusa/auth.ts
57
+ npm notice 6.2kB src/providers/medusa/fulfillment-planner.ts
58
+ npm notice 151.8kB src/providers/medusa/index.js
59
+ npm notice 147.6kB src/providers/medusa/index.ts
60
+ npm notice 184B src/providers/medusa/medusa.ts
61
+ npm notice 11.0kB src/providers/medusa/payment.js
62
+ npm notice 7.2kB src/providers/medusa/payment.ts
63
+ npm notice 25.8kB src/providers/medusa/transforms.js
64
+ npm notice 19.8kB src/providers/medusa/transforms.ts
65
+ npm notice 5.5kB src/resilience/circuit-breaker.ts
66
+ npm notice 238B src/resilience/index.ts
67
+ npm notice 7.6kB src/resilience/README.md
68
+ npm notice 4.8kB src/types/capabilities.types.js
69
+ npm notice 4.7kB src/types/capabilities.types.ts
70
+ npm notice 513B src/types/index.ts
71
+ npm notice 350B src/types/provider.js
72
+ npm notice 365B src/types/provider.ts
73
+ npm notice 6.5kB src/types/ui-responses.ts
74
+ npm notice 1.1kB src/utils/city-coordinates.ts
75
+ npm notice 1.3kB src/utils/geolocation.ts
76
+ npm notice 5.6kB src/utils/payment-utils.js
77
+ npm notice 6.5kB src/utils/payment-utils.ts
78
+ npm notice 357B tsconfig.json
79
+ npm notice 370B tsup.config.ts
80
+ npm notice Tarball Details
81
+ npm notice name: @thor/adapters
82
+ npm notice version: 3.0.1
83
+ npm notice filename: thor-adapters-3.0.1.tgz
84
+ npm notice package size: 413.9 kB
85
+ npm notice unpacked size: 1.9 MB
86
+ npm notice shasum: 696c58c4b5629ad1ec09336238ea157aad015e3d
87
+ npm notice integrity: sha512-tIweHlz73prg8[...]3KYkFTyNlUX4w==
88
+ npm notice total files: 72
89
+ npm notice
90
+ npm notice Publishing to https://npm.pkg.github.com with tag latest and restricted access
91
+ npm error code E401
92
+ npm error 401 Unauthorized - PUT https://npm.pkg.github.com/@thor%2fadapters - unauthenticated: User cannot be authenticated with the token provided.
93
+ npm error A complete log of this run can be found in: /home/nelson/.npm/_logs/2026-04-16T15_45_37_415Z-debug-0.log
@@ -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,7 @@ 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';
20
21
  import { MockProvider, type MockProviderConfig } from '../providers/mock';
21
22
  import { ProviderNotFoundError, ConfigurationError } from '../core/errors';
22
23
  import type { ProviderTypeString } from '@thorprovider/types';
@@ -33,6 +34,7 @@ export type ProviderType = ProviderTypeString;
33
34
  export type ProviderFactoryConfig =
34
35
  | { provider: 'mock'; config: MockProviderConfig }
35
36
  | { provider: 'medusa'; config: MedusaProviderConfig }
37
+ | { provider: 'stelorder'; config: StelOrderProviderConfig }
36
38
  | { provider: 'shopify'; config: ShopifyProviderConfig }
37
39
  | { provider: 'bigcommerce'; config: BigCommerceProviderConfig }
38
40
  | { provider: 'woocommerce'; config: WooCommerceProviderConfig }
@@ -79,6 +81,8 @@ export function createProvider(options: ProviderFactoryConfig | RuntimeProviderC
79
81
  return new MockProvider(config);
80
82
  case 'medusa':
81
83
  return new MedusaProvider(config);
84
+ case 'stelorder':
85
+ return new StelOrderProvider(config);
82
86
  case 'shopify':
83
87
  return new ShopifyProvider(config);
84
88
  case 'bigcommerce':
package/src/index.ts CHANGED
@@ -40,6 +40,7 @@ export {
40
40
  export {
41
41
  MOCK_CAPABILITIES,
42
42
  MEDUSA_CAPABILITIES,
43
+ STELORDER_CAPABILITIES,
43
44
  SHOPIFY_CAPABILITIES,
44
45
  BIGCOMMERCE_CAPABILITIES,
45
46
  WOOCOMMERCE_CAPABILITIES,
@@ -58,9 +59,13 @@ export {
58
59
  ConfigurationError,
59
60
  ResourceNotFoundError,
60
61
  ProviderAPIError,
62
+ extractErrorMessage,
61
63
  createLogger,
64
+ fetchWithRetry,
65
+ createFetchWithRetry,
62
66
  type Logger,
63
67
  type LogLevel,
68
+ type RetryConfig,
64
69
  } from './core';
65
70
 
66
71
  // ============================================
@@ -193,6 +198,8 @@ export {
193
198
  export {
194
199
  MedusaProvider,
195
200
  type MedusaProviderConfig,
201
+ StelOrderProvider,
202
+ type StelOrderProviderConfig,
196
203
  MockProvider,
197
204
  type MockProviderConfig,
198
205
  ShopifyProvider,
@@ -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