@commercelayer/sdk 7.0.0-beta.1 → 7.0.0-beta.10

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 (601) hide show
  1. package/lib/api-BYcswOJ0.d.cts +16784 -0
  2. package/lib/api-Cknm0QL_.d.ts +16784 -0
  3. package/lib/api.cjs +936 -0
  4. package/lib/api.d.cts +4 -0
  5. package/lib/api.d.ts +4 -0
  6. package/lib/api.js +275 -0
  7. package/lib/client.cjs +170 -0
  8. package/lib/client.d.cts +36 -0
  9. package/lib/client.d.ts +36 -0
  10. package/lib/client.js +161 -0
  11. package/lib/commercelayer.cjs +798 -0
  12. package/lib/commercelayer.d.cts +167 -0
  13. package/lib/commercelayer.d.ts +167 -0
  14. package/lib/commercelayer.js +768 -0
  15. package/lib/common.cjs +17 -0
  16. package/lib/common.d.cts +13 -0
  17. package/lib/common.d.ts +13 -0
  18. package/lib/common.js +13 -0
  19. package/lib/config.cjs +21 -0
  20. package/lib/config.d.cts +19 -0
  21. package/lib/config.d.ts +19 -0
  22. package/lib/config.js +17 -0
  23. package/lib/debug.cjs +19 -0
  24. package/lib/debug.d.cts +4 -0
  25. package/lib/debug.d.ts +4 -0
  26. package/lib/debug.js +15 -0
  27. package/lib/error.cjs +97 -0
  28. package/lib/error.d.cts +35 -0
  29. package/lib/error.d.ts +35 -0
  30. package/lib/error.js +91 -0
  31. package/lib/fetch.cjs +83 -0
  32. package/lib/fetch.d.cts +1 -0
  33. package/lib/fetch.d.ts +1 -0
  34. package/lib/fetch.js +76 -0
  35. package/lib/index.cjs +32 -2
  36. package/lib/index.d.cts +8 -16916
  37. package/lib/index.d.ts +8 -16916
  38. package/lib/index.js +3 -2
  39. package/lib/instance.cjs +272 -0
  40. package/lib/instance.d.cts +141 -0
  41. package/lib/instance.d.ts +141 -0
  42. package/lib/instance.js +139 -0
  43. package/lib/interceptor-5MISI1yn.d.cts +54 -0
  44. package/lib/interceptor-5MISI1yn.d.ts +54 -0
  45. package/lib/interceptor.cjs +2 -0
  46. package/lib/interceptor.d.cts +1 -0
  47. package/lib/interceptor.d.ts +1 -0
  48. package/lib/interceptor.js +1 -0
  49. package/lib/jsonapi.cjs +79 -0
  50. package/lib/jsonapi.d.cts +11 -0
  51. package/lib/jsonapi.d.ts +11 -0
  52. package/lib/jsonapi.js +71 -0
  53. package/lib/model.cjs +2 -0
  54. package/lib/model.d.cts +4 -0
  55. package/lib/model.d.ts +4 -0
  56. package/lib/model.js +1 -0
  57. package/lib/query.cjs +64 -0
  58. package/lib/query.d.cts +4 -0
  59. package/lib/query.d.ts +4 -0
  60. package/lib/query.js +56 -0
  61. package/lib/resource.cjs +222 -0
  62. package/lib/resource.d.cts +4 -0
  63. package/lib/resource.d.ts +4 -0
  64. package/lib/resource.js +209 -0
  65. package/lib/resources/addresses.cjs +53 -0
  66. package/lib/resources/addresses.d.cts +4 -0
  67. package/lib/resources/addresses.d.ts +4 -0
  68. package/lib/resources/addresses.js +49 -0
  69. package/lib/resources/adjustments.cjs +41 -0
  70. package/lib/resources/adjustments.d.cts +4 -0
  71. package/lib/resources/adjustments.d.ts +4 -0
  72. package/lib/resources/adjustments.js +37 -0
  73. package/lib/resources/adyen_gateways.cjs +49 -0
  74. package/lib/resources/adyen_gateways.d.cts +4 -0
  75. package/lib/resources/adyen_gateways.d.ts +4 -0
  76. package/lib/resources/adyen_gateways.js +45 -0
  77. package/lib/resources/adyen_payments.cjs +55 -0
  78. package/lib/resources/adyen_payments.d.cts +4 -0
  79. package/lib/resources/adyen_payments.d.ts +4 -0
  80. package/lib/resources/adyen_payments.js +51 -0
  81. package/lib/resources/applications.cjs +31 -0
  82. package/lib/resources/applications.d.cts +4 -0
  83. package/lib/resources/applications.d.ts +4 -0
  84. package/lib/resources/applications.js +27 -0
  85. package/lib/resources/attachments.cjs +37 -0
  86. package/lib/resources/attachments.d.cts +4 -0
  87. package/lib/resources/attachments.d.ts +4 -0
  88. package/lib/resources/attachments.js +33 -0
  89. package/lib/resources/authorizations.cjs +70 -0
  90. package/lib/resources/authorizations.d.cts +4 -0
  91. package/lib/resources/authorizations.d.ts +4 -0
  92. package/lib/resources/authorizations.js +66 -0
  93. package/lib/resources/avalara_accounts.cjs +57 -0
  94. package/lib/resources/avalara_accounts.d.cts +4 -0
  95. package/lib/resources/avalara_accounts.d.ts +4 -0
  96. package/lib/resources/avalara_accounts.js +53 -0
  97. package/lib/resources/axerve_gateways.cjs +49 -0
  98. package/lib/resources/axerve_gateways.d.cts +4 -0
  99. package/lib/resources/axerve_gateways.d.ts +4 -0
  100. package/lib/resources/axerve_gateways.js +45 -0
  101. package/lib/resources/axerve_payments.cjs +52 -0
  102. package/lib/resources/axerve_payments.d.cts +4 -0
  103. package/lib/resources/axerve_payments.d.ts +4 -0
  104. package/lib/resources/axerve_payments.js +48 -0
  105. package/lib/resources/bing_geocoders.cjs +49 -0
  106. package/lib/resources/bing_geocoders.d.cts +4 -0
  107. package/lib/resources/bing_geocoders.d.ts +4 -0
  108. package/lib/resources/bing_geocoders.js +45 -0
  109. package/lib/resources/braintree_gateways.cjs +49 -0
  110. package/lib/resources/braintree_gateways.d.cts +4 -0
  111. package/lib/resources/braintree_gateways.d.ts +4 -0
  112. package/lib/resources/braintree_gateways.js +45 -0
  113. package/lib/resources/braintree_payments.cjs +49 -0
  114. package/lib/resources/braintree_payments.d.cts +4 -0
  115. package/lib/resources/braintree_payments.d.ts +4 -0
  116. package/lib/resources/braintree_payments.js +45 -0
  117. package/lib/resources/bundles.cjs +71 -0
  118. package/lib/resources/bundles.d.cts +4 -0
  119. package/lib/resources/bundles.d.ts +4 -0
  120. package/lib/resources/bundles.js +67 -0
  121. package/lib/resources/buy_x_pay_y_promotions.cjs +91 -0
  122. package/lib/resources/buy_x_pay_y_promotions.d.cts +4 -0
  123. package/lib/resources/buy_x_pay_y_promotions.d.ts +4 -0
  124. package/lib/resources/buy_x_pay_y_promotions.js +87 -0
  125. package/lib/resources/captures.cjs +71 -0
  126. package/lib/resources/captures.d.cts +4 -0
  127. package/lib/resources/captures.d.ts +4 -0
  128. package/lib/resources/captures.js +67 -0
  129. package/lib/resources/carrier_accounts.cjs +49 -0
  130. package/lib/resources/carrier_accounts.d.cts +4 -0
  131. package/lib/resources/carrier_accounts.d.ts +4 -0
  132. package/lib/resources/carrier_accounts.js +45 -0
  133. package/lib/resources/checkout_com_gateways.cjs +49 -0
  134. package/lib/resources/checkout_com_gateways.d.cts +4 -0
  135. package/lib/resources/checkout_com_gateways.d.ts +4 -0
  136. package/lib/resources/checkout_com_gateways.js +45 -0
  137. package/lib/resources/checkout_com_payments.cjs +55 -0
  138. package/lib/resources/checkout_com_payments.d.cts +4 -0
  139. package/lib/resources/checkout_com_payments.d.ts +4 -0
  140. package/lib/resources/checkout_com_payments.js +51 -0
  141. package/lib/resources/cleanups.cjs +48 -0
  142. package/lib/resources/cleanups.d.cts +4 -0
  143. package/lib/resources/cleanups.d.ts +4 -0
  144. package/lib/resources/cleanups.js +44 -0
  145. package/lib/resources/coupon_codes_promotion_rules.cjs +45 -0
  146. package/lib/resources/coupon_codes_promotion_rules.d.cts +4 -0
  147. package/lib/resources/coupon_codes_promotion_rules.d.ts +4 -0
  148. package/lib/resources/coupon_codes_promotion_rules.js +41 -0
  149. package/lib/resources/coupon_recipients.cjs +49 -0
  150. package/lib/resources/coupon_recipients.d.cts +4 -0
  151. package/lib/resources/coupon_recipients.d.ts +4 -0
  152. package/lib/resources/coupon_recipients.js +45 -0
  153. package/lib/resources/coupons.cjs +57 -0
  154. package/lib/resources/coupons.d.cts +4 -0
  155. package/lib/resources/coupons.d.ts +4 -0
  156. package/lib/resources/coupons.js +53 -0
  157. package/lib/resources/custom_promotion_rules.cjs +41 -0
  158. package/lib/resources/custom_promotion_rules.d.cts +4 -0
  159. package/lib/resources/custom_promotion_rules.d.ts +4 -0
  160. package/lib/resources/custom_promotion_rules.js +37 -0
  161. package/lib/resources/customer_addresses.cjs +53 -0
  162. package/lib/resources/customer_addresses.d.cts +4 -0
  163. package/lib/resources/customer_addresses.d.ts +4 -0
  164. package/lib/resources/customer_addresses.js +49 -0
  165. package/lib/resources/customer_groups.cjs +53 -0
  166. package/lib/resources/customer_groups.d.cts +4 -0
  167. package/lib/resources/customer_groups.d.ts +4 -0
  168. package/lib/resources/customer_groups.js +49 -0
  169. package/lib/resources/customer_password_resets.cjs +48 -0
  170. package/lib/resources/customer_password_resets.d.cts +4 -0
  171. package/lib/resources/customer_password_resets.d.ts +4 -0
  172. package/lib/resources/customer_password_resets.js +44 -0
  173. package/lib/resources/customer_payment_sources.cjs +49 -0
  174. package/lib/resources/customer_payment_sources.d.cts +4 -0
  175. package/lib/resources/customer_payment_sources.d.ts +4 -0
  176. package/lib/resources/customer_payment_sources.js +45 -0
  177. package/lib/resources/customer_subscriptions.cjs +49 -0
  178. package/lib/resources/customer_subscriptions.d.cts +4 -0
  179. package/lib/resources/customer_subscriptions.d.ts +4 -0
  180. package/lib/resources/customer_subscriptions.js +45 -0
  181. package/lib/resources/customers.cjs +81 -0
  182. package/lib/resources/customers.d.cts +4 -0
  183. package/lib/resources/customers.d.ts +4 -0
  184. package/lib/resources/customers.js +77 -0
  185. package/lib/resources/delivery_lead_times.cjs +53 -0
  186. package/lib/resources/delivery_lead_times.d.cts +4 -0
  187. package/lib/resources/delivery_lead_times.d.ts +4 -0
  188. package/lib/resources/delivery_lead_times.js +49 -0
  189. package/lib/resources/discount_engine_items.cjs +36 -0
  190. package/lib/resources/discount_engine_items.d.cts +4 -0
  191. package/lib/resources/discount_engine_items.d.ts +4 -0
  192. package/lib/resources/discount_engine_items.js +32 -0
  193. package/lib/resources/discount_engines.cjs +44 -0
  194. package/lib/resources/discount_engines.d.cts +4 -0
  195. package/lib/resources/discount_engines.d.ts +4 -0
  196. package/lib/resources/discount_engines.js +40 -0
  197. package/lib/resources/easypost_pickups.cjs +52 -0
  198. package/lib/resources/easypost_pickups.d.cts +4 -0
  199. package/lib/resources/easypost_pickups.d.ts +4 -0
  200. package/lib/resources/easypost_pickups.js +48 -0
  201. package/lib/resources/event_callbacks.cjs +32 -0
  202. package/lib/resources/event_callbacks.d.cts +4 -0
  203. package/lib/resources/event_callbacks.d.ts +4 -0
  204. package/lib/resources/event_callbacks.js +28 -0
  205. package/lib/resources/events.cjs +42 -0
  206. package/lib/resources/events.d.cts +4 -0
  207. package/lib/resources/events.d.ts +4 -0
  208. package/lib/resources/events.js +38 -0
  209. package/lib/resources/exports.cjs +48 -0
  210. package/lib/resources/exports.d.cts +4 -0
  211. package/lib/resources/exports.d.ts +4 -0
  212. package/lib/resources/exports.js +44 -0
  213. package/lib/resources/external_gateways.cjs +52 -0
  214. package/lib/resources/external_gateways.d.cts +4 -0
  215. package/lib/resources/external_gateways.d.ts +4 -0
  216. package/lib/resources/external_gateways.js +48 -0
  217. package/lib/resources/external_payments.cjs +53 -0
  218. package/lib/resources/external_payments.d.cts +4 -0
  219. package/lib/resources/external_payments.d.ts +4 -0
  220. package/lib/resources/external_payments.js +49 -0
  221. package/lib/resources/external_promotions.cjs +94 -0
  222. package/lib/resources/external_promotions.d.cts +4 -0
  223. package/lib/resources/external_promotions.d.ts +4 -0
  224. package/lib/resources/external_promotions.js +90 -0
  225. package/lib/resources/external_tax_calculators.cjs +56 -0
  226. package/lib/resources/external_tax_calculators.d.cts +4 -0
  227. package/lib/resources/external_tax_calculators.d.ts +4 -0
  228. package/lib/resources/external_tax_calculators.js +52 -0
  229. package/lib/resources/fixed_amount_promotions.cjs +91 -0
  230. package/lib/resources/fixed_amount_promotions.d.cts +4 -0
  231. package/lib/resources/fixed_amount_promotions.d.ts +4 -0
  232. package/lib/resources/fixed_amount_promotions.js +87 -0
  233. package/lib/resources/fixed_price_promotions.cjs +91 -0
  234. package/lib/resources/fixed_price_promotions.d.cts +4 -0
  235. package/lib/resources/fixed_price_promotions.d.ts +4 -0
  236. package/lib/resources/fixed_price_promotions.js +87 -0
  237. package/lib/resources/flex_promotions.cjs +67 -0
  238. package/lib/resources/flex_promotions.d.cts +4 -0
  239. package/lib/resources/flex_promotions.d.ts +4 -0
  240. package/lib/resources/flex_promotions.js +63 -0
  241. package/lib/resources/free_gift_promotions.cjs +91 -0
  242. package/lib/resources/free_gift_promotions.d.cts +4 -0
  243. package/lib/resources/free_gift_promotions.d.ts +4 -0
  244. package/lib/resources/free_gift_promotions.js +87 -0
  245. package/lib/resources/free_shipping_promotions.cjs +87 -0
  246. package/lib/resources/free_shipping_promotions.d.cts +4 -0
  247. package/lib/resources/free_shipping_promotions.d.ts +4 -0
  248. package/lib/resources/free_shipping_promotions.js +83 -0
  249. package/lib/resources/geocoders.cjs +40 -0
  250. package/lib/resources/geocoders.d.cts +4 -0
  251. package/lib/resources/geocoders.d.ts +4 -0
  252. package/lib/resources/geocoders.js +36 -0
  253. package/lib/resources/gift_card_recipients.cjs +49 -0
  254. package/lib/resources/gift_card_recipients.d.cts +4 -0
  255. package/lib/resources/gift_card_recipients.d.ts +4 -0
  256. package/lib/resources/gift_card_recipients.js +45 -0
  257. package/lib/resources/gift_cards.cjs +73 -0
  258. package/lib/resources/gift_cards.d.cts +4 -0
  259. package/lib/resources/gift_cards.d.ts +4 -0
  260. package/lib/resources/gift_cards.js +69 -0
  261. package/lib/resources/google_geocoders.cjs +49 -0
  262. package/lib/resources/google_geocoders.d.cts +4 -0
  263. package/lib/resources/google_geocoders.d.ts +4 -0
  264. package/lib/resources/google_geocoders.js +45 -0
  265. package/lib/resources/imports.cjs +44 -0
  266. package/lib/resources/imports.d.cts +4 -0
  267. package/lib/resources/imports.d.ts +4 -0
  268. package/lib/resources/imports.js +40 -0
  269. package/lib/resources/in_stock_subscriptions.cjs +63 -0
  270. package/lib/resources/in_stock_subscriptions.d.cts +4 -0
  271. package/lib/resources/in_stock_subscriptions.d.ts +4 -0
  272. package/lib/resources/in_stock_subscriptions.js +59 -0
  273. package/lib/resources/inventory_models.cjs +53 -0
  274. package/lib/resources/inventory_models.d.cts +4 -0
  275. package/lib/resources/inventory_models.d.ts +4 -0
  276. package/lib/resources/inventory_models.js +49 -0
  277. package/lib/resources/inventory_return_locations.cjs +49 -0
  278. package/lib/resources/inventory_return_locations.d.cts +4 -0
  279. package/lib/resources/inventory_return_locations.d.ts +4 -0
  280. package/lib/resources/inventory_return_locations.js +45 -0
  281. package/lib/resources/inventory_stock_locations.cjs +49 -0
  282. package/lib/resources/inventory_stock_locations.d.cts +4 -0
  283. package/lib/resources/inventory_stock_locations.d.ts +4 -0
  284. package/lib/resources/inventory_stock_locations.js +45 -0
  285. package/lib/resources/klarna_gateways.cjs +49 -0
  286. package/lib/resources/klarna_gateways.d.cts +4 -0
  287. package/lib/resources/klarna_gateways.d.ts +4 -0
  288. package/lib/resources/klarna_gateways.js +45 -0
  289. package/lib/resources/klarna_payments.cjs +52 -0
  290. package/lib/resources/klarna_payments.d.cts +4 -0
  291. package/lib/resources/klarna_payments.d.ts +4 -0
  292. package/lib/resources/klarna_payments.js +48 -0
  293. package/lib/resources/line_item_options.cjs +53 -0
  294. package/lib/resources/line_item_options.d.cts +4 -0
  295. package/lib/resources/line_item_options.d.ts +4 -0
  296. package/lib/resources/line_item_options.js +49 -0
  297. package/lib/resources/line_items.cjs +82 -0
  298. package/lib/resources/line_items.d.cts +4 -0
  299. package/lib/resources/line_items.d.ts +4 -0
  300. package/lib/resources/line_items.js +78 -0
  301. package/lib/resources/links.cjs +47 -0
  302. package/lib/resources/links.d.cts +4 -0
  303. package/lib/resources/links.d.ts +4 -0
  304. package/lib/resources/links.js +43 -0
  305. package/lib/resources/manual_gateways.cjs +45 -0
  306. package/lib/resources/manual_gateways.d.cts +4 -0
  307. package/lib/resources/manual_gateways.d.ts +4 -0
  308. package/lib/resources/manual_gateways.js +41 -0
  309. package/lib/resources/manual_tax_calculators.cjs +57 -0
  310. package/lib/resources/manual_tax_calculators.d.cts +4 -0
  311. package/lib/resources/manual_tax_calculators.d.ts +4 -0
  312. package/lib/resources/manual_tax_calculators.js +53 -0
  313. package/lib/resources/markets.cjs +91 -0
  314. package/lib/resources/markets.d.cts +4 -0
  315. package/lib/resources/markets.d.ts +4 -0
  316. package/lib/resources/markets.js +87 -0
  317. package/lib/resources/merchants.cjs +49 -0
  318. package/lib/resources/merchants.d.cts +4 -0
  319. package/lib/resources/merchants.d.ts +4 -0
  320. package/lib/resources/merchants.js +45 -0
  321. package/lib/resources/notifications.cjs +37 -0
  322. package/lib/resources/notifications.d.cts +4 -0
  323. package/lib/resources/notifications.d.ts +4 -0
  324. package/lib/resources/notifications.js +33 -0
  325. package/lib/resources/order_amount_promotion_rules.cjs +41 -0
  326. package/lib/resources/order_amount_promotion_rules.d.cts +4 -0
  327. package/lib/resources/order_amount_promotion_rules.d.ts +4 -0
  328. package/lib/resources/order_amount_promotion_rules.js +37 -0
  329. package/lib/resources/order_copies.cjs +53 -0
  330. package/lib/resources/order_copies.d.cts +4 -0
  331. package/lib/resources/order_copies.d.ts +4 -0
  332. package/lib/resources/order_copies.js +49 -0
  333. package/lib/resources/order_factories.cjs +40 -0
  334. package/lib/resources/order_factories.d.cts +4 -0
  335. package/lib/resources/order_factories.d.ts +4 -0
  336. package/lib/resources/order_factories.js +36 -0
  337. package/lib/resources/order_subscription_items.cjs +45 -0
  338. package/lib/resources/order_subscription_items.d.cts +4 -0
  339. package/lib/resources/order_subscription_items.d.ts +4 -0
  340. package/lib/resources/order_subscription_items.js +41 -0
  341. package/lib/resources/order_subscriptions.cjs +97 -0
  342. package/lib/resources/order_subscriptions.d.cts +4 -0
  343. package/lib/resources/order_subscriptions.d.ts +4 -0
  344. package/lib/resources/order_subscriptions.js +93 -0
  345. package/lib/resources/orders.cjs +266 -0
  346. package/lib/resources/orders.d.cts +4 -0
  347. package/lib/resources/orders.d.ts +4 -0
  348. package/lib/resources/orders.js +262 -0
  349. package/lib/resources/organizations.cjs +31 -0
  350. package/lib/resources/organizations.d.cts +4 -0
  351. package/lib/resources/organizations.d.ts +4 -0
  352. package/lib/resources/organizations.js +27 -0
  353. package/lib/resources/packages.cjs +53 -0
  354. package/lib/resources/packages.d.cts +4 -0
  355. package/lib/resources/packages.d.ts +4 -0
  356. package/lib/resources/packages.js +49 -0
  357. package/lib/resources/parcel_line_items.cjs +49 -0
  358. package/lib/resources/parcel_line_items.d.cts +4 -0
  359. package/lib/resources/parcel_line_items.d.ts +4 -0
  360. package/lib/resources/parcel_line_items.js +45 -0
  361. package/lib/resources/parcels.cjs +61 -0
  362. package/lib/resources/parcels.d.cts +4 -0
  363. package/lib/resources/parcels.d.ts +4 -0
  364. package/lib/resources/parcels.js +57 -0
  365. package/lib/resources/payment_gateways.cjs +36 -0
  366. package/lib/resources/payment_gateways.d.cts +4 -0
  367. package/lib/resources/payment_gateways.d.ts +4 -0
  368. package/lib/resources/payment_gateways.js +32 -0
  369. package/lib/resources/payment_methods.cjs +67 -0
  370. package/lib/resources/payment_methods.d.cts +4 -0
  371. package/lib/resources/payment_methods.d.ts +4 -0
  372. package/lib/resources/payment_methods.js +63 -0
  373. package/lib/resources/payment_options.cjs +45 -0
  374. package/lib/resources/payment_options.d.cts +4 -0
  375. package/lib/resources/payment_options.d.ts +4 -0
  376. package/lib/resources/payment_options.js +41 -0
  377. package/lib/resources/paypal_gateways.cjs +49 -0
  378. package/lib/resources/paypal_gateways.d.cts +4 -0
  379. package/lib/resources/paypal_gateways.d.ts +4 -0
  380. package/lib/resources/paypal_gateways.js +45 -0
  381. package/lib/resources/paypal_payments.cjs +49 -0
  382. package/lib/resources/paypal_payments.d.cts +4 -0
  383. package/lib/resources/paypal_payments.d.ts +4 -0
  384. package/lib/resources/paypal_payments.js +45 -0
  385. package/lib/resources/percentage_discount_promotions.cjs +91 -0
  386. package/lib/resources/percentage_discount_promotions.d.cts +4 -0
  387. package/lib/resources/percentage_discount_promotions.d.ts +4 -0
  388. package/lib/resources/percentage_discount_promotions.js +87 -0
  389. package/lib/resources/pickups.cjs +40 -0
  390. package/lib/resources/pickups.d.cts +4 -0
  391. package/lib/resources/pickups.d.ts +4 -0
  392. package/lib/resources/pickups.js +36 -0
  393. package/lib/resources/price_frequency_tiers.cjs +53 -0
  394. package/lib/resources/price_frequency_tiers.d.cts +4 -0
  395. package/lib/resources/price_frequency_tiers.d.ts +4 -0
  396. package/lib/resources/price_frequency_tiers.js +49 -0
  397. package/lib/resources/price_list_schedulers.cjs +59 -0
  398. package/lib/resources/price_list_schedulers.d.cts +4 -0
  399. package/lib/resources/price_list_schedulers.d.ts +4 -0
  400. package/lib/resources/price_list_schedulers.js +55 -0
  401. package/lib/resources/price_lists.cjs +53 -0
  402. package/lib/resources/price_lists.d.cts +4 -0
  403. package/lib/resources/price_lists.d.ts +4 -0
  404. package/lib/resources/price_lists.js +49 -0
  405. package/lib/resources/price_tiers.cjs +40 -0
  406. package/lib/resources/price_tiers.d.cts +4 -0
  407. package/lib/resources/price_tiers.d.ts +4 -0
  408. package/lib/resources/price_tiers.js +36 -0
  409. package/lib/resources/price_volume_tiers.cjs +53 -0
  410. package/lib/resources/price_volume_tiers.d.cts +4 -0
  411. package/lib/resources/price_volume_tiers.d.ts +4 -0
  412. package/lib/resources/price_volume_tiers.js +49 -0
  413. package/lib/resources/prices.cjs +77 -0
  414. package/lib/resources/prices.d.cts +4 -0
  415. package/lib/resources/prices.d.ts +4 -0
  416. package/lib/resources/prices.js +73 -0
  417. package/lib/resources/promotion_rules.cjs +32 -0
  418. package/lib/resources/promotion_rules.d.cts +4 -0
  419. package/lib/resources/promotion_rules.d.ts +4 -0
  420. package/lib/resources/promotion_rules.js +28 -0
  421. package/lib/resources/promotions.cjs +72 -0
  422. package/lib/resources/promotions.d.cts +4 -0
  423. package/lib/resources/promotions.d.ts +4 -0
  424. package/lib/resources/promotions.js +68 -0
  425. package/lib/resources/recurring_order_copies.cjs +53 -0
  426. package/lib/resources/recurring_order_copies.d.cts +4 -0
  427. package/lib/resources/recurring_order_copies.d.ts +4 -0
  428. package/lib/resources/recurring_order_copies.js +49 -0
  429. package/lib/resources/refunds.cjs +58 -0
  430. package/lib/resources/refunds.d.cts +4 -0
  431. package/lib/resources/refunds.d.ts +4 -0
  432. package/lib/resources/refunds.js +54 -0
  433. package/lib/resources/reserved_stocks.cjs +44 -0
  434. package/lib/resources/reserved_stocks.d.cts +4 -0
  435. package/lib/resources/reserved_stocks.d.ts +4 -0
  436. package/lib/resources/reserved_stocks.js +40 -0
  437. package/lib/resources/resource_errors.cjs +28 -0
  438. package/lib/resources/resource_errors.d.cts +4 -0
  439. package/lib/resources/resource_errors.d.ts +4 -0
  440. package/lib/resources/resource_errors.js +24 -0
  441. package/lib/resources/return_line_items.cjs +48 -0
  442. package/lib/resources/return_line_items.d.cts +4 -0
  443. package/lib/resources/return_line_items.d.ts +4 -0
  444. package/lib/resources/return_line_items.js +44 -0
  445. package/lib/resources/returns.cjs +122 -0
  446. package/lib/resources/returns.d.cts +4 -0
  447. package/lib/resources/returns.d.ts +4 -0
  448. package/lib/resources/returns.js +118 -0
  449. package/lib/resources/satispay_gateways.cjs +49 -0
  450. package/lib/resources/satispay_gateways.d.cts +4 -0
  451. package/lib/resources/satispay_gateways.d.ts +4 -0
  452. package/lib/resources/satispay_gateways.js +45 -0
  453. package/lib/resources/satispay_payments.cjs +52 -0
  454. package/lib/resources/satispay_payments.d.cts +4 -0
  455. package/lib/resources/satispay_payments.d.ts +4 -0
  456. package/lib/resources/satispay_payments.js +48 -0
  457. package/lib/resources/shipments.cjs +152 -0
  458. package/lib/resources/shipments.d.cts +4 -0
  459. package/lib/resources/shipments.d.ts +4 -0
  460. package/lib/resources/shipments.js +148 -0
  461. package/lib/resources/shipping_categories.cjs +49 -0
  462. package/lib/resources/shipping_categories.d.cts +4 -0
  463. package/lib/resources/shipping_categories.d.ts +4 -0
  464. package/lib/resources/shipping_categories.js +45 -0
  465. package/lib/resources/shipping_method_tiers.cjs +40 -0
  466. package/lib/resources/shipping_method_tiers.d.cts +4 -0
  467. package/lib/resources/shipping_method_tiers.d.ts +4 -0
  468. package/lib/resources/shipping_method_tiers.js +36 -0
  469. package/lib/resources/shipping_methods.cjs +86 -0
  470. package/lib/resources/shipping_methods.d.cts +4 -0
  471. package/lib/resources/shipping_methods.d.ts +4 -0
  472. package/lib/resources/shipping_methods.js +82 -0
  473. package/lib/resources/shipping_weight_tiers.cjs +49 -0
  474. package/lib/resources/shipping_weight_tiers.d.cts +4 -0
  475. package/lib/resources/shipping_weight_tiers.d.ts +4 -0
  476. package/lib/resources/shipping_weight_tiers.js +45 -0
  477. package/lib/resources/shipping_zones.cjs +45 -0
  478. package/lib/resources/shipping_zones.d.cts +4 -0
  479. package/lib/resources/shipping_zones.d.ts +4 -0
  480. package/lib/resources/shipping_zones.js +41 -0
  481. package/lib/resources/sku_list_items.cjs +49 -0
  482. package/lib/resources/sku_list_items.d.cts +4 -0
  483. package/lib/resources/sku_list_items.d.ts +4 -0
  484. package/lib/resources/sku_list_items.js +45 -0
  485. package/lib/resources/sku_list_promotion_rules.cjs +49 -0
  486. package/lib/resources/sku_list_promotion_rules.d.cts +4 -0
  487. package/lib/resources/sku_list_promotion_rules.d.ts +4 -0
  488. package/lib/resources/sku_list_promotion_rules.js +45 -0
  489. package/lib/resources/sku_lists.cjs +65 -0
  490. package/lib/resources/sku_lists.d.cts +4 -0
  491. package/lib/resources/sku_lists.d.ts +4 -0
  492. package/lib/resources/sku_lists.js +61 -0
  493. package/lib/resources/sku_options.cjs +57 -0
  494. package/lib/resources/sku_options.d.cts +4 -0
  495. package/lib/resources/sku_options.d.ts +4 -0
  496. package/lib/resources/sku_options.js +53 -0
  497. package/lib/resources/skus.cjs +101 -0
  498. package/lib/resources/skus.d.cts +4 -0
  499. package/lib/resources/skus.d.ts +4 -0
  500. package/lib/resources/skus.js +97 -0
  501. package/lib/resources/stock_items.cjs +64 -0
  502. package/lib/resources/stock_items.d.cts +4 -0
  503. package/lib/resources/stock_items.d.ts +4 -0
  504. package/lib/resources/stock_items.js +60 -0
  505. package/lib/resources/stock_line_items.cjs +70 -0
  506. package/lib/resources/stock_line_items.d.cts +4 -0
  507. package/lib/resources/stock_line_items.d.ts +4 -0
  508. package/lib/resources/stock_line_items.js +66 -0
  509. package/lib/resources/stock_locations.cjs +69 -0
  510. package/lib/resources/stock_locations.d.cts +4 -0
  511. package/lib/resources/stock_locations.d.ts +4 -0
  512. package/lib/resources/stock_locations.js +65 -0
  513. package/lib/resources/stock_reservations.cjs +68 -0
  514. package/lib/resources/stock_reservations.d.cts +4 -0
  515. package/lib/resources/stock_reservations.d.ts +4 -0
  516. package/lib/resources/stock_reservations.js +64 -0
  517. package/lib/resources/stock_transfers.cjs +91 -0
  518. package/lib/resources/stock_transfers.d.cts +4 -0
  519. package/lib/resources/stock_transfers.d.ts +4 -0
  520. package/lib/resources/stock_transfers.js +87 -0
  521. package/lib/resources/stores.cjs +65 -0
  522. package/lib/resources/stores.d.cts +4 -0
  523. package/lib/resources/stores.d.ts +4 -0
  524. package/lib/resources/stores.js +61 -0
  525. package/lib/resources/stripe_gateways.cjs +49 -0
  526. package/lib/resources/stripe_gateways.d.cts +4 -0
  527. package/lib/resources/stripe_gateways.d.ts +4 -0
  528. package/lib/resources/stripe_gateways.js +45 -0
  529. package/lib/resources/stripe_payments.cjs +55 -0
  530. package/lib/resources/stripe_payments.d.cts +4 -0
  531. package/lib/resources/stripe_payments.d.ts +4 -0
  532. package/lib/resources/stripe_payments.js +51 -0
  533. package/lib/resources/stripe_tax_accounts.cjs +57 -0
  534. package/lib/resources/stripe_tax_accounts.d.cts +4 -0
  535. package/lib/resources/stripe_tax_accounts.d.ts +4 -0
  536. package/lib/resources/stripe_tax_accounts.js +53 -0
  537. package/lib/resources/subscription_models.cjs +49 -0
  538. package/lib/resources/subscription_models.d.cts +4 -0
  539. package/lib/resources/subscription_models.d.ts +4 -0
  540. package/lib/resources/subscription_models.js +45 -0
  541. package/lib/resources/tags.cjs +37 -0
  542. package/lib/resources/tags.d.cts +4 -0
  543. package/lib/resources/tags.d.ts +4 -0
  544. package/lib/resources/tags.js +33 -0
  545. package/lib/resources/talon_one_accounts.cjs +53 -0
  546. package/lib/resources/talon_one_accounts.d.cts +4 -0
  547. package/lib/resources/talon_one_accounts.d.ts +4 -0
  548. package/lib/resources/talon_one_accounts.js +49 -0
  549. package/lib/resources/tax_calculators.cjs +44 -0
  550. package/lib/resources/tax_calculators.d.cts +4 -0
  551. package/lib/resources/tax_calculators.d.ts +4 -0
  552. package/lib/resources/tax_calculators.js +40 -0
  553. package/lib/resources/tax_categories.cjs +49 -0
  554. package/lib/resources/tax_categories.d.cts +4 -0
  555. package/lib/resources/tax_categories.d.ts +4 -0
  556. package/lib/resources/tax_categories.js +45 -0
  557. package/lib/resources/tax_rules.cjs +45 -0
  558. package/lib/resources/tax_rules.d.cts +4 -0
  559. package/lib/resources/tax_rules.d.ts +4 -0
  560. package/lib/resources/tax_rules.js +41 -0
  561. package/lib/resources/taxjar_accounts.cjs +57 -0
  562. package/lib/resources/taxjar_accounts.d.cts +4 -0
  563. package/lib/resources/taxjar_accounts.d.ts +4 -0
  564. package/lib/resources/taxjar_accounts.js +53 -0
  565. package/lib/resources/transactions.cjs +44 -0
  566. package/lib/resources/transactions.d.cts +4 -0
  567. package/lib/resources/transactions.d.ts +4 -0
  568. package/lib/resources/transactions.js +40 -0
  569. package/lib/resources/versions.cjs +28 -0
  570. package/lib/resources/versions.d.cts +4 -0
  571. package/lib/resources/versions.d.ts +4 -0
  572. package/lib/resources/versions.js +24 -0
  573. package/lib/resources/vertex_accounts.cjs +56 -0
  574. package/lib/resources/vertex_accounts.d.cts +4 -0
  575. package/lib/resources/vertex_accounts.d.ts +4 -0
  576. package/lib/resources/vertex_accounts.js +52 -0
  577. package/lib/resources/voids.cjs +54 -0
  578. package/lib/resources/voids.d.cts +4 -0
  579. package/lib/resources/voids.d.ts +4 -0
  580. package/lib/resources/voids.js +50 -0
  581. package/lib/resources/webhooks.cjs +54 -0
  582. package/lib/resources/webhooks.d.cts +4 -0
  583. package/lib/resources/webhooks.d.ts +4 -0
  584. package/lib/resources/webhooks.js +50 -0
  585. package/lib/resources/wire_transfers.cjs +45 -0
  586. package/lib/resources/wire_transfers.d.cts +4 -0
  587. package/lib/resources/wire_transfers.d.ts +4 -0
  588. package/lib/resources/wire_transfers.js +41 -0
  589. package/lib/static.cjs +39 -0
  590. package/lib/static.d.cts +19 -0
  591. package/lib/static.d.ts +19 -0
  592. package/lib/static.js +33 -0
  593. package/lib/types.cjs +2 -0
  594. package/lib/types.d.cts +7 -0
  595. package/lib/types.d.ts +7 -0
  596. package/lib/types.js +1 -0
  597. package/lib/util.cjs +37 -0
  598. package/lib/util.d.cts +13 -0
  599. package/lib/util.d.ts +13 -0
  600. package/lib/util.js +32 -0
  601. package/package.json +12 -10
@@ -0,0 +1,139 @@
1
+ import { ApiResourceAdapter } from './resource';
2
+ import { Addresses, Adjustments, AdyenGateways, AdyenPayments, Applications, Attachments, Authorizations, AvalaraAccounts, AxerveGateways, AxervePayments, BingGeocoders, BraintreeGateways, BraintreePayments, Bundles, BuyXPayYPromotions, Captures, CarrierAccounts, CheckoutComGateways, CheckoutComPayments, Cleanups, CouponCodesPromotionRules, CouponRecipients, Coupons, CustomPromotionRules, CustomerAddresses, CustomerGroups, CustomerPasswordResets, CustomerPaymentSources, CustomerSubscriptions, Customers, DeliveryLeadTimes, DiscountEngineItems, DiscountEngines, EasypostPickups, EventCallbacks, Events, Exports, ExternalGateways, ExternalPayments, ExternalPromotions, ExternalTaxCalculators, FixedAmountPromotions, FixedPricePromotions, FlexPromotions, FreeGiftPromotions, FreeShippingPromotions, Geocoders, GiftCardRecipients, GiftCards, GoogleGeocoders, Imports, InStockSubscriptions, InventoryModels, InventoryReturnLocations, InventoryStockLocations, KlarnaGateways, KlarnaPayments, LineItemOptions, LineItems, Links, ManualGateways, ManualTaxCalculators, Markets, Merchants, Notifications, OrderAmountPromotionRules, OrderCopies, OrderFactories, OrderSubscriptionItems, OrderSubscriptions, Orders, Organizations, Packages, ParcelLineItems, Parcels, PaymentGateways, PaymentMethods, PaymentOptions, PaypalGateways, PaypalPayments, PercentageDiscountPromotions, Pickups, PriceFrequencyTiers, PriceListSchedulers, PriceLists, PriceTiers, PriceVolumeTiers, Prices, PromotionRules, Promotions, RecurringOrderCopies, Refunds, ReservedStocks, ResourceErrors, ReturnLineItems, Returns, SatispayGateways, SatispayPayments, Shipments, ShippingCategories, ShippingMethodTiers, ShippingMethods, ShippingWeightTiers, ShippingZones, SkuListItems, SkuListPromotionRules, SkuLists, SkuOptions, Skus, StockItems, StockLineItems, StockLocations, StockReservations, StockTransfers, Stores, StripeGateways, StripePayments, StripeTaxAccounts, SubscriptionModels, Tags, TalonOneAccounts, TaxCalculators, TaxCategories, TaxRules, TaxjarAccounts, Transactions, Versions, VertexAccounts, Voids, Webhooks, WireTransfers } from './api';
3
+
4
+ const addresses = new Addresses();
5
+ const adjustments = new Adjustments();
6
+ const adyen_gateways = new AdyenGateways();
7
+ const adyen_payments = new AdyenPayments();
8
+ const application = new Applications();
9
+ const attachments = new Attachments();
10
+ const authorizations = new Authorizations();
11
+ const avalara_accounts = new AvalaraAccounts();
12
+ const axerve_gateways = new AxerveGateways();
13
+ const axerve_payments = new AxervePayments();
14
+ const bing_geocoders = new BingGeocoders();
15
+ const braintree_gateways = new BraintreeGateways();
16
+ const braintree_payments = new BraintreePayments();
17
+ const bundles = new Bundles();
18
+ const buy_x_pay_y_promotions = new BuyXPayYPromotions();
19
+ const captures = new Captures();
20
+ const carrier_accounts = new CarrierAccounts();
21
+ const checkout_com_gateways = new CheckoutComGateways();
22
+ const checkout_com_payments = new CheckoutComPayments();
23
+ const cleanups = new Cleanups();
24
+ const coupon_codes_promotion_rules = new CouponCodesPromotionRules();
25
+ const coupon_recipients = new CouponRecipients();
26
+ const coupons = new Coupons();
27
+ const custom_promotion_rules = new CustomPromotionRules();
28
+ const customer_addresses = new CustomerAddresses();
29
+ const customer_groups = new CustomerGroups();
30
+ const customer_password_resets = new CustomerPasswordResets();
31
+ const customer_payment_sources = new CustomerPaymentSources();
32
+ const customer_subscriptions = new CustomerSubscriptions();
33
+ const customers = new Customers();
34
+ const delivery_lead_times = new DeliveryLeadTimes();
35
+ const discount_engine_items = new DiscountEngineItems();
36
+ const discount_engines = new DiscountEngines();
37
+ const easypost_pickups = new EasypostPickups();
38
+ const event_callbacks = new EventCallbacks();
39
+ const events = new Events();
40
+ const exportz = new Exports();
41
+ const external_gateways = new ExternalGateways();
42
+ const external_payments = new ExternalPayments();
43
+ const external_promotions = new ExternalPromotions();
44
+ const external_tax_calculators = new ExternalTaxCalculators();
45
+ const fixed_amount_promotions = new FixedAmountPromotions();
46
+ const fixed_price_promotions = new FixedPricePromotions();
47
+ const flex_promotions = new FlexPromotions();
48
+ const free_gift_promotions = new FreeGiftPromotions();
49
+ const free_shipping_promotions = new FreeShippingPromotions();
50
+ const geocoders = new Geocoders();
51
+ const gift_card_recipients = new GiftCardRecipients();
52
+ const gift_cards = new GiftCards();
53
+ const google_geocoders = new GoogleGeocoders();
54
+ const imports = new Imports();
55
+ const in_stock_subscriptions = new InStockSubscriptions();
56
+ const inventory_models = new InventoryModels();
57
+ const inventory_return_locations = new InventoryReturnLocations();
58
+ const inventory_stock_locations = new InventoryStockLocations();
59
+ const klarna_gateways = new KlarnaGateways();
60
+ const klarna_payments = new KlarnaPayments();
61
+ const line_item_options = new LineItemOptions();
62
+ const line_items = new LineItems();
63
+ const links = new Links();
64
+ const manual_gateways = new ManualGateways();
65
+ const manual_tax_calculators = new ManualTaxCalculators();
66
+ const markets = new Markets();
67
+ const merchants = new Merchants();
68
+ const notifications = new Notifications();
69
+ const order_amount_promotion_rules = new OrderAmountPromotionRules();
70
+ const order_copies = new OrderCopies();
71
+ const order_factories = new OrderFactories();
72
+ const order_subscription_items = new OrderSubscriptionItems();
73
+ const order_subscriptions = new OrderSubscriptions();
74
+ const orders = new Orders();
75
+ const organization = new Organizations();
76
+ const packages = new Packages();
77
+ const parcel_line_items = new ParcelLineItems();
78
+ const parcels = new Parcels();
79
+ const payment_gateways = new PaymentGateways();
80
+ const payment_methods = new PaymentMethods();
81
+ const payment_options = new PaymentOptions();
82
+ const paypal_gateways = new PaypalGateways();
83
+ const paypal_payments = new PaypalPayments();
84
+ const percentage_discount_promotions = new PercentageDiscountPromotions();
85
+ const pickups = new Pickups();
86
+ const price_frequency_tiers = new PriceFrequencyTiers();
87
+ const price_list_schedulers = new PriceListSchedulers();
88
+ const price_lists = new PriceLists();
89
+ const price_tiers = new PriceTiers();
90
+ const price_volume_tiers = new PriceVolumeTiers();
91
+ const prices = new Prices();
92
+ const promotion_rules = new PromotionRules();
93
+ const promotions = new Promotions();
94
+ const recurring_order_copies = new RecurringOrderCopies();
95
+ const refunds = new Refunds();
96
+ const reserved_stocks = new ReservedStocks();
97
+ const resource_errors = new ResourceErrors();
98
+ const return_line_items = new ReturnLineItems();
99
+ const returns = new Returns();
100
+ const satispay_gateways = new SatispayGateways();
101
+ const satispay_payments = new SatispayPayments();
102
+ const shipments = new Shipments();
103
+ const shipping_categories = new ShippingCategories();
104
+ const shipping_method_tiers = new ShippingMethodTiers();
105
+ const shipping_methods = new ShippingMethods();
106
+ const shipping_weight_tiers = new ShippingWeightTiers();
107
+ const shipping_zones = new ShippingZones();
108
+ const sku_list_items = new SkuListItems();
109
+ const sku_list_promotion_rules = new SkuListPromotionRules();
110
+ const sku_lists = new SkuLists();
111
+ const sku_options = new SkuOptions();
112
+ const skus = new Skus();
113
+ const stock_items = new StockItems();
114
+ const stock_line_items = new StockLineItems();
115
+ const stock_locations = new StockLocations();
116
+ const stock_reservations = new StockReservations();
117
+ const stock_transfers = new StockTransfers();
118
+ const stores = new Stores();
119
+ const stripe_gateways = new StripeGateways();
120
+ const stripe_payments = new StripePayments();
121
+ const stripe_tax_accounts = new StripeTaxAccounts();
122
+ const subscription_models = new SubscriptionModels();
123
+ const tags = new Tags();
124
+ const talon_one_accounts = new TalonOneAccounts();
125
+ const tax_calculators = new TaxCalculators();
126
+ const tax_categories = new TaxCategories();
127
+ const tax_rules = new TaxRules();
128
+ const taxjar_accounts = new TaxjarAccounts();
129
+ const transactions = new Transactions();
130
+ const versions = new Versions();
131
+ const vertex_accounts = new VertexAccounts();
132
+ const voids = new Voids();
133
+ const webhooks = new Webhooks();
134
+ const wire_transfers = new WireTransfers();
135
+ const initCommerceLayer = (config) => {
136
+ ApiResourceAdapter.init(config);
137
+ };
138
+
139
+ export { addresses, adjustments, adyen_gateways, adyen_payments, application, attachments, authorizations, avalara_accounts, axerve_gateways, axerve_payments, bing_geocoders, braintree_gateways, braintree_payments, bundles, buy_x_pay_y_promotions, captures, carrier_accounts, checkout_com_gateways, checkout_com_payments, cleanups, coupon_codes_promotion_rules, coupon_recipients, coupons, custom_promotion_rules, customer_addresses, customer_groups, customer_password_resets, customer_payment_sources, customer_subscriptions, customers, delivery_lead_times, discount_engine_items, discount_engines, easypost_pickups, event_callbacks, events, exportz, external_gateways, external_payments, external_promotions, external_tax_calculators, fixed_amount_promotions, fixed_price_promotions, flex_promotions, free_gift_promotions, free_shipping_promotions, geocoders, gift_card_recipients, gift_cards, google_geocoders, imports, in_stock_subscriptions, initCommerceLayer, inventory_models, inventory_return_locations, inventory_stock_locations, klarna_gateways, klarna_payments, line_item_options, line_items, links, manual_gateways, manual_tax_calculators, markets, merchants, notifications, order_amount_promotion_rules, order_copies, order_factories, order_subscription_items, order_subscriptions, orders, organization, packages, parcel_line_items, parcels, payment_gateways, payment_methods, payment_options, paypal_gateways, paypal_payments, percentage_discount_promotions, pickups, price_frequency_tiers, price_list_schedulers, price_lists, price_tiers, price_volume_tiers, prices, promotion_rules, promotions, recurring_order_copies, refunds, reserved_stocks, resource_errors, return_line_items, returns, satispay_gateways, satispay_payments, shipments, shipping_categories, shipping_method_tiers, shipping_methods, shipping_weight_tiers, shipping_zones, sku_list_items, sku_list_promotion_rules, sku_lists, sku_options, skus, stock_items, stock_line_items, stock_locations, stock_reservations, stock_transfers, stores, stripe_gateways, stripe_payments, stripe_tax_accounts, subscription_models, tags, talon_one_accounts, tax_calculators, tax_categories, tax_rules, taxjar_accounts, transactions, versions, vertex_accounts, voids, webhooks, wire_transfers };
@@ -0,0 +1,54 @@
1
+ type Fetch = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
2
+ type FetchResponse = any;
3
+ type FetchRequestOptions = RequestInit;
4
+ type FetchClientOptions = {
5
+ interceptors?: InterceptorManager;
6
+ fetch?: Fetch;
7
+ };
8
+ declare class FetchError extends Error {
9
+ #private;
10
+ static isFetchError: (error: any) => error is FetchError;
11
+ constructor(status: number, statusText: string, body?: any, request?: FetchRequestOptions);
12
+ get errors(): any[] | undefined;
13
+ get status(): number;
14
+ get statusText(): string;
15
+ get request(): Partial<FetchRequestOptions> | undefined;
16
+ }
17
+ declare const fetchURL: (url: URL, requestOptions: FetchRequestOptions, clientOptions?: FetchClientOptions) => Promise<FetchResponse>;
18
+
19
+ type InterceptorEventManager<S extends (RequestInterceptor | ResponseInterceptor), F extends (ErrorInterceptor | ResponseInterceptor)> = {
20
+ onSuccess?: S;
21
+ onFailure?: F;
22
+ };
23
+ type RequestEventManager = InterceptorEventManager<RequestInterceptor, ErrorInterceptor>;
24
+ type ResponseEventManager = InterceptorEventManager<ResponseInterceptor, ErrorInterceptor>;
25
+ type ErrorEventManager = InterceptorEventManager<ResponseInterceptor, ResponseInterceptor>;
26
+ type InterceptorManager = {
27
+ request?: RequestEventManager;
28
+ response?: ResponseEventManager;
29
+ rawReader?: ErrorEventManager;
30
+ };
31
+ type RequestObj = {
32
+ url: URL;
33
+ options: FetchRequestOptions;
34
+ };
35
+ type RequestInterceptor = (request: RequestObj) => RequestObj | Promise<RequestObj>;
36
+ type ResponseObj = Response;
37
+ type ResponseInterceptor = (response: ResponseObj) => ResponseObj | Promise<ResponseObj>;
38
+ type ApiHeadersList = 'x-ratelimit-limit' | 'x-ratelimit-interval' | 'x-ratelimit-remaining';
39
+ type ApiHeaders = {
40
+ [key in ApiHeadersList]: string | number | boolean;
41
+ };
42
+ type HeadersObj = Record<string, string> | ApiHeaders;
43
+ type ErrorObj = FetchError;
44
+ type ErrorInterceptor = (error: ErrorObj) => ErrorObj | Promise<ErrorObj>;
45
+ type InterceptorType = 'request' | 'response';
46
+
47
+ type RawResponseReader = {
48
+ id: number;
49
+ rawResponse?: any;
50
+ headers?: HeadersObj;
51
+ ok: boolean;
52
+ };
53
+
54
+ export { type ErrorObj as E, type Fetch as F, type HeadersObj as H, type InterceptorType as I, type RequestObj as R, type ResponseObj as a, type RequestInterceptor as b, type ErrorInterceptor as c, type ResponseInterceptor as d, type RawResponseReader as e, type InterceptorManager as f, type FetchResponse as g, type FetchRequestOptions as h, type FetchClientOptions as i, FetchError as j, fetchURL as k };
@@ -0,0 +1,54 @@
1
+ type Fetch = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
2
+ type FetchResponse = any;
3
+ type FetchRequestOptions = RequestInit;
4
+ type FetchClientOptions = {
5
+ interceptors?: InterceptorManager;
6
+ fetch?: Fetch;
7
+ };
8
+ declare class FetchError extends Error {
9
+ #private;
10
+ static isFetchError: (error: any) => error is FetchError;
11
+ constructor(status: number, statusText: string, body?: any, request?: FetchRequestOptions);
12
+ get errors(): any[] | undefined;
13
+ get status(): number;
14
+ get statusText(): string;
15
+ get request(): Partial<FetchRequestOptions> | undefined;
16
+ }
17
+ declare const fetchURL: (url: URL, requestOptions: FetchRequestOptions, clientOptions?: FetchClientOptions) => Promise<FetchResponse>;
18
+
19
+ type InterceptorEventManager<S extends (RequestInterceptor | ResponseInterceptor), F extends (ErrorInterceptor | ResponseInterceptor)> = {
20
+ onSuccess?: S;
21
+ onFailure?: F;
22
+ };
23
+ type RequestEventManager = InterceptorEventManager<RequestInterceptor, ErrorInterceptor>;
24
+ type ResponseEventManager = InterceptorEventManager<ResponseInterceptor, ErrorInterceptor>;
25
+ type ErrorEventManager = InterceptorEventManager<ResponseInterceptor, ResponseInterceptor>;
26
+ type InterceptorManager = {
27
+ request?: RequestEventManager;
28
+ response?: ResponseEventManager;
29
+ rawReader?: ErrorEventManager;
30
+ };
31
+ type RequestObj = {
32
+ url: URL;
33
+ options: FetchRequestOptions;
34
+ };
35
+ type RequestInterceptor = (request: RequestObj) => RequestObj | Promise<RequestObj>;
36
+ type ResponseObj = Response;
37
+ type ResponseInterceptor = (response: ResponseObj) => ResponseObj | Promise<ResponseObj>;
38
+ type ApiHeadersList = 'x-ratelimit-limit' | 'x-ratelimit-interval' | 'x-ratelimit-remaining';
39
+ type ApiHeaders = {
40
+ [key in ApiHeadersList]: string | number | boolean;
41
+ };
42
+ type HeadersObj = Record<string, string> | ApiHeaders;
43
+ type ErrorObj = FetchError;
44
+ type ErrorInterceptor = (error: ErrorObj) => ErrorObj | Promise<ErrorObj>;
45
+ type InterceptorType = 'request' | 'response';
46
+
47
+ type RawResponseReader = {
48
+ id: number;
49
+ rawResponse?: any;
50
+ headers?: HeadersObj;
51
+ ok: boolean;
52
+ };
53
+
54
+ export { type ErrorObj as E, type Fetch as F, type HeadersObj as H, type InterceptorType as I, type RequestObj as R, type ResponseObj as a, type RequestInterceptor as b, type ErrorInterceptor as c, type ResponseInterceptor as d, type RawResponseReader as e, type InterceptorManager as f, type FetchResponse as g, type FetchRequestOptions as h, type FetchClientOptions as i, FetchError as j, fetchURL as k };
@@ -0,0 +1,2 @@
1
+ 'use strict';
2
+
@@ -0,0 +1 @@
1
+ export { c as ErrorInterceptor, E as ErrorObj, H as HeadersObj, f as InterceptorManager, I as InterceptorType, e as RawResponseReader, b as RequestInterceptor, R as RequestObj, d as ResponseInterceptor, a as ResponseObj } from './interceptor-5MISI1yn.cjs';
@@ -0,0 +1 @@
1
+ export { c as ErrorInterceptor, E as ErrorObj, H as HeadersObj, f as InterceptorManager, I as InterceptorType, e as RawResponseReader, b as RequestInterceptor, R as RequestObj, d as ResponseInterceptor, a as ResponseObj } from './interceptor-5MISI1yn.js';
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,79 @@
1
+ 'use strict';
2
+
3
+ var common = require('./common');
4
+ var config = require('./config');
5
+ var Debug = require('./debug');
6
+
7
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
+
9
+ var config__default = /*#__PURE__*/_interopDefault(config);
10
+ var Debug__default = /*#__PURE__*/_interopDefault(Debug);
11
+
12
+ const debug = Debug__default.default("jsonapi");
13
+ const denormalize = (response) => {
14
+ if (!response) return response;
15
+ let denormalizedResponse;
16
+ if (response.links) delete response.links;
17
+ const data = response.data;
18
+ const included = response.included;
19
+ if (!data) denormalizedResponse = data;
20
+ else {
21
+ if (Array.isArray(data)) denormalizedResponse = data.map((res) => denormalizeResource(res, included));
22
+ else denormalizedResponse = denormalizeResource(data, included);
23
+ }
24
+ return denormalizedResponse;
25
+ };
26
+ const findIncluded = (rel, included = []) => {
27
+ const inc = included.find((inc2) => {
28
+ return rel.id === inc2.id && rel.type === inc2.type;
29
+ });
30
+ return inc || rel;
31
+ };
32
+ const denormalizeResource = (res, included, chain = []) => {
33
+ debug("denormalize resource: %O, %o", res, included || {});
34
+ if (!res) return res;
35
+ const resource = {
36
+ id: res.id,
37
+ type: res.type,
38
+ ...res.attributes
39
+ };
40
+ if (res.relationships) Object.keys(res.relationships).forEach((key) => {
41
+ const rel = res.relationships[key].data;
42
+ if (rel) {
43
+ if (chain.filter((r) => r.id === rel.id && r.type === rel.type).length >= config__default.default.jsonapi.maxResourceIncluded) resource[key] = rel;
44
+ else {
45
+ if (Array.isArray(rel)) resource[key] = rel.map((r) => denormalizeResource(findIncluded(r, included), included, [...chain, r]));
46
+ else resource[key] = denormalizeResource(findIncluded(rel, included), included, [...chain, rel]);
47
+ }
48
+ } else if (rel === null) resource[key] = null;
49
+ });
50
+ debug("denormalized resource: %O", resource);
51
+ return resource;
52
+ };
53
+ const normalize = (resource) => {
54
+ debug("normalize resource: %O", resource);
55
+ const attributes = {};
56
+ const relationships = {};
57
+ for (const field in resource) {
58
+ if (["type", "id"].includes(field)) continue;
59
+ const value = resource[field];
60
+ if (Array.isArray(value) && value.length === 1 && common.isResourceType(value[0]) && value[0].id === null) {
61
+ relationships[field] = { data: [] };
62
+ } else if (value && common.isResourceType(value) && value.id === null) {
63
+ relationships[field] = { data: null };
64
+ } else if (value && (common.isResourceId(value) || Array.isArray(value) && common.isResourceId(value[0]))) {
65
+ relationships[field] = { data: value };
66
+ } else attributes[field] = value;
67
+ }
68
+ const normalized = {
69
+ type: resource.type,
70
+ attributes,
71
+ relationships
72
+ };
73
+ if (common.isResourceId(resource)) normalized.id = resource.id;
74
+ debug("normalized resource: %O", normalized);
75
+ return normalized;
76
+ };
77
+
78
+ exports.denormalize = denormalize;
79
+ exports.normalize = normalize;
@@ -0,0 +1,11 @@
1
+ import { DocWithData, ResourceObject } from 'jsonapi-typescript';
2
+ export { DocWithData } from 'jsonapi-typescript';
3
+ import { q as Resource, r as ResourceCreate, R as ResourceType, s as ResourceUpdate, p as ResourceId } from './api-BYcswOJ0.cjs';
4
+ import './client.cjs';
5
+ import './interceptor-5MISI1yn.cjs';
6
+ import './types.cjs';
7
+
8
+ declare const denormalize: <R extends Resource>(response: DocWithData) => R | R[];
9
+ declare const normalize: (resource: (ResourceCreate & ResourceType) | (ResourceUpdate & ResourceId)) => ResourceObject;
10
+
11
+ export { denormalize, normalize };
@@ -0,0 +1,11 @@
1
+ import { DocWithData, ResourceObject } from 'jsonapi-typescript';
2
+ export { DocWithData } from 'jsonapi-typescript';
3
+ import { q as Resource, r as ResourceCreate, R as ResourceType, s as ResourceUpdate, p as ResourceId } from './api-Cknm0QL_.js';
4
+ import './client.js';
5
+ import './interceptor-5MISI1yn.js';
6
+ import './types.js';
7
+
8
+ declare const denormalize: <R extends Resource>(response: DocWithData) => R | R[];
9
+ declare const normalize: (resource: (ResourceCreate & ResourceType) | (ResourceUpdate & ResourceId)) => ResourceObject;
10
+
11
+ export { denormalize, normalize };
package/lib/jsonapi.js ADDED
@@ -0,0 +1,71 @@
1
+ import { isResourceType, isResourceId } from './common';
2
+ import config from './config';
3
+ import Debug from './debug';
4
+
5
+ const debug = Debug("jsonapi");
6
+ const denormalize = (response) => {
7
+ if (!response) return response;
8
+ let denormalizedResponse;
9
+ if (response.links) delete response.links;
10
+ const data = response.data;
11
+ const included = response.included;
12
+ if (!data) denormalizedResponse = data;
13
+ else {
14
+ if (Array.isArray(data)) denormalizedResponse = data.map((res) => denormalizeResource(res, included));
15
+ else denormalizedResponse = denormalizeResource(data, included);
16
+ }
17
+ return denormalizedResponse;
18
+ };
19
+ const findIncluded = (rel, included = []) => {
20
+ const inc = included.find((inc2) => {
21
+ return rel.id === inc2.id && rel.type === inc2.type;
22
+ });
23
+ return inc || rel;
24
+ };
25
+ const denormalizeResource = (res, included, chain = []) => {
26
+ debug("denormalize resource: %O, %o", res, included || {});
27
+ if (!res) return res;
28
+ const resource = {
29
+ id: res.id,
30
+ type: res.type,
31
+ ...res.attributes
32
+ };
33
+ if (res.relationships) Object.keys(res.relationships).forEach((key) => {
34
+ const rel = res.relationships[key].data;
35
+ if (rel) {
36
+ if (chain.filter((r) => r.id === rel.id && r.type === rel.type).length >= config.jsonapi.maxResourceIncluded) resource[key] = rel;
37
+ else {
38
+ if (Array.isArray(rel)) resource[key] = rel.map((r) => denormalizeResource(findIncluded(r, included), included, [...chain, r]));
39
+ else resource[key] = denormalizeResource(findIncluded(rel, included), included, [...chain, rel]);
40
+ }
41
+ } else if (rel === null) resource[key] = null;
42
+ });
43
+ debug("denormalized resource: %O", resource);
44
+ return resource;
45
+ };
46
+ const normalize = (resource) => {
47
+ debug("normalize resource: %O", resource);
48
+ const attributes = {};
49
+ const relationships = {};
50
+ for (const field in resource) {
51
+ if (["type", "id"].includes(field)) continue;
52
+ const value = resource[field];
53
+ if (Array.isArray(value) && value.length === 1 && isResourceType(value[0]) && value[0].id === null) {
54
+ relationships[field] = { data: [] };
55
+ } else if (value && isResourceType(value) && value.id === null) {
56
+ relationships[field] = { data: null };
57
+ } else if (value && (isResourceId(value) || Array.isArray(value) && isResourceId(value[0]))) {
58
+ relationships[field] = { data: value };
59
+ } else attributes[field] = value;
60
+ }
61
+ const normalized = {
62
+ type: resource.type,
63
+ attributes,
64
+ relationships
65
+ };
66
+ if (isResourceId(resource)) normalized.id = resource.id;
67
+ debug("normalized resource: %O", normalized);
68
+ return normalized;
69
+ };
70
+
71
+ export { denormalize, normalize };
package/lib/model.cjs ADDED
@@ -0,0 +1,2 @@
1
+ 'use strict';
2
+
@@ -0,0 +1,4 @@
1
+ export { D as Address, E as AddressCreate, G as AddressSort, F as AddressUpdate, H as Adjustment, I as AdjustmentCreate, K as AdjustmentSort, J as AdjustmentUpdate, N as AdyenGateway, O as AdyenGatewayCreate, S as AdyenGatewaySort, P as AdyenGatewayUpdate, T as AdyenPayment, U as AdyenPaymentCreate, W as AdyenPaymentSort, V as AdyenPaymentUpdate, X as Application, Y as ApplicationSort, Z as Attachment, _ as AttachmentCreate, a0 as AttachmentSort, $ as AttachmentUpdate, a1 as Authorization, a3 as AuthorizationSort, a2 as AuthorizationUpdate, a4 as AvalaraAccount, a5 as AvalaraAccountCreate, a7 as AvalaraAccountSort, a6 as AvalaraAccountUpdate, a8 as AxerveGateway, a9 as AxerveGatewayCreate, ab as AxerveGatewaySort, aa as AxerveGatewayUpdate, ac as AxervePayment, ad as AxervePaymentCreate, af as AxervePaymentSort, ae as AxervePaymentUpdate, ag as BingGeocoder, ah as BingGeocoderCreate, aj as BingGeocoderSort, ai as BingGeocoderUpdate, ak as BraintreeGateway, al as BraintreeGatewayCreate, an as BraintreeGatewaySort, am as BraintreeGatewayUpdate, ao as BraintreePayment, ap as BraintreePaymentCreate, ar as BraintreePaymentSort, aq as BraintreePaymentUpdate, as as Bundle, at as BundleCreate, av as BundleSort, au as BundleUpdate, aw as BuyXPayYPromotion, ax as BuyXPayYPromotionCreate, az as BuyXPayYPromotionSort, ay as BuyXPayYPromotionUpdate, aA as Capture, aC as CaptureSort, aB as CaptureUpdate, aD as CarrierAccount, aE as CarrierAccountCreate, aG as CarrierAccountSort, aF as CarrierAccountUpdate, aH as CheckoutComGateway, aI as CheckoutComGatewayCreate, aK as CheckoutComGatewaySort, aJ as CheckoutComGatewayUpdate, aL as CheckoutComPayment, aM as CheckoutComPaymentCreate, aO as CheckoutComPaymentSort, aN as CheckoutComPaymentUpdate, aP as Cleanup, aQ as CleanupCreate, aS as CleanupSort, aR as CleanupUpdate, a$ as Coupon, aT as CouponCodesPromotionRule, aU as CouponCodesPromotionRuleCreate, aW as CouponCodesPromotionRuleSort, aV as CouponCodesPromotionRuleUpdate, b0 as CouponCreate, aX as CouponRecipient, aY as CouponRecipientCreate, a_ as CouponRecipientSort, aZ as CouponRecipientUpdate, b2 as CouponSort, b1 as CouponUpdate, b3 as CustomPromotionRule, b4 as CustomPromotionRuleCreate, b6 as CustomPromotionRuleSort, b5 as CustomPromotionRuleUpdate, br as Customer, b7 as CustomerAddress, b8 as CustomerAddressCreate, ba as CustomerAddressSort, b9 as CustomerAddressUpdate, bs as CustomerCreate, bb as CustomerGroup, bc as CustomerGroupCreate, be as CustomerGroupSort, bd as CustomerGroupUpdate, bf as CustomerPasswordReset, bg as CustomerPasswordResetCreate, bi as CustomerPasswordResetSort, bh as CustomerPasswordResetUpdate, bj as CustomerPaymentSource, bk as CustomerPaymentSourceCreate, bm as CustomerPaymentSourceSort, bl as CustomerPaymentSourceUpdate, bu as CustomerSort, bn as CustomerSubscription, bo as CustomerSubscriptionCreate, bq as CustomerSubscriptionSort, bp as CustomerSubscriptionUpdate, bt as CustomerUpdate, bv as DeliveryLeadTime, bw as DeliveryLeadTimeCreate, by as DeliveryLeadTimeSort, bx as DeliveryLeadTimeUpdate, bB as DiscountEngine, bz as DiscountEngineItem, bA as DiscountEngineItemSort, bC as DiscountEngineSort, bD as EasypostPickup, bE as EasypostPickupCreate, bG as EasypostPickupSort, bF as EasypostPickupUpdate, bJ as Event, bH as EventCallback, bI as EventCallbackSort, bL as EventSort, bK as EventUpdate, bM as Export, bN as ExportCreate, bP as ExportSort, bO as ExportUpdate, bQ as ExternalGateway, bR as ExternalGatewayCreate, bT as ExternalGatewaySort, bS as ExternalGatewayUpdate, bU as ExternalPayment, bV as ExternalPaymentCreate, bX as ExternalPaymentSort, bW as ExternalPaymentUpdate, bY as ExternalPromotion, bZ as ExternalPromotionCreate, b$ as ExternalPromotionSort, b_ as ExternalPromotionUpdate, c0 as ExternalTaxCalculator, c1 as ExternalTaxCalculatorCreate, c3 as ExternalTaxCalculatorSort, c2 as ExternalTaxCalculatorUpdate, c4 as FixedAmountPromotion, c5 as FixedAmountPromotionCreate, c7 as FixedAmountPromotionSort, c6 as FixedAmountPromotionUpdate, c8 as FixedPricePromotion, c9 as FixedPricePromotionCreate, cb as FixedPricePromotionSort, ca as FixedPricePromotionUpdate, cc as FlexPromotion, cd as FlexPromotionCreate, cf as FlexPromotionSort, ce as FlexPromotionUpdate, cg as FreeGiftPromotion, ch as FreeGiftPromotionCreate, cj as FreeGiftPromotionSort, ci as FreeGiftPromotionUpdate, ck as FreeShippingPromotion, cl as FreeShippingPromotionCreate, cn as FreeShippingPromotionSort, cm as FreeShippingPromotionUpdate, co as Geocoder, cp as GeocoderSort, cu as GiftCard, cv as GiftCardCreate, cq as GiftCardRecipient, cr as GiftCardRecipientCreate, ct as GiftCardRecipientSort, cs as GiftCardRecipientUpdate, cx as GiftCardSort, cw as GiftCardUpdate, cy as GoogleGeocoder, cz as GoogleGeocoderCreate, cB as GoogleGeocoderSort, cA as GoogleGeocoderUpdate, cC as Import, cD as ImportCreate, cF as ImportSort, cE as ImportUpdate, cG as InStockSubscription, cH as InStockSubscriptionCreate, cJ as InStockSubscriptionSort, cI as InStockSubscriptionUpdate, cK as InventoryModel, cL as InventoryModelCreate, cN as InventoryModelSort, cM as InventoryModelUpdate, cO as InventoryReturnLocation, cP as InventoryReturnLocationCreate, cR as InventoryReturnLocationSort, cQ as InventoryReturnLocationUpdate, cS as InventoryStockLocation, cT as InventoryStockLocationCreate, cV as InventoryStockLocationSort, cU as InventoryStockLocationUpdate, cW as KlarnaGateway, cX as KlarnaGatewayCreate, cZ as KlarnaGatewaySort, cY as KlarnaGatewayUpdate, c_ as KlarnaPayment, c$ as KlarnaPaymentCreate, d1 as KlarnaPaymentSort, d0 as KlarnaPaymentUpdate, d6 as LineItem, d7 as LineItemCreate, d2 as LineItemOption, d3 as LineItemOptionCreate, d5 as LineItemOptionSort, d4 as LineItemOptionUpdate, d9 as LineItemSort, d8 as LineItemUpdate, da as Link, db as LinkCreate, dd as LinkSort, dc as LinkUpdate, de as ManualGateway, df as ManualGatewayCreate, dh as ManualGatewaySort, dg as ManualGatewayUpdate, di as ManualTaxCalculator, dj as ManualTaxCalculatorCreate, dl as ManualTaxCalculatorSort, dk as ManualTaxCalculatorUpdate, dm as Market, dn as MarketCreate, dq as MarketSort, dp as MarketUpdate, dr as Merchant, ds as MerchantCreate, du as MerchantSort, dt as MerchantUpdate, dv as Notification, dw as NotificationCreate, dy as NotificationSort, dx as NotificationUpdate, dR as Order, dz as OrderAmountPromotionRule, dA as OrderAmountPromotionRuleCreate, dC as OrderAmountPromotionRuleSort, dB as OrderAmountPromotionRuleUpdate, dD as OrderCopy, dE as OrderCopyCreate, dG as OrderCopySort, dF as OrderCopyUpdate, dS as OrderCreate, dH as OrderFactory, dI as OrderFactorySort, dU as OrderSort, dN as OrderSubscription, dO as OrderSubscriptionCreate, dJ as OrderSubscriptionItem, dK as OrderSubscriptionItemCreate, dM as OrderSubscriptionItemSort, dL as OrderSubscriptionItemUpdate, dQ as OrderSubscriptionSort, dP as OrderSubscriptionUpdate, dT as OrderUpdate, dV as Organization, dW as OrganizationSort, dX as Package, dY as PackageCreate, d_ as PackageSort, dZ as PackageUpdate, e3 as Parcel, e4 as ParcelCreate, d$ as ParcelLineItem, e0 as ParcelLineItemCreate, e2 as ParcelLineItemSort, e1 as ParcelLineItemUpdate, e6 as ParcelSort, e5 as ParcelUpdate, e7 as PaymentGateway, e8 as PaymentGatewaySort, e9 as PaymentMethod, ea as PaymentMethodCreate, ec as PaymentMethodSort, eb as PaymentMethodUpdate, ed as PaymentOption, ee as PaymentOptionCreate, eg as PaymentOptionSort, ef as PaymentOptionUpdate, eh as PaypalGateway, ei as PaypalGatewayCreate, ek as PaypalGatewaySort, ej as PaypalGatewayUpdate, el as PaypalPayment, em as PaypalPaymentCreate, eo as PaypalPaymentSort, en as PaypalPaymentUpdate, ep as PercentageDiscountPromotion, eq as PercentageDiscountPromotionCreate, es as PercentageDiscountPromotionSort, er as PercentageDiscountPromotionUpdate, et as Pickup, eu as PickupSort, eN as Price, eO as PriceCreate, ev as PriceFrequencyTier, ew as PriceFrequencyTierCreate, ey as PriceFrequencyTierSort, ex as PriceFrequencyTierUpdate, eD as PriceList, eE as PriceListCreate, ez as PriceListScheduler, eA as PriceListSchedulerCreate, eC as PriceListSchedulerSort, eB as PriceListSchedulerUpdate, eG as PriceListSort, eF as PriceListUpdate, eQ as PriceSort, eH as PriceTier, eI as PriceTierSort, eP as PriceUpdate, eJ as PriceVolumeTier, eK as PriceVolumeTierCreate, eM as PriceVolumeTierSort, eL as PriceVolumeTierUpdate, eT as Promotion, eR as PromotionRule, eS as PromotionRuleSort, eU as PromotionSort, eV as RecurringOrderCopy, eW as RecurringOrderCopyCreate, eY as RecurringOrderCopySort, eX as RecurringOrderCopyUpdate, eZ as Refund, e$ as RefundSort, e_ as RefundUpdate, f0 as ReservedStock, f1 as ReservedStockSort, f2 as ResourceError, f3 as ResourceErrorSort, f8 as Return, f9 as ReturnCreate, f4 as ReturnLineItem, f5 as ReturnLineItemCreate, f7 as ReturnLineItemSort, f6 as ReturnLineItemUpdate, fb as ReturnSort, fa as ReturnUpdate, fc as SatispayGateway, fd as SatispayGatewayCreate, ff as SatispayGatewaySort, fe as SatispayGatewayUpdate, fg as SatispayPayment, fh as SatispayPaymentCreate, fj as SatispayPaymentSort, fi as SatispayPaymentUpdate, fk as Shipment, fl as ShipmentCreate, fn as ShipmentSort, fm as ShipmentUpdate, fo as ShippingCategory, fp as ShippingCategoryCreate, fr as ShippingCategorySort, fq as ShippingCategoryUpdate, fu as ShippingMethod, fv as ShippingMethodCreate, fx as ShippingMethodSort, fs as ShippingMethodTier, ft as ShippingMethodTierSort, fw as ShippingMethodUpdate, fy as ShippingWeightTier, fz as ShippingWeightTierCreate, fB as ShippingWeightTierSort, fA as ShippingWeightTierUpdate, fC as ShippingZone, fD as ShippingZoneCreate, fF as ShippingZoneSort, fE as ShippingZoneUpdate, fW as Sku, fX as SkuCreate, fO as SkuList, fP as SkuListCreate, fG as SkuListItem, fH as SkuListItemCreate, fJ as SkuListItemSort, fI as SkuListItemUpdate, fK as SkuListPromotionRule, fL as SkuListPromotionRuleCreate, fN as SkuListPromotionRuleSort, fM as SkuListPromotionRuleUpdate, fR as SkuListSort, fQ as SkuListUpdate, fS as SkuOption, fT as SkuOptionCreate, fV as SkuOptionSort, fU as SkuOptionUpdate, fZ as SkuSort, fY as SkuUpdate, f_ as StockItem, f$ as StockItemCreate, g1 as StockItemSort, g0 as StockItemUpdate, g2 as StockLineItem, g3 as StockLineItemCreate, g5 as StockLineItemSort, g4 as StockLineItemUpdate, g6 as StockLocation, g7 as StockLocationCreate, g9 as StockLocationSort, g8 as StockLocationUpdate, ga as StockReservation, gb as StockReservationCreate, gd as StockReservationSort, gc as StockReservationUpdate, ge as StockTransfer, gf as StockTransferCreate, gh as StockTransferSort, gg as StockTransferUpdate, gi as Store, gj as StoreCreate, gl as StoreSort, gk as StoreUpdate, gm as StripeGateway, gn as StripeGatewayCreate, gp as StripeGatewaySort, go as StripeGatewayUpdate, gq as StripePayment, gr as StripePaymentCreate, gt as StripePaymentSort, gs as StripePaymentUpdate, gu as StripeTaxAccount, gv as StripeTaxAccountCreate, gx as StripeTaxAccountSort, gw as StripeTaxAccountUpdate, gy as SubscriptionModel, gz as SubscriptionModelCreate, gB as SubscriptionModelSort, gA as SubscriptionModelUpdate, gC as Tag, gD as TagCreate, gF as TagSort, gE as TagUpdate, gG as TalonOneAccount, gH as TalonOneAccountCreate, gJ as TalonOneAccountSort, gI as TalonOneAccountUpdate, gK as TaxCalculator, gL as TaxCalculatorSort, gM as TaxCategory, gN as TaxCategoryCreate, gP as TaxCategorySort, gO as TaxCategoryUpdate, gQ as TaxRule, gR as TaxRuleCreate, gT as TaxRuleSort, gS as TaxRuleUpdate, gU as TaxjarAccount, gV as TaxjarAccountCreate, gX as TaxjarAccountSort, gW as TaxjarAccountUpdate, gY as Transaction, gZ as TransactionSort, g_ as Version, g$ as VersionSort, h0 as VertexAccount, h1 as VertexAccountCreate, h3 as VertexAccountSort, h2 as VertexAccountUpdate, h4 as Void, h6 as VoidSort, h5 as VoidUpdate, h7 as Webhook, h8 as WebhookCreate, ha as WebhookSort, h9 as WebhookUpdate, hb as WireTransfer, hc as WireTransferCreate, he as WireTransferSort, hd as WireTransferUpdate } from './api-BYcswOJ0.cjs';
2
+ import './client.cjs';
3
+ import './interceptor-5MISI1yn.cjs';
4
+ import './types.cjs';
package/lib/model.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export { D as Address, E as AddressCreate, G as AddressSort, F as AddressUpdate, H as Adjustment, I as AdjustmentCreate, K as AdjustmentSort, J as AdjustmentUpdate, N as AdyenGateway, O as AdyenGatewayCreate, S as AdyenGatewaySort, P as AdyenGatewayUpdate, T as AdyenPayment, U as AdyenPaymentCreate, W as AdyenPaymentSort, V as AdyenPaymentUpdate, X as Application, Y as ApplicationSort, Z as Attachment, _ as AttachmentCreate, a0 as AttachmentSort, $ as AttachmentUpdate, a1 as Authorization, a3 as AuthorizationSort, a2 as AuthorizationUpdate, a4 as AvalaraAccount, a5 as AvalaraAccountCreate, a7 as AvalaraAccountSort, a6 as AvalaraAccountUpdate, a8 as AxerveGateway, a9 as AxerveGatewayCreate, ab as AxerveGatewaySort, aa as AxerveGatewayUpdate, ac as AxervePayment, ad as AxervePaymentCreate, af as AxervePaymentSort, ae as AxervePaymentUpdate, ag as BingGeocoder, ah as BingGeocoderCreate, aj as BingGeocoderSort, ai as BingGeocoderUpdate, ak as BraintreeGateway, al as BraintreeGatewayCreate, an as BraintreeGatewaySort, am as BraintreeGatewayUpdate, ao as BraintreePayment, ap as BraintreePaymentCreate, ar as BraintreePaymentSort, aq as BraintreePaymentUpdate, as as Bundle, at as BundleCreate, av as BundleSort, au as BundleUpdate, aw as BuyXPayYPromotion, ax as BuyXPayYPromotionCreate, az as BuyXPayYPromotionSort, ay as BuyXPayYPromotionUpdate, aA as Capture, aC as CaptureSort, aB as CaptureUpdate, aD as CarrierAccount, aE as CarrierAccountCreate, aG as CarrierAccountSort, aF as CarrierAccountUpdate, aH as CheckoutComGateway, aI as CheckoutComGatewayCreate, aK as CheckoutComGatewaySort, aJ as CheckoutComGatewayUpdate, aL as CheckoutComPayment, aM as CheckoutComPaymentCreate, aO as CheckoutComPaymentSort, aN as CheckoutComPaymentUpdate, aP as Cleanup, aQ as CleanupCreate, aS as CleanupSort, aR as CleanupUpdate, a$ as Coupon, aT as CouponCodesPromotionRule, aU as CouponCodesPromotionRuleCreate, aW as CouponCodesPromotionRuleSort, aV as CouponCodesPromotionRuleUpdate, b0 as CouponCreate, aX as CouponRecipient, aY as CouponRecipientCreate, a_ as CouponRecipientSort, aZ as CouponRecipientUpdate, b2 as CouponSort, b1 as CouponUpdate, b3 as CustomPromotionRule, b4 as CustomPromotionRuleCreate, b6 as CustomPromotionRuleSort, b5 as CustomPromotionRuleUpdate, br as Customer, b7 as CustomerAddress, b8 as CustomerAddressCreate, ba as CustomerAddressSort, b9 as CustomerAddressUpdate, bs as CustomerCreate, bb as CustomerGroup, bc as CustomerGroupCreate, be as CustomerGroupSort, bd as CustomerGroupUpdate, bf as CustomerPasswordReset, bg as CustomerPasswordResetCreate, bi as CustomerPasswordResetSort, bh as CustomerPasswordResetUpdate, bj as CustomerPaymentSource, bk as CustomerPaymentSourceCreate, bm as CustomerPaymentSourceSort, bl as CustomerPaymentSourceUpdate, bu as CustomerSort, bn as CustomerSubscription, bo as CustomerSubscriptionCreate, bq as CustomerSubscriptionSort, bp as CustomerSubscriptionUpdate, bt as CustomerUpdate, bv as DeliveryLeadTime, bw as DeliveryLeadTimeCreate, by as DeliveryLeadTimeSort, bx as DeliveryLeadTimeUpdate, bB as DiscountEngine, bz as DiscountEngineItem, bA as DiscountEngineItemSort, bC as DiscountEngineSort, bD as EasypostPickup, bE as EasypostPickupCreate, bG as EasypostPickupSort, bF as EasypostPickupUpdate, bJ as Event, bH as EventCallback, bI as EventCallbackSort, bL as EventSort, bK as EventUpdate, bM as Export, bN as ExportCreate, bP as ExportSort, bO as ExportUpdate, bQ as ExternalGateway, bR as ExternalGatewayCreate, bT as ExternalGatewaySort, bS as ExternalGatewayUpdate, bU as ExternalPayment, bV as ExternalPaymentCreate, bX as ExternalPaymentSort, bW as ExternalPaymentUpdate, bY as ExternalPromotion, bZ as ExternalPromotionCreate, b$ as ExternalPromotionSort, b_ as ExternalPromotionUpdate, c0 as ExternalTaxCalculator, c1 as ExternalTaxCalculatorCreate, c3 as ExternalTaxCalculatorSort, c2 as ExternalTaxCalculatorUpdate, c4 as FixedAmountPromotion, c5 as FixedAmountPromotionCreate, c7 as FixedAmountPromotionSort, c6 as FixedAmountPromotionUpdate, c8 as FixedPricePromotion, c9 as FixedPricePromotionCreate, cb as FixedPricePromotionSort, ca as FixedPricePromotionUpdate, cc as FlexPromotion, cd as FlexPromotionCreate, cf as FlexPromotionSort, ce as FlexPromotionUpdate, cg as FreeGiftPromotion, ch as FreeGiftPromotionCreate, cj as FreeGiftPromotionSort, ci as FreeGiftPromotionUpdate, ck as FreeShippingPromotion, cl as FreeShippingPromotionCreate, cn as FreeShippingPromotionSort, cm as FreeShippingPromotionUpdate, co as Geocoder, cp as GeocoderSort, cu as GiftCard, cv as GiftCardCreate, cq as GiftCardRecipient, cr as GiftCardRecipientCreate, ct as GiftCardRecipientSort, cs as GiftCardRecipientUpdate, cx as GiftCardSort, cw as GiftCardUpdate, cy as GoogleGeocoder, cz as GoogleGeocoderCreate, cB as GoogleGeocoderSort, cA as GoogleGeocoderUpdate, cC as Import, cD as ImportCreate, cF as ImportSort, cE as ImportUpdate, cG as InStockSubscription, cH as InStockSubscriptionCreate, cJ as InStockSubscriptionSort, cI as InStockSubscriptionUpdate, cK as InventoryModel, cL as InventoryModelCreate, cN as InventoryModelSort, cM as InventoryModelUpdate, cO as InventoryReturnLocation, cP as InventoryReturnLocationCreate, cR as InventoryReturnLocationSort, cQ as InventoryReturnLocationUpdate, cS as InventoryStockLocation, cT as InventoryStockLocationCreate, cV as InventoryStockLocationSort, cU as InventoryStockLocationUpdate, cW as KlarnaGateway, cX as KlarnaGatewayCreate, cZ as KlarnaGatewaySort, cY as KlarnaGatewayUpdate, c_ as KlarnaPayment, c$ as KlarnaPaymentCreate, d1 as KlarnaPaymentSort, d0 as KlarnaPaymentUpdate, d6 as LineItem, d7 as LineItemCreate, d2 as LineItemOption, d3 as LineItemOptionCreate, d5 as LineItemOptionSort, d4 as LineItemOptionUpdate, d9 as LineItemSort, d8 as LineItemUpdate, da as Link, db as LinkCreate, dd as LinkSort, dc as LinkUpdate, de as ManualGateway, df as ManualGatewayCreate, dh as ManualGatewaySort, dg as ManualGatewayUpdate, di as ManualTaxCalculator, dj as ManualTaxCalculatorCreate, dl as ManualTaxCalculatorSort, dk as ManualTaxCalculatorUpdate, dm as Market, dn as MarketCreate, dq as MarketSort, dp as MarketUpdate, dr as Merchant, ds as MerchantCreate, du as MerchantSort, dt as MerchantUpdate, dv as Notification, dw as NotificationCreate, dy as NotificationSort, dx as NotificationUpdate, dR as Order, dz as OrderAmountPromotionRule, dA as OrderAmountPromotionRuleCreate, dC as OrderAmountPromotionRuleSort, dB as OrderAmountPromotionRuleUpdate, dD as OrderCopy, dE as OrderCopyCreate, dG as OrderCopySort, dF as OrderCopyUpdate, dS as OrderCreate, dH as OrderFactory, dI as OrderFactorySort, dU as OrderSort, dN as OrderSubscription, dO as OrderSubscriptionCreate, dJ as OrderSubscriptionItem, dK as OrderSubscriptionItemCreate, dM as OrderSubscriptionItemSort, dL as OrderSubscriptionItemUpdate, dQ as OrderSubscriptionSort, dP as OrderSubscriptionUpdate, dT as OrderUpdate, dV as Organization, dW as OrganizationSort, dX as Package, dY as PackageCreate, d_ as PackageSort, dZ as PackageUpdate, e3 as Parcel, e4 as ParcelCreate, d$ as ParcelLineItem, e0 as ParcelLineItemCreate, e2 as ParcelLineItemSort, e1 as ParcelLineItemUpdate, e6 as ParcelSort, e5 as ParcelUpdate, e7 as PaymentGateway, e8 as PaymentGatewaySort, e9 as PaymentMethod, ea as PaymentMethodCreate, ec as PaymentMethodSort, eb as PaymentMethodUpdate, ed as PaymentOption, ee as PaymentOptionCreate, eg as PaymentOptionSort, ef as PaymentOptionUpdate, eh as PaypalGateway, ei as PaypalGatewayCreate, ek as PaypalGatewaySort, ej as PaypalGatewayUpdate, el as PaypalPayment, em as PaypalPaymentCreate, eo as PaypalPaymentSort, en as PaypalPaymentUpdate, ep as PercentageDiscountPromotion, eq as PercentageDiscountPromotionCreate, es as PercentageDiscountPromotionSort, er as PercentageDiscountPromotionUpdate, et as Pickup, eu as PickupSort, eN as Price, eO as PriceCreate, ev as PriceFrequencyTier, ew as PriceFrequencyTierCreate, ey as PriceFrequencyTierSort, ex as PriceFrequencyTierUpdate, eD as PriceList, eE as PriceListCreate, ez as PriceListScheduler, eA as PriceListSchedulerCreate, eC as PriceListSchedulerSort, eB as PriceListSchedulerUpdate, eG as PriceListSort, eF as PriceListUpdate, eQ as PriceSort, eH as PriceTier, eI as PriceTierSort, eP as PriceUpdate, eJ as PriceVolumeTier, eK as PriceVolumeTierCreate, eM as PriceVolumeTierSort, eL as PriceVolumeTierUpdate, eT as Promotion, eR as PromotionRule, eS as PromotionRuleSort, eU as PromotionSort, eV as RecurringOrderCopy, eW as RecurringOrderCopyCreate, eY as RecurringOrderCopySort, eX as RecurringOrderCopyUpdate, eZ as Refund, e$ as RefundSort, e_ as RefundUpdate, f0 as ReservedStock, f1 as ReservedStockSort, f2 as ResourceError, f3 as ResourceErrorSort, f8 as Return, f9 as ReturnCreate, f4 as ReturnLineItem, f5 as ReturnLineItemCreate, f7 as ReturnLineItemSort, f6 as ReturnLineItemUpdate, fb as ReturnSort, fa as ReturnUpdate, fc as SatispayGateway, fd as SatispayGatewayCreate, ff as SatispayGatewaySort, fe as SatispayGatewayUpdate, fg as SatispayPayment, fh as SatispayPaymentCreate, fj as SatispayPaymentSort, fi as SatispayPaymentUpdate, fk as Shipment, fl as ShipmentCreate, fn as ShipmentSort, fm as ShipmentUpdate, fo as ShippingCategory, fp as ShippingCategoryCreate, fr as ShippingCategorySort, fq as ShippingCategoryUpdate, fu as ShippingMethod, fv as ShippingMethodCreate, fx as ShippingMethodSort, fs as ShippingMethodTier, ft as ShippingMethodTierSort, fw as ShippingMethodUpdate, fy as ShippingWeightTier, fz as ShippingWeightTierCreate, fB as ShippingWeightTierSort, fA as ShippingWeightTierUpdate, fC as ShippingZone, fD as ShippingZoneCreate, fF as ShippingZoneSort, fE as ShippingZoneUpdate, fW as Sku, fX as SkuCreate, fO as SkuList, fP as SkuListCreate, fG as SkuListItem, fH as SkuListItemCreate, fJ as SkuListItemSort, fI as SkuListItemUpdate, fK as SkuListPromotionRule, fL as SkuListPromotionRuleCreate, fN as SkuListPromotionRuleSort, fM as SkuListPromotionRuleUpdate, fR as SkuListSort, fQ as SkuListUpdate, fS as SkuOption, fT as SkuOptionCreate, fV as SkuOptionSort, fU as SkuOptionUpdate, fZ as SkuSort, fY as SkuUpdate, f_ as StockItem, f$ as StockItemCreate, g1 as StockItemSort, g0 as StockItemUpdate, g2 as StockLineItem, g3 as StockLineItemCreate, g5 as StockLineItemSort, g4 as StockLineItemUpdate, g6 as StockLocation, g7 as StockLocationCreate, g9 as StockLocationSort, g8 as StockLocationUpdate, ga as StockReservation, gb as StockReservationCreate, gd as StockReservationSort, gc as StockReservationUpdate, ge as StockTransfer, gf as StockTransferCreate, gh as StockTransferSort, gg as StockTransferUpdate, gi as Store, gj as StoreCreate, gl as StoreSort, gk as StoreUpdate, gm as StripeGateway, gn as StripeGatewayCreate, gp as StripeGatewaySort, go as StripeGatewayUpdate, gq as StripePayment, gr as StripePaymentCreate, gt as StripePaymentSort, gs as StripePaymentUpdate, gu as StripeTaxAccount, gv as StripeTaxAccountCreate, gx as StripeTaxAccountSort, gw as StripeTaxAccountUpdate, gy as SubscriptionModel, gz as SubscriptionModelCreate, gB as SubscriptionModelSort, gA as SubscriptionModelUpdate, gC as Tag, gD as TagCreate, gF as TagSort, gE as TagUpdate, gG as TalonOneAccount, gH as TalonOneAccountCreate, gJ as TalonOneAccountSort, gI as TalonOneAccountUpdate, gK as TaxCalculator, gL as TaxCalculatorSort, gM as TaxCategory, gN as TaxCategoryCreate, gP as TaxCategorySort, gO as TaxCategoryUpdate, gQ as TaxRule, gR as TaxRuleCreate, gT as TaxRuleSort, gS as TaxRuleUpdate, gU as TaxjarAccount, gV as TaxjarAccountCreate, gX as TaxjarAccountSort, gW as TaxjarAccountUpdate, gY as Transaction, gZ as TransactionSort, g_ as Version, g$ as VersionSort, h0 as VertexAccount, h1 as VertexAccountCreate, h3 as VertexAccountSort, h2 as VertexAccountUpdate, h4 as Void, h6 as VoidSort, h5 as VoidUpdate, h7 as Webhook, h8 as WebhookCreate, ha as WebhookSort, h9 as WebhookUpdate, hb as WireTransfer, hc as WireTransferCreate, he as WireTransferSort, hd as WireTransferUpdate } from './api-Cknm0QL_.js';
2
+ import './client.js';
3
+ import './interceptor-5MISI1yn.js';
4
+ import './types.js';
package/lib/model.js ADDED
@@ -0,0 +1 @@
1
+
package/lib/query.cjs ADDED
@@ -0,0 +1,64 @@
1
+ 'use strict';
2
+
3
+ var error = require('./error');
4
+ var Debug = require('./debug');
5
+
6
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
+
8
+ var Debug__default = /*#__PURE__*/_interopDefault(Debug);
9
+
10
+ const debug = Debug__default.default("query");
11
+ const arrayFilters = ["_any", "_all", "_in", "_not_in_or_null"];
12
+ const isArrayFilter = (filter) => {
13
+ return arrayFilters.some((f) => filter.endsWith(f));
14
+ };
15
+ const objectFilters = ["_jcont"];
16
+ const isObjectFilter = (filter) => {
17
+ return objectFilters.some((f) => filter.endsWith(f));
18
+ };
19
+ const isParamsList = (params) => {
20
+ return params && (params.filters || params.pageNumber || params.pageSize || params.sort);
21
+ };
22
+ const generateQueryStringParams = (params, res) => {
23
+ debug("generate query string params: %O, %O", params, res);
24
+ const qp = {};
25
+ if (!params) return qp;
26
+ if (params.include) qp.include = params.include.join(",");
27
+ if (params.fields) {
28
+ if (Array.isArray(params.fields)) params.fields = { [res.type || res]: params.fields };
29
+ Object.entries(params.fields).forEach(([p, v]) => {
30
+ qp[`fields[${p}]`] = v.join(",");
31
+ });
32
+ }
33
+ if (isParamsList(params)) {
34
+ if (params.sort) {
35
+ if (Array.isArray(params.sort)) qp.sort = params.sort.join(",");
36
+ else qp.sort = Object.entries(params.sort).map(([k, v]) => `${v === "desc" ? "-" : ""}${k}`).join(",");
37
+ }
38
+ if (params.pageNumber) qp["page[number]"] = String(params.pageNumber);
39
+ if (params.pageSize) qp["page[size]"] = String(params.pageSize);
40
+ if (params.filters) {
41
+ Object.entries(params.filters).forEach(([p, v]) => {
42
+ let val;
43
+ if (Array.isArray(v)) {
44
+ if (!isArrayFilter(p)) throw new error.SdkError({ message: `Incorrect filter [${p}]: Array value is supported only for the following filters: ${arrayFilters.join(", ")}`, type: error.ErrorType.REQUEST });
45
+ val = v.join(",");
46
+ } else if (typeof v === "object") {
47
+ if (!isObjectFilter(p)) throw new error.SdkError({ message: `Incorrect filter [${p}]: Object value is supported only for the following filters: ${objectFilters.join(", ")}`, type: error.ErrorType.REQUEST });
48
+ val = JSON.stringify(v);
49
+ } else val = String(v);
50
+ qp[`filter[q][${p}]`] = val;
51
+ });
52
+ }
53
+ }
54
+ debug("query string params: %O", qp);
55
+ return qp;
56
+ };
57
+ const generateSearchString = (params, questionMark = true) => {
58
+ if (!params || Object.keys(params).length === 0) return "";
59
+ return `${questionMark ? "?" : ""}${Object.entries(params).map(([key, val]) => `${key}=${String(val)}`).join("&")}`;
60
+ };
61
+
62
+ exports.generateQueryStringParams = generateQueryStringParams;
63
+ exports.generateSearchString = generateSearchString;
64
+ exports.isParamsList = isParamsList;
@@ -0,0 +1,4 @@
1
+ export { b as QueryArrayFields, f as QueryArraySortable, d as QueryFields, k as QueryFilter, Q as QueryInclude, l as QueryPageNumber, m as QueryPageSize, o as QueryParams, n as QueryParamsList, e as QueryParamsRetrieve, c as QueryRecordFields, h as QueryRecordSortable, j as QuerySort, g as generateQueryStringParams, a as generateSearchString, i as isParamsList } from './api-BYcswOJ0.cjs';
2
+ import './types.cjs';
3
+ import './client.cjs';
4
+ import './interceptor-5MISI1yn.cjs';
package/lib/query.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export { b as QueryArrayFields, f as QueryArraySortable, d as QueryFields, k as QueryFilter, Q as QueryInclude, l as QueryPageNumber, m as QueryPageSize, o as QueryParams, n as QueryParamsList, e as QueryParamsRetrieve, c as QueryRecordFields, h as QueryRecordSortable, j as QuerySort, g as generateQueryStringParams, a as generateSearchString, i as isParamsList } from './api-Cknm0QL_.js';
2
+ import './types.js';
3
+ import './client.js';
4
+ import './interceptor-5MISI1yn.js';
package/lib/query.js ADDED
@@ -0,0 +1,56 @@
1
+ import { SdkError, ErrorType } from './error';
2
+ import Debug from './debug';
3
+
4
+ const debug = Debug("query");
5
+ const arrayFilters = ["_any", "_all", "_in", "_not_in_or_null"];
6
+ const isArrayFilter = (filter) => {
7
+ return arrayFilters.some((f) => filter.endsWith(f));
8
+ };
9
+ const objectFilters = ["_jcont"];
10
+ const isObjectFilter = (filter) => {
11
+ return objectFilters.some((f) => filter.endsWith(f));
12
+ };
13
+ const isParamsList = (params) => {
14
+ return params && (params.filters || params.pageNumber || params.pageSize || params.sort);
15
+ };
16
+ const generateQueryStringParams = (params, res) => {
17
+ debug("generate query string params: %O, %O", params, res);
18
+ const qp = {};
19
+ if (!params) return qp;
20
+ if (params.include) qp.include = params.include.join(",");
21
+ if (params.fields) {
22
+ if (Array.isArray(params.fields)) params.fields = { [res.type || res]: params.fields };
23
+ Object.entries(params.fields).forEach(([p, v]) => {
24
+ qp[`fields[${p}]`] = v.join(",");
25
+ });
26
+ }
27
+ if (isParamsList(params)) {
28
+ if (params.sort) {
29
+ if (Array.isArray(params.sort)) qp.sort = params.sort.join(",");
30
+ else qp.sort = Object.entries(params.sort).map(([k, v]) => `${v === "desc" ? "-" : ""}${k}`).join(",");
31
+ }
32
+ if (params.pageNumber) qp["page[number]"] = String(params.pageNumber);
33
+ if (params.pageSize) qp["page[size]"] = String(params.pageSize);
34
+ if (params.filters) {
35
+ Object.entries(params.filters).forEach(([p, v]) => {
36
+ let val;
37
+ if (Array.isArray(v)) {
38
+ if (!isArrayFilter(p)) throw new SdkError({ message: `Incorrect filter [${p}]: Array value is supported only for the following filters: ${arrayFilters.join(", ")}`, type: ErrorType.REQUEST });
39
+ val = v.join(",");
40
+ } else if (typeof v === "object") {
41
+ if (!isObjectFilter(p)) throw new SdkError({ message: `Incorrect filter [${p}]: Object value is supported only for the following filters: ${objectFilters.join(", ")}`, type: ErrorType.REQUEST });
42
+ val = JSON.stringify(v);
43
+ } else val = String(v);
44
+ qp[`filter[q][${p}]`] = val;
45
+ });
46
+ }
47
+ }
48
+ debug("query string params: %O", qp);
49
+ return qp;
50
+ };
51
+ const generateSearchString = (params, questionMark = true) => {
52
+ if (!params || Object.keys(params).length === 0) return "";
53
+ return `${questionMark ? "?" : ""}${Object.entries(params).map(([key, val]) => `${key}=${String(val)}`).join("&")}`;
54
+ };
55
+
56
+ export { generateQueryStringParams, generateSearchString, isParamsList };