@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
package/dist/index.mjs CHANGED
@@ -71,6 +71,41 @@ var MEDUSA_CAPABILITIES = {
71
71
  loyaltyProgram: false
72
72
  // Requires custom implementation
73
73
  };
74
+ var STELORDER_CAPABILITIES = {
75
+ // Profile Management
76
+ updateProfile: false,
77
+ updateEmail: false,
78
+ changePasswordDirect: false,
79
+ changePasswordViaEmail: false,
80
+ deleteAccount: false,
81
+ // Avatar
82
+ uploadAvatar: false,
83
+ avatarViaMetadata: false,
84
+ // Custom Attributes
85
+ customAttributes: false,
86
+ // Orders
87
+ fetchOrders: true,
88
+ cancelOrder: false,
89
+ // Addresses
90
+ manageAddresses: true,
91
+ defaultAddress: false,
92
+ // Cart/Checkout
93
+ applyDiscounts: false,
94
+ shippingCalculation: false,
95
+ guestCheckout: false,
96
+ savedPaymentMethods: false,
97
+ listPaymentProviders: true,
98
+ regionSpecificPayments: false,
99
+ // Wishlist
100
+ wishlist: false,
101
+ // Search
102
+ advancedSearch: false,
103
+ facetedFilters: false,
104
+ // Reviews
105
+ productReviews: false,
106
+ // Loyalty
107
+ loyaltyProgram: false
108
+ };
74
109
  var SHOPIFY_CAPABILITIES = {
75
110
  // Profile Management
76
111
  updateProfile: true,
@@ -488,6 +523,9 @@ async function fetchWithRetry(url, init, retryConfig) {
488
523
  }
489
524
  throw lastError;
490
525
  }
526
+ function createFetchWithRetry(retryConfig) {
527
+ return (url, init) => fetchWithRetry(url, init, retryConfig);
528
+ }
491
529
 
492
530
  // src/resilience/circuit-breaker.ts
493
531
  var CircuitBreaker = class {
@@ -7977,6 +8015,1031 @@ var MagentoProvider = class {
7977
8015
  }
7978
8016
  };
7979
8017
 
8018
+ // src/providers/stelorder/transforms.ts
8019
+ function normalizeStelCollection(payload) {
8020
+ if (!payload) {
8021
+ return [];
8022
+ }
8023
+ return Array.isArray(payload) ? payload : [payload];
8024
+ }
8025
+ function normalizeStelEntity(payload) {
8026
+ if (!payload) {
8027
+ return void 0;
8028
+ }
8029
+ return Array.isArray(payload) ? payload[0] : payload;
8030
+ }
8031
+ function transformStelMoney(amount, currencyCode = "USD") {
8032
+ const normalizedAmount = typeof amount === "string" ? Number.parseFloat(amount) : amount ?? 0;
8033
+ return {
8034
+ amount: Number.isFinite(normalizedAmount) ? normalizedAmount.toFixed(2) : "0.00",
8035
+ currencyCode: currencyCode.toUpperCase()
8036
+ };
8037
+ }
8038
+ function transformStelImage(url, altText = "") {
8039
+ const normalizedUrl = url?.trim();
8040
+ if (!normalizedUrl) {
8041
+ return void 0;
8042
+ }
8043
+ return {
8044
+ url: normalizedUrl,
8045
+ altText,
8046
+ width: 800,
8047
+ height: 800
8048
+ };
8049
+ }
8050
+ function normalizeStelDate(value) {
8051
+ if (!value) {
8052
+ return (/* @__PURE__ */ new Date()).toISOString();
8053
+ }
8054
+ const parsed = new Date(value);
8055
+ return Number.isNaN(parsed.getTime()) ? (/* @__PURE__ */ new Date()).toISOString() : parsed.toISOString();
8056
+ }
8057
+ function toStelStringId(value) {
8058
+ if (value === null || value === void 0) {
8059
+ return "";
8060
+ }
8061
+ return String(value);
8062
+ }
8063
+ function slugify(value) {
8064
+ return value.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
8065
+ }
8066
+ function buildStelHandle(...candidates) {
8067
+ for (const candidate of candidates) {
8068
+ if (candidate === null || candidate === void 0) {
8069
+ continue;
8070
+ }
8071
+ const normalized = slugify(String(candidate).trim());
8072
+ if (normalized) {
8073
+ return normalized;
8074
+ }
8075
+ }
8076
+ return "stel-item";
8077
+ }
8078
+ function transformStelProductImages(product) {
8079
+ const images = [];
8080
+ if (!product["item-images"]) {
8081
+ return images;
8082
+ }
8083
+ const sorted = [...product["item-images"]].sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
8084
+ for (const img of sorted) {
8085
+ const transformed = transformStelImage(img["item-image-path"], product.name ?? "");
8086
+ if (transformed) {
8087
+ images.push(transformed);
8088
+ }
8089
+ }
8090
+ return images;
8091
+ }
8092
+ function deriveStelStockStatus(product) {
8093
+ if (!product["stock-enabled"]) {
8094
+ return "in_stock";
8095
+ }
8096
+ const realStock = product["real-stock"] ?? 0;
8097
+ const minimumStock = product["minimum-stock"] ?? 0;
8098
+ if (realStock <= 0) {
8099
+ return "out_of_stock";
8100
+ }
8101
+ if (realStock <= minimumStock) {
8102
+ return "low_stock";
8103
+ }
8104
+ return "in_stock";
8105
+ }
8106
+ function buildSyntheticVariant(product, currencyCode) {
8107
+ const price = transformStelMoney(product["sales-price"], currencyCode);
8108
+ const stockStatus = deriveStelStockStatus(product);
8109
+ const quantityAvailable = product["stock-enabled"] ? product["real-stock"] ?? 0 : void 0;
8110
+ const image = product["item-images"]?.[0] ? transformStelImage(product["item-images"][0]["item-image-path"], product.name ?? "") : void 0;
8111
+ return {
8112
+ id: toStelStringId(product.id),
8113
+ title: "Default",
8114
+ sku: product.barcode ?? product["full-reference"] ?? void 0,
8115
+ availableForSale: stockStatus !== "out_of_stock",
8116
+ selectedOptions: [],
8117
+ price,
8118
+ compareAtPrice: void 0,
8119
+ quantityAvailable,
8120
+ stockStatus,
8121
+ image
8122
+ };
8123
+ }
8124
+ function transformStelProduct(raw, currencyCode) {
8125
+ const id = toStelStringId(raw.id);
8126
+ const handle = buildStelHandle(raw["full-reference"], raw.reference, raw.name, raw.id);
8127
+ const price = transformStelMoney(raw["sales-price"], currencyCode);
8128
+ const images = transformStelProductImages(raw);
8129
+ const variant = buildSyntheticVariant(raw, currencyCode);
8130
+ const now = (/* @__PURE__ */ new Date()).toISOString();
8131
+ return {
8132
+ id,
8133
+ handle,
8134
+ title: raw.name ?? "",
8135
+ description: raw.description ?? "",
8136
+ availableForSale: variant.availableForSale,
8137
+ options: [],
8138
+ variants: [variant],
8139
+ featuredImage: images[0],
8140
+ images,
8141
+ priceRange: {
8142
+ minVariantPrice: price,
8143
+ maxVariantPrice: price
8144
+ },
8145
+ productType: void 0,
8146
+ vendor: void 0,
8147
+ tags: raw.promotional ? ["promotional"] : [],
8148
+ createdAt: normalizeStelDate(raw["creation-date"]),
8149
+ updatedAt: normalizeStelDate(raw["utc-last-modification-date"]) || now,
8150
+ metadata: {
8151
+ stelFullReference: raw["full-reference"],
8152
+ stelReference: raw.reference,
8153
+ stelBarcode: raw.barcode,
8154
+ stelCategoryId: raw["product-category-id"],
8155
+ stelInactive: raw.inactive,
8156
+ stelPromotional: raw.promotional,
8157
+ stelPurchasePrice: raw["purchase-price"]
8158
+ }
8159
+ };
8160
+ }
8161
+ function transformStelCategory(raw) {
8162
+ const id = toStelStringId(raw.id);
8163
+ const handle = buildStelHandle(raw.slug, raw.name, raw.id);
8164
+ return {
8165
+ id,
8166
+ name: raw.name ?? "",
8167
+ handle,
8168
+ description: raw.description ?? void 0,
8169
+ parentCategoryId: raw["parent-category-id"] ? toStelStringId(raw["parent-category-id"]) : void 0,
8170
+ metadata: {
8171
+ stelSlug: raw.slug
8172
+ }
8173
+ };
8174
+ }
8175
+ function transformStelCategoryToCollection(raw) {
8176
+ const id = toStelStringId(raw.id);
8177
+ const handle = buildStelHandle(raw.slug, raw.name, raw.id);
8178
+ return {
8179
+ id,
8180
+ handle,
8181
+ title: raw.name ?? "",
8182
+ description: raw.description ?? "",
8183
+ path: `/collections/${handle}`,
8184
+ updatedAt: normalizeStelDate(raw["utc-last-modification-date"])
8185
+ };
8186
+ }
8187
+ function transformStelWarehouseToStockLocation(raw) {
8188
+ return {
8189
+ id: toStelStringId(raw.id),
8190
+ name: raw.name ?? "Warehouse"
8191
+ };
8192
+ }
8193
+ function transformStelProductWarehouseToInventoryLevel(pw) {
8194
+ return {
8195
+ locationId: toStelStringId(pw["warehouse-id"]),
8196
+ locationName: pw["warehouse-path"] ?? `Warehouse ${pw["warehouse-id"] ?? "unknown"}`,
8197
+ availableQuantity: pw["real-stock"] ?? 0,
8198
+ reservedQuantity: Math.max(0, (pw["virtual-stock"] ?? 0) - (pw["real-stock"] ?? 0)),
8199
+ stockedQuantity: pw["virtual-stock"] ?? pw["real-stock"] ?? 0
8200
+ };
8201
+ }
8202
+ function splitStelName(fullName) {
8203
+ if (!fullName?.trim()) {
8204
+ return { firstName: "", lastName: "" };
8205
+ }
8206
+ const parts = fullName.trim().split(/\s+/);
8207
+ const firstName = parts[0] ?? "";
8208
+ const lastName = parts.length > 1 ? parts.slice(1).join(" ") : "";
8209
+ return { firstName, lastName };
8210
+ }
8211
+ function transformStelClient(raw) {
8212
+ const { firstName, lastName } = splitStelName(raw.name ?? raw["business-name"]);
8213
+ return {
8214
+ id: toStelStringId(raw.id),
8215
+ email: raw.email ?? "",
8216
+ firstName: firstName || null,
8217
+ lastName: lastName || null,
8218
+ phone: raw.phone ?? raw.mobile ?? null,
8219
+ hasAccount: true,
8220
+ createdAt: normalizeStelDate(raw["utc-last-modification-date"]),
8221
+ updatedAt: normalizeStelDate(raw["utc-last-modification-date"]),
8222
+ metadata: {
8223
+ stelBusinessName: raw["business-name"],
8224
+ stelRateId: raw["rate-id"],
8225
+ stelPaymentOptionId: raw["payment-option-id"],
8226
+ stelPaymentTermId: raw["payment-term-id"],
8227
+ stelDeliveryOptionId: raw["delivery-option-id"]
8228
+ }
8229
+ };
8230
+ }
8231
+ function deriveStelOrderStatus(raw) {
8232
+ if (raw.deleted) {
8233
+ return "cancelled";
8234
+ }
8235
+ const status = (raw.status ?? "").toLowerCase();
8236
+ if (status.includes("cancel") || status.includes("anulad")) {
8237
+ return "cancelled";
8238
+ }
8239
+ if (status.includes("complet") || status.includes("cerrad") || status.includes("settled")) {
8240
+ return "completed";
8241
+ }
8242
+ if (status.includes("process") || status.includes("confirm")) {
8243
+ return "processing";
8244
+ }
8245
+ return "pending";
8246
+ }
8247
+ function deriveStelPaymentStatus(raw) {
8248
+ const orderStatus = deriveStelOrderStatus(raw);
8249
+ if (orderStatus === "completed") {
8250
+ return "paid";
8251
+ }
8252
+ if (orderStatus === "cancelled") {
8253
+ return "pending";
8254
+ }
8255
+ return "pending";
8256
+ }
8257
+ function deriveStelFulfillmentStatus(raw) {
8258
+ const orderStatus = deriveStelOrderStatus(raw);
8259
+ if (orderStatus === "completed") {
8260
+ return "fulfilled";
8261
+ }
8262
+ return "unfulfilled";
8263
+ }
8264
+ function transformStelDocumentLine(line, index, currencyCode) {
8265
+ const unitPrice = line["item-base-price"] ?? 0;
8266
+ const quantity = line.units ?? 1;
8267
+ const lineTotal = unitPrice * quantity;
8268
+ return {
8269
+ id: toStelStringId(line["item-id"] ?? index),
8270
+ title: line["item-name"] ?? "",
8271
+ variantTitle: void 0,
8272
+ quantity,
8273
+ price: transformStelMoney(unitPrice, currencyCode),
8274
+ total: transformStelMoney(lineTotal, currencyCode),
8275
+ sku: void 0,
8276
+ productId: line["item-id"] ? toStelStringId(line["item-id"]) : void 0
8277
+ };
8278
+ }
8279
+ function transformStelSalesOrder(raw, currencyCode) {
8280
+ const id = toStelStringId(raw.id);
8281
+ const now = (/* @__PURE__ */ new Date()).toISOString();
8282
+ const items = (raw["document-lines"] ?? []).filter((line) => line["line-type"] === "ITEM" || !line["line-type"]).map((line, i) => transformStelDocumentLine(line, i, currencyCode));
8283
+ const status = deriveStelOrderStatus(raw);
8284
+ return {
8285
+ id,
8286
+ orderNumber: raw.reference ?? id,
8287
+ email: raw.email ?? "",
8288
+ status,
8289
+ paymentStatus: deriveStelPaymentStatus(raw),
8290
+ fulfillmentStatus: deriveStelFulfillmentStatus(raw),
8291
+ customerId: raw["client-id"] ? toStelStringId(raw["client-id"]) : void 0,
8292
+ items,
8293
+ subtotal: transformStelMoney(raw["total-base"], currencyCode),
8294
+ total: transformStelMoney(raw.total, currencyCode),
8295
+ tax: raw["total-tax"] != null ? transformStelMoney(raw["total-tax"], currencyCode) : void 0,
8296
+ createdAt: normalizeStelDate(raw["creation-date"]),
8297
+ updatedAt: normalizeStelDate(raw["utc-last-modification-date"]) || now,
8298
+ cancelledAt: status === "cancelled" ? normalizeStelDate(raw["utc-last-modification-date"]) : void 0,
8299
+ completedAt: status === "completed" ? normalizeStelDate(raw["utc-last-modification-date"]) : void 0,
8300
+ metadata: {
8301
+ stelReference: raw.reference,
8302
+ stelStatus: raw.status,
8303
+ stelPaymentOptionId: raw["payment-option-id"],
8304
+ stelPaymentTermId: raw["payment-term-id"],
8305
+ stelDeliveryOptionId: raw["delivery-option-id"]
8306
+ }
8307
+ };
8308
+ }
8309
+ function inferPaymentMethodType(name) {
8310
+ if (!name) {
8311
+ return "other";
8312
+ }
8313
+ const lower = name.toLowerCase();
8314
+ if (lower.includes("transfer") || lower.includes("bank") || lower.includes("sepa") || lower.includes("iban")) {
8315
+ return "bank_transfer";
8316
+ }
8317
+ if (lower.includes("card") || lower.includes("tarjeta") || lower.includes("visa") || lower.includes("master")) {
8318
+ return "card";
8319
+ }
8320
+ if (lower.includes("paypal") || lower.includes("wallet") || lower.includes("apple") || lower.includes("google")) {
8321
+ return "wallet";
8322
+ }
8323
+ if (lower.includes("cash") || lower.includes("contrar") || lower.includes("efectivo") || lower.includes("cod")) {
8324
+ return "cash_on_delivery";
8325
+ }
8326
+ if (lower.includes("crypto") || lower.includes("bitcoin")) {
8327
+ return "crypto";
8328
+ }
8329
+ return "other";
8330
+ }
8331
+ function transformStelPaymentOption(raw) {
8332
+ return {
8333
+ id: toStelStringId(raw.id),
8334
+ name: raw.name ?? "Payment Option",
8335
+ type: inferPaymentMethodType(raw.name),
8336
+ isEnabled: !raw.deleted,
8337
+ requiresSetup: false,
8338
+ description: raw.description ?? void 0,
8339
+ metadata: {
8340
+ stelPath: raw.path,
8341
+ source: "paymentOption"
8342
+ }
8343
+ };
8344
+ }
8345
+ function transformStelDeliveryOption(raw, currencyCode) {
8346
+ return {
8347
+ id: toStelStringId(raw.id),
8348
+ name: raw.name ?? "Delivery Option",
8349
+ price: transformStelMoney(0, currencyCode),
8350
+ description: raw.description ?? void 0
8351
+ };
8352
+ }
8353
+
8354
+ // src/providers/stelorder/client.ts
8355
+ var DEFAULT_RETRY_CONFIG2 = {
8356
+ maxRetries: 2,
8357
+ initialDelayMs: 300,
8358
+ backoffMultiplier: 2,
8359
+ maxDelayMs: 5e3,
8360
+ timeoutMs: 1e4,
8361
+ retryableStatusCodes: [408, 429, 500, 502, 503, 504]
8362
+ };
8363
+ function sleep2(ms) {
8364
+ return new Promise((resolve) => setTimeout(resolve, ms));
8365
+ }
8366
+ function calculateDelay2(attempt, retryConfig) {
8367
+ const delay = retryConfig.initialDelayMs * Math.pow(retryConfig.backoffMultiplier, attempt);
8368
+ return Math.min(delay, retryConfig.maxDelayMs);
8369
+ }
8370
+ function isRetryableError2(error, retryConfig) {
8371
+ if (error instanceof ProviderAPIError) {
8372
+ return typeof error.status === "number" && retryConfig.retryableStatusCodes.includes(error.status);
8373
+ }
8374
+ if (!(error instanceof Error)) {
8375
+ return false;
8376
+ }
8377
+ const message = error.message.toLowerCase();
8378
+ return error.name === "AbortError" || error.name === "TimeoutError" || message.includes("fetch failed") || message.includes("timeout") || message.includes("econnrefused") || message.includes("etimedout");
8379
+ }
8380
+ function createRetryingFetch(fetchImplementation, retryConfig, logger2) {
8381
+ return async (url, init) => {
8382
+ let lastError = new Error("Unknown STEL Order request error");
8383
+ for (let attempt = 0; attempt <= retryConfig.maxRetries; attempt += 1) {
8384
+ const controller = new AbortController();
8385
+ const timeoutId = setTimeout(() => controller.abort(), retryConfig.timeoutMs);
8386
+ try {
8387
+ const response = await fetchImplementation(url, {
8388
+ ...init,
8389
+ signal: controller.signal
8390
+ });
8391
+ clearTimeout(timeoutId);
8392
+ if (!response.ok && retryConfig.retryableStatusCodes.includes(response.status)) {
8393
+ throw new ProviderAPIError(
8394
+ `STEL Order API error: ${response.status} ${response.statusText}`,
8395
+ "stelorder",
8396
+ response.status
8397
+ );
8398
+ }
8399
+ return response;
8400
+ } catch (error) {
8401
+ clearTimeout(timeoutId);
8402
+ lastError = error;
8403
+ if (attempt >= retryConfig.maxRetries || !isRetryableError2(error, retryConfig)) {
8404
+ throw error;
8405
+ }
8406
+ const delay = calculateDelay2(attempt, retryConfig);
8407
+ logger2.warn("STEL request failed, retrying.", {
8408
+ url,
8409
+ attempt: attempt + 1,
8410
+ maxAttempts: retryConfig.maxRetries + 1,
8411
+ nextRetryIn: delay,
8412
+ error: extractErrorMessage(error)
8413
+ });
8414
+ await sleep2(delay);
8415
+ }
8416
+ }
8417
+ throw lastError;
8418
+ };
8419
+ }
8420
+ async function parseErrorResponse(response) {
8421
+ const contentType = response.headers.get("content-type") ?? "";
8422
+ try {
8423
+ if (contentType.includes("application/json")) {
8424
+ const body = await response.json();
8425
+ const message = extractErrorMessage(body);
8426
+ if (message && message !== "An unknown error occurred") {
8427
+ return message;
8428
+ }
8429
+ }
8430
+ } catch {
8431
+ }
8432
+ try {
8433
+ const text = await response.text();
8434
+ if (text.trim()) {
8435
+ return text.trim();
8436
+ }
8437
+ } catch {
8438
+ }
8439
+ return `STEL Order API error: ${response.status} ${response.statusText}`;
8440
+ }
8441
+ function normalizeStelApiBaseUrl(baseUrl) {
8442
+ const trimmed = baseUrl.trim();
8443
+ if (!trimmed) {
8444
+ throw new ConfigurationError("Stel Order baseUrl is required.");
8445
+ }
8446
+ const normalized = trimmed.replace(/\/api\/openapi\.json$/i, "").replace(/\/+$/, "");
8447
+ return normalized.endsWith("/app") ? normalized : `${normalized}/app`;
8448
+ }
8449
+ var StelOrderClient = class {
8450
+ apiBaseUrl;
8451
+ apiKey;
8452
+ logger;
8453
+ retryConfig;
8454
+ fetchImplementation;
8455
+ constructor(config) {
8456
+ const apiKey = config.apiKey ?? config.publishableKey;
8457
+ if (!apiKey) {
8458
+ throw new ConfigurationError(
8459
+ "Stel Order API key is required. Pass `apiKey` or `publishableKey` to createProvider()."
8460
+ );
8461
+ }
8462
+ this.apiBaseUrl = normalizeStelApiBaseUrl(config.baseUrl);
8463
+ this.apiKey = apiKey;
8464
+ this.logger = createLogger("StelOrderClient", config.debug);
8465
+ this.retryConfig = {
8466
+ ...DEFAULT_RETRY_CONFIG2,
8467
+ ...config.retry
8468
+ };
8469
+ this.fetchImplementation = config.customFetch ? createRetryingFetch(config.customFetch, this.retryConfig, this.logger) : void 0;
8470
+ this.logger.info("Initializing Stel Order client", {
8471
+ apiBaseUrl: this.apiBaseUrl,
8472
+ retryConfig: this.retryConfig
8473
+ });
8474
+ }
8475
+ async list(resource, query) {
8476
+ const payload = await this.request({
8477
+ method: "GET",
8478
+ path: resource,
8479
+ query
8480
+ });
8481
+ return normalizeStelCollection(payload);
8482
+ }
8483
+ async getOne(resource, id, query) {
8484
+ const payload = await this.request({
8485
+ method: "GET",
8486
+ path: `${resource}/${id}`,
8487
+ query
8488
+ });
8489
+ return normalizeStelEntity(payload);
8490
+ }
8491
+ async create(resource, body) {
8492
+ return this.request({
8493
+ method: "POST",
8494
+ path: resource,
8495
+ body
8496
+ });
8497
+ }
8498
+ async update(resource, id, body) {
8499
+ return this.request({
8500
+ method: "PUT",
8501
+ path: `${resource}/${id}`,
8502
+ body
8503
+ });
8504
+ }
8505
+ async remove(resource, id) {
8506
+ await this.request({
8507
+ method: "DELETE",
8508
+ path: `${resource}/${id}`
8509
+ });
8510
+ }
8511
+ buildUrl(path, query) {
8512
+ const normalizedPath = path.replace(/^\/+/, "");
8513
+ const url = new URL(`${this.apiBaseUrl}/${normalizedPath}`);
8514
+ if (!query) {
8515
+ return url.toString();
8516
+ }
8517
+ for (const [key, value] of Object.entries(query)) {
8518
+ if (value === void 0 || value === null || value === "") {
8519
+ continue;
8520
+ }
8521
+ if (Array.isArray(value)) {
8522
+ url.searchParams.set(key, value.map(String).join(","));
8523
+ continue;
8524
+ }
8525
+ url.searchParams.set(key, String(value));
8526
+ }
8527
+ return url.toString();
8528
+ }
8529
+ buildHeaders(headers, hasBody = false) {
8530
+ const normalizedHeaders = new Headers(headers);
8531
+ normalizedHeaders.set("Accept", "application/json");
8532
+ normalizedHeaders.set("APIKEY", this.apiKey);
8533
+ if (hasBody && !normalizedHeaders.has("Content-Type")) {
8534
+ normalizedHeaders.set("Content-Type", "application/json");
8535
+ }
8536
+ return normalizedHeaders;
8537
+ }
8538
+ async executeFetch(url, init) {
8539
+ if (this.fetchImplementation) {
8540
+ return this.fetchImplementation(url, init);
8541
+ }
8542
+ return fetchWithRetry(url, init, this.retryConfig);
8543
+ }
8544
+ async request(options) {
8545
+ const url = this.buildUrl(options.path, options.query);
8546
+ const hasBody = options.body !== void 0;
8547
+ this.logger.debug("STEL request", {
8548
+ method: options.method,
8549
+ url
8550
+ });
8551
+ const response = await this.executeFetch(url, {
8552
+ method: options.method,
8553
+ headers: this.buildHeaders(options.headers, hasBody),
8554
+ body: hasBody ? JSON.stringify(options.body) : void 0
8555
+ });
8556
+ if (!response.ok) {
8557
+ const message = await parseErrorResponse(response);
8558
+ throw new ProviderAPIError(message, "stelorder", response.status);
8559
+ }
8560
+ if (response.status === 204) {
8561
+ return void 0;
8562
+ }
8563
+ const contentType = response.headers.get("content-type") ?? "";
8564
+ if (contentType.includes("application/json")) {
8565
+ return await response.json();
8566
+ }
8567
+ return await response.text();
8568
+ }
8569
+ };
8570
+
8571
+ // src/providers/stelorder/index.ts
8572
+ var StelOrderProvider = class {
8573
+ name = "stelorder";
8574
+ version = "1.0.0";
8575
+ capabilities = STELORDER_CAPABILITIES;
8576
+ client;
8577
+ logger;
8578
+ currencyCode;
8579
+ storefrontId;
8580
+ companyName;
8581
+ constructor(config) {
8582
+ this.client = new StelOrderClient(config);
8583
+ this.logger = createLogger("StelOrderProvider", config.debug);
8584
+ this.currencyCode = config.currencyCode ?? "USD";
8585
+ this.storefrontId = config.storefrontId ?? "stelorder-primary";
8586
+ this.companyName = config.companyName ?? "Stel Order";
8587
+ this.logger.info("Initializing Stel Order provider", {
8588
+ storefrontId: this.storefrontId,
8589
+ companyName: this.companyName,
8590
+ currencyCode: this.currencyCode
8591
+ });
8592
+ }
8593
+ // ============================================
8594
+ // Product Operations
8595
+ // ============================================
8596
+ async getProduct(handle, _options) {
8597
+ this.logger.debug("getProduct", { handle });
8598
+ try {
8599
+ if (/^\d+$/.test(handle)) {
8600
+ const raw = await this.client.getOne("products", handle);
8601
+ return raw ? transformStelProduct(raw, this.currencyCode) : void 0;
8602
+ }
8603
+ const rawProducts = await this.client.list("products", { limit: 100 });
8604
+ for (const raw of rawProducts) {
8605
+ const productHandle = buildStelHandle(raw["full-reference"], raw.reference, raw.name, raw.id);
8606
+ if (productHandle === handle) {
8607
+ return transformStelProduct(raw, this.currencyCode);
8608
+ }
8609
+ }
8610
+ return void 0;
8611
+ } catch (error) {
8612
+ this.logger.error("getProduct failed", { handle, error });
8613
+ throw this.wrapError("getProduct", error);
8614
+ }
8615
+ }
8616
+ async getProducts(options) {
8617
+ this.logger.debug("getProducts", { options });
8618
+ try {
8619
+ const query = {};
8620
+ if (options?.first) {
8621
+ query.limit = options.first;
8622
+ }
8623
+ if (options?.skip) {
8624
+ query.start = options.skip;
8625
+ }
8626
+ if (typeof options?.after === "number") {
8627
+ query.start = options.after;
8628
+ }
8629
+ if (options?.sortKey) {
8630
+ query.sort = options.reverse ? `-${options.sortKey}` : options.sortKey;
8631
+ }
8632
+ if (options?.categoryIds?.length) {
8633
+ query["product-category-id"] = `in:${options.categoryIds.join(",")}`;
8634
+ }
8635
+ const rawProducts = await this.client.list("products", query);
8636
+ let products = rawProducts.filter((p) => !p.deleted && !p.inactive).map((p) => transformStelProduct(p, this.currencyCode));
8637
+ if (options?.query) {
8638
+ const needle = options.query.toLowerCase();
8639
+ products = products.filter(
8640
+ (p) => p.title.toLowerCase().includes(needle) || p.description.toLowerCase().includes(needle) || p.handle.includes(needle)
8641
+ );
8642
+ }
8643
+ return products;
8644
+ } catch (error) {
8645
+ this.logger.error("getProducts failed", { options, error });
8646
+ throw this.wrapError("getProducts", error);
8647
+ }
8648
+ }
8649
+ async getProductRecommendations(_productId) {
8650
+ return [];
8651
+ }
8652
+ // ============================================
8653
+ // Category Operations
8654
+ // ============================================
8655
+ async getCategory(idOrHandle) {
8656
+ this.logger.debug("getCategory", { idOrHandle });
8657
+ try {
8658
+ if (/^\d+$/.test(idOrHandle)) {
8659
+ const raw = await this.client.getOne("productCategories", idOrHandle);
8660
+ return raw ? transformStelCategory(raw) : void 0;
8661
+ }
8662
+ const rawCategories = await this.client.list("productCategories");
8663
+ for (const raw of rawCategories) {
8664
+ const catHandle = buildStelHandle(raw.slug, raw.name, raw.id);
8665
+ if (catHandle === idOrHandle) {
8666
+ return transformStelCategory(raw);
8667
+ }
8668
+ }
8669
+ return void 0;
8670
+ } catch (error) {
8671
+ this.logger.error("getCategory failed", { idOrHandle, error });
8672
+ throw this.wrapError("getCategory", error);
8673
+ }
8674
+ }
8675
+ async getCategories(options) {
8676
+ this.logger.debug("getCategories", { options });
8677
+ try {
8678
+ if (options?.customFetcher) {
8679
+ return options.customFetcher(options);
8680
+ }
8681
+ const query = {};
8682
+ if (options?.limit) {
8683
+ query.limit = options.limit;
8684
+ }
8685
+ if (options?.parentCategoryId) {
8686
+ query["parent-category-id"] = options.parentCategoryId;
8687
+ }
8688
+ const rawCategories = await this.client.list("productCategories", query);
8689
+ let categories = rawCategories.filter((c) => !c.deleted).map(transformStelCategory);
8690
+ if (options?.query) {
8691
+ const needle = options.query.toLowerCase();
8692
+ categories = categories.filter(
8693
+ (c) => c.name.toLowerCase().includes(needle) || c.handle.includes(needle)
8694
+ );
8695
+ }
8696
+ return categories;
8697
+ } catch (error) {
8698
+ this.logger.error("getCategories failed", { options, error });
8699
+ throw this.wrapError("getCategories", error);
8700
+ }
8701
+ }
8702
+ async getCategoryProducts(handle, options) {
8703
+ this.logger.debug("getCategoryProducts", { handle, options });
8704
+ try {
8705
+ const category = await this.getCategory(handle);
8706
+ if (!category) {
8707
+ return [];
8708
+ }
8709
+ return this.getProducts({
8710
+ categoryIds: [category.id],
8711
+ first: options?.first,
8712
+ sortKey: options?.sortKey,
8713
+ reverse: options?.reverse,
8714
+ after: options?.after
8715
+ });
8716
+ } catch (error) {
8717
+ this.logger.error("getCategoryProducts failed", { handle, error });
8718
+ throw this.wrapError("getCategoryProducts", error);
8719
+ }
8720
+ }
8721
+ // ============================================
8722
+ // Collection Operations (alias categories)
8723
+ // ============================================
8724
+ async getCollection(handle) {
8725
+ this.logger.debug("getCollection", { handle });
8726
+ try {
8727
+ if (/^\d+$/.test(handle)) {
8728
+ const raw = await this.client.getOne("productCategories", handle);
8729
+ return raw ? transformStelCategoryToCollection(raw) : void 0;
8730
+ }
8731
+ const rawCategories = await this.client.list("productCategories");
8732
+ for (const raw of rawCategories) {
8733
+ const catHandle = buildStelHandle(raw.slug, raw.name, raw.id);
8734
+ if (catHandle === handle) {
8735
+ return transformStelCategoryToCollection(raw);
8736
+ }
8737
+ }
8738
+ return void 0;
8739
+ } catch (error) {
8740
+ this.logger.error("getCollection failed", { handle, error });
8741
+ throw this.wrapError("getCollection", error);
8742
+ }
8743
+ }
8744
+ async getCollections(options) {
8745
+ this.logger.debug("getCollections", { options });
8746
+ try {
8747
+ const query = {};
8748
+ if (options?.limit) {
8749
+ query.limit = options.limit;
8750
+ }
8751
+ const rawCategories = await this.client.list("productCategories", query);
8752
+ let collections = rawCategories.filter((c) => !c.deleted).map(transformStelCategoryToCollection);
8753
+ if (options?.query) {
8754
+ const needle = options.query.toLowerCase();
8755
+ collections = collections.filter(
8756
+ (c) => c.title.toLowerCase().includes(needle) || c.handle.includes(needle)
8757
+ );
8758
+ }
8759
+ return collections;
8760
+ } catch (error) {
8761
+ this.logger.error("getCollections failed", { options, error });
8762
+ throw this.wrapError("getCollections", error);
8763
+ }
8764
+ }
8765
+ async getCollectionProducts(handle, options) {
8766
+ return this.getCategoryProducts(handle, options);
8767
+ }
8768
+ // ============================================
8769
+ // Inventory Operations
8770
+ // ============================================
8771
+ async getStockLocations(_params) {
8772
+ this.logger.debug("getStockLocations");
8773
+ try {
8774
+ const rawWarehouses = await this.client.list("warehouses");
8775
+ return rawWarehouses.filter((w) => !w.deleted).map(transformStelWarehouseToStockLocation);
8776
+ } catch (error) {
8777
+ this.logger.error("getStockLocations failed", { error });
8778
+ throw this.wrapError("getStockLocations", error);
8779
+ }
8780
+ }
8781
+ async checkInventoryLevels(variantId, _salesChannelId) {
8782
+ this.logger.debug("checkInventoryLevels", { variantId });
8783
+ try {
8784
+ const raw = await this.client.getOne("products", variantId);
8785
+ if (!raw?.["product-warehouses"]?.length) {
8786
+ return [];
8787
+ }
8788
+ return raw["product-warehouses"].map(transformStelProductWarehouseToInventoryLevel);
8789
+ } catch (error) {
8790
+ this.logger.error("checkInventoryLevels failed", { variantId, error });
8791
+ throw this.wrapError("checkInventoryLevels", error);
8792
+ }
8793
+ }
8794
+ validateCartStock(_cartId) {
8795
+ return this.notSupported("validateCartStock");
8796
+ }
8797
+ getFulfillmentOptions(_cartId, _salesChannelId) {
8798
+ return this.notSupported("getFulfillmentOptions");
8799
+ }
8800
+ // ============================================
8801
+ // Cart Operations (unsupported — STEL is ERP, not storefront)
8802
+ // ============================================
8803
+ createCart(_options) {
8804
+ return this.notSupported("createCart");
8805
+ }
8806
+ getCart(_cartId) {
8807
+ return this.notSupported("getCart");
8808
+ }
8809
+ addToCart(_cartId, _lines) {
8810
+ return this.notSupported("addToCart");
8811
+ }
8812
+ removeFromCart(_cartId, _lineIds) {
8813
+ return this.notSupported("removeFromCart");
8814
+ }
8815
+ updateCart(_cartId, _lines) {
8816
+ return this.notSupported("updateCart");
8817
+ }
8818
+ // ============================================
8819
+ // Checkout Operations (unsupported)
8820
+ // ============================================
8821
+ completeCheckout(_cartId) {
8822
+ return this.notSupported("completeCheckout");
8823
+ }
8824
+ getRegionCountries(_regionId) {
8825
+ return this.notSupported("getRegionCountries");
8826
+ }
8827
+ addShippingMethod(_cartId, _methodId) {
8828
+ return this.notSupported("addShippingMethod");
8829
+ }
8830
+ initiatePaymentSession(_cartId, _providerId) {
8831
+ return this.notSupported("initiatePaymentSession");
8832
+ }
8833
+ applyDiscountCode(_cartId, _code) {
8834
+ return this.notSupported("applyDiscountCode");
8835
+ }
8836
+ removeDiscountCode(_cartId, _code) {
8837
+ return this.notSupported("removeDiscountCode");
8838
+ }
8839
+ // ============================================
8840
+ // Payment Methods
8841
+ // ============================================
8842
+ async getPaymentMethods(_options) {
8843
+ this.logger.debug("getPaymentMethods");
8844
+ try {
8845
+ const rawOptions = await this.client.list("paymentOptions");
8846
+ return rawOptions.filter((o) => !o.deleted).map(transformStelPaymentOption);
8847
+ } catch (error) {
8848
+ this.logger.error("getPaymentMethods failed", { error });
8849
+ throw this.wrapError("getPaymentMethods", error);
8850
+ }
8851
+ }
8852
+ // ============================================
8853
+ // Shipping / Delivery Methods
8854
+ // ============================================
8855
+ async getShippingMethods(_cartId) {
8856
+ this.logger.debug("getShippingMethods (delivery options listing)");
8857
+ try {
8858
+ const rawOptions = await this.client.list("deliveryOptions");
8859
+ return rawOptions.filter((o) => !o.deleted).map((o) => transformStelDeliveryOption(o, this.currencyCode));
8860
+ } catch (error) {
8861
+ this.logger.error("getShippingMethods failed", { error });
8862
+ throw this.wrapError("getShippingMethods", error);
8863
+ }
8864
+ }
8865
+ // ============================================
8866
+ // Customer Operations (optional)
8867
+ // ============================================
8868
+ async getCustomer(customerId) {
8869
+ this.logger.debug("getCustomer", { customerId });
8870
+ try {
8871
+ const raw = await this.client.getOne("clients", customerId);
8872
+ return raw ? transformStelClient(raw) : void 0;
8873
+ } catch (error) {
8874
+ this.logger.error("getCustomer failed", { customerId, error });
8875
+ throw this.wrapError("getCustomer", error);
8876
+ }
8877
+ }
8878
+ async getCustomers(options) {
8879
+ this.logger.debug("getCustomers", { options });
8880
+ try {
8881
+ if (options?.customFetcher) {
8882
+ return options.customFetcher(options);
8883
+ }
8884
+ const query = {};
8885
+ if (options?.limit) {
8886
+ query.limit = options.limit;
8887
+ }
8888
+ if (options?.offset) {
8889
+ query.start = options.offset;
8890
+ }
8891
+ const rawClients = await this.client.list("clients", query);
8892
+ let customers = rawClients.filter((c) => !c.deleted).map(transformStelClient);
8893
+ if (options?.search) {
8894
+ const needle = options.search.toLowerCase();
8895
+ customers = customers.filter(
8896
+ (c) => c.email.toLowerCase().includes(needle) || (c.firstName ?? "").toLowerCase().includes(needle) || (c.lastName ?? "").toLowerCase().includes(needle)
8897
+ );
8898
+ }
8899
+ return customers;
8900
+ } catch (error) {
8901
+ this.logger.error("getCustomers failed", { options, error });
8902
+ throw this.wrapError("getCustomers", error);
8903
+ }
8904
+ }
8905
+ async updateCustomer(customerId, data) {
8906
+ this.logger.debug("updateCustomer", { customerId, data });
8907
+ try {
8908
+ const stelPayload = {};
8909
+ if (data.firstName || data.lastName) {
8910
+ stelPayload.name = [data.firstName, data.lastName].filter(Boolean).join(" ");
8911
+ }
8912
+ if (data.email) {
8913
+ stelPayload.email = data.email;
8914
+ }
8915
+ if (data.phone) {
8916
+ stelPayload.phone = data.phone;
8917
+ }
8918
+ const raw = await this.client.update("clients", customerId, stelPayload);
8919
+ return transformStelClient(raw);
8920
+ } catch (error) {
8921
+ this.logger.error("updateCustomer failed", { customerId, error });
8922
+ throw this.wrapError("updateCustomer", error);
8923
+ }
8924
+ }
8925
+ // ============================================
8926
+ // Order Operations (optional)
8927
+ // ============================================
8928
+ async getOrder(orderId) {
8929
+ this.logger.debug("getOrder", { orderId });
8930
+ try {
8931
+ const raw = await this.client.getOne("salesOrders", orderId);
8932
+ return raw ? transformStelSalesOrder(raw, this.currencyCode) : void 0;
8933
+ } catch (error) {
8934
+ this.logger.error("getOrder failed", { orderId, error });
8935
+ throw this.wrapError("getOrder", error);
8936
+ }
8937
+ }
8938
+ async getOrders(options) {
8939
+ this.logger.debug("getOrders", { options });
8940
+ try {
8941
+ if (options?.customFetcher) {
8942
+ return options.customFetcher(options);
8943
+ }
8944
+ const query = {};
8945
+ if (options?.limit) {
8946
+ query.limit = options.limit;
8947
+ }
8948
+ if (options?.offset) {
8949
+ query.start = options.offset;
8950
+ }
8951
+ if (options?.customerId) {
8952
+ query["client-id"] = options.customerId;
8953
+ }
8954
+ const rawOrders = await this.client.list("salesOrders", query);
8955
+ return rawOrders.filter((o) => !o.deleted).map((o) => transformStelSalesOrder(o, this.currencyCode));
8956
+ } catch (error) {
8957
+ this.logger.error("getOrders failed", { options, error });
8958
+ throw this.wrapError("getOrders", error);
8959
+ }
8960
+ }
8961
+ async getAdminOrders(options) {
8962
+ this.logger.debug("getAdminOrders", { options });
8963
+ try {
8964
+ const query = {};
8965
+ if (options?.limit) {
8966
+ query.limit = options.limit;
8967
+ }
8968
+ if (options?.offset) {
8969
+ query.start = options.offset;
8970
+ }
8971
+ const rawOrders = await this.client.list("salesOrders", query);
8972
+ let orders = rawOrders.filter((o) => !o.deleted).map((o) => transformStelSalesOrder(o, this.currencyCode));
8973
+ if (options?.search) {
8974
+ const needle = options.search.toLowerCase();
8975
+ orders = orders.filter(
8976
+ (o) => o.orderNumber.toLowerCase().includes(needle) || o.email.toLowerCase().includes(needle)
8977
+ );
8978
+ }
8979
+ if (options?.status) {
8980
+ const statuses = Array.isArray(options.status) ? options.status : [options.status];
8981
+ orders = orders.filter((o) => statuses.includes(o.status));
8982
+ }
8983
+ return { orders, count: orders.length };
8984
+ } catch (error) {
8985
+ this.logger.error("getAdminOrders failed", { options, error });
8986
+ throw this.wrapError("getAdminOrders", error);
8987
+ }
8988
+ }
8989
+ cancelOrder(_orderId) {
8990
+ return this.notSupported("cancelOrder");
8991
+ }
8992
+ createFulfillment(_orderId, _items) {
8993
+ return this.notSupported("createFulfillment");
8994
+ }
8995
+ createRefund(_orderId, _amount, _reason) {
8996
+ return this.notSupported("createRefund");
8997
+ }
8998
+ // ============================================
8999
+ // Storefront Context
9000
+ // ============================================
9001
+ async getStorefrontContext() {
9002
+ return {
9003
+ id: this.storefrontId,
9004
+ name: this.companyName,
9005
+ platformType: "stelorder",
9006
+ requiresProductScoping: false,
9007
+ currencyCode: this.currencyCode,
9008
+ metadata: {
9009
+ apiBaseUrl: this.client.apiBaseUrl,
9010
+ singleCompany: true,
9011
+ providerVersion: this.version
9012
+ }
9013
+ };
9014
+ }
9015
+ isStorefrontRequired() {
9016
+ return false;
9017
+ }
9018
+ // ============================================
9019
+ // Internal helpers
9020
+ // ============================================
9021
+ notSupported(operation) {
9022
+ return Promise.reject(
9023
+ new ProviderAPIError(
9024
+ `Stel Order does not support \`${operation}\`. STEL is an ERP adapter without cart/checkout/auth capabilities.`,
9025
+ "stelorder",
9026
+ 501
9027
+ )
9028
+ );
9029
+ }
9030
+ wrapError(operation, error) {
9031
+ if (error instanceof ProviderAPIError) {
9032
+ return error;
9033
+ }
9034
+ const message = error instanceof Error ? error.message : String(error);
9035
+ return new ProviderAPIError(
9036
+ `Stel Order \`${operation}\` failed: ${message}`,
9037
+ "stelorder",
9038
+ 500
9039
+ );
9040
+ }
9041
+ };
9042
+
7980
9043
  // src/providers/mock/mock.ts
7981
9044
  var FIXTURE_TIMESTAMP = "2026-01-01T00:00:00.000Z";
7982
9045
  var DEFAULT_SITE_URL = "https://mock.thorcommerce.local";
@@ -8996,6 +10059,8 @@ function createProvider(options) {
8996
10059
  return new MockProvider(config);
8997
10060
  case "medusa":
8998
10061
  return new MedusaProvider(config);
10062
+ case "stelorder":
10063
+ return new StelOrderProvider(config);
8999
10064
  case "shopify":
9000
10065
  return new ShopifyProvider(config);
9001
10066
  case "bigcommerce":
@@ -9039,8 +10104,10 @@ export {
9039
10104
  ResourceNotFoundError,
9040
10105
  SHOPIFY_CAPABILITIES,
9041
10106
  SPREE_CAPABILITIES,
10107
+ STELORDER_CAPABILITIES,
9042
10108
  ShopifyProvider,
9043
10109
  SpreeProvider,
10110
+ StelOrderProvider,
9044
10111
  StorefrontConfigError2 as StorefrontConfigError,
9045
10112
  WOOCOMMERCE_CAPABILITIES,
9046
10113
  WooCommerceProvider,
@@ -9049,8 +10116,11 @@ export {
9049
10116
  buildChannelScopeMetadata,
9050
10117
  calculateDistance,
9051
10118
  createBackendMetadataAdapter,
10119
+ createFetchWithRetry,
9052
10120
  createLogger,
9053
10121
  createProvider,
10122
+ extractErrorMessage,
10123
+ fetchWithRetry,
9054
10124
  filterByChannel,
9055
10125
  filterGlobalOnly,
9056
10126
  geocodeAddress,