@hubcommerce/trendyol 1.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.
Files changed (235) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/LICENSE +21 -0
  3. package/README.md +257 -0
  4. package/dist/batch/poller.d.ts +23 -0
  5. package/dist/batch/poller.d.ts.map +1 -0
  6. package/dist/batch/poller.js +85 -0
  7. package/dist/batch/report.d.ts +15 -0
  8. package/dist/batch/report.d.ts.map +1 -0
  9. package/dist/batch/report.js +41 -0
  10. package/dist/batch/types.d.ts +4 -0
  11. package/dist/batch/types.d.ts.map +1 -0
  12. package/dist/batch/types.js +2 -0
  13. package/dist/claims/api.d.ts +48 -0
  14. package/dist/claims/api.d.ts.map +1 -0
  15. package/dist/claims/api.js +116 -0
  16. package/dist/claims/form.d.ts +9 -0
  17. package/dist/claims/form.d.ts.map +1 -0
  18. package/dist/claims/form.js +20 -0
  19. package/dist/claims/paths.d.ts +3 -0
  20. package/dist/claims/paths.d.ts.map +1 -0
  21. package/dist/claims/paths.js +8 -0
  22. package/dist/client.d.ts +39 -0
  23. package/dist/client.d.ts.map +1 -0
  24. package/dist/client.js +66 -0
  25. package/dist/compensation/api.d.ts +17 -0
  26. package/dist/compensation/api.d.ts.map +1 -0
  27. package/dist/compensation/api.js +37 -0
  28. package/dist/compensation/paths.d.ts +2 -0
  29. package/dist/compensation/paths.d.ts.map +1 -0
  30. package/dist/compensation/paths.js +4 -0
  31. package/dist/config.d.ts +10 -0
  32. package/dist/config.d.ts.map +1 -0
  33. package/dist/config.js +78 -0
  34. package/dist/connection.d.ts +4 -0
  35. package/dist/connection.d.ts.map +1 -0
  36. package/dist/connection.js +8 -0
  37. package/dist/constants/claim-reasons.d.ts +10 -0
  38. package/dist/constants/claim-reasons.d.ts.map +1 -0
  39. package/dist/constants/claim-reasons.js +43 -0
  40. package/dist/constants/error-codes.d.ts +3 -0
  41. package/dist/constants/error-codes.d.ts.map +1 -0
  42. package/dist/constants/error-codes.js +9 -0
  43. package/dist/constants/origins.d.ts +6 -0
  44. package/dist/constants/origins.d.ts.map +1 -0
  45. package/dist/constants/origins.js +6 -0
  46. package/dist/constants/package-status.d.ts +3 -0
  47. package/dist/constants/package-status.d.ts.map +1 -0
  48. package/dist/constants/package-status.js +15 -0
  49. package/dist/constants/page-limits.d.ts +3 -0
  50. package/dist/constants/page-limits.d.ts.map +1 -0
  51. package/dist/constants/page-limits.js +9 -0
  52. package/dist/constants.d.ts +18 -0
  53. package/dist/constants.d.ts.map +1 -0
  54. package/dist/constants.js +17 -0
  55. package/dist/errors.d.ts +27 -0
  56. package/dist/errors.d.ts.map +1 -0
  57. package/dist/errors.js +113 -0
  58. package/dist/finance/api.d.ts +39 -0
  59. package/dist/finance/api.d.ts.map +1 -0
  60. package/dist/finance/api.js +165 -0
  61. package/dist/finance/paths.d.ts +6 -0
  62. package/dist/finance/paths.d.ts.map +1 -0
  63. package/dist/finance/paths.js +16 -0
  64. package/dist/http/multipart.d.ts +10 -0
  65. package/dist/http/multipart.d.ts.map +1 -0
  66. package/dist/http/multipart.js +1 -0
  67. package/dist/http/query.d.ts +5 -0
  68. package/dist/http/query.d.ts.map +1 -0
  69. package/dist/http/query.js +24 -0
  70. package/dist/http/response.d.ts +9 -0
  71. package/dist/http/response.d.ts.map +1 -0
  72. package/dist/http/response.js +37 -0
  73. package/dist/http/signals.d.ts +5 -0
  74. package/dist/http/signals.d.ts.map +1 -0
  75. package/dist/http/signals.js +26 -0
  76. package/dist/http.d.ts +14 -0
  77. package/dist/http.d.ts.map +1 -0
  78. package/dist/http.js +180 -0
  79. package/dist/index.d.ts +61 -0
  80. package/dist/index.d.ts.map +1 -0
  81. package/dist/index.js +41 -0
  82. package/dist/inventory/api.d.ts +26 -0
  83. package/dist/inventory/api.d.ts.map +1 -0
  84. package/dist/inventory/api.js +51 -0
  85. package/dist/inventory/paths.d.ts +2 -0
  86. package/dist/inventory/paths.d.ts.map +1 -0
  87. package/dist/inventory/paths.js +4 -0
  88. package/dist/invoices/api.d.ts +23 -0
  89. package/dist/invoices/api.d.ts.map +1 -0
  90. package/dist/invoices/api.js +52 -0
  91. package/dist/labels/api.d.ts +45 -0
  92. package/dist/labels/api.d.ts.map +1 -0
  93. package/dist/labels/api.js +89 -0
  94. package/dist/labels/paths.d.ts +3 -0
  95. package/dist/labels/paths.d.ts.map +1 -0
  96. package/dist/labels/paths.js +7 -0
  97. package/dist/logger.d.ts +6 -0
  98. package/dist/logger.d.ts.map +1 -0
  99. package/dist/logger.js +47 -0
  100. package/dist/orders/api.d.ts +68 -0
  101. package/dist/orders/api.d.ts.map +1 -0
  102. package/dist/orders/api.js +69 -0
  103. package/dist/orders/created-by.d.ts +4 -0
  104. package/dist/orders/created-by.d.ts.map +1 -0
  105. package/dist/orders/created-by.js +9 -0
  106. package/dist/orders/mutations.d.ts +31 -0
  107. package/dist/orders/mutations.d.ts.map +1 -0
  108. package/dist/orders/mutations.js +139 -0
  109. package/dist/orders/paths.d.ts +4 -0
  110. package/dist/orders/paths.d.ts.map +1 -0
  111. package/dist/orders/paths.js +12 -0
  112. package/dist/orders/read.d.ts +35 -0
  113. package/dist/orders/read.d.ts.map +1 -0
  114. package/dist/orders/read.js +140 -0
  115. package/dist/orders/split.d.ts +17 -0
  116. package/dist/orders/split.d.ts.map +1 -0
  117. package/dist/orders/split.js +45 -0
  118. package/dist/orders/status.d.ts +9 -0
  119. package/dist/orders/status.d.ts.map +1 -0
  120. package/dist/orders/status.js +20 -0
  121. package/dist/orders/stream.d.ts +19 -0
  122. package/dist/orders/stream.d.ts.map +1 -0
  123. package/dist/orders/stream.js +26 -0
  124. package/dist/orders/warranty.d.ts +24 -0
  125. package/dist/orders/warranty.d.ts.map +1 -0
  126. package/dist/orders/warranty.js +30 -0
  127. package/dist/pagination.d.ts +23 -0
  128. package/dist/pagination.d.ts.map +1 -0
  129. package/dist/pagination.js +34 -0
  130. package/dist/products/api.d.ts +52 -0
  131. package/dist/products/api.d.ts.map +1 -0
  132. package/dist/products/api.js +222 -0
  133. package/dist/products/builder.d.ts +22 -0
  134. package/dist/products/builder.d.ts.map +1 -0
  135. package/dist/products/builder.js +89 -0
  136. package/dist/products/paths.d.ts +7 -0
  137. package/dist/products/paths.d.ts.map +1 -0
  138. package/dist/products/paths.js +20 -0
  139. package/dist/qna/api.d.ts +32 -0
  140. package/dist/qna/api.d.ts.map +1 -0
  141. package/dist/qna/api.js +78 -0
  142. package/dist/qna/paths.d.ts +5 -0
  143. package/dist/qna/paths.d.ts.map +1 -0
  144. package/dist/qna/paths.js +13 -0
  145. package/dist/rate-limit/governor.d.ts +11 -0
  146. package/dist/rate-limit/governor.d.ts.map +1 -0
  147. package/dist/rate-limit/governor.js +25 -0
  148. package/dist/rate-limit/groups.d.ts +15 -0
  149. package/dist/rate-limit/groups.d.ts.map +1 -0
  150. package/dist/rate-limit/groups.js +14 -0
  151. package/dist/reference/addresses-cache.d.ts +13 -0
  152. package/dist/reference/addresses-cache.d.ts.map +1 -0
  153. package/dist/reference/addresses-cache.js +33 -0
  154. package/dist/reference/api.d.ts +48 -0
  155. package/dist/reference/api.d.ts.map +1 -0
  156. package/dist/reference/api.js +215 -0
  157. package/dist/reference/paths.d.ts +12 -0
  158. package/dist/reference/paths.d.ts.map +1 -0
  159. package/dist/reference/paths.js +34 -0
  160. package/dist/retry.d.ts +6 -0
  161. package/dist/retry.d.ts.map +1 -0
  162. package/dist/retry.js +37 -0
  163. package/dist/testing/fixtures/batch-partial-fail.json +12 -0
  164. package/dist/testing/fixtures/shipment-package.json +5 -0
  165. package/dist/testing/fixtures/webhook-payload.json +4 -0
  166. package/dist/testing/fixtures.d.ts +23 -0
  167. package/dist/testing/fixtures.d.ts.map +1 -0
  168. package/dist/testing/fixtures.js +9 -0
  169. package/dist/testing/guard.d.ts +13 -0
  170. package/dist/testing/guard.d.ts.map +1 -0
  171. package/dist/testing/guard.js +32 -0
  172. package/dist/testing/index.d.ts +6 -0
  173. package/dist/testing/index.d.ts.map +1 -0
  174. package/dist/testing/index.js +4 -0
  175. package/dist/testing/paths.d.ts +5 -0
  176. package/dist/testing/paths.d.ts.map +1 -0
  177. package/dist/testing/paths.js +14 -0
  178. package/dist/testing/stage-helpers.d.ts +24 -0
  179. package/dist/testing/stage-helpers.d.ts.map +1 -0
  180. package/dist/testing/stage-helpers.js +64 -0
  181. package/dist/testing/types.d.ts +66 -0
  182. package/dist/testing/types.d.ts.map +1 -0
  183. package/dist/testing/types.js +1 -0
  184. package/dist/types/claims.d.ts +132 -0
  185. package/dist/types/claims.d.ts.map +1 -0
  186. package/dist/types/claims.js +1 -0
  187. package/dist/types/compensation.d.ts +32 -0
  188. package/dist/types/compensation.d.ts.map +1 -0
  189. package/dist/types/compensation.js +20 -0
  190. package/dist/types/finance.d.ts +98 -0
  191. package/dist/types/finance.d.ts.map +1 -0
  192. package/dist/types/finance.js +1 -0
  193. package/dist/types/inventory.d.ts +12 -0
  194. package/dist/types/inventory.d.ts.map +1 -0
  195. package/dist/types/inventory.js +1 -0
  196. package/dist/types/labels.d.ts +19 -0
  197. package/dist/types/labels.d.ts.map +1 -0
  198. package/dist/types/labels.js +1 -0
  199. package/dist/types/orders.d.ts +276 -0
  200. package/dist/types/orders.d.ts.map +1 -0
  201. package/dist/types/orders.js +1 -0
  202. package/dist/types/products.d.ts +99 -0
  203. package/dist/types/products.d.ts.map +1 -0
  204. package/dist/types/products.js +1 -0
  205. package/dist/types/qna.d.ts +51 -0
  206. package/dist/types/qna.d.ts.map +1 -0
  207. package/dist/types/qna.js +6 -0
  208. package/dist/types/reference.d.ts +78 -0
  209. package/dist/types/reference.d.ts.map +1 -0
  210. package/dist/types/reference.js +1 -0
  211. package/dist/types/webhooks.d.ts +47 -0
  212. package/dist/types/webhooks.d.ts.map +1 -0
  213. package/dist/types/webhooks.js +19 -0
  214. package/dist/types.d.ts +73 -0
  215. package/dist/types.d.ts.map +1 -0
  216. package/dist/types.js +1 -0
  217. package/dist/validate.d.ts +9 -0
  218. package/dist/validate.d.ts.map +1 -0
  219. package/dist/validate.js +70 -0
  220. package/dist/video/api.d.ts +46 -0
  221. package/dist/video/api.d.ts.map +1 -0
  222. package/dist/video/api.js +95 -0
  223. package/dist/video/paths.d.ts +3 -0
  224. package/dist/video/paths.d.ts.map +1 -0
  225. package/dist/video/paths.js +7 -0
  226. package/dist/webhooks/inbound.d.ts +33 -0
  227. package/dist/webhooks/inbound.d.ts.map +1 -0
  228. package/dist/webhooks/inbound.js +113 -0
  229. package/dist/webhooks/management.d.ts +49 -0
  230. package/dist/webhooks/management.d.ts.map +1 -0
  231. package/dist/webhooks/management.js +89 -0
  232. package/dist/webhooks/paths.d.ts +5 -0
  233. package/dist/webhooks/paths.d.ts.map +1 -0
  234. package/dist/webhooks/paths.js +13 -0
  235. package/package.json +47 -0
@@ -0,0 +1,9 @@
1
+ import type { CreateClaimIssueFields } from "../types/claims.js";
2
+ export type BuildClaimIssueFormDataInput = CreateClaimIssueFields;
3
+ /**
4
+ * createClaimIssue icin multipart FormData olusturur.
5
+ *
6
+ * claimItemIdList API'de virgulle ayrilmis string bekler.
7
+ */
8
+ export declare function buildClaimIssueFormData(input: BuildClaimIssueFormDataInput): FormData;
9
+ //# sourceMappingURL=form.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../src/claims/form.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAEjE,MAAM,MAAM,4BAA4B,GAAG,sBAAsB,CAAC;AAElE;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,4BAA4B,GAClC,QAAQ,CAqBV"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * createClaimIssue icin multipart FormData olusturur.
3
+ *
4
+ * claimItemIdList API'de virgulle ayrilmis string bekler.
5
+ */
6
+ export function buildClaimIssueFormData(input) {
7
+ const form = new FormData();
8
+ form.append("claimIssueReasonId", String(input.claimIssueReasonId));
9
+ const itemList = Array.isArray(input.claimItemIdList)
10
+ ? input.claimItemIdList.join(",")
11
+ : input.claimItemIdList;
12
+ form.append("claimItemIdList", itemList);
13
+ form.append("description", input.description);
14
+ if (input.files) {
15
+ for (const [index, file] of input.files.entries()) {
16
+ form.append("files", file.blob, file.fileName ?? `attachment-${index + 1}`);
17
+ }
18
+ }
19
+ return form;
20
+ }
@@ -0,0 +1,3 @@
1
+ export declare function claimsBase(sellerId: string): string;
2
+ export declare function claimIssueReasonsPath(): string;
3
+ //# sourceMappingURL=paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/claims/paths.ts"],"names":[],"mappings":"AAGA,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C"}
@@ -0,0 +1,8 @@
1
+ import { TRENDYOL_INTEGRATION_PREFIX } from "../constants.js";
2
+ import { orderSellerBase } from "../orders/paths.js";
3
+ export function claimsBase(sellerId) {
4
+ return `${orderSellerBase(sellerId)}/claims`;
5
+ }
6
+ export function claimIssueReasonsPath() {
7
+ return `${TRENDYOL_INTEGRATION_PREFIX}/order/claim-issue-reasons`;
8
+ }
@@ -0,0 +1,39 @@
1
+ import { BatchPoller } from "./batch/poller.js";
2
+ import { ClaimsApi } from "./claims/api.js";
3
+ import { CompensationApi } from "./compensation/api.js";
4
+ import { FinanceApi } from "./finance/api.js";
5
+ import { InventoryApi } from "./inventory/api.js";
6
+ import { InvoicesApi } from "./invoices/api.js";
7
+ import { TrendyolHttpClient } from "./http.js";
8
+ import { LabelsApi } from "./labels/api.js";
9
+ import { WarrantyApi } from "./orders/warranty.js";
10
+ import { OrdersApi } from "./orders/api.js";
11
+ import { ProductsApi } from "./products/api.js";
12
+ import { QnaApi } from "./qna/api.js";
13
+ import { ReferenceApi } from "./reference/api.js";
14
+ import { VideoApi } from "./video/api.js";
15
+ import { WebhooksApi } from "./webhooks/management.js";
16
+ import type { CategoryTreeResponse, TrendyolConfig, TrendyolResult } from "./types.js";
17
+ export declare class TrendyolClient {
18
+ readonly config: TrendyolConfig;
19
+ readonly orders: OrdersApi;
20
+ readonly claims: ClaimsApi;
21
+ readonly invoices: InvoicesApi;
22
+ readonly inventory: InventoryApi;
23
+ readonly reference: ReferenceApi;
24
+ readonly products: ProductsApi;
25
+ readonly batch: BatchPoller;
26
+ readonly video: VideoApi;
27
+ readonly warranty: WarrantyApi;
28
+ readonly webhooks: WebhooksApi;
29
+ readonly finance: FinanceApi;
30
+ readonly qna: QnaApi;
31
+ readonly labels: LabelsApi;
32
+ readonly compensation: CompensationApi;
33
+ private readonly http;
34
+ constructor(config?: Partial<TrendyolConfig>);
35
+ getHttpClient(): TrendyolHttpClient;
36
+ testConnection(): Promise<TrendyolResult<CategoryTreeResponse>>;
37
+ }
38
+ export declare function createTrendyolClient(config?: Partial<TrendyolConfig>): TrendyolClient;
39
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGxD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEvF,qBAAa,cAAc;IACzB,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAC/B,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC;IACjC,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC;IACjC,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAC/B,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAC7B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,YAAY,EAAE,eAAe,CAAC;IACvC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAqB;gBAE9B,MAAM,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC;IA0B5C,aAAa,IAAI,kBAAkB;IAInC,cAAc,IAAI,OAAO,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAAC;CAGhE;AAED,wBAAgB,oBAAoB,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,cAAc,CAErF"}
package/dist/client.js ADDED
@@ -0,0 +1,66 @@
1
+ import { BatchPoller } from "./batch/poller.js";
2
+ import { ClaimsApi } from "./claims/api.js";
3
+ import { CompensationApi } from "./compensation/api.js";
4
+ import { getTrendyolConfig } from "./config.js";
5
+ import { testConnection as testConnectionImpl } from "./connection.js";
6
+ import { FinanceApi } from "./finance/api.js";
7
+ import { InventoryApi } from "./inventory/api.js";
8
+ import { InvoicesApi } from "./invoices/api.js";
9
+ import { TrendyolHttpClient } from "./http.js";
10
+ import { LabelsApi } from "./labels/api.js";
11
+ import { WarrantyApi } from "./orders/warranty.js";
12
+ import { OrdersApi } from "./orders/api.js";
13
+ import { ProductsApi } from "./products/api.js";
14
+ import { QnaApi } from "./qna/api.js";
15
+ import { ReferenceApi } from "./reference/api.js";
16
+ import { RateLimitGovernor } from "./rate-limit/governor.js";
17
+ import { VideoApi } from "./video/api.js";
18
+ import { WebhooksApi } from "./webhooks/management.js";
19
+ export class TrendyolClient {
20
+ config;
21
+ orders;
22
+ claims;
23
+ invoices;
24
+ inventory;
25
+ reference;
26
+ products;
27
+ batch;
28
+ video;
29
+ warranty;
30
+ webhooks;
31
+ finance;
32
+ qna;
33
+ labels;
34
+ compensation;
35
+ http;
36
+ constructor(config) {
37
+ this.config = getTrendyolConfig(config);
38
+ const governor = this.config.enableClientSideLimiter
39
+ ? new RateLimitGovernor()
40
+ : undefined;
41
+ this.http = new TrendyolHttpClient(this.config, governor);
42
+ this.orders = new OrdersApi(this.http, this.config);
43
+ this.claims = new ClaimsApi(this.http, this.config);
44
+ this.invoices = new InvoicesApi(this.http, this.config);
45
+ this.inventory = new InventoryApi(this.http, this.config);
46
+ this.reference = new ReferenceApi(this.http, this.config);
47
+ this.products = new ProductsApi(this.http, this.config);
48
+ this.batch = new BatchPoller((batchRequestId, signal) => this.products.getBatchRequestResult(batchRequestId, { signal }), () => this.http.getHooks());
49
+ this.video = new VideoApi(this.http, this.config);
50
+ this.warranty = new WarrantyApi(this.http, this.config);
51
+ this.webhooks = new WebhooksApi(this.http, this.config);
52
+ this.finance = new FinanceApi(this.http, this.config);
53
+ this.qna = new QnaApi(this.http, this.config);
54
+ this.labels = new LabelsApi(this.http, this.config);
55
+ this.compensation = new CompensationApi(this.http, this.config);
56
+ }
57
+ getHttpClient() {
58
+ return this.http;
59
+ }
60
+ testConnection() {
61
+ return testConnectionImpl(this.http);
62
+ }
63
+ }
64
+ export function createTrendyolClient(config) {
65
+ return new TrendyolClient(config);
66
+ }
@@ -0,0 +1,17 @@
1
+ import type { TrendyolHttpClient } from "../http.js";
2
+ import type { TrendyolConfig, TrendyolResult } from "../types.js";
3
+ import type { CompensationTicketsResponse, GetCompensationTicketsParams } from "../types/compensation.js";
4
+ /**
5
+ * Trendyol Express tazmin (TEX) API.
6
+ */
7
+ export declare class CompensationApi {
8
+ private readonly http;
9
+ private readonly config;
10
+ constructor(http: TrendyolHttpClient, config: TrendyolConfig);
11
+ /**
12
+ * Tazmin taleplerini listeler.
13
+ * GET /integration/tex/compensation/sellers/{sellerId}/tickets
14
+ */
15
+ getCompensationTickets(params?: GetCompensationTicketsParams): Promise<TrendyolResult<CompensationTicketsResponse>>;
16
+ }
17
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/compensation/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,KAAK,EACV,2BAA2B,EAC3B,4BAA4B,EAC7B,MAAM,0BAA0B,CAAC;AAclC;;GAEG;AACH,qBAAa,eAAe;IAExB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBADN,IAAI,EAAE,kBAAkB,EACxB,MAAM,EAAE,cAAc;IAGzC;;;OAGG;IACH,sBAAsB,CACpB,MAAM,CAAC,EAAE,4BAA4B,GACpC,OAAO,CAAC,cAAc,CAAC,2BAA2B,CAAC,CAAC;CASxD"}
@@ -0,0 +1,37 @@
1
+ import { compensationTicketsPath } from "./paths.js";
2
+ function buildCompensationQuery(params) {
3
+ const query = {};
4
+ if (params?.startDate !== undefined)
5
+ query.startDate = params.startDate;
6
+ if (params?.endDate !== undefined)
7
+ query.endDate = params.endDate;
8
+ if (params?.page !== undefined)
9
+ query.page = params.page;
10
+ if (params?.size !== undefined)
11
+ query.size = params.size;
12
+ return query;
13
+ }
14
+ /**
15
+ * Trendyol Express tazmin (TEX) API.
16
+ */
17
+ export class CompensationApi {
18
+ http;
19
+ config;
20
+ constructor(http, config) {
21
+ this.http = http;
22
+ this.config = config;
23
+ }
24
+ /**
25
+ * Tazmin taleplerini listeler.
26
+ * GET /integration/tex/compensation/sellers/{sellerId}/tickets
27
+ */
28
+ getCompensationTickets(params) {
29
+ return this.http.requestJson({
30
+ method: "GET",
31
+ path: compensationTicketsPath(this.config.sellerId),
32
+ query: buildCompensationQuery(params),
33
+ retryPolicy: "safe",
34
+ signal: params?.signal,
35
+ });
36
+ }
37
+ }
@@ -0,0 +1,2 @@
1
+ export declare function compensationTicketsPath(sellerId: string): string;
2
+ //# sourceMappingURL=paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/compensation/paths.ts"],"names":[],"mappings":"AAEA,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEhE"}
@@ -0,0 +1,4 @@
1
+ import { TRENDYOL_INTEGRATION_PREFIX } from "../constants.js";
2
+ export function compensationTicketsPath(sellerId) {
3
+ return `${TRENDYOL_INTEGRATION_PREFIX}/tex/compensation/sellers/${sellerId}/tickets`;
4
+ }
@@ -0,0 +1,10 @@
1
+ import type { TrendyolConfig } from "./types.js";
2
+ export declare class TrendyolConfigError extends Error {
3
+ constructor(message: string);
4
+ }
5
+ export declare function getTrendyolConfig(overrides?: Partial<TrendyolConfig>): TrendyolConfig;
6
+ export declare function isTrendyolConfigured(): boolean;
7
+ export declare function buildBasicAuthHeader(apiKey: string, apiSecret: string): string;
8
+ export declare function buildUserAgent(integratorName: string, sellerId: string): string;
9
+ export declare function resolveGatewayUrl(config: TrendyolConfig, path: string): string;
10
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,cAAc,EAAe,MAAM,YAAY,CAAC;AAE9D,qBAAa,mBAAoB,SAAQ,KAAK;gBAChC,OAAO,EAAE,MAAM;CAI5B;AAsBD,wBAAgB,iBAAiB,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,cAAc,CAyDrF;AAED,wBAAgB,oBAAoB,IAAI,OAAO,CAO9C;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAG9E;AAED,wBAAgB,cAAc,CAAC,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE/E;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAG9E"}
package/dist/config.js ADDED
@@ -0,0 +1,78 @@
1
+ import { TRENDYOL_DEFAULT_INTEGRATOR, TRENDYOL_DEFAULT_MAX_RETRIES, TRENDYOL_DEFAULT_MAX_WEBHOOK_BYTES, TRENDYOL_DEFAULT_RETRY_BASE_MS, TRENDYOL_DEFAULT_STORE_FRONT, TRENDYOL_DEFAULT_TIMEOUT_MS, TRENDYOL_PROD_GATEWAY, TRENDYOL_STAGE_GATEWAY, } from "./constants.js";
2
+ export class TrendyolConfigError extends Error {
3
+ constructor(message) {
4
+ super(message);
5
+ this.name = "TrendyolConfigError";
6
+ }
7
+ }
8
+ function parseEnv() {
9
+ const value = process.env.TRENDYOL_ENV?.trim().toLowerCase();
10
+ return value === "production" ? "production" : "stage";
11
+ }
12
+ function defaultGateway(env) {
13
+ return env === "production" ? TRENDYOL_PROD_GATEWAY : TRENDYOL_STAGE_GATEWAY;
14
+ }
15
+ function parsePositiveInt(value, fallback) {
16
+ const parsed = Number(value);
17
+ return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback;
18
+ }
19
+ function parseBoolean(value, fallback = false) {
20
+ if (value === undefined)
21
+ return fallback;
22
+ const normalized = value.trim().toLowerCase();
23
+ return normalized === "1" || normalized === "true" || normalized === "yes";
24
+ }
25
+ export function getTrendyolConfig(overrides) {
26
+ const env = overrides?.env ?? parseEnv();
27
+ const gatewayBase = overrides?.gatewayBase ??
28
+ process.env.TRENDYOL_GATEWAY_BASE?.trim() ??
29
+ defaultGateway(env);
30
+ const sellerId = overrides?.sellerId ?? process.env.TRENDYOL_SELLER_ID?.trim() ?? "";
31
+ const apiKey = overrides?.apiKey ?? process.env.TRENDYOL_API_KEY?.trim() ?? "";
32
+ const apiSecret = overrides?.apiSecret ?? process.env.TRENDYOL_API_SECRET?.trim() ?? "";
33
+ if (!sellerId || !apiKey || !apiSecret) {
34
+ throw new TrendyolConfigError("Trendyol bilgileri eksik. TRENDYOL_SELLER_ID, TRENDYOL_API_KEY ve TRENDYOL_API_SECRET tanimlanmalidir.");
35
+ }
36
+ return {
37
+ sellerId,
38
+ apiKey,
39
+ apiSecret,
40
+ env,
41
+ integratorName: overrides?.integratorName ??
42
+ process.env.TRENDYOL_INTEGRATOR_NAME?.trim() ??
43
+ TRENDYOL_DEFAULT_INTEGRATOR,
44
+ storeFrontCode: overrides?.storeFrontCode ??
45
+ process.env.TRENDYOL_STORE_FRONT_CODE?.trim() ??
46
+ TRENDYOL_DEFAULT_STORE_FRONT,
47
+ gatewayBase: gatewayBase.replace(/\/$/, ""),
48
+ requestTimeoutMs: parsePositiveInt(overrides?.requestTimeoutMs?.toString() ??
49
+ process.env.TRENDYOL_REQUEST_TIMEOUT_MS, TRENDYOL_DEFAULT_TIMEOUT_MS),
50
+ debug: overrides?.debug ?? parseBoolean(process.env.TRENDYOL_DEBUG),
51
+ maxRetries: parsePositiveInt(overrides?.maxRetries?.toString() ?? process.env.TRENDYOL_MAX_RETRIES, TRENDYOL_DEFAULT_MAX_RETRIES),
52
+ retryBaseMs: parsePositiveInt(overrides?.retryBaseMs?.toString() ?? process.env.TRENDYOL_RETRY_BASE_MS, TRENDYOL_DEFAULT_RETRY_BASE_MS),
53
+ enableClientSideLimiter: overrides?.enableClientSideLimiter ??
54
+ parseBoolean(process.env.TRENDYOL_ENABLE_CLIENT_LIMITER),
55
+ maxWebhookBodyBytes: parsePositiveInt(overrides?.maxWebhookBodyBytes?.toString() ??
56
+ process.env.TRENDYOL_MAX_WEBHOOK_BYTES, TRENDYOL_DEFAULT_MAX_WEBHOOK_BYTES),
57
+ };
58
+ }
59
+ export function isTrendyolConfigured() {
60
+ try {
61
+ getTrendyolConfig();
62
+ return true;
63
+ }
64
+ catch {
65
+ return false;
66
+ }
67
+ }
68
+ export function buildBasicAuthHeader(apiKey, apiSecret) {
69
+ const token = Buffer.from(`${apiKey}:${apiSecret}`, "utf8").toString("base64");
70
+ return `Basic ${token}`;
71
+ }
72
+ export function buildUserAgent(integratorName, sellerId) {
73
+ return `${integratorName} - ${sellerId}`;
74
+ }
75
+ export function resolveGatewayUrl(config, path) {
76
+ const normalizedPath = path.startsWith("/") ? path : `/${path}`;
77
+ return `${config.gatewayBase}${normalizedPath}`;
78
+ }
@@ -0,0 +1,4 @@
1
+ import type { TrendyolHttpClient } from "./http.js";
2
+ import type { CategoryTreeResponse, TrendyolResult } from "./types.js";
3
+ export declare function testConnection(http: TrendyolHttpClient): Promise<TrendyolResult<CategoryTreeResponse>>;
4
+ //# sourceMappingURL=connection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEvE,wBAAsB,cAAc,CAClC,IAAI,EAAE,kBAAkB,GACvB,OAAO,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAAC,CAM/C"}
@@ -0,0 +1,8 @@
1
+ import { TRENDYOL_TEST_CONNECTION_PATH } from "./constants.js";
2
+ export async function testConnection(http) {
3
+ return http.requestJson({
4
+ method: "GET",
5
+ path: TRENDYOL_TEST_CONNECTION_PATH,
6
+ retryPolicy: "safe",
7
+ });
8
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Iade sebepleri — resmi liste (developers.trendyol.com/docs/iade-sebepleri).
3
+ * getClaims response icindeki customerClaimItemReason / trendyolClaimItemReason
4
+ * externalReasonId ile eslesir.
5
+ */
6
+ export declare const CLAIM_REASONS: ReadonlyArray<{
7
+ id: number;
8
+ name: string;
9
+ }>;
10
+ //# sourceMappingURL=claim-reasons.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claim-reasons.d.ts","sourceRoot":"","sources":["../../src/constants/claim-reasons.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,aAAa,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAqC5D,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Iade sebepleri — resmi liste (developers.trendyol.com/docs/iade-sebepleri).
3
+ * getClaims response icindeki customerClaimItemReason / trendyolClaimItemReason
4
+ * externalReasonId ile eslesir.
5
+ */
6
+ export const CLAIM_REASONS = [
7
+ { id: 51, name: "Sebep Yok" },
8
+ { id: 101, name: "Depo Kayip" },
9
+ { id: 151, name: "Capraz Hatali" },
10
+ { id: 201, name: "Musteri Iade Kayip" },
11
+ { id: 251, name: "Modelini begenmedim" },
12
+ { id: 301, name: "Kusurlu urun gonderildi" },
13
+ { id: 351, name: "Yanlis urun gonderildi" },
14
+ { id: 401, name: "Vazgecdim" },
15
+ { id: 451, name: "Diger" },
16
+ { id: 501, name: "Bedeni kucuk geldi" },
17
+ { id: 551, name: "Bedeni buyuk geldi" },
18
+ { id: 651, name: "Urun belirtilen ozelliklere sahip degil" },
19
+ { id: 701, name: "Yanlis siparis verdim" },
20
+ { id: 751, name: "Diger - Fraud Kaynakli" },
21
+ { id: 1651, name: "Kalitesini begenmedim" },
22
+ { id: 1701, name: "Kargo Teslimati Gecikmesi" },
23
+ { id: 2000, name: "Cezali Onay" },
24
+ { id: 2001, name: "Cezasiz Onay" },
25
+ { id: 2002, name: "Teknik Servis Destegi Gerekiyor" },
26
+ { id: 2003, name: "Kullanilmis Urun Sebepli Red" },
27
+ { id: 2004, name: "Hijyenik Sebepli Red" },
28
+ { id: 2005, name: "Analiz sonucu uretimden kaynakli sorun yok" },
29
+ { id: 2006, name: "Analiz Degisim" },
30
+ { id: 2007, name: "Analiz Tamirat" },
31
+ { id: 2008, name: "Urunde adet/aksesuar eksigi" },
32
+ { id: 2009, name: "Firmaya ait olmayan urun" },
33
+ { id: 2010, name: "Tekrar Sevk" },
34
+ { id: 2011, name: "Satici Tarafindan Aksiyona Cekilen" },
35
+ { id: 2012, name: "Iade Suresi Gecmis" },
36
+ { id: 2013, name: "Urun Musteride" },
37
+ { id: 2014, name: "Analize Gonder" },
38
+ { id: 2015, name: "Teslim edilemeyen gonderi" },
39
+ { id: 2017, name: "Tazmin" },
40
+ { id: 2030, name: "Daha iyi bir fiyat mevcut" },
41
+ { id: 2042, name: "Begenmedim" },
42
+ { id: 2043, name: "Urunumun parcasi/aksesuari eksik gonderildi" },
43
+ ];
@@ -0,0 +1,3 @@
1
+ export declare const TRENDYOL_ERROR_CODES: Record<string, string>;
2
+ export declare function lookupErrorMessage(code: string | number | undefined): string | undefined;
3
+ //# sourceMappingURL=error-codes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-codes.d.ts","sourceRoot":"","sources":["../../src/constants/error-codes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAIvD,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAGxF"}
@@ -0,0 +1,9 @@
1
+ export const TRENDYOL_ERROR_CODES = {
2
+ COMMON_LABEL_NOT_ALLOWED: "Ortak etiket bu paket için kullanılamaz.",
3
+ INVOICE_NUMBER_ALREADY_EXISTS: "Ayni fatura numarasi daha once kullanilmis; yeni numara gerekir.",
4
+ };
5
+ export function lookupErrorMessage(code) {
6
+ if (code === undefined)
7
+ return undefined;
8
+ return TRENDYOL_ERROR_CODES[String(code)];
9
+ }
@@ -0,0 +1,6 @@
1
+ /** Statik menşei ISO-2 tablosu — resmi dokümandan genişletilir. */
2
+ export declare const ORIGIN_COUNTRIES: ReadonlyArray<{
3
+ code: string;
4
+ name: string;
5
+ }>;
6
+ //# sourceMappingURL=origins.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"origins.d.ts","sourceRoot":"","sources":["../../src/constants/origins.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,eAAO,MAAM,gBAAgB,EAAE,aAAa,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAIjE,CAAC"}
@@ -0,0 +1,6 @@
1
+ /** Statik menşei ISO-2 tablosu — resmi dokümandan genişletilir. */
2
+ export const ORIGIN_COUNTRIES = [
3
+ { code: "TR", name: "Türkiye" },
4
+ { code: "DE", name: "Almanya" },
5
+ { code: "CN", name: "Çin" },
6
+ ];
@@ -0,0 +1,3 @@
1
+ export declare const PACKAGE_STATUSES: readonly ["Created", "Picking", "Invoiced", "Shipped", "Cancelled", "Delivered", "UnDelivered", "Returned", "UnSupplied", "AtCollectionPoint", "UnPacked", "Awaiting", "Verified"];
2
+ export type PackageStatus = (typeof PACKAGE_STATUSES)[number];
3
+ //# sourceMappingURL=package-status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-status.d.ts","sourceRoot":"","sources":["../../src/constants/package-status.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,oLAcnB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC"}
@@ -0,0 +1,15 @@
1
+ export const PACKAGE_STATUSES = [
2
+ "Created",
3
+ "Picking",
4
+ "Invoiced",
5
+ "Shipped",
6
+ "Cancelled",
7
+ "Delivered",
8
+ "UnDelivered",
9
+ "Returned",
10
+ "UnSupplied",
11
+ "AtCollectionPoint",
12
+ "UnPacked",
13
+ "Awaiting",
14
+ "Verified",
15
+ ];
@@ -0,0 +1,3 @@
1
+ export type PageLimitEndpoint = "orders" | "products" | "claims" | "qna" | "finance.paymentOrder" | "brands" | "default";
2
+ export declare const MAX_PAGE_SIZE: Record<PageLimitEndpoint, number>;
3
+ //# sourceMappingURL=page-limits.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page-limits.d.ts","sourceRoot":"","sources":["../../src/constants/page-limits.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GACzB,QAAQ,GACR,UAAU,GACV,QAAQ,GACR,KAAK,GACL,sBAAsB,GACtB,QAAQ,GACR,SAAS,CAAC;AAEd,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,iBAAiB,EAAE,MAAM,CAQ3D,CAAC"}
@@ -0,0 +1,9 @@
1
+ export const MAX_PAGE_SIZE = {
2
+ orders: 200,
3
+ products: 200,
4
+ claims: 200,
5
+ qna: 50,
6
+ "finance.paymentOrder": 10,
7
+ brands: 1000,
8
+ default: 100,
9
+ };
@@ -0,0 +1,18 @@
1
+ export declare const TRENDYOL_PROD_GATEWAY = "https://apigw.trendyol.com";
2
+ export declare const TRENDYOL_STAGE_GATEWAY = "https://stageapigw.trendyol.com";
3
+ export declare const TRENDYOL_INTEGRATION_PREFIX = "/integration";
4
+ export declare const TRENDYOL_WEBHOOK_PREFIX = "/integration/webhook";
5
+ export declare const TRENDYOL_FINANCE_PREFIX = "/integration/finance/che";
6
+ export declare const TRENDYOL_VIDEO_PREFIX = "/integration/video";
7
+ export declare const TRENDYOL_DEFAULT_INTEGRATOR = "SelfIntegration";
8
+ export declare const TRENDYOL_DEFAULT_STORE_FRONT = "TR";
9
+ export declare const TRENDYOL_DEFAULT_TIMEOUT_MS = 30000;
10
+ export declare const TRENDYOL_DEFAULT_MAX_RETRIES = 3;
11
+ export declare const TRENDYOL_DEFAULT_RETRY_BASE_MS = 500;
12
+ export declare const TRENDYOL_RETRY_DELAY_CAP_MS = 30000;
13
+ export declare const TRENDYOL_DEFAULT_MAX_WEBHOOK_BYTES: number;
14
+ /** Canonical testConnection path (side-effect free). */
15
+ export declare const TRENDYOL_TEST_CONNECTION_PATH = "/integration/product/product-categories";
16
+ /** @deprecated sapigw host — kullanilmaz. */
17
+ export declare const TRENDYOL_DEPRECATED_SAPIGW_HOST = "api.trendyol.com";
18
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,+BAA+B,CAAC;AAClE,eAAO,MAAM,sBAAsB,oCAAoC,CAAC;AAExE,eAAO,MAAM,2BAA2B,iBAAiB,CAAC;AAC1D,eAAO,MAAM,uBAAuB,yBAAyB,CAAC;AAC9D,eAAO,MAAM,uBAAuB,6BAA6B,CAAC;AAClE,eAAO,MAAM,qBAAqB,uBAAuB,CAAC;AAE1D,eAAO,MAAM,2BAA2B,oBAAoB,CAAC;AAC7D,eAAO,MAAM,4BAA4B,OAAO,CAAC;AAEjD,eAAO,MAAM,2BAA2B,QAAS,CAAC;AAClD,eAAO,MAAM,4BAA4B,IAAI,CAAC;AAC9C,eAAO,MAAM,8BAA8B,MAAM,CAAC;AAClD,eAAO,MAAM,2BAA2B,QAAS,CAAC;AAElD,eAAO,MAAM,kCAAkC,QAAkB,CAAC;AAElE,wDAAwD;AACxD,eAAO,MAAM,6BAA6B,4CAA4C,CAAC;AAEvF,6CAA6C;AAC7C,eAAO,MAAM,+BAA+B,qBAAqB,CAAC"}
@@ -0,0 +1,17 @@
1
+ export const TRENDYOL_PROD_GATEWAY = "https://apigw.trendyol.com";
2
+ export const TRENDYOL_STAGE_GATEWAY = "https://stageapigw.trendyol.com";
3
+ export const TRENDYOL_INTEGRATION_PREFIX = "/integration";
4
+ export const TRENDYOL_WEBHOOK_PREFIX = "/integration/webhook";
5
+ export const TRENDYOL_FINANCE_PREFIX = "/integration/finance/che";
6
+ export const TRENDYOL_VIDEO_PREFIX = "/integration/video";
7
+ export const TRENDYOL_DEFAULT_INTEGRATOR = "SelfIntegration";
8
+ export const TRENDYOL_DEFAULT_STORE_FRONT = "TR";
9
+ export const TRENDYOL_DEFAULT_TIMEOUT_MS = 30_000;
10
+ export const TRENDYOL_DEFAULT_MAX_RETRIES = 3;
11
+ export const TRENDYOL_DEFAULT_RETRY_BASE_MS = 500;
12
+ export const TRENDYOL_RETRY_DELAY_CAP_MS = 30_000;
13
+ export const TRENDYOL_DEFAULT_MAX_WEBHOOK_BYTES = 2 * 1024 * 1024;
14
+ /** Canonical testConnection path (side-effect free). */
15
+ export const TRENDYOL_TEST_CONNECTION_PATH = "/integration/product/product-categories";
16
+ /** @deprecated sapigw host — kullanilmaz. */
17
+ export const TRENDYOL_DEPRECATED_SAPIGW_HOST = "api.trendyol.com";
@@ -0,0 +1,27 @@
1
+ import type { TrendyolResult } from "./types.js";
2
+ export declare class TrendyolApiError extends Error {
3
+ code?: string | number;
4
+ status: number;
5
+ raw?: unknown;
6
+ retryable: boolean;
7
+ constructor(message: string, options: {
8
+ status: number;
9
+ code?: string | number;
10
+ raw?: unknown;
11
+ retryable?: boolean;
12
+ });
13
+ }
14
+ export declare class TrendyolTransportError extends Error {
15
+ retryable: boolean;
16
+ constructor(message: string, options?: {
17
+ retryable?: boolean;
18
+ });
19
+ }
20
+ export declare function isHtmlErrorBody(body: unknown): boolean;
21
+ export declare function isHtmlGatewayError(error: unknown): boolean;
22
+ export declare function isTransientGatewayError(error: unknown): boolean;
23
+ export declare function parseApiError(status: number, body: unknown, headers?: Headers): TrendyolApiError;
24
+ export declare function isRetryableStatus(status: number): boolean;
25
+ export declare function isRetryableError(error: unknown): boolean;
26
+ export declare function toFailure<T>(error: unknown, fallbackReason?: string): TrendyolResult<T>;
27
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;gBAGjB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE;QACP,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QACvB,GAAG,CAAC,EAAE,OAAO,CAAC;QACd,SAAS,CAAC,EAAE,OAAO,CAAC;KACrB;CASJ;AAED,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C,SAAS,EAAE,OAAO,CAAC;gBAEP,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE;CAK/D;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAItD;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAU1D;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAK/D;AAED,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,EACb,OAAO,CAAC,EAAE,OAAO,GAChB,gBAAgB,CAyBlB;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAiBxD;AAED,wBAAgB,SAAS,CAAC,CAAC,EACzB,KAAK,EAAE,OAAO,EACd,cAAc,SAA+B,GAC5C,cAAc,CAAC,CAAC,CAAC,CA6BnB"}