@shopify/shopify-api 3.1.3 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (355) hide show
  1. package/CHANGELOG.md +78 -53
  2. package/dist/auth/session/session_storage.d.ts +12 -0
  3. package/dist/auth/session/session_storage.d.ts.map +1 -1
  4. package/dist/auth/session/storage/__tests__/battery-of-tests.d.ts.map +1 -1
  5. package/dist/auth/session/storage/__tests__/battery-of-tests.js +124 -0
  6. package/dist/auth/session/storage/__tests__/session-test-utils.d.ts +3 -0
  7. package/dist/auth/session/storage/__tests__/session-test-utils.d.ts.map +1 -0
  8. package/dist/auth/session/storage/__tests__/session-test-utils.js +46 -0
  9. package/dist/auth/session/storage/custom.d.ts +5 -1
  10. package/dist/auth/session/storage/custom.d.ts.map +1 -1
  11. package/dist/auth/session/storage/custom.js +56 -1
  12. package/dist/auth/session/storage/memory.d.ts +2 -0
  13. package/dist/auth/session/storage/memory.d.ts.map +1 -1
  14. package/dist/auth/session/storage/memory.js +18 -0
  15. package/dist/auth/session/storage/mongodb.d.ts +2 -0
  16. package/dist/auth/session/storage/mongodb.d.ts.map +1 -1
  17. package/dist/auth/session/storage/mongodb.js +39 -6
  18. package/dist/auth/session/storage/mysql.d.ts +2 -0
  19. package/dist/auth/session/storage/mysql.d.ts.map +1 -1
  20. package/dist/auth/session/storage/mysql.js +39 -0
  21. package/dist/auth/session/storage/postgresql.d.ts +2 -0
  22. package/dist/auth/session/storage/postgresql.d.ts.map +1 -1
  23. package/dist/auth/session/storage/postgresql.js +43 -4
  24. package/dist/auth/session/storage/redis.d.ts +2 -0
  25. package/dist/auth/session/storage/redis.d.ts.map +1 -1
  26. package/dist/auth/session/storage/redis.js +65 -0
  27. package/dist/auth/session/storage/sqlite.d.ts +2 -0
  28. package/dist/auth/session/storage/sqlite.d.ts.map +1 -1
  29. package/dist/auth/session/storage/sqlite.js +39 -0
  30. package/dist/base-types.d.ts +2 -1
  31. package/dist/base-types.d.ts.map +1 -1
  32. package/dist/base-types.js +3 -2
  33. package/dist/clients/http_client/http_client.d.ts.map +1 -1
  34. package/dist/clients/http_client/http_client.js +4 -0
  35. package/dist/error.d.ts +2 -0
  36. package/dist/error.d.ts.map +1 -1
  37. package/dist/error.js +9 -1
  38. package/dist/index.d.ts +1 -0
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/rest-resources/{2021-07 → 2022-07}/abandoned_checkout.d.ts +3 -0
  41. package/dist/rest-resources/2022-07/abandoned_checkout.d.ts.map +1 -0
  42. package/dist/rest-resources/{2021-07 → 2022-07}/abandoned_checkout.js +4 -1
  43. package/dist/rest-resources/{2021-07 → 2022-07}/access_scope.d.ts +3 -0
  44. package/dist/rest-resources/2022-07/access_scope.d.ts.map +1 -0
  45. package/dist/rest-resources/{2021-07 → 2022-07}/access_scope.js +4 -1
  46. package/dist/rest-resources/{2021-07 → 2022-07}/android_pay_key.d.ts +3 -0
  47. package/dist/rest-resources/2022-07/android_pay_key.d.ts.map +1 -0
  48. package/dist/rest-resources/{2021-07 → 2022-07}/android_pay_key.js +4 -1
  49. package/dist/rest-resources/{2021-07 → 2022-07}/apple_pay_certificate.d.ts +3 -0
  50. package/dist/rest-resources/2022-07/apple_pay_certificate.d.ts.map +1 -0
  51. package/dist/rest-resources/{2021-07 → 2022-07}/apple_pay_certificate.js +4 -1
  52. package/dist/rest-resources/{2021-07 → 2022-07}/application_charge.d.ts +3 -0
  53. package/dist/rest-resources/2022-07/application_charge.d.ts.map +1 -0
  54. package/dist/rest-resources/{2021-07 → 2022-07}/application_charge.js +4 -1
  55. package/dist/rest-resources/{2021-07 → 2022-07}/application_credit.d.ts +3 -0
  56. package/dist/rest-resources/2022-07/application_credit.d.ts.map +1 -0
  57. package/dist/rest-resources/{2021-07 → 2022-07}/application_credit.js +4 -1
  58. package/dist/rest-resources/{2021-07 → 2022-07}/article.d.ts +3 -0
  59. package/dist/rest-resources/2022-07/article.d.ts.map +1 -0
  60. package/dist/rest-resources/{2021-07 → 2022-07}/article.js +4 -1
  61. package/dist/rest-resources/{2021-07 → 2022-07}/asset.d.ts +3 -0
  62. package/dist/rest-resources/2022-07/asset.d.ts.map +1 -0
  63. package/dist/rest-resources/{2021-07 → 2022-07}/asset.js +4 -1
  64. package/dist/rest-resources/{2021-07 → 2022-07}/assigned_fulfillment_order.d.ts +3 -0
  65. package/dist/rest-resources/2022-07/assigned_fulfillment_order.d.ts.map +1 -0
  66. package/dist/rest-resources/{2021-07 → 2022-07}/assigned_fulfillment_order.js +4 -1
  67. package/dist/rest-resources/{2021-07 → 2022-07}/balance.d.ts +3 -0
  68. package/dist/rest-resources/2022-07/balance.d.ts.map +1 -0
  69. package/dist/rest-resources/{2021-07 → 2022-07}/balance.js +4 -1
  70. package/dist/rest-resources/{2021-07 → 2022-07}/blog.d.ts +3 -0
  71. package/dist/rest-resources/2022-07/blog.d.ts.map +1 -0
  72. package/dist/rest-resources/{2021-07 → 2022-07}/blog.js +4 -1
  73. package/dist/rest-resources/{2021-07 → 2022-07}/cancellation_request.d.ts +3 -0
  74. package/dist/rest-resources/2022-07/cancellation_request.d.ts.map +1 -0
  75. package/dist/rest-resources/{2021-07 → 2022-07}/cancellation_request.js +4 -1
  76. package/dist/rest-resources/{2021-07 → 2022-07}/carrier_service.d.ts +3 -1
  77. package/dist/rest-resources/2022-07/carrier_service.d.ts.map +1 -0
  78. package/dist/rest-resources/{2021-07 → 2022-07}/carrier_service.js +4 -1
  79. package/dist/rest-resources/{2021-07 → 2022-07}/checkout.d.ts +3 -0
  80. package/dist/rest-resources/2022-07/checkout.d.ts.map +1 -0
  81. package/dist/rest-resources/{2021-07 → 2022-07}/checkout.js +4 -1
  82. package/dist/rest-resources/{2021-07 → 2022-07}/collect.d.ts +3 -0
  83. package/dist/rest-resources/2022-07/collect.d.ts.map +1 -0
  84. package/dist/rest-resources/{2021-07 → 2022-07}/collect.js +4 -1
  85. package/dist/rest-resources/{2021-07 → 2022-07}/collection.d.ts +3 -0
  86. package/dist/rest-resources/2022-07/collection.d.ts.map +1 -0
  87. package/dist/rest-resources/{2021-07 → 2022-07}/collection.js +4 -1
  88. package/dist/rest-resources/{2021-07 → 2022-07}/collection_listing.d.ts +3 -0
  89. package/dist/rest-resources/2022-07/collection_listing.d.ts.map +1 -0
  90. package/dist/rest-resources/{2021-07 → 2022-07}/collection_listing.js +4 -1
  91. package/dist/rest-resources/{2021-07 → 2022-07}/comment.d.ts +3 -0
  92. package/dist/rest-resources/2022-07/comment.d.ts.map +1 -0
  93. package/dist/rest-resources/{2021-07 → 2022-07}/comment.js +4 -1
  94. package/dist/rest-resources/{2021-07 → 2022-07}/country.d.ts +3 -0
  95. package/dist/rest-resources/2022-07/country.d.ts.map +1 -0
  96. package/dist/rest-resources/{2021-07 → 2022-07}/country.js +4 -1
  97. package/dist/rest-resources/{2021-07 → 2022-07}/currency.d.ts +3 -0
  98. package/dist/rest-resources/2022-07/currency.d.ts.map +1 -0
  99. package/dist/rest-resources/{2021-07 → 2022-07}/currency.js +4 -1
  100. package/dist/rest-resources/{2021-07 → 2022-07}/custom_collection.d.ts +3 -0
  101. package/dist/rest-resources/2022-07/custom_collection.d.ts.map +1 -0
  102. package/dist/rest-resources/{2021-07 → 2022-07}/custom_collection.js +4 -1
  103. package/dist/rest-resources/{2021-07 → 2022-07}/customer.d.ts +11 -0
  104. package/dist/rest-resources/2022-07/customer.d.ts.map +1 -0
  105. package/dist/rest-resources/{2021-07 → 2022-07}/customer.js +4 -1
  106. package/dist/rest-resources/{2021-07 → 2022-07}/customer_address.d.ts +3 -0
  107. package/dist/rest-resources/2022-07/customer_address.d.ts.map +1 -0
  108. package/dist/rest-resources/{2021-07 → 2022-07}/customer_address.js +4 -1
  109. package/dist/rest-resources/{2021-07 → 2022-07}/customer_saved_search.d.ts +3 -0
  110. package/dist/rest-resources/2022-07/customer_saved_search.d.ts.map +1 -0
  111. package/dist/rest-resources/{2021-07 → 2022-07}/customer_saved_search.js +4 -1
  112. package/dist/rest-resources/{2021-07 → 2022-07}/deprecated_api_call.d.ts +3 -0
  113. package/dist/rest-resources/2022-07/deprecated_api_call.d.ts.map +1 -0
  114. package/dist/rest-resources/{2021-07 → 2022-07}/deprecated_api_call.js +4 -1
  115. package/dist/rest-resources/{2021-07 → 2022-07}/discount_code.d.ts +3 -0
  116. package/dist/rest-resources/2022-07/discount_code.d.ts.map +1 -0
  117. package/dist/rest-resources/{2021-07 → 2022-07}/discount_code.js +4 -1
  118. package/dist/rest-resources/{2021-07 → 2022-07}/dispute.d.ts +3 -0
  119. package/dist/rest-resources/2022-07/dispute.d.ts.map +1 -0
  120. package/dist/rest-resources/{2021-07 → 2022-07}/dispute.js +4 -1
  121. package/dist/rest-resources/2022-07/dispute_evidence.d.ts +56 -0
  122. package/dist/rest-resources/2022-07/dispute_evidence.d.ts.map +1 -0
  123. package/dist/rest-resources/2022-07/dispute_evidence.js +48 -0
  124. package/dist/rest-resources/2022-07/dispute_file_upload.d.ts +35 -0
  125. package/dist/rest-resources/2022-07/dispute_file_upload.d.ts.map +1 -0
  126. package/dist/rest-resources/2022-07/dispute_file_upload.js +46 -0
  127. package/dist/rest-resources/{2021-07 → 2022-07}/draft_order.d.ts +8 -1
  128. package/dist/rest-resources/2022-07/draft_order.d.ts.map +1 -0
  129. package/dist/rest-resources/{2021-07 → 2022-07}/draft_order.js +9 -6
  130. package/dist/rest-resources/{2021-07 → 2022-07}/event.d.ts +3 -0
  131. package/dist/rest-resources/2022-07/event.d.ts.map +1 -0
  132. package/dist/rest-resources/{2021-07 → 2022-07}/event.js +4 -1
  133. package/dist/rest-resources/{2021-07 → 2022-07}/fulfillment.d.ts +13 -0
  134. package/dist/rest-resources/2022-07/fulfillment.d.ts.map +1 -0
  135. package/dist/rest-resources/{2021-07 → 2022-07}/fulfillment.js +28 -1
  136. package/dist/rest-resources/{2021-07 → 2022-07}/fulfillment_event.d.ts +3 -0
  137. package/dist/rest-resources/2022-07/fulfillment_event.d.ts.map +1 -0
  138. package/dist/rest-resources/{2021-07 → 2022-07}/fulfillment_event.js +4 -1
  139. package/dist/rest-resources/{2021-07 → 2022-07}/fulfillment_order.d.ts +33 -0
  140. package/dist/rest-resources/2022-07/fulfillment_order.d.ts.map +1 -0
  141. package/dist/rest-resources/{2021-07 → 2022-07}/fulfillment_order.js +74 -2
  142. package/dist/rest-resources/{2021-07 → 2022-07}/fulfillment_request.d.ts +6 -1
  143. package/dist/rest-resources/2022-07/fulfillment_request.d.ts.map +1 -0
  144. package/dist/rest-resources/{2021-07 → 2022-07}/fulfillment_request.js +9 -6
  145. package/dist/rest-resources/{2021-07 → 2022-07}/fulfillment_service.d.ts +4 -1
  146. package/dist/rest-resources/2022-07/fulfillment_service.d.ts.map +1 -0
  147. package/dist/rest-resources/{2021-07 → 2022-07}/fulfillment_service.js +4 -1
  148. package/dist/rest-resources/{2021-07 → 2022-07}/gift_card.d.ts +3 -0
  149. package/dist/rest-resources/2022-07/gift_card.d.ts.map +1 -0
  150. package/dist/rest-resources/{2021-07 → 2022-07}/gift_card.js +4 -1
  151. package/dist/rest-resources/{2021-07 → 2022-07}/gift_card_adjustment.d.ts +3 -0
  152. package/dist/rest-resources/2022-07/gift_card_adjustment.d.ts.map +1 -0
  153. package/dist/rest-resources/{2021-07 → 2022-07}/gift_card_adjustment.js +4 -1
  154. package/dist/rest-resources/{2021-07 → 2022-07}/image.d.ts +3 -0
  155. package/dist/rest-resources/2022-07/image.d.ts.map +1 -0
  156. package/dist/rest-resources/{2021-07 → 2022-07}/image.js +4 -1
  157. package/dist/rest-resources/{2021-07 → 2022-07}/index.d.ts +2 -0
  158. package/dist/rest-resources/2022-07/index.d.ts.map +1 -0
  159. package/dist/rest-resources/{2021-07 → 2022-07}/index.js +6 -2
  160. package/dist/rest-resources/{2021-07 → 2022-07}/inventory_item.d.ts +3 -0
  161. package/dist/rest-resources/2022-07/inventory_item.d.ts.map +1 -0
  162. package/dist/rest-resources/{2021-07 → 2022-07}/inventory_item.js +4 -1
  163. package/dist/rest-resources/{2021-07 → 2022-07}/inventory_level.d.ts +3 -0
  164. package/dist/rest-resources/2022-07/inventory_level.d.ts.map +1 -0
  165. package/dist/rest-resources/{2021-07 → 2022-07}/inventory_level.js +4 -1
  166. package/dist/rest-resources/{2021-07 → 2022-07}/location.d.ts +3 -0
  167. package/dist/rest-resources/2022-07/location.d.ts.map +1 -0
  168. package/dist/rest-resources/{2021-07 → 2022-07}/location.js +4 -1
  169. package/dist/rest-resources/{2021-07 → 2022-07}/locations_for_move.d.ts +3 -0
  170. package/dist/rest-resources/2022-07/locations_for_move.d.ts.map +1 -0
  171. package/dist/rest-resources/{2021-07 → 2022-07}/locations_for_move.js +4 -1
  172. package/dist/rest-resources/{2021-07 → 2022-07}/marketing_event.d.ts +3 -0
  173. package/dist/rest-resources/2022-07/marketing_event.d.ts.map +1 -0
  174. package/dist/rest-resources/{2021-07 → 2022-07}/marketing_event.js +4 -1
  175. package/dist/rest-resources/{2021-07 → 2022-07}/metafield.d.ts +3 -0
  176. package/dist/rest-resources/2022-07/metafield.d.ts.map +1 -0
  177. package/dist/rest-resources/{2021-07 → 2022-07}/metafield.js +4 -1
  178. package/dist/rest-resources/{2021-07 → 2022-07}/mobile_platform_application.d.ts +3 -0
  179. package/dist/rest-resources/2022-07/mobile_platform_application.d.ts.map +1 -0
  180. package/dist/rest-resources/{2021-07 → 2022-07}/mobile_platform_application.js +4 -1
  181. package/dist/rest-resources/{2021-07 → 2022-07}/order.d.ts +6 -0
  182. package/dist/rest-resources/2022-07/order.d.ts.map +1 -0
  183. package/dist/rest-resources/{2021-07 → 2022-07}/order.js +4 -1
  184. package/dist/rest-resources/{2021-07 → 2022-07}/order_risk.d.ts +3 -0
  185. package/dist/rest-resources/2022-07/order_risk.d.ts.map +1 -0
  186. package/dist/rest-resources/{2021-07 → 2022-07}/order_risk.js +4 -1
  187. package/dist/rest-resources/{2021-07 → 2022-07}/page.d.ts +3 -0
  188. package/dist/rest-resources/2022-07/page.d.ts.map +1 -0
  189. package/dist/rest-resources/{2021-07 → 2022-07}/page.js +4 -1
  190. package/dist/rest-resources/{2021-07 → 2022-07}/payment.d.ts +3 -0
  191. package/dist/rest-resources/2022-07/payment.d.ts.map +1 -0
  192. package/dist/rest-resources/{2021-07 → 2022-07}/payment.js +4 -1
  193. package/dist/rest-resources/{2021-07 → 2022-07}/payment_gateway.d.ts +3 -0
  194. package/dist/rest-resources/2022-07/payment_gateway.d.ts.map +1 -0
  195. package/dist/rest-resources/{2021-07 → 2022-07}/payment_gateway.js +4 -1
  196. package/dist/rest-resources/{2021-07 → 2022-07}/payment_transaction.d.ts +3 -0
  197. package/dist/rest-resources/2022-07/payment_transaction.d.ts.map +1 -0
  198. package/dist/rest-resources/{2021-07 → 2022-07}/payment_transaction.js +4 -1
  199. package/dist/rest-resources/{2021-07 → 2022-07}/payout.d.ts +3 -0
  200. package/dist/rest-resources/2022-07/payout.d.ts.map +1 -0
  201. package/dist/rest-resources/{2021-07 → 2022-07}/payout.js +4 -1
  202. package/dist/rest-resources/{2021-07 → 2022-07}/policy.d.ts +3 -0
  203. package/dist/rest-resources/2022-07/policy.d.ts.map +1 -0
  204. package/dist/rest-resources/{2021-07 → 2022-07}/policy.js +4 -1
  205. package/dist/rest-resources/{2021-07 → 2022-07}/price_rule.d.ts +4 -1
  206. package/dist/rest-resources/2022-07/price_rule.d.ts.map +1 -0
  207. package/dist/rest-resources/{2021-07 → 2022-07}/price_rule.js +4 -1
  208. package/dist/rest-resources/{2021-07 → 2022-07}/product.d.ts +3 -0
  209. package/dist/rest-resources/2022-07/product.d.ts.map +1 -0
  210. package/dist/rest-resources/{2021-07 → 2022-07}/product.js +4 -1
  211. package/dist/rest-resources/{2021-07 → 2022-07}/product_listing.d.ts +3 -0
  212. package/dist/rest-resources/2022-07/product_listing.d.ts.map +1 -0
  213. package/dist/rest-resources/{2021-07 → 2022-07}/product_listing.js +4 -1
  214. package/dist/rest-resources/{2021-07 → 2022-07}/product_resource_feedback.d.ts +3 -0
  215. package/dist/rest-resources/2022-07/product_resource_feedback.d.ts.map +1 -0
  216. package/dist/rest-resources/{2021-07 → 2022-07}/product_resource_feedback.js +4 -1
  217. package/dist/rest-resources/{2021-07 → 2022-07}/province.d.ts +3 -0
  218. package/dist/rest-resources/2022-07/province.d.ts.map +1 -0
  219. package/dist/rest-resources/{2021-07 → 2022-07}/province.js +4 -1
  220. package/dist/rest-resources/{2021-07 → 2022-07}/recurring_application_charge.d.ts +3 -0
  221. package/dist/rest-resources/2022-07/recurring_application_charge.d.ts.map +1 -0
  222. package/dist/rest-resources/{2021-07 → 2022-07}/recurring_application_charge.js +4 -1
  223. package/dist/rest-resources/{2021-07 → 2022-07}/redirect.d.ts +3 -0
  224. package/dist/rest-resources/2022-07/redirect.d.ts.map +1 -0
  225. package/dist/rest-resources/{2021-07 → 2022-07}/redirect.js +4 -1
  226. package/dist/rest-resources/{2021-07 → 2022-07}/refund.d.ts +3 -0
  227. package/dist/rest-resources/2022-07/refund.d.ts.map +1 -0
  228. package/dist/rest-resources/{2021-07 → 2022-07}/refund.js +4 -1
  229. package/dist/rest-resources/{2021-07 → 2022-07}/report.d.ts +3 -0
  230. package/dist/rest-resources/2022-07/report.d.ts.map +1 -0
  231. package/dist/rest-resources/{2021-07 → 2022-07}/report.js +4 -1
  232. package/dist/rest-resources/{2021-07 → 2022-07}/resource_feedback.d.ts +3 -0
  233. package/dist/rest-resources/2022-07/resource_feedback.d.ts.map +1 -0
  234. package/dist/rest-resources/{2021-07 → 2022-07}/resource_feedback.js +4 -1
  235. package/dist/rest-resources/{2021-07 → 2022-07}/script_tag.d.ts +3 -0
  236. package/dist/rest-resources/2022-07/script_tag.d.ts.map +1 -0
  237. package/dist/rest-resources/{2021-07 → 2022-07}/script_tag.js +4 -1
  238. package/dist/rest-resources/{2021-07 → 2022-07}/shipping_zone.d.ts +3 -0
  239. package/dist/rest-resources/2022-07/shipping_zone.d.ts.map +1 -0
  240. package/dist/rest-resources/{2021-07 → 2022-07}/shipping_zone.js +4 -1
  241. package/dist/rest-resources/{2021-07 → 2022-07}/shop.d.ts +3 -0
  242. package/dist/rest-resources/2022-07/shop.d.ts.map +1 -0
  243. package/dist/rest-resources/{2021-07 → 2022-07}/shop.js +4 -1
  244. package/dist/rest-resources/{2021-07 → 2022-07}/smart_collection.d.ts +3 -0
  245. package/dist/rest-resources/2022-07/smart_collection.d.ts.map +1 -0
  246. package/dist/rest-resources/{2021-07 → 2022-07}/smart_collection.js +4 -1
  247. package/dist/rest-resources/{2021-07 → 2022-07}/storefront_access_token.d.ts +3 -0
  248. package/dist/rest-resources/2022-07/storefront_access_token.d.ts.map +1 -0
  249. package/dist/rest-resources/{2021-07 → 2022-07}/storefront_access_token.js +4 -1
  250. package/dist/rest-resources/{2021-07 → 2022-07}/tender_transaction.d.ts +3 -0
  251. package/dist/rest-resources/2022-07/tender_transaction.d.ts.map +1 -0
  252. package/dist/rest-resources/{2021-07 → 2022-07}/tender_transaction.js +4 -1
  253. package/dist/rest-resources/{2021-07 → 2022-07}/theme.d.ts +3 -0
  254. package/dist/rest-resources/2022-07/theme.d.ts.map +1 -0
  255. package/dist/rest-resources/{2021-07 → 2022-07}/theme.js +4 -1
  256. package/dist/rest-resources/{2021-07 → 2022-07}/transaction.d.ts +6 -0
  257. package/dist/rest-resources/2022-07/transaction.d.ts.map +1 -0
  258. package/dist/rest-resources/{2021-07 → 2022-07}/transaction.js +4 -1
  259. package/dist/rest-resources/{2021-07 → 2022-07}/usage_charge.d.ts +3 -0
  260. package/dist/rest-resources/2022-07/usage_charge.d.ts.map +1 -0
  261. package/dist/rest-resources/{2021-07 → 2022-07}/usage_charge.js +4 -1
  262. package/dist/rest-resources/{2021-07 → 2022-07}/user.d.ts +3 -0
  263. package/dist/rest-resources/2022-07/user.d.ts.map +1 -0
  264. package/dist/rest-resources/{2021-07 → 2022-07}/user.js +4 -1
  265. package/dist/rest-resources/{2021-07 → 2022-07}/variant.d.ts +3 -0
  266. package/dist/rest-resources/2022-07/variant.d.ts.map +1 -0
  267. package/dist/rest-resources/{2021-07 → 2022-07}/variant.js +4 -1
  268. package/dist/rest-resources/{2021-07 → 2022-07}/webhook.d.ts +3 -0
  269. package/dist/rest-resources/2022-07/webhook.d.ts.map +1 -0
  270. package/dist/rest-resources/{2021-07 → 2022-07}/webhook.js +4 -1
  271. package/dist/utils/get-embedded-app-url.d.ts +9 -0
  272. package/dist/utils/get-embedded-app-url.d.ts.map +1 -0
  273. package/dist/utils/get-embedded-app-url.js +26 -0
  274. package/dist/utils/index.d.ts +2 -0
  275. package/dist/utils/index.d.ts.map +1 -1
  276. package/dist/utils/index.js +2 -0
  277. package/dist/version.d.ts +1 -1
  278. package/dist/version.js +1 -1
  279. package/dist/webhooks/registry.js +2 -2
  280. package/package.json +4 -4
  281. package/dist/rest-resources/2021-07/abandoned_checkout.d.ts.map +0 -1
  282. package/dist/rest-resources/2021-07/access_scope.d.ts.map +0 -1
  283. package/dist/rest-resources/2021-07/android_pay_key.d.ts.map +0 -1
  284. package/dist/rest-resources/2021-07/apple_pay_certificate.d.ts.map +0 -1
  285. package/dist/rest-resources/2021-07/application_charge.d.ts.map +0 -1
  286. package/dist/rest-resources/2021-07/application_credit.d.ts.map +0 -1
  287. package/dist/rest-resources/2021-07/article.d.ts.map +0 -1
  288. package/dist/rest-resources/2021-07/asset.d.ts.map +0 -1
  289. package/dist/rest-resources/2021-07/assigned_fulfillment_order.d.ts.map +0 -1
  290. package/dist/rest-resources/2021-07/balance.d.ts.map +0 -1
  291. package/dist/rest-resources/2021-07/blog.d.ts.map +0 -1
  292. package/dist/rest-resources/2021-07/cancellation_request.d.ts.map +0 -1
  293. package/dist/rest-resources/2021-07/carrier_service.d.ts.map +0 -1
  294. package/dist/rest-resources/2021-07/checkout.d.ts.map +0 -1
  295. package/dist/rest-resources/2021-07/collect.d.ts.map +0 -1
  296. package/dist/rest-resources/2021-07/collection.d.ts.map +0 -1
  297. package/dist/rest-resources/2021-07/collection_listing.d.ts.map +0 -1
  298. package/dist/rest-resources/2021-07/comment.d.ts.map +0 -1
  299. package/dist/rest-resources/2021-07/country.d.ts.map +0 -1
  300. package/dist/rest-resources/2021-07/currency.d.ts.map +0 -1
  301. package/dist/rest-resources/2021-07/custom_collection.d.ts.map +0 -1
  302. package/dist/rest-resources/2021-07/customer.d.ts.map +0 -1
  303. package/dist/rest-resources/2021-07/customer_address.d.ts.map +0 -1
  304. package/dist/rest-resources/2021-07/customer_saved_search.d.ts.map +0 -1
  305. package/dist/rest-resources/2021-07/deprecated_api_call.d.ts.map +0 -1
  306. package/dist/rest-resources/2021-07/discount_code.d.ts.map +0 -1
  307. package/dist/rest-resources/2021-07/dispute.d.ts.map +0 -1
  308. package/dist/rest-resources/2021-07/draft_order.d.ts.map +0 -1
  309. package/dist/rest-resources/2021-07/event.d.ts.map +0 -1
  310. package/dist/rest-resources/2021-07/fulfillment.d.ts.map +0 -1
  311. package/dist/rest-resources/2021-07/fulfillment_event.d.ts.map +0 -1
  312. package/dist/rest-resources/2021-07/fulfillment_order.d.ts.map +0 -1
  313. package/dist/rest-resources/2021-07/fulfillment_request.d.ts.map +0 -1
  314. package/dist/rest-resources/2021-07/fulfillment_service.d.ts.map +0 -1
  315. package/dist/rest-resources/2021-07/gift_card.d.ts.map +0 -1
  316. package/dist/rest-resources/2021-07/gift_card_adjustment.d.ts.map +0 -1
  317. package/dist/rest-resources/2021-07/image.d.ts.map +0 -1
  318. package/dist/rest-resources/2021-07/index.d.ts.map +0 -1
  319. package/dist/rest-resources/2021-07/inventory_item.d.ts.map +0 -1
  320. package/dist/rest-resources/2021-07/inventory_level.d.ts.map +0 -1
  321. package/dist/rest-resources/2021-07/location.d.ts.map +0 -1
  322. package/dist/rest-resources/2021-07/locations_for_move.d.ts.map +0 -1
  323. package/dist/rest-resources/2021-07/marketing_event.d.ts.map +0 -1
  324. package/dist/rest-resources/2021-07/metafield.d.ts.map +0 -1
  325. package/dist/rest-resources/2021-07/mobile_platform_application.d.ts.map +0 -1
  326. package/dist/rest-resources/2021-07/order.d.ts.map +0 -1
  327. package/dist/rest-resources/2021-07/order_risk.d.ts.map +0 -1
  328. package/dist/rest-resources/2021-07/page.d.ts.map +0 -1
  329. package/dist/rest-resources/2021-07/payment.d.ts.map +0 -1
  330. package/dist/rest-resources/2021-07/payment_gateway.d.ts.map +0 -1
  331. package/dist/rest-resources/2021-07/payment_transaction.d.ts.map +0 -1
  332. package/dist/rest-resources/2021-07/payout.d.ts.map +0 -1
  333. package/dist/rest-resources/2021-07/policy.d.ts.map +0 -1
  334. package/dist/rest-resources/2021-07/price_rule.d.ts.map +0 -1
  335. package/dist/rest-resources/2021-07/product.d.ts.map +0 -1
  336. package/dist/rest-resources/2021-07/product_listing.d.ts.map +0 -1
  337. package/dist/rest-resources/2021-07/product_resource_feedback.d.ts.map +0 -1
  338. package/dist/rest-resources/2021-07/province.d.ts.map +0 -1
  339. package/dist/rest-resources/2021-07/recurring_application_charge.d.ts.map +0 -1
  340. package/dist/rest-resources/2021-07/redirect.d.ts.map +0 -1
  341. package/dist/rest-resources/2021-07/refund.d.ts.map +0 -1
  342. package/dist/rest-resources/2021-07/report.d.ts.map +0 -1
  343. package/dist/rest-resources/2021-07/resource_feedback.d.ts.map +0 -1
  344. package/dist/rest-resources/2021-07/script_tag.d.ts.map +0 -1
  345. package/dist/rest-resources/2021-07/shipping_zone.d.ts.map +0 -1
  346. package/dist/rest-resources/2021-07/shop.d.ts.map +0 -1
  347. package/dist/rest-resources/2021-07/smart_collection.d.ts.map +0 -1
  348. package/dist/rest-resources/2021-07/storefront_access_token.d.ts.map +0 -1
  349. package/dist/rest-resources/2021-07/tender_transaction.d.ts.map +0 -1
  350. package/dist/rest-resources/2021-07/theme.d.ts.map +0 -1
  351. package/dist/rest-resources/2021-07/transaction.d.ts.map +0 -1
  352. package/dist/rest-resources/2021-07/usage_charge.d.ts.map +0 -1
  353. package/dist/rest-resources/2021-07/user.d.ts.map +0 -1
  354. package/dist/rest-resources/2021-07/variant.d.ts.map +0 -1
  355. package/dist/rest-resources/2021-07/webhook.d.ts.map +0 -1
package/CHANGELOG.md CHANGED
@@ -5,29 +5,54 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
6
6
  and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## Unreleased
9
+
10
+ ## [4.2.0] - 2022-07-20
11
+
12
+ - Return a 401 instead of 403 when webhooks fail validation [#425](https://github.com/Shopify/shopify-api-node/pull/425)
13
+ - Add optional new methods `deleteSession` and `findSessionsByShop` to `SessionStorage`, with the corresponding implementations for the various session storage adapters [#418](https://github.com/Shopify/shopify-api-node/pull/418)
14
+ - Include subset of query body in API deprecation logs [#426](https://github.com/Shopify/shopify-api-node/pull/426)
15
+
16
+ ## [4.1.0] - 2022-07-14
17
+
18
+ - Add new method to construct the host app URL [#419](https://github.com/Shopify/shopify-api-node/pull/419)
19
+
20
+ ## [4.0.0] - 2022-07-04
21
+
22
+ - ⚠️ [Breaking] Add REST resources for July 2022 API version, add `LATEST_API_VERSION` constant, remove support and REST resources for July 2021 (`2021-07`) API version [#415](https://github.com/Shopify/shopify-api-node/pull/415)
23
+ - Add support for July 2022 API version [#409](https://github.com/Shopify/shopify-api-node/pull/409)
24
+
25
+ ### Fixes
26
+
27
+ - Fix a bug where the PostgreSQL session storage always attempted to create the sessions table [#413](https://github.com/Shopify/shopify-api-node/pull/413)
28
+
8
29
  ## [3.1.3] - 2022-06-08
9
30
 
10
31
  ### Fixes
32
+
11
33
  - Return instances of `Session` from session storages, not POJOs.
12
34
 
13
35
  ## [3.1.2] - 2022-06-07
14
36
 
15
37
  ### Added
38
+
16
39
  - Store user id and expiration date of online tokens
17
40
 
18
41
  ### Fixes
19
- - Properly parse a non-json HTTP response [#257](https://github.com/Shopify/shopify-node-api/issues/257)
20
- - Don’t create a SQLite DB file if the SQLite storage is not used.
21
42
 
43
+ - Properly parse a non-json HTTP response [#257](https://github.com/Shopify/shopify-api-node/issues/257)
44
+ - Don’t create a SQLite DB file if the SQLite storage is not used.
22
45
 
23
46
  ## [3.1.0] - 2022-05-16
24
47
 
25
48
  ### Added
26
- - Support for specifying the URI scheme of the host [#385](https://github.com/Shopify/shopify-node-api/pull/385)
49
+
50
+ - Support for specifying the URI scheme of the host [#385](https://github.com/Shopify/shopify-api-node/pull/385)
27
51
  - Add optional `saving` parameter to `serialize` of `Base` class - default is `false` and will include read-only attributes in returned object; `true` used for `save` when committing via API to Shopify.
28
52
 
29
53
  ### Fixed
30
- - Fixes [#363](https://github.com/Shopify/shopify-node-api/issues/363)
54
+
55
+ - Fixes [#363](https://github.com/Shopify/shopify-api-node/issues/363)
31
56
  - Webhooks `register` now checks for any attempt to register a GDPR topic (not done via API but by Partner Dashboard), provides an error message in response
32
57
  - For topics that don't exist, `register` checks the response from the initial API call for an `errors` field and returns accordingly
33
58
 
@@ -35,22 +60,22 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
35
60
 
36
61
  ### Added
37
62
 
38
- - Allow REST resources to configure a deny list of attributes to be excluded when saving [#355](https://github.com/Shopify/shopify-node-api/pull/355)
63
+ - Allow REST resources to configure a deny list of attributes to be excluded when saving [#355](https://github.com/Shopify/shopify-api-node/pull/355)
39
64
 
40
65
  ## [3.0.0] - 2022-04-04
41
66
 
42
67
  ### Added
43
68
 
44
- - ⚠️ [Breaking] Removing API version `2021-04` [#343](https://github.com/Shopify/shopify-node-api/pull/343)
69
+ - ⚠️ [Breaking] Removing API version `2021-04` [#343](https://github.com/Shopify/shopify-api-node/pull/343)
45
70
  - ⚠️ [Breaking] The `HttpResponseError` error and its flavours (all returned from HTTP requests) have been slightly altered:
46
71
  - They now take in a hash of values, and will always include the response code, body (as a string if the response is not JSON), and headers
47
72
  - All response fields are now contained within a `response` object, to make it easier to access them
48
- - ⚠️ [Breaking] Update supported Admin API versions [#310](https://github.com/Shopify/shopify-node-api/pull/310)
49
- - Allow full paths in REST requests [#301](https://github.com/Shopify/shopify-node-api/pull/301)
73
+ - ⚠️ [Breaking] Update supported Admin API versions [#310](https://github.com/Shopify/shopify-api-node/pull/310)
74
+ - Allow full paths in REST requests [#301](https://github.com/Shopify/shopify-api-node/pull/301)
50
75
 
51
76
  ### Fixed
52
77
 
53
- - ⚠️ [Breaking] Stop responding to the request in the GraphQL Proxy function, returning Shopify's response instead [#312](https://github.com/Shopify/shopify-node-api/pull/312)
78
+ - ⚠️ [Breaking] Stop responding to the request in the GraphQL Proxy function, returning Shopify's response instead [#312](https://github.com/Shopify/shopify-api-node/pull/312)
54
79
 
55
80
  The examples below are in [express](https://expressjs.com/); you will now need to handle the response yourself.
56
81
 
@@ -75,76 +100,76 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
75
100
 
76
101
  ### Added
77
102
 
78
- - Add support for January 2022 API version [#285](https://github.com/Shopify/shopify-node-api/pull/285)
103
+ - Add support for January 2022 API version [#285](https://github.com/Shopify/shopify-api-node/pull/285)
79
104
 
80
105
  ## [2.0.0] - 2021-10-28
81
106
 
82
107
  ### Added
83
108
 
84
- - Add a 5 second `clockTolerance` to fix `jwt not active` error [#227](https://github.com/Shopify/shopify-node-api/pull/227)
85
- - [Breaking] Change default for OAuth.beginAuth to online sessions [#203](https://github.com/Shopify/shopify-node-api/pull/203)
86
- - see [oauth.md](https://github.com/Shopify/shopify-node-api/blob/main/docs/usage/oauth.md) for updated docs
87
- - [Breaking] Return and delete session in `validateAuthCallback` [#217](https://github.com/Shopify/shopify-node-api/pull/217)
88
- - see [oauth.md](https://github.com/Shopify/shopify-node-api/blob/main/docs/usage/oauth.md) for updated usage
89
- - [Breaking] Extract `addHandler` and `getHandler` methods for webhooks out of `register` [#205](https://github.com/Shopify/shopify-node-api/pull/205)
90
- - [Breaking] Sessions no longer default to `false` for `isOnline` [#169](https://github.com/Shopify/shopify-node-api/pull/169)
91
- - Required `Session` arguments must be passed to the constructor [#169](https://github.com/Shopify/shopify-node-api/pull/169)
92
- - Allow `undefined` in `AuthScopes` [#169](https://github.com/Shopify/shopify-node-api/pull/169)
109
+ - Add a 5 second `clockTolerance` to fix `jwt not active` error [#227](https://github.com/Shopify/shopify-api-node/pull/227)
110
+ - [Breaking] Change default for OAuth.beginAuth to online sessions [#203](https://github.com/Shopify/shopify-api-node/pull/203)
111
+ - see [oauth.md](https://github.com/Shopify/shopify-api-node/blob/main/docs/usage/oauth.md) for updated docs
112
+ - [Breaking] Return and delete session in `validateAuthCallback` [#217](https://github.com/Shopify/shopify-api-node/pull/217)
113
+ - see [oauth.md](https://github.com/Shopify/shopify-api-node/blob/main/docs/usage/oauth.md) for updated usage
114
+ - [Breaking] Extract `addHandler` and `getHandler` methods for webhooks out of `register` [#205](https://github.com/Shopify/shopify-api-node/pull/205)
115
+ - [Breaking] Sessions no longer default to `false` for `isOnline` [#169](https://github.com/Shopify/shopify-api-node/pull/169)
116
+ - Required `Session` arguments must be passed to the constructor [#169](https://github.com/Shopify/shopify-api-node/pull/169)
117
+ - Allow `undefined` in `AuthScopes` [#169](https://github.com/Shopify/shopify-api-node/pull/169)
93
118
 
94
119
  ## [1.4.3] - 2021-10-22
95
120
 
96
121
  ### Fixed
97
122
 
98
- - Fixed the HTTP client error messages to expand objects [#252](https://github.com/Shopify/shopify-node-api/pull/252)
123
+ - Fixed the HTTP client error messages to expand objects [#252](https://github.com/Shopify/shopify-api-node/pull/252)
99
124
 
100
125
  ## [1.4.2] - 2021-10-20
101
126
 
102
- - Added `October21` to `ApiVersion` [#247](https://github.com/Shopify/shopify-node-api/pull/247)
127
+ - Added `October21` to `ApiVersion` [#247](https://github.com/Shopify/shopify-api-node/pull/247)
103
128
 
104
129
  ## [1.4.1] - 2021-06-11
105
130
 
106
- - Don't include extra params when calculating local hmac [#196](https://github.com/Shopify/shopify-node-api/pull/196)
131
+ - Don't include extra params when calculating local hmac [#196](https://github.com/Shopify/shopify-api-node/pull/196)
107
132
 
108
133
  ## [1.4.0] - 2021-05-21
109
134
 
110
135
  ### Added
111
136
 
112
- - Add support for registering Google Pub/Sub webhooks [#181](https://github.com/Shopify/shopify-node-api/pull/181)
113
- - Added `July21` to `ApiVersion` [#181](https://github.com/Shopify/shopify-node-api/pull/181)
137
+ - Add support for registering Google Pub/Sub webhooks [#181](https://github.com/Shopify/shopify-api-node/pull/181)
138
+ - Added `July21` to `ApiVersion` [#181](https://github.com/Shopify/shopify-api-node/pull/181)
114
139
 
115
140
  ## [1.3.0] - 2021-05-12
116
141
 
117
142
  ### Added
118
143
 
119
144
  - Added Storefront API client under `Shopify.Clients.Storefront`
120
- - Add `isActive()` method to `Session` class to check if session is active, replace `Session` with `SessionInterface` when used as a type [#153](https://github.com/Shopify/shopify-node-api/pull/153)
145
+ - Add `isActive()` method to `Session` class to check if session is active, replace `Session` with `SessionInterface` when used as a type [#153](https://github.com/Shopify/shopify-api-node/pull/153)
121
146
 
122
147
  ## [1.2.1] - 2021-03-26
123
148
 
124
149
  ### Added
125
150
 
126
- - Added `April21` to `ApiVersion` [#149](https://github.com/Shopify/shopify-node-api/pull/149)
151
+ - Added `April21` to `ApiVersion` [#149](https://github.com/Shopify/shopify-api-node/pull/149)
127
152
 
128
153
  ## [1.2.0] - 2021-03-16
129
154
 
130
155
  ### Added
131
156
 
132
- - Allow plain objects to be returned from the `loadCallback` on `CustomSessionStorage` [#126](https://github.com/shopify/shopify-node-api/pull/126)
133
- - Documentation and example code for `CustomSessionStorage` [#129](https://github.com/shopify/shopify-node-api/pull/129)
157
+ - Allow plain objects to be returned from the `loadCallback` on `CustomSessionStorage` [#126](https://github.com/Shopify/shopify-api-node/pull/126)
158
+ - Documentation and example code for `CustomSessionStorage` [#129](https://github.com/Shopify/shopify-api-node/pull/129)
134
159
 
135
160
  ### Fixed
136
161
 
137
- - Throw a different error for a missing cookie upon OAuth return [#131](https://github.com/shopify/shopify-node-api/pull/131)
138
- - Improved documentation for GraphQL and Rest Clients. [#123](https://github.com/Shopify/shopify-node-api/pull/123)
139
- - Made Docs directory more browseable in GitHub. [#136](https://github.com/Shopify/shopify-node-api/pull/136)
140
- - Make sure `CustomSessionStorage` converts the `expires` field from a string to `Date`. [#132](https://github.com/Shopify/shopify-node-api/pull/132)
141
- - Made `limit` optional for get-requests with query [#135](https://github.com/Shopify/shopify-node-api/pull/135)
162
+ - Throw a different error for a missing cookie upon OAuth return [#131](https://github.com/Shopify/shopify-api-node/pull/131)
163
+ - Improved documentation for GraphQL and Rest Clients. [#123](https://github.com/Shopify/shopify-api-node/pull/123)
164
+ - Made Docs directory more browseable in GitHub. [#136](https://github.com/Shopify/shopify-api-node/pull/136)
165
+ - Make sure `CustomSessionStorage` converts the `expires` field from a string to `Date`. [#132](https://github.com/Shopify/shopify-api-node/pull/132)
166
+ - Made `limit` optional for get-requests with query [#135](https://github.com/Shopify/shopify-api-node/pull/135)
142
167
 
143
168
  ## [1.1.0] - 2021-03-02
144
169
 
145
170
  - Minor text/doc changes
146
- - Added `2021-01` API version to enum. [#117](https://github.com/shopify/shopify-node-api/pull/117)
147
- - Allow retrieving offline sessions using `loadCurrentSession`. [#119](https://github.com/shopify/shopify-node-api/pull/119)
171
+ - Added `2021-01` API version to enum. [#117](https://github.com/Shopify/shopify-api-node/pull/117)
172
+ - Allow retrieving offline sessions using `loadCurrentSession`. [#119](https://github.com/Shopify/shopify-api-node/pull/119)
148
173
 
149
174
  ## [1.0.0]
150
175
 
@@ -154,56 +179,56 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
154
179
 
155
180
  ### Added
156
181
 
157
- - Added `AuthScopes` value object to allow apps to easily check whether scopes have been updated. [#110](https://github.com/shopify/shopify-node-api/pull/110)
182
+ - Added `AuthScopes` value object to allow apps to easily check whether scopes have been updated. [#110](https://github.com/Shopify/shopify-api-node/pull/110)
158
183
 
159
184
  ### Fixed
160
185
 
161
- - GraphQL Proxy attempts to parse the request body as JSON before passing it to the client. [#106](https://github.com/shopify/shopify-node-api/pull/106)
186
+ - GraphQL Proxy attempts to parse the request body as JSON before passing it to the client. [#106](https://github.com/Shopify/shopify-api-node/pull/106)
162
187
 
163
188
  ## [0.4.0] - 2021-02-10
164
189
 
165
190
  ### Added
166
191
 
167
- - Webhooks types are now exported outside the library [#91](https://github.com/shopify/shopify-node-api/pull/91)
168
- - Added support for private apps [#99](https://github.com/Shopify/shopify-node-api/pull/99)
169
- - `USER_AGENT_PREFIX` added to Context, to add agent to all requests [#101](https://github.com/Shopify/shopify-node-api/pull/101)
170
- - Add link to tutorial on how to rotate credentials if neccesary [#107](https://github.com/Shopify/shopify-node-api/pull/107)
192
+ - Webhooks types are now exported outside the library [#91](https://github.com/Shopify/shopify-api-node/pull/91)
193
+ - Added support for private apps [#99](https://github.com/Shopify/shopify-api-node/pull/99)
194
+ - `USER_AGENT_PREFIX` added to Context, to add agent to all requests [#101](https://github.com/Shopify/shopify-api-node/pull/101)
195
+ - Add link to tutorial on how to rotate credentials if neccesary [#107](https://github.com/Shopify/shopify-api-node/pull/107)
171
196
 
172
197
  ### Fixed
173
198
 
174
- - Export `withSession` utility method [#96](https://github.com/Shopify/shopify-node-api/pull/96)
175
- - GraphQL Client appropriately handles queries with variables [#97](https://github.com/Shopify/shopify-node-api/pull/97)
176
- - Use cryptographically random bytes to generate nonce [#98](https://github.com/Shopify/shopify-node-api/pull/98)
177
- - Stop using `SameSite=none` cookies for OAuth, using `lax` instead [#100](https://github.com/Shopify/shopify-node-api/pull/100)
199
+ - Export `withSession` utility method [#96](https://github.com/Shopify/shopify-api-node/pull/96)
200
+ - GraphQL Client appropriately handles queries with variables [#97](https://github.com/Shopify/shopify-api-node/pull/97)
201
+ - Use cryptographically random bytes to generate nonce [#98](https://github.com/Shopify/shopify-api-node/pull/98)
202
+ - Stop using `SameSite=none` cookies for OAuth, using `lax` instead [#100](https://github.com/Shopify/shopify-api-node/pull/100)
178
203
 
179
204
  ## [0.3.1] - 2021-02-03
180
205
 
181
206
  ### Fixed
182
207
 
183
- - Fixed an issue when deleting the current session for embedded apps [#88](https://github.com/shopify/shopify-node-api/pull/88)
208
+ - Fixed an issue when deleting the current session for embedded apps [#88](https://github.com/Shopify/shopify-api-node/pull/88)
184
209
 
185
210
  ## [0.3.0] - 2021-01-27
186
211
 
187
212
  ### Added
188
213
 
189
- - Add `withSession` utility method [#83](https://github.com/shopify/shopify-node-api/pull/83)
214
+ - Add `withSession` utility method [#83](https://github.com/Shopify/shopify-api-node/pull/83)
190
215
 
191
216
  ### Fixed
192
217
 
193
- - Refactor library public interface [#87](https://github.com/shopify/shopify-node-api/pull/87)
194
- - Check if a webhook is registered before calling Shopify [#82](https://github.com/shopify/shopify-node-api/pull/82)
218
+ - Refactor library public interface [#87](https://github.com/Shopify/shopify-api-node/pull/87)
219
+ - Check if a webhook is registered before calling Shopify [#82](https://github.com/Shopify/shopify-api-node/pull/82)
195
220
 
196
221
  ## [0.2.2] - 2021-01-14
197
222
 
198
223
  ### Fixed
199
224
 
200
- - Ensure that the OAuth session expiration matches the cookie expiration [#72](https://github.com/shopify/shopify-node-api/pull/72) / [#73](https://github.com/shopify/shopify-node-api/pull/73)
225
+ - Ensure that the OAuth session expiration matches the cookie expiration [#72](https://github.com/Shopify/shopify-api-node/pull/72) / [#73](https://github.com/Shopify/shopify-api-node/pull/73)
201
226
 
202
227
  ## [0.2.0] - 2021-01-13
203
228
 
204
- - Preserve the OAuth cookie session for a few seconds so SPA can perform their initial load using it [#70](https://github.com/shopify/shopify-node-api/pull/70)
205
- - Session fetches now return `undefined` when a session is not available [#64](https://github.com/shopify/shopify-node-api/pull/64)
206
- - Add `deleteCurrentSession` utils method [#60](https://github.com/shopify/shopify-node-api/pull/60)
229
+ - Preserve the OAuth cookie session for a few seconds so SPA can perform their initial load using it [#70](https://github.com/Shopify/shopify-api-node/pull/70)
230
+ - Session fetches now return `undefined` when a session is not available [#64](https://github.com/Shopify/shopify-api-node/pull/64)
231
+ - Add `deleteCurrentSession` utils method [#60](https://github.com/Shopify/shopify-api-node/pull/60)
207
232
 
208
233
  ## [0.1.0] - 2020-12-17
209
234
 
@@ -21,6 +21,18 @@ interface SessionStorage {
21
21
  * @param id Id of the session to delete
22
22
  */
23
23
  deleteSession(id: string): Promise<boolean>;
24
+ /**
25
+ * Deletes an array of sessions from storage.
26
+ *
27
+ * @param ids Array of session id's to delete
28
+ */
29
+ deleteSessions?(ids: string[]): Promise<boolean>;
30
+ /**
31
+ * Return an array of sessions for a given shop (or [] if none found).
32
+ *
33
+ * @param shop shop of the session(s) to return
34
+ */
35
+ findSessionsByShop?(shop: string): Promise<SessionInterface[]>;
24
36
  }
25
37
  export { SessionStorage };
26
38
  //# sourceMappingURL=session_storage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"session_storage.d.ts","sourceRoot":"","sources":["../../../src/auth/session/session_storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,SAAS,CAAC;AAEzC;;GAEG;AACH,UAAU,cAAc;IACtB;;;;OAIG;IACH,YAAY,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAE1D;;;;OAIG;IACH,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAAC;IAE/D;;;;OAIG;IACH,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC7C;AAED,OAAO,EAAC,cAAc,EAAC,CAAC"}
1
+ {"version":3,"file":"session_storage.d.ts","sourceRoot":"","sources":["../../../src/auth/session/session_storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,SAAS,CAAC;AAEzC;;GAEG;AACH,UAAU,cAAc;IACtB;;;;OAIG;IACH,YAAY,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAE1D;;;;OAIG;IACH,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAAC;IAE/D;;;;OAIG;IACH,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAE5C;;;;OAIG;IACH,cAAc,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEjD;;;;OAIG;IACH,kBAAkB,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;CAChE;AAED,OAAO,EAAC,cAAc,EAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"battery-of-tests.d.ts","sourceRoot":"","sources":["../../../../../src/auth/session/storage/__tests__/battery-of-tests.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,cAAc,EAAC,MAAM,uBAAuB,CAAC;AAErD,wBAAgB,cAAc,CAAC,cAAc,EAAE,MAAM,OAAO,CAAC,cAAc,CAAC,QA+F3E"}
1
+ {"version":3,"file":"battery-of-tests.d.ts","sourceRoot":"","sources":["../../../../../src/auth/session/storage/__tests__/battery-of-tests.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,cAAc,EAAC,MAAM,uBAAuB,CAAC;AAKrD,wBAAgB,cAAc,CAAC,cAAc,EAAE,MAAM,OAAO,CAAC,cAAc,CAAC,QA6J3E"}
@@ -5,6 +5,7 @@ var tslib_1 = require("tslib");
5
5
  var context_1 = require("../../../../context");
6
6
  var session_1 = require("../../session");
7
7
  var session_utils_1 = require("../../session-utils");
8
+ var session_test_utils_1 = require("./session-test-utils");
8
9
  function batteryOfTests(storageFactory) {
9
10
  var _this = this;
10
11
  it('can store and delete all kinds of sessions', function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
@@ -187,5 +188,128 @@ function batteryOfTests(storageFactory) {
187
188
  }
188
189
  });
189
190
  }); });
191
+ it('can find all the sessions for a given shop', function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
192
+ var storage, prefix, sessions, sessions_1, sessions_1_1, session, e_2_1, shop1Sessions;
193
+ var e_2, _a;
194
+ return tslib_1.__generator(this, function (_b) {
195
+ switch (_b.label) {
196
+ case 0: return [4 /*yield*/, storageFactory()];
197
+ case 1:
198
+ storage = _b.sent();
199
+ prefix = 'find_sessions';
200
+ sessions = [
201
+ new session_1.Session("".concat(prefix, "_1"), 'find-shop1-sessions', 'state', true),
202
+ new session_1.Session("".concat(prefix, "_2"), 'do-not-find-shop2-sessions', 'state', true),
203
+ new session_1.Session("".concat(prefix, "_3"), 'find-shop1-sessions', 'state', true),
204
+ new session_1.Session("".concat(prefix, "_4"), 'do-not-find-shop3-sessions', 'state', true),
205
+ ];
206
+ _b.label = 2;
207
+ case 2:
208
+ _b.trys.push([2, 7, 8, 9]);
209
+ sessions_1 = tslib_1.__values(sessions), sessions_1_1 = sessions_1.next();
210
+ _b.label = 3;
211
+ case 3:
212
+ if (!!sessions_1_1.done) return [3 /*break*/, 6];
213
+ session = sessions_1_1.value;
214
+ return [4 /*yield*/, expect(storage.storeSession(session)).resolves.toBe(true)];
215
+ case 4:
216
+ _b.sent();
217
+ _b.label = 5;
218
+ case 5:
219
+ sessions_1_1 = sessions_1.next();
220
+ return [3 /*break*/, 3];
221
+ case 6: return [3 /*break*/, 9];
222
+ case 7:
223
+ e_2_1 = _b.sent();
224
+ e_2 = { error: e_2_1 };
225
+ return [3 /*break*/, 9];
226
+ case 8:
227
+ try {
228
+ if (sessions_1_1 && !sessions_1_1.done && (_a = sessions_1.return)) _a.call(sessions_1);
229
+ }
230
+ finally { if (e_2) throw e_2.error; }
231
+ return [7 /*endfinally*/];
232
+ case 9:
233
+ expect(storage.findSessionsByShop).toBeDefined();
234
+ if (!storage.findSessionsByShop) return [3 /*break*/, 11];
235
+ return [4 /*yield*/, storage.findSessionsByShop('find-shop1-sessions')];
236
+ case 10:
237
+ shop1Sessions = _b.sent();
238
+ expect(shop1Sessions).toBeDefined();
239
+ if (shop1Sessions) {
240
+ expect(shop1Sessions.length).toBe(2);
241
+ expect((0, session_test_utils_1.sessionArraysEqual)(shop1Sessions, [
242
+ sessions[0],
243
+ sessions[2],
244
+ ])).toBe(true);
245
+ }
246
+ _b.label = 11;
247
+ case 11: return [2 /*return*/];
248
+ }
249
+ });
250
+ }); });
251
+ it('can delete the sessions for a given array of ids', function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
252
+ var storage, prefix, sessions, sessions_2, sessions_2_1, session, e_3_1, shop1Sessions, idsToDelete;
253
+ var e_3, _a;
254
+ return tslib_1.__generator(this, function (_b) {
255
+ switch (_b.label) {
256
+ case 0: return [4 /*yield*/, storageFactory()];
257
+ case 1:
258
+ storage = _b.sent();
259
+ prefix = 'delete_sessions';
260
+ sessions = [
261
+ new session_1.Session("".concat(prefix, "_1"), 'delete-shop1-sessions', 'state', true),
262
+ new session_1.Session("".concat(prefix, "_2"), 'do-not-delete-shop2-sessions', 'state', true),
263
+ new session_1.Session("".concat(prefix, "_3"), 'delete-shop1-sessions', 'state', true),
264
+ new session_1.Session("".concat(prefix, "_4"), 'do-not-delete-shop3-sessions', 'state', true),
265
+ ];
266
+ _b.label = 2;
267
+ case 2:
268
+ _b.trys.push([2, 7, 8, 9]);
269
+ sessions_2 = tslib_1.__values(sessions), sessions_2_1 = sessions_2.next();
270
+ _b.label = 3;
271
+ case 3:
272
+ if (!!sessions_2_1.done) return [3 /*break*/, 6];
273
+ session = sessions_2_1.value;
274
+ return [4 /*yield*/, expect(storage.storeSession(session)).resolves.toBe(true)];
275
+ case 4:
276
+ _b.sent();
277
+ _b.label = 5;
278
+ case 5:
279
+ sessions_2_1 = sessions_2.next();
280
+ return [3 /*break*/, 3];
281
+ case 6: return [3 /*break*/, 9];
282
+ case 7:
283
+ e_3_1 = _b.sent();
284
+ e_3 = { error: e_3_1 };
285
+ return [3 /*break*/, 9];
286
+ case 8:
287
+ try {
288
+ if (sessions_2_1 && !sessions_2_1.done && (_a = sessions_2.return)) _a.call(sessions_2);
289
+ }
290
+ finally { if (e_3) throw e_3.error; }
291
+ return [7 /*endfinally*/];
292
+ case 9:
293
+ expect(storage.deleteSessions).toBeDefined();
294
+ if (!(storage.deleteSessions && storage.findSessionsByShop)) return [3 /*break*/, 13];
295
+ return [4 /*yield*/, storage.findSessionsByShop('delete-shop1-sessions')];
296
+ case 10:
297
+ shop1Sessions = _b.sent();
298
+ expect(shop1Sessions).toBeDefined();
299
+ if (!shop1Sessions) return [3 /*break*/, 13];
300
+ expect(shop1Sessions.length).toBe(2);
301
+ idsToDelete = shop1Sessions.map(function (session) { return session.id; });
302
+ return [4 /*yield*/, expect(storage.deleteSessions(idsToDelete)).resolves.toBe(true)];
303
+ case 11:
304
+ _b.sent();
305
+ return [4 /*yield*/, storage.findSessionsByShop('delete-shop1-sessions')];
306
+ case 12:
307
+ shop1Sessions = _b.sent();
308
+ expect(shop1Sessions).toEqual([]);
309
+ _b.label = 13;
310
+ case 13: return [2 /*return*/];
311
+ }
312
+ });
313
+ }); });
190
314
  }
191
315
  exports.batteryOfTests = batteryOfTests;
@@ -0,0 +1,3 @@
1
+ import { SessionInterface } from '../../types';
2
+ export declare function sessionArraysEqual(sessionArray1: SessionInterface[], sessionArray2: SessionInterface[]): boolean;
3
+ //# sourceMappingURL=session-test-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-test-utils.d.ts","sourceRoot":"","sources":["../../../../../src/auth/session/storage/__tests__/session-test-utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,gBAAgB,EAAC,MAAM,aAAa,CAAC;AAI7C,wBAAgB,kBAAkB,CAChC,aAAa,EAAE,gBAAgB,EAAE,EACjC,aAAa,EAAE,gBAAgB,EAAE,GAChC,OAAO,CAgBT"}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sessionArraysEqual = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var session_utils_1 = require("../../session-utils");
6
+ // compare two arrays of sessions that should contain
7
+ // the same sessions but may be in a different order
8
+ function sessionArraysEqual(sessionArray1, sessionArray2) {
9
+ var e_1, _a, e_2, _b;
10
+ if (sessionArray1.length !== sessionArray2.length) {
11
+ return false;
12
+ }
13
+ try {
14
+ for (var sessionArray1_1 = tslib_1.__values(sessionArray1), sessionArray1_1_1 = sessionArray1_1.next(); !sessionArray1_1_1.done; sessionArray1_1_1 = sessionArray1_1.next()) {
15
+ var session1 = sessionArray1_1_1.value;
16
+ var found = false;
17
+ try {
18
+ for (var sessionArray2_1 = (e_2 = void 0, tslib_1.__values(sessionArray2)), sessionArray2_1_1 = sessionArray2_1.next(); !sessionArray2_1_1.done; sessionArray2_1_1 = sessionArray2_1.next()) {
19
+ var session2 = sessionArray2_1_1.value;
20
+ if ((0, session_utils_1.sessionEqual)(session1, session2)) {
21
+ found = true;
22
+ continue;
23
+ }
24
+ }
25
+ }
26
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
27
+ finally {
28
+ try {
29
+ if (sessionArray2_1_1 && !sessionArray2_1_1.done && (_b = sessionArray2_1.return)) _b.call(sessionArray2_1);
30
+ }
31
+ finally { if (e_2) throw e_2.error; }
32
+ }
33
+ if (!found)
34
+ return false;
35
+ }
36
+ }
37
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
38
+ finally {
39
+ try {
40
+ if (sessionArray1_1_1 && !sessionArray1_1_1.done && (_a = sessionArray1_1.return)) _a.call(sessionArray1_1);
41
+ }
42
+ finally { if (e_1) throw e_1.error; }
43
+ }
44
+ return true;
45
+ }
46
+ exports.sessionArraysEqual = sessionArraysEqual;
@@ -6,11 +6,15 @@ export declare class CustomSessionStorage implements SessionStorage {
6
6
  [key: string]: unknown;
7
7
  } | undefined>;
8
8
  readonly deleteCallback: (id: string) => Promise<boolean>;
9
+ readonly deleteSessionsCallback?: ((ids: string[]) => Promise<boolean>) | undefined;
10
+ readonly findSessionsByShopCallback?: ((shop: string) => Promise<SessionInterface[]>) | undefined;
9
11
  constructor(storeCallback: (session: SessionInterface) => Promise<boolean>, loadCallback: (id: string) => Promise<SessionInterface | {
10
12
  [key: string]: unknown;
11
- } | undefined>, deleteCallback: (id: string) => Promise<boolean>);
13
+ } | undefined>, deleteCallback: (id: string) => Promise<boolean>, deleteSessionsCallback?: ((ids: string[]) => Promise<boolean>) | undefined, findSessionsByShopCallback?: ((shop: string) => Promise<SessionInterface[]>) | undefined);
12
14
  storeSession(session: SessionInterface): Promise<boolean>;
13
15
  loadSession(id: string): Promise<SessionInterface | undefined>;
14
16
  deleteSession(id: string): Promise<boolean>;
17
+ deleteSessions(ids: string[]): Promise<boolean>;
18
+ findSessionsByShop(shop: string): Promise<SessionInterface[]>;
15
19
  }
16
20
  //# sourceMappingURL=custom.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"custom.d.ts","sourceRoot":"","sources":["../../../../src/auth/session/storage/custom.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,gBAAgB,EAAC,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAC,cAAc,EAAC,MAAM,oBAAoB,CAAC;AAGlD,qBAAa,oBAAqB,YAAW,cAAc;IAEvD,QAAQ,CAAC,aAAa,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC,OAAO,CAAC;IACvE,QAAQ,CAAC,YAAY,EAAE,CACrB,EAAE,EAAE,MAAM,KACP,OAAO,CAAC,gBAAgB,GAAG;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAC,GAAG,SAAS,CAAC;IACrE,QAAQ,CAAC,cAAc,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC;gBAJhD,aAAa,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC,OAAO,CAAC,EAC9D,YAAY,EAAE,CACrB,EAAE,EAAE,MAAM,KACP,OAAO,CAAC,gBAAgB,GAAG;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAC,GAAG,SAAS,CAAC,EAC5D,cAAc,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC;IAO9C,YAAY,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;IAUzD,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;IA0C9D,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CASzD"}
1
+ {"version":3,"file":"custom.d.ts","sourceRoot":"","sources":["../../../../src/auth/session/storage/custom.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,gBAAgB,EAAC,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAC,cAAc,EAAC,MAAM,oBAAoB,CAAC;AAGlD,qBAAa,oBAAqB,YAAW,cAAc;IAEvD,QAAQ,CAAC,aAAa,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC,OAAO,CAAC;IACvE,QAAQ,CAAC,YAAY,EAAE,CACrB,EAAE,EAAE,MAAM,KACP,OAAO,CAAC,gBAAgB,GAAG;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAC,GAAG,SAAS,CAAC;IACrE,QAAQ,CAAC,cAAc,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC;IACzD,QAAQ,CAAC,sBAAsB,CAAC,SAAQ,MAAM,EAAE,KAAK,QAAQ,OAAO,CAAC;IACrE,QAAQ,CAAC,0BAA0B,CAAC,UAC5B,MAAM,KACT,QAAQ,gBAAgB,EAAE,CAAC;gBARvB,aAAa,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC,OAAO,CAAC,EAC9D,YAAY,EAAE,CACrB,EAAE,EAAE,MAAM,KACP,OAAO,CAAC,gBAAgB,GAAG;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAC,GAAG,SAAS,CAAC,EAC5D,cAAc,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,EAChD,sBAAsB,CAAC,SAAQ,MAAM,EAAE,KAAK,QAAQ,OAAO,CAAC,aAAA,EAC5D,0BAA0B,CAAC,UAC5B,MAAM,KACT,QAAQ,gBAAgB,EAAE,CAAC,aAAA;IASrB,YAAY,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;IAUzD,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;IA0C9D,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAU3C,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IAiB/C,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;CAkB3E"}
@@ -5,13 +5,17 @@ var tslib_1 = require("tslib");
5
5
  var session_1 = require("../session");
6
6
  var ShopifyErrors = tslib_1.__importStar(require("../../../error"));
7
7
  var CustomSessionStorage = /** @class */ (function () {
8
- function CustomSessionStorage(storeCallback, loadCallback, deleteCallback) {
8
+ function CustomSessionStorage(storeCallback, loadCallback, deleteCallback, deleteSessionsCallback, findSessionsByShopCallback) {
9
9
  this.storeCallback = storeCallback;
10
10
  this.loadCallback = loadCallback;
11
11
  this.deleteCallback = deleteCallback;
12
+ this.deleteSessionsCallback = deleteSessionsCallback;
13
+ this.findSessionsByShopCallback = findSessionsByShopCallback;
12
14
  this.storeCallback = storeCallback;
13
15
  this.loadCallback = loadCallback;
14
16
  this.deleteCallback = deleteCallback;
17
+ this.deleteSessionsCallback = deleteSessionsCallback;
18
+ this.findSessionsByShopCallback = findSessionsByShopCallback;
15
19
  }
16
20
  CustomSessionStorage.prototype.storeSession = function (session) {
17
21
  return tslib_1.__awaiter(this, void 0, void 0, function () {
@@ -89,6 +93,57 @@ var CustomSessionStorage = /** @class */ (function () {
89
93
  });
90
94
  });
91
95
  };
96
+ CustomSessionStorage.prototype.deleteSessions = function (ids) {
97
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
98
+ var error_4;
99
+ return tslib_1.__generator(this, function (_a) {
100
+ switch (_a.label) {
101
+ case 0:
102
+ if (!this.deleteSessionsCallback) return [3 /*break*/, 5];
103
+ _a.label = 1;
104
+ case 1:
105
+ _a.trys.push([1, 3, , 4]);
106
+ return [4 /*yield*/, this.deleteSessionsCallback(ids)];
107
+ case 2: return [2 /*return*/, _a.sent()];
108
+ case 3:
109
+ error_4 = _a.sent();
110
+ throw new ShopifyErrors.SessionStorageError("CustomSessionStorage failed to delete array of sessions. Error Details: ".concat(error_4));
111
+ case 4: return [3 /*break*/, 6];
112
+ case 5:
113
+ console.warn("CustomSessionStorage failed to delete array of sessions. Error Details: deleteSessionsCallback not defined.");
114
+ _a.label = 6;
115
+ case 6: return [2 /*return*/, false];
116
+ }
117
+ });
118
+ });
119
+ };
120
+ CustomSessionStorage.prototype.findSessionsByShop = function (shop) {
121
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
122
+ var sessions, error_5;
123
+ return tslib_1.__generator(this, function (_a) {
124
+ switch (_a.label) {
125
+ case 0:
126
+ sessions = [];
127
+ if (!this.findSessionsByShopCallback) return [3 /*break*/, 5];
128
+ _a.label = 1;
129
+ case 1:
130
+ _a.trys.push([1, 3, , 4]);
131
+ return [4 /*yield*/, this.findSessionsByShopCallback(shop)];
132
+ case 2:
133
+ sessions = _a.sent();
134
+ return [3 /*break*/, 4];
135
+ case 3:
136
+ error_5 = _a.sent();
137
+ throw new ShopifyErrors.SessionStorageError("CustomSessionStorage failed to find sessions by shop. Error Details: ".concat(error_5));
138
+ case 4: return [3 /*break*/, 6];
139
+ case 5:
140
+ console.warn("CustomSessionStorage failed to find sessions by shop. Error Details: findSessionsByShopCallback not defined.");
141
+ _a.label = 6;
142
+ case 6: return [2 /*return*/, sessions];
143
+ }
144
+ });
145
+ });
146
+ };
92
147
  return CustomSessionStorage;
93
148
  }());
94
149
  exports.CustomSessionStorage = CustomSessionStorage;
@@ -5,5 +5,7 @@ export declare class MemorySessionStorage implements SessionStorage {
5
5
  storeSession(session: SessionInterface): Promise<boolean>;
6
6
  loadSession(id: string): Promise<SessionInterface | undefined>;
7
7
  deleteSession(id: string): Promise<boolean>;
8
+ deleteSessions(ids: string[]): Promise<boolean>;
9
+ findSessionsByShop(shop: string): Promise<SessionInterface[]>;
8
10
  }
9
11
  //# sourceMappingURL=memory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../../../src/auth/session/storage/memory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAC,cAAc,EAAC,MAAM,oBAAoB,CAAC;AAElD,qBAAa,oBAAqB,YAAW,cAAc;IACzD,OAAO,CAAC,QAAQ,CAAwC;IAE3C,YAAY,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;IAKzD,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;IAI9D,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAMzD"}
1
+ {"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../../../src/auth/session/storage/memory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAC,cAAc,EAAC,MAAM,oBAAoB,CAAC;AAElD,qBAAa,oBAAqB,YAAW,cAAc;IACzD,OAAO,CAAC,QAAQ,CAAwC;IAE3C,YAAY,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;IAKzD,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;IAI9D,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAO3C,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IAK/C,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;CAM3E"}
@@ -31,6 +31,24 @@ var MemorySessionStorage = /** @class */ (function () {
31
31
  });
32
32
  });
33
33
  };
34
+ MemorySessionStorage.prototype.deleteSessions = function (ids) {
35
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
36
+ var _this = this;
37
+ return tslib_1.__generator(this, function (_a) {
38
+ ids.forEach(function (id) { return delete _this.sessions[id]; });
39
+ return [2 /*return*/, true];
40
+ });
41
+ });
42
+ };
43
+ MemorySessionStorage.prototype.findSessionsByShop = function (shop) {
44
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
45
+ var results;
46
+ return tslib_1.__generator(this, function (_a) {
47
+ results = Object.values(this.sessions).filter(function (session) { return session.shop === shop; });
48
+ return [2 /*return*/, results];
49
+ });
50
+ });
51
+ };
34
52
  return MemorySessionStorage;
35
53
  }());
36
54
  exports.MemorySessionStorage = MemorySessionStorage;