@thorprovider/adapters 4.2.1 → 5.0.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.
- package/PROVIDER_IMPLEMENTATION_ANALYSIS.md +659 -0
- package/dist/index.d.mts +225 -387
- package/dist/index.d.ts +225 -387
- package/dist/index.js +613 -3062
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +609 -3052
- package/dist/index.mjs.map +1 -1
- package/docs/RETRY_SOLUTION_SUMMARY.md +26 -11
- package/docs/authentication.md +115 -62
- package/docs/capabilities-system.md +4 -2
- package/docs/category-customization.md +37 -29
- package/docs/fetch-reliability-solution.md +127 -278
- package/docs/getting-started.md +43 -29
- package/docs/profile-management.md +68 -38
- package/docs/services-overview.md +4 -2
- package/package.json +1 -1
- package/quick-reference.md +33 -0
- package/src/backend/factory.ts +1 -11
- package/src/factory/index.ts +74 -52
- package/src/index.ts +5 -15
- package/src/providers/index.ts +1 -16
- package/src/providers/medusa/admin.test.ts +404 -0
- package/src/providers/medusa/admin.ts +442 -0
- package/src/providers/medusa/auth.test.ts +137 -0
- package/src/providers/medusa/auth.ts +96 -1
- package/src/providers/medusa/index.ts +21 -1
- package/src/resilience/README.md +70 -48
- package/src/types/capabilities.types.ts +0 -250
- package/src/core/errors.js +0 -161
- package/src/core/fetch-utils.js +0 -240
- package/src/core/logger.js +0 -63
- package/src/metadata/channel-scope-validation.js +0 -136
- package/src/metadata/channel-scope.js +0 -174
- package/src/metadata/index.js +0 -31
- package/src/providers/bigcommerce/bigcommerce.ts +0 -6
- package/src/providers/bigcommerce/index.ts +0 -315
- package/src/providers/bigcommerce/transforms.ts +0 -227
- package/src/providers/magento/index.ts +0 -387
- package/src/providers/magento/magento.ts +0 -5
- package/src/providers/magento/queries.ts +0 -267
- package/src/providers/magento/transforms.ts +0 -249
- package/src/providers/medusa/auth.js +0 -601
- package/src/providers/medusa/index.js +0 -2485
- package/src/providers/medusa/payment.js +0 -265
- package/src/providers/medusa/transforms.js +0 -505
- package/src/providers/shopify/auth.ts +0 -402
- package/src/providers/shopify/index.ts +0 -444
- package/src/providers/shopify/mutations.ts +0 -247
- package/src/providers/shopify/queries.ts +0 -324
- package/src/providers/shopify/shopify.ts +0 -7
- package/src/providers/shopify/transforms.ts +0 -275
- package/src/providers/spree/index.ts +0 -344
- package/src/providers/spree/spree.ts +0 -5
- package/src/providers/spree/transforms.ts +0 -254
- package/src/providers/woocommerce/index.ts +0 -310
- package/src/providers/woocommerce/transforms.ts +0 -254
- package/src/providers/woocommerce/woocommerce.ts +0 -5
- package/src/types/capabilities.types.js +0 -141
- package/src/types/provider.js +0 -9
- package/src/utils/payment-utils.js +0 -152
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _thorprovider_types from '@thorprovider/types';
|
|
2
|
-
import { BackendCapabilities, Money, PaymentMethod, FulfillmentOption, CartItem, StockLocation, InventoryLevel, StorefrontConfig, DashboardMetrics, ProviderTypeString, CommerceProvider, AuthProvider, ProviderConfig, AuthConfig, Product, GetProductsOptions, AdvancedSearchProductsOptions, SearchResultMeta, FilterConfig, Collection, GetCollectionsOptions, CollectionProductsOptions, ProductCategory, GetCategoriesOptions, Cart, CartLineInput, CartLineUpdate, GetOrdersOptions, Order, GetCustomersOptions, Customer, Address, Region, AdminProduct, PaymentMethodsOptions, StockValidation, StorefrontContext, DesignerConfig, DesignerHistoryEntry,
|
|
2
|
+
import { BackendCapabilities, Money, PaymentMethod, FulfillmentOption, CartItem, StockLocation, InventoryLevel, StorefrontConfig, DashboardMetrics, ProviderTypeString, GetChannelCustomersOptions, GetChannelCustomersResponse, GetChannelApiKeysResponse, GetChannelCategoriesOptions, GetChannelCategoriesResponse, GetCategorySalesChannelsResponse, AssignCategoriesToChannelsBody, AssignCategoriesToChannelsResponse, UnassignCategoriesFromChannelsBody, UnassignCategoriesFromChannelsResponse, GetCollectionSalesChannelsResponse, AssignCollectionsToChannelsBody, AssignCollectionsToChannelsResponse, UnassignCollectionsFromChannelsBody, UnassignCollectionsFromChannelsResponse, GetAdminStorefrontConfigResponse, UpdateStorefrontConfigBody, UpdateStorefrontConfigResponse, GetAdminSiteConfigResponse, UpdateSiteConfigBody, UpdateSiteConfigResponse, GetAdminSiteConfigHistoryOptions, GetAdminSiteConfigHistoryResponse, RestoreSiteConfigResponse, CommerceProvider, AuthProvider, ProviderConfig, AuthConfig, Product, GetProductsOptions, AdvancedSearchProductsOptions, SearchResultMeta, FilterConfig, Collection, GetCollectionsOptions, CollectionProductsOptions, ProductCategory, GetCategoriesOptions, Cart, CartLineInput, CartLineUpdate, GetOrdersOptions, Order, GetCustomersOptions, Customer, Address, Region, AdminProduct, PaymentMethodsOptions, StockValidation, StorefrontContext, DesignerConfig, DesignerHistoryEntry, Country, ShippingMethod } from '@thorprovider/types';
|
|
3
3
|
export * from '@thorprovider/types';
|
|
4
4
|
export { BackendCapabilities, CommerceProvider, DesignerConfig, DesignerHistoryEntry, DesignerNavItem, DesignerThemeConfig, DesignerThemePreset, ProviderConfig, StorefrontConfig, StorefrontConfigError, StorefrontContext, StorefrontPlatformType, StorefrontSeoDefaults } from '@thorprovider/types';
|
|
5
5
|
import Medusa from '@medusajs/js-sdk';
|
|
@@ -246,36 +246,6 @@ declare const MEDUSA_CAPABILITIES: Readonly<BackendCapabilities>;
|
|
|
246
246
|
* but without cart, checkout, customer auth, or storefront-native payment flows.
|
|
247
247
|
*/
|
|
248
248
|
declare const STELORDER_CAPABILITIES: Readonly<BackendCapabilities>;
|
|
249
|
-
/**
|
|
250
|
-
* Shopify backend capabilities
|
|
251
|
-
*
|
|
252
|
-
* @see https://shopify.dev/docs/api/storefront
|
|
253
|
-
*/
|
|
254
|
-
declare const SHOPIFY_CAPABILITIES: Readonly<BackendCapabilities>;
|
|
255
|
-
/**
|
|
256
|
-
* BigCommerce backend capabilities
|
|
257
|
-
*
|
|
258
|
-
* @see https://developer.bigcommerce.com/docs/rest-storefront
|
|
259
|
-
*/
|
|
260
|
-
declare const BIGCOMMERCE_CAPABILITIES: Readonly<BackendCapabilities>;
|
|
261
|
-
/**
|
|
262
|
-
* WooCommerce backend capabilities
|
|
263
|
-
*
|
|
264
|
-
* @see https://developer.woocommerce.com/docs/apis/store-api
|
|
265
|
-
*/
|
|
266
|
-
declare const WOOCOMMERCE_CAPABILITIES: Readonly<BackendCapabilities>;
|
|
267
|
-
/**
|
|
268
|
-
* Spree Commerce backend capabilities
|
|
269
|
-
*
|
|
270
|
-
* @see https://docs.spreecommerce.org/api-reference
|
|
271
|
-
*/
|
|
272
|
-
declare const SPREE_CAPABILITIES: Readonly<BackendCapabilities>;
|
|
273
|
-
/**
|
|
274
|
-
* Adobe Commerce / Magento backend capabilities
|
|
275
|
-
*
|
|
276
|
-
* @see https://developer.adobe.com/commerce/webapi/graphql/
|
|
277
|
-
*/
|
|
278
|
-
declare const MAGENTO_CAPABILITIES: Readonly<BackendCapabilities>;
|
|
279
249
|
/**
|
|
280
250
|
* Type guard to check if an object is a valid BackendCapabilities
|
|
281
251
|
*/
|
|
@@ -322,6 +292,11 @@ declare class ProviderAPIError extends CommerceError {
|
|
|
322
292
|
readonly provider: string;
|
|
323
293
|
constructor(message: string, provider: string, status?: number);
|
|
324
294
|
}
|
|
295
|
+
/**
|
|
296
|
+
* Extract error message from various error types
|
|
297
|
+
* Handles standard Error objects, API responses, and unknown error types
|
|
298
|
+
*/
|
|
299
|
+
declare function extractErrorMessage(error: unknown): string;
|
|
325
300
|
|
|
326
301
|
/**
|
|
327
302
|
* @thorprovider/adapters v2.0
|
|
@@ -377,6 +352,32 @@ interface RetryConfig {
|
|
|
377
352
|
*/
|
|
378
353
|
retryableStatusCodes?: number[];
|
|
379
354
|
}
|
|
355
|
+
/**
|
|
356
|
+
* Enhanced fetch with retry logic and timeout
|
|
357
|
+
*
|
|
358
|
+
* @example
|
|
359
|
+
* ```typescript
|
|
360
|
+
* import { fetchWithRetry } from '@thorprovider/adapters/core/fetch-utils';
|
|
361
|
+
*
|
|
362
|
+
* // Basic usage with defaults (3 retries, 10s timeout)
|
|
363
|
+
* const response = await fetchWithRetry('https://api.example.com/products');
|
|
364
|
+
*
|
|
365
|
+
* // Custom configuration
|
|
366
|
+
* const response = await fetchWithRetry(
|
|
367
|
+
* 'https://api.example.com/products',
|
|
368
|
+
* {
|
|
369
|
+
* method: 'POST',
|
|
370
|
+
* body: JSON.stringify({ name: 'Product' }),
|
|
371
|
+
* },
|
|
372
|
+
* {
|
|
373
|
+
* maxRetries: 5,
|
|
374
|
+
* timeoutMs: 15000, // 15 seconds
|
|
375
|
+
* initialDelayMs: 500,
|
|
376
|
+
* }
|
|
377
|
+
* );
|
|
378
|
+
* ```
|
|
379
|
+
*/
|
|
380
|
+
declare function fetchWithRetry(url: string, init?: RequestInit, retryConfig?: RetryConfig): Promise<Response>;
|
|
380
381
|
|
|
381
382
|
/**
|
|
382
383
|
* Circuit Breaker Pattern Implementation
|
|
@@ -1368,6 +1369,153 @@ declare function validateChannelScopeAssignment(entityId: string, channelId: str
|
|
|
1368
1369
|
*/
|
|
1369
1370
|
declare function assertEntityBelongsToChannel(entity: ChannelScopeable, expectedChannelId: string): void;
|
|
1370
1371
|
|
|
1372
|
+
/**
|
|
1373
|
+
* @fileoverview Medusa Multi-Tenant Admin Client
|
|
1374
|
+
* @module @thorprovider/adapters/providers/medusa/admin
|
|
1375
|
+
*
|
|
1376
|
+
* Wrapper methods for all `/admin/thor/` endpoints defined in the Thor Commerce
|
|
1377
|
+
* multi-tenant API contract. Requires an admin API key (`adminConfig.apiKey`)
|
|
1378
|
+
* to be provided when creating the Medusa provider.
|
|
1379
|
+
*
|
|
1380
|
+
* Every method performs a raw `fetch` against the Medusa backend using the
|
|
1381
|
+
* admin API key (`x-medusa-access-token`) — the Medusa JS-SDK's admin client
|
|
1382
|
+
* does not expose these custom Thor plugin routes, so we use direct HTTP calls.
|
|
1383
|
+
*
|
|
1384
|
+
* Endpoint reference: `multitenant-api-contract.md`
|
|
1385
|
+
*/
|
|
1386
|
+
|
|
1387
|
+
/**
|
|
1388
|
+
* Configuration required to instantiate the admin client.
|
|
1389
|
+
*/
|
|
1390
|
+
interface MedusaAdminClientConfig {
|
|
1391
|
+
/** Medusa backend base URL */
|
|
1392
|
+
baseUrl: string;
|
|
1393
|
+
/** Secret admin API key (x-medusa-access-token) */
|
|
1394
|
+
apiKey: string;
|
|
1395
|
+
/** Enable debug logging */
|
|
1396
|
+
debug?: boolean;
|
|
1397
|
+
}
|
|
1398
|
+
/**
|
|
1399
|
+
* HTTP client for Thor Commerce multi-tenant admin endpoints (`/admin/thor/`).
|
|
1400
|
+
*
|
|
1401
|
+
* All methods throw `ProviderAPIError` on non-2xx responses.
|
|
1402
|
+
*
|
|
1403
|
+
* @example
|
|
1404
|
+
* ```typescript
|
|
1405
|
+
* const admin = new MedusaAdminClient({
|
|
1406
|
+
* baseUrl: process.env.MEDUSA_BACKEND_URL!,
|
|
1407
|
+
* apiKey: process.env.MEDUSA_ADMIN_API_KEY!,
|
|
1408
|
+
* });
|
|
1409
|
+
*
|
|
1410
|
+
* const { customers } = await admin.getChannelCustomers('sc_01JXXXXX');
|
|
1411
|
+
* ```
|
|
1412
|
+
*/
|
|
1413
|
+
declare class MedusaAdminClient {
|
|
1414
|
+
private baseUrl;
|
|
1415
|
+
private apiKey;
|
|
1416
|
+
private logger;
|
|
1417
|
+
constructor(config: MedusaAdminClientConfig);
|
|
1418
|
+
private request;
|
|
1419
|
+
/**
|
|
1420
|
+
* Paginated list of customers linked to a sales channel.
|
|
1421
|
+
*
|
|
1422
|
+
* `GET /admin/thor/sales-channels/:id/customers`
|
|
1423
|
+
*/
|
|
1424
|
+
getChannelCustomers(salesChannelId: string, options?: GetChannelCustomersOptions): Promise<GetChannelCustomersResponse>;
|
|
1425
|
+
/**
|
|
1426
|
+
* Publishable API keys associated with a sales channel.
|
|
1427
|
+
*
|
|
1428
|
+
* `GET /admin/thor/sales-channels/:id/api-keys`
|
|
1429
|
+
*/
|
|
1430
|
+
getChannelApiKeys(salesChannelId: string): Promise<GetChannelApiKeysResponse>;
|
|
1431
|
+
/**
|
|
1432
|
+
* Product categories assigned to a sales channel.
|
|
1433
|
+
*
|
|
1434
|
+
* `GET /admin/thor/sales-channels/:id/categories`
|
|
1435
|
+
*/
|
|
1436
|
+
getChannelCategories(salesChannelId: string, options?: GetChannelCategoriesOptions): Promise<GetChannelCategoriesResponse>;
|
|
1437
|
+
/**
|
|
1438
|
+
* Sales channels to which a category is assigned.
|
|
1439
|
+
*
|
|
1440
|
+
* `GET /admin/thor/categories/:id/sales-channels`
|
|
1441
|
+
*/
|
|
1442
|
+
getCategorySalesChannels(categoryId: string): Promise<GetCategorySalesChannelsResponse>;
|
|
1443
|
+
/**
|
|
1444
|
+
* Assign a category to one or more sales channels (idempotent).
|
|
1445
|
+
*
|
|
1446
|
+
* `POST /admin/thor/categories/:id/sales-channels`
|
|
1447
|
+
*/
|
|
1448
|
+
assignCategoryToChannels(categoryId: string, body: AssignCategoriesToChannelsBody): Promise<AssignCategoriesToChannelsResponse>;
|
|
1449
|
+
/**
|
|
1450
|
+
* Remove category assignment from one or more sales channels (idempotent).
|
|
1451
|
+
*
|
|
1452
|
+
* `DELETE /admin/thor/categories/:id/sales-channels`
|
|
1453
|
+
*/
|
|
1454
|
+
unassignCategoryFromChannels(categoryId: string, body: UnassignCategoriesFromChannelsBody): Promise<UnassignCategoriesFromChannelsResponse>;
|
|
1455
|
+
/**
|
|
1456
|
+
* Sales channels to which a collection is assigned.
|
|
1457
|
+
*
|
|
1458
|
+
* `GET /admin/thor/collections/:id/sales-channels`
|
|
1459
|
+
*/
|
|
1460
|
+
getCollectionSalesChannels(collectionId: string): Promise<GetCollectionSalesChannelsResponse>;
|
|
1461
|
+
/**
|
|
1462
|
+
* Assign a collection to one or more sales channels (idempotent).
|
|
1463
|
+
*
|
|
1464
|
+
* `POST /admin/thor/collections/:id/sales-channels`
|
|
1465
|
+
*/
|
|
1466
|
+
assignCollectionToChannels(collectionId: string, body: AssignCollectionsToChannelsBody): Promise<AssignCollectionsToChannelsResponse>;
|
|
1467
|
+
/**
|
|
1468
|
+
* Remove collection assignment from one or more sales channels (idempotent).
|
|
1469
|
+
*
|
|
1470
|
+
* `DELETE /admin/thor/collections/:id/sales-channels`
|
|
1471
|
+
*/
|
|
1472
|
+
unassignCollectionFromChannels(collectionId: string, body: UnassignCollectionsFromChannelsBody): Promise<UnassignCollectionsFromChannelsResponse>;
|
|
1473
|
+
/**
|
|
1474
|
+
* Read the visual storefront configuration for a channel.
|
|
1475
|
+
* `:id` is the `sales_channel_id`.
|
|
1476
|
+
*
|
|
1477
|
+
* `GET /admin/thor/storefront-config/:id`
|
|
1478
|
+
*/
|
|
1479
|
+
getStorefrontConfig(salesChannelId: string): Promise<GetAdminStorefrontConfigResponse>;
|
|
1480
|
+
/**
|
|
1481
|
+
* Update the visual storefront configuration for a channel.
|
|
1482
|
+
* Triggers the `storefront_config.updated` event → ISR webhook.
|
|
1483
|
+
*
|
|
1484
|
+
* `PUT /admin/thor/storefront-config/:id`
|
|
1485
|
+
*/
|
|
1486
|
+
updateStorefrontConfig(salesChannelId: string, body: UpdateStorefrontConfigBody): Promise<UpdateStorefrontConfigResponse>;
|
|
1487
|
+
/**
|
|
1488
|
+
* Read the active Site Designer configuration for a channel, including the
|
|
1489
|
+
* last 10 history entries.
|
|
1490
|
+
*
|
|
1491
|
+
* `GET /admin/thor/site-config/:sales_channel_id`
|
|
1492
|
+
*/
|
|
1493
|
+
getSiteConfig(salesChannelId: string): Promise<GetAdminSiteConfigResponse>;
|
|
1494
|
+
/**
|
|
1495
|
+
* Update the Site Designer configuration for a channel.
|
|
1496
|
+
* Creates a new history entry on every PUT.
|
|
1497
|
+
*
|
|
1498
|
+
* `PUT /admin/thor/site-config/:sales_channel_id`
|
|
1499
|
+
*/
|
|
1500
|
+
updateSiteConfig(salesChannelId: string, body: UpdateSiteConfigBody): Promise<UpdateSiteConfigResponse>;
|
|
1501
|
+
/**
|
|
1502
|
+
* Full paginated history of Site Designer versions for a channel.
|
|
1503
|
+
* Entries are immutable — they are never deleted.
|
|
1504
|
+
*
|
|
1505
|
+
* `GET /admin/thor/site-config/:sales_channel_id/history`
|
|
1506
|
+
*/
|
|
1507
|
+
getSiteConfigHistory(salesChannelId: string, options?: GetAdminSiteConfigHistoryOptions): Promise<GetAdminSiteConfigHistoryResponse>;
|
|
1508
|
+
/**
|
|
1509
|
+
* Restore a previous Site Designer version.
|
|
1510
|
+
* Internally runs the update workflow with the stored config of the target
|
|
1511
|
+
* version — this creates a **new** history entry and does NOT mutate past
|
|
1512
|
+
* entries.
|
|
1513
|
+
*
|
|
1514
|
+
* `POST /admin/thor/site-config/:sales_channel_id/restore/:version`
|
|
1515
|
+
*/
|
|
1516
|
+
restoreSiteConfig(salesChannelId: string, version: string): Promise<RestoreSiteConfigResponse>;
|
|
1517
|
+
}
|
|
1518
|
+
|
|
1371
1519
|
/**
|
|
1372
1520
|
* Medusa provider configuration
|
|
1373
1521
|
*/
|
|
@@ -1459,6 +1607,18 @@ declare class MedusaProvider implements CommerceProvider {
|
|
|
1459
1607
|
* Only created when adminConfig.apiKey is provided.
|
|
1460
1608
|
*/
|
|
1461
1609
|
private sdkAdmin?;
|
|
1610
|
+
/**
|
|
1611
|
+
* Admin client for Thor multi-tenant endpoints (`/admin/thor/`).
|
|
1612
|
+
* Available when `adminConfig.apiKey` is provided.
|
|
1613
|
+
*
|
|
1614
|
+
* @example
|
|
1615
|
+
* ```typescript
|
|
1616
|
+
* const { customers } = await commerce.admin.getChannelCustomers('sc_01JXXXXX');
|
|
1617
|
+
* const { api_keys } = await commerce.admin.getChannelApiKeys('sc_01JXXXXX');
|
|
1618
|
+
* await commerce.admin.updateStorefrontConfig('sc_01JXXXXX', { theme_accent_color: '#EF4444', ... });
|
|
1619
|
+
* ```
|
|
1620
|
+
*/
|
|
1621
|
+
readonly admin?: MedusaAdminClient;
|
|
1462
1622
|
/** Cached distinct product status values — rarely changes, cached for process lifetime */
|
|
1463
1623
|
private _cachedProductStatuses;
|
|
1464
1624
|
/**
|
|
@@ -2144,330 +2304,6 @@ declare class MedusaProvider implements CommerceProvider {
|
|
|
2144
2304
|
}>;
|
|
2145
2305
|
}
|
|
2146
2306
|
|
|
2147
|
-
/**
|
|
2148
|
-
* Shopify provider configuration
|
|
2149
|
-
*/
|
|
2150
|
-
interface ShopifyProviderConfig extends ProviderConfig {
|
|
2151
|
-
/** Store domain (e.g., 'your-store.myshopify.com') */
|
|
2152
|
-
storeDomain: string;
|
|
2153
|
-
/** Public Storefront API access token */
|
|
2154
|
-
publicAccessToken: string;
|
|
2155
|
-
/** Private Storefront API access token (server-side only) */
|
|
2156
|
-
privateAccessToken?: string;
|
|
2157
|
-
/** API version (default: '2026-04') */
|
|
2158
|
-
apiVersion?: string;
|
|
2159
|
-
}
|
|
2160
|
-
/**
|
|
2161
|
-
* Shopify commerce provider
|
|
2162
|
-
*
|
|
2163
|
-
* Implements CommerceProvider for Shopify Storefront API.
|
|
2164
|
-
* Uses raw fetch + GraphQL queries (no SDK dependency to stay L2-pure).
|
|
2165
|
-
*/
|
|
2166
|
-
declare class ShopifyProvider implements CommerceProvider {
|
|
2167
|
-
readonly name = "shopify";
|
|
2168
|
-
readonly version = "1.0.0";
|
|
2169
|
-
readonly capabilities: BackendCapabilities;
|
|
2170
|
-
private logger;
|
|
2171
|
-
private storeDomain;
|
|
2172
|
-
private apiVersion;
|
|
2173
|
-
private endpoint;
|
|
2174
|
-
private headers;
|
|
2175
|
-
constructor(config: ShopifyProviderConfig);
|
|
2176
|
-
private query;
|
|
2177
|
-
getProduct(handle: string): Promise<Product | undefined>;
|
|
2178
|
-
getProducts(options?: GetProductsOptions): Promise<Product[]>;
|
|
2179
|
-
getProductRecommendations(productId: string): Promise<Product[]>;
|
|
2180
|
-
getCollection(handle: string): Promise<Collection | undefined>;
|
|
2181
|
-
getCollections(options?: GetCollectionsOptions): Promise<Collection[]>;
|
|
2182
|
-
getCollectionProducts(handle: string, options?: CollectionProductsOptions): Promise<Product[]>;
|
|
2183
|
-
getCategory(): Promise<ProductCategory | undefined>;
|
|
2184
|
-
getCategories(): Promise<ProductCategory[]>;
|
|
2185
|
-
getCategoryProducts(): Promise<Product[]>;
|
|
2186
|
-
createCart(): Promise<Cart>;
|
|
2187
|
-
getCart(cartId: string): Promise<Cart | undefined>;
|
|
2188
|
-
addToCart(cartId: string, lines: CartLineInput[]): Promise<Cart>;
|
|
2189
|
-
removeFromCart(cartId: string, lineIds: string[]): Promise<Cart>;
|
|
2190
|
-
updateCart(cartId: string, lines: CartLineUpdate[]): Promise<Cart>;
|
|
2191
|
-
completeCheckout(_cartId: string): Promise<Order>;
|
|
2192
|
-
getShippingMethods(_cartId: string): Promise<ShippingMethod[]>;
|
|
2193
|
-
getRegionCountries(): Promise<_thorprovider_types.Country[]>;
|
|
2194
|
-
addShippingMethod(_cartId: string, _methodId: string): Promise<Cart>;
|
|
2195
|
-
initiatePaymentSession(_cartId: string, _providerId: string): Promise<void>;
|
|
2196
|
-
applyDiscountCode(cartId: string, code: string): Promise<Cart>;
|
|
2197
|
-
removeDiscountCode(cartId: string, _code: string): Promise<Cart>;
|
|
2198
|
-
getOrders(options: GetOrdersOptions): Promise<Order[]>;
|
|
2199
|
-
getPaymentMethods(_options: PaymentMethodsOptions): Promise<PaymentMethod[]>;
|
|
2200
|
-
getStockLocations(): Promise<StockLocation[]>;
|
|
2201
|
-
checkInventoryLevels(): Promise<InventoryLevel[]>;
|
|
2202
|
-
validateCartStock(): Promise<StockValidation>;
|
|
2203
|
-
getFulfillmentOptions(): Promise<FulfillmentOption[]>;
|
|
2204
|
-
cancelOrder(_orderId: string): Promise<Order>;
|
|
2205
|
-
createFulfillment(_orderId: string): Promise<void>;
|
|
2206
|
-
createRefund(_orderId: string): Promise<void>;
|
|
2207
|
-
getAdminOrders(): Promise<{
|
|
2208
|
-
orders: Order[];
|
|
2209
|
-
count: number;
|
|
2210
|
-
}>;
|
|
2211
|
-
getStorefrontContext(): Promise<StorefrontContext>;
|
|
2212
|
-
isStorefrontRequired(): boolean;
|
|
2213
|
-
}
|
|
2214
|
-
|
|
2215
|
-
/**
|
|
2216
|
-
* BigCommerce provider configuration
|
|
2217
|
-
*/
|
|
2218
|
-
interface BigCommerceProviderConfig extends ProviderConfig {
|
|
2219
|
-
/** BigCommerce store hash */
|
|
2220
|
-
storeHash: string;
|
|
2221
|
-
/** Storefront API token (JWT) */
|
|
2222
|
-
storefrontApiToken: string;
|
|
2223
|
-
/** Storefront API URL (usually https://store-{hash}.mybigcommerce.com) */
|
|
2224
|
-
storefrontApiUrl: string;
|
|
2225
|
-
/** Channel ID */
|
|
2226
|
-
channelId: string;
|
|
2227
|
-
/** Default currency code (default: 'USD') */
|
|
2228
|
-
currencyCode?: string;
|
|
2229
|
-
}
|
|
2230
|
-
declare class BigCommerceProvider implements CommerceProvider {
|
|
2231
|
-
readonly name = "bigcommerce";
|
|
2232
|
-
readonly version = "1.0.0";
|
|
2233
|
-
readonly capabilities: BackendCapabilities;
|
|
2234
|
-
private logger;
|
|
2235
|
-
private storefrontApiUrl;
|
|
2236
|
-
private storeHash;
|
|
2237
|
-
private channelId;
|
|
2238
|
-
private currencyCode;
|
|
2239
|
-
private headers;
|
|
2240
|
-
constructor(config: BigCommerceProviderConfig);
|
|
2241
|
-
private fetchApi;
|
|
2242
|
-
getProduct(handle: string): Promise<Product | undefined>;
|
|
2243
|
-
getProducts(options?: GetProductsOptions): Promise<Product[]>;
|
|
2244
|
-
getProductRecommendations(_productId: string): Promise<Product[]>;
|
|
2245
|
-
getCollection(handle: string): Promise<Collection | undefined>;
|
|
2246
|
-
getCollections(options?: GetCollectionsOptions): Promise<Collection[]>;
|
|
2247
|
-
getCollectionProducts(handle: string, options?: CollectionProductsOptions): Promise<Product[]>;
|
|
2248
|
-
getCategory(idOrHandle: string): Promise<ProductCategory | undefined>;
|
|
2249
|
-
getCategories(options?: GetCategoriesOptions): Promise<ProductCategory[]>;
|
|
2250
|
-
getCategoryProducts(handle: string, options?: CollectionProductsOptions): Promise<Product[]>;
|
|
2251
|
-
createCart(): Promise<Cart>;
|
|
2252
|
-
getCart(cartId: string): Promise<Cart | undefined>;
|
|
2253
|
-
addToCart(cartId: string, lines: CartLineInput[]): Promise<Cart>;
|
|
2254
|
-
removeFromCart(cartId: string, lineIds: string[]): Promise<Cart>;
|
|
2255
|
-
updateCart(cartId: string, lines: CartLineUpdate[]): Promise<Cart>;
|
|
2256
|
-
completeCheckout(_cartId: string): Promise<Order>;
|
|
2257
|
-
getShippingMethods(_cartId: string): Promise<ShippingMethod[]>;
|
|
2258
|
-
getRegionCountries(): Promise<_thorprovider_types.Country[]>;
|
|
2259
|
-
addShippingMethod(_cartId: string, _methodId: string): Promise<Cart>;
|
|
2260
|
-
initiatePaymentSession(_cartId: string, _providerId: string): Promise<void>;
|
|
2261
|
-
applyDiscountCode(cartId: string, code: string): Promise<Cart>;
|
|
2262
|
-
removeDiscountCode(cartId: string, code: string): Promise<Cart>;
|
|
2263
|
-
getOrders(_options: GetOrdersOptions): Promise<Order[]>;
|
|
2264
|
-
getPaymentMethods(_options: PaymentMethodsOptions): Promise<PaymentMethod[]>;
|
|
2265
|
-
getStockLocations(): Promise<StockLocation[]>;
|
|
2266
|
-
checkInventoryLevels(): Promise<InventoryLevel[]>;
|
|
2267
|
-
validateCartStock(): Promise<StockValidation>;
|
|
2268
|
-
getFulfillmentOptions(): Promise<FulfillmentOption[]>;
|
|
2269
|
-
cancelOrder(_orderId: string): Promise<Order>;
|
|
2270
|
-
createFulfillment(_orderId: string): Promise<void>;
|
|
2271
|
-
createRefund(_orderId: string): Promise<void>;
|
|
2272
|
-
getAdminOrders(): Promise<{
|
|
2273
|
-
orders: Order[];
|
|
2274
|
-
count: number;
|
|
2275
|
-
}>;
|
|
2276
|
-
getStorefrontContext(): Promise<StorefrontContext>;
|
|
2277
|
-
isStorefrontRequired(): boolean;
|
|
2278
|
-
}
|
|
2279
|
-
|
|
2280
|
-
/**
|
|
2281
|
-
* WooCommerce provider configuration
|
|
2282
|
-
*/
|
|
2283
|
-
interface WooCommerceProviderConfig extends ProviderConfig {
|
|
2284
|
-
/** WordPress site URL (e.g., 'https://mystore.com') */
|
|
2285
|
-
url: string;
|
|
2286
|
-
/** WooCommerce REST API consumer key (for authenticated operations) */
|
|
2287
|
-
consumerKey?: string;
|
|
2288
|
-
/** WooCommerce REST API consumer secret (for authenticated operations) */
|
|
2289
|
-
consumerSecret?: string;
|
|
2290
|
-
/** Default currency code (default: 'USD') */
|
|
2291
|
-
currencyCode?: string;
|
|
2292
|
-
}
|
|
2293
|
-
declare class WooCommerceProvider implements CommerceProvider {
|
|
2294
|
-
readonly name = "woocommerce";
|
|
2295
|
-
readonly version = "1.0.0";
|
|
2296
|
-
readonly capabilities: BackendCapabilities;
|
|
2297
|
-
private logger;
|
|
2298
|
-
private baseUrl;
|
|
2299
|
-
private storeApiBase;
|
|
2300
|
-
private restApiBase;
|
|
2301
|
-
private currencyCode;
|
|
2302
|
-
private authHeader?;
|
|
2303
|
-
constructor(config: WooCommerceProviderConfig);
|
|
2304
|
-
private storeApiFetch;
|
|
2305
|
-
private restApiFetch;
|
|
2306
|
-
getProduct(handle: string): Promise<Product | undefined>;
|
|
2307
|
-
getProducts(options?: GetProductsOptions): Promise<Product[]>;
|
|
2308
|
-
getProductRecommendations(_productId: string): Promise<Product[]>;
|
|
2309
|
-
getCollection(handle: string): Promise<Collection | undefined>;
|
|
2310
|
-
getCollections(options?: GetCollectionsOptions): Promise<Collection[]>;
|
|
2311
|
-
getCollectionProducts(handle: string, options?: CollectionProductsOptions): Promise<Product[]>;
|
|
2312
|
-
getCategory(idOrHandle: string): Promise<ProductCategory | undefined>;
|
|
2313
|
-
getCategories(options?: GetCategoriesOptions): Promise<ProductCategory[]>;
|
|
2314
|
-
getCategoryProducts(handle: string, options?: CollectionProductsOptions): Promise<Product[]>;
|
|
2315
|
-
createCart(): Promise<Cart>;
|
|
2316
|
-
getCart(_cartId: string): Promise<Cart | undefined>;
|
|
2317
|
-
addToCart(_cartId: string, lines: CartLineInput[]): Promise<Cart>;
|
|
2318
|
-
removeFromCart(_cartId: string, lineIds: string[]): Promise<Cart>;
|
|
2319
|
-
updateCart(_cartId: string, lines: CartLineUpdate[]): Promise<Cart>;
|
|
2320
|
-
completeCheckout(_cartId: string): Promise<Order>;
|
|
2321
|
-
getShippingMethods(_cartId: string): Promise<ShippingMethod[]>;
|
|
2322
|
-
getRegionCountries(): Promise<_thorprovider_types.Country[]>;
|
|
2323
|
-
addShippingMethod(_cartId: string, methodId: string): Promise<Cart>;
|
|
2324
|
-
initiatePaymentSession(_cartId: string, _providerId: string): Promise<void>;
|
|
2325
|
-
applyDiscountCode(_cartId: string, code: string): Promise<Cart>;
|
|
2326
|
-
removeDiscountCode(_cartId: string, code: string): Promise<Cart>;
|
|
2327
|
-
getOrders(_options: GetOrdersOptions): Promise<Order[]>;
|
|
2328
|
-
getPaymentMethods(_options: PaymentMethodsOptions): Promise<PaymentMethod[]>;
|
|
2329
|
-
getStockLocations(): Promise<StockLocation[]>;
|
|
2330
|
-
checkInventoryLevels(): Promise<InventoryLevel[]>;
|
|
2331
|
-
validateCartStock(): Promise<StockValidation>;
|
|
2332
|
-
getFulfillmentOptions(): Promise<FulfillmentOption[]>;
|
|
2333
|
-
cancelOrder(_orderId: string): Promise<Order>;
|
|
2334
|
-
createFulfillment(_orderId: string): Promise<void>;
|
|
2335
|
-
createRefund(_orderId: string): Promise<void>;
|
|
2336
|
-
getAdminOrders(): Promise<{
|
|
2337
|
-
orders: Order[];
|
|
2338
|
-
count: number;
|
|
2339
|
-
}>;
|
|
2340
|
-
getStorefrontContext(): Promise<StorefrontContext>;
|
|
2341
|
-
isStorefrontRequired(): boolean;
|
|
2342
|
-
}
|
|
2343
|
-
|
|
2344
|
-
/**
|
|
2345
|
-
* Spree provider configuration
|
|
2346
|
-
*/
|
|
2347
|
-
interface SpreeProviderConfig extends ProviderConfig {
|
|
2348
|
-
/** Spree store base URL (e.g., 'https://myspreestore.com') */
|
|
2349
|
-
baseUrl: string;
|
|
2350
|
-
/** Bearer token for authenticated operations (customer or OAuth) */
|
|
2351
|
-
bearerToken?: string;
|
|
2352
|
-
/** Default currency code (default: 'USD') */
|
|
2353
|
-
currencyCode?: string;
|
|
2354
|
-
}
|
|
2355
|
-
declare class SpreeProvider implements CommerceProvider {
|
|
2356
|
-
readonly name = "spree";
|
|
2357
|
-
readonly version = "1.0.0";
|
|
2358
|
-
readonly capabilities: BackendCapabilities;
|
|
2359
|
-
private logger;
|
|
2360
|
-
private baseUrl;
|
|
2361
|
-
private apiBase;
|
|
2362
|
-
private currencyCode;
|
|
2363
|
-
private bearerToken?;
|
|
2364
|
-
private orderToken?;
|
|
2365
|
-
constructor(config: SpreeProviderConfig);
|
|
2366
|
-
private apiFetch;
|
|
2367
|
-
getProduct(handle: string): Promise<Product | undefined>;
|
|
2368
|
-
getProducts(options?: GetProductsOptions): Promise<Product[]>;
|
|
2369
|
-
getProductRecommendations(_productId: string): Promise<Product[]>;
|
|
2370
|
-
getCollection(handle: string): Promise<Collection | undefined>;
|
|
2371
|
-
getCollections(options?: GetCollectionsOptions): Promise<Collection[]>;
|
|
2372
|
-
getCollectionProducts(handle: string, options?: CollectionProductsOptions): Promise<Product[]>;
|
|
2373
|
-
getCategory(handle: string): Promise<ProductCategory | undefined>;
|
|
2374
|
-
getCategories(options?: GetCategoriesOptions): Promise<ProductCategory[]>;
|
|
2375
|
-
getCategoryProducts(handle: string, options?: CollectionProductsOptions): Promise<Product[]>;
|
|
2376
|
-
createCart(): Promise<Cart>;
|
|
2377
|
-
getCart(_cartId: string): Promise<Cart | undefined>;
|
|
2378
|
-
addToCart(_cartId: string, lines: CartLineInput[]): Promise<Cart>;
|
|
2379
|
-
removeFromCart(_cartId: string, lineIds: string[]): Promise<Cart>;
|
|
2380
|
-
updateCart(_cartId: string, lines: CartLineUpdate[]): Promise<Cart>;
|
|
2381
|
-
completeCheckout(_cartId: string): Promise<Order>;
|
|
2382
|
-
getShippingMethods(_cartId: string): Promise<ShippingMethod[]>;
|
|
2383
|
-
getRegionCountries(): Promise<_thorprovider_types.Country[]>;
|
|
2384
|
-
addShippingMethod(_cartId: string, methodId: string): Promise<Cart>;
|
|
2385
|
-
initiatePaymentSession(_cartId: string, _providerId: string): Promise<void>;
|
|
2386
|
-
applyDiscountCode(_cartId: string, code: string): Promise<Cart>;
|
|
2387
|
-
removeDiscountCode(_cartId: string, code: string): Promise<Cart>;
|
|
2388
|
-
getOrders(_options: GetOrdersOptions): Promise<Order[]>;
|
|
2389
|
-
getPaymentMethods(_options: PaymentMethodsOptions): Promise<PaymentMethod[]>;
|
|
2390
|
-
getStockLocations(): Promise<StockLocation[]>;
|
|
2391
|
-
checkInventoryLevels(): Promise<InventoryLevel[]>;
|
|
2392
|
-
validateCartStock(): Promise<StockValidation>;
|
|
2393
|
-
getFulfillmentOptions(): Promise<FulfillmentOption[]>;
|
|
2394
|
-
cancelOrder(_orderId: string): Promise<Order>;
|
|
2395
|
-
createFulfillment(_orderId: string): Promise<void>;
|
|
2396
|
-
createRefund(_orderId: string): Promise<void>;
|
|
2397
|
-
getAdminOrders(): Promise<{
|
|
2398
|
-
orders: Order[];
|
|
2399
|
-
count: number;
|
|
2400
|
-
}>;
|
|
2401
|
-
getStorefrontContext(): Promise<StorefrontContext>;
|
|
2402
|
-
isStorefrontRequired(): boolean;
|
|
2403
|
-
}
|
|
2404
|
-
|
|
2405
|
-
/**
|
|
2406
|
-
* Magento provider configuration
|
|
2407
|
-
*/
|
|
2408
|
-
interface MagentoProviderConfig extends ProviderConfig {
|
|
2409
|
-
/** Magento base URL (e.g., 'https://mymagento.com') */
|
|
2410
|
-
baseUrl: string;
|
|
2411
|
-
/** Store code for multi-tenant (default: 'default') */
|
|
2412
|
-
storeCode?: string;
|
|
2413
|
-
/** Customer bearer token (for authenticated operations) */
|
|
2414
|
-
customerToken?: string;
|
|
2415
|
-
/** Integration access token (for admin-level operations) */
|
|
2416
|
-
accessToken?: string;
|
|
2417
|
-
/** Default currency code (default: 'USD') */
|
|
2418
|
-
currencyCode?: string;
|
|
2419
|
-
}
|
|
2420
|
-
declare class MagentoProvider implements CommerceProvider {
|
|
2421
|
-
readonly name = "magento";
|
|
2422
|
-
readonly version = "1.0.0";
|
|
2423
|
-
readonly capabilities: BackendCapabilities;
|
|
2424
|
-
private logger;
|
|
2425
|
-
private baseUrl;
|
|
2426
|
-
private storeCode;
|
|
2427
|
-
private currencyCode;
|
|
2428
|
-
private graphqlEndpoint;
|
|
2429
|
-
private customerToken?;
|
|
2430
|
-
private accessToken?;
|
|
2431
|
-
constructor(config: MagentoProviderConfig);
|
|
2432
|
-
private graphql;
|
|
2433
|
-
getProduct(handle: string): Promise<Product | undefined>;
|
|
2434
|
-
getProducts(options?: GetProductsOptions): Promise<Product[]>;
|
|
2435
|
-
getProductRecommendations(_productId: string): Promise<Product[]>;
|
|
2436
|
-
getCollection(handle: string): Promise<Collection | undefined>;
|
|
2437
|
-
getCollections(options?: GetCollectionsOptions): Promise<Collection[]>;
|
|
2438
|
-
getCollectionProducts(handle: string, options?: CollectionProductsOptions): Promise<Product[]>;
|
|
2439
|
-
getCategory(handle: string): Promise<ProductCategory | undefined>;
|
|
2440
|
-
getCategories(options?: GetCategoriesOptions): Promise<ProductCategory[]>;
|
|
2441
|
-
getCategoryProducts(handle: string, options?: CollectionProductsOptions): Promise<Product[]>;
|
|
2442
|
-
createCart(): Promise<Cart>;
|
|
2443
|
-
getCart(cartId: string): Promise<Cart | undefined>;
|
|
2444
|
-
addToCart(cartId: string, lines: CartLineInput[]): Promise<Cart>;
|
|
2445
|
-
removeFromCart(cartId: string, lineIds: string[]): Promise<Cart>;
|
|
2446
|
-
updateCart(cartId: string, lines: CartLineUpdate[]): Promise<Cart>;
|
|
2447
|
-
completeCheckout(_cartId: string): Promise<Order>;
|
|
2448
|
-
getShippingMethods(_cartId: string): Promise<ShippingMethod[]>;
|
|
2449
|
-
getRegionCountries(): Promise<_thorprovider_types.Country[]>;
|
|
2450
|
-
addShippingMethod(_cartId: string, _methodId: string): Promise<Cart>;
|
|
2451
|
-
initiatePaymentSession(_cartId: string, _providerId: string): Promise<void>;
|
|
2452
|
-
applyDiscountCode(cartId: string, code: string): Promise<Cart>;
|
|
2453
|
-
removeDiscountCode(cartId: string, _code: string): Promise<Cart>;
|
|
2454
|
-
getOrders(_options: GetOrdersOptions): Promise<Order[]>;
|
|
2455
|
-
getPaymentMethods(_options: PaymentMethodsOptions): Promise<PaymentMethod[]>;
|
|
2456
|
-
getStockLocations(): Promise<StockLocation[]>;
|
|
2457
|
-
checkInventoryLevels(): Promise<InventoryLevel[]>;
|
|
2458
|
-
validateCartStock(): Promise<StockValidation>;
|
|
2459
|
-
getFulfillmentOptions(): Promise<FulfillmentOption[]>;
|
|
2460
|
-
cancelOrder(_orderId: string): Promise<Order>;
|
|
2461
|
-
createFulfillment(_orderId: string): Promise<void>;
|
|
2462
|
-
createRefund(_orderId: string): Promise<void>;
|
|
2463
|
-
getAdminOrders(): Promise<{
|
|
2464
|
-
orders: Order[];
|
|
2465
|
-
count: number;
|
|
2466
|
-
}>;
|
|
2467
|
-
getStorefrontContext(): Promise<StorefrontContext>;
|
|
2468
|
-
isStorefrontRequired(): boolean;
|
|
2469
|
-
}
|
|
2470
|
-
|
|
2471
2307
|
interface StelOrderProviderConfig extends ProviderConfig {
|
|
2472
2308
|
baseUrl: string;
|
|
2473
2309
|
apiKey?: string;
|
|
@@ -2617,24 +2453,40 @@ declare class MockProvider implements CommerceProvider {
|
|
|
2617
2453
|
}
|
|
2618
2454
|
|
|
2619
2455
|
/**
|
|
2620
|
-
* @thorprovider/adapters
|
|
2621
|
-
* Provider Factory -
|
|
2456
|
+
* @thorprovider/adapters v5.0
|
|
2457
|
+
* Provider Factory - Dynamic registry pattern
|
|
2458
|
+
*
|
|
2459
|
+
* Providers register themselves at import time via `registerProvider()`.
|
|
2460
|
+
* The factory no longer statically imports every backend — only the ones
|
|
2461
|
+
* the consumer explicitly imports will be available.
|
|
2622
2462
|
*
|
|
2623
|
-
*
|
|
2624
|
-
* When adding a new provider:
|
|
2625
|
-
* 1. Update SupportedProviderType enum in packages/types/src/provider.ts
|
|
2626
|
-
* 2. Add new discriminated union case here
|
|
2627
|
-
* 3. Create packages/adapters/src/providers/[platform]/
|
|
2628
|
-
* 4. Implement CommerceProvider interface
|
|
2463
|
+
* Built-in providers (medusa, stelorder, mock) are registered automatically.
|
|
2629
2464
|
*/
|
|
2630
2465
|
|
|
2466
|
+
type ProviderFactory = (config: any) => CommerceProvider;
|
|
2467
|
+
/**
|
|
2468
|
+
* Register a provider factory for a given type string.
|
|
2469
|
+
* Call this to make a provider available to `createProvider()`.
|
|
2470
|
+
*
|
|
2471
|
+
* @example
|
|
2472
|
+
* ```ts
|
|
2473
|
+
* import { registerProvider } from '@thorprovider/adapters';
|
|
2474
|
+
* import { MyProvider } from './my-provider';
|
|
2475
|
+
*
|
|
2476
|
+
* registerProvider('my-provider', (config) => new MyProvider(config));
|
|
2477
|
+
* ```
|
|
2478
|
+
*/
|
|
2479
|
+
declare function registerProvider(type: string, factory: ProviderFactory): void;
|
|
2631
2480
|
/**
|
|
2632
|
-
*
|
|
2633
|
-
* Kept for backward compatibility; prefer ProviderTypeString from @thorprovider/types
|
|
2481
|
+
* Get all registered provider type strings.
|
|
2634
2482
|
*/
|
|
2635
|
-
|
|
2483
|
+
declare function getRegisteredProviders(): string[];
|
|
2636
2484
|
/**
|
|
2637
|
-
*
|
|
2485
|
+
* Supported provider types
|
|
2486
|
+
*/
|
|
2487
|
+
type ProviderType = ProviderTypeString | (string & {});
|
|
2488
|
+
/**
|
|
2489
|
+
* Provider configuration discriminated union (built-in providers)
|
|
2638
2490
|
*/
|
|
2639
2491
|
type ProviderFactoryConfig = {
|
|
2640
2492
|
provider: 'mock';
|
|
@@ -2646,30 +2498,18 @@ type ProviderFactoryConfig = {
|
|
|
2646
2498
|
provider: 'stelorder';
|
|
2647
2499
|
config: StelOrderProviderConfig;
|
|
2648
2500
|
} | {
|
|
2649
|
-
provider:
|
|
2650
|
-
config:
|
|
2651
|
-
} | {
|
|
2652
|
-
provider: 'bigcommerce';
|
|
2653
|
-
config: BigCommerceProviderConfig;
|
|
2654
|
-
} | {
|
|
2655
|
-
provider: 'woocommerce';
|
|
2656
|
-
config: WooCommerceProviderConfig;
|
|
2657
|
-
} | {
|
|
2658
|
-
provider: 'spree';
|
|
2659
|
-
config: SpreeProviderConfig;
|
|
2660
|
-
} | {
|
|
2661
|
-
provider: 'magento';
|
|
2662
|
-
config: MagentoProviderConfig;
|
|
2501
|
+
provider: string;
|
|
2502
|
+
config: Record<string, unknown>;
|
|
2663
2503
|
};
|
|
2664
2504
|
/**
|
|
2665
|
-
* Runtime provider configuration (accepts any
|
|
2505
|
+
* Runtime provider configuration (accepts any registered provider string)
|
|
2666
2506
|
*/
|
|
2667
2507
|
type RuntimeProviderConfig = {
|
|
2668
|
-
provider:
|
|
2508
|
+
provider: string;
|
|
2669
2509
|
config: Record<string, unknown>;
|
|
2670
2510
|
};
|
|
2671
2511
|
/**
|
|
2672
|
-
* Create a commerce provider instance
|
|
2512
|
+
* Create a commerce provider instance from the registry.
|
|
2673
2513
|
*
|
|
2674
2514
|
* @example
|
|
2675
2515
|
* ```ts
|
|
@@ -2680,8 +2520,6 @@ type RuntimeProviderConfig = {
|
|
|
2680
2520
|
* publishableKey: process.env.MEDUSA_PUBLISHABLE_KEY,
|
|
2681
2521
|
* }
|
|
2682
2522
|
* });
|
|
2683
|
-
*
|
|
2684
|
-
* const products = await commerce.getProducts();
|
|
2685
2523
|
* ```
|
|
2686
2524
|
*/
|
|
2687
2525
|
declare function createProvider(options: ProviderFactoryConfig | RuntimeProviderConfig): CommerceProvider;
|
|
@@ -2690,4 +2528,4 @@ declare function createProvider(options: ProviderFactoryConfig | RuntimeProvider
|
|
|
2690
2528
|
*/
|
|
2691
2529
|
declare function isProviderType<T extends ProviderType>(provider: CommerceProvider, type: T): boolean;
|
|
2692
2530
|
|
|
2693
|
-
export { AdminAuthService, type AdminSession, AdminSessionService,
|
|
2531
|
+
export { AdminAuthService, type AdminSession, AdminSessionService, type BackendMapping, type BackendMetadataAdapter, type BackendMetadataAdapterConfig, CHANNEL_ASSIGNED_AT_KEY, CHANNEL_ASSIGNED_BY_KEY, CHANNEL_SCOPE_KEY, type ChannelScopeMetadata, ChannelScopeValidationError, type ChannelScopeable, CircuitBreaker, type CircuitBreakerConfig, CircuitBreakerOpenError, type CircuitBreakerStats, type CircuitState, CommerceError, ConfigurationError, type Coordinates, type FulfillmentGroup, type FulfillmentPlan, type LogLevel, type Logger, MEDUSA_CAPABILITIES, MOCK_CAPABILITIES, MedusaMetadataAdapter, MedusaProvider, type MedusaProviderConfig, type MetricsOrderInput, type MetricsProductInput, MetricsService, MockProvider, type MockProviderConfig, type PlanFulfillmentShippingAddress, ProviderAPIError, type ProviderFactoryConfig, ProviderNotFoundError, type ProviderType, ResourceNotFoundError, type RetryConfig, STELORDER_CAPABILITIES, StelOrderProvider, type StelOrderProviderConfig, type UICartItem, type UICartTotals, type UIDiscountCode, type UIPaymentMethod, type UIShippingMethod, assertEntityBelongsToChannel, backendCircuitBreaker, buildChannelScopeMetadata, calculateDistance, createBackendMetadataAdapter, createLogger, createProvider, extractErrorMessage, fetchWithRetry, filterByChannel, filterGlobalOnly, geocodeAddress, getBackendProviderId, getCapabilityDescription, getChannelScope, getRegisteredProviders, isBackendCapabilities, isGlobalEntity, isProviderType, isScopedToChannel, moneyToNumber, moneyToNumberSafe, numberToMoney, partitionByChannel, planFulfillment, registerProvider, transformFulfillmentOption, transformInventoryLevel, transformStockLocation, transformStorefrontConfig, validateAssignedBy, validateChannelId, validateChannelScopeAssignment, validateEntityId, validatePaymentId };
|