@shopify/shopify-api 13.1.0 → 14.0.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 (603) hide show
  1. package/dist/cjs/lib/auth/oauth/create-session.js +1 -1
  2. package/dist/cjs/lib/auth/oauth/create-session.js.map +1 -1
  3. package/dist/cjs/lib/auth/oauth/oauth.js +4 -1
  4. package/dist/cjs/lib/auth/oauth/oauth.js.map +1 -1
  5. package/dist/cjs/lib/billing/types.js.map +1 -1
  6. package/dist/cjs/lib/clients/common.js +64 -8
  7. package/dist/cjs/lib/clients/common.js.map +1 -1
  8. package/dist/cjs/lib/config.js +2 -2
  9. package/dist/cjs/lib/config.js.map +1 -1
  10. package/dist/cjs/lib/types.js +1 -1
  11. package/dist/cjs/lib/types.js.map +1 -1
  12. package/dist/cjs/lib/utils/fetch-request.js +12 -1
  13. package/dist/cjs/lib/utils/fetch-request.js.map +1 -1
  14. package/dist/cjs/lib/utils/hmac-validator.js +53 -7
  15. package/dist/cjs/lib/utils/hmac-validator.js.map +1 -1
  16. package/dist/cjs/lib/utils/processed-query.js +1 -1
  17. package/dist/cjs/lib/utils/processed-query.js.map +1 -1
  18. package/dist/cjs/lib/version.js +1 -1
  19. package/dist/cjs/lib/version.js.map +1 -1
  20. package/dist/cjs/lib/webhooks/process.js +2 -2
  21. package/dist/cjs/lib/webhooks/process.js.map +1 -1
  22. package/dist/cjs/lib/webhooks/register.js +0 -4
  23. package/dist/cjs/lib/webhooks/register.js.map +1 -1
  24. package/dist/cjs/lib/webhooks/types.js +0 -1
  25. package/dist/cjs/lib/webhooks/types.js.map +1 -1
  26. package/dist/cjs/lib/webhooks/validate.js +0 -3
  27. package/dist/cjs/lib/webhooks/validate.js.map +1 -1
  28. package/dist/cjs/rest/admin/2026-07/abandoned_checkout.js +85 -0
  29. package/dist/cjs/rest/admin/2026-07/abandoned_checkout.js.map +1 -0
  30. package/dist/cjs/rest/admin/2026-07/access_scope.js +36 -0
  31. package/dist/cjs/rest/admin/2026-07/access_scope.js.map +1 -0
  32. package/dist/cjs/rest/admin/2026-07/apple_pay_certificate.js +62 -0
  33. package/dist/cjs/rest/admin/2026-07/apple_pay_certificate.js.map +1 -0
  34. package/dist/cjs/rest/admin/2026-07/application_charge.js +56 -0
  35. package/dist/cjs/rest/admin/2026-07/application_charge.js.map +1 -0
  36. package/dist/cjs/rest/admin/2026-07/application_credit.js +50 -0
  37. package/dist/cjs/rest/admin/2026-07/application_credit.js.map +1 -0
  38. package/dist/cjs/rest/admin/2026-07/article.js +114 -0
  39. package/dist/cjs/rest/admin/2026-07/article.js.map +1 -0
  40. package/dist/cjs/rest/admin/2026-07/asset.js +57 -0
  41. package/dist/cjs/rest/admin/2026-07/asset.js.map +1 -0
  42. package/dist/cjs/rest/admin/2026-07/assigned_fulfillment_order.js +41 -0
  43. package/dist/cjs/rest/admin/2026-07/assigned_fulfillment_order.js.map +1 -0
  44. package/dist/cjs/rest/admin/2026-07/balance.js +34 -0
  45. package/dist/cjs/rest/admin/2026-07/balance.js.map +1 -0
  46. package/dist/cjs/rest/admin/2026-07/blog.js +83 -0
  47. package/dist/cjs/rest/admin/2026-07/blog.js.map +1 -0
  48. package/dist/cjs/rest/admin/2026-07/cancellation_request.js +52 -0
  49. package/dist/cjs/rest/admin/2026-07/cancellation_request.js.map +1 -0
  50. package/dist/cjs/rest/admin/2026-07/carrier_service.js +63 -0
  51. package/dist/cjs/rest/admin/2026-07/carrier_service.js.map +1 -0
  52. package/dist/cjs/rest/admin/2026-07/checkout.js +103 -0
  53. package/dist/cjs/rest/admin/2026-07/checkout.js.map +1 -0
  54. package/dist/cjs/rest/admin/2026-07/collect.js +74 -0
  55. package/dist/cjs/rest/admin/2026-07/collect.js.map +1 -0
  56. package/dist/cjs/rest/admin/2026-07/collection.js +59 -0
  57. package/dist/cjs/rest/admin/2026-07/collection.js.map +1 -0
  58. package/dist/cjs/rest/admin/2026-07/collection_listing.js +80 -0
  59. package/dist/cjs/rest/admin/2026-07/collection_listing.js.map +1 -0
  60. package/dist/cjs/rest/admin/2026-07/comment.js +135 -0
  61. package/dist/cjs/rest/admin/2026-07/comment.js.map +1 -0
  62. package/dist/cjs/rest/admin/2026-07/country.js +76 -0
  63. package/dist/cjs/rest/admin/2026-07/country.js.map +1 -0
  64. package/dist/cjs/rest/admin/2026-07/currency.js +35 -0
  65. package/dist/cjs/rest/admin/2026-07/currency.js.map +1 -0
  66. package/dist/cjs/rest/admin/2026-07/custom_collection.js +79 -0
  67. package/dist/cjs/rest/admin/2026-07/custom_collection.js.map +1 -0
  68. package/dist/cjs/rest/admin/2026-07/customer.js +150 -0
  69. package/dist/cjs/rest/admin/2026-07/customer.js.map +1 -0
  70. package/dist/cjs/rest/admin/2026-07/deprecated_api_call.js +35 -0
  71. package/dist/cjs/rest/admin/2026-07/deprecated_api_call.js.map +1 -0
  72. package/dist/cjs/rest/admin/2026-07/discount_code.js +115 -0
  73. package/dist/cjs/rest/admin/2026-07/discount_code.js.map +1 -0
  74. package/dist/cjs/rest/admin/2026-07/dispute.js +53 -0
  75. package/dist/cjs/rest/admin/2026-07/dispute.js.map +1 -0
  76. package/dist/cjs/rest/admin/2026-07/dispute_evidence.js +57 -0
  77. package/dist/cjs/rest/admin/2026-07/dispute_evidence.js.map +1 -0
  78. package/dist/cjs/rest/admin/2026-07/dispute_file_upload.js +45 -0
  79. package/dist/cjs/rest/admin/2026-07/dispute_file_upload.js.map +1 -0
  80. package/dist/cjs/rest/admin/2026-07/draft_order.js +126 -0
  81. package/dist/cjs/rest/admin/2026-07/draft_order.js.map +1 -0
  82. package/dist/cjs/rest/admin/2026-07/event.js +67 -0
  83. package/dist/cjs/rest/admin/2026-07/event.js.map +1 -0
  84. package/dist/cjs/rest/admin/2026-07/fulfillment.js +102 -0
  85. package/dist/cjs/rest/admin/2026-07/fulfillment.js.map +1 -0
  86. package/dist/cjs/rest/admin/2026-07/fulfillment_event.js +79 -0
  87. package/dist/cjs/rest/admin/2026-07/fulfillment_event.js.map +1 -0
  88. package/dist/cjs/rest/admin/2026-07/fulfillment_order.js +164 -0
  89. package/dist/cjs/rest/admin/2026-07/fulfillment_order.js.map +1 -0
  90. package/dist/cjs/rest/admin/2026-07/fulfillment_request.js +61 -0
  91. package/dist/cjs/rest/admin/2026-07/fulfillment_request.js.map +1 -0
  92. package/dist/cjs/rest/admin/2026-07/fulfillment_service.js +66 -0
  93. package/dist/cjs/rest/admin/2026-07/fulfillment_service.js.map +1 -0
  94. package/dist/cjs/rest/admin/2026-07/gift_card.js +105 -0
  95. package/dist/cjs/rest/admin/2026-07/gift_card.js.map +1 -0
  96. package/dist/cjs/rest/admin/2026-07/gift_card_adjustment.js +58 -0
  97. package/dist/cjs/rest/admin/2026-07/gift_card_adjustment.js.map +1 -0
  98. package/dist/cjs/rest/admin/2026-07/image.js +77 -0
  99. package/dist/cjs/rest/admin/2026-07/image.js.map +1 -0
  100. package/dist/cjs/rest/admin/2026-07/index.js +155 -0
  101. package/dist/cjs/rest/admin/2026-07/index.js.map +1 -0
  102. package/dist/cjs/rest/admin/2026-07/inventory_item.js +54 -0
  103. package/dist/cjs/rest/admin/2026-07/inventory_item.js.map +1 -0
  104. package/dist/cjs/rest/admin/2026-07/inventory_level.js +87 -0
  105. package/dist/cjs/rest/admin/2026-07/inventory_level.js.map +1 -0
  106. package/dist/cjs/rest/admin/2026-07/location.js +85 -0
  107. package/dist/cjs/rest/admin/2026-07/location.js.map +1 -0
  108. package/dist/cjs/rest/admin/2026-07/locations_for_move.js +34 -0
  109. package/dist/cjs/rest/admin/2026-07/locations_for_move.js.map +1 -0
  110. package/dist/cjs/rest/admin/2026-07/marketing_event.js +98 -0
  111. package/dist/cjs/rest/admin/2026-07/marketing_event.js.map +1 -0
  112. package/dist/cjs/rest/admin/2026-07/metafield.js +154 -0
  113. package/dist/cjs/rest/admin/2026-07/metafield.js.map +1 -0
  114. package/dist/cjs/rest/admin/2026-07/mobile_platform_application.js +63 -0
  115. package/dist/cjs/rest/admin/2026-07/mobile_platform_application.js.map +1 -0
  116. package/dist/cjs/rest/admin/2026-07/order.js +202 -0
  117. package/dist/cjs/rest/admin/2026-07/order.js.map +1 -0
  118. package/dist/cjs/rest/admin/2026-07/order_risk.js +68 -0
  119. package/dist/cjs/rest/admin/2026-07/order_risk.js.map +1 -0
  120. package/dist/cjs/rest/admin/2026-07/page.js +83 -0
  121. package/dist/cjs/rest/admin/2026-07/page.js.map +1 -0
  122. package/dist/cjs/rest/admin/2026-07/payment.js +46 -0
  123. package/dist/cjs/rest/admin/2026-07/payment.js.map +1 -0
  124. package/dist/cjs/rest/admin/2026-07/payment_gateway.js +72 -0
  125. package/dist/cjs/rest/admin/2026-07/payment_gateway.js.map +1 -0
  126. package/dist/cjs/rest/admin/2026-07/payment_transaction.js +56 -0
  127. package/dist/cjs/rest/admin/2026-07/payment_transaction.js.map +1 -0
  128. package/dist/cjs/rest/admin/2026-07/payout.js +47 -0
  129. package/dist/cjs/rest/admin/2026-07/payout.js.map +1 -0
  130. package/dist/cjs/rest/admin/2026-07/policy.js +39 -0
  131. package/dist/cjs/rest/admin/2026-07/policy.js.map +1 -0
  132. package/dist/cjs/rest/admin/2026-07/price_rule.js +97 -0
  133. package/dist/cjs/rest/admin/2026-07/price_rule.js.map +1 -0
  134. package/dist/cjs/rest/admin/2026-07/product.js +89 -0
  135. package/dist/cjs/rest/admin/2026-07/product.js.map +1 -0
  136. package/dist/cjs/rest/admin/2026-07/product_listing.js +99 -0
  137. package/dist/cjs/rest/admin/2026-07/product_listing.js.map +1 -0
  138. package/dist/cjs/rest/admin/2026-07/product_resource_feedback.js +46 -0
  139. package/dist/cjs/rest/admin/2026-07/product_resource_feedback.js.map +1 -0
  140. package/dist/cjs/rest/admin/2026-07/province.js +65 -0
  141. package/dist/cjs/rest/admin/2026-07/province.js.map +1 -0
  142. package/dist/cjs/rest/admin/2026-07/recurring_application_charge.js +87 -0
  143. package/dist/cjs/rest/admin/2026-07/recurring_application_charge.js.map +1 -0
  144. package/dist/cjs/rest/admin/2026-07/redirect.js +71 -0
  145. package/dist/cjs/rest/admin/2026-07/redirect.js.map +1 -0
  146. package/dist/cjs/rest/admin/2026-07/refund.js +72 -0
  147. package/dist/cjs/rest/admin/2026-07/refund.js.map +1 -0
  148. package/dist/cjs/rest/admin/2026-07/resource_feedback.js +41 -0
  149. package/dist/cjs/rest/admin/2026-07/resource_feedback.js.map +1 -0
  150. package/dist/cjs/rest/admin/2026-07/script_tag.js +75 -0
  151. package/dist/cjs/rest/admin/2026-07/script_tag.js.map +1 -0
  152. package/dist/cjs/rest/admin/2026-07/shipping_zone.js +47 -0
  153. package/dist/cjs/rest/admin/2026-07/shipping_zone.js.map +1 -0
  154. package/dist/cjs/rest/admin/2026-07/shop.js +96 -0
  155. package/dist/cjs/rest/admin/2026-07/shop.js.map +1 -0
  156. package/dist/cjs/rest/admin/2026-07/smart_collection.js +93 -0
  157. package/dist/cjs/rest/admin/2026-07/smart_collection.js.map +1 -0
  158. package/dist/cjs/rest/admin/2026-07/storefront_access_token.js +50 -0
  159. package/dist/cjs/rest/admin/2026-07/storefront_access_token.js.map +1 -0
  160. package/dist/cjs/rest/admin/2026-07/tender_transaction.js +43 -0
  161. package/dist/cjs/rest/admin/2026-07/tender_transaction.js.map +1 -0
  162. package/dist/cjs/rest/admin/2026-07/theme.js +64 -0
  163. package/dist/cjs/rest/admin/2026-07/theme.js.map +1 -0
  164. package/dist/cjs/rest/admin/2026-07/transaction.js +83 -0
  165. package/dist/cjs/rest/admin/2026-07/transaction.js.map +1 -0
  166. package/dist/cjs/rest/admin/2026-07/usage_charge.js +53 -0
  167. package/dist/cjs/rest/admin/2026-07/usage_charge.js.map +1 -0
  168. package/dist/cjs/rest/admin/2026-07/user.js +69 -0
  169. package/dist/cjs/rest/admin/2026-07/user.js.map +1 -0
  170. package/dist/cjs/rest/admin/2026-07/variant.js +96 -0
  171. package/dist/cjs/rest/admin/2026-07/variant.js.map +1 -0
  172. package/dist/cjs/rest/admin/2026-07/webhook.js +78 -0
  173. package/dist/cjs/rest/admin/2026-07/webhook.js.map +1 -0
  174. package/dist/cjs/runtime/crypto/utils.js.map +1 -1
  175. package/dist/cjs/tsconfig.build.tsbuildinfo +1 -1
  176. package/dist/esm/lib/auth/oauth/create-session.mjs +1 -1
  177. package/dist/esm/lib/auth/oauth/create-session.mjs.map +1 -1
  178. package/dist/esm/lib/auth/oauth/oauth.mjs +4 -1
  179. package/dist/esm/lib/auth/oauth/oauth.mjs.map +1 -1
  180. package/dist/esm/lib/billing/types.mjs.map +1 -1
  181. package/dist/esm/lib/clients/common.mjs +64 -8
  182. package/dist/esm/lib/clients/common.mjs.map +1 -1
  183. package/dist/esm/lib/config.mjs +2 -2
  184. package/dist/esm/lib/config.mjs.map +1 -1
  185. package/dist/esm/lib/types.mjs +1 -1
  186. package/dist/esm/lib/types.mjs.map +1 -1
  187. package/dist/esm/lib/utils/fetch-request.mjs +12 -1
  188. package/dist/esm/lib/utils/fetch-request.mjs.map +1 -1
  189. package/dist/esm/lib/utils/hmac-validator.mjs +53 -7
  190. package/dist/esm/lib/utils/hmac-validator.mjs.map +1 -1
  191. package/dist/esm/lib/utils/processed-query.mjs +1 -1
  192. package/dist/esm/lib/utils/processed-query.mjs.map +1 -1
  193. package/dist/esm/lib/version.mjs +1 -1
  194. package/dist/esm/lib/version.mjs.map +1 -1
  195. package/dist/esm/lib/webhooks/process.mjs +2 -2
  196. package/dist/esm/lib/webhooks/process.mjs.map +1 -1
  197. package/dist/esm/lib/webhooks/register.mjs +0 -4
  198. package/dist/esm/lib/webhooks/register.mjs.map +1 -1
  199. package/dist/esm/lib/webhooks/types.mjs +0 -1
  200. package/dist/esm/lib/webhooks/types.mjs.map +1 -1
  201. package/dist/esm/lib/webhooks/validate.mjs +0 -3
  202. package/dist/esm/lib/webhooks/validate.mjs.map +1 -1
  203. package/dist/esm/rest/admin/2026-07/abandoned_checkout.mjs +83 -0
  204. package/dist/esm/rest/admin/2026-07/abandoned_checkout.mjs.map +1 -0
  205. package/dist/esm/rest/admin/2026-07/access_scope.mjs +34 -0
  206. package/dist/esm/rest/admin/2026-07/access_scope.mjs.map +1 -0
  207. package/dist/esm/rest/admin/2026-07/apple_pay_certificate.mjs +60 -0
  208. package/dist/esm/rest/admin/2026-07/apple_pay_certificate.mjs.map +1 -0
  209. package/dist/esm/rest/admin/2026-07/application_charge.mjs +54 -0
  210. package/dist/esm/rest/admin/2026-07/application_charge.mjs.map +1 -0
  211. package/dist/esm/rest/admin/2026-07/application_credit.mjs +48 -0
  212. package/dist/esm/rest/admin/2026-07/application_credit.mjs.map +1 -0
  213. package/dist/esm/rest/admin/2026-07/article.mjs +112 -0
  214. package/dist/esm/rest/admin/2026-07/article.mjs.map +1 -0
  215. package/dist/esm/rest/admin/2026-07/asset.mjs +55 -0
  216. package/dist/esm/rest/admin/2026-07/asset.mjs.map +1 -0
  217. package/dist/esm/rest/admin/2026-07/assigned_fulfillment_order.mjs +39 -0
  218. package/dist/esm/rest/admin/2026-07/assigned_fulfillment_order.mjs.map +1 -0
  219. package/dist/esm/rest/admin/2026-07/balance.mjs +32 -0
  220. package/dist/esm/rest/admin/2026-07/balance.mjs.map +1 -0
  221. package/dist/esm/rest/admin/2026-07/blog.mjs +81 -0
  222. package/dist/esm/rest/admin/2026-07/blog.mjs.map +1 -0
  223. package/dist/esm/rest/admin/2026-07/cancellation_request.mjs +50 -0
  224. package/dist/esm/rest/admin/2026-07/cancellation_request.mjs.map +1 -0
  225. package/dist/esm/rest/admin/2026-07/carrier_service.mjs +61 -0
  226. package/dist/esm/rest/admin/2026-07/carrier_service.mjs.map +1 -0
  227. package/dist/esm/rest/admin/2026-07/checkout.mjs +101 -0
  228. package/dist/esm/rest/admin/2026-07/checkout.mjs.map +1 -0
  229. package/dist/esm/rest/admin/2026-07/collect.mjs +72 -0
  230. package/dist/esm/rest/admin/2026-07/collect.mjs.map +1 -0
  231. package/dist/esm/rest/admin/2026-07/collection.mjs +57 -0
  232. package/dist/esm/rest/admin/2026-07/collection.mjs.map +1 -0
  233. package/dist/esm/rest/admin/2026-07/collection_listing.mjs +78 -0
  234. package/dist/esm/rest/admin/2026-07/collection_listing.mjs.map +1 -0
  235. package/dist/esm/rest/admin/2026-07/comment.mjs +133 -0
  236. package/dist/esm/rest/admin/2026-07/comment.mjs.map +1 -0
  237. package/dist/esm/rest/admin/2026-07/country.mjs +74 -0
  238. package/dist/esm/rest/admin/2026-07/country.mjs.map +1 -0
  239. package/dist/esm/rest/admin/2026-07/currency.mjs +33 -0
  240. package/dist/esm/rest/admin/2026-07/currency.mjs.map +1 -0
  241. package/dist/esm/rest/admin/2026-07/custom_collection.mjs +77 -0
  242. package/dist/esm/rest/admin/2026-07/custom_collection.mjs.map +1 -0
  243. package/dist/esm/rest/admin/2026-07/customer.mjs +148 -0
  244. package/dist/esm/rest/admin/2026-07/customer.mjs.map +1 -0
  245. package/dist/esm/rest/admin/2026-07/deprecated_api_call.mjs +33 -0
  246. package/dist/esm/rest/admin/2026-07/deprecated_api_call.mjs.map +1 -0
  247. package/dist/esm/rest/admin/2026-07/discount_code.mjs +113 -0
  248. package/dist/esm/rest/admin/2026-07/discount_code.mjs.map +1 -0
  249. package/dist/esm/rest/admin/2026-07/dispute.mjs +51 -0
  250. package/dist/esm/rest/admin/2026-07/dispute.mjs.map +1 -0
  251. package/dist/esm/rest/admin/2026-07/dispute_evidence.mjs +55 -0
  252. package/dist/esm/rest/admin/2026-07/dispute_evidence.mjs.map +1 -0
  253. package/dist/esm/rest/admin/2026-07/dispute_file_upload.mjs +43 -0
  254. package/dist/esm/rest/admin/2026-07/dispute_file_upload.mjs.map +1 -0
  255. package/dist/esm/rest/admin/2026-07/draft_order.mjs +124 -0
  256. package/dist/esm/rest/admin/2026-07/draft_order.mjs.map +1 -0
  257. package/dist/esm/rest/admin/2026-07/event.mjs +65 -0
  258. package/dist/esm/rest/admin/2026-07/event.mjs.map +1 -0
  259. package/dist/esm/rest/admin/2026-07/fulfillment.mjs +100 -0
  260. package/dist/esm/rest/admin/2026-07/fulfillment.mjs.map +1 -0
  261. package/dist/esm/rest/admin/2026-07/fulfillment_event.mjs +77 -0
  262. package/dist/esm/rest/admin/2026-07/fulfillment_event.mjs.map +1 -0
  263. package/dist/esm/rest/admin/2026-07/fulfillment_order.mjs +162 -0
  264. package/dist/esm/rest/admin/2026-07/fulfillment_order.mjs.map +1 -0
  265. package/dist/esm/rest/admin/2026-07/fulfillment_request.mjs +59 -0
  266. package/dist/esm/rest/admin/2026-07/fulfillment_request.mjs.map +1 -0
  267. package/dist/esm/rest/admin/2026-07/fulfillment_service.mjs +64 -0
  268. package/dist/esm/rest/admin/2026-07/fulfillment_service.mjs.map +1 -0
  269. package/dist/esm/rest/admin/2026-07/gift_card.mjs +103 -0
  270. package/dist/esm/rest/admin/2026-07/gift_card.mjs.map +1 -0
  271. package/dist/esm/rest/admin/2026-07/gift_card_adjustment.mjs +56 -0
  272. package/dist/esm/rest/admin/2026-07/gift_card_adjustment.mjs.map +1 -0
  273. package/dist/esm/rest/admin/2026-07/image.mjs +75 -0
  274. package/dist/esm/rest/admin/2026-07/image.mjs.map +1 -0
  275. package/dist/esm/rest/admin/2026-07/index.mjs +153 -0
  276. package/dist/esm/rest/admin/2026-07/index.mjs.map +1 -0
  277. package/dist/esm/rest/admin/2026-07/inventory_item.mjs +52 -0
  278. package/dist/esm/rest/admin/2026-07/inventory_item.mjs.map +1 -0
  279. package/dist/esm/rest/admin/2026-07/inventory_level.mjs +85 -0
  280. package/dist/esm/rest/admin/2026-07/inventory_level.mjs.map +1 -0
  281. package/dist/esm/rest/admin/2026-07/location.mjs +83 -0
  282. package/dist/esm/rest/admin/2026-07/location.mjs.map +1 -0
  283. package/dist/esm/rest/admin/2026-07/locations_for_move.mjs +32 -0
  284. package/dist/esm/rest/admin/2026-07/locations_for_move.mjs.map +1 -0
  285. package/dist/esm/rest/admin/2026-07/marketing_event.mjs +96 -0
  286. package/dist/esm/rest/admin/2026-07/marketing_event.mjs.map +1 -0
  287. package/dist/esm/rest/admin/2026-07/metafield.mjs +152 -0
  288. package/dist/esm/rest/admin/2026-07/metafield.mjs.map +1 -0
  289. package/dist/esm/rest/admin/2026-07/mobile_platform_application.mjs +61 -0
  290. package/dist/esm/rest/admin/2026-07/mobile_platform_application.mjs.map +1 -0
  291. package/dist/esm/rest/admin/2026-07/order.mjs +200 -0
  292. package/dist/esm/rest/admin/2026-07/order.mjs.map +1 -0
  293. package/dist/esm/rest/admin/2026-07/order_risk.mjs +66 -0
  294. package/dist/esm/rest/admin/2026-07/order_risk.mjs.map +1 -0
  295. package/dist/esm/rest/admin/2026-07/page.mjs +81 -0
  296. package/dist/esm/rest/admin/2026-07/page.mjs.map +1 -0
  297. package/dist/esm/rest/admin/2026-07/payment.mjs +44 -0
  298. package/dist/esm/rest/admin/2026-07/payment.mjs.map +1 -0
  299. package/dist/esm/rest/admin/2026-07/payment_gateway.mjs +70 -0
  300. package/dist/esm/rest/admin/2026-07/payment_gateway.mjs.map +1 -0
  301. package/dist/esm/rest/admin/2026-07/payment_transaction.mjs +54 -0
  302. package/dist/esm/rest/admin/2026-07/payment_transaction.mjs.map +1 -0
  303. package/dist/esm/rest/admin/2026-07/payout.mjs +45 -0
  304. package/dist/esm/rest/admin/2026-07/payout.mjs.map +1 -0
  305. package/dist/esm/rest/admin/2026-07/policy.mjs +37 -0
  306. package/dist/esm/rest/admin/2026-07/policy.mjs.map +1 -0
  307. package/dist/esm/rest/admin/2026-07/price_rule.mjs +95 -0
  308. package/dist/esm/rest/admin/2026-07/price_rule.mjs.map +1 -0
  309. package/dist/esm/rest/admin/2026-07/product.mjs +87 -0
  310. package/dist/esm/rest/admin/2026-07/product.mjs.map +1 -0
  311. package/dist/esm/rest/admin/2026-07/product_listing.mjs +97 -0
  312. package/dist/esm/rest/admin/2026-07/product_listing.mjs.map +1 -0
  313. package/dist/esm/rest/admin/2026-07/product_resource_feedback.mjs +44 -0
  314. package/dist/esm/rest/admin/2026-07/product_resource_feedback.mjs.map +1 -0
  315. package/dist/esm/rest/admin/2026-07/province.mjs +63 -0
  316. package/dist/esm/rest/admin/2026-07/province.mjs.map +1 -0
  317. package/dist/esm/rest/admin/2026-07/recurring_application_charge.mjs +85 -0
  318. package/dist/esm/rest/admin/2026-07/recurring_application_charge.mjs.map +1 -0
  319. package/dist/esm/rest/admin/2026-07/redirect.mjs +69 -0
  320. package/dist/esm/rest/admin/2026-07/redirect.mjs.map +1 -0
  321. package/dist/esm/rest/admin/2026-07/refund.mjs +70 -0
  322. package/dist/esm/rest/admin/2026-07/refund.mjs.map +1 -0
  323. package/dist/esm/rest/admin/2026-07/resource_feedback.mjs +39 -0
  324. package/dist/esm/rest/admin/2026-07/resource_feedback.mjs.map +1 -0
  325. package/dist/esm/rest/admin/2026-07/script_tag.mjs +73 -0
  326. package/dist/esm/rest/admin/2026-07/script_tag.mjs.map +1 -0
  327. package/dist/esm/rest/admin/2026-07/shipping_zone.mjs +45 -0
  328. package/dist/esm/rest/admin/2026-07/shipping_zone.mjs.map +1 -0
  329. package/dist/esm/rest/admin/2026-07/shop.mjs +94 -0
  330. package/dist/esm/rest/admin/2026-07/shop.mjs.map +1 -0
  331. package/dist/esm/rest/admin/2026-07/smart_collection.mjs +91 -0
  332. package/dist/esm/rest/admin/2026-07/smart_collection.mjs.map +1 -0
  333. package/dist/esm/rest/admin/2026-07/storefront_access_token.mjs +48 -0
  334. package/dist/esm/rest/admin/2026-07/storefront_access_token.mjs.map +1 -0
  335. package/dist/esm/rest/admin/2026-07/tender_transaction.mjs +41 -0
  336. package/dist/esm/rest/admin/2026-07/tender_transaction.mjs.map +1 -0
  337. package/dist/esm/rest/admin/2026-07/theme.mjs +62 -0
  338. package/dist/esm/rest/admin/2026-07/theme.mjs.map +1 -0
  339. package/dist/esm/rest/admin/2026-07/transaction.mjs +81 -0
  340. package/dist/esm/rest/admin/2026-07/transaction.mjs.map +1 -0
  341. package/dist/esm/rest/admin/2026-07/usage_charge.mjs +51 -0
  342. package/dist/esm/rest/admin/2026-07/usage_charge.mjs.map +1 -0
  343. package/dist/esm/rest/admin/2026-07/user.mjs +67 -0
  344. package/dist/esm/rest/admin/2026-07/user.mjs.map +1 -0
  345. package/dist/esm/rest/admin/2026-07/variant.mjs +94 -0
  346. package/dist/esm/rest/admin/2026-07/variant.mjs.map +1 -0
  347. package/dist/esm/rest/admin/2026-07/webhook.mjs +76 -0
  348. package/dist/esm/rest/admin/2026-07/webhook.mjs.map +1 -0
  349. package/dist/esm/runtime/crypto/utils.mjs.map +1 -1
  350. package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
  351. package/dist/ts/lib/auth/oauth/oauth.d.ts.map +1 -1
  352. package/dist/ts/lib/base-types.d.ts +28 -0
  353. package/dist/ts/lib/base-types.d.ts.map +1 -1
  354. package/dist/ts/lib/billing/types.d.ts.map +1 -1
  355. package/dist/ts/lib/clients/common.d.ts.map +1 -1
  356. package/dist/ts/lib/types.d.ts +1 -1
  357. package/dist/ts/lib/types.d.ts.map +1 -1
  358. package/dist/ts/lib/utils/fetch-request.d.ts.map +1 -1
  359. package/dist/ts/lib/utils/hmac-validator.d.ts +3 -1
  360. package/dist/ts/lib/utils/hmac-validator.d.ts.map +1 -1
  361. package/dist/ts/lib/utils/index.d.ts +1 -1
  362. package/dist/ts/lib/version.d.ts +1 -1
  363. package/dist/ts/lib/webhooks/register.d.ts.map +1 -1
  364. package/dist/ts/lib/webhooks/types.d.ts +1 -4
  365. package/dist/ts/lib/webhooks/types.d.ts.map +1 -1
  366. package/dist/ts/rest/admin/2026-07/abandoned_checkout.d.ts +90 -0
  367. package/dist/ts/rest/admin/2026-07/abandoned_checkout.d.ts.map +1 -0
  368. package/dist/ts/rest/admin/2026-07/access_scope.d.ts +30 -0
  369. package/dist/ts/rest/admin/2026-07/access_scope.d.ts.map +1 -0
  370. package/dist/ts/rest/admin/2026-07/apple_pay_certificate.d.ts +39 -0
  371. package/dist/ts/rest/admin/2026-07/apple_pay_certificate.d.ts.map +1 -0
  372. package/dist/ts/rest/admin/2026-07/application_charge.d.ts +46 -0
  373. package/dist/ts/rest/admin/2026-07/application_charge.d.ts.map +1 -0
  374. package/dist/ts/rest/admin/2026-07/application_credit.d.ts +40 -0
  375. package/dist/ts/rest/admin/2026-07/application_credit.d.ts.map +1 -0
  376. package/dist/ts/rest/admin/2026-07/article.d.ts +99 -0
  377. package/dist/ts/rest/admin/2026-07/article.d.ts.map +1 -0
  378. package/dist/ts/rest/admin/2026-07/asset.d.ts +49 -0
  379. package/dist/ts/rest/admin/2026-07/asset.d.ts.map +1 -0
  380. package/dist/ts/rest/admin/2026-07/assigned_fulfillment_order.d.ts +39 -0
  381. package/dist/ts/rest/admin/2026-07/assigned_fulfillment_order.d.ts.map +1 -0
  382. package/dist/ts/rest/admin/2026-07/balance.d.ts +28 -0
  383. package/dist/ts/rest/admin/2026-07/balance.d.ts.map +1 -0
  384. package/dist/ts/rest/admin/2026-07/blog.d.ts +60 -0
  385. package/dist/ts/rest/admin/2026-07/blog.d.ts.map +1 -0
  386. package/dist/ts/rest/admin/2026-07/cancellation_request.d.ts +36 -0
  387. package/dist/ts/rest/admin/2026-07/cancellation_request.d.ts.map +1 -0
  388. package/dist/ts/rest/admin/2026-07/carrier_service.d.ts +43 -0
  389. package/dist/ts/rest/admin/2026-07/carrier_service.d.ts.map +1 -0
  390. package/dist/ts/rest/admin/2026-07/checkout.d.ts +95 -0
  391. package/dist/ts/rest/admin/2026-07/checkout.d.ts.map +1 -0
  392. package/dist/ts/rest/admin/2026-07/collect.d.ts +51 -0
  393. package/dist/ts/rest/admin/2026-07/collect.d.ts.map +1 -0
  394. package/dist/ts/rest/admin/2026-07/collection.d.ts +46 -0
  395. package/dist/ts/rest/admin/2026-07/collection.d.ts.map +1 -0
  396. package/dist/ts/rest/admin/2026-07/collection_listing.d.ts +58 -0
  397. package/dist/ts/rest/admin/2026-07/collection_listing.d.ts.map +1 -0
  398. package/dist/ts/rest/admin/2026-07/comment.d.ts +103 -0
  399. package/dist/ts/rest/admin/2026-07/comment.d.ts.map +1 -0
  400. package/dist/ts/rest/admin/2026-07/country.d.ts +51 -0
  401. package/dist/ts/rest/admin/2026-07/country.d.ts.map +1 -0
  402. package/dist/ts/rest/admin/2026-07/currency.d.ts +27 -0
  403. package/dist/ts/rest/admin/2026-07/currency.d.ts.map +1 -0
  404. package/dist/ts/rest/admin/2026-07/custom_collection.d.ts +73 -0
  405. package/dist/ts/rest/admin/2026-07/custom_collection.d.ts.map +1 -0
  406. package/dist/ts/rest/admin/2026-07/customer.d.ts +121 -0
  407. package/dist/ts/rest/admin/2026-07/customer.d.ts.map +1 -0
  408. package/dist/ts/rest/admin/2026-07/deprecated_api_call.d.ts +29 -0
  409. package/dist/ts/rest/admin/2026-07/deprecated_api_call.d.ts.map +1 -0
  410. package/dist/ts/rest/admin/2026-07/discount_code.d.ts +76 -0
  411. package/dist/ts/rest/admin/2026-07/discount_code.d.ts.map +1 -0
  412. package/dist/ts/rest/admin/2026-07/dispute.d.ts +45 -0
  413. package/dist/ts/rest/admin/2026-07/dispute.d.ts.map +1 -0
  414. package/dist/ts/rest/admin/2026-07/dispute_evidence.d.ts +56 -0
  415. package/dist/ts/rest/admin/2026-07/dispute_evidence.d.ts.map +1 -0
  416. package/dist/ts/rest/admin/2026-07/dispute_file_upload.d.ts +35 -0
  417. package/dist/ts/rest/admin/2026-07/dispute_file_upload.d.ts.map +1 -0
  418. package/dist/ts/rest/admin/2026-07/draft_order.d.ts +116 -0
  419. package/dist/ts/rest/admin/2026-07/draft_order.d.ts.map +1 -0
  420. package/dist/ts/rest/admin/2026-07/event.d.ts +57 -0
  421. package/dist/ts/rest/admin/2026-07/event.d.ts.map +1 -0
  422. package/dist/ts/rest/admin/2026-07/fulfillment.d.ts +92 -0
  423. package/dist/ts/rest/admin/2026-07/fulfillment.d.ts.map +1 -0
  424. package/dist/ts/rest/admin/2026-07/fulfillment_event.d.ts +66 -0
  425. package/dist/ts/rest/admin/2026-07/fulfillment_event.d.ts.map +1 -0
  426. package/dist/ts/rest/admin/2026-07/fulfillment_order.d.ts +129 -0
  427. package/dist/ts/rest/admin/2026-07/fulfillment_order.d.ts.map +1 -0
  428. package/dist/ts/rest/admin/2026-07/fulfillment_request.d.ts +47 -0
  429. package/dist/ts/rest/admin/2026-07/fulfillment_request.d.ts.map +1 -0
  430. package/dist/ts/rest/admin/2026-07/fulfillment_service.d.ts +47 -0
  431. package/dist/ts/rest/admin/2026-07/fulfillment_service.d.ts.map +1 -0
  432. package/dist/ts/rest/admin/2026-07/gift_card.d.ts +83 -0
  433. package/dist/ts/rest/admin/2026-07/gift_card.d.ts.map +1 -0
  434. package/dist/ts/rest/admin/2026-07/gift_card_adjustment.d.ts +45 -0
  435. package/dist/ts/rest/admin/2026-07/gift_card_adjustment.d.ts.map +1 -0
  436. package/dist/ts/rest/admin/2026-07/image.d.ts +57 -0
  437. package/dist/ts/rest/admin/2026-07/image.d.ts.map +1 -0
  438. package/dist/ts/rest/admin/2026-07/index.d.ts +152 -0
  439. package/dist/ts/rest/admin/2026-07/index.d.ts.map +1 -0
  440. package/dist/ts/rest/admin/2026-07/inventory_item.d.ts +45 -0
  441. package/dist/ts/rest/admin/2026-07/inventory_item.d.ts.map +1 -0
  442. package/dist/ts/rest/admin/2026-07/inventory_level.d.ts +70 -0
  443. package/dist/ts/rest/admin/2026-07/inventory_level.d.ts.map +1 -0
  444. package/dist/ts/rest/admin/2026-07/location.d.ts +59 -0
  445. package/dist/ts/rest/admin/2026-07/location.d.ts.map +1 -0
  446. package/dist/ts/rest/admin/2026-07/locations_for_move.d.ts +29 -0
  447. package/dist/ts/rest/admin/2026-07/locations_for_move.d.ts.map +1 -0
  448. package/dist/ts/rest/admin/2026-07/marketing_event.d.ts +79 -0
  449. package/dist/ts/rest/admin/2026-07/marketing_event.d.ts.map +1 -0
  450. package/dist/ts/rest/admin/2026-07/metafield.d.ts +111 -0
  451. package/dist/ts/rest/admin/2026-07/metafield.d.ts.map +1 -0
  452. package/dist/ts/rest/admin/2026-07/mobile_platform_application.d.ts +43 -0
  453. package/dist/ts/rest/admin/2026-07/mobile_platform_application.d.ts.map +1 -0
  454. package/dist/ts/rest/admin/2026-07/order.d.ts +239 -0
  455. package/dist/ts/rest/admin/2026-07/order.d.ts.map +1 -0
  456. package/dist/ts/rest/admin/2026-07/order_risk.d.ts +49 -0
  457. package/dist/ts/rest/admin/2026-07/order_risk.d.ts.map +1 -0
  458. package/dist/ts/rest/admin/2026-07/page.d.ts +76 -0
  459. package/dist/ts/rest/admin/2026-07/page.d.ts.map +1 -0
  460. package/dist/ts/rest/admin/2026-07/payment.d.ts +43 -0
  461. package/dist/ts/rest/admin/2026-07/payment.d.ts.map +1 -0
  462. package/dist/ts/rest/admin/2026-07/payment_gateway.d.ts +52 -0
  463. package/dist/ts/rest/admin/2026-07/payment_gateway.d.ts.map +1 -0
  464. package/dist/ts/rest/admin/2026-07/payment_transaction.d.ts +51 -0
  465. package/dist/ts/rest/admin/2026-07/payment_transaction.d.ts.map +1 -0
  466. package/dist/ts/rest/admin/2026-07/payout.d.ts +41 -0
  467. package/dist/ts/rest/admin/2026-07/payout.d.ts.map +1 -0
  468. package/dist/ts/rest/admin/2026-07/policy.d.ts +31 -0
  469. package/dist/ts/rest/admin/2026-07/policy.d.ts.map +1 -0
  470. package/dist/ts/rest/admin/2026-07/price_rule.d.ts +90 -0
  471. package/dist/ts/rest/admin/2026-07/price_rule.d.ts.map +1 -0
  472. package/dist/ts/rest/admin/2026-07/product.d.ts +95 -0
  473. package/dist/ts/rest/admin/2026-07/product.d.ts.map +1 -0
  474. package/dist/ts/rest/admin/2026-07/product_listing.d.ts +73 -0
  475. package/dist/ts/rest/admin/2026-07/product_listing.d.ts.map +1 -0
  476. package/dist/ts/rest/admin/2026-07/product_resource_feedback.d.ts +36 -0
  477. package/dist/ts/rest/admin/2026-07/product_resource_feedback.d.ts.map +1 -0
  478. package/dist/ts/rest/admin/2026-07/province.d.ts +50 -0
  479. package/dist/ts/rest/admin/2026-07/province.d.ts.map +1 -0
  480. package/dist/ts/rest/admin/2026-07/recurring_application_charge.d.ts +65 -0
  481. package/dist/ts/rest/admin/2026-07/recurring_application_charge.d.ts.map +1 -0
  482. package/dist/ts/rest/admin/2026-07/redirect.d.ts +51 -0
  483. package/dist/ts/rest/admin/2026-07/redirect.d.ts.map +1 -0
  484. package/dist/ts/rest/admin/2026-07/refund.d.ts +73 -0
  485. package/dist/ts/rest/admin/2026-07/refund.d.ts.map +1 -0
  486. package/dist/ts/rest/admin/2026-07/resource_feedback.d.ts +32 -0
  487. package/dist/ts/rest/admin/2026-07/resource_feedback.d.ts.map +1 -0
  488. package/dist/ts/rest/admin/2026-07/script_tag.d.ts +57 -0
  489. package/dist/ts/rest/admin/2026-07/script_tag.d.ts.map +1 -0
  490. package/dist/ts/rest/admin/2026-07/shipping_zone.d.ts +45 -0
  491. package/dist/ts/rest/admin/2026-07/shipping_zone.d.ts.map +1 -0
  492. package/dist/ts/rest/admin/2026-07/shop.d.ts +82 -0
  493. package/dist/ts/rest/admin/2026-07/shop.d.ts.map +1 -0
  494. package/dist/ts/rest/admin/2026-07/smart_collection.d.ts +87 -0
  495. package/dist/ts/rest/admin/2026-07/smart_collection.d.ts.map +1 -0
  496. package/dist/ts/rest/admin/2026-07/storefront_access_token.d.ts +35 -0
  497. package/dist/ts/rest/admin/2026-07/storefront_access_token.d.ts.map +1 -0
  498. package/dist/ts/rest/admin/2026-07/tender_transaction.d.ts +43 -0
  499. package/dist/ts/rest/admin/2026-07/tender_transaction.d.ts.map +1 -0
  500. package/dist/ts/rest/admin/2026-07/theme.d.ts +46 -0
  501. package/dist/ts/rest/admin/2026-07/theme.d.ts.map +1 -0
  502. package/dist/ts/rest/admin/2026-07/transaction.d.ts +82 -0
  503. package/dist/ts/rest/admin/2026-07/transaction.d.ts.map +1 -0
  504. package/dist/ts/rest/admin/2026-07/usage_charge.d.ts +44 -0
  505. package/dist/ts/rest/admin/2026-07/usage_charge.d.ts.map +1 -0
  506. package/dist/ts/rest/admin/2026-07/user.d.ts +51 -0
  507. package/dist/ts/rest/admin/2026-07/user.d.ts.map +1 -0
  508. package/dist/ts/rest/admin/2026-07/variant.d.ts +78 -0
  509. package/dist/ts/rest/admin/2026-07/variant.d.ts.map +1 -0
  510. package/dist/ts/rest/admin/2026-07/webhook.d.ts +62 -0
  511. package/dist/ts/rest/admin/2026-07/webhook.d.ts.map +1 -0
  512. package/dist/ts/tsconfig.build.tsbuildinfo +1 -1
  513. package/lib/__test-helpers__/graphql-base-request.ts +1 -1
  514. package/lib/auth/oauth/create-session.ts +1 -1
  515. package/lib/auth/oauth/oauth.ts +5 -1
  516. package/lib/base-types.ts +28 -0
  517. package/lib/billing/types.ts +2 -4
  518. package/lib/clients/common.ts +91 -7
  519. package/lib/config.ts +2 -2
  520. package/lib/types.ts +1 -1
  521. package/lib/utils/fetch-request.ts +13 -1
  522. package/lib/utils/hmac-validator.ts +78 -8
  523. package/lib/utils/processed-query.ts +1 -1
  524. package/lib/version.ts +1 -1
  525. package/lib/webhooks/process.ts +1 -2
  526. package/lib/webhooks/register.ts +0 -5
  527. package/lib/webhooks/types.ts +1 -7
  528. package/lib/webhooks/validate.ts +0 -3
  529. package/package.json +10 -11
  530. package/rest/admin/2026-07/abandoned_checkout.ts +112 -0
  531. package/rest/admin/2026-07/access_scope.ts +48 -0
  532. package/rest/admin/2026-07/apple_pay_certificate.ts +97 -0
  533. package/rest/admin/2026-07/application_charge.ts +85 -0
  534. package/rest/admin/2026-07/application_credit.ts +77 -0
  535. package/rest/admin/2026-07/article.ts +237 -0
  536. package/rest/admin/2026-07/asset.ts +88 -0
  537. package/rest/admin/2026-07/assigned_fulfillment_order.ts +57 -0
  538. package/rest/admin/2026-07/balance.ts +46 -0
  539. package/rest/admin/2026-07/blog.ts +138 -0
  540. package/rest/admin/2026-07/cancellation_request.ts +78 -0
  541. package/rest/admin/2026-07/carrier_service.ts +96 -0
  542. package/rest/admin/2026-07/checkout.ts +139 -0
  543. package/rest/admin/2026-07/collect.ts +126 -0
  544. package/rest/admin/2026-07/collection.ts +88 -0
  545. package/rest/admin/2026-07/collection_listing.ts +131 -0
  546. package/rest/admin/2026-07/comment.ts +263 -0
  547. package/rest/admin/2026-07/country.ts +127 -0
  548. package/rest/admin/2026-07/currency.ts +47 -0
  549. package/rest/admin/2026-07/custom_collection.ts +163 -0
  550. package/rest/admin/2026-07/customer.ts +277 -0
  551. package/rest/admin/2026-07/deprecated_api_call.ts +47 -0
  552. package/rest/admin/2026-07/discount_code.ts +212 -0
  553. package/rest/admin/2026-07/dispute.ts +83 -0
  554. package/rest/admin/2026-07/dispute_evidence.ts +69 -0
  555. package/rest/admin/2026-07/dispute_file_upload.ts +59 -0
  556. package/rest/admin/2026-07/draft_order.ts +221 -0
  557. package/rest/admin/2026-07/event.ts +124 -0
  558. package/rest/admin/2026-07/fulfillment.ts +193 -0
  559. package/rest/admin/2026-07/fulfillment_event.ts +129 -0
  560. package/rest/admin/2026-07/fulfillment_order.ts +296 -0
  561. package/rest/admin/2026-07/fulfillment_request.ts +91 -0
  562. package/rest/admin/2026-07/fulfillment_service.ts +101 -0
  563. package/rest/admin/2026-07/gift_card.ts +187 -0
  564. package/rest/admin/2026-07/gift_card_adjustment.ts +86 -0
  565. package/rest/admin/2026-07/image.ts +137 -0
  566. package/rest/admin/2026-07/index.ts +228 -0
  567. package/rest/admin/2026-07/inventory_item.ts +80 -0
  568. package/rest/admin/2026-07/inventory_level.ts +173 -0
  569. package/rest/admin/2026-07/location.ts +133 -0
  570. package/rest/admin/2026-07/locations_for_move.ts +48 -0
  571. package/rest/admin/2026-07/marketing_event.ts +175 -0
  572. package/rest/admin/2026-07/metafield.ts +300 -0
  573. package/rest/admin/2026-07/mobile_platform_application.ts +96 -0
  574. package/rest/admin/2026-07/order.ts +338 -0
  575. package/rest/admin/2026-07/order_risk.ts +109 -0
  576. package/rest/admin/2026-07/page.ts +170 -0
  577. package/rest/admin/2026-07/payment.ts +60 -0
  578. package/rest/admin/2026-07/payment_gateway.ts +105 -0
  579. package/rest/admin/2026-07/payment_transaction.ts +79 -0
  580. package/rest/admin/2026-07/payout.ts +81 -0
  581. package/rest/admin/2026-07/policy.ts +51 -0
  582. package/rest/admin/2026-07/price_rule.ts +163 -0
  583. package/rest/admin/2026-07/product.ts +192 -0
  584. package/rest/admin/2026-07/product_listing.ts +167 -0
  585. package/rest/admin/2026-07/product_resource_feedback.ts +62 -0
  586. package/rest/admin/2026-07/province.ts +110 -0
  587. package/rest/admin/2026-07/recurring_application_charge.ts +138 -0
  588. package/rest/admin/2026-07/redirect.ts +131 -0
  589. package/rest/admin/2026-07/refund.ts +126 -0
  590. package/rest/admin/2026-07/resource_feedback.ts +53 -0
  591. package/rest/admin/2026-07/script_tag.ts +139 -0
  592. package/rest/admin/2026-07/shipping_zone.ts +62 -0
  593. package/rest/admin/2026-07/shop.ts +118 -0
  594. package/rest/admin/2026-07/smart_collection.ts +192 -0
  595. package/rest/admin/2026-07/storefront_access_token.ts +73 -0
  596. package/rest/admin/2026-07/tender_transaction.ts +67 -0
  597. package/rest/admin/2026-07/theme.ts +101 -0
  598. package/rest/admin/2026-07/transaction.ts +132 -0
  599. package/rest/admin/2026-07/usage_charge.ts +84 -0
  600. package/rest/admin/2026-07/user.ts +106 -0
  601. package/rest/admin/2026-07/variant.ts +156 -0
  602. package/rest/admin/2026-07/webhook.ts +146 -0
  603. package/runtime/crypto/utils.ts +1 -1
@@ -9,7 +9,7 @@ function createSession({ config, accessTokenResponse, shop, state, }) {
9
9
  logger(config).info('Creating new session', { shop, isOnline });
10
10
  const getSessionExpiration = (expires_in) => new Date(Date.now() + expires_in * 1000);
11
11
  const getOnlineSessionProperties = (responseBody) => {
12
- const { access_token, scope, ...rest } = responseBody;
12
+ const { access_token: _access_token, scope: _scope, ...rest } = responseBody;
13
13
  const sessionId = config.isEmbeddedApp
14
14
  ? getJwtSessionId(config)(shop, `${rest.associated_user.id}`)
15
15
  : crypto.randomUUID();
@@ -1 +1 @@
1
- {"version":3,"file":"create-session.mjs","sources":["../../../../../../../lib/auth/oauth/create-session.ts"],"sourcesContent":["import {Session} from '../../session/session';\nimport {ConfigInterface} from '../../base-types';\nimport {logger} from '../../logger';\nimport {getJwtSessionId, getOfflineId} from '../../session/session-utils';\n\nimport {\n AccessTokenResponse,\n OnlineAccessResponse,\n OnlineAccessInfo,\n OfflineAccessResponse,\n} from './types';\n\nexport function createSession({\n config,\n accessTokenResponse,\n shop,\n state,\n}: {\n config: ConfigInterface;\n accessTokenResponse: AccessTokenResponse;\n shop: string;\n state: string;\n}): Session {\n const associatedUser = (accessTokenResponse as OnlineAccessResponse)\n .associated_user;\n const isOnline = Boolean(associatedUser);\n\n logger(config).info('Creating new session', {shop, isOnline});\n\n const getSessionExpiration = (expires_in: number) =>\n new Date(Date.now() + expires_in * 1000);\n\n const getOnlineSessionProperties = (responseBody: OnlineAccessResponse) => {\n const {access_token, scope, ...rest} = responseBody;\n const sessionId = config.isEmbeddedApp\n ? getJwtSessionId(config)(\n shop,\n `${(rest as OnlineAccessInfo).associated_user.id}`,\n )\n : crypto.randomUUID();\n\n return {\n id: sessionId,\n onlineAccessInfo: rest,\n expires: getSessionExpiration(rest.expires_in),\n };\n };\n\n const getOfflineSessionProperties = (responseBody: OfflineAccessResponse) => {\n const {expires_in, refresh_token, refresh_token_expires_in} = responseBody;\n return {\n id: getOfflineId(config)(shop),\n ...(expires_in && {expires: getSessionExpiration(expires_in)}),\n ...(refresh_token &&\n refresh_token_expires_in && {\n refreshToken: refresh_token,\n refreshTokenExpires: getSessionExpiration(refresh_token_expires_in),\n }),\n };\n };\n\n return new Session({\n shop,\n state,\n isOnline,\n accessToken: accessTokenResponse.access_token,\n scope: accessTokenResponse.scope,\n ...(isOnline\n ? getOnlineSessionProperties(accessTokenResponse as OnlineAccessResponse)\n : getOfflineSessionProperties(\n accessTokenResponse as OfflineAccessResponse,\n )),\n });\n}\n"],"names":[],"mappings":";;;;AAYM,SAAU,aAAa,CAAC,EAC5B,MAAM,EACN,mBAAmB,EACnB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AC,wBAAwB,CAAC;aACpE,CAAC;SACL;AACH,IAAA,CAAC;IAED,OAAO,IAAI,OAAO,CAAC;QACjB,IAAI;QACJ,KAAK;QACL,QAAQ;QACR,WAAW,EAAE,mBAAmB,CAAC,YAAY;QAC7C,KAAK,EAAE,mBAAmB,CAAC,KAAK;AAChC,QAAA,IAAI;AACF,cAAE,0BAA0B,CAAC,mBAA2C;AACxE,cAAE,2BAA2B,CACzB,mBAA4C,CAC7C,CAAC;AACP,KAAA,CAAC;AACJ;;;;"}
1
+ {"version":3,"file":"create-session.mjs","sources":["../../../../../../../lib/auth/oauth/create-session.ts"],"sourcesContent":["import {Session} from '../../session/session';\nimport {ConfigInterface} from '../../base-types';\nimport {logger} from '../../logger';\nimport {getJwtSessionId, getOfflineId} from '../../session/session-utils';\n\nimport {\n AccessTokenResponse,\n OnlineAccessResponse,\n OnlineAccessInfo,\n OfflineAccessResponse,\n} from './types';\n\nexport function createSession({\n config,\n accessTokenResponse,\n shop,\n state,\n}: {\n config: ConfigInterface;\n accessTokenResponse: AccessTokenResponse;\n shop: string;\n state: string;\n}): Session {\n const associatedUser = (accessTokenResponse as OnlineAccessResponse)\n .associated_user;\n const isOnline = Boolean(associatedUser);\n\n logger(config).info('Creating new session', {shop, isOnline});\n\n const getSessionExpiration = (expires_in: number) =>\n new Date(Date.now() + expires_in * 1000);\n\n const getOnlineSessionProperties = (responseBody: OnlineAccessResponse) => {\n const {access_token: _access_token, scope: _scope, ...rest} = responseBody;\n const sessionId = config.isEmbeddedApp\n ? getJwtSessionId(config)(\n shop,\n `${(rest as OnlineAccessInfo).associated_user.id}`,\n )\n : crypto.randomUUID();\n\n return {\n id: sessionId,\n onlineAccessInfo: rest,\n expires: getSessionExpiration(rest.expires_in),\n };\n };\n\n const getOfflineSessionProperties = (responseBody: OfflineAccessResponse) => {\n const {expires_in, refresh_token, refresh_token_expires_in} = responseBody;\n return {\n id: getOfflineId(config)(shop),\n ...(expires_in && {expires: getSessionExpiration(expires_in)}),\n ...(refresh_token &&\n refresh_token_expires_in && {\n refreshToken: refresh_token,\n refreshTokenExpires: getSessionExpiration(refresh_token_expires_in),\n }),\n };\n };\n\n return new Session({\n shop,\n state,\n isOnline,\n accessToken: accessTokenResponse.access_token,\n scope: accessTokenResponse.scope,\n ...(isOnline\n ? getOnlineSessionProperties(accessTokenResponse as OnlineAccessResponse)\n : getOfflineSessionProperties(\n accessTokenResponse as OfflineAccessResponse,\n )),\n });\n}\n"],"names":[],"mappings":";;;;AAYM,SAAU,aAAa,CAAC,EAC5B,MAAM,EACN,mBAAmB,EACnB,IAAI,EACJ,KAAK,GAMN,EAAA;IACC,MAAM,cAAc,GAAI;AACrB,SAAA,eAAe;AAClB,IAAA,MAAM,QAAQ,GAAG,OAAO,CAAC,cAAc,CAAC;AAExC,IAAA,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,sBAAsB,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC,CAAC;AAE7D,IAAA,MAAM,oBAAoB,GAAG,CAAC,UAAkB,KAC9C,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,UAAU,GAAG,IAAI,CAAC;AAE1C,IAAA,MAAM,0BAA0B,GAAG,CAAC,YAAkC,KAAI;AACxE,QAAA,MAAM,EAAC,YAAY,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,EAAC,GAAG,YAAY;AAC1E,QAAA,MAAM,SAAS,GAAG,MAAM,CAAC;AACvB,cAAE,eAAe,CAAC,MAAM,CAAC,CACrB,IAAI,EACJ,CAAA,EAAI,IAAyB,CAAC,eAAe,CAAC,EAAE,EAAE;AAEtD,cAAE,MAAM,CAAC,UAAU,EAAE;QAEvB,OAAO;AACL,YAAA,EAAE,EAAE,SAAS;AACb,YAAA,gBAAgB,EAAE,IAAI;AACtB,YAAA,OAAO,EAAE,oBAAoB,CAAC,IAAI,CAAC,UAAU,CAAC;SAC/C;AACH,IAAA,CAAC;AAED,IAAA,MAAM,2BAA2B,GAAG,CAAC,YAAmC,KAAI;QAC1E,MAAM,EAAC,UAAU,EAAE,aAAa,EAAE,wBAAwB,EAAC,GAAG,YAAY;QAC1E,OAAO;AACL,YAAA,EAAE,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC;YAC9B,IAAI,UAAU,IAAI,EAAC,OAAO,EAAE,oBAAoB,CAAC,UAAU,CAAC,EAAC,CAAC;AAC9D,YAAA,IAAI,aAAa;AACf,gBAAA,wBAAwB,IAAI;AAC1B,gBAAA,YAAY,EAAE,aAAa;AAC3B,gBAAA,mBAAmB,EAAE,oBAAoB,CAAC,wBAAwB,CAAC;aACpE,CAAC;SACL;AACH,IAAA,CAAC;IAED,OAAO,IAAI,OAAO,CAAC;QACjB,IAAI;QACJ,KAAK;QACL,QAAQ;QACR,WAAW,EAAE,mBAAmB,CAAC,YAAY;QAC7C,KAAK,EAAE,mBAAmB,CAAC,KAAK;AAChC,QAAA,IAAI;AACF,cAAE,0BAA0B,CAAC,mBAA2C;AACxE,cAAE,2BAA2B,CACzB,mBAA4C,CAC7C,CAAC;AACP,KAAA,CAAC;AACJ;;;;"}
@@ -127,11 +127,14 @@ function callback(config) {
127
127
  config,
128
128
  });
129
129
  if (!config.isEmbeddedApp) {
130
+ const cookiePath = typeof config.cookiePath === 'function'
131
+ ? config.cookiePath(session)
132
+ : (config.cookiePath ?? '/');
130
133
  await cookies.setAndSign(SESSION_COOKIE_NAME, session.id, {
131
134
  expires: session.expires,
132
135
  sameSite: 'lax',
133
136
  secure: true,
134
- path: '/',
137
+ path: cookiePath,
135
138
  });
136
139
  }
137
140
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"oauth.mjs","sources":["../../../../../../../lib/auth/oauth/oauth.ts"],"sourcesContent":["import {isbot} from 'isbot';\n\nimport {throwFailedRequest} from '../../clients/common';\nimport ProcessedQuery from '../../utils/processed-query';\nimport {ConfigInterface} from '../../base-types';\nimport * as ShopifyErrors from '../../error';\nimport {validateHmac} from '../../utils/hmac-validator';\nimport {sanitizeShop} from '../../utils/shop-validator';\nimport {Session} from '../../session/session';\nimport {\n abstractConvertRequest,\n abstractConvertIncomingResponse,\n abstractConvertResponse,\n abstractConvertHeaders,\n AdapterResponse,\n AdapterHeaders,\n Cookies,\n NormalizedResponse,\n NormalizedRequest,\n} from '../../../runtime/http';\nimport {logger, ShopifyLogger} from '../../logger';\nimport {DataType} from '../../clients/types';\nimport {fetchRequestFactory} from '../../utils/fetch-request';\n\nimport {\n SESSION_COOKIE_NAME,\n STATE_COOKIE_NAME,\n BeginParams,\n CallbackParams,\n AuthQuery,\n AccessTokenResponse,\n} from './types';\nimport {nonce} from './nonce';\nimport {safeCompare} from './safe-compare';\nimport {createSession} from './create-session';\n\nexport type OAuthBegin = (beginParams: BeginParams) => Promise<AdapterResponse>;\n\nexport interface CallbackResponse<T = AdapterHeaders> {\n headers: T;\n session: Session;\n}\n\nexport type OAuthCallback = <T = AdapterHeaders>(\n callbackParams: CallbackParams,\n) => Promise<CallbackResponse<T>>;\n\ninterface BotLog {\n request: NormalizedRequest;\n log: ShopifyLogger;\n func: string;\n}\n\nconst logForBot = ({request, log, func}: BotLog) => {\n log.debug(`Possible bot request to auth ${func}: `, {\n userAgent: request.headers['User-Agent'],\n });\n};\n\nexport function begin(config: ConfigInterface): OAuthBegin {\n return async ({\n shop,\n callbackPath,\n isOnline,\n ...adapterArgs\n }: BeginParams): Promise<AdapterResponse> => {\n throwIfCustomStoreApp(\n config.isCustomStoreApp,\n 'Cannot perform OAuth for private apps',\n );\n\n const log = logger(config);\n log.info('Beginning OAuth', {shop, isOnline, callbackPath});\n\n const request = await abstractConvertRequest(adapterArgs);\n const response = await abstractConvertIncomingResponse(adapterArgs);\n\n let userAgent = request.headers['User-Agent'];\n if (Array.isArray(userAgent)) {\n userAgent = userAgent[0];\n }\n if (isbot(userAgent)) {\n logForBot({request, log, func: 'begin'});\n response.statusCode = 410;\n return abstractConvertResponse(response, adapterArgs);\n }\n\n const cookies = new Cookies(request, response, {\n keys: [config.apiSecretKey],\n secure: true,\n });\n\n const state = nonce();\n\n await cookies.setAndSign(STATE_COOKIE_NAME, state, {\n expires: new Date(Date.now() + 60000),\n sameSite: 'lax',\n secure: true,\n path: callbackPath,\n });\n\n const scopes = config.scopes ? config.scopes.toString() : '';\n const query = {\n client_id: config.apiKey,\n scope: scopes,\n redirect_uri: `${config.hostScheme}://${config.hostName}${callbackPath}`,\n state,\n 'grant_options[]': isOnline ? 'per-user' : '',\n };\n const processedQuery = new ProcessedQuery();\n processedQuery.putAll(query);\n\n const cleanShop = sanitizeShop(config)(shop, true)!;\n const redirectUrl = `https://${cleanShop}/admin/oauth/authorize${processedQuery.stringify()}`;\n response.statusCode = 302;\n response.statusText = 'Found';\n response.headers = {\n ...response.headers,\n ...cookies.response.headers!,\n Location: redirectUrl,\n };\n\n log.debug(`OAuth started, redirecting to ${redirectUrl}`, {shop, isOnline});\n\n return abstractConvertResponse(response, adapterArgs);\n };\n}\n\nexport function callback(config: ConfigInterface): OAuthCallback {\n return async function callback<T = AdapterHeaders>({\n expiring,\n ...adapterArgs\n }: CallbackParams): Promise<CallbackResponse<T>> {\n throwIfCustomStoreApp(\n config.isCustomStoreApp,\n 'Cannot perform OAuth for private apps',\n );\n\n const log = logger(config);\n\n const request = await abstractConvertRequest(adapterArgs);\n\n const query = new URL(\n request.url,\n `${config.hostScheme}://${config.hostName}`,\n ).searchParams;\n const shop = query.get('shop')!;\n\n const response = {} as NormalizedResponse;\n let userAgent = request.headers['User-Agent'];\n if (Array.isArray(userAgent)) {\n userAgent = userAgent[0];\n }\n if (isbot(userAgent)) {\n logForBot({request, log, func: 'callback'});\n throw new ShopifyErrors.BotActivityDetected(\n 'Invalid OAuth callback initiated by bot',\n );\n }\n\n log.info('Completing OAuth', {shop});\n\n const cookies = new Cookies(request, response, {\n keys: [config.apiSecretKey],\n secure: true,\n });\n\n const stateFromCookie = await cookies.getAndVerify(STATE_COOKIE_NAME);\n cookies.deleteCookie(STATE_COOKIE_NAME);\n if (!stateFromCookie) {\n log.error('Could not find OAuth cookie', {shop});\n\n throw new ShopifyErrors.CookieNotFound(\n `Cannot complete OAuth process. Could not find an OAuth cookie for shop url: ${shop}`,\n );\n }\n\n const authQuery: AuthQuery = Object.fromEntries(query.entries());\n if (!(await validQuery({config, query: authQuery, stateFromCookie}))) {\n log.error('Invalid OAuth callback', {shop, stateFromCookie});\n\n throw new ShopifyErrors.InvalidOAuthError('Invalid OAuth callback.');\n }\n\n log.debug('OAuth request is valid, requesting access token', {shop});\n\n const body = {\n client_id: config.apiKey,\n client_secret: config.apiSecretKey,\n code: query.get('code'),\n expiring: expiring ? '1' : '0',\n };\n\n const cleanShop = sanitizeShop(config)(query.get('shop')!, true)!;\n\n const postResponse = await fetchRequestFactory(config)(\n `https://${cleanShop}/admin/oauth/access_token`,\n {\n method: 'POST',\n body: JSON.stringify(body),\n headers: {\n 'Content-Type': DataType.JSON,\n Accept: DataType.JSON,\n },\n },\n );\n\n if (!postResponse.ok) {\n throwFailedRequest(await postResponse.json(), false, postResponse);\n }\n\n const session: Session = createSession({\n accessTokenResponse: await postResponse.json<AccessTokenResponse>(),\n shop: cleanShop,\n state: stateFromCookie,\n config,\n });\n\n if (!config.isEmbeddedApp) {\n await cookies.setAndSign(SESSION_COOKIE_NAME, session.id, {\n expires: session.expires,\n sameSite: 'lax',\n secure: true,\n path: '/',\n });\n }\n\n return {\n headers: (await abstractConvertHeaders(\n cookies.response.headers!,\n adapterArgs,\n )) as T,\n session,\n };\n };\n}\n\nasync function validQuery({\n config,\n query,\n stateFromCookie,\n}: {\n config: ConfigInterface;\n query: AuthQuery;\n stateFromCookie: string;\n}): Promise<boolean> {\n return (\n (await validateHmac(config)(query)) &&\n safeCompare(query.state!, stateFromCookie)\n );\n}\n\nfunction throwIfCustomStoreApp(\n isCustomStoreApp: boolean,\n message: string,\n): void {\n if (isCustomStoreApp) {\n throw new ShopifyErrors.PrivateAppError(message);\n }\n}\n"],"names":["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C,MAAM,YAAY,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC;QAClC,WAAW,CAAC,KAAK,CAAC,KAAM,EAAE,eAAe,CAAC;AAE9C;AAEA,SAAS,qBAAqB,CAC5B,gBAAyB,EACzB,OAAe,EAAA;IAEf,IAAI,gBAAgB,EAAE;AACpB,QAAA,MAAM,IAAIC,eAA6B,CAAC,OAAO,CAAC;IAClD;AACF;;;;"}
1
+ {"version":3,"file":"oauth.mjs","sources":["../../../../../../../lib/auth/oauth/oauth.ts"],"sourcesContent":["import {isbot} from 'isbot';\n\nimport {throwFailedRequest} from '../../clients/common';\nimport ProcessedQuery from '../../utils/processed-query';\nimport {ConfigInterface} from '../../base-types';\nimport * as ShopifyErrors from '../../error';\nimport {validateHmac} from '../../utils/hmac-validator';\nimport {sanitizeShop} from '../../utils/shop-validator';\nimport {Session} from '../../session/session';\nimport {\n abstractConvertRequest,\n abstractConvertIncomingResponse,\n abstractConvertResponse,\n abstractConvertHeaders,\n AdapterResponse,\n AdapterHeaders,\n Cookies,\n NormalizedResponse,\n NormalizedRequest,\n} from '../../../runtime/http';\nimport {logger, ShopifyLogger} from '../../logger';\nimport {DataType} from '../../clients/types';\nimport {fetchRequestFactory} from '../../utils/fetch-request';\n\nimport {\n SESSION_COOKIE_NAME,\n STATE_COOKIE_NAME,\n BeginParams,\n CallbackParams,\n AuthQuery,\n AccessTokenResponse,\n} from './types';\nimport {nonce} from './nonce';\nimport {safeCompare} from './safe-compare';\nimport {createSession} from './create-session';\n\nexport type OAuthBegin = (beginParams: BeginParams) => Promise<AdapterResponse>;\n\nexport interface CallbackResponse<T = AdapterHeaders> {\n headers: T;\n session: Session;\n}\n\nexport type OAuthCallback = <T = AdapterHeaders>(\n callbackParams: CallbackParams,\n) => Promise<CallbackResponse<T>>;\n\ninterface BotLog {\n request: NormalizedRequest;\n log: ShopifyLogger;\n func: string;\n}\n\nconst logForBot = ({request, log, func}: BotLog) => {\n log.debug(`Possible bot request to auth ${func}: `, {\n userAgent: request.headers['User-Agent'],\n });\n};\n\nexport function begin(config: ConfigInterface): OAuthBegin {\n return async ({\n shop,\n callbackPath,\n isOnline,\n ...adapterArgs\n }: BeginParams): Promise<AdapterResponse> => {\n throwIfCustomStoreApp(\n config.isCustomStoreApp,\n 'Cannot perform OAuth for private apps',\n );\n\n const log = logger(config);\n log.info('Beginning OAuth', {shop, isOnline, callbackPath});\n\n const request = await abstractConvertRequest(adapterArgs);\n const response = await abstractConvertIncomingResponse(adapterArgs);\n\n let userAgent = request.headers['User-Agent'];\n if (Array.isArray(userAgent)) {\n userAgent = userAgent[0];\n }\n if (isbot(userAgent)) {\n logForBot({request, log, func: 'begin'});\n response.statusCode = 410;\n return abstractConvertResponse(response, adapterArgs);\n }\n\n const cookies = new Cookies(request, response, {\n keys: [config.apiSecretKey],\n secure: true,\n });\n\n const state = nonce();\n\n await cookies.setAndSign(STATE_COOKIE_NAME, state, {\n expires: new Date(Date.now() + 60000),\n sameSite: 'lax',\n secure: true,\n path: callbackPath,\n });\n\n const scopes = config.scopes ? config.scopes.toString() : '';\n const query = {\n client_id: config.apiKey,\n scope: scopes,\n redirect_uri: `${config.hostScheme}://${config.hostName}${callbackPath}`,\n state,\n 'grant_options[]': isOnline ? 'per-user' : '',\n };\n const processedQuery = new ProcessedQuery();\n processedQuery.putAll(query);\n\n const cleanShop = sanitizeShop(config)(shop, true)!;\n const redirectUrl = `https://${cleanShop}/admin/oauth/authorize${processedQuery.stringify()}`;\n response.statusCode = 302;\n response.statusText = 'Found';\n response.headers = {\n ...response.headers,\n ...cookies.response.headers!,\n Location: redirectUrl,\n };\n\n log.debug(`OAuth started, redirecting to ${redirectUrl}`, {shop, isOnline});\n\n return abstractConvertResponse(response, adapterArgs);\n };\n}\n\nexport function callback(config: ConfigInterface): OAuthCallback {\n return async function callback<T = AdapterHeaders>({\n expiring,\n ...adapterArgs\n }: CallbackParams): Promise<CallbackResponse<T>> {\n throwIfCustomStoreApp(\n config.isCustomStoreApp,\n 'Cannot perform OAuth for private apps',\n );\n\n const log = logger(config);\n\n const request = await abstractConvertRequest(adapterArgs);\n\n const query = new URL(\n request.url,\n `${config.hostScheme}://${config.hostName}`,\n ).searchParams;\n const shop = query.get('shop')!;\n\n const response = {} as NormalizedResponse;\n let userAgent = request.headers['User-Agent'];\n if (Array.isArray(userAgent)) {\n userAgent = userAgent[0];\n }\n if (isbot(userAgent)) {\n logForBot({request, log, func: 'callback'});\n throw new ShopifyErrors.BotActivityDetected(\n 'Invalid OAuth callback initiated by bot',\n );\n }\n\n log.info('Completing OAuth', {shop});\n\n const cookies = new Cookies(request, response, {\n keys: [config.apiSecretKey],\n secure: true,\n });\n\n const stateFromCookie = await cookies.getAndVerify(STATE_COOKIE_NAME);\n cookies.deleteCookie(STATE_COOKIE_NAME);\n if (!stateFromCookie) {\n log.error('Could not find OAuth cookie', {shop});\n\n throw new ShopifyErrors.CookieNotFound(\n `Cannot complete OAuth process. Could not find an OAuth cookie for shop url: ${shop}`,\n );\n }\n\n const authQuery: AuthQuery = Object.fromEntries(query.entries());\n if (!(await validQuery({config, query: authQuery, stateFromCookie}))) {\n log.error('Invalid OAuth callback', {shop, stateFromCookie});\n\n throw new ShopifyErrors.InvalidOAuthError('Invalid OAuth callback.');\n }\n\n log.debug('OAuth request is valid, requesting access token', {shop});\n\n const body = {\n client_id: config.apiKey,\n client_secret: config.apiSecretKey,\n code: query.get('code'),\n expiring: expiring ? '1' : '0',\n };\n\n const cleanShop = sanitizeShop(config)(query.get('shop')!, true)!;\n\n const postResponse = await fetchRequestFactory(config)(\n `https://${cleanShop}/admin/oauth/access_token`,\n {\n method: 'POST',\n body: JSON.stringify(body),\n headers: {\n 'Content-Type': DataType.JSON,\n Accept: DataType.JSON,\n },\n },\n );\n\n if (!postResponse.ok) {\n throwFailedRequest(await postResponse.json(), false, postResponse);\n }\n\n const session: Session = createSession({\n accessTokenResponse: await postResponse.json<AccessTokenResponse>(),\n shop: cleanShop,\n state: stateFromCookie,\n config,\n });\n\n if (!config.isEmbeddedApp) {\n const cookiePath =\n typeof config.cookiePath === 'function'\n ? config.cookiePath(session)\n : (config.cookiePath ?? '/');\n await cookies.setAndSign(SESSION_COOKIE_NAME, session.id, {\n expires: session.expires,\n sameSite: 'lax',\n secure: true,\n path: cookiePath,\n });\n }\n\n return {\n headers: (await abstractConvertHeaders(\n cookies.response.headers!,\n adapterArgs,\n )) as T,\n session,\n };\n };\n}\n\nasync function validQuery({\n config,\n query,\n stateFromCookie,\n}: {\n config: ConfigInterface;\n query: AuthQuery;\n stateFromCookie: string;\n}): Promise<boolean> {\n return (\n (await validateHmac(config)(query)) &&\n safeCompare(query.state!, stateFromCookie)\n );\n}\n\nfunction throwIfCustomStoreApp(\n isCustomStoreApp: boolean,\n message: string,\n): void {\n if (isCustomStoreApp) {\n throw new ShopifyErrors.PrivateAppError(message);\n }\n}\n"],"names":["ShopifyErrors.BotActivityDetected","ShopifyErrors.CookieNotFound","ShopifyErrors.InvalidOAuthError","ShopifyErrors.PrivateAppError"],"mappings":";;;;;;;;;;;;;;;;AAqDA,MAAM,SAAS,GAAG,CAAC,EAAC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAS,KAAI;AACjD,IAAA,GAAG,CAAC,KAAK,CAAC,CAAA,6BAAA,EAAgC,IAAI,IAAI,EAAE;AAClD,QAAA,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC;AACzC,KAAA,CAAC;AACJ,CAAC;AAEK,SAAU,KAAK,CAAC,MAAuB,EAAA;AAC3C,IAAA,OAAO,OAAO,EACZ,IAAI,EACJ,YAAY,EACZ,QAAQ,EACR,GAAG,WAAW,EACF,KAA8B;AAC1C,QAAA,qBAAqB,CACnB,MAAM,CAAC,gBAAgB,EACvB,uCAAuC,CACxC;AAED,QAAA,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC;AAC1B,QAAA,GAAG,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,YAAY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YACtB,MAAM;AACP,SAAA,CAAC;AAEF,QAAA,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE;AACzB,YAAA,MAAM,UAAU,GACd,OAAO,MAAM,CAAC,UAAU,KAAK;AAC3B,kBAAE,MAAM,CAAC,UAAU,CAAC,OAAO;mBACxB,MAAM,CAAC,UAAU,IAAI,GAAG,CAAC;YAChC,MAAM,OAAO,CAAC,UAAU,CAAC,mBAAmB,EAAE,OAAO,CAAC,EAAE,EAAE;gBACxD,OAAO,EAAE,OAAO,CAAC,OAAO;AACxB,gBAAA,QAAQ,EAAE,KAAK;AACf,gBAAA,MAAM,EAAE,IAAI;AACZ,gBAAA,IAAI,EAAE,UAAU;AACjB,aAAA,CAAC;QACJ;QAEA,OAAO;AACL,YAAA,OAAO,GAAG,MAAM,sBAAsB,CACpC,OAAO,CAAC,QAAQ,CAAC,OAAQ,EACzB,WAAW,CACZ,CAAM;YACP,OAAO;SACR;AACH,IAAA,CAAC;AACH;AAEA,eAAe,UAAU,CAAC,EACxB,MAAM,EACN,KAAK,EACL,eAAe,GAKhB,EAAA;IACC,QACE,CAAC,MAAM,YAAY,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC;QAClC,WAAW,CAAC,KAAK,CAAC,KAAM,EAAE,eAAe,CAAC;AAE9C;AAEA,SAAS,qBAAqB,CAC5B,gBAAyB,EACzB,OAAe,EAAA;IAEf,IAAI,gBAAgB,EAAE;AACpB,QAAA,MAAM,IAAIC,eAA6B,CAAC,OAAO,CAAC;IAClD;AACF;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.mjs","sources":["../../../../../../lib/billing/types.ts"],"sourcesContent":["import {BillingInterval, BillingReplacementBehavior} from '../types';\nimport {Session} from '../session/session';\nimport {FeatureEnabled, FutureFlagOptions} from '../../future/flags';\n\nexport interface BillingConfigPlan {\n /**\n * Amount to charge for this plan.\n */\n amount: number;\n /**\n * Currency code for this plan.\n */\n currencyCode: string;\n}\n\nexport interface BillingConfigOneTimePlan extends BillingConfigPlan {\n /**\n * Interval for this plan.\n *\n * Must be set to `OneTime`.\n */\n interval: BillingInterval.OneTime;\n}\n\nexport interface BillingConfigSubscriptionPlanDiscountAmount {\n /**\n * The amount to discount.\n *\n * Cannot be set if `percentage` is set.\n */\n amount: number;\n /**\n * The percentage to discount.\n *\n * Cannot be set if `amount` is set.\n */\n percentage?: never;\n}\n\nexport interface BillingConfigSubscriptionPlanDiscountPercentage {\n /**\n * The amount to discount.\n *\n * Cannot be set if `percentage` is set.\n */\n amount?: never;\n /**\n * The percentage to discount.\n *\n * Cannot be set if `amount` is set.\n */\n percentage: number;\n}\n\nexport interface BillingConfigSubscriptionPlanDiscount {\n /**\n * The number of intervals to apply the discount for.\n */\n durationLimitInIntervals?: number;\n /**\n * The discount to apply.\n */\n value:\n | BillingConfigSubscriptionPlanDiscountAmount\n | BillingConfigSubscriptionPlanDiscountPercentage;\n}\n\nexport type BillingConfigItem =\n | BillingConfigOneTimePlan\n | BillingConfigSubscriptionLineItemPlan;\n\n// Type this as an interface to improve TSDoc support for it.\n\n/**\n * Billing configuration options, indexed by an app-specific plan name.\n */\nexport interface BillingConfig {\n /**\n * An individual billing plan.\n */\n [plan: string]: BillingConfigItem;\n}\n\nexport type RequestConfigOverrides = Partial<BillingConfigOneTimePlan>;\n\nexport interface BillingConfigLineItem {\n /**\n * The amount to charge for this line item.\n */\n amount: number;\n /**\n * The currency code for this line item.\n */\n currencyCode: string;\n}\n\nexport interface BillingConfigRecurringLineItem extends BillingConfigLineItem {\n /**\n * The recurring interval for this line item.\n *\n * Must be either `Every30Days` or `Annual`.\n */\n interval: BillingInterval.Every30Days | BillingInterval.Annual;\n /**\n * An optional discount to apply for this line item.\n */\n discount?: BillingConfigSubscriptionPlanDiscount;\n}\n\nexport interface BillingConfigUsageLineItem extends BillingConfigLineItem {\n /**\n * The usage interval for this line item.\n *\n * Must be set to `Usage`.\n */\n interval: BillingInterval.Usage;\n /**\n * The capped amount or the maximum amount to be charged in the interval.\n */\n amount: number;\n /**\n * Usage terms for this line item.\n */\n terms: string;\n}\n\nexport interface BillingConfigSubscriptionLineItemPlan {\n /**\n * The replacement behavior to use for this plan.\n */\n replacementBehavior?: BillingReplacementBehavior;\n /**\n * How many trial days to give before charging for this plan.\n */\n trialDays?: number;\n /**\n * The line items for this plan.\n */\n lineItems: (BillingConfigRecurringLineItem | BillingConfigUsageLineItem)[];\n}\n\ntype DeepPartial<T> = T extends object\n ? {[P in keyof T]?: DeepPartial<T[P]>}\n : T;\nexport type RequestConfigLineItemOverrides =\n DeepPartial<BillingConfigSubscriptionLineItemPlan>;\n\ninterface BillingCheckParamsNew {\n /**\n * The session to use for this check.\n */\n session: Session;\n /**\n * The plans to accept for this check.\n */\n plans?: string[] | string;\n /**\n * Whether to include charges that were created on test mode. Test shops and demo shops cannot be charged.\n */\n isTest?: boolean;\n}\n\ninterface BillingCheckParamsOld extends BillingCheckParamsNew {\n /**\n * The plans to accept for this check.\n */\n plans: string[] | string;\n /**\n * Whether to return the full response object.\n */\n returnObject?: boolean;\n}\n\nexport type BillingCheckParams<\n Future extends FutureFlagOptions = FutureFlagOptions,\n> =\n FeatureEnabled<Future, 'unstable_managedPricingSupport'> extends true\n ? BillingCheckParamsNew\n : BillingCheckParamsOld;\n\nexport interface BillingCheckResponseObject {\n /**\n * Whether the user has an active payment method.\n */\n hasActivePayment: boolean;\n /**\n * The one-time purchases the shop has.\n */\n oneTimePurchases: OneTimePurchase[];\n /**\n * The active subscriptions the shop has.\n */\n appSubscriptions: AppSubscription[];\n}\n\nexport type BillingCheckResponse<\n Params extends BillingCheckParams<Future>,\n Future extends FutureFlagOptions = FutureFlagOptions,\n> =\n FeatureEnabled<Future, 'unstable_managedPricingSupport'> extends true\n ? BillingCheckResponseObject\n : Params extends BillingCheckParamsOld\n ? Params['returnObject'] extends true\n ? BillingCheckResponseObject\n : boolean\n : never;\n\ntype BillingRequestOverridesType = RequestConfigOverrides &\n RequestConfigLineItemOverrides;\n\nexport type BillingRequestParams = {\n /**\n * The session to use for this request.\n */\n session: Session;\n /**\n * The plan to request.\n */\n plan: string;\n /**\n * Whether this is a test purchase.\n */\n isTest?: boolean;\n /**\n * Override the return URL after the purchase is complete.\n */\n returnUrl?: string;\n /**\n * Whether to return the full response object.\n */\n returnObject?: boolean;\n} & BillingRequestOverridesType;\n\nexport interface BillingRequestResponseObject {\n /**\n * The confirmation URL for this request.\n */\n confirmationUrl: string;\n /**\n * The one-time purchase created by this request.\n */\n oneTimePurchase?: OneTimePurchase;\n /**\n * The app subscription created by this request.\n */\n appSubscription?: AppSubscription;\n}\n\nexport type BillingRequestResponse<Params extends BillingRequestParams> =\n Params['returnObject'] extends true ? BillingRequestResponseObject : string;\n\nexport interface BillingCancelParams {\n /**\n * The session to use for this request.\n */\n session: Session;\n /**\n * The subscription ID to cancel.\n */\n subscriptionId: string;\n /**\n * Whether to prorate the cancellation.\n */\n prorate?: boolean;\n /**\n * Whether to consider test purchases.\n */\n isTest?: boolean;\n}\n\nexport interface BillingSubscriptionParams {\n /**\n * The session to use for this request.\n */\n session: Session;\n}\n\nexport interface AppSubscription {\n /**\n * The ID of the app subscription.\n */\n id: string;\n /**\n * The name of the purchased plan.\n */\n name: string;\n /**\n * Whether this is a test subscription.\n */\n test: boolean;\n /**\n * The number of trial days for this subscription.\n */\n trialDays: number;\n /**\n * The date and time when the subscription was created.\n */\n createdAt: string;\n /**\n * The date and time when the current period ends.\n */\n currentPeriodEnd: string;\n /**\n * The return URL for this subscription.\n */\n returnUrl: string;\n\n /*\n * The line items for this plan.\n */\n lineItems: ActiveSubscriptionLineItem[];\n\n /*\n * The status of the subscription. [ACTIVE, CANCELLED, PENDING, DECLINED, EXPIRED, FROZEN, ACCEPTED]\n */\n status:\n | 'ACTIVE'\n | 'CANCELLED'\n | 'PENDING'\n | 'DECLINED'\n | 'EXPIRED'\n | 'FROZEN'\n | 'ACCEPTED';\n}\n\nexport interface ActiveSubscriptions {\n activeSubscriptions: AppSubscription[];\n}\n\nexport interface ActiveSubscriptionLineItem {\n /*\n * The ID of the line item.\n */\n id: string;\n /*\n * The details of the plan.\n */\n plan: AppPlan;\n}\n\nexport interface RecurringAppPlan {\n /*\n * The interval for this plan is charged on.\n */\n interval: BillingInterval.Every30Days | BillingInterval.Annual;\n /*\n * The price of the plan.\n */\n price: Money;\n /*\n * The discount applied to the plan.\n */\n discount: AppPlanDiscount;\n}\n\nexport interface UsageAppPlan {\n /*\n * The total usage records for interval.\n */\n balanceUsed: Money;\n /*\n * The capped amount prevents the merchant from being charged for any usage over that amount during a billing period.\n */\n cappedAmount: Money;\n /*\n * The terms and conditions for app usage pricing.\n */\n terms: string;\n}\n\nexport interface Money {\n amount: number;\n currencyCode: string;\n}\n\nexport interface AppPlanDiscount {\n /*\n * The total number of intervals the discount applies to.\n */\n durationLimitInIntervals: number;\n /*\n * The remaining number of intervals the discount applies to.\n */\n remainingDurationInIntervals: number;\n /*\n * The price after the discount is applied.\n */\n priceAfterDiscount: Money;\n /*\n * The value of the discount applied every billing interval.\n */\n value: AppPlanDiscountAmount;\n}\n\nexport interface AppSubscriptionLineItemUpdatePayload {\n userErrors: string[];\n confirmationUrl: string;\n appSubscription: AppSubscription;\n}\n\nexport type UpdateCappedAmountConfirmation = Omit<\n AppSubscriptionLineItemUpdatePayload,\n 'userErrors'\n>;\n\ntype AppPlanDiscountAmount =\n | BillingConfigSubscriptionPlanDiscountAmount\n | BillingConfigSubscriptionPlanDiscountPercentage;\n\nexport interface AppPlan {\n /*\n * The pricing details of the plan.\n */\n pricingDetails: RecurringAppPlan | UsageAppPlan;\n}\nexport interface OneTimePurchase {\n /**\n * The ID of the one-time purchase.\n */\n id: string;\n /**\n * The name of the purchased plan.\n */\n name: string;\n /**\n * Whether this is a test purchase.\n */\n test: boolean;\n /*\n * The status of the subscription. [ACTIVE, CANCELLED, PENDING, DECLINED, EXPIRED, FROZEN, ACCEPTED]\n */\n status:\n | 'ACTIVE'\n | 'CANCELLED'\n | 'PENDING'\n | 'DECLINED'\n | 'EXPIRED'\n | 'FROZEN'\n | 'ACCEPTED';\n}\n\nexport interface BillingCreateUsageRecordParams {\n /**\n * The session to use for this request.\n */\n session: Session;\n /**\n * The description of the usage record.\n */\n description: string;\n /**\n * The price and currency of the usage record.\n */\n price: {\n /**\n * The amount to charge for this usage record.\n */\n amount: number;\n /**\n * The currency code for this usage record.\n */\n currencyCode: string;\n };\n /**\n * The subscription line item ID to associate the usage record with.\n */\n subscriptionLineItemId?: string;\n /**\n * The idempotency key for this request.\n */\n idempotencyKey?: string;\n /**\n * Whether this is a test charge.\n * */\n isTest?: boolean;\n}\n\nexport interface UsageRecord {\n /**\n * The ID of the usage record.\n */\n id: string;\n /**\n * The description of the usage record.\n */\n description: string;\n /**\n * The price and currency of the usage record.\n */\n price: {\n /**\n * The amount to charge for this usage record.\n */\n amount: number;\n /**\n * The currency code for this usage record.\n */\n currencyCode: string;\n };\n /**\n * The subscription line item associated with the usage record.\n */\n plan: ActiveSubscriptionLineItem;\n /**\n * The idempotency key for this request.\n */\n idempotencyKey?: string;\n /**\n * The subscription line item associated with the usage record.\n */\n subscriptionLineItem: AppSubscriptionLineItem;\n}\n\nexport interface AppSubscriptionLineItem {\n /**\n * The ID of the subscription line item.\n */\n id: string;\n /**\n * The plan associated with the subscription line item.\n */\n plan: AppPlan;\n}\n\nexport interface BillingUpdateUsageCappedAmountParams {\n /**\n * The session to use for this request.\n */\n session: Session;\n /**\n * The subscription line item ID to update.\n */\n subscriptionLineItemId: string;\n /**\n * The maximum charge for the usage billing plan.\n */\n cappedAmount: {\n /**\n * The amount to update.\n */\n amount: number;\n /**\n * The currency code to update.\n */\n currencyCode: string;\n };\n}\n\ninterface OneTimePurchases {\n oneTimePurchases: {\n edges: {\n node: OneTimePurchase;\n }[];\n pageInfo: {\n endCursor: string;\n hasNextPage: boolean;\n };\n };\n}\n\nexport type CurrentAppInstallation = OneTimePurchases & ActiveSubscriptions;\n\nexport interface CurrentAppInstallations {\n currentAppInstallation?: CurrentAppInstallation;\n}\n\nexport interface RequestResponse {\n userErrors: string[];\n confirmationUrl: string;\n}\n\ninterface AppSubscriptionCreate {\n userErrors: string[];\n confirmationUrl: string;\n appSubscription: AppSubscription;\n}\n\ninterface AppPurchaseOneTimeCreate {\n userErrors: string[];\n confirmationUrl: string;\n oneTimePurchase: OneTimePurchase;\n}\n\nexport interface RecurringPaymentResponse {\n appSubscriptionCreate?: AppSubscriptionCreate;\n}\n\nexport interface SinglePaymentResponse {\n appPurchaseOneTimeCreate?: AppPurchaseOneTimeCreate;\n}\n\nexport type RequestResponseData =\n | AppSubscriptionCreate\n | AppPurchaseOneTimeCreate;\n\nexport interface SubscriptionResponse {\n currentAppInstallation?: ActiveSubscriptions;\n}\n\nexport interface CancelResponse {\n appSubscriptionCancel?: {\n appSubscription: AppSubscription;\n userErrors: string[];\n };\n}\n\nexport interface UsageRecordCreateResponse {\n appUsageRecordCreate?: {\n appUsageRecord: UsageRecord;\n userErrors: string[];\n };\n}\n\nexport interface BillingUpdateUsageCappedAmountResponse {\n appSubscriptionLineItemUpdate?: AppSubscriptionLineItemUpdatePayload;\n}\n\nexport type BillingCheck<Future extends FutureFlagOptions> = <\n Params extends BillingCheckParams<Future>,\n>(\n params: Params,\n) => Promise<BillingCheckResponse<Params, Future>>;\n\nexport type BillingRequest = <Params extends BillingRequestParams>(\n params: Params,\n) => Promise<BillingRequestResponse<Params>>;\n\nexport type BillingCancel = (\n params: BillingCancelParams,\n) => Promise<AppSubscription>;\n\nexport type BillingSubscriptions = (\n params: BillingSubscriptionParams,\n) => Promise<ActiveSubscriptions>;\n\nexport type BillingCreateUsageRecord = (\n params: BillingCreateUsageRecordParams,\n) => Promise<UsageRecord>;\n\nexport type BillingUpdateUsageCappedAmount = (\n params: BillingUpdateUsageCappedAmountParams,\n) => Promise<UpdateCappedAmountConfirmation>;\n\nexport interface ShopifyBilling<Future extends FutureFlagOptions> {\n check: BillingCheck<Future>;\n request: BillingRequest;\n cancel: BillingCancel;\n subscriptions: BillingSubscriptions;\n createUsageRecord: BillingCreateUsageRecord;\n updateUsageCappedAmount: BillingUpdateUsageCappedAmount;\n}\n\nexport const APP_SUBSCRIPTION_FRAGMENT = `\n fragment AppSubscriptionFragment on AppSubscription {\n id\n name\n test\n status\n trialDays\n createdAt\n currentPeriodEnd\n returnUrl\n lineItems {\n id\n plan {\n pricingDetails {\n ... on AppRecurringPricing {\n price {\n amount\n currencyCode\n }\n interval\n discount {\n durationLimitInIntervals\n remainingDurationInIntervals\n priceAfterDiscount {\n amount\n }\n value {\n ... on AppSubscriptionDiscountAmount {\n amount {\n amount\n currencyCode\n }\n }\n ... on AppSubscriptionDiscountPercentage {\n percentage\n }\n }\n }\n }\n ... on AppUsagePricing {\n balanceUsed {\n amount\n currencyCode\n }\n cappedAmount {\n amount\n currencyCode\n }\n terms\n }\n }\n }\n }\n }\n`;\n"],"names":[],"mappings":"AA4oBO,MAAM,yBAAyB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"types.mjs","sources":["../../../../../../lib/billing/types.ts"],"sourcesContent":["import {BillingInterval, BillingReplacementBehavior} from '../types';\nimport {Session} from '../session/session';\nimport {FeatureEnabled, FutureFlagOptions} from '../../future/flags';\n\nexport interface BillingConfigPlan {\n /**\n * Amount to charge for this plan.\n */\n amount: number;\n /**\n * Currency code for this plan.\n */\n currencyCode: string;\n}\n\nexport interface BillingConfigOneTimePlan extends BillingConfigPlan {\n /**\n * Interval for this plan.\n *\n * Must be set to `OneTime`.\n */\n interval: BillingInterval.OneTime;\n}\n\nexport interface BillingConfigSubscriptionPlanDiscountAmount {\n /**\n * The amount to discount.\n *\n * Cannot be set if `percentage` is set.\n */\n amount: number;\n /**\n * The percentage to discount.\n *\n * Cannot be set if `amount` is set.\n */\n percentage?: never;\n}\n\nexport interface BillingConfigSubscriptionPlanDiscountPercentage {\n /**\n * The amount to discount.\n *\n * Cannot be set if `percentage` is set.\n */\n amount?: never;\n /**\n * The percentage to discount.\n *\n * Cannot be set if `amount` is set.\n */\n percentage: number;\n}\n\nexport interface BillingConfigSubscriptionPlanDiscount {\n /**\n * The number of intervals to apply the discount for.\n */\n durationLimitInIntervals?: number;\n /**\n * The discount to apply.\n */\n value:\n | BillingConfigSubscriptionPlanDiscountAmount\n | BillingConfigSubscriptionPlanDiscountPercentage;\n}\n\nexport type BillingConfigItem =\n BillingConfigOneTimePlan | BillingConfigSubscriptionLineItemPlan;\n\n// Type this as an interface to improve TSDoc support for it.\n\n/**\n * Billing configuration options, indexed by an app-specific plan name.\n */\nexport interface BillingConfig {\n /**\n * An individual billing plan.\n */\n [plan: string]: BillingConfigItem;\n}\n\nexport type RequestConfigOverrides = Partial<BillingConfigOneTimePlan>;\n\nexport interface BillingConfigLineItem {\n /**\n * The amount to charge for this line item.\n */\n amount: number;\n /**\n * The currency code for this line item.\n */\n currencyCode: string;\n}\n\nexport interface BillingConfigRecurringLineItem extends BillingConfigLineItem {\n /**\n * The recurring interval for this line item.\n *\n * Must be either `Every30Days` or `Annual`.\n */\n interval: BillingInterval.Every30Days | BillingInterval.Annual;\n /**\n * An optional discount to apply for this line item.\n */\n discount?: BillingConfigSubscriptionPlanDiscount;\n}\n\nexport interface BillingConfigUsageLineItem extends BillingConfigLineItem {\n /**\n * The usage interval for this line item.\n *\n * Must be set to `Usage`.\n */\n interval: BillingInterval.Usage;\n /**\n * The capped amount or the maximum amount to be charged in the interval.\n */\n amount: number;\n /**\n * Usage terms for this line item.\n */\n terms: string;\n}\n\nexport interface BillingConfigSubscriptionLineItemPlan {\n /**\n * The replacement behavior to use for this plan.\n */\n replacementBehavior?: BillingReplacementBehavior;\n /**\n * How many trial days to give before charging for this plan.\n */\n trialDays?: number;\n /**\n * The line items for this plan.\n */\n lineItems: (BillingConfigRecurringLineItem | BillingConfigUsageLineItem)[];\n}\n\ntype DeepPartial<T> = T extends object\n ? {[P in keyof T]?: DeepPartial<T[P]>}\n : T;\nexport type RequestConfigLineItemOverrides =\n DeepPartial<BillingConfigSubscriptionLineItemPlan>;\n\ninterface BillingCheckParamsNew {\n /**\n * The session to use for this check.\n */\n session: Session;\n /**\n * The plans to accept for this check.\n */\n plans?: string[] | string;\n /**\n * Whether to include charges that were created on test mode. Test shops and demo shops cannot be charged.\n */\n isTest?: boolean;\n}\n\ninterface BillingCheckParamsOld extends BillingCheckParamsNew {\n /**\n * The plans to accept for this check.\n */\n plans: string[] | string;\n /**\n * Whether to return the full response object.\n */\n returnObject?: boolean;\n}\n\nexport type BillingCheckParams<\n Future extends FutureFlagOptions = FutureFlagOptions,\n> =\n FeatureEnabled<Future, 'unstable_managedPricingSupport'> extends true\n ? BillingCheckParamsNew\n : BillingCheckParamsOld;\n\nexport interface BillingCheckResponseObject {\n /**\n * Whether the user has an active payment method.\n */\n hasActivePayment: boolean;\n /**\n * The one-time purchases the shop has.\n */\n oneTimePurchases: OneTimePurchase[];\n /**\n * The active subscriptions the shop has.\n */\n appSubscriptions: AppSubscription[];\n}\n\nexport type BillingCheckResponse<\n Params extends BillingCheckParams<Future>,\n Future extends FutureFlagOptions = FutureFlagOptions,\n> =\n FeatureEnabled<Future, 'unstable_managedPricingSupport'> extends true\n ? BillingCheckResponseObject\n : Params extends BillingCheckParamsOld\n ? Params['returnObject'] extends true\n ? BillingCheckResponseObject\n : boolean\n : never;\n\ntype BillingRequestOverridesType = RequestConfigOverrides &\n RequestConfigLineItemOverrides;\n\nexport type BillingRequestParams = {\n /**\n * The session to use for this request.\n */\n session: Session;\n /**\n * The plan to request.\n */\n plan: string;\n /**\n * Whether this is a test purchase.\n */\n isTest?: boolean;\n /**\n * Override the return URL after the purchase is complete.\n */\n returnUrl?: string;\n /**\n * Whether to return the full response object.\n */\n returnObject?: boolean;\n} & BillingRequestOverridesType;\n\nexport interface BillingRequestResponseObject {\n /**\n * The confirmation URL for this request.\n */\n confirmationUrl: string;\n /**\n * The one-time purchase created by this request.\n */\n oneTimePurchase?: OneTimePurchase;\n /**\n * The app subscription created by this request.\n */\n appSubscription?: AppSubscription;\n}\n\nexport type BillingRequestResponse<Params extends BillingRequestParams> =\n Params['returnObject'] extends true ? BillingRequestResponseObject : string;\n\nexport interface BillingCancelParams {\n /**\n * The session to use for this request.\n */\n session: Session;\n /**\n * The subscription ID to cancel.\n */\n subscriptionId: string;\n /**\n * Whether to prorate the cancellation.\n */\n prorate?: boolean;\n /**\n * Whether to consider test purchases.\n */\n isTest?: boolean;\n}\n\nexport interface BillingSubscriptionParams {\n /**\n * The session to use for this request.\n */\n session: Session;\n}\n\nexport interface AppSubscription {\n /**\n * The ID of the app subscription.\n */\n id: string;\n /**\n * The name of the purchased plan.\n */\n name: string;\n /**\n * Whether this is a test subscription.\n */\n test: boolean;\n /**\n * The number of trial days for this subscription.\n */\n trialDays: number;\n /**\n * The date and time when the subscription was created.\n */\n createdAt: string;\n /**\n * The date and time when the current period ends.\n */\n currentPeriodEnd: string;\n /**\n * The return URL for this subscription.\n */\n returnUrl: string;\n\n /*\n * The line items for this plan.\n */\n lineItems: ActiveSubscriptionLineItem[];\n\n /*\n * The status of the subscription. [ACTIVE, CANCELLED, PENDING, DECLINED, EXPIRED, FROZEN, ACCEPTED]\n */\n status:\n | 'ACTIVE'\n | 'CANCELLED'\n | 'PENDING'\n | 'DECLINED'\n | 'EXPIRED'\n | 'FROZEN'\n | 'ACCEPTED';\n}\n\nexport interface ActiveSubscriptions {\n activeSubscriptions: AppSubscription[];\n}\n\nexport interface ActiveSubscriptionLineItem {\n /*\n * The ID of the line item.\n */\n id: string;\n /*\n * The details of the plan.\n */\n plan: AppPlan;\n}\n\nexport interface RecurringAppPlan {\n /*\n * The interval for this plan is charged on.\n */\n interval: BillingInterval.Every30Days | BillingInterval.Annual;\n /*\n * The price of the plan.\n */\n price: Money;\n /*\n * The discount applied to the plan.\n */\n discount: AppPlanDiscount;\n}\n\nexport interface UsageAppPlan {\n /*\n * The total usage records for interval.\n */\n balanceUsed: Money;\n /*\n * The capped amount prevents the merchant from being charged for any usage over that amount during a billing period.\n */\n cappedAmount: Money;\n /*\n * The terms and conditions for app usage pricing.\n */\n terms: string;\n}\n\nexport interface Money {\n amount: number;\n currencyCode: string;\n}\n\nexport interface AppPlanDiscount {\n /*\n * The total number of intervals the discount applies to.\n */\n durationLimitInIntervals: number;\n /*\n * The remaining number of intervals the discount applies to.\n */\n remainingDurationInIntervals: number;\n /*\n * The price after the discount is applied.\n */\n priceAfterDiscount: Money;\n /*\n * The value of the discount applied every billing interval.\n */\n value: AppPlanDiscountAmount;\n}\n\nexport interface AppSubscriptionLineItemUpdatePayload {\n userErrors: string[];\n confirmationUrl: string;\n appSubscription: AppSubscription;\n}\n\nexport type UpdateCappedAmountConfirmation = Omit<\n AppSubscriptionLineItemUpdatePayload,\n 'userErrors'\n>;\n\ntype AppPlanDiscountAmount =\n | BillingConfigSubscriptionPlanDiscountAmount\n | BillingConfigSubscriptionPlanDiscountPercentage;\n\nexport interface AppPlan {\n /*\n * The pricing details of the plan.\n */\n pricingDetails: RecurringAppPlan | UsageAppPlan;\n}\nexport interface OneTimePurchase {\n /**\n * The ID of the one-time purchase.\n */\n id: string;\n /**\n * The name of the purchased plan.\n */\n name: string;\n /**\n * Whether this is a test purchase.\n */\n test: boolean;\n /*\n * The status of the subscription. [ACTIVE, CANCELLED, PENDING, DECLINED, EXPIRED, FROZEN, ACCEPTED]\n */\n status:\n | 'ACTIVE'\n | 'CANCELLED'\n | 'PENDING'\n | 'DECLINED'\n | 'EXPIRED'\n | 'FROZEN'\n | 'ACCEPTED';\n}\n\nexport interface BillingCreateUsageRecordParams {\n /**\n * The session to use for this request.\n */\n session: Session;\n /**\n * The description of the usage record.\n */\n description: string;\n /**\n * The price and currency of the usage record.\n */\n price: {\n /**\n * The amount to charge for this usage record.\n */\n amount: number;\n /**\n * The currency code for this usage record.\n */\n currencyCode: string;\n };\n /**\n * The subscription line item ID to associate the usage record with.\n */\n subscriptionLineItemId?: string;\n /**\n * The idempotency key for this request.\n */\n idempotencyKey?: string;\n /**\n * Whether this is a test charge.\n * */\n isTest?: boolean;\n}\n\nexport interface UsageRecord {\n /**\n * The ID of the usage record.\n */\n id: string;\n /**\n * The description of the usage record.\n */\n description: string;\n /**\n * The price and currency of the usage record.\n */\n price: {\n /**\n * The amount to charge for this usage record.\n */\n amount: number;\n /**\n * The currency code for this usage record.\n */\n currencyCode: string;\n };\n /**\n * The subscription line item associated with the usage record.\n */\n plan: ActiveSubscriptionLineItem;\n /**\n * The idempotency key for this request.\n */\n idempotencyKey?: string;\n /**\n * The subscription line item associated with the usage record.\n */\n subscriptionLineItem: AppSubscriptionLineItem;\n}\n\nexport interface AppSubscriptionLineItem {\n /**\n * The ID of the subscription line item.\n */\n id: string;\n /**\n * The plan associated with the subscription line item.\n */\n plan: AppPlan;\n}\n\nexport interface BillingUpdateUsageCappedAmountParams {\n /**\n * The session to use for this request.\n */\n session: Session;\n /**\n * The subscription line item ID to update.\n */\n subscriptionLineItemId: string;\n /**\n * The maximum charge for the usage billing plan.\n */\n cappedAmount: {\n /**\n * The amount to update.\n */\n amount: number;\n /**\n * The currency code to update.\n */\n currencyCode: string;\n };\n}\n\ninterface OneTimePurchases {\n oneTimePurchases: {\n edges: {\n node: OneTimePurchase;\n }[];\n pageInfo: {\n endCursor: string;\n hasNextPage: boolean;\n };\n };\n}\n\nexport type CurrentAppInstallation = OneTimePurchases & ActiveSubscriptions;\n\nexport interface CurrentAppInstallations {\n currentAppInstallation?: CurrentAppInstallation;\n}\n\nexport interface RequestResponse {\n userErrors: string[];\n confirmationUrl: string;\n}\n\ninterface AppSubscriptionCreate {\n userErrors: string[];\n confirmationUrl: string;\n appSubscription: AppSubscription;\n}\n\ninterface AppPurchaseOneTimeCreate {\n userErrors: string[];\n confirmationUrl: string;\n oneTimePurchase: OneTimePurchase;\n}\n\nexport interface RecurringPaymentResponse {\n appSubscriptionCreate?: AppSubscriptionCreate;\n}\n\nexport interface SinglePaymentResponse {\n appPurchaseOneTimeCreate?: AppPurchaseOneTimeCreate;\n}\n\nexport type RequestResponseData =\n AppSubscriptionCreate | AppPurchaseOneTimeCreate;\n\nexport interface SubscriptionResponse {\n currentAppInstallation?: ActiveSubscriptions;\n}\n\nexport interface CancelResponse {\n appSubscriptionCancel?: {\n appSubscription: AppSubscription;\n userErrors: string[];\n };\n}\n\nexport interface UsageRecordCreateResponse {\n appUsageRecordCreate?: {\n appUsageRecord: UsageRecord;\n userErrors: string[];\n };\n}\n\nexport interface BillingUpdateUsageCappedAmountResponse {\n appSubscriptionLineItemUpdate?: AppSubscriptionLineItemUpdatePayload;\n}\n\nexport type BillingCheck<Future extends FutureFlagOptions> = <\n Params extends BillingCheckParams<Future>,\n>(\n params: Params,\n) => Promise<BillingCheckResponse<Params, Future>>;\n\nexport type BillingRequest = <Params extends BillingRequestParams>(\n params: Params,\n) => Promise<BillingRequestResponse<Params>>;\n\nexport type BillingCancel = (\n params: BillingCancelParams,\n) => Promise<AppSubscription>;\n\nexport type BillingSubscriptions = (\n params: BillingSubscriptionParams,\n) => Promise<ActiveSubscriptions>;\n\nexport type BillingCreateUsageRecord = (\n params: BillingCreateUsageRecordParams,\n) => Promise<UsageRecord>;\n\nexport type BillingUpdateUsageCappedAmount = (\n params: BillingUpdateUsageCappedAmountParams,\n) => Promise<UpdateCappedAmountConfirmation>;\n\nexport interface ShopifyBilling<Future extends FutureFlagOptions> {\n check: BillingCheck<Future>;\n request: BillingRequest;\n cancel: BillingCancel;\n subscriptions: BillingSubscriptions;\n createUsageRecord: BillingCreateUsageRecord;\n updateUsageCappedAmount: BillingUpdateUsageCappedAmount;\n}\n\nexport const APP_SUBSCRIPTION_FRAGMENT = `\n fragment AppSubscriptionFragment on AppSubscription {\n id\n name\n test\n status\n trialDays\n createdAt\n currentPeriodEnd\n returnUrl\n lineItems {\n id\n plan {\n pricingDetails {\n ... on AppRecurringPricing {\n price {\n amount\n currencyCode\n }\n interval\n discount {\n durationLimitInIntervals\n remainingDurationInIntervals\n priceAfterDiscount {\n amount\n }\n value {\n ... on AppSubscriptionDiscountAmount {\n amount {\n amount\n currencyCode\n }\n }\n ... on AppSubscriptionDiscountPercentage {\n percentage\n }\n }\n }\n }\n ... on AppUsagePricing {\n balanceUsed {\n amount\n currencyCode\n }\n cappedAmount {\n amount\n currencyCode\n }\n terms\n }\n }\n }\n }\n }\n`;\n"],"names":[],"mappings":"AA0oBO,MAAM,yBAAyB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -12,6 +12,65 @@ function getUserAgent(config) {
12
12
  }
13
13
  return userAgentPrefix;
14
14
  }
15
+ const REDACTED_LOG_VALUE = '****';
16
+ // These headers carry reusable credentials and must not reach the logs.
17
+ const SENSITIVE_LOG_HEADERS = new Set([
18
+ 'authorization',
19
+ 'cookie',
20
+ 'set-cookie',
21
+ 'shopify-storefront-private-token',
22
+ 'x-shopify-access-token',
23
+ 'x-shopify-storefront-access-token',
24
+ ]);
25
+ function sanitizeHeaderValue(name, value) {
26
+ return SENSITIVE_LOG_HEADERS.has(name.toLowerCase())
27
+ ? REDACTED_LOG_VALUE
28
+ : value;
29
+ }
30
+ // Keep the original serialized shape of request headers. A Headers instance
31
+ // has no own enumerable properties, so it stays opaque here, the same as
32
+ // JSON.stringify shows it.
33
+ function sanitizeHeaders(headers) {
34
+ if (!headers || typeof headers !== 'object') {
35
+ return headers;
36
+ }
37
+ if (Array.isArray(headers)) {
38
+ return headers.map((header) => Array.isArray(header)
39
+ ? [header[0], sanitizeHeaderValue(header[0], header[1])]
40
+ : header);
41
+ }
42
+ return Object.fromEntries(Object.entries(headers).map(([name, value]) => [
43
+ name,
44
+ sanitizeHeaderValue(name, value),
45
+ ]));
46
+ }
47
+ // Response headers were always enumerated in the log, so keep that and
48
+ // redact the credential values.
49
+ function sanitizeEnumerableHeaders(headers) {
50
+ if (typeof headers?.entries === 'function' && !Array.isArray(headers)) {
51
+ return Object.fromEntries([...headers.entries()].map(([name, value]) => [
52
+ name,
53
+ sanitizeHeaderValue(name, value),
54
+ ]));
55
+ }
56
+ return sanitizeHeaders(headers);
57
+ }
58
+ function sanitizeRequestParams(requestParams) {
59
+ if (Array.isArray(requestParams)) {
60
+ return requestParams.map((param) => param && typeof param === 'object' && 'headers' in param
61
+ ? { ...param, headers: sanitizeHeaders(param.headers) }
62
+ : param);
63
+ }
64
+ if (requestParams &&
65
+ typeof requestParams === 'object' &&
66
+ 'headers' in requestParams) {
67
+ return {
68
+ ...requestParams,
69
+ headers: sanitizeHeaders(requestParams.headers),
70
+ };
71
+ }
72
+ return requestParams;
73
+ }
15
74
  function serializeResponse(response) {
16
75
  if (!response) {
17
76
  return { error: 'No response object provided' };
@@ -26,11 +85,8 @@ function serializeResponse(response) {
26
85
  type,
27
86
  url,
28
87
  };
29
- if (headers?.entries) {
30
- serialized.headers = Object.fromEntries(headers.entries());
31
- }
32
- else if (headers) {
33
- serialized.headers = headers;
88
+ if (headers) {
89
+ serialized.headers = sanitizeEnumerableHeaders(headers);
34
90
  }
35
91
  return serialized;
36
92
  }
@@ -45,7 +101,7 @@ function clientLoggerFactory(config) {
45
101
  case 'HTTP-Response': {
46
102
  const responseLog = logContent.content;
47
103
  logger(config).debug('Received response for HTTP request', {
48
- requestParams: JSON.stringify(responseLog.requestParams),
104
+ requestParams: JSON.stringify(sanitizeRequestParams(responseLog.requestParams)),
49
105
  response: JSON.stringify(serializeResponse(responseLog.response)),
50
106
  });
51
107
  break;
@@ -53,7 +109,7 @@ function clientLoggerFactory(config) {
53
109
  case 'HTTP-Retry': {
54
110
  const responseLog = logContent.content;
55
111
  logger(config).debug('Retrying HTTP request', {
56
- requestParams: JSON.stringify(responseLog.requestParams),
112
+ requestParams: JSON.stringify(sanitizeRequestParams(responseLog.requestParams)),
57
113
  retryAttempt: responseLog.retryAttempt,
58
114
  maxRetries: responseLog.maxRetries,
59
115
  response: responseLog.lastResponse
@@ -65,7 +121,7 @@ function clientLoggerFactory(config) {
65
121
  case 'HTTP-Response-GraphQL-Deprecation-Notice': {
66
122
  const responseLog = logContent.content;
67
123
  logger(config).debug('Received response containing Deprecated GraphQL Notice', {
68
- requestParams: JSON.stringify(responseLog.requestParams),
124
+ requestParams: JSON.stringify(sanitizeRequestParams(responseLog.requestParams)),
69
125
  deprecationNotice: responseLog.deprecationNotice,
70
126
  });
71
127
  break;
@@ -1 +1 @@
1
- {"version":3,"file":"common.mjs","sources":["../../../../../../lib/clients/common.ts"],"sourcesContent":["import {\n HTTPResponseLog,\n HTTPRetryLog,\n HTTPResponseGraphQLDeprecationNotice,\n LogContent,\n} from '@shopify/admin-api-client';\n\nimport * as ShopifyErrors from '../error';\nimport {LIBRARY_NAME, StatusCode} from '../types';\nimport {ConfigInterface} from '../base-types';\nimport {SHOPIFY_API_LIBRARY_VERSION} from '../version';\nimport {\n abstractRuntimeString,\n canonicalizeHeaders,\n getHeader,\n} from '../../runtime';\nimport {logger} from '../logger';\n\nexport function getUserAgent(config: ConfigInterface): string {\n let userAgentPrefix = `${LIBRARY_NAME} v${SHOPIFY_API_LIBRARY_VERSION} | ${abstractRuntimeString()}`;\n if (config.userAgentPrefix) {\n userAgentPrefix = `${config.userAgentPrefix} | ${userAgentPrefix}`;\n }\n\n return userAgentPrefix;\n}\n\nfunction serializeResponse(response: Response | any) {\n if (!response) {\n return {error: 'No response object provided'};\n }\n\n try {\n const {status, statusText, ok, redirected, type, url, headers} = response;\n\n const serialized: any = {\n status,\n statusText,\n ok,\n redirected,\n type,\n url,\n };\n\n if (headers?.entries) {\n serialized.headers = Object.fromEntries(headers.entries());\n } else if (headers) {\n serialized.headers = headers;\n }\n\n return serialized;\n } catch {\n return response;\n }\n}\n\nexport function clientLoggerFactory(config: ConfigInterface) {\n return (logContent: LogContent) => {\n if (config.logger.httpRequests) {\n switch (logContent.type) {\n case 'HTTP-Response': {\n const responseLog: HTTPResponseLog['content'] = logContent.content;\n logger(config).debug('Received response for HTTP request', {\n requestParams: JSON.stringify(responseLog.requestParams),\n response: JSON.stringify(serializeResponse(responseLog.response)),\n });\n break;\n }\n case 'HTTP-Retry': {\n const responseLog: HTTPRetryLog['content'] = logContent.content;\n logger(config).debug('Retrying HTTP request', {\n requestParams: JSON.stringify(responseLog.requestParams),\n retryAttempt: responseLog.retryAttempt,\n maxRetries: responseLog.maxRetries,\n response: responseLog.lastResponse\n ? JSON.stringify(serializeResponse(responseLog.lastResponse))\n : 'undefined',\n });\n break;\n }\n case 'HTTP-Response-GraphQL-Deprecation-Notice': {\n const responseLog: HTTPResponseGraphQLDeprecationNotice['content'] =\n logContent.content;\n logger(config).debug(\n 'Received response containing Deprecated GraphQL Notice',\n {\n requestParams: JSON.stringify(responseLog.requestParams),\n deprecationNotice: responseLog.deprecationNotice,\n },\n );\n break;\n }\n default: {\n logger(config).debug(`HTTP request event: ${logContent.content}`);\n break;\n }\n }\n }\n };\n}\n\nexport function throwFailedRequest(\n body: any,\n atMaxRetries: boolean,\n response?: Response,\n): never {\n if (typeof response === 'undefined') {\n const message = body?.errors?.message ?? '';\n throw new ShopifyErrors.HttpRequestError(\n `Http request error, no response available: ${message}`,\n );\n }\n\n const responseHeaders = canonicalizeHeaders(\n Object.fromEntries(response.headers.entries() ?? []),\n );\n\n if (response.status === StatusCode.Ok && body.errors.graphQLErrors) {\n throw new ShopifyErrors.GraphqlQueryError({\n message:\n body.errors.graphQLErrors?.[0].message ?? 'GraphQL operation failed',\n response: response as Record<string, any>,\n headers: responseHeaders,\n body: body as Record<string, any>,\n });\n }\n\n const errorMessages: string[] = [];\n if (body.errors) {\n errorMessages.push(JSON.stringify(body.errors, null, 2));\n }\n const xRequestId = getHeader(responseHeaders, 'x-request-id');\n if (xRequestId) {\n errorMessages.push(\n `If you report this error, please include this id: ${xRequestId}`,\n );\n }\n\n const errorMessage = errorMessages.length\n ? `:\\n${errorMessages.join('\\n')}`\n : '';\n const code = response.status;\n const statusText = response.statusText;\n\n switch (true) {\n case response.status === StatusCode.TooManyRequests: {\n if (atMaxRetries) {\n throw new ShopifyErrors.HttpMaxRetriesError(\n 'Attempted the maximum number of retries for HTTP request.',\n );\n } else {\n const retryAfter = getHeader(responseHeaders, 'Retry-After');\n throw new ShopifyErrors.HttpThrottlingError({\n message: `Shopify is throttling requests ${errorMessage}`,\n code,\n statusText,\n body,\n headers: responseHeaders,\n retryAfter: retryAfter ? parseFloat(retryAfter) : undefined,\n });\n }\n }\n case response.status >= StatusCode.InternalServerError:\n if (atMaxRetries) {\n throw new ShopifyErrors.HttpMaxRetriesError(\n 'Attempted the maximum number of retries for HTTP request.',\n );\n } else {\n throw new ShopifyErrors.HttpInternalError({\n message: `Shopify internal error${errorMessage}`,\n code,\n statusText,\n body,\n headers: responseHeaders,\n });\n }\n default:\n throw new ShopifyErrors.HttpResponseError({\n message: `Received an error response (${response.status} ${response.statusText}) from Shopify${errorMessage}`,\n code,\n statusText,\n body,\n headers: responseHeaders,\n });\n }\n}\n"],"names":["ShopifyErrors.HttpRequestError","ShopifyErrors.GraphqlQueryError","ShopifyErrors.HttpMaxRetriesError","ShopifyErrors.HttpThrottlingError","ShopifyErrors.HttpInternalError","ShopifyErrors.HttpResponseError"],"mappings":";;;;;;;AAkBM,SAAU,YAAY,CAAC,MAAuB,EAAA;IAClD,IAAI,eAAe,GAAG,CAAA,EAAG,YAAY,CAAA,EAAA,EAAK,2BAA2B,CAAA,GAAA,EAAM,qBAAqB,EAAE,CAAA,CAAE;AACpG,IAAA,IAAI,MAAM,CAAC,eAAe,EAAE;QAC1B,eAAe,GAAG,GAAG,MAAM,CAAC,eAAe,CAAA,GAAA,EAAM,eAAe,EAAE;IACpE;AAEA,IAAA,OAAO,eAAe;AACxB;AAEA,SAAS,iBAAiB,CAAC,QAAwB,EAAA;IACjD,IAAI,CAAC,QAAQ,EAAE;AACb,QAAA,OAAO,EAAC,KAAK,EAAE,6BAA6B,EAAC;IAC/C;AAEA,IAAA,IAAI;AACF,QAAA,MAAM,EAAC,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE,UAAU,EAAE,I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UAAU,CAAC,mBAAmB;YACpD,IAAI,YAAY,EAAE;AAChB,gBAAA,MAAM,IAAID,mBAAiC,CACzC,2DAA2D,CAC5D;YACH;iBAAO;AACL,gBAAA,MAAM,IAAIE,iBAA+B,CAAC;oBACxC,OAAO,EAAE,CAAA,sBAAA,EAAyB,YAAY,CAAA,CAAE;oBAChD,IAAI;oBACJ,UAAU;oBACV,IAAI;AACJ,oBAAA,OAAO,EAAE,eAAe;AACzB,iBAAA,CAAC;YACJ;AACF,QAAA;AACE,YAAA,MAAM,IAAIC,iBAA+B,CAAC;gBACxC,OAAO,EAAE,CAAA,4BAAA,EAA+B,QAAQ,CAAC,MAAM,CAAA,CAAA,EAAI,QAAQ,CAAC,UAAU,CAAA,cAAA,EAAiB,YAAY,CAAA,CAAE;gBAC7G,IAAI;gBACJ,UAAU;gBACV,IAAI;AACJ,gBAAA,OAAO,EAAE,eAAe;AACzB,aAAA,CAAC;;AAER;;;;"}
1
+ {"version":3,"file":"common.mjs","sources":["../../../../../../lib/clients/common.ts"],"sourcesContent":["import {\n HTTPResponseLog,\n HTTPRetryLog,\n HTTPResponseGraphQLDeprecationNotice,\n LogContent,\n} from '@shopify/admin-api-client';\n\nimport * as ShopifyErrors from '../error';\nimport {LIBRARY_NAME, StatusCode} from '../types';\nimport {ConfigInterface} from '../base-types';\nimport {SHOPIFY_API_LIBRARY_VERSION} from '../version';\nimport {\n abstractRuntimeString,\n canonicalizeHeaders,\n getHeader,\n} from '../../runtime';\nimport {logger} from '../logger';\n\nexport function getUserAgent(config: ConfigInterface): string {\n let userAgentPrefix = `${LIBRARY_NAME} v${SHOPIFY_API_LIBRARY_VERSION} | ${abstractRuntimeString()}`;\n if (config.userAgentPrefix) {\n userAgentPrefix = `${config.userAgentPrefix} | ${userAgentPrefix}`;\n }\n\n return userAgentPrefix;\n}\n\nconst REDACTED_LOG_VALUE = '****';\n\n// These headers carry reusable credentials and must not reach the logs.\nconst SENSITIVE_LOG_HEADERS = new Set([\n 'authorization',\n 'cookie',\n 'set-cookie',\n 'shopify-storefront-private-token',\n 'x-shopify-access-token',\n 'x-shopify-storefront-access-token',\n]);\n\nfunction sanitizeHeaderValue(name: string, value: unknown): unknown {\n return SENSITIVE_LOG_HEADERS.has(name.toLowerCase())\n ? REDACTED_LOG_VALUE\n : value;\n}\n\n// Keep the original serialized shape of request headers. A Headers instance\n// has no own enumerable properties, so it stays opaque here, the same as\n// JSON.stringify shows it.\nfunction sanitizeHeaders(headers: any): any {\n if (!headers || typeof headers !== 'object') {\n return headers;\n }\n\n if (Array.isArray(headers)) {\n return headers.map((header) =>\n Array.isArray(header)\n ? [header[0], sanitizeHeaderValue(header[0], header[1])]\n : header,\n );\n }\n\n return Object.fromEntries(\n Object.entries(headers).map(([name, value]) => [\n name,\n sanitizeHeaderValue(name, value),\n ]),\n );\n}\n\n// Response headers were always enumerated in the log, so keep that and\n// redact the credential values.\nfunction sanitizeEnumerableHeaders(headers: any): any {\n if (typeof headers?.entries === 'function' && !Array.isArray(headers)) {\n return Object.fromEntries(\n [...headers.entries()].map(([name, value]: [string, string]) => [\n name,\n sanitizeHeaderValue(name, value),\n ]),\n );\n }\n\n return sanitizeHeaders(headers);\n}\n\nfunction sanitizeRequestParams<T>(requestParams: T): T {\n if (Array.isArray(requestParams)) {\n return requestParams.map((param) =>\n param && typeof param === 'object' && 'headers' in param\n ? {...param, headers: sanitizeHeaders(param.headers)}\n : param,\n ) as T;\n }\n\n if (\n requestParams &&\n typeof requestParams === 'object' &&\n 'headers' in requestParams\n ) {\n return {\n ...requestParams,\n headers: sanitizeHeaders((requestParams as {headers: any}).headers),\n };\n }\n\n return requestParams;\n}\n\nfunction serializeResponse(response: Response | any) {\n if (!response) {\n return {error: 'No response object provided'};\n }\n\n try {\n const {status, statusText, ok, redirected, type, url, headers} = response;\n\n const serialized: any = {\n status,\n statusText,\n ok,\n redirected,\n type,\n url,\n };\n\n if (headers) {\n serialized.headers = sanitizeEnumerableHeaders(headers);\n }\n\n return serialized;\n } catch {\n return response;\n }\n}\n\nexport function clientLoggerFactory(config: ConfigInterface) {\n return (logContent: LogContent) => {\n if (config.logger.httpRequests) {\n switch (logContent.type) {\n case 'HTTP-Response': {\n const responseLog: HTTPResponseLog['content'] = logContent.content;\n logger(config).debug('Received response for HTTP request', {\n requestParams: JSON.stringify(\n sanitizeRequestParams(responseLog.requestParams),\n ),\n response: JSON.stringify(serializeResponse(responseLog.response)),\n });\n break;\n }\n case 'HTTP-Retry': {\n const responseLog: HTTPRetryLog['content'] = logContent.content;\n logger(config).debug('Retrying HTTP request', {\n requestParams: JSON.stringify(\n sanitizeRequestParams(responseLog.requestParams),\n ),\n retryAttempt: responseLog.retryAttempt,\n maxRetries: responseLog.maxRetries,\n response: responseLog.lastResponse\n ? JSON.stringify(serializeResponse(responseLog.lastResponse))\n : 'undefined',\n });\n break;\n }\n case 'HTTP-Response-GraphQL-Deprecation-Notice': {\n const responseLog: HTTPResponseGraphQLDeprecationNotice['content'] =\n logContent.content;\n logger(config).debug(\n 'Received response containing Deprecated GraphQL Notice',\n {\n requestParams: JSON.stringify(\n sanitizeRequestParams(responseLog.requestParams),\n ),\n deprecationNotice: responseLog.deprecationNotice,\n },\n );\n break;\n }\n default: {\n logger(config).debug(`HTTP request event: ${logContent.content}`);\n break;\n }\n }\n }\n };\n}\n\nexport function throwFailedRequest(\n body: any,\n atMaxRetries: boolean,\n response?: Response,\n): never {\n if (typeof response === 'undefined') {\n const message = body?.errors?.message ?? '';\n throw new ShopifyErrors.HttpRequestError(\n `Http request error, no response available: ${message}`,\n );\n }\n\n const responseHeaders = canonicalizeHeaders(\n Object.fromEntries(response.headers.entries() ?? []),\n );\n\n if (response.status === StatusCode.Ok && body.errors.graphQLErrors) {\n throw new ShopifyErrors.GraphqlQueryError({\n message:\n body.errors.graphQLErrors?.[0].message ?? 'GraphQL operation failed',\n response: response as Record<string, any>,\n headers: responseHeaders,\n body: body as Record<string, any>,\n });\n }\n\n const errorMessages: string[] = [];\n if (body.errors) {\n errorMessages.push(JSON.stringify(body.errors, null, 2));\n }\n const xRequestId = getHeader(responseHeaders, 'x-request-id');\n if (xRequestId) {\n errorMessages.push(\n `If you report this error, please include this id: ${xRequestId}`,\n );\n }\n\n const errorMessage = errorMessages.length\n ? `:\\n${errorMessages.join('\\n')}`\n : '';\n const code = response.status;\n const statusText = response.statusText;\n\n switch (true) {\n case response.status === StatusCode.TooManyRequests: {\n if (atMaxRetries) {\n throw new ShopifyErrors.HttpMaxRetriesError(\n 'Attempted the maximum number of retries for HTTP request.',\n );\n } else {\n const retryAfter = getHeader(responseHeaders, 'Retry-After');\n throw new ShopifyErrors.HttpThrottlingError({\n message: `Shopify is throttling requests ${errorMessage}`,\n code,\n statusText,\n body,\n headers: responseHeaders,\n retryAfter: retryAfter ? parseFloat(retryAfter) : undefined,\n });\n }\n }\n case response.status >= StatusCode.InternalServerError:\n if (atMaxRetries) {\n throw new ShopifyErrors.HttpMaxRetriesError(\n 'Attempted the maximum number of retries for HTTP request.',\n );\n } else {\n throw new ShopifyErrors.HttpInternalError({\n message: `Shopify internal error${errorMessage}`,\n code,\n statusText,\n body,\n headers: responseHeaders,\n });\n }\n default:\n throw new ShopifyErrors.HttpResponseError({\n message: `Received an error response (${response.status} ${response.statusText}) from Shopify${errorMessage}`,\n code,\n statusText,\n body,\n headers: responseHeaders,\n });\n }\n}\n"],"names":["ShopifyErrors.HttpRequestError","ShopifyErrors.GraphqlQueryError","ShopifyErrors.HttpMaxRetriesError","ShopifyErrors.HttpThrottlingError","ShopifyErrors.HttpInternalError","ShopifyErrors.HttpResponseError"],"mappings":";;;;;;;AAkBM,SAAU,YAAY,CAAC,MAAuB,EAAA;IAClD,IAAI,eAAe,GAAG,CAAA,EAAG,YAAY,CAAA,EAAA,EAAK,2BAA2B,CAAA,GAAA,EAAM,qBAAqB,EAAE,CAAA,CAAE;AACpG,IAAA,IAAI,MAAM,CAAC,eAAe,EAAE;QAC1B,eAAe,GAAG,GAAG,MAAM,CAAC,eAAe,CAA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zB,iBAAA,CAAC;YACJ;AACF,QAAA;AACE,YAAA,MAAM,IAAIC,iBAA+B,CAAC;gBACxC,OAAO,EAAE,CAAA,4BAAA,EAA+B,QAAQ,CAAC,MAAM,CAAA,CAAA,EAAI,QAAQ,CAAC,UAAU,CAAA,cAAA,EAAiB,YAAY,CAAA,CAAE;gBAC7G,IAAI;gBACJ,UAAU;gBACV,IAAI;AACJ,gBAAA,OAAO,EAAE,eAAe;AACzB,aAAA,CAAC;;AAER;;;;"}
@@ -42,7 +42,7 @@ function validateConfig(params) {
42
42
  }
43
43
  });
44
44
  if (missing.length) {
45
- throw new ShopifyError(`Cannot initialize Shopify API Library. Missing values for: ${missing.join(', ')}. For apiVersion, please specify an explicit API version (e.g., ApiVersion.July25). See https://shopify.dev/docs/api/usage/versioning for more information.`);
45
+ throw new ShopifyError(`Cannot initialize Shopify API Library. Missing values for: ${missing.join(', ')}. For apiVersion, please specify an explicit API version (e.g., ApiVersion.July26). See https://shopify.dev/docs/api/usage/versioning for more information.`);
46
46
  }
47
47
  const { hostScheme, isCustomStoreApp, adminApiAccessToken, userAgentPrefix, logger: logger$1, privateAppStorefrontAccessToken, billing, future, ...mandatoryParams } = params;
48
48
  let scopes;
@@ -62,7 +62,7 @@ function validateConfig(params) {
62
62
  isCustomStoreApp: isCustomStoreApp ?? config.isCustomStoreApp,
63
63
  adminApiAccessToken: adminApiAccessToken ?? config.adminApiAccessToken,
64
64
  userAgentPrefix: userAgentPrefix ?? config.userAgentPrefix,
65
- logger: { ...config.logger, ...(logger$1 || {}) },
65
+ logger: { ...config.logger, ...logger$1 },
66
66
  privateAppStorefrontAccessToken: privateAppStorefrontAccessToken ?? config.privateAppStorefrontAccessToken,
67
67
  billing: billing ?? config.billing,
68
68
  future: future ?? config.future,
@@ -1 +1 @@
1
- {"version":3,"file":"config.mjs","sources":["../../../../../lib/config.ts"],"sourcesContent":["import {ShopifyError} from './error';\nimport {ConfigInterface, ConfigParams} from './base-types';\nimport {LogSeverity} from './types';\nimport {AuthScopes} from './auth/scopes';\nimport {logger as createLogger} from './logger';\n\nexport function validateConfig<Params extends ConfigParams>(\n params: Params,\n): ConfigInterface<Params> {\n const config = {\n apiKey: '',\n apiSecretKey: '',\n hostName: '',\n hostScheme: 'https',\n isEmbeddedApp: true,\n isCustomStoreApp: false,\n logger: {\n log: defaultLogFunction,\n level: LogSeverity.Info,\n httpRequests: false,\n timestamps: false,\n },\n future: {},\n _logDisabledFutureFlags: true,\n } as ConfigInterface<Params>;\n\n // Make sure that the essential params actually have content in them\n const mandatory: (keyof Params)[] = [\n 'apiSecretKey',\n 'hostName',\n 'apiVersion',\n ];\n if (!('isCustomStoreApp' in params) || !params.isCustomStoreApp) {\n mandatory.push('apiKey');\n }\n if ('isCustomStoreApp' in params && params.isCustomStoreApp) {\n if (\n !('adminApiAccessToken' in params) ||\n params.adminApiAccessToken?.length === 0\n ) {\n mandatory.push('adminApiAccessToken');\n }\n }\n\n const missing: (keyof Params)[] = [];\n mandatory.forEach((key) => {\n if (!notEmpty(params[key])) {\n missing.push(key);\n }\n });\n\n if (missing.length) {\n throw new ShopifyError(\n `Cannot initialize Shopify API Library. Missing values for: ${missing.join(\n ', ',\n )}. For apiVersion, please specify an explicit API version (e.g., ApiVersion.July25). See https://shopify.dev/docs/api/usage/versioning for more information.`,\n );\n }\n\n const {\n hostScheme,\n isCustomStoreApp,\n adminApiAccessToken,\n userAgentPrefix,\n logger,\n privateAppStorefrontAccessToken,\n billing,\n future,\n ...mandatoryParams\n } = params;\n\n let scopes;\n if (params.scopes === undefined) {\n scopes = undefined;\n } else if (params.scopes instanceof AuthScopes) {\n scopes = params.scopes;\n } else {\n scopes = new AuthScopes(params.scopes);\n }\n\n Object.assign(config, mandatoryParams, {\n hostName: params.hostName.replace(/\\/$/, ''),\n scopes,\n hostScheme: hostScheme ?? config.hostScheme,\n isCustomStoreApp: isCustomStoreApp ?? config.isCustomStoreApp,\n adminApiAccessToken: adminApiAccessToken ?? config.adminApiAccessToken,\n userAgentPrefix: userAgentPrefix ?? config.userAgentPrefix,\n logger: {...config.logger, ...(logger || {})},\n privateAppStorefrontAccessToken:\n privateAppStorefrontAccessToken ?? config.privateAppStorefrontAccessToken,\n billing: billing ?? config.billing,\n future: future ?? config.future,\n });\n\n if (\n config.isCustomStoreApp &&\n params.adminApiAccessToken === params.apiSecretKey\n ) {\n createLogger(config).warning(\n \"adminApiAccessToken is set to the same value as apiSecretKey. adminApiAccessToken should be set to the Admin API access token for custom store apps; apiSecretKey should be set to the custom store app's API secret key.\",\n );\n }\n\n return config;\n}\n\nfunction notEmpty<T>(value: T): value is NonNullable<T> {\n if (value == null) {\n return false;\n }\n return typeof value === 'string' || Array.isArray(value)\n ? value.length > 0\n : true;\n}\n\nfunction defaultLogFunction(severity: LogSeverity, message: string): void {\n switch (severity) {\n case LogSeverity.Debug:\n console.debug(message);\n break;\n case LogSeverity.Info:\n console.log(message);\n break;\n case LogSeverity.Warning:\n console.warn(message);\n break;\n case LogSeverity.Error:\n console.error(message);\n break;\n }\n}\n"],"names":["logger","createLogger"],"mappings":";;;;;AAMM,SAAU,cAAc,CAC5B,MAAc,EAAA;AAEd,IAAA,MAAM,MAAM,GAAG;AACb,QAAA,MAAM,EAAE,EAAE;AACV,QAAA,YAAY,EAAE,EAAE;AAChB,QAAA,QAAQ,EAAE,EAAE;AACZ,QAAA,UAAU,EAAE,OAAO;AACnB,QAAA,aAAa,EAAE,IAAI;AACnB,QAAA,gBAAgB,EAAE,KAAK;AACvB,QAAA,MAAM,EAAE;AACN,YAAA,GAAG,EAAE,kBAAkB;YACvB,KAAK,EAAE,WAAW,CAAC,IAAI;AACvB,YAAA,YAAY,EAAE,KAAK;AACnB,YAAA,UAAU,EAAE,KAAK;AAClB,SAAA;AACD,QAAA,MAAM,EAAE,EAAE;AACV,QAAA,uBAAuB,EAAE,IAAI;KACH;;AAG5B,IAAA,MAAM,SAAS,GAAqB;QAClC,cAAc;QACd,UAAU;QACV,YAAY;KACb;AACD,IAAA,I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AK,WAAW,CAAC,IAAI;AACnB,YAAA,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC;YACpB;QACF,KAAK,WAAW,CAAC,OAAO;AACtB,YAAA,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC;YACrB;QACF,KAAK,WAAW,CAAC,KAAK;AACpB,YAAA,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC;YACtB;;AAEN;;;;"}
1
+ {"version":3,"file":"config.mjs","sources":["../../../../../lib/config.ts"],"sourcesContent":["import {ShopifyError} from './error';\nimport {ConfigInterface, ConfigParams} from './base-types';\nimport {LogSeverity} from './types';\nimport {AuthScopes} from './auth/scopes';\nimport {logger as createLogger} from './logger';\n\nexport function validateConfig<Params extends ConfigParams>(\n params: Params,\n): ConfigInterface<Params> {\n const config = {\n apiKey: '',\n apiSecretKey: '',\n hostName: '',\n hostScheme: 'https',\n isEmbeddedApp: true,\n isCustomStoreApp: false,\n logger: {\n log: defaultLogFunction,\n level: LogSeverity.Info,\n httpRequests: false,\n timestamps: false,\n },\n future: {},\n _logDisabledFutureFlags: true,\n } as ConfigInterface<Params>;\n\n // Make sure that the essential params actually have content in them\n const mandatory: (keyof Params)[] = [\n 'apiSecretKey',\n 'hostName',\n 'apiVersion',\n ];\n if (!('isCustomStoreApp' in params) || !params.isCustomStoreApp) {\n mandatory.push('apiKey');\n }\n if ('isCustomStoreApp' in params && params.isCustomStoreApp) {\n if (\n !('adminApiAccessToken' in params) ||\n params.adminApiAccessToken?.length === 0\n ) {\n mandatory.push('adminApiAccessToken');\n }\n }\n\n const missing: (keyof Params)[] = [];\n mandatory.forEach((key) => {\n if (!notEmpty(params[key])) {\n missing.push(key);\n }\n });\n\n if (missing.length) {\n throw new ShopifyError(\n `Cannot initialize Shopify API Library. Missing values for: ${missing.join(\n ', ',\n )}. For apiVersion, please specify an explicit API version (e.g., ApiVersion.July26). See https://shopify.dev/docs/api/usage/versioning for more information.`,\n );\n }\n\n const {\n hostScheme,\n isCustomStoreApp,\n adminApiAccessToken,\n userAgentPrefix,\n logger,\n privateAppStorefrontAccessToken,\n billing,\n future,\n ...mandatoryParams\n } = params;\n\n let scopes;\n if (params.scopes === undefined) {\n scopes = undefined;\n } else if (params.scopes instanceof AuthScopes) {\n scopes = params.scopes;\n } else {\n scopes = new AuthScopes(params.scopes);\n }\n\n Object.assign(config, mandatoryParams, {\n hostName: params.hostName.replace(/\\/$/, ''),\n scopes,\n hostScheme: hostScheme ?? config.hostScheme,\n isCustomStoreApp: isCustomStoreApp ?? config.isCustomStoreApp,\n adminApiAccessToken: adminApiAccessToken ?? config.adminApiAccessToken,\n userAgentPrefix: userAgentPrefix ?? config.userAgentPrefix,\n logger: {...config.logger, ...logger},\n privateAppStorefrontAccessToken:\n privateAppStorefrontAccessToken ?? config.privateAppStorefrontAccessToken,\n billing: billing ?? config.billing,\n future: future ?? config.future,\n });\n\n if (\n config.isCustomStoreApp &&\n params.adminApiAccessToken === params.apiSecretKey\n ) {\n createLogger(config).warning(\n \"adminApiAccessToken is set to the same value as apiSecretKey. adminApiAccessToken should be set to the Admin API access token for custom store apps; apiSecretKey should be set to the custom store app's API secret key.\",\n );\n }\n\n return config;\n}\n\nfunction notEmpty<T>(value: T): value is NonNullable<T> {\n if (value == null) {\n return false;\n }\n return typeof value === 'string' || Array.isArray(value)\n ? value.length > 0\n : true;\n}\n\nfunction defaultLogFunction(severity: LogSeverity, message: string): void {\n switch (severity) {\n case LogSeverity.Debug:\n console.debug(message);\n break;\n case LogSeverity.Info:\n console.log(message);\n break;\n case LogSeverity.Warning:\n console.warn(message);\n break;\n case LogSeverity.Error:\n console.error(message);\n break;\n }\n}\n"],"names":["logger","createLogger"],"mappings":";;;;;AAMM,SAAU,cAAc,CAC5B,MAAc,EAAA;AAEd,IAAA,MAAM,MAAM,GAAG;AACb,QAAA,MAAM,EAAE,EAAE;AACV,QAAA,YAAY,EAAE,EAAE;AAChB,QAAA,QAAQ,EAAE,EAAE;AACZ,QAAA,UAAU,EAAE,OAAO;AAC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A,IAAI,KAAK,IAAI,IAAI,EAAE;AACjB,QAAA,OAAO,KAAK;IACd;IACA,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK;AACrD,UAAE,KAAK,CAAC,MAAM,GAAG;UACf,IAAI;AACV;AAEA,SAAS,kBAAkB,CAAC,QAAqB,EAAE,OAAe,EAAA;IAChE,QAAQ,QAAQ;QACd,KAAK,WAAW,CAAC,KAAK;AACpB,YAAA,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC;YACtB;QACF,KAAK,WAAW,CAAC,IAAI;AACnB,YAAA,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC;YACpB;QACF,KAAK,WAAW,CAAC,OAAO;AACtB,YAAA,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC;YACrB;QACF,KAAK,WAAW,CAAC,KAAK;AACpB,YAAA,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC;YACtB;;AAEN;;;;"}
@@ -15,6 +15,7 @@ var ApiVersion;
15
15
  ApiVersion["January26"] = "2026-01";
16
16
  ApiVersion["April26"] = "2026-04";
17
17
  ApiVersion["July26"] = "2026-07";
18
+ ApiVersion["October26"] = "2026-10";
18
19
  ApiVersion["Unstable"] = "unstable";
19
20
  })(ApiVersion || (ApiVersion = {}));
20
21
  const LIBRARY_NAME = 'Shopify API Library';
@@ -26,7 +27,6 @@ var ShopifyHeader;
26
27
  ShopifyHeader["Domain"] = "X-Shopify-Shop-Domain";
27
28
  ShopifyHeader["Hmac"] = "X-Shopify-Hmac-Sha256";
28
29
  ShopifyHeader["Topic"] = "X-Shopify-Topic";
29
- ShopifyHeader["SubTopic"] = "X-Shopify-Sub-Topic";
30
30
  ShopifyHeader["WebhookId"] = "X-Shopify-Webhook-Id";
31
31
  ShopifyHeader["Name"] = "X-Shopify-Name";
32
32
  ShopifyHeader["TriggeredAt"] = "X-Shopify-Triggered-At";
@@ -1 +1 @@
1
- {"version":3,"file":"types.mjs","sources":["../../../../../lib/types.ts"],"sourcesContent":["export enum LogSeverity {\n Error,\n Warning,\n Info,\n Debug,\n}\n\nexport enum ApiVersion {\n October24 = '2024-10',\n January25 = '2025-01',\n April25 = '2025-04',\n July25 = '2025-07',\n October25 = '2025-10',\n January26 = '2026-01',\n April26 = '2026-04',\n July26 = '2026-07',\n Unstable = 'unstable',\n}\n\nexport const LIBRARY_NAME = 'Shopify API Library';\n\n/* eslint-disable @shopify/typescript-prefer-pascal-case-enums */\nexport enum ShopifyHeader {\n AccessToken = 'X-Shopify-Access-Token',\n ApiVersion = 'X-Shopify-API-Version',\n Domain = 'X-Shopify-Shop-Domain',\n Hmac = 'X-Shopify-Hmac-Sha256',\n Topic = 'X-Shopify-Topic',\n SubTopic = 'X-Shopify-Sub-Topic',\n WebhookId = 'X-Shopify-Webhook-Id',\n Name = 'X-Shopify-Name',\n TriggeredAt = 'X-Shopify-Triggered-At',\n EventId = 'X-Shopify-Event-Id',\n StorefrontPrivateToken = 'Shopify-Storefront-Private-Token',\n StorefrontSDKVariant = 'X-SDK-Variant',\n StorefrontSDKVersion = 'X-SDK-Version',\n}\n/* eslint-enable @shopify/typescript-prefer-pascal-case-enums */\n\nexport const ShopifyEventsHeader = {\n Hmac: 'shopify-hmac-sha256',\n Topic: 'shopify-topic',\n Domain: 'shopify-shop-domain',\n ApiVersion: 'shopify-api-version',\n EventId: 'shopify-event-id',\n WebhookId: 'shopify-webhook-id',\n Handle: 'shopify-handle',\n Action: 'shopify-action',\n ResourceId: 'shopify-resource-id',\n TriggeredAt: 'shopify-triggered-at',\n} as const;\n\nexport enum ClientType {\n Rest = 'rest',\n Graphql = 'graphql',\n}\n\nexport const privacyTopics: string[] = [\n 'CUSTOMERS_DATA_REQUEST',\n 'CUSTOMERS_REDACT',\n 'SHOP_REDACT',\n];\n\nexport enum BillingInterval {\n OneTime = 'ONE_TIME',\n Every30Days = 'EVERY_30_DAYS',\n Annual = 'ANNUAL',\n Usage = 'USAGE',\n}\n\nexport type RecurringBillingIntervals = Exclude<\n BillingInterval,\n BillingInterval.OneTime\n>;\n\nexport enum BillingReplacementBehavior {\n ApplyImmediately = 'APPLY_IMMEDIATELY',\n ApplyOnNextBillingCycle = 'APPLY_ON_NEXT_BILLING_CYCLE',\n Standard = 'STANDARD',\n}\n\nexport enum StatusCode {\n Continue = 100,\n SwitchingProtocols = 101,\n Ok = 200,\n Created = 201,\n Accepted = 202,\n NonAuthoritativeInformation = 203,\n NoContent = 204,\n ResetContent = 205,\n PartialContent = 206,\n MultipleChoices = 300,\n MovedPermanently = 301,\n Found = 302,\n SeeOther = 303,\n NotModified = 304,\n UseProxy = 305,\n TemporaryRedirect = 307,\n BadRequest = 400,\n Unauthorized = 401,\n PaymentRequired = 402,\n Forbidden = 403,\n NotFound = 404,\n MethodNotAllowed = 405,\n NotAcceptable = 406,\n ProxyAuthenticationRequired = 407,\n RequestTimeout = 408,\n Conflict = 409,\n Gone = 410,\n LengthRequired = 411,\n PreconditionFailed = 412,\n RequestEntityTooLarge = 413,\n RequestUriTooLong = 414,\n UnsupportedMediaType = 415,\n RequestedRangeNotSatisfiable = 416,\n ExpectationFailed = 417,\n ImATeapot = 418,\n UnprocessableEntity = 422,\n TooManyRequests = 429,\n InternalServerError = 500,\n NotImplemented = 501,\n BadGateway = 502,\n ServiceUnavailable = 503,\n GatewayTimeout = 504,\n HttpVersionNotSupported = 505,\n}\n\nexport enum Method {\n Get = 'GET',\n Post = 'POST',\n Put = 'PUT',\n Patch = 'PATCH',\n Delete = 'DELETE',\n Head = 'HEAD',\n Options = 'OPTIONS',\n Connect = 'CONNECT',\n}\n\n/**\n * Configuration for transforming shop domains in split-domain architectures.\n *\n * @example\n * // Template-based transformation\n * {\n * match: /^([a-zA-Z0-9][a-zA-Z0-9-_]*)\\.my\\.shop\\.dev$/,\n * transform: '$1.dev-api.shop.dev'\n * }\n *\n * @example\n * // Function-based transformation\n * {\n * match: /^([^.]+)\\.ui\\.example\\.com$/,\n * transform: (matches) => `${matches[1]}.api.example.com`\n * }\n */\nexport interface DomainTransformation {\n /**\n * Pattern to match against shop domains (source domain).\n * Can be a RegExp or string (converted to RegExp internally).\n */\n match: RegExp | string;\n\n /**\n * Transformation function or template string.\n * - Template string: Uses $1, $2, etc. for capture group substitution\n * - Function: Receives regex match groups and returns transformed domain\n */\n transform: ((matches: RegExpMatchArray) => string | null) | string;\n\n /**\n * Whether this transformation should also apply to host validation.\n * @default true\n */\n includeHost?: boolean;\n}\n"],"names":[],"mappings":"IAAY;AAAZ,CAAA,UAAY,WAAW,EAAA;AACrB,IAAA,WAAA,CAAA,WAAA,CAAA,OAAA,CAAA,GAAA,CAAA,CAAA,GAAA,OAAK;AACL,IAAA,WAAA,CAAA,WAAA,CAAA,SAAA,CAAA,GAAA,CAAA,CAAA,GAAA,SAAO;AACP,IAAA,WAAA,CAAA,WAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAI;AACJ,IAAA,WAAA,CAAA,WAAA,CAAA,OAAA,CAAA,GAAA,CAAA,CAAA,GAAA,OAAK;AACP,CAAC,EALW,WAAW,KAAX,WAAW,GAAA,EAAA,CAAA,CAAA;IAOX;AAAZ,CAAA,UAAY,UAAU,EAAA;AACpB,IAAA,UAAA,CAAA,WAAA,CAAA,GAAA,SAAqB;AACrB,IAAA,UAAA,CAAA,WAAA,CAAA,GAAA,SAAqB;AACrB,IAAA,UAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,UAAA,CAAA,QAAA,CAAA,GAAA,SAAkB;AAClB,IAAA,UAAA,CAAA,WAAA,CAAA,GAAA,SAAqB;AACrB,IAAA,UAAA,CAAA,WAAA,CAAA,GAAA,SAAqB;AACrB,IAAA,UAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,UAAA,CAAA,QAAA,CAAA,GAAA,SAAkB;AAClB,IAAA,UAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACvB,CAAC,EAVW,UAAU,KAAV,UAAU,GAAA,EAAA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,iBAAA,CAAA,GAAA,GAAA,CAAA,GAAA,iBAAqB;AACrB,IAAA,UAAA,CAAA,UAAA,CAAA,qBAAA,CAAA,GAAA,GAAA,CAAA,GAAA,qBAAyB;AACzB,IAAA,UAAA,CAAA,UAAA,CAAA,gBAAA,CAAA,GAAA,GAAA,CAAA,GAAA,gBAAoB;AACpB,IAAA,UAAA,CAAA,UAAA,CAAA,YAAA,CAAA,GAAA,GAAA,CAAA,GAAA,YAAgB;AAChB,IAAA,UAAA,CAAA,UAAA,CAAA,oBAAA,CAAA,GAAA,GAAA,CAAA,GAAA,oBAAwB;AACxB,IAAA,UAAA,CAAA,UAAA,CAAA,gBAAA,CAAA,GAAA,GAAA,CAAA,GAAA,gBAAoB;AACpB,IAAA,UAAA,CAAA,UAAA,CAAA,yBAAA,CAAA,GAAA,GAAA,CAAA,GAAA,yBAA6B;AAC/B,CAAC,EA5CW,UAAU,KAAV,UAAU,GAAA,EAAA,CAAA,CAAA;IA8CV;AAAZ,CAAA,UAAY,MAAM,EAAA;AAChB,IAAA,MAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,MAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,MAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,MAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACf,IAAA,MAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACjB,IAAA,MAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,MAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,MAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACrB,CAAC,EATW,MAAM,KAAN,MAAM,GAAA,EAAA,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"types.mjs","sources":["../../../../../lib/types.ts"],"sourcesContent":["export enum LogSeverity {\n Error,\n Warning,\n Info,\n Debug,\n}\n\nexport enum ApiVersion {\n October24 = '2024-10',\n January25 = '2025-01',\n April25 = '2025-04',\n July25 = '2025-07',\n October25 = '2025-10',\n January26 = '2026-01',\n April26 = '2026-04',\n July26 = '2026-07',\n October26 = '2026-10',\n Unstable = 'unstable',\n}\n\nexport const LIBRARY_NAME = 'Shopify API Library';\n\n/* eslint-disable @shopify/typescript-prefer-pascal-case-enums */\nexport enum ShopifyHeader {\n AccessToken = 'X-Shopify-Access-Token',\n ApiVersion = 'X-Shopify-API-Version',\n Domain = 'X-Shopify-Shop-Domain',\n Hmac = 'X-Shopify-Hmac-Sha256',\n Topic = 'X-Shopify-Topic',\n WebhookId = 'X-Shopify-Webhook-Id',\n Name = 'X-Shopify-Name',\n TriggeredAt = 'X-Shopify-Triggered-At',\n EventId = 'X-Shopify-Event-Id',\n StorefrontPrivateToken = 'Shopify-Storefront-Private-Token',\n StorefrontSDKVariant = 'X-SDK-Variant',\n StorefrontSDKVersion = 'X-SDK-Version',\n}\n/* eslint-enable @shopify/typescript-prefer-pascal-case-enums */\n\nexport const ShopifyEventsHeader = {\n Hmac: 'shopify-hmac-sha256',\n Topic: 'shopify-topic',\n Domain: 'shopify-shop-domain',\n ApiVersion: 'shopify-api-version',\n EventId: 'shopify-event-id',\n WebhookId: 'shopify-webhook-id',\n Handle: 'shopify-handle',\n Action: 'shopify-action',\n ResourceId: 'shopify-resource-id',\n TriggeredAt: 'shopify-triggered-at',\n} as const;\n\nexport enum ClientType {\n Rest = 'rest',\n Graphql = 'graphql',\n}\n\nexport const privacyTopics: string[] = [\n 'CUSTOMERS_DATA_REQUEST',\n 'CUSTOMERS_REDACT',\n 'SHOP_REDACT',\n];\n\nexport enum BillingInterval {\n OneTime = 'ONE_TIME',\n Every30Days = 'EVERY_30_DAYS',\n Annual = 'ANNUAL',\n Usage = 'USAGE',\n}\n\nexport type RecurringBillingIntervals = Exclude<\n BillingInterval,\n BillingInterval.OneTime\n>;\n\nexport enum BillingReplacementBehavior {\n ApplyImmediately = 'APPLY_IMMEDIATELY',\n ApplyOnNextBillingCycle = 'APPLY_ON_NEXT_BILLING_CYCLE',\n Standard = 'STANDARD',\n}\n\nexport enum StatusCode {\n Continue = 100,\n SwitchingProtocols = 101,\n Ok = 200,\n Created = 201,\n Accepted = 202,\n NonAuthoritativeInformation = 203,\n NoContent = 204,\n ResetContent = 205,\n PartialContent = 206,\n MultipleChoices = 300,\n MovedPermanently = 301,\n Found = 302,\n SeeOther = 303,\n NotModified = 304,\n UseProxy = 305,\n TemporaryRedirect = 307,\n BadRequest = 400,\n Unauthorized = 401,\n PaymentRequired = 402,\n Forbidden = 403,\n NotFound = 404,\n MethodNotAllowed = 405,\n NotAcceptable = 406,\n ProxyAuthenticationRequired = 407,\n RequestTimeout = 408,\n Conflict = 409,\n Gone = 410,\n LengthRequired = 411,\n PreconditionFailed = 412,\n RequestEntityTooLarge = 413,\n RequestUriTooLong = 414,\n UnsupportedMediaType = 415,\n RequestedRangeNotSatisfiable = 416,\n ExpectationFailed = 417,\n ImATeapot = 418,\n UnprocessableEntity = 422,\n TooManyRequests = 429,\n InternalServerError = 500,\n NotImplemented = 501,\n BadGateway = 502,\n ServiceUnavailable = 503,\n GatewayTimeout = 504,\n HttpVersionNotSupported = 505,\n}\n\nexport enum Method {\n Get = 'GET',\n Post = 'POST',\n Put = 'PUT',\n Patch = 'PATCH',\n Delete = 'DELETE',\n Head = 'HEAD',\n Options = 'OPTIONS',\n Connect = 'CONNECT',\n}\n\n/**\n * Configuration for transforming shop domains in split-domain architectures.\n *\n * @example\n * // Template-based transformation\n * {\n * match: /^([a-zA-Z0-9][a-zA-Z0-9-_]*)\\.my\\.shop\\.dev$/,\n * transform: '$1.dev-api.shop.dev'\n * }\n *\n * @example\n * // Function-based transformation\n * {\n * match: /^([^.]+)\\.ui\\.example\\.com$/,\n * transform: (matches) => `${matches[1]}.api.example.com`\n * }\n */\nexport interface DomainTransformation {\n /**\n * Pattern to match against shop domains (source domain).\n * Can be a RegExp or string (converted to RegExp internally).\n */\n match: RegExp | string;\n\n /**\n * Transformation function or template string.\n * - Template string: Uses $1, $2, etc. for capture group substitution\n * - Function: Receives regex match groups and returns transformed domain\n */\n transform: ((matches: RegExpMatchArray) => string | null) | string;\n\n /**\n * Whether this transformation should also apply to host validation.\n * @default true\n */\n includeHost?: boolean;\n}\n"],"names":[],"mappings":"IAAY;AAAZ,CAAA,UAAY,WAAW,EAAA;AACrB,IAAA,WAAA,CAAA,WAAA,CAAA,OAAA,CAAA,GAAA,CAAA,CAAA,GAAA,OAAK;AACL,IAAA,WAAA,CAAA,WAAA,CAAA,SAAA,CAAA,GAAA,CAAA,CAAA,GAAA,SAAO;AACP,IAAA,WAAA,CAAA,WAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAI;AACJ,IAAA,WAAA,CAAA,WAAA,CAAA,OAAA,CAAA,GAAA,CAAA,CAAA,GAAA,OAAK;AACP,CAAC,EALW,WAAW,KAAX,WAAW,GAAA,EAAA,CAAA,CAAA;IAOX;AAAZ,CAAA,UAAY,UAAU,EAAA;AACpB,IAAA,UAAA,CAAA,WAAA,CAAA,GAAA,SAAqB;AACrB,IAAA,UAAA,CAAA,WAAA,CAAA,GAAA,SAAqB;AACrB,IAAA,UAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,UAAA,CAAA,QAAA,CAAA,GAAA,SAAkB;AAClB,IAAA,UAAA,CAAA,WAAA,CAAA,GAAA,SAAqB;AACrB,IAAA,UAAA,CAAA,WAAA,CAAA,GAAA,SAAqB;AACrB,IAAA,UAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,UAAA,CAAA,QAAA,CAAA,GAAA,SAAkB;AAClB,IAAA,UAAA,CAAA,WAAA,CAAA,GAAA,SAAqB;AACrB,IAAA,UAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACvB,CAAC,EAXW,UAAU,KAAV,UAAU,GAAA,EAAA,CAAA,CAAA;AAaf,MAAM,YAAY,GAAG;AAE5B;IACY;AAAZ,CAAA,UAAY,aAAa,EAAA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ACzB,IAAA,UAAA,CAAA,UAAA,CAAA,gBAAA,CAAA,GAAA,GAAA,CAAA,GAAA,gBAAoB;AACpB,IAAA,UAAA,CAAA,UAAA,CAAA,YAAA,CAAA,GAAA,GAAA,CAAA,GAAA,YAAgB;AAChB,IAAA,UAAA,CAAA,UAAA,CAAA,oBAAA,CAAA,GAAA,GAAA,CAAA,GAAA,oBAAwB;AACxB,IAAA,UAAA,CAAA,UAAA,CAAA,gBAAA,CAAA,GAAA,GAAA,CAAA,GAAA,gBAAoB;AACpB,IAAA,UAAA,CAAA,UAAA,CAAA,yBAAA,CAAA,GAAA,GAAA,CAAA,GAAA,yBAA6B;AAC/B,CAAC,EA5CW,UAAU,KAAV,UAAU,GAAA,EAAA,CAAA,CAAA;IA8CV;AAAZ,CAAA,UAAY,MAAM,EAAA;AAChB,IAAA,MAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,MAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,MAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,MAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACf,IAAA,MAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACjB,IAAA,MAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,MAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,MAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACrB,CAAC,EATW,MAAM,KAAN,MAAM,GAAA,EAAA,CAAA,CAAA;;;;"}
@@ -2,6 +2,17 @@ import { logger } from '../logger/index.mjs';
2
2
  import { LogSeverity } from '../types.mjs';
3
3
  import { abstractFetch } from '../../runtime/http/index.mjs';
4
4
 
5
+ const OAUTH_TOKEN_ENDPOINT_PATH = '/admin/oauth/access_token';
6
+ // Token endpoint bodies carry OAuth secrets, so they must not reach the logs.
7
+ // When the URL does not parse, fail closed and keep the body out of the logs.
8
+ function canLogRequestBody(url) {
9
+ try {
10
+ return new URL(url).pathname !== OAUTH_TOKEN_ENDPOINT_PATH;
11
+ }
12
+ catch {
13
+ return false;
14
+ }
15
+ }
5
16
  function fetchRequestFactory(config) {
6
17
  return async function fetchRequest(url, options) {
7
18
  const log = logger(config);
@@ -10,7 +21,7 @@ function fetchRequestFactory(config) {
10
21
  log.debug('Making HTTP request', {
11
22
  method: options?.method || 'GET',
12
23
  url,
13
- ...(options?.body && { body: options?.body }),
24
+ ...(options?.body && canLogRequestBody(url) && { body: options.body }),
14
25
  });
15
26
  }
16
27
  const response = await abstractFetch(url, options);
@@ -1 +1 @@
1
- {"version":3,"file":"fetch-request.mjs","sources":["../../../../../../lib/utils/fetch-request.ts"],"sourcesContent":["import {logger} from '../logger';\nimport {LogSeverity} from '../types';\nimport {abstractFetch} from '../../runtime';\nimport {ConfigInterface} from '../base-types';\n\nexport function fetchRequestFactory(config: ConfigInterface) {\n return async function fetchRequest(\n url: string,\n options?: RequestInit,\n ): Promise<Response> {\n const log = logger(config);\n const doLog =\n config.logger.httpRequests && config.logger.level === LogSeverity.Debug;\n\n if (doLog) {\n log.debug('Making HTTP request', {\n method: options?.method || 'GET',\n url,\n ...(options?.body && {body: options?.body}),\n });\n }\n\n const response = await abstractFetch(url, options);\n\n if (doLog) {\n log.debug('HTTP request completed', {\n method: options?.method || 'GET',\n url,\n status: response.status,\n });\n }\n\n return response;\n };\n}\n"],"names":[],"mappings":";;;;AAKM,SAAU,mBAAmB,CAAC,MAAuB,EAAA;AACzD,IAAA,OAAO,eAAe,YAAY,CAChC,GAAW,EACX,OAAqB,EAAA;AAErB,QAAA,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC;AAC1B,QAAA,MAAM,KAAK,GACT,MAAM,CAAC,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,KAAK,WAAW,CAAC,KAAK;QAEzE,IAAI,KAAK,EAAE;AACT,YAAA,GAAG,CAAC,KAAK,CAAC,qBAAqB,EAAE;AAC/B,gBAAA,MAAM,EAAE,OAAO,EAAE,MAAM,IAAI,KAAK;gBAChC,GAAG;AACH,gBAAA,IAAI,OAAO,EAAE,IAAI,IAAI,EAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;AAC5C,aAAA,CAAC;QACJ;QAEA,MAAM,QAAQ,GAAG,MAAM,aAAa,CAAC,GAAG,EAAE,OAAO,CAAC;QAElD,IAAI,KAAK,EAAE;AACT,YAAA,GAAG,CAAC,KAAK,CAAC,wBAAwB,EAAE;AAClC,gBAAA,MAAM,EAAE,OAAO,EAAE,MAAM,IAAI,KAAK;gBAChC,GAAG;gBACH,MAAM,EAAE,QAAQ,CAAC,MAAM;AACxB,aAAA,CAAC;QACJ;AAEA,QAAA,OAAO,QAAQ;AACjB,IAAA,CAAC;AACH;;;;"}
1
+ {"version":3,"file":"fetch-request.mjs","sources":["../../../../../../lib/utils/fetch-request.ts"],"sourcesContent":["import {logger} from '../logger';\nimport {LogSeverity} from '../types';\nimport {abstractFetch} from '../../runtime';\nimport {ConfigInterface} from '../base-types';\n\nconst OAUTH_TOKEN_ENDPOINT_PATH = '/admin/oauth/access_token';\n\n// Token endpoint bodies carry OAuth secrets, so they must not reach the logs.\n// When the URL does not parse, fail closed and keep the body out of the logs.\nfunction canLogRequestBody(url: string): boolean {\n try {\n return new URL(url).pathname !== OAUTH_TOKEN_ENDPOINT_PATH;\n } catch {\n return false;\n }\n}\n\nexport function fetchRequestFactory(config: ConfigInterface) {\n return async function fetchRequest(\n url: string,\n options?: RequestInit,\n ): Promise<Response> {\n const log = logger(config);\n const doLog =\n config.logger.httpRequests && config.logger.level === LogSeverity.Debug;\n\n if (doLog) {\n log.debug('Making HTTP request', {\n method: options?.method || 'GET',\n url,\n ...(options?.body && canLogRequestBody(url) && {body: options.body}),\n });\n }\n\n const response = await abstractFetch(url, options);\n\n if (doLog) {\n log.debug('HTTP request completed', {\n method: options?.method || 'GET',\n url,\n status: response.status,\n });\n }\n\n return response;\n };\n}\n"],"names":[],"mappings":";;;;AAKA,MAAM,yBAAyB,GAAG,2BAA2B;AAE7D;AACA;AACA,SAAS,iBAAiB,CAAC,GAAW,EAAA;AACpC,IAAA,IAAI;QACF,OAAO,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,KAAK,yBAAyB;IAC5D;AAAE,IAAA,MAAM;AACN,QAAA,OAAO,KAAK;IACd;AACF;AAEM,SAAU,mBAAmB,CAAC,MAAuB,EAAA;AACzD,IAAA,OAAO,eAAe,YAAY,CAChC,GAAW,EACX,OAAqB,EAAA;AAErB,QAAA,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC;AAC1B,QAAA,MAAM,KAAK,GACT,MAAM,CAAC,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,KAAK,WAAW,CAAC,KAAK;QAEzE,IAAI,KAAK,EAAE;AACT,YAAA,GAAG,CAAC,KAAK,CAAC,qBAAqB,EAAE;AAC/B,gBAAA,MAAM,EAAE,OAAO,EAAE,MAAM,IAAI,KAAK;gBAChC,GAAG;AACH,gBAAA,IAAI,OAAO,EAAE,IAAI,IAAI,iBAAiB,CAAC,GAAG,CAAC,IAAI,EAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAC,CAAC;AACrE,aAAA,CAAC;QACJ;QAEA,MAAM,QAAQ,GAAG,MAAM,aAAa,CAAC,GAAG,EAAE,OAAO,CAAC;QAElD,IAAI,KAAK,EAAE;AACT,YAAA,GAAG,CAAC,KAAK,CAAC,wBAAwB,EAAE;AAClC,gBAAA,MAAM,EAAE,OAAO,EAAE,MAAM,IAAI,KAAK;gBAChC,GAAG;gBACH,MAAM,EAAE,QAAQ,CAAC,MAAM;AACxB,aAAA,CAAC;QACJ;AAEA,QAAA,OAAO,QAAQ;AACjB,IAAA,CAAC;AACH;;;;"}