mdd-printful-client 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (559) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/LICENSE +201 -0
  3. package/README.md +358 -0
  4. package/api-promise.d.mts +2 -0
  5. package/api-promise.d.mts.map +1 -0
  6. package/api-promise.d.ts +2 -0
  7. package/api-promise.d.ts.map +1 -0
  8. package/api-promise.js +6 -0
  9. package/api-promise.js.map +1 -0
  10. package/api-promise.mjs +2 -0
  11. package/api-promise.mjs.map +1 -0
  12. package/client.d.mts +237 -0
  13. package/client.d.mts.map +1 -0
  14. package/client.d.ts +237 -0
  15. package/client.d.ts.map +1 -0
  16. package/client.js +521 -0
  17. package/client.js.map +1 -0
  18. package/client.mjs +517 -0
  19. package/client.mjs.map +1 -0
  20. package/core/api-promise.d.mts +46 -0
  21. package/core/api-promise.d.mts.map +1 -0
  22. package/core/api-promise.d.ts +46 -0
  23. package/core/api-promise.d.ts.map +1 -0
  24. package/core/api-promise.js +74 -0
  25. package/core/api-promise.js.map +1 -0
  26. package/core/api-promise.mjs +70 -0
  27. package/core/api-promise.mjs.map +1 -0
  28. package/core/error.d.mts +46 -0
  29. package/core/error.d.mts.map +1 -0
  30. package/core/error.d.ts +46 -0
  31. package/core/error.d.ts.map +1 -0
  32. package/core/error.js +113 -0
  33. package/core/error.js.map +1 -0
  34. package/core/error.mjs +97 -0
  35. package/core/error.mjs.map +1 -0
  36. package/core/resource.d.mts +6 -0
  37. package/core/resource.d.mts.map +1 -0
  38. package/core/resource.d.ts +6 -0
  39. package/core/resource.d.ts.map +1 -0
  40. package/core/resource.js +11 -0
  41. package/core/resource.js.map +1 -0
  42. package/core/resource.mjs +7 -0
  43. package/core/resource.mjs.map +1 -0
  44. package/core/uploads.d.mts +3 -0
  45. package/core/uploads.d.mts.map +1 -0
  46. package/core/uploads.d.ts +3 -0
  47. package/core/uploads.d.ts.map +1 -0
  48. package/core/uploads.js +6 -0
  49. package/core/uploads.js.map +1 -0
  50. package/core/uploads.mjs +2 -0
  51. package/core/uploads.mjs.map +1 -0
  52. package/error.d.mts +2 -0
  53. package/error.d.mts.map +1 -0
  54. package/error.d.ts +2 -0
  55. package/error.d.ts.map +1 -0
  56. package/error.js +6 -0
  57. package/error.js.map +1 -0
  58. package/error.mjs +2 -0
  59. package/error.mjs.map +1 -0
  60. package/index.d.mts +6 -0
  61. package/index.d.mts.map +1 -0
  62. package/index.d.ts +6 -0
  63. package/index.d.ts.map +1 -0
  64. package/index.js +30 -0
  65. package/index.js.map +1 -0
  66. package/index.mjs +7 -0
  67. package/index.mjs.map +1 -0
  68. package/internal/builtin-types.d.mts +73 -0
  69. package/internal/builtin-types.d.mts.map +1 -0
  70. package/internal/builtin-types.d.ts +73 -0
  71. package/internal/builtin-types.d.ts.map +1 -0
  72. package/internal/builtin-types.js +4 -0
  73. package/internal/builtin-types.js.map +1 -0
  74. package/internal/builtin-types.mjs +3 -0
  75. package/internal/builtin-types.mjs.map +1 -0
  76. package/internal/detect-platform.d.mts +15 -0
  77. package/internal/detect-platform.d.mts.map +1 -0
  78. package/internal/detect-platform.d.ts +15 -0
  79. package/internal/detect-platform.d.ts.map +1 -0
  80. package/internal/detect-platform.js +162 -0
  81. package/internal/detect-platform.js.map +1 -0
  82. package/internal/detect-platform.mjs +157 -0
  83. package/internal/detect-platform.mjs.map +1 -0
  84. package/internal/errors.d.mts +3 -0
  85. package/internal/errors.d.mts.map +1 -0
  86. package/internal/errors.d.ts +3 -0
  87. package/internal/errors.d.ts.map +1 -0
  88. package/internal/errors.js +41 -0
  89. package/internal/errors.js.map +1 -0
  90. package/internal/errors.mjs +36 -0
  91. package/internal/errors.mjs.map +1 -0
  92. package/internal/headers.d.mts +20 -0
  93. package/internal/headers.d.mts.map +1 -0
  94. package/internal/headers.d.ts +20 -0
  95. package/internal/headers.d.ts.map +1 -0
  96. package/internal/headers.js +79 -0
  97. package/internal/headers.js.map +1 -0
  98. package/internal/headers.mjs +74 -0
  99. package/internal/headers.mjs.map +1 -0
  100. package/internal/parse.d.mts +12 -0
  101. package/internal/parse.d.mts.map +1 -0
  102. package/internal/parse.d.ts +12 -0
  103. package/internal/parse.d.ts.map +1 -0
  104. package/internal/parse.js +40 -0
  105. package/internal/parse.js.map +1 -0
  106. package/internal/parse.mjs +37 -0
  107. package/internal/parse.mjs.map +1 -0
  108. package/internal/request-options.d.mts +78 -0
  109. package/internal/request-options.d.mts.map +1 -0
  110. package/internal/request-options.d.ts +78 -0
  111. package/internal/request-options.d.ts.map +1 -0
  112. package/internal/request-options.js +14 -0
  113. package/internal/request-options.js.map +1 -0
  114. package/internal/request-options.mjs +10 -0
  115. package/internal/request-options.mjs.map +1 -0
  116. package/internal/shim-types.d.mts +17 -0
  117. package/internal/shim-types.d.mts.map +1 -0
  118. package/internal/shim-types.d.ts +17 -0
  119. package/internal/shim-types.d.ts.map +1 -0
  120. package/internal/shim-types.js +4 -0
  121. package/internal/shim-types.js.map +1 -0
  122. package/internal/shim-types.mjs +3 -0
  123. package/internal/shim-types.mjs.map +1 -0
  124. package/internal/shims.d.mts +20 -0
  125. package/internal/shims.d.mts.map +1 -0
  126. package/internal/shims.d.ts +20 -0
  127. package/internal/shims.d.ts.map +1 -0
  128. package/internal/shims.js +92 -0
  129. package/internal/shims.js.map +1 -0
  130. package/internal/shims.mjs +85 -0
  131. package/internal/shims.mjs.map +1 -0
  132. package/internal/to-file.d.mts +45 -0
  133. package/internal/to-file.d.mts.map +1 -0
  134. package/internal/to-file.d.ts +45 -0
  135. package/internal/to-file.d.ts.map +1 -0
  136. package/internal/to-file.js +91 -0
  137. package/internal/to-file.js.map +1 -0
  138. package/internal/to-file.mjs +88 -0
  139. package/internal/to-file.mjs.map +1 -0
  140. package/internal/tslib.js +81 -0
  141. package/internal/tslib.mjs +17 -0
  142. package/internal/types.d.mts +69 -0
  143. package/internal/types.d.mts.map +1 -0
  144. package/internal/types.d.ts +69 -0
  145. package/internal/types.d.ts.map +1 -0
  146. package/internal/types.js +4 -0
  147. package/internal/types.js.map +1 -0
  148. package/internal/types.mjs +3 -0
  149. package/internal/types.mjs.map +1 -0
  150. package/internal/uploads.d.mts +42 -0
  151. package/internal/uploads.d.mts.map +1 -0
  152. package/internal/uploads.d.ts +42 -0
  153. package/internal/uploads.d.ts.map +1 -0
  154. package/internal/uploads.js +141 -0
  155. package/internal/uploads.js.map +1 -0
  156. package/internal/uploads.mjs +131 -0
  157. package/internal/uploads.mjs.map +1 -0
  158. package/internal/utils/base64.d.mts +3 -0
  159. package/internal/utils/base64.d.mts.map +1 -0
  160. package/internal/utils/base64.d.ts +3 -0
  161. package/internal/utils/base64.d.ts.map +1 -0
  162. package/internal/utils/base64.js +38 -0
  163. package/internal/utils/base64.js.map +1 -0
  164. package/internal/utils/base64.mjs +33 -0
  165. package/internal/utils/base64.mjs.map +1 -0
  166. package/internal/utils/bytes.d.mts +4 -0
  167. package/internal/utils/bytes.d.mts.map +1 -0
  168. package/internal/utils/bytes.d.ts +4 -0
  169. package/internal/utils/bytes.d.ts.map +1 -0
  170. package/internal/utils/bytes.js +31 -0
  171. package/internal/utils/bytes.js.map +1 -0
  172. package/internal/utils/bytes.mjs +26 -0
  173. package/internal/utils/bytes.mjs.map +1 -0
  174. package/internal/utils/env.d.mts +9 -0
  175. package/internal/utils/env.d.mts.map +1 -0
  176. package/internal/utils/env.d.ts +9 -0
  177. package/internal/utils/env.d.ts.map +1 -0
  178. package/internal/utils/env.js +22 -0
  179. package/internal/utils/env.js.map +1 -0
  180. package/internal/utils/env.mjs +18 -0
  181. package/internal/utils/env.mjs.map +1 -0
  182. package/internal/utils/log.d.mts +37 -0
  183. package/internal/utils/log.d.mts.map +1 -0
  184. package/internal/utils/log.d.ts +37 -0
  185. package/internal/utils/log.d.ts.map +1 -0
  186. package/internal/utils/log.js +85 -0
  187. package/internal/utils/log.js.map +1 -0
  188. package/internal/utils/log.mjs +79 -0
  189. package/internal/utils/log.mjs.map +1 -0
  190. package/internal/utils/path.d.mts +15 -0
  191. package/internal/utils/path.d.mts.map +1 -0
  192. package/internal/utils/path.d.ts +15 -0
  193. package/internal/utils/path.d.ts.map +1 -0
  194. package/internal/utils/path.js +79 -0
  195. package/internal/utils/path.js.map +1 -0
  196. package/internal/utils/path.mjs +74 -0
  197. package/internal/utils/path.mjs.map +1 -0
  198. package/internal/utils/sleep.d.mts +2 -0
  199. package/internal/utils/sleep.d.mts.map +1 -0
  200. package/internal/utils/sleep.d.ts +2 -0
  201. package/internal/utils/sleep.d.ts.map +1 -0
  202. package/internal/utils/sleep.js +7 -0
  203. package/internal/utils/sleep.js.map +1 -0
  204. package/internal/utils/sleep.mjs +3 -0
  205. package/internal/utils/sleep.mjs.map +1 -0
  206. package/internal/utils/uuid.d.mts +5 -0
  207. package/internal/utils/uuid.d.mts.map +1 -0
  208. package/internal/utils/uuid.d.ts +5 -0
  209. package/internal/utils/uuid.d.ts.map +1 -0
  210. package/internal/utils/uuid.js +19 -0
  211. package/internal/utils/uuid.js.map +1 -0
  212. package/internal/utils/uuid.mjs +15 -0
  213. package/internal/utils/uuid.mjs.map +1 -0
  214. package/internal/utils/values.d.mts +18 -0
  215. package/internal/utils/values.d.mts.map +1 -0
  216. package/internal/utils/values.d.ts +18 -0
  217. package/internal/utils/values.d.ts.map +1 -0
  218. package/internal/utils/values.js +112 -0
  219. package/internal/utils/values.js.map +1 -0
  220. package/internal/utils/values.mjs +94 -0
  221. package/internal/utils/values.mjs.map +1 -0
  222. package/internal/utils.d.mts +7 -0
  223. package/internal/utils.d.mts.map +1 -0
  224. package/internal/utils.d.ts +7 -0
  225. package/internal/utils.d.ts.map +1 -0
  226. package/internal/utils.js +11 -0
  227. package/internal/utils.js.map +1 -0
  228. package/internal/utils.mjs +8 -0
  229. package/internal/utils.mjs.map +1 -0
  230. package/package.json +137 -0
  231. package/resource.d.mts +2 -0
  232. package/resource.d.mts.map +1 -0
  233. package/resource.d.ts +2 -0
  234. package/resource.d.ts.map +1 -0
  235. package/resource.js +6 -0
  236. package/resource.js.map +1 -0
  237. package/resource.mjs +2 -0
  238. package/resource.mjs.map +1 -0
  239. package/resources/approval-sheets.d.mts +164 -0
  240. package/resources/approval-sheets.d.mts.map +1 -0
  241. package/resources/approval-sheets.d.ts +164 -0
  242. package/resources/approval-sheets.d.ts.map +1 -0
  243. package/resources/approval-sheets.js +77 -0
  244. package/resources/approval-sheets.js.map +1 -0
  245. package/resources/approval-sheets.mjs +73 -0
  246. package/resources/approval-sheets.mjs.map +1 -0
  247. package/resources/categories.d.mts +88 -0
  248. package/resources/categories.d.mts.map +1 -0
  249. package/resources/categories.d.ts +88 -0
  250. package/resources/categories.d.ts.map +1 -0
  251. package/resources/categories.js +22 -0
  252. package/resources/categories.js.map +1 -0
  253. package/resources/categories.mjs +18 -0
  254. package/resources/categories.mjs.map +1 -0
  255. package/resources/countries.d.mts +46 -0
  256. package/resources/countries.d.mts.map +1 -0
  257. package/resources/countries.d.ts +46 -0
  258. package/resources/countries.d.ts.map +1 -0
  259. package/resources/countries.js +15 -0
  260. package/resources/countries.js.map +1 -0
  261. package/resources/countries.mjs +11 -0
  262. package/resources/countries.mjs.map +1 -0
  263. package/resources/files.d.mts +127 -0
  264. package/resources/files.d.mts.map +1 -0
  265. package/resources/files.d.ts +127 -0
  266. package/resources/files.d.ts.map +1 -0
  267. package/resources/files.js +73 -0
  268. package/resources/files.js.map +1 -0
  269. package/resources/files.mjs +69 -0
  270. package/resources/files.mjs.map +1 -0
  271. package/resources/index.d.mts +18 -0
  272. package/resources/index.d.mts.map +1 -0
  273. package/resources/index.d.ts +18 -0
  274. package/resources/index.d.ts.map +1 -0
  275. package/resources/index.js +39 -0
  276. package/resources/index.js.map +1 -0
  277. package/resources/index.mjs +19 -0
  278. package/resources/index.mjs.map +1 -0
  279. package/resources/mockup-generator.d.mts +651 -0
  280. package/resources/mockup-generator.d.mts.map +1 -0
  281. package/resources/mockup-generator.d.ts +651 -0
  282. package/resources/mockup-generator.d.ts.map +1 -0
  283. package/resources/mockup-generator.js +119 -0
  284. package/resources/mockup-generator.js.map +1 -0
  285. package/resources/mockup-generator.mjs +115 -0
  286. package/resources/mockup-generator.mjs.map +1 -0
  287. package/resources/oauth.d.mts +31 -0
  288. package/resources/oauth.d.mts.map +1 -0
  289. package/resources/oauth.d.ts +31 -0
  290. package/resources/oauth.d.ts.map +1 -0
  291. package/resources/oauth.js +15 -0
  292. package/resources/oauth.js.map +1 -0
  293. package/resources/oauth.mjs +11 -0
  294. package/resources/oauth.mjs.map +1 -0
  295. package/resources/orders.d.mts +923 -0
  296. package/resources/orders.d.mts.map +1 -0
  297. package/resources/orders.d.ts +923 -0
  298. package/resources/orders.d.ts.map +1 -0
  299. package/resources/orders.js +166 -0
  300. package/resources/orders.js.map +1 -0
  301. package/resources/orders.mjs +162 -0
  302. package/resources/orders.mjs.map +1 -0
  303. package/resources/product-templates.d.mts +171 -0
  304. package/resources/product-templates.d.mts.map +1 -0
  305. package/resources/product-templates.d.ts +171 -0
  306. package/resources/product-templates.d.ts.map +1 -0
  307. package/resources/product-templates.js +28 -0
  308. package/resources/product-templates.js.map +1 -0
  309. package/resources/product-templates.mjs +24 -0
  310. package/resources/product-templates.mjs.map +1 -0
  311. package/resources/products.d.mts +511 -0
  312. package/resources/products.d.mts.map +1 -0
  313. package/resources/products.d.ts +511 -0
  314. package/resources/products.d.ts.map +1 -0
  315. package/resources/products.js +35 -0
  316. package/resources/products.js.map +1 -0
  317. package/resources/products.mjs +31 -0
  318. package/resources/products.mjs.map +1 -0
  319. package/resources/reports.d.mts +363 -0
  320. package/resources/reports.d.mts.map +1 -0
  321. package/resources/reports.d.ts +363 -0
  322. package/resources/reports.d.ts.map +1 -0
  323. package/resources/reports.js +56 -0
  324. package/resources/reports.js.map +1 -0
  325. package/resources/reports.mjs +52 -0
  326. package/resources/reports.mjs.map +1 -0
  327. package/resources/shared.d.mts +304 -0
  328. package/resources/shared.d.mts.map +1 -0
  329. package/resources/shared.d.ts +304 -0
  330. package/resources/shared.d.ts.map +1 -0
  331. package/resources/shared.js +4 -0
  332. package/resources/shared.js.map +1 -0
  333. package/resources/shared.mjs +3 -0
  334. package/resources/shared.mjs.map +1 -0
  335. package/resources/shipping.d.mts +215 -0
  336. package/resources/shipping.d.mts.map +1 -0
  337. package/resources/shipping.d.ts +215 -0
  338. package/resources/shipping.d.ts.map +1 -0
  339. package/resources/shipping.js +56 -0
  340. package/resources/shipping.js.map +1 -0
  341. package/resources/shipping.mjs +52 -0
  342. package/resources/shipping.mjs.map +1 -0
  343. package/resources/store/index.d.mts +4 -0
  344. package/resources/store/index.d.mts.map +1 -0
  345. package/resources/store/index.d.ts +4 -0
  346. package/resources/store/index.d.ts.map +1 -0
  347. package/resources/store/index.js +11 -0
  348. package/resources/store/index.js.map +1 -0
  349. package/resources/store/index.mjs +5 -0
  350. package/resources/store/index.mjs.map +1 -0
  351. package/resources/store/products.d.mts +327 -0
  352. package/resources/store/products.d.mts.map +1 -0
  353. package/resources/store/products.d.ts +327 -0
  354. package/resources/store/products.d.ts.map +1 -0
  355. package/resources/store/products.js +164 -0
  356. package/resources/store/products.js.map +1 -0
  357. package/resources/store/products.mjs +160 -0
  358. package/resources/store/products.mjs.map +1 -0
  359. package/resources/store/store.d.mts +148 -0
  360. package/resources/store/store.d.mts.map +1 -0
  361. package/resources/store/store.d.ts +148 -0
  362. package/resources/store/store.d.ts.map +1 -0
  363. package/resources/store/store.js +65 -0
  364. package/resources/store/store.js.map +1 -0
  365. package/resources/store/store.mjs +60 -0
  366. package/resources/store/store.mjs.map +1 -0
  367. package/resources/store/variants.d.mts +151 -0
  368. package/resources/store/variants.d.mts.map +1 -0
  369. package/resources/store/variants.d.ts +151 -0
  370. package/resources/store/variants.d.ts.map +1 -0
  371. package/resources/store/variants.js +74 -0
  372. package/resources/store/variants.js.map +1 -0
  373. package/resources/store/variants.mjs +70 -0
  374. package/resources/store/variants.mjs.map +1 -0
  375. package/resources/store.d.mts +2 -0
  376. package/resources/store.d.mts.map +1 -0
  377. package/resources/store.d.ts +2 -0
  378. package/resources/store.d.ts.map +1 -0
  379. package/resources/store.js +6 -0
  380. package/resources/store.js.map +1 -0
  381. package/resources/store.mjs +3 -0
  382. package/resources/store.mjs.map +1 -0
  383. package/resources/sync/index.d.mts +4 -0
  384. package/resources/sync/index.d.mts.map +1 -0
  385. package/resources/sync/index.d.ts +4 -0
  386. package/resources/sync/index.d.ts.map +1 -0
  387. package/resources/sync/index.js +11 -0
  388. package/resources/sync/index.js.map +1 -0
  389. package/resources/sync/index.mjs +5 -0
  390. package/resources/sync/index.mjs.map +1 -0
  391. package/resources/sync/products.d.mts +138 -0
  392. package/resources/sync/products.d.mts.map +1 -0
  393. package/resources/sync/products.d.ts +138 -0
  394. package/resources/sync/products.d.ts.map +1 -0
  395. package/resources/sync/products.js +69 -0
  396. package/resources/sync/products.js.map +1 -0
  397. package/resources/sync/products.mjs +65 -0
  398. package/resources/sync/products.mjs.map +1 -0
  399. package/resources/sync/sync.d.mts +14 -0
  400. package/resources/sync/sync.d.mts.map +1 -0
  401. package/resources/sync/sync.d.ts +14 -0
  402. package/resources/sync/sync.d.ts.map +1 -0
  403. package/resources/sync/sync.js +21 -0
  404. package/resources/sync/sync.js.map +1 -0
  405. package/resources/sync/sync.mjs +16 -0
  406. package/resources/sync/sync.mjs.map +1 -0
  407. package/resources/sync/variant.d.mts +164 -0
  408. package/resources/sync/variant.d.mts.map +1 -0
  409. package/resources/sync/variant.d.ts +164 -0
  410. package/resources/sync/variant.d.ts.map +1 -0
  411. package/resources/sync/variant.js +78 -0
  412. package/resources/sync/variant.js.map +1 -0
  413. package/resources/sync/variant.mjs +74 -0
  414. package/resources/sync/variant.mjs.map +1 -0
  415. package/resources/sync.d.mts +2 -0
  416. package/resources/sync.d.mts.map +1 -0
  417. package/resources/sync.d.ts +2 -0
  418. package/resources/sync.d.ts.map +1 -0
  419. package/resources/sync.js +6 -0
  420. package/resources/sync.js.map +1 -0
  421. package/resources/sync.mjs +3 -0
  422. package/resources/sync.mjs.map +1 -0
  423. package/resources/tax.d.mts +122 -0
  424. package/resources/tax.d.mts.map +1 -0
  425. package/resources/tax.d.ts +122 -0
  426. package/resources/tax.d.ts.map +1 -0
  427. package/resources/tax.js +31 -0
  428. package/resources/tax.js.map +1 -0
  429. package/resources/tax.mjs +27 -0
  430. package/resources/tax.mjs.map +1 -0
  431. package/resources/warehouse/index.d.mts +3 -0
  432. package/resources/warehouse/index.d.mts.map +1 -0
  433. package/resources/warehouse/index.d.ts +3 -0
  434. package/resources/warehouse/index.d.ts.map +1 -0
  435. package/resources/warehouse/index.js +9 -0
  436. package/resources/warehouse/index.js.map +1 -0
  437. package/resources/warehouse/index.mjs +4 -0
  438. package/resources/warehouse/index.mjs.map +1 -0
  439. package/resources/warehouse/products.d.mts +311 -0
  440. package/resources/warehouse/products.d.mts.map +1 -0
  441. package/resources/warehouse/products.d.ts +311 -0
  442. package/resources/warehouse/products.d.ts.map +1 -0
  443. package/resources/warehouse/products.js +51 -0
  444. package/resources/warehouse/products.js.map +1 -0
  445. package/resources/warehouse/products.mjs +47 -0
  446. package/resources/warehouse/products.mjs.map +1 -0
  447. package/resources/warehouse/warehouse.d.mts +10 -0
  448. package/resources/warehouse/warehouse.d.mts.map +1 -0
  449. package/resources/warehouse/warehouse.d.ts +10 -0
  450. package/resources/warehouse/warehouse.d.ts.map +1 -0
  451. package/resources/warehouse/warehouse.js +17 -0
  452. package/resources/warehouse/warehouse.js.map +1 -0
  453. package/resources/warehouse/warehouse.mjs +12 -0
  454. package/resources/warehouse/warehouse.mjs.map +1 -0
  455. package/resources/warehouse.d.mts +2 -0
  456. package/resources/warehouse.d.mts.map +1 -0
  457. package/resources/warehouse.d.ts +2 -0
  458. package/resources/warehouse.d.ts.map +1 -0
  459. package/resources/warehouse.js +6 -0
  460. package/resources/warehouse.js.map +1 -0
  461. package/resources/warehouse.mjs +3 -0
  462. package/resources/warehouse.mjs.map +1 -0
  463. package/resources/webhooks.d.mts +130 -0
  464. package/resources/webhooks.d.mts.map +1 -0
  465. package/resources/webhooks.d.ts +130 -0
  466. package/resources/webhooks.d.ts.map +1 -0
  467. package/resources/webhooks.js +81 -0
  468. package/resources/webhooks.js.map +1 -0
  469. package/resources/webhooks.mjs +77 -0
  470. package/resources/webhooks.mjs.map +1 -0
  471. package/resources.d.mts +2 -0
  472. package/resources.d.mts.map +1 -0
  473. package/resources.d.ts +2 -0
  474. package/resources.d.ts.map +1 -0
  475. package/resources.js +5 -0
  476. package/resources.js.map +1 -0
  477. package/resources.mjs +2 -0
  478. package/resources.mjs.map +1 -0
  479. package/src/api-promise.ts +2 -0
  480. package/src/client.ts +1030 -0
  481. package/src/core/README.md +3 -0
  482. package/src/core/api-promise.ts +92 -0
  483. package/src/core/error.ts +130 -0
  484. package/src/core/resource.ts +11 -0
  485. package/src/core/uploads.ts +2 -0
  486. package/src/error.ts +2 -0
  487. package/src/index.ts +22 -0
  488. package/src/internal/README.md +3 -0
  489. package/src/internal/builtin-types.ts +93 -0
  490. package/src/internal/detect-platform.ts +196 -0
  491. package/src/internal/errors.ts +33 -0
  492. package/src/internal/headers.ts +97 -0
  493. package/src/internal/parse.ts +56 -0
  494. package/src/internal/request-options.ts +93 -0
  495. package/src/internal/shim-types.ts +26 -0
  496. package/src/internal/shims.ts +107 -0
  497. package/src/internal/to-file.ts +154 -0
  498. package/src/internal/types.ts +95 -0
  499. package/src/internal/uploads.ts +187 -0
  500. package/src/internal/utils/base64.ts +40 -0
  501. package/src/internal/utils/bytes.ts +32 -0
  502. package/src/internal/utils/env.ts +18 -0
  503. package/src/internal/utils/log.ts +126 -0
  504. package/src/internal/utils/path.ts +88 -0
  505. package/src/internal/utils/sleep.ts +3 -0
  506. package/src/internal/utils/uuid.ts +17 -0
  507. package/src/internal/utils/values.ts +105 -0
  508. package/src/internal/utils.ts +8 -0
  509. package/src/lib/.keep +4 -0
  510. package/src/resource.ts +2 -0
  511. package/src/resources/approval-sheets.ts +245 -0
  512. package/src/resources/categories.ts +114 -0
  513. package/src/resources/countries.ts +59 -0
  514. package/src/resources/files.ts +185 -0
  515. package/src/resources/index.ts +115 -0
  516. package/src/resources/mockup-generator.ts +830 -0
  517. package/src/resources/oauth.ts +41 -0
  518. package/src/resources/orders.ts +1212 -0
  519. package/src/resources/product-templates.ts +252 -0
  520. package/src/resources/products.ts +636 -0
  521. package/src/resources/reports.ts +443 -0
  522. package/src/resources/shared.ts +366 -0
  523. package/src/resources/shipping.ts +263 -0
  524. package/src/resources/store/index.ts +33 -0
  525. package/src/resources/store/products.ts +472 -0
  526. package/src/resources/store/store.ts +249 -0
  527. package/src/resources/store/variants.ts +227 -0
  528. package/src/resources/store.ts +3 -0
  529. package/src/resources/sync/index.ts +21 -0
  530. package/src/resources/sync/products.ts +212 -0
  531. package/src/resources/sync/sync.ts +53 -0
  532. package/src/resources/sync/variant.ts +242 -0
  533. package/src/resources/sync.ts +3 -0
  534. package/src/resources/tax.ts +156 -0
  535. package/src/resources/warehouse/index.ts +10 -0
  536. package/src/resources/warehouse/products.ts +412 -0
  537. package/src/resources/warehouse/warehouse.ts +27 -0
  538. package/src/resources/warehouse.ts +3 -0
  539. package/src/resources/webhooks.ts +192 -0
  540. package/src/resources.ts +1 -0
  541. package/src/tsconfig.json +11 -0
  542. package/src/uploads.ts +2 -0
  543. package/src/version.ts +1 -0
  544. package/uploads.d.mts +2 -0
  545. package/uploads.d.mts.map +1 -0
  546. package/uploads.d.ts +2 -0
  547. package/uploads.d.ts.map +1 -0
  548. package/uploads.js +6 -0
  549. package/uploads.js.map +1 -0
  550. package/uploads.mjs +2 -0
  551. package/uploads.mjs.map +1 -0
  552. package/version.d.mts +2 -0
  553. package/version.d.mts.map +1 -0
  554. package/version.d.ts +2 -0
  555. package/version.d.ts.map +1 -0
  556. package/version.js +5 -0
  557. package/version.js.map +1 -0
  558. package/version.mjs +2 -0
  559. package/version.mjs.map +1 -0
package/src/client.ts ADDED
@@ -0,0 +1,1030 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import type { RequestInit, RequestInfo, BodyInit } from './internal/builtin-types';
4
+ import type { HTTPMethod, PromiseOrValue, MergedRequestInit, FinalizedRequestInit } from './internal/types';
5
+ import { uuid4 } from './internal/utils/uuid';
6
+ import { validatePositiveInteger, isAbsoluteURL, safeJSON } from './internal/utils/values';
7
+ import { sleep } from './internal/utils/sleep';
8
+ export type { Logger, LogLevel } from './internal/utils/log';
9
+ import { castToError, isAbortError } from './internal/errors';
10
+ import type { APIResponseProps } from './internal/parse';
11
+ import { getPlatformHeaders } from './internal/detect-platform';
12
+ import * as Shims from './internal/shims';
13
+ import * as Opts from './internal/request-options';
14
+ import { VERSION } from './version';
15
+ import * as Errors from './core/error';
16
+ import * as Uploads from './core/uploads';
17
+ import * as API from './resources/index';
18
+ import { APIPromise } from './core/api-promise';
19
+ import {
20
+ ApprovalSheetApproveParams,
21
+ ApprovalSheetApproveResponse,
22
+ ApprovalSheetListParams,
23
+ ApprovalSheetListResponse,
24
+ ApprovalSheetSubmitChangesParams,
25
+ ApprovalSheetSubmitChangesResponse,
26
+ ApprovalSheets,
27
+ } from './resources/approval-sheets';
28
+ import { Categories, CategoryListResponse, CategoryRetrieveResponse } from './resources/categories';
29
+ import { Countries, CountryListResponse } from './resources/countries';
30
+ import {
31
+ FileCreateParams,
32
+ FileCreateResponse,
33
+ FileGetThreadColorsParams,
34
+ FileGetThreadColorsResponse,
35
+ FileRetrieveParams,
36
+ FileRetrieveResponse,
37
+ Files,
38
+ } from './resources/files';
39
+ import {
40
+ MockupGenerator,
41
+ MockupGeneratorCreateTaskParams,
42
+ MockupGeneratorCreateTaskResponse,
43
+ MockupGeneratorRetrievePrintfilesParams,
44
+ MockupGeneratorRetrievePrintfilesResponse,
45
+ MockupGeneratorRetrieveTaskResultParams,
46
+ MockupGeneratorRetrieveTaskResultResponse,
47
+ MockupGeneratorRetrieveTemplatesParams,
48
+ MockupGeneratorRetrieveTemplatesResponse,
49
+ } from './resources/mockup-generator';
50
+ import { OAuth, OAuthListScopesResponse } from './resources/oauth';
51
+ import {
52
+ Address,
53
+ Costs,
54
+ Gift,
55
+ IncompleteItem,
56
+ Item,
57
+ Option,
58
+ Order,
59
+ OrderCancelParams,
60
+ OrderCancelResponse,
61
+ OrderConfirmParams,
62
+ OrderConfirmResponse,
63
+ OrderCreateParams,
64
+ OrderCreateResponse,
65
+ OrderEstimateCostsParams,
66
+ OrderEstimateCostsResponse,
67
+ OrderListParams,
68
+ OrderListResponse,
69
+ OrderRetrieveParams,
70
+ OrderRetrieveResponse,
71
+ OrderShipmentItem,
72
+ OrderUpdateParams,
73
+ OrderUpdateResponse,
74
+ Orders,
75
+ PricingBreakdown,
76
+ RetailCosts,
77
+ Shipment,
78
+ } from './resources/orders';
79
+ import {
80
+ ProductTemplateDeleteResponse,
81
+ ProductTemplateListParams,
82
+ ProductTemplateListResponse,
83
+ ProductTemplateRetrieveResponse,
84
+ ProductTemplates,
85
+ } from './resources/product-templates';
86
+ import {
87
+ AvailableTechnique,
88
+ CatalogFileOption,
89
+ FileType,
90
+ OptionType,
91
+ Product,
92
+ ProductListParams,
93
+ ProductListResponse,
94
+ ProductRetrieveResponse,
95
+ ProductRetrieveSizeGuideParams,
96
+ ProductRetrieveSizeGuideResponse,
97
+ ProductRetrieveVariantResponse,
98
+ Products,
99
+ } from './resources/products';
100
+ import {
101
+ ReportRetrieveStatisticsParams,
102
+ ReportRetrieveStatisticsResponse,
103
+ Reports,
104
+ } from './resources/reports';
105
+ import { Shipping, ShippingCalculateRatesParams, ShippingCalculateRatesResponse } from './resources/shipping';
106
+ import {
107
+ Tax,
108
+ TaxCalculateRateParams,
109
+ TaxCalculateRateResponse,
110
+ TaxListCountriesResponse,
111
+ } from './resources/tax';
112
+ import {
113
+ WebhookCreateParams,
114
+ WebhookCreateResponse,
115
+ WebhookDeleteParams,
116
+ WebhookDeleteResponse,
117
+ WebhookInfo,
118
+ WebhookRetrieveParams,
119
+ WebhookRetrieveResponse,
120
+ Webhooks,
121
+ } from './resources/webhooks';
122
+ import {
123
+ Store,
124
+ StoreListResponse,
125
+ StoreRetrieveResponse,
126
+ StoreUpdatePackingSlipParams,
127
+ StoreUpdatePackingSlipResponse,
128
+ } from './resources/store/store';
129
+ import { Sync } from './resources/sync/sync';
130
+ import { Warehouse } from './resources/warehouse/warehouse';
131
+ import { type Fetch } from './internal/builtin-types';
132
+ import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
133
+ import { FinalRequestOptions, RequestOptions } from './internal/request-options';
134
+ import { readEnv } from './internal/utils/env';
135
+ import {
136
+ type LogLevel,
137
+ type Logger,
138
+ formatRequestDetails,
139
+ loggerFor,
140
+ parseLogLevel,
141
+ } from './internal/utils/log';
142
+ import { isEmptyObj } from './internal/utils/values';
143
+
144
+ export interface ClientOptions {
145
+ /**
146
+ * Defaults to process.env['PRINTFUL_API_KEY'].
147
+ */
148
+ apiKey?: string | null | undefined;
149
+
150
+ /**
151
+ * Override the default base URL for the API, e.g., "https://api.example.com/v2/"
152
+ *
153
+ * Defaults to process.env['PRINTFUL_BASE_URL'].
154
+ */
155
+ baseURL?: string | null | undefined;
156
+
157
+ /**
158
+ * The maximum amount of time (in milliseconds) that the client should wait for a response
159
+ * from the server before timing out a single request.
160
+ *
161
+ * Note that request timeouts are retried by default, so in a worst-case scenario you may wait
162
+ * much longer than this timeout before the promise succeeds or fails.
163
+ *
164
+ * @unit milliseconds
165
+ */
166
+ timeout?: number | undefined;
167
+ /**
168
+ * Additional `RequestInit` options to be passed to `fetch` calls.
169
+ * Properties will be overridden by per-request `fetchOptions`.
170
+ */
171
+ fetchOptions?: MergedRequestInit | undefined;
172
+
173
+ /**
174
+ * Specify a custom `fetch` function implementation.
175
+ *
176
+ * If not provided, we expect that `fetch` is defined globally.
177
+ */
178
+ fetch?: Fetch | undefined;
179
+
180
+ /**
181
+ * The maximum number of times that the client will retry a request in case of a
182
+ * temporary failure, like a network error or a 5XX error from the server.
183
+ *
184
+ * @default 2
185
+ */
186
+ maxRetries?: number | undefined;
187
+
188
+ /**
189
+ * Default headers to include with every request to the API.
190
+ *
191
+ * These can be removed in individual requests by explicitly setting the
192
+ * header to `null` in request options.
193
+ */
194
+ defaultHeaders?: HeadersLike | undefined;
195
+
196
+ /**
197
+ * Default query parameters to include with every request to the API.
198
+ *
199
+ * These can be removed in individual requests by explicitly setting the
200
+ * param to `undefined` in request options.
201
+ */
202
+ defaultQuery?: Record<string, string | undefined> | undefined;
203
+
204
+ /**
205
+ * Set the log level.
206
+ *
207
+ * Defaults to process.env['PRINTFUL_LOG'] or 'warn' if it isn't set.
208
+ */
209
+ logLevel?: LogLevel | undefined;
210
+
211
+ /**
212
+ * Set the logger.
213
+ *
214
+ * Defaults to globalThis.console.
215
+ */
216
+ logger?: Logger | undefined;
217
+ }
218
+
219
+ /**
220
+ * API Client for interfacing with the Printful API.
221
+ */
222
+ export class Printful {
223
+ apiKey: string | null;
224
+
225
+ baseURL: string;
226
+ maxRetries: number;
227
+ timeout: number;
228
+ logger: Logger;
229
+ logLevel: LogLevel | undefined;
230
+ fetchOptions: MergedRequestInit | undefined;
231
+
232
+ private fetch: Fetch;
233
+ #encoder: Opts.RequestEncoder;
234
+ protected idempotencyHeader?: string;
235
+ private _options: ClientOptions;
236
+
237
+ /**
238
+ * API Client for interfacing with the Printful API.
239
+ *
240
+ * @param {string | null | undefined} [opts.apiKey=process.env['PRINTFUL_API_KEY'] ?? null]
241
+ * @param {string} [opts.baseURL=process.env['PRINTFUL_BASE_URL'] ?? https://api.printful.com] - Override the default base URL for the API.
242
+ * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
243
+ * @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
244
+ * @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
245
+ * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
246
+ * @param {HeadersLike} opts.defaultHeaders - Default headers to include with every request to the API.
247
+ * @param {Record<string, string | undefined>} opts.defaultQuery - Default query parameters to include with every request to the API.
248
+ */
249
+ constructor({
250
+ baseURL = readEnv('PRINTFUL_BASE_URL'),
251
+ apiKey = readEnv('PRINTFUL_API_KEY') ?? null,
252
+ ...opts
253
+ }: ClientOptions = {}) {
254
+ const options: ClientOptions = {
255
+ apiKey,
256
+ ...opts,
257
+ baseURL: baseURL || `https://api.printful.com`,
258
+ };
259
+
260
+ this.baseURL = options.baseURL!;
261
+ this.timeout = options.timeout ?? Printful.DEFAULT_TIMEOUT /* 1 minute */;
262
+ this.logger = options.logger ?? console;
263
+ const defaultLogLevel = 'warn';
264
+ // Set default logLevel early so that we can log a warning in parseLogLevel.
265
+ this.logLevel = defaultLogLevel;
266
+ this.logLevel =
267
+ parseLogLevel(options.logLevel, 'ClientOptions.logLevel', this) ??
268
+ parseLogLevel(readEnv('PRINTFUL_LOG'), "process.env['PRINTFUL_LOG']", this) ??
269
+ defaultLogLevel;
270
+ this.fetchOptions = options.fetchOptions;
271
+ this.maxRetries = options.maxRetries ?? 2;
272
+ this.fetch = options.fetch ?? Shims.getDefaultFetch();
273
+ this.#encoder = Opts.FallbackEncoder;
274
+
275
+ this._options = options;
276
+
277
+ this.apiKey = apiKey;
278
+ }
279
+
280
+ /**
281
+ * Create a new client instance re-using the same options given to the current client with optional overriding.
282
+ */
283
+ withOptions(options: Partial<ClientOptions>): this {
284
+ const client = new (this.constructor as any as new (props: ClientOptions) => typeof this)({
285
+ ...this._options,
286
+ baseURL: this.baseURL,
287
+ maxRetries: this.maxRetries,
288
+ timeout: this.timeout,
289
+ logger: this.logger,
290
+ logLevel: this.logLevel,
291
+ fetch: this.fetch,
292
+ fetchOptions: this.fetchOptions,
293
+ apiKey: this.apiKey,
294
+ ...options,
295
+ });
296
+ return client;
297
+ }
298
+
299
+ /**
300
+ * Check whether the base URL is set to its default.
301
+ */
302
+ #baseURLOverridden(): boolean {
303
+ return this.baseURL !== 'https://api.printful.com';
304
+ }
305
+
306
+ protected defaultQuery(): Record<string, string | undefined> | undefined {
307
+ return this._options.defaultQuery;
308
+ }
309
+
310
+ protected validateHeaders({ values, nulls }: NullableHeaders) {
311
+ if (this.apiKey && values.get('authorization')) {
312
+ return;
313
+ }
314
+ if (nulls.has('authorization')) {
315
+ return;
316
+ }
317
+
318
+ throw new Error(
319
+ 'Could not resolve authentication method. Expected the apiKey to be set. Or for the "Authorization" headers to be explicitly omitted',
320
+ );
321
+ }
322
+
323
+ protected async authHeaders(
324
+ opts: FinalRequestOptions,
325
+ schemes: { bearerAuth?: boolean },
326
+ ): Promise<NullableHeaders | undefined> {
327
+ return buildHeaders([schemes.bearerAuth ? await this.bearerAuth(opts) : null]);
328
+ }
329
+
330
+ protected async bearerAuth(opts: FinalRequestOptions): Promise<NullableHeaders | undefined> {
331
+ if (this.apiKey == null) {
332
+ return undefined;
333
+ }
334
+ return buildHeaders([{ Authorization: `Bearer ${this.apiKey}` }]);
335
+ }
336
+
337
+ /**
338
+ * Basic re-implementation of `qs.stringify` for primitive types.
339
+ */
340
+ protected stringifyQuery(query: Record<string, unknown>): string {
341
+ return Object.entries(query)
342
+ .filter(([_, value]) => typeof value !== 'undefined')
343
+ .map(([key, value]) => {
344
+ if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
345
+ return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
346
+ }
347
+ if (value === null) {
348
+ return `${encodeURIComponent(key)}=`;
349
+ }
350
+ throw new Errors.PrintfulError(
351
+ `Cannot stringify type ${typeof value}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`,
352
+ );
353
+ })
354
+ .join('&');
355
+ }
356
+
357
+ private getUserAgent(): string {
358
+ return `${this.constructor.name}/JS ${VERSION}`;
359
+ }
360
+
361
+ protected defaultIdempotencyKey(): string {
362
+ return `stainless-node-retry-${uuid4()}`;
363
+ }
364
+
365
+ protected makeStatusError(
366
+ status: number,
367
+ error: Object,
368
+ message: string | undefined,
369
+ headers: Headers,
370
+ ): Errors.APIError {
371
+ return Errors.APIError.generate(status, error, message, headers);
372
+ }
373
+
374
+ buildURL(
375
+ path: string,
376
+ query: Record<string, unknown> | null | undefined,
377
+ defaultBaseURL?: string | undefined,
378
+ ): string {
379
+ const baseURL = (!this.#baseURLOverridden() && defaultBaseURL) || this.baseURL;
380
+ const url =
381
+ isAbsoluteURL(path) ?
382
+ new URL(path)
383
+ : new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
384
+
385
+ const defaultQuery = this.defaultQuery();
386
+ if (!isEmptyObj(defaultQuery)) {
387
+ query = { ...defaultQuery, ...query };
388
+ }
389
+
390
+ if (typeof query === 'object' && query && !Array.isArray(query)) {
391
+ url.search = this.stringifyQuery(query as Record<string, unknown>);
392
+ }
393
+
394
+ return url.toString();
395
+ }
396
+
397
+ /**
398
+ * Used as a callback for mutating the given `FinalRequestOptions` object.
399
+ */
400
+ protected async prepareOptions(options: FinalRequestOptions): Promise<void> {}
401
+
402
+ /**
403
+ * Used as a callback for mutating the given `RequestInit` object.
404
+ *
405
+ * This is useful for cases where you want to add certain headers based off of
406
+ * the request properties, e.g. `method` or `url`.
407
+ */
408
+ protected async prepareRequest(
409
+ request: RequestInit,
410
+ { url, options }: { url: string; options: FinalRequestOptions },
411
+ ): Promise<void> {}
412
+
413
+ get<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp> {
414
+ return this.methodRequest('get', path, opts);
415
+ }
416
+
417
+ post<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp> {
418
+ return this.methodRequest('post', path, opts);
419
+ }
420
+
421
+ patch<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp> {
422
+ return this.methodRequest('patch', path, opts);
423
+ }
424
+
425
+ put<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp> {
426
+ return this.methodRequest('put', path, opts);
427
+ }
428
+
429
+ delete<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp> {
430
+ return this.methodRequest('delete', path, opts);
431
+ }
432
+
433
+ private methodRequest<Rsp>(
434
+ method: HTTPMethod,
435
+ path: string,
436
+ opts?: PromiseOrValue<RequestOptions>,
437
+ ): APIPromise<Rsp> {
438
+ return this.request(
439
+ Promise.resolve(opts).then((opts) => {
440
+ return { method, path, ...opts };
441
+ }),
442
+ );
443
+ }
444
+
445
+ request<Rsp>(
446
+ options: PromiseOrValue<FinalRequestOptions>,
447
+ remainingRetries: number | null = null,
448
+ ): APIPromise<Rsp> {
449
+ return new APIPromise(this, this.makeRequest(options, remainingRetries, undefined));
450
+ }
451
+
452
+ private async makeRequest(
453
+ optionsInput: PromiseOrValue<FinalRequestOptions>,
454
+ retriesRemaining: number | null,
455
+ retryOfRequestLogID: string | undefined,
456
+ ): Promise<APIResponseProps> {
457
+ const options = await optionsInput;
458
+ const maxRetries = options.maxRetries ?? this.maxRetries;
459
+ if (retriesRemaining == null) {
460
+ retriesRemaining = maxRetries;
461
+ }
462
+
463
+ await this.prepareOptions(options);
464
+
465
+ const { req, url, timeout } = await this.buildRequest(options, {
466
+ retryCount: maxRetries - retriesRemaining,
467
+ });
468
+
469
+ await this.prepareRequest(req, { url, options });
470
+
471
+ /** Not an API request ID, just for correlating local log entries. */
472
+ const requestLogID = 'log_' + ((Math.random() * (1 << 24)) | 0).toString(16).padStart(6, '0');
473
+ const retryLogStr = retryOfRequestLogID === undefined ? '' : `, retryOf: ${retryOfRequestLogID}`;
474
+ const startTime = Date.now();
475
+
476
+ loggerFor(this).debug(
477
+ `[${requestLogID}] sending request`,
478
+ formatRequestDetails({
479
+ retryOfRequestLogID,
480
+ method: options.method,
481
+ url,
482
+ options,
483
+ headers: req.headers,
484
+ }),
485
+ );
486
+
487
+ if (options.signal?.aborted) {
488
+ throw new Errors.APIUserAbortError();
489
+ }
490
+
491
+ const controller = new AbortController();
492
+ const response = await this.fetchWithTimeout(url, req, timeout, controller).catch(castToError);
493
+ const headersTime = Date.now();
494
+
495
+ if (response instanceof globalThis.Error) {
496
+ const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
497
+ if (options.signal?.aborted) {
498
+ throw new Errors.APIUserAbortError();
499
+ }
500
+ // detect native connection timeout errors
501
+ // deno throws "TypeError: error sending request for url (https://example/): client error (Connect): tcp connect error: Operation timed out (os error 60): Operation timed out (os error 60)"
502
+ // undici throws "TypeError: fetch failed" with cause "ConnectTimeoutError: Connect Timeout Error (attempted address: example:443, timeout: 1ms)"
503
+ // others do not provide enough information to distinguish timeouts from other connection errors
504
+ const isTimeout =
505
+ isAbortError(response) ||
506
+ /timed? ?out/i.test(String(response) + ('cause' in response ? String(response.cause) : ''));
507
+ if (retriesRemaining) {
508
+ loggerFor(this).info(
509
+ `[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} - ${retryMessage}`,
510
+ );
511
+ loggerFor(this).debug(
512
+ `[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} (${retryMessage})`,
513
+ formatRequestDetails({
514
+ retryOfRequestLogID,
515
+ url,
516
+ durationMs: headersTime - startTime,
517
+ message: response.message,
518
+ }),
519
+ );
520
+ return this.retryRequest(options, retriesRemaining, retryOfRequestLogID ?? requestLogID);
521
+ }
522
+ loggerFor(this).info(
523
+ `[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} - error; no more retries left`,
524
+ );
525
+ loggerFor(this).debug(
526
+ `[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} (error; no more retries left)`,
527
+ formatRequestDetails({
528
+ retryOfRequestLogID,
529
+ url,
530
+ durationMs: headersTime - startTime,
531
+ message: response.message,
532
+ }),
533
+ );
534
+ if (isTimeout) {
535
+ throw new Errors.APIConnectionTimeoutError();
536
+ }
537
+ throw new Errors.APIConnectionError({ cause: response });
538
+ }
539
+
540
+ const responseInfo = `[${requestLogID}${retryLogStr}] ${req.method} ${url} ${
541
+ response.ok ? 'succeeded' : 'failed'
542
+ } with status ${response.status} in ${headersTime - startTime}ms`;
543
+
544
+ if (!response.ok) {
545
+ const shouldRetry = await this.shouldRetry(response);
546
+ if (retriesRemaining && shouldRetry) {
547
+ const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
548
+
549
+ // We don't need the body of this response.
550
+ await Shims.CancelReadableStream(response.body);
551
+ loggerFor(this).info(`${responseInfo} - ${retryMessage}`);
552
+ loggerFor(this).debug(
553
+ `[${requestLogID}] response error (${retryMessage})`,
554
+ formatRequestDetails({
555
+ retryOfRequestLogID,
556
+ url: response.url,
557
+ status: response.status,
558
+ headers: response.headers,
559
+ durationMs: headersTime - startTime,
560
+ }),
561
+ );
562
+ return this.retryRequest(
563
+ options,
564
+ retriesRemaining,
565
+ retryOfRequestLogID ?? requestLogID,
566
+ response.headers,
567
+ );
568
+ }
569
+
570
+ const retryMessage = shouldRetry ? `error; no more retries left` : `error; not retryable`;
571
+
572
+ loggerFor(this).info(`${responseInfo} - ${retryMessage}`);
573
+
574
+ const errText = await response.text().catch((err: any) => castToError(err).message);
575
+ const errJSON = safeJSON(errText);
576
+ const errMessage = errJSON ? undefined : errText;
577
+
578
+ loggerFor(this).debug(
579
+ `[${requestLogID}] response error (${retryMessage})`,
580
+ formatRequestDetails({
581
+ retryOfRequestLogID,
582
+ url: response.url,
583
+ status: response.status,
584
+ headers: response.headers,
585
+ message: errMessage,
586
+ durationMs: Date.now() - startTime,
587
+ }),
588
+ );
589
+
590
+ const err = this.makeStatusError(response.status, errJSON, errMessage, response.headers);
591
+ throw err;
592
+ }
593
+
594
+ loggerFor(this).info(responseInfo);
595
+ loggerFor(this).debug(
596
+ `[${requestLogID}] response start`,
597
+ formatRequestDetails({
598
+ retryOfRequestLogID,
599
+ url: response.url,
600
+ status: response.status,
601
+ headers: response.headers,
602
+ durationMs: headersTime - startTime,
603
+ }),
604
+ );
605
+
606
+ return { response, options, controller, requestLogID, retryOfRequestLogID, startTime };
607
+ }
608
+
609
+ async fetchWithTimeout(
610
+ url: RequestInfo,
611
+ init: RequestInit | undefined,
612
+ ms: number,
613
+ controller: AbortController,
614
+ ): Promise<Response> {
615
+ const { signal, method, ...options } = init || {};
616
+ const abort = this._makeAbort(controller);
617
+ if (signal) signal.addEventListener('abort', abort, { once: true });
618
+
619
+ const timeout = setTimeout(abort, ms);
620
+
621
+ const isReadableBody =
622
+ ((globalThis as any).ReadableStream && options.body instanceof (globalThis as any).ReadableStream) ||
623
+ (typeof options.body === 'object' && options.body !== null && Symbol.asyncIterator in options.body);
624
+
625
+ const fetchOptions: RequestInit = {
626
+ signal: controller.signal as any,
627
+ ...(isReadableBody ? { duplex: 'half' } : {}),
628
+ method: 'GET',
629
+ ...options,
630
+ };
631
+ if (method) {
632
+ // Custom methods like 'patch' need to be uppercased
633
+ // See https://github.com/nodejs/undici/issues/2294
634
+ fetchOptions.method = method.toUpperCase();
635
+ }
636
+
637
+ try {
638
+ // use undefined this binding; fetch errors if bound to something else in browser/cloudflare
639
+ return await this.fetch.call(undefined, url, fetchOptions);
640
+ } finally {
641
+ clearTimeout(timeout);
642
+ }
643
+ }
644
+
645
+ private async shouldRetry(response: Response): Promise<boolean> {
646
+ // Note this is not a standard header.
647
+ const shouldRetryHeader = response.headers.get('x-should-retry');
648
+
649
+ // If the server explicitly says whether or not to retry, obey.
650
+ if (shouldRetryHeader === 'true') return true;
651
+ if (shouldRetryHeader === 'false') return false;
652
+
653
+ // Retry on request timeouts.
654
+ if (response.status === 408) return true;
655
+
656
+ // Retry on lock timeouts.
657
+ if (response.status === 409) return true;
658
+
659
+ // Retry on rate limits.
660
+ if (response.status === 429) return true;
661
+
662
+ // Retry internal errors.
663
+ if (response.status >= 500) return true;
664
+
665
+ return false;
666
+ }
667
+
668
+ private async retryRequest(
669
+ options: FinalRequestOptions,
670
+ retriesRemaining: number,
671
+ requestLogID: string,
672
+ responseHeaders?: Headers | undefined,
673
+ ): Promise<APIResponseProps> {
674
+ let timeoutMillis: number | undefined;
675
+
676
+ // Note the `retry-after-ms` header may not be standard, but is a good idea and we'd like proactive support for it.
677
+ const retryAfterMillisHeader = responseHeaders?.get('retry-after-ms');
678
+ if (retryAfterMillisHeader) {
679
+ const timeoutMs = parseFloat(retryAfterMillisHeader);
680
+ if (!Number.isNaN(timeoutMs)) {
681
+ timeoutMillis = timeoutMs;
682
+ }
683
+ }
684
+
685
+ // About the Retry-After header: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After
686
+ const retryAfterHeader = responseHeaders?.get('retry-after');
687
+ if (retryAfterHeader && !timeoutMillis) {
688
+ const timeoutSeconds = parseFloat(retryAfterHeader);
689
+ if (!Number.isNaN(timeoutSeconds)) {
690
+ timeoutMillis = timeoutSeconds * 1000;
691
+ } else {
692
+ timeoutMillis = Date.parse(retryAfterHeader) - Date.now();
693
+ }
694
+ }
695
+
696
+ // If the API asks us to wait a certain amount of time (and it's a reasonable amount),
697
+ // just do what it says, but otherwise calculate a default
698
+ if (!(timeoutMillis && 0 <= timeoutMillis && timeoutMillis < 60 * 1000)) {
699
+ const maxRetries = options.maxRetries ?? this.maxRetries;
700
+ timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries);
701
+ }
702
+ await sleep(timeoutMillis);
703
+
704
+ return this.makeRequest(options, retriesRemaining - 1, requestLogID);
705
+ }
706
+
707
+ private calculateDefaultRetryTimeoutMillis(retriesRemaining: number, maxRetries: number): number {
708
+ const initialRetryDelay = 0.5;
709
+ const maxRetryDelay = 8.0;
710
+
711
+ const numRetries = maxRetries - retriesRemaining;
712
+
713
+ // Apply exponential backoff, but not more than the max.
714
+ const sleepSeconds = Math.min(initialRetryDelay * Math.pow(2, numRetries), maxRetryDelay);
715
+
716
+ // Apply some jitter, take up to at most 25 percent of the retry time.
717
+ const jitter = 1 - Math.random() * 0.25;
718
+
719
+ return sleepSeconds * jitter * 1000;
720
+ }
721
+
722
+ async buildRequest(
723
+ inputOptions: FinalRequestOptions,
724
+ { retryCount = 0 }: { retryCount?: number } = {},
725
+ ): Promise<{ req: FinalizedRequestInit; url: string; timeout: number }> {
726
+ const options = { ...inputOptions };
727
+ const { method, path, query, defaultBaseURL } = options;
728
+
729
+ const url = this.buildURL(path!, query as Record<string, unknown>, defaultBaseURL);
730
+ if ('timeout' in options) validatePositiveInteger('timeout', options.timeout);
731
+ options.timeout = options.timeout ?? this.timeout;
732
+ const { bodyHeaders, body } = this.buildBody({ options });
733
+ const reqHeaders = await this.buildHeaders({ options: inputOptions, method, bodyHeaders, retryCount });
734
+
735
+ const req: FinalizedRequestInit = {
736
+ method,
737
+ headers: reqHeaders,
738
+ ...(options.signal && { signal: options.signal }),
739
+ ...((globalThis as any).ReadableStream &&
740
+ body instanceof (globalThis as any).ReadableStream && { duplex: 'half' }),
741
+ ...(body && { body }),
742
+ ...((this.fetchOptions as any) ?? {}),
743
+ ...((options.fetchOptions as any) ?? {}),
744
+ };
745
+
746
+ return { req, url, timeout: options.timeout };
747
+ }
748
+
749
+ private async buildHeaders({
750
+ options,
751
+ method,
752
+ bodyHeaders,
753
+ retryCount,
754
+ }: {
755
+ options: FinalRequestOptions;
756
+ method: HTTPMethod;
757
+ bodyHeaders: HeadersLike;
758
+ retryCount: number;
759
+ }): Promise<Headers> {
760
+ let idempotencyHeaders: HeadersLike = {};
761
+ if (this.idempotencyHeader && method !== 'get') {
762
+ if (!options.idempotencyKey) options.idempotencyKey = this.defaultIdempotencyKey();
763
+ idempotencyHeaders[this.idempotencyHeader] = options.idempotencyKey;
764
+ }
765
+
766
+ const headers = buildHeaders([
767
+ idempotencyHeaders,
768
+ {
769
+ Accept: 'application/json',
770
+ 'User-Agent': this.getUserAgent(),
771
+ 'X-Stainless-Retry-Count': String(retryCount),
772
+ ...(options.timeout ? { 'X-Stainless-Timeout': String(Math.trunc(options.timeout / 1000)) } : {}),
773
+ ...getPlatformHeaders(),
774
+ },
775
+ await this.authHeaders(options, options.__security ?? { bearerAuth: true }),
776
+ this._options.defaultHeaders,
777
+ bodyHeaders,
778
+ options.headers,
779
+ ]);
780
+
781
+ this.validateHeaders(headers);
782
+
783
+ return headers.values;
784
+ }
785
+
786
+ private _makeAbort(controller: AbortController) {
787
+ // note: we can't just inline this method inside `fetchWithTimeout()` because then the closure
788
+ // would capture all request options, and cause a memory leak.
789
+ return () => controller.abort();
790
+ }
791
+
792
+ private buildBody({ options: { body, headers: rawHeaders } }: { options: FinalRequestOptions }): {
793
+ bodyHeaders: HeadersLike;
794
+ body: BodyInit | undefined;
795
+ } {
796
+ if (!body) {
797
+ return { bodyHeaders: undefined, body: undefined };
798
+ }
799
+ const headers = buildHeaders([rawHeaders]);
800
+ if (
801
+ // Pass raw type verbatim
802
+ ArrayBuffer.isView(body) ||
803
+ body instanceof ArrayBuffer ||
804
+ body instanceof DataView ||
805
+ (typeof body === 'string' &&
806
+ // Preserve legacy string encoding behavior for now
807
+ headers.values.has('content-type')) ||
808
+ // `Blob` is superset of `File`
809
+ ((globalThis as any).Blob && body instanceof (globalThis as any).Blob) ||
810
+ // `FormData` -> `multipart/form-data`
811
+ body instanceof FormData ||
812
+ // `URLSearchParams` -> `application/x-www-form-urlencoded`
813
+ body instanceof URLSearchParams ||
814
+ // Send chunked stream (each chunk has own `length`)
815
+ ((globalThis as any).ReadableStream && body instanceof (globalThis as any).ReadableStream)
816
+ ) {
817
+ return { bodyHeaders: undefined, body: body as BodyInit };
818
+ } else if (
819
+ typeof body === 'object' &&
820
+ (Symbol.asyncIterator in body ||
821
+ (Symbol.iterator in body && 'next' in body && typeof body.next === 'function'))
822
+ ) {
823
+ return { bodyHeaders: undefined, body: Shims.ReadableStreamFrom(body as AsyncIterable<Uint8Array>) };
824
+ } else {
825
+ return this.#encoder({ body, headers });
826
+ }
827
+ }
828
+
829
+ static Printful = this;
830
+ static DEFAULT_TIMEOUT = 60000; // 1 minute
831
+
832
+ static PrintfulError = Errors.PrintfulError;
833
+ static APIError = Errors.APIError;
834
+ static APIConnectionError = Errors.APIConnectionError;
835
+ static APIConnectionTimeoutError = Errors.APIConnectionTimeoutError;
836
+ static APIUserAbortError = Errors.APIUserAbortError;
837
+ static NotFoundError = Errors.NotFoundError;
838
+ static ConflictError = Errors.ConflictError;
839
+ static RateLimitError = Errors.RateLimitError;
840
+ static BadRequestError = Errors.BadRequestError;
841
+ static AuthenticationError = Errors.AuthenticationError;
842
+ static InternalServerError = Errors.InternalServerError;
843
+ static PermissionDeniedError = Errors.PermissionDeniedError;
844
+ static UnprocessableEntityError = Errors.UnprocessableEntityError;
845
+
846
+ static toFile = Uploads.toFile;
847
+
848
+ products: API.Products = new API.Products(this);
849
+ categories: API.Categories = new API.Categories(this);
850
+ productTemplates: API.ProductTemplates = new API.ProductTemplates(this);
851
+ orders: API.Orders = new API.Orders(this);
852
+ files: API.Files = new API.Files(this);
853
+ sync: API.Sync = new API.Sync(this);
854
+ shipping: API.Shipping = new API.Shipping(this);
855
+ countries: API.Countries = new API.Countries(this);
856
+ tax: API.Tax = new API.Tax(this);
857
+ mockupGenerator: API.MockupGenerator = new API.MockupGenerator(this);
858
+ warehouse: API.Warehouse = new API.Warehouse(this);
859
+ approvalSheets: API.ApprovalSheets = new API.ApprovalSheets(this);
860
+ webhooks: API.Webhooks = new API.Webhooks(this);
861
+ oauth: API.OAuth = new API.OAuth(this);
862
+ reports: API.Reports = new API.Reports(this);
863
+ store: API.Store = new API.Store(this);
864
+ }
865
+
866
+ Printful.Products = Products;
867
+ Printful.Categories = Categories;
868
+ Printful.ProductTemplates = ProductTemplates;
869
+ Printful.Orders = Orders;
870
+ Printful.Files = Files;
871
+ Printful.Sync = Sync;
872
+ Printful.Shipping = Shipping;
873
+ Printful.Countries = Countries;
874
+ Printful.Tax = Tax;
875
+ Printful.MockupGenerator = MockupGenerator;
876
+ Printful.Warehouse = Warehouse;
877
+ Printful.ApprovalSheets = ApprovalSheets;
878
+ Printful.Webhooks = Webhooks;
879
+ Printful.OAuth = OAuth;
880
+ Printful.Reports = Reports;
881
+ Printful.Store = Store;
882
+
883
+ export declare namespace Printful {
884
+ export type RequestOptions = Opts.RequestOptions;
885
+
886
+ export {
887
+ Products as Products,
888
+ type AvailableTechnique as AvailableTechnique,
889
+ type CatalogFileOption as CatalogFileOption,
890
+ type FileType as FileType,
891
+ type OptionType as OptionType,
892
+ type Product as Product,
893
+ type ProductRetrieveResponse as ProductRetrieveResponse,
894
+ type ProductListResponse as ProductListResponse,
895
+ type ProductRetrieveSizeGuideResponse as ProductRetrieveSizeGuideResponse,
896
+ type ProductRetrieveVariantResponse as ProductRetrieveVariantResponse,
897
+ type ProductListParams as ProductListParams,
898
+ type ProductRetrieveSizeGuideParams as ProductRetrieveSizeGuideParams,
899
+ };
900
+
901
+ export {
902
+ Categories as Categories,
903
+ type CategoryRetrieveResponse as CategoryRetrieveResponse,
904
+ type CategoryListResponse as CategoryListResponse,
905
+ };
906
+
907
+ export {
908
+ ProductTemplates as ProductTemplates,
909
+ type ProductTemplateRetrieveResponse as ProductTemplateRetrieveResponse,
910
+ type ProductTemplateListResponse as ProductTemplateListResponse,
911
+ type ProductTemplateDeleteResponse as ProductTemplateDeleteResponse,
912
+ type ProductTemplateListParams as ProductTemplateListParams,
913
+ };
914
+
915
+ export {
916
+ Orders as Orders,
917
+ type Address as Address,
918
+ type Costs as Costs,
919
+ type Gift as Gift,
920
+ type IncompleteItem as IncompleteItem,
921
+ type Item as Item,
922
+ type Option as Option,
923
+ type Order as Order,
924
+ type OrderShipmentItem as OrderShipmentItem,
925
+ type PricingBreakdown as PricingBreakdown,
926
+ type RetailCosts as RetailCosts,
927
+ type Shipment as Shipment,
928
+ type OrderCreateResponse as OrderCreateResponse,
929
+ type OrderRetrieveResponse as OrderRetrieveResponse,
930
+ type OrderUpdateResponse as OrderUpdateResponse,
931
+ type OrderListResponse as OrderListResponse,
932
+ type OrderCancelResponse as OrderCancelResponse,
933
+ type OrderConfirmResponse as OrderConfirmResponse,
934
+ type OrderEstimateCostsResponse as OrderEstimateCostsResponse,
935
+ type OrderCreateParams as OrderCreateParams,
936
+ type OrderRetrieveParams as OrderRetrieveParams,
937
+ type OrderUpdateParams as OrderUpdateParams,
938
+ type OrderListParams as OrderListParams,
939
+ type OrderCancelParams as OrderCancelParams,
940
+ type OrderConfirmParams as OrderConfirmParams,
941
+ type OrderEstimateCostsParams as OrderEstimateCostsParams,
942
+ };
943
+
944
+ export {
945
+ Files as Files,
946
+ type FileCreateResponse as FileCreateResponse,
947
+ type FileRetrieveResponse as FileRetrieveResponse,
948
+ type FileGetThreadColorsResponse as FileGetThreadColorsResponse,
949
+ type FileCreateParams as FileCreateParams,
950
+ type FileRetrieveParams as FileRetrieveParams,
951
+ type FileGetThreadColorsParams as FileGetThreadColorsParams,
952
+ };
953
+
954
+ export { Sync as Sync };
955
+
956
+ export {
957
+ Shipping as Shipping,
958
+ type ShippingCalculateRatesResponse as ShippingCalculateRatesResponse,
959
+ type ShippingCalculateRatesParams as ShippingCalculateRatesParams,
960
+ };
961
+
962
+ export { Countries as Countries, type CountryListResponse as CountryListResponse };
963
+
964
+ export {
965
+ Tax as Tax,
966
+ type TaxCalculateRateResponse as TaxCalculateRateResponse,
967
+ type TaxListCountriesResponse as TaxListCountriesResponse,
968
+ type TaxCalculateRateParams as TaxCalculateRateParams,
969
+ };
970
+
971
+ export {
972
+ MockupGenerator as MockupGenerator,
973
+ type MockupGeneratorCreateTaskResponse as MockupGeneratorCreateTaskResponse,
974
+ type MockupGeneratorRetrievePrintfilesResponse as MockupGeneratorRetrievePrintfilesResponse,
975
+ type MockupGeneratorRetrieveTaskResultResponse as MockupGeneratorRetrieveTaskResultResponse,
976
+ type MockupGeneratorRetrieveTemplatesResponse as MockupGeneratorRetrieveTemplatesResponse,
977
+ type MockupGeneratorCreateTaskParams as MockupGeneratorCreateTaskParams,
978
+ type MockupGeneratorRetrievePrintfilesParams as MockupGeneratorRetrievePrintfilesParams,
979
+ type MockupGeneratorRetrieveTaskResultParams as MockupGeneratorRetrieveTaskResultParams,
980
+ type MockupGeneratorRetrieveTemplatesParams as MockupGeneratorRetrieveTemplatesParams,
981
+ };
982
+
983
+ export { Warehouse as Warehouse };
984
+
985
+ export {
986
+ ApprovalSheets as ApprovalSheets,
987
+ type ApprovalSheetListResponse as ApprovalSheetListResponse,
988
+ type ApprovalSheetApproveResponse as ApprovalSheetApproveResponse,
989
+ type ApprovalSheetSubmitChangesResponse as ApprovalSheetSubmitChangesResponse,
990
+ type ApprovalSheetListParams as ApprovalSheetListParams,
991
+ type ApprovalSheetApproveParams as ApprovalSheetApproveParams,
992
+ type ApprovalSheetSubmitChangesParams as ApprovalSheetSubmitChangesParams,
993
+ };
994
+
995
+ export {
996
+ Webhooks as Webhooks,
997
+ type WebhookInfo as WebhookInfo,
998
+ type WebhookCreateResponse as WebhookCreateResponse,
999
+ type WebhookRetrieveResponse as WebhookRetrieveResponse,
1000
+ type WebhookDeleteResponse as WebhookDeleteResponse,
1001
+ type WebhookCreateParams as WebhookCreateParams,
1002
+ type WebhookRetrieveParams as WebhookRetrieveParams,
1003
+ type WebhookDeleteParams as WebhookDeleteParams,
1004
+ };
1005
+
1006
+ export { OAuth as OAuth, type OAuthListScopesResponse as OAuthListScopesResponse };
1007
+
1008
+ export {
1009
+ Reports as Reports,
1010
+ type ReportRetrieveStatisticsResponse as ReportRetrieveStatisticsResponse,
1011
+ type ReportRetrieveStatisticsParams as ReportRetrieveStatisticsParams,
1012
+ };
1013
+
1014
+ export {
1015
+ Store as Store,
1016
+ type StoreRetrieveResponse as StoreRetrieveResponse,
1017
+ type StoreListResponse as StoreListResponse,
1018
+ type StoreUpdatePackingSlipResponse as StoreUpdatePackingSlipResponse,
1019
+ type StoreUpdatePackingSlipParams as StoreUpdatePackingSlipParams,
1020
+ };
1021
+
1022
+ export type File = API.File;
1023
+ export type FileOption = API.FileOption;
1024
+ export type ItemOption = API.ItemOption;
1025
+ export type PackingSlip = API.PackingSlip;
1026
+ export type Paging = API.Paging;
1027
+ export type ProductVariant = API.ProductVariant;
1028
+ export type SyncProduct = API.SyncProduct;
1029
+ export type SyncVariant = API.SyncVariant;
1030
+ }