@delopay/sdk 0.499.0 → 0.503.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 (349) hide show
  1. package/dist/airwallexCard.cjs.map +1 -1
  2. package/dist/branding.cjs.map +1 -1
  3. package/dist/cardFormStyles.cjs.map +1 -1
  4. package/dist/checkoutSession.cjs +2 -2
  5. package/dist/checkoutSession.cjs.map +1 -1
  6. package/dist/checkoutSession.js +1 -1
  7. package/dist/chunk-244VZFFO.cjs.map +1 -1
  8. package/dist/chunk-2IJRBJXW.cjs.map +1 -1
  9. package/dist/{chunk-I5KOMBQ3.js → chunk-2OJJ3KGP.js} +25 -1
  10. package/dist/chunk-2OJJ3KGP.js.map +1 -0
  11. package/dist/chunk-34PC72O7.cjs.map +1 -1
  12. package/dist/chunk-3GBWQWTP.cjs.map +1 -1
  13. package/dist/chunk-3YBBJT3Y.cjs.map +1 -1
  14. package/dist/chunk-44QBWVRS.cjs.map +1 -1
  15. package/dist/chunk-4EKAWNYI.cjs.map +1 -1
  16. package/dist/chunk-4LN4BR2T.cjs.map +1 -1
  17. package/dist/chunk-4T4XHPYN.cjs.map +1 -1
  18. package/dist/chunk-575SNLIT.cjs.map +1 -1
  19. package/dist/chunk-5CITBN33.cjs.map +1 -1
  20. package/dist/chunk-5HCKC4HF.cjs.map +1 -1
  21. package/dist/chunk-5O2JSQYA.cjs.map +1 -1
  22. package/dist/chunk-5QS67SBO.cjs.map +1 -1
  23. package/dist/chunk-6EBY2KKL.cjs.map +1 -1
  24. package/dist/chunk-6LFOM6HV.cjs.map +1 -1
  25. package/dist/chunk-6LOWE2YI.cjs.map +1 -1
  26. package/dist/chunk-6LSG5Z4T.cjs.map +1 -1
  27. package/dist/chunk-6SU2MTN2.cjs.map +1 -1
  28. package/dist/chunk-6YCDLSIU.cjs.map +1 -1
  29. package/dist/chunk-75E5WNJG.cjs.map +1 -1
  30. package/dist/chunk-7JV6VVO7.cjs.map +1 -1
  31. package/dist/{chunk-OEREK6NU.js → chunk-7N4OLAWY.js} +98 -1
  32. package/dist/chunk-7N4OLAWY.js.map +1 -0
  33. package/dist/chunk-7NKJD5ST.cjs.map +1 -1
  34. package/dist/chunk-7QZCUXWB.cjs.map +1 -1
  35. package/dist/chunk-7VXF5D67.cjs.map +1 -1
  36. package/dist/chunk-ABWAYMN5.cjs.map +1 -1
  37. package/dist/chunk-ACZ2R47X.cjs.map +1 -1
  38. package/dist/chunk-AYUYJO3I.cjs.map +1 -1
  39. package/dist/chunk-BCA3TCGS.cjs.map +1 -1
  40. package/dist/{chunk-FLQ3K6Y6.js → chunk-BN5SIRFO.js} +2 -2
  41. package/dist/chunk-BN5SIRFO.js.map +1 -0
  42. package/dist/chunk-BP6KDQ6I.cjs.map +1 -1
  43. package/dist/chunk-BRY3W7N3.cjs.map +1 -1
  44. package/dist/chunk-BT3UAUEV.cjs.map +1 -1
  45. package/dist/chunk-CCN44NZJ.cjs.map +1 -1
  46. package/dist/chunk-CR3JBTP3.cjs.map +1 -1
  47. package/dist/chunk-DJASVBOJ.cjs.map +1 -1
  48. package/dist/chunk-EEB2HDYL.cjs.map +1 -1
  49. package/dist/chunk-ENPSUWTS.cjs.map +1 -1
  50. package/dist/chunk-EQ6P6ZND.cjs.map +1 -1
  51. package/dist/chunk-EXPWQBI3.cjs.map +1 -1
  52. package/dist/chunk-EYHSXJMJ.cjs.map +1 -1
  53. package/dist/chunk-F3I5DOWV.cjs.map +1 -1
  54. package/dist/chunk-F46K5H3U.cjs.map +1 -1
  55. package/dist/chunk-F6QJB4XP.cjs.map +1 -1
  56. package/dist/chunk-F6S3WCCB.cjs.map +1 -1
  57. package/dist/chunk-FQRC4NJG.cjs.map +1 -1
  58. package/dist/chunk-FTWGI7UZ.cjs.map +1 -1
  59. package/dist/chunk-FYISDU2Y.cjs.map +1 -1
  60. package/dist/chunk-GG52SAHA.cjs.map +1 -1
  61. package/dist/chunk-GK5FWN4H.cjs.map +1 -1
  62. package/dist/chunk-GSQN5EOO.cjs.map +1 -1
  63. package/dist/chunk-GW7IHYXR.cjs.map +1 -1
  64. package/dist/chunk-GWSVQXEY.cjs.map +1 -1
  65. package/dist/chunk-HLKFUOAQ.cjs.map +1 -1
  66. package/dist/chunk-HLYGHP6F.cjs.map +1 -1
  67. package/dist/chunk-I2W7AO4B.cjs.map +1 -1
  68. package/dist/chunk-I2XGNALG.cjs.map +1 -1
  69. package/dist/chunk-IKXGA2Z5.cjs.map +1 -1
  70. package/dist/chunk-IR2LFKKA.cjs.map +1 -1
  71. package/dist/{chunk-BX2CT7FR.js → chunk-J3Y6EVBP.js} +84 -1
  72. package/dist/chunk-J3Y6EVBP.js.map +1 -0
  73. package/dist/chunk-J4ZB7MU4.cjs.map +1 -1
  74. package/dist/chunk-J5RPSRBQ.cjs.map +1 -1
  75. package/dist/chunk-JPPRDMTJ.cjs.map +1 -1
  76. package/dist/chunk-K5Q2H3VD.cjs.map +1 -1
  77. package/dist/chunk-KD5Y2YWK.cjs.map +1 -1
  78. package/dist/chunk-KJDMNF2T.cjs.map +1 -1
  79. package/dist/chunk-KLONGJCL.cjs.map +1 -1
  80. package/dist/chunk-LJ2EG6JK.cjs.map +1 -1
  81. package/dist/chunk-LLYY4TCZ.cjs.map +1 -1
  82. package/dist/chunk-LYIBTVK6.cjs.map +1 -1
  83. package/dist/chunk-M3HWE7KT.cjs.map +1 -1
  84. package/dist/chunk-M3SJHFT4.cjs.map +1 -1
  85. package/dist/chunk-MLG6NXI6.cjs.map +1 -1
  86. package/dist/chunk-MYAXAWBQ.cjs.map +1 -1
  87. package/dist/chunk-NFB3S2E6.cjs.map +1 -1
  88. package/dist/chunk-NX36HDXE.cjs.map +1 -1
  89. package/dist/chunk-NYL3BNHR.cjs.map +1 -1
  90. package/dist/chunk-O4AYHLQX.cjs.map +1 -1
  91. package/dist/{chunk-HSJABE7X.cjs → chunk-O7SQCN44.cjs} +13 -13
  92. package/dist/chunk-O7SQCN44.cjs.map +1 -0
  93. package/dist/chunk-OAEKP665.cjs.map +1 -1
  94. package/dist/chunk-ODPNVNYE.cjs.map +1 -1
  95. package/dist/chunk-OG2KJAYD.cjs.map +1 -1
  96. package/dist/chunk-OYZP6NF6.cjs.map +1 -1
  97. package/dist/chunk-P4UILJVU.cjs.map +1 -1
  98. package/dist/chunk-P7DYLUUI.cjs.map +1 -1
  99. package/dist/chunk-PKAE6AQT.cjs.map +1 -1
  100. package/dist/chunk-Q7M7DO7M.cjs.map +1 -1
  101. package/dist/chunk-QKUWFMZP.cjs.map +1 -1
  102. package/dist/{chunk-7H2VFIPS.js → chunk-QMZWH4LG.js} +5 -5
  103. package/dist/chunk-QRSA72B3.cjs.map +1 -1
  104. package/dist/chunk-QYNRNDIY.cjs.map +1 -1
  105. package/dist/chunk-R4GA6BVP.cjs.map +1 -1
  106. package/dist/chunk-R5VYSZ3Q.cjs.map +1 -1
  107. package/dist/{chunk-NULOAF7W.cjs → chunk-RBZZEW2H.cjs} +84 -1
  108. package/dist/chunk-RBZZEW2H.cjs.map +1 -0
  109. package/dist/chunk-RHFUXHQN.cjs.map +1 -1
  110. package/dist/{chunk-CAMALM35.cjs → chunk-RHT27R27.cjs} +25 -1
  111. package/dist/chunk-RHT27R27.cjs.map +1 -0
  112. package/dist/chunk-RI42IDRR.cjs.map +1 -1
  113. package/dist/chunk-S77LQWYC.cjs.map +1 -1
  114. package/dist/chunk-S7SBNOGS.cjs.map +1 -1
  115. package/dist/chunk-TMAJE5P2.cjs.map +1 -1
  116. package/dist/chunk-TNIJ6OSH.cjs.map +1 -1
  117. package/dist/{chunk-ZMJT2YPZ.cjs → chunk-TZXY7QJB.cjs} +9 -9
  118. package/dist/chunk-TZXY7QJB.cjs.map +1 -0
  119. package/dist/chunk-U3JK7NBG.cjs.map +1 -1
  120. package/dist/chunk-UGSM7RJ2.cjs.map +1 -1
  121. package/dist/chunk-UKLZAOLW.cjs.map +1 -1
  122. package/dist/chunk-UTCXNBID.cjs.map +1 -1
  123. package/dist/chunk-V47G7P6L.cjs.map +1 -1
  124. package/dist/chunk-VH5A6SMU.cjs.map +1 -1
  125. package/dist/chunk-VHMH4QMY.cjs.map +1 -1
  126. package/dist/chunk-VYC7WUM5.cjs.map +1 -1
  127. package/dist/{chunk-K3XXGAOR.cjs → chunk-W3HFS5KT.cjs} +3 -3
  128. package/dist/chunk-W3HFS5KT.cjs.map +1 -0
  129. package/dist/chunk-W457XUA6.cjs.map +1 -1
  130. package/dist/{chunk-CQQW5JU7.js → chunk-W4AW52WT.js} +2 -2
  131. package/dist/{chunk-DDXERBGG.js → chunk-W7KJTMAF.js} +12 -1
  132. package/dist/{chunk-PYNHK6AP.cjs.map → chunk-W7KJTMAF.js.map} +1 -1
  133. package/dist/chunk-WHDI3TMP.cjs.map +1 -1
  134. package/dist/chunk-WITCPKNL.cjs.map +1 -1
  135. package/dist/chunk-WX6NP7UU.cjs.map +1 -1
  136. package/dist/chunk-XQLRIBVR.cjs.map +1 -1
  137. package/dist/chunk-Y7LSSRNJ.cjs.map +1 -1
  138. package/dist/chunk-YK3P5QNZ.cjs.map +1 -1
  139. package/dist/{chunk-YFRAI34Y.cjs → chunk-YRGIXGGW.cjs} +98 -1
  140. package/dist/chunk-YRGIXGGW.cjs.map +1 -0
  141. package/dist/chunk-YW4DVKNT.cjs.map +1 -1
  142. package/dist/{chunk-PYNHK6AP.cjs → chunk-Z7AVB6VI.cjs} +12 -1
  143. package/dist/chunk-Z7AVB6VI.cjs.map +1 -0
  144. package/dist/chunk-ZGMIHHGL.cjs.map +1 -1
  145. package/dist/chunk-ZKPVUCQV.cjs.map +1 -1
  146. package/dist/chunk-ZUULK36E.cjs.map +1 -1
  147. package/dist/client.cjs +3 -3
  148. package/dist/client.cjs.map +1 -1
  149. package/dist/client.js +2 -2
  150. package/dist/core.cjs +2 -2
  151. package/dist/core.cjs.map +1 -1
  152. package/dist/core.d.cts +8 -0
  153. package/dist/core.d.ts +8 -0
  154. package/dist/core.js +1 -1
  155. package/dist/currencies.cjs.map +1 -1
  156. package/dist/enigmaCardForm.cjs.map +1 -1
  157. package/dist/error.cjs.map +1 -1
  158. package/dist/eventStream.cjs.map +1 -1
  159. package/dist/exportDownload.cjs.map +1 -1
  160. package/dist/feeProgram.cjs.map +1 -1
  161. package/dist/index.cjs +7 -7
  162. package/dist/index.cjs.map +1 -1
  163. package/dist/index.d.cts +1 -1
  164. package/dist/index.d.ts +1 -1
  165. package/dist/index.js +6 -6
  166. package/dist/internal/resources/admin.cjs.map +1 -1
  167. package/dist/internal/resources/admin.d.cts +1 -1
  168. package/dist/internal/resources/admin.d.ts +1 -1
  169. package/dist/internal/resources/adminBranding.cjs.map +1 -1
  170. package/dist/internal/resources/adminBranding.d.cts +1 -1
  171. package/dist/internal/resources/adminBranding.d.ts +1 -1
  172. package/dist/internal/resources/adminCheckoutDomains.cjs.map +1 -1
  173. package/dist/internal/resources/adminCheckoutDomains.d.cts +1 -1
  174. package/dist/internal/resources/adminCheckoutDomains.d.ts +1 -1
  175. package/dist/internal/resources/adminFeePlans.cjs.map +1 -1
  176. package/dist/internal/resources/adminFeePlans.d.cts +1 -1
  177. package/dist/internal/resources/adminFeePlans.d.ts +1 -1
  178. package/dist/internal/resources/adminFileScans.cjs.map +1 -1
  179. package/dist/internal/resources/adminFileScans.d.cts +1 -1
  180. package/dist/internal/resources/adminFileScans.d.ts +1 -1
  181. package/dist/internal/resources/adminIndustries.cjs.map +1 -1
  182. package/dist/internal/resources/adminIndustries.d.cts +1 -1
  183. package/dist/internal/resources/adminIndustries.d.ts +1 -1
  184. package/dist/internal/resources/adminLive.cjs.map +1 -1
  185. package/dist/internal/resources/adminNotices.cjs.map +1 -1
  186. package/dist/internal/resources/adminNotices.d.cts +1 -1
  187. package/dist/internal/resources/adminNotices.d.ts +1 -1
  188. package/dist/internal/resources/adminPortal.cjs +2 -2
  189. package/dist/internal/resources/adminPortal.cjs.map +1 -1
  190. package/dist/internal/resources/adminPortal.d.cts +64 -1
  191. package/dist/internal/resources/adminPortal.d.ts +64 -1
  192. package/dist/internal/resources/adminPortal.js +1 -1
  193. package/dist/internal/resources/adminPricing.cjs.map +1 -1
  194. package/dist/internal/resources/adminPricing.d.cts +1 -1
  195. package/dist/internal/resources/adminPricing.d.ts +1 -1
  196. package/dist/internal/resources/adminSupport.cjs.map +1 -1
  197. package/dist/internal/resources/adminSupport.d.cts +1 -1
  198. package/dist/internal/resources/adminSupport.d.ts +1 -1
  199. package/dist/internal/resources/auditLogs.cjs.map +1 -1
  200. package/dist/internal/resources/auditLogs.d.cts +1 -1
  201. package/dist/internal/resources/auditLogs.d.ts +1 -1
  202. package/dist/internal/resources/cache.cjs.map +1 -1
  203. package/dist/internal/resources/cardIssuers.cjs.map +1 -1
  204. package/dist/internal/resources/cardIssuers.d.cts +1 -1
  205. package/dist/internal/resources/cardIssuers.d.ts +1 -1
  206. package/dist/internal/resources/configs.cjs.map +1 -1
  207. package/dist/internal/resources/connectorRestrictionRules.cjs.map +1 -1
  208. package/dist/internal/resources/connectorRestrictionRules.d.cts +1 -1
  209. package/dist/internal/resources/connectorRestrictionRules.d.ts +1 -1
  210. package/dist/internal/resources/connectorRestrictions.cjs.map +1 -1
  211. package/dist/internal/resources/connectorRestrictions.d.cts +1 -1
  212. package/dist/internal/resources/connectorRestrictions.d.ts +1 -1
  213. package/dist/internal/resources/diagnostic.cjs.map +1 -1
  214. package/dist/internal/resources/diagnostic.d.cts +1 -1
  215. package/dist/internal/resources/diagnostic.d.ts +1 -1
  216. package/dist/internal/resources/gsm.cjs.map +1 -1
  217. package/dist/internal/resources/gsm.d.cts +1 -1
  218. package/dist/internal/resources/gsm.d.ts +1 -1
  219. package/dist/internal/resources/nativeRenewals.cjs.map +1 -1
  220. package/dist/internal/resources/nativeRenewals.d.cts +1 -1
  221. package/dist/internal/resources/nativeRenewals.d.ts +1 -1
  222. package/dist/internal/resources/platformBilling.cjs.map +1 -1
  223. package/dist/internal/resources/platformBilling.d.cts +1 -1
  224. package/dist/internal/resources/platformBilling.d.ts +1 -1
  225. package/dist/internal/resources/platformFees.cjs.map +1 -1
  226. package/dist/internal/resources/platformMessageTemplates.cjs.map +1 -1
  227. package/dist/internal/resources/platformSettings.cjs.map +1 -1
  228. package/dist/internal/resources/platformSettings.d.cts +1 -1
  229. package/dist/internal/resources/platformSettings.d.ts +1 -1
  230. package/dist/internal.cjs +10 -10
  231. package/dist/internal.cjs.map +1 -1
  232. package/dist/internal.d.cts +2 -2
  233. package/dist/internal.d.ts +2 -2
  234. package/dist/internal.js +7 -7
  235. package/dist/listQuery.cjs.map +1 -1
  236. package/dist/panes.cjs.map +1 -1
  237. package/dist/paymentPresentation.cjs.map +1 -1
  238. package/dist/recordCounter.cjs.map +1 -1
  239. package/dist/resources/aiTools.cjs.map +1 -1
  240. package/dist/resources/analytics.cjs.map +1 -1
  241. package/dist/resources/analyticsDashboard.cjs.map +1 -1
  242. package/dist/resources/apiKeys.cjs.map +1 -1
  243. package/dist/resources/audit.cjs.map +1 -1
  244. package/dist/resources/authentication.cjs.map +1 -1
  245. package/dist/resources/availabilityOverrides.cjs.map +1 -1
  246. package/dist/resources/billing.cjs.map +1 -1
  247. package/dist/resources/buyerAccount.cjs.map +1 -1
  248. package/dist/resources/buyerBlocklist.cjs.map +1 -1
  249. package/dist/resources/buyerConversations.cjs.map +1 -1
  250. package/dist/resources/buyerEvidenceReviews.cjs.map +1 -1
  251. package/dist/resources/buyerPortal.cjs +2 -2
  252. package/dist/resources/buyerPortal.cjs.map +1 -1
  253. package/dist/resources/buyerPortal.d.cts +7 -1
  254. package/dist/resources/buyerPortal.d.ts +7 -1
  255. package/dist/resources/buyerPortal.js +1 -1
  256. package/dist/resources/cards.cjs.map +1 -1
  257. package/dist/resources/chargebackPrevention.cjs.map +1 -1
  258. package/dist/resources/checkoutDomains.cjs.map +1 -1
  259. package/dist/resources/checkoutMethods.cjs.map +1 -1
  260. package/dist/resources/checkoutRecovery.cjs.map +1 -1
  261. package/dist/resources/checkoutTemplates.cjs.map +1 -1
  262. package/dist/resources/connectors.cjs.map +1 -1
  263. package/dist/resources/contentEncryption.cjs.map +1 -1
  264. package/dist/resources/costRules.cjs.map +1 -1
  265. package/dist/resources/customers.cjs.map +1 -1
  266. package/dist/resources/deploymentBranding.cjs.map +1 -1
  267. package/dist/resources/disputes.cjs.map +1 -1
  268. package/dist/resources/ephemeralKeys.cjs.map +1 -1
  269. package/dist/resources/events.cjs.map +1 -1
  270. package/dist/resources/export.cjs.map +1 -1
  271. package/dist/resources/externalRecords.cjs.map +1 -1
  272. package/dist/resources/featureMatrix.cjs.map +1 -1
  273. package/dist/resources/fees.cjs.map +1 -1
  274. package/dist/resources/files.cjs.map +1 -1
  275. package/dist/resources/forex.cjs.map +1 -1
  276. package/dist/resources/identityVerifications.cjs.map +1 -1
  277. package/dist/resources/industries.cjs.map +1 -1
  278. package/dist/resources/invoiceSettings.cjs.map +1 -1
  279. package/dist/resources/invoices.cjs.map +1 -1
  280. package/dist/resources/live.cjs.map +1 -1
  281. package/dist/resources/mandates.cjs.map +1 -1
  282. package/dist/resources/merchantAccounts.cjs.map +1 -1
  283. package/dist/resources/messageTemplates.cjs.map +1 -1
  284. package/dist/resources/notices.cjs.map +1 -1
  285. package/dist/resources/operationLimits.cjs.map +1 -1
  286. package/dist/resources/paymentLinks.cjs.map +1 -1
  287. package/dist/resources/paymentMethods.cjs.map +1 -1
  288. package/dist/resources/payments.cjs.map +1 -1
  289. package/dist/resources/payoutDestinations.cjs.map +1 -1
  290. package/dist/resources/payouts.cjs.map +1 -1
  291. package/dist/resources/paypalDisputes.cjs.map +1 -1
  292. package/dist/resources/persons.cjs.map +1 -1
  293. package/dist/resources/poll.cjs.map +1 -1
  294. package/dist/resources/processorCosts.cjs.map +1 -1
  295. package/dist/resources/processorImports.cjs.map +1 -1
  296. package/dist/resources/products.cjs.map +1 -1
  297. package/dist/resources/profileAcquirers.cjs.map +1 -1
  298. package/dist/resources/profiles.cjs.map +1 -1
  299. package/dist/resources/projects.cjs.map +1 -1
  300. package/dist/resources/refunds.cjs.map +1 -1
  301. package/dist/resources/regions.cjs.map +1 -1
  302. package/dist/resources/relay.cjs.map +1 -1
  303. package/dist/resources/risk.cjs.map +1 -1
  304. package/dist/resources/routing.cjs.map +1 -1
  305. package/dist/resources/search.cjs.map +1 -1
  306. package/dist/resources/sellToRestrictions.cjs.map +1 -1
  307. package/dist/resources/settings.cjs.map +1 -1
  308. package/dist/resources/settlement.cjs.map +1 -1
  309. package/dist/resources/shareLinks.cjs.map +1 -1
  310. package/dist/resources/shopLabels.cjs.map +1 -1
  311. package/dist/resources/shopify.cjs +2 -2
  312. package/dist/resources/shopify.cjs.map +1 -1
  313. package/dist/resources/shopify.d.cts +66 -4
  314. package/dist/resources/shopify.d.ts +66 -4
  315. package/dist/resources/shopify.js +1 -1
  316. package/dist/resources/shops.cjs.map +1 -1
  317. package/dist/resources/stripeConnect.cjs.map +1 -1
  318. package/dist/resources/subscriptions.cjs +2 -2
  319. package/dist/resources/subscriptions.cjs.map +1 -1
  320. package/dist/resources/subscriptions.d.cts +6 -1
  321. package/dist/resources/subscriptions.d.ts +6 -1
  322. package/dist/resources/subscriptions.js +1 -1
  323. package/dist/resources/support.cjs.map +1 -1
  324. package/dist/resources/threeDsRules.cjs.map +1 -1
  325. package/dist/resources/users.cjs.map +1 -1
  326. package/dist/resources/vatRates.cjs.map +1 -1
  327. package/dist/resources/verification.cjs.map +1 -1
  328. package/dist/resources/webhooks.cjs.map +1 -1
  329. package/dist/resources/whopResolutionCases.cjs.map +1 -1
  330. package/dist/trustedOrigins.cjs.map +1 -1
  331. package/dist/{types-SEJjet2B.d.ts → types-DWl8-llD.d.cts} +201 -2
  332. package/dist/{types-FHqOLCyI.d.cts → types-m2Cm6l0z.d.ts} +201 -2
  333. package/dist/types.cjs.map +1 -1
  334. package/dist/types.d.cts +332 -3
  335. package/dist/types.d.ts +332 -3
  336. package/package.json +17 -19
  337. package/dist/chunk-BX2CT7FR.js.map +0 -1
  338. package/dist/chunk-CAMALM35.cjs.map +0 -1
  339. package/dist/chunk-DDXERBGG.js.map +0 -1
  340. package/dist/chunk-FLQ3K6Y6.js.map +0 -1
  341. package/dist/chunk-HSJABE7X.cjs.map +0 -1
  342. package/dist/chunk-I5KOMBQ3.js.map +0 -1
  343. package/dist/chunk-K3XXGAOR.cjs.map +0 -1
  344. package/dist/chunk-NULOAF7W.cjs.map +0 -1
  345. package/dist/chunk-OEREK6NU.js.map +0 -1
  346. package/dist/chunk-YFRAI34Y.cjs.map +0 -1
  347. package/dist/chunk-ZMJT2YPZ.cjs.map +0 -1
  348. /package/dist/{chunk-7H2VFIPS.js.map → chunk-QMZWH4LG.js.map} +0 -0
  349. /package/dist/{chunk-CQQW5JU7.js.map → chunk-W4AW52WT.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core.ts"],"sourcesContent":["import { DelopayError, DelopayAuthenticationError } from './error';\nimport { EventStreamParser } from './eventStream';\nimport type { EventStreamDispatch } from './eventStream';\nimport type { TokenResponse } from './types';\n\nexport { DelopayError, DelopayAuthenticationError } from './error';\n\nconst PRODUCTION_URL = 'https://api.delopay.net';\nconst SANDBOX_URL = 'https://sandbox.delopay.net/api';\n\nconst MAX_RAW_BODY_BYTES = 2048;\nconst MAX_RETRY_AFTER_MS = 30_000;\n\nfunction parseRetryAfter(header: string | null): number | null {\n if (!header) return null;\n const trimmed = header.trim();\n const seconds = Number(trimmed);\n if (Number.isFinite(seconds) && seconds >= 0) {\n return Math.min(seconds * 1000, MAX_RETRY_AFTER_MS);\n }\n const date = Date.parse(trimmed);\n if (Number.isFinite(date)) {\n const delta = date - Date.now();\n return delta > 0 ? Math.min(delta, MAX_RETRY_AFTER_MS) : 0;\n }\n return null;\n}\n\nfunction truncateRawBody(raw: string): string | undefined {\n if (!raw) return undefined;\n return raw.length > MAX_RAW_BODY_BYTES ? raw.slice(0, MAX_RAW_BODY_BYTES) + '…' : raw;\n}\n\n/**\n * The error a non-2xx response stands for, read off its body.\n *\n * The API wraps errors as `{ error: { message, code, type, data? } }`; a body\n * that is not JSON (an HTML 502 from a proxy) is kept, truncated, as\n * `rawBody`. A 401 is a {@link DelopayAuthenticationError} unless it is a\n * connector's passthrough.\n */\nasync function errorFromResponse(\n response: Response,\n requestId: string | undefined,\n): Promise<DelopayError> {\n const rawBody = await response.text().catch(() => '');\n let parsed: Record<string, unknown> = {};\n if (rawBody) {\n try {\n parsed = JSON.parse(rawBody) as Record<string, unknown>;\n } catch {\n // non-JSON error body (HTML from a proxy, truncated stream, etc.) — keep raw\n }\n }\n // API wraps errors as { error: { message, code, type, data? } } — unwrap if present\n const err = (parsed.error as Record<string, unknown>) ?? parsed;\n const message = (err.message as string) ?? `Request failed with status ${response.status}`;\n const code = (err.code as string) ?? '';\n const type = (err.error_type as string) ?? (err.type as string) ?? '';\n const data =\n err.data && typeof err.data === 'object' && !Array.isArray(err.data)\n ? (err.data as Record<string, unknown>)\n : undefined;\n const truncatedRaw = truncateRawBody(rawBody);\n\n // A 401 usually means OUR credential (API key / JWT) was rejected —\n // but connector-passthrough errors (`CE_*` / type \"connector\", e.g.\n // a PSP rejecting the merchant's stored Stripe key) propagate the\n // upstream status and are NOT a Delopay authentication failure, so\n // they stay a plain DelopayError instead of triggering the\n // \"re-authenticate\" handling dashboards attach to auth errors.\n const isConnectorPassthrough = type === 'connector' || code.startsWith('CE_');\n if (response.status === 401 && !isConnectorPassthrough) {\n return new DelopayAuthenticationError(message, {\n code,\n type,\n requestId,\n rawBody: truncatedRaw,\n data,\n });\n }\n\n return new DelopayError(message, {\n status: response.status,\n code,\n type,\n requestId,\n rawBody: truncatedRaw,\n data,\n });\n}\n\nfunction findIdempotencyKey(headers: Record<string, string>): string | undefined {\n for (const [k, v] of Object.entries(headers)) {\n if (k.toLowerCase() === 'idempotency-key') return v;\n }\n return undefined;\n}\n\ninterface CombinedSignal {\n signal: AbortSignal;\n dispose: () => void;\n}\n\nfunction noop(): void {\n // Intentionally empty: no listeners registered, nothing to clean up.\n}\n\n/**\n * A `onDownloadProgress` listener threw. Carried out of the transport as-is so\n * the retry logic never mistakes the caller's own failure — a `TypeError` in a\n * progress bar, say — for a network error and downloads the body again.\n */\nclass ListenerFailure {\n constructor(readonly cause: unknown) {}\n}\n\n/**\n * The body stream failed after the headers arrived: the connection dropped, or\n * the server aborted it because it could not finish the body it had started.\n * Surfaced as the transport's ordinary network error, so it is retried on\n * exactly the same terms as a failure before the first byte.\n */\nclass BodyStreamFailure {\n constructor(readonly cause: unknown) {}\n}\n\nfunction abortError(): Error {\n const error = new Error('The operation was aborted');\n error.name = 'AbortError';\n return error;\n}\n\n/** `Content-Length` as a byte count, or `null` when absent or unreadable. */\nfunction parseContentLength(header: string | null): number | null {\n if (header === null || !/^\\s*\\d+\\s*$/.test(header)) return null;\n const value = Number(header);\n return Number.isSafeInteger(value) ? value : null;\n}\n\n/**\n * One `reader.read()`, raced against the request's signal.\n *\n * A conforming `fetch` errors the body stream itself when its signal aborts,\n * but not every stream a runtime or a polyfill hands back does, and a read\n * that never settles would hold a timed-out or cancelled download open for\n * good. The race makes the abort reach the reader either way.\n */\nfunction readChunk(\n reader: ReadableStreamDefaultReader<Uint8Array>,\n signal: AbortSignal,\n): Promise<ReadableStreamReadResult<Uint8Array>> {\n if (signal.aborted) return Promise.reject(abortError());\n return new Promise((resolve, reject) => {\n const onAbort = () => reject(abortError());\n signal.addEventListener('abort', onAbort, { once: true });\n reader.read().then(\n (result) => {\n signal.removeEventListener('abort', onAbort);\n resolve(result);\n },\n (cause: unknown) => {\n signal.removeEventListener('abort', onAbort);\n reject(signal.aborted ? abortError() : new BodyStreamFailure(cause));\n },\n );\n });\n}\n\n/** The chunks as one buffer of exactly `length` bytes. */\nfunction concatChunks(chunks: Uint8Array[], length: number): ArrayBuffer {\n const out = new Uint8Array(length);\n let offset = 0;\n for (const chunk of chunks) {\n out.set(chunk, offset);\n offset += chunk.byteLength;\n }\n return out.buffer;\n}\n\n/**\n * Read a 2xx body chunk by chunk, reporting each one, and decode it as\n * `responseType` asks — the `onDownloadProgress` path of `request()`.\n *\n * `onActivity` is called when the headers arrive and on every chunk; the\n * caller uses it to restart its idle timer.\n */\nasync function receiveWithProgress(\n response: Response,\n responseType: RequestOptions['responseType'],\n listener: (event: DownloadProgressEvent) => void,\n attempt: number,\n signal: AbortSignal,\n onActivity: () => void,\n): Promise<unknown> {\n const headers = response.headers ?? new Headers();\n const total = parseContentLength(headers.get('content-length'));\n let loaded = 0;\n const notify = (chunk: Uint8Array) => {\n try {\n // A copy: the request resolves to the bytes it read, whatever a\n // listener does with the ones it was shown.\n listener({ loaded, total, chunk: chunk.slice(), headers, attempt });\n } catch (cause) {\n throw new ListenerFailure(cause);\n }\n };\n\n onActivity();\n notify(new Uint8Array(0));\n\n const body = response.body;\n if (!body || typeof body.getReader !== 'function') {\n // No readable stream: a null-body status, or a runtime whose `fetch` does\n // not expose one. The body is read whole, and reported as one chunk.\n if (responseType === 'blob') {\n const blob = await response.blob();\n const bytes = new Uint8Array(await blob.arrayBuffer());\n loaded = bytes.byteLength;\n if (loaded > 0) notify(bytes);\n return blob;\n }\n if (responseType === 'arraybuffer') {\n const buffer = await response.arrayBuffer();\n loaded = buffer.byteLength;\n if (loaded > 0) notify(new Uint8Array(buffer));\n return buffer;\n }\n const text = await response.text();\n const bytes = new TextEncoder().encode(text);\n loaded = bytes.byteLength;\n if (loaded > 0) notify(bytes);\n return text ? JSON.parse(text) : undefined;\n }\n\n const reader = body.getReader();\n const chunks: Uint8Array[] = [];\n try {\n for (;;) {\n const { done, value } = await readChunk(reader, signal);\n if (done) break;\n if (!value || value.byteLength === 0) continue;\n chunks.push(value);\n loaded += value.byteLength;\n onActivity();\n notify(value);\n }\n } catch (err) {\n // Release the connection rather than leave a half-read body behind it.\n reader.cancel().catch(noop);\n throw err;\n }\n\n const bytes = concatChunks(chunks, loaded);\n if (responseType === 'blob') {\n return new Blob([bytes], { type: headers.get('content-type') ?? '' });\n }\n if (responseType === 'arraybuffer') {\n return bytes;\n }\n const text = new TextDecoder().decode(bytes);\n return text ? JSON.parse(text) : undefined;\n}\n\nfunction combineSignals(signals: AbortSignal[]): CombinedSignal {\n const controller = new AbortController();\n const listeners: { signal: AbortSignal; handler: () => void }[] = [];\n const dispose = () => {\n for (const { signal, handler } of listeners) {\n signal.removeEventListener('abort', handler);\n }\n listeners.length = 0;\n };\n for (const signal of signals) {\n if (signal.aborted) {\n controller.abort(signal.reason);\n dispose();\n return { signal: controller.signal, dispose: noop };\n }\n const handler = () => {\n controller.abort(signal.reason);\n dispose();\n };\n signal.addEventListener('abort', handler, { once: true });\n listeners.push({ signal, handler });\n }\n return { signal: controller.signal, dispose };\n}\n\n/**\n * Events emitted by the debug logger.\n * - `request` — about to send a request (`method`, `url`, `path`)\n * - `response` — response received (`status`, `method`, `path`, `requestId?`)\n * - `retry` — about to retry after a transient failure (`attempt`, `maxRetries`, `method`, `path`)\n */\nexport type DelopayLogger = (\n event: 'request' | 'response' | 'retry',\n data: Record<string, unknown>,\n) => void;\n\n/**\n * Configuration options for the Delopay client.\n */\nexport interface DelopayOptions {\n /**\n * Use the sandbox environment (`https://sandbox.delopay.net/api`). Defaults\n * to `false` (production). Request paths are appended to that address, so a\n * payment is created at `https://sandbox.delopay.net/api/payments`.\n */\n sandbox?: boolean;\n /** Override the base URL entirely. Takes precedence over `sandbox`. */\n baseUrl?: string;\n /** Request timeout in milliseconds. Defaults to `30000` (30 seconds). */\n timeout?: number;\n /**\n * Maximum number of automatic retries for transient failures (5xx, timeout, network errors).\n * Retries use exponential backoff. Set to `0` to disable. Defaults to `2`.\n * Only idempotent-safe requests (GET, DELETE, and requests with an `Idempotency-Key` header) are retried.\n */\n maxRetries?: number;\n /** Enable debug logging of requests and responses. Defaults to `false`. */\n debug?: boolean;\n /**\n * Custom logger for debug events (`request`, `response`, `retry`). When omitted,\n * debug output is written to `console.log`. Has no effect unless `debug` is `true`.\n * Useful for routing SDK logs through pino, winston, or similar structured loggers.\n */\n logger?: DelopayLogger;\n /**\n * The shop (business profile) every request acts on, sent as `X-Profile-Id`.\n * An API key bound to several shops must name one of them on every request;\n * create one client per shop. A header a call sets itself takes precedence.\n */\n profileId?: string;\n}\n\nconst SENSITIVE_QUERY_KEYS = new Set([\n 'client_secret',\n 'ephemeral_key',\n 'api_key',\n 'publishable_key',\n]);\n\n/**\n * Return a copy of `url` with the values of known-sensitive query parameters\n * replaced by `REDACTED`, leaving the rest of the query string intact.\n * Used only to sanitize URLs before they hit debug logs.\n */\nfunction redactUrlForLogging(url: string): string {\n const qIdx = url.indexOf('?');\n if (qIdx === -1) return url;\n const base = url.slice(0, qIdx);\n const query = url.slice(qIdx + 1);\n const parts = query.split('&').map((pair) => {\n const eqIdx = pair.indexOf('=');\n if (eqIdx === -1) return pair;\n const key = pair.slice(0, eqIdx);\n if (SENSITIVE_QUERY_KEYS.has(decodeURIComponent(key).toLowerCase())) {\n return `${key}=REDACTED`;\n }\n return pair;\n });\n return `${base}?${parts.join('&')}`;\n}\n\n/**\n * One step of a response body's download, reported to\n * {@link RequestOptions.onDownloadProgress}.\n */\nexport interface DownloadProgressEvent {\n /** Body bytes received so far on this attempt, `chunk` included. */\n loaded: number;\n /**\n * `Content-Length`, when the response carried one — a buffered body such as\n * a PDF. `null` for a streamed (chunked) body, whose size is not known\n * until it ends. With a compressed transfer it is the compressed size, so\n * `loaded` can pass it.\n */\n total: number | null;\n /**\n * The bytes this event reports. Empty on the first event of an attempt,\n * which fires as soon as the headers arrive, before any of the body.\n * A copy: changing it cannot change the value the request resolves to.\n */\n chunk: Uint8Array;\n /** The response headers, available from the first event on. */\n headers: Headers;\n /**\n * Which attempt this is, from `0`. A retried request reports its body\n * again from the start under the next number, so a listener that\n * accumulates state resets it when this changes.\n */\n attempt: number;\n}\n\n/**\n * Low-level options forwarded to a single HTTP request.\n */\nexport interface RequestOptions {\n /** Request body, serialised as JSON. */\n body?: unknown;\n /**\n * @internal Resource assertion that this operation deduplicates by the JSON\n * body's idempotency_key. Null means that optional key is absent, so the write\n * must not be retried. The transport checks the assertion against the body;\n * it does not send this option or copy a JSON key into an HTTP header.\n */\n bodyIdempotencyKey?: string | null;\n /**\n * @internal Resource assertion that this operation must be sent at most\n * once, even where its method is otherwise retried: a `DELETE` whose server\n * side guards against concurrent changes only within one request, so a\n * replay after a lost response could undo a newer change. The transport\n * then never retries it.\n */\n noRetry?: boolean;\n /**\n * Query-string parameters. `undefined` and `null` values are omitted.\n * Array values are emitted as repeated keys (`?tag=a&tag=b`) — not comma-joined.\n */\n query?: Record<\n string,\n string | number | boolean | null | undefined | (string | number | boolean)[]\n >;\n /** Additional HTTP headers merged with the default `api-key` header. */\n headers?: Record<string, string>;\n /**\n * Override the client-level timeout for this request, in milliseconds.\n *\n * Covers the whole request, body included — unless `onDownloadProgress` is\n * set, in which case it is an **idle** timeout: it restarts when the\n * headers arrive and on every chunk of the body, so a long download that\n * keeps making progress is never cut off, and one that stalls still is.\n */\n timeout?: number;\n /**\n * Caller-provided `AbortSignal`. Aborting it cancels the in-flight request and rejects\n * with a `DelopayError` carrying code `'ABORTED'`. Combined with the per-request timeout.\n */\n signal?: AbortSignal;\n /**\n * How to decode a 2xx response body. `'json'` (the default) parses JSON;\n * `'blob'` / `'arraybuffer'` return the raw bytes for binary endpoints\n * such as PDF exports. Error responses are always decoded as JSON and\n * thrown as `DelopayError` regardless of this setting.\n */\n responseType?: 'json' | 'blob' | 'arraybuffer';\n /**\n * Pass `keepalive: true` to let the request outlive its page — e.g.\n * telemetry sent while the document is navigating away. Browsers cap\n * keepalive request bodies at ~64 KiB and reject larger ones.\n */\n keepalive?: boolean;\n /**\n * Report a 2xx response body as it downloads. Called once as soon as the\n * headers arrive (with an empty `chunk` and `loaded: 0`), then once per\n * chunk of the body; the value the request resolves to is decoded from\n * those same bytes, per `responseType`. Error responses are not reported.\n *\n * Setting it turns `timeout` into an idle timeout (see there). A body that\n * fails part-way rejects with the ordinary `NETWORK` error and is retried\n * on the usual terms, starting again under the next `attempt`. A listener\n * that throws rejects the request with that error, unretried.\n */\n onDownloadProgress?: (event: DownloadProgressEvent) => void;\n}\n\nexport type RequestFn = <T>(method: string, path: string, options?: RequestOptions) => Promise<T>;\n\n/**\n * Per-call options that resource methods accept as an optional final argument:\n * extra HTTP headers (e.g. `Idempotency-Key`), a per-request timeout override,\n * an `AbortSignal` for cancellation, and a download-progress listener — the\n * last is what a file download (a statement PDF, a report CSV) reports its\n * bytes through.\n */\nexport type RequestExtras = Pick<\n RequestOptions,\n 'headers' | 'timeout' | 'signal' | 'onDownloadProgress'\n>;\n\n/** How long an event stream may stay silent before it is given up. */\nconst DEFAULT_STREAM_IDLE_TIMEOUT_MS = 45_000;\n\n/** Options of one `text/event-stream` request. */\nexport interface EventStreamRequestOptions {\n /** Query-string parameters, as {@link RequestOptions.query}. */\n query?: RequestOptions['query'];\n /** Additional HTTP headers, merged over the auth header. */\n headers?: Record<string, string>;\n /**\n * Aborting it before the response arrives rejects with code `ABORTED`;\n * aborting it later ends the dispatches without an error.\n */\n signal?: AbortSignal;\n /**\n * How long the stream may stay silent, response headers included, before\n * it fails with code `TIMEOUT`. Paused while the consumer holds a dispatch.\n * Defaults to 45 seconds.\n */\n idleTimeoutMs?: number;\n /** Sent as `Last-Event-ID`, and the id the stream starts from. */\n lastEventId?: string | null;\n}\n\n/**\n * An open event stream. Its body is read as it is iterated and never kept:\n * only the line and the event in progress are held.\n */\nexport interface EventStreamConnection {\n /**\n * The stream's dispatches, in order. Ends when the server closes the\n * stream or the caller aborts or closes it; throws a `DelopayError` with\n * code `TIMEOUT` when the stream is silent too long, and `NETWORK` when\n * the connection fails. Iterate it once.\n */\n readonly dispatches: AsyncIterable<EventStreamDispatch>;\n /** Close the stream: the iteration ends and the connection is released. */\n close(): void;\n}\n\n/** Opens a `GET` event stream; what resources that stream receive. */\nexport type EventStreamFn = (\n path: string,\n options?: EventStreamRequestOptions,\n) => Promise<EventStreamConnection>;\n\n/**\n * What a resource class is built from: the client's request and event-stream\n * functions. Every resource takes the request function first; the few that\n * stream (`Live`, `ProcessorImports`) also take the stream opener.\n */\nexport interface DelopayTransport {\n /** Send one request with the client's credentials, retries and timeout. */\n readonly request: RequestFn;\n /** Open one `text/event-stream` request with the client's credentials. */\n readonly openStream: EventStreamFn;\n /** The resolved base URL every request goes to. */\n readonly baseUrl: string;\n}\n\n/** A resource class that {@link DelopayCore.use} can build. */\nexport type ResourceConstructor<T> = new (request: RequestFn, openStream: EventStreamFn) => T;\n\n/**\n * The Delopay client without its resources: credentials, configuration,\n * transport, sessions and pagination.\n *\n * {@link Delopay} extends it with every resource as a property, which puts\n * every resource in the application's bundle. An application that wants only\n * the resources it calls builds them from this class instead, importing each\n * one from its own module, so a bundler leaves the rest out and can load each\n * one with the code that uses it:\n *\n * @example\n * ```typescript\n * import { DelopayCore } from '@delopay/sdk/core';\n * import { Refunds } from '@delopay/sdk/resources/refunds';\n *\n * const client = new DelopayCore('snd_...', { sandbox: true });\n * const refunds = client.use(Refunds);\n * const refund = await refunds.create({ payment_id: 'pay_abc123' });\n * ```\n *\n * A resource built this way shares the client's credentials: a token set with\n * {@link DelopayCore.setJwtToken} applies to it at once.\n */\nexport class DelopayCore {\n /** The resolved base URL used for all API requests. */\n readonly baseUrl: string;\n private readonly apiKey: string;\n private readonly timeout: number;\n private readonly maxRetries: number;\n private readonly debug: boolean;\n private readonly logger?: DelopayLogger;\n private readonly profileId?: string;\n private jwtToken?: string;\n\n /** The functions every resource is built from; see {@link DelopayCore.use}. */\n readonly transport: DelopayTransport;\n\n private readonly resources = new Map<ResourceConstructor<unknown>, unknown>();\n\n /**\n * Create a new client.\n *\n * @param apiKey - Your Delopay API key (e.g. `prd_...` or `snd_...`).\n * Pass an empty string or omit for JWT-only usage (e.g. dashboard apps).\n * @param options - Optional configuration (sandbox mode, base URL override, timeout).\n */\n constructor(apiKey?: string, options?: DelopayOptions) {\n this.apiKey = apiKey ?? '';\n this.timeout = options?.timeout ?? 30_000;\n this.maxRetries = options?.maxRetries ?? 2;\n this.debug = options?.debug ?? false;\n if (options?.logger !== undefined) this.logger = options.logger;\n if (options?.profileId !== undefined && options.profileId !== '') {\n this.profileId = options.profileId;\n }\n\n if (options?.baseUrl !== undefined) {\n this.baseUrl = options.baseUrl;\n } else if (options?.sandbox) {\n this.baseUrl = SANDBOX_URL;\n } else {\n this.baseUrl = PRODUCTION_URL;\n }\n\n this.transport = {\n request: this.request.bind(this) as RequestFn,\n openStream: this.openEventStream.bind(this),\n baseUrl: this.baseUrl,\n };\n }\n\n /**\n * The client's instance of a resource class, built on first use from this\n * client's transport. Later calls with the same class return the same\n * instance.\n *\n * A resource whose constructor takes something else besides the transport\n * (`Branding` takes the base URL) is built directly instead:\n * `new Branding(client.transport.request, client.baseUrl)`.\n *\n * @param Resource - The resource class, imported from its own module.\n * @returns The resource, bound to this client.\n */\n use<T>(Resource: ResourceConstructor<T>): T {\n let resource = this.resources.get(Resource) as T | undefined;\n if (resource === undefined) {\n resource = new Resource(this.transport.request, this.transport.openStream);\n this.resources.set(Resource, resource);\n }\n return resource;\n }\n\n /**\n * Set a JWT token for subsequent requests.\n * When set, requests use `Authorization: Bearer <token>` instead of `api-key`.\n * Useful after `users.signIn()` returns a JWT for dashboard operations.\n */\n setJwtToken(token: string): void {\n this.jwtToken = token;\n }\n\n /**\n * Clear the JWT token, reverting to API key authentication.\n */\n clearJwtToken(): void {\n this.jwtToken = undefined;\n }\n\n /**\n * End the current login session on the server (`POST /user/signout`), the\n * same request as {@link Users.signOut}. The token stays set on this\n * client: clear it with {@link DelopayCore.clearJwtToken} afterwards. The\n * request's `Authorization` header is built when this is called, so\n * clearing the token straight after still signs out the session it held.\n */\n async signOut(): Promise<Record<string, unknown>> {\n return this.request('POST', '/user/signout');\n }\n\n /**\n * Refresh the current login JWT (see {@link Users.refreshToken}) and\n * apply the fresh token to this client, so subsequent requests use it.\n * Returns the fresh token for the caller to persist (e.g. session\n * storage) — the backend has already re-set the `login_token` cookie.\n *\n * If the client's auth state changes while the refresh is pending —\n * `clearJwtToken()` on sign-out, or `setJwtToken()` switching to another\n * session — the stale completion is discarded and this rejects with a\n * `session_changed` `DelopayError` (status 0), so the explicit change\n * wins and the caller never persists a token for a session that is gone.\n *\n * Otherwise throws like any other request; in particular a 401 means the\n * session is dead (expired/blacklisted/revoked), a 429 means a refresh\n * was already minted for this session within the last minute, and a 400\n * means this token has no revocable session to slide (no `jti` — team\n * impersonation is the case in practice) and can never be refreshed,\n * though it stays valid for ordinary calls.\n */\n async refreshSession(): Promise<TokenResponse> {\n const originatingToken = this.jwtToken;\n const response = await this.request<TokenResponse>('POST', '/user/token/refresh');\n if (this.jwtToken !== originatingToken) {\n throw new DelopayError(\n 'Auth state changed while the refresh was pending; refreshed token discarded',\n {\n status: 0,\n code: 'session_changed',\n type: 'session_changed',\n },\n );\n }\n this.setJwtToken(response.token);\n return response;\n }\n\n /** `path` on the base URL, with the query string `query` makes. */\n private buildUrl(path: string, query?: RequestOptions['query']): string {\n let url = `${this.baseUrl}${path}`;\n if (query) {\n const params = new URLSearchParams();\n for (const [key, value] of Object.entries(query)) {\n if (value === undefined || value === null) continue;\n if (Array.isArray(value)) {\n for (const v of value) {\n if (v !== undefined && v !== null) params.append(key, String(v));\n }\n } else {\n params.set(key, String(value));\n }\n }\n const qs = params.toString();\n if (qs) {\n url += `?${qs}`;\n }\n }\n return url;\n }\n\n /** The credential header: the JWT when one is set, else the API key. */\n /**\n * The client's `X-Profile-Id`, unless the call names one itself (in any\n * letter case: two spellings would be sent as one joined value).\n */\n private profileHeaders(callHeaders?: Record<string, string>): Record<string, string> {\n if (this.profileId === undefined) return {};\n const named = Object.keys(callHeaders ?? {}).some(\n (name) => name.toLowerCase() === 'x-profile-id',\n );\n return named ? {} : { 'X-Profile-Id': this.profileId };\n }\n\n private authHeaders(): Record<string, string> {\n if (this.jwtToken) return { Authorization: `Bearer ${this.jwtToken}` };\n if (this.apiKey) return { 'api-key': this.apiKey };\n return {};\n }\n\n /** One debug event, when `debug` is on. */\n private log(event: 'request' | 'response' | 'retry', data: Record<string, unknown>): void {\n if (!this.debug) return;\n if (this.logger) {\n this.logger(event, data);\n return;\n }\n if (event === 'request')\n console.log(`[delopay] ${data.method as string} ${data.url as string}`);\n else if (event === 'response')\n console.log(\n `[delopay] ${data.status as number} ${data.method as string} ${data.path as string}`,\n );\n else\n console.log(\n `[delopay] retry ${data.attempt as number}/${data.maxRetries as number} ${data.method as string} ${data.path as string}`,\n );\n }\n\n /**\n * Open a `GET` `text/event-stream` and read it as it arrives.\n *\n * `request()` keeps every chunk of a body until the body ends, which a\n * stream that stays open for half an hour must not do; this reads the body\n * chunk by chunk through {@link EventStreamParser} and keeps nothing it has\n * dispatched. Credentials, the base URL, debug logging and the mapping of a\n * non-2xx answer to `DelopayError` / `DelopayAuthenticationError` are the\n * ones `request()` uses.\n *\n * Never retried, and never reconnected: the caller owns reconnection.\n * Resolves once the response headers arrive; rejects on a non-2xx answer,\n * on a 2xx that is not `text/event-stream` (code `NOT_EVENT_STREAM`), and\n * with `TIMEOUT`, `NETWORK` or `ABORTED` like `request()`.\n */\n protected async openEventStream(\n path: string,\n options: EventStreamRequestOptions = {},\n ): Promise<EventStreamConnection> {\n const url = this.buildUrl(path, options.query);\n const lastEventId = options.lastEventId ?? '';\n const headers: Record<string, string> = {\n ...this.authHeaders(),\n ...this.profileHeaders(options.headers),\n Accept: 'text/event-stream',\n ...(lastEventId ? { 'Last-Event-ID': lastEventId } : {}),\n ...options.headers,\n };\n const idleMs = options.idleTimeoutMs ?? DEFAULT_STREAM_IDLE_TIMEOUT_MS;\n const callerSignal = options.signal;\n const aborted = () =>\n new DelopayError('Request aborted', { status: 0, code: 'ABORTED', type: 'abort_error' });\n if (callerSignal?.aborted) throw aborted();\n\n const idleCtrl = new AbortController();\n const closeCtrl = new AbortController();\n let timer: ReturnType<typeof setTimeout> | undefined;\n const stopIdleTimer = () => {\n if (timer !== undefined) clearTimeout(timer);\n timer = undefined;\n };\n const startIdleTimer = () => {\n stopIdleTimer();\n if (!idleCtrl.signal.aborted) timer = setTimeout(() => idleCtrl.abort(), idleMs);\n };\n const combined = combineSignals(\n callerSignal\n ? [idleCtrl.signal, closeCtrl.signal, callerSignal]\n : [idleCtrl.signal, closeCtrl.signal],\n );\n const release = () => {\n stopIdleTimer();\n combined.dispose();\n };\n const timedOut = () =>\n new DelopayError(`Event stream silent for ${idleMs} ms`, {\n status: 0,\n code: 'TIMEOUT',\n type: 'timeout_error',\n });\n const network = (cause: unknown) =>\n new DelopayError(\n `Network error: ${cause instanceof Error ? cause.message : String(cause ?? 'stream failed')}`,\n { status: 0, code: 'NETWORK', type: 'network_error' },\n );\n\n this.log('request', { method: 'GET', url: redactUrlForLogging(url), path });\n startIdleTimer();\n let response: Response;\n try {\n response = await fetch(url, { method: 'GET', headers, signal: combined.signal });\n } catch (err) {\n release();\n if (callerSignal?.aborted) throw aborted();\n if (idleCtrl.signal.aborted) throw timedOut();\n throw network(err);\n }\n\n const requestId =\n response.headers?.get('x-request-id') ?? response.headers?.get('x-trace-id') ?? undefined;\n this.log('response', { status: response.status, method: 'GET', path, requestId });\n\n if (!response.ok) {\n // Read under the idle timer: a body that never ends gives up as empty.\n const error = await errorFromResponse(response, requestId);\n release();\n throw error;\n }\n\n const body = response.body;\n const contentType = response.headers?.get('content-type') ?? '';\n const mediaType = (contentType.split(';')[0] ?? '').trim().toLowerCase();\n if (mediaType !== 'text/event-stream' || !body || typeof body.getReader !== 'function') {\n release();\n body?.cancel().catch(noop);\n throw new DelopayError(\n mediaType === 'text/event-stream'\n ? 'The event stream has no readable body'\n : `Expected a text/event-stream response, got ${contentType ? `\"${contentType}\"` : 'no content type'}`,\n {\n status: response.status,\n code: 'NOT_EVENT_STREAM',\n type: 'invalid_response',\n requestId,\n },\n );\n }\n\n // The idle timer runs only while a read is pending: a consumer busy with\n // an event, or one that has not started iterating, is not silence.\n stopIdleTimer();\n const reader = body.getReader();\n const parser = new EventStreamParser(lastEventId);\n const decoder = new TextDecoder();\n const stopped = () => Boolean(callerSignal?.aborted) || closeCtrl.signal.aborted;\n let finished = false;\n const finish = () => {\n if (finished) return;\n finished = true;\n release();\n reader.cancel().catch(noop);\n };\n\n async function* dispatches(): AsyncGenerator<EventStreamDispatch, void, undefined> {\n try {\n for (;;) {\n let result: ReadableStreamReadResult<Uint8Array>;\n startIdleTimer();\n try {\n result = await readChunk(reader, combined.signal);\n } catch (err) {\n if (callerSignal?.aborted || closeCtrl.signal.aborted) return;\n if (idleCtrl.signal.aborted) throw timedOut();\n throw network(err instanceof BodyStreamFailure ? err.cause : err);\n } finally {\n stopIdleTimer();\n }\n if (result.done) {\n // An event the stream did not finish with a blank line is\n // discarded, as the standard has it; only completed ones count.\n for (const dispatch of parser.push(decoder.decode())) {\n if (stopped()) return;\n yield dispatch;\n }\n return;\n }\n if (!result.value || result.value.byteLength === 0) continue;\n for (const dispatch of parser.push(decoder.decode(result.value, { stream: true }))) {\n // Aborted or closed while the consumer held the previous one.\n if (stopped()) return;\n yield dispatch;\n }\n }\n } finally {\n finish();\n }\n }\n\n return {\n dispatches: dispatches(),\n close: () => {\n closeCtrl.abort();\n finish();\n },\n };\n }\n\n /**\n * Make a raw HTTP request to the Delopay API.\n *\n * You rarely need to call this directly — prefer the typed resource methods.\n * Use it only for endpoints not yet covered by a resource class.\n *\n * @param method - HTTP method (`GET`, `POST`, `PUT`, `PATCH`, `DELETE`).\n * @param path - API path starting with `/` (e.g. `/payments`).\n * @param options - Optional body, query parameters, and headers.\n * @returns Parsed JSON response body typed as `T`.\n * @throws {DelopayAuthenticationError} On 401 responses.\n * @throws {DelopayError} On all other non-2xx responses, timeouts, and network errors.\n */\n async request<T>(method: string, path: string, options?: RequestOptions): Promise<T> {\n const url = this.buildUrl(path, options?.query);\n\n let headers: Record<string, string> = {\n ...this.authHeaders(),\n ...this.profileHeaders(options?.headers),\n ...options?.headers,\n };\n\n // FormData / Blob / ArrayBuffer / URLSearchParams pass through unchanged so callers\n // can send multipart uploads. The runtime (browser or Node 18+ fetch) sets the\n // appropriate Content-Type including the multipart boundary, so we don't touch it.\n const isRawBody =\n options?.body !== undefined &&\n options?.body !== null &&\n (options.body instanceof FormData ||\n options.body instanceof Blob ||\n options.body instanceof ArrayBuffer ||\n options.body instanceof URLSearchParams);\n\n if (options?.body && !isRawBody) {\n headers['Content-Type'] = 'application/json';\n }\n\n // Serialize body once so circular-reference errors surface immediately and big payloads\n // aren't re-stringified on every retry attempt. Raw bodies pass through untouched.\n let serializedBody: BodyInit | undefined;\n if (isRawBody) {\n serializedBody = options?.body as BodyInit;\n } else if (options?.body) {\n serializedBody = JSON.stringify(options.body);\n }\n\n let idempotencyKey = findIdempotencyKey(headers)?.trim();\n if (options && Object.prototype.hasOwnProperty.call(options, 'bodyIdempotencyKey')) {\n const bodyKey = options?.bodyIdempotencyKey;\n const serialized: unknown =\n !isRawBody && typeof serializedBody === 'string' ? JSON.parse(serializedBody) : null;\n const actualKey =\n serialized && typeof serialized === 'object' && !Array.isArray(serialized)\n ? ((serialized as Record<string, unknown>).idempotency_key ?? null)\n : null;\n const suppliedHeaders = Object.keys(headers).filter(\n (name) => name.toLowerCase() === 'idempotency-key',\n );\n if (\n (bodyKey !== null && typeof bodyKey !== 'string') ||\n actualKey !== bodyKey ||\n suppliedHeaders.some(\n (name) => headers[name] !== bodyKey || headers[name]?.trim() !== headers[name],\n )\n ) {\n throw new DelopayError('Request retry keys must match the JSON body key', {\n status: 0,\n code: 'IDEMPOTENCY_KEY_MISMATCH',\n type: 'invalid_request',\n });\n }\n idempotencyKey = bodyKey?.trim();\n // Collapse differently cased copies so fetch cannot combine them into a\n // different header value. Other caller headers remain untouched.\n if (suppliedHeaders.length > 0) {\n headers = {\n ...Object.fromEntries(\n Object.entries(headers).filter(([name]) => name.toLowerCase() !== 'idempotency-key'),\n ),\n 'Idempotency-Key': idempotencyKey ?? '',\n };\n }\n }\n const isRetryable =\n options?.noRetry !== true &&\n (method === 'GET' ||\n method === 'DELETE' ||\n (idempotencyKey !== undefined && idempotencyKey !== ''));\n\n const callerSignal = options?.signal;\n if (callerSignal?.aborted) {\n throw new DelopayError('Request aborted', {\n status: 0,\n code: 'ABORTED',\n type: 'abort_error',\n });\n }\n\n const timeoutMs = options?.timeout ?? this.timeout;\n\n let lastError: unknown;\n let retryAfterOverrideMs: number | null = null;\n\n const safeUrl = () => redactUrlForLogging(url);\n const emit = (event: 'request' | 'response' | 'retry', data: Record<string, unknown>) =>\n this.log(event, data);\n\n for (let attempt = 0; attempt <= this.maxRetries; attempt++) {\n if (attempt > 0) {\n const base = Math.min(500 * 2 ** (attempt - 1), 5000);\n // Full jitter: pick uniformly in [0, base) to avoid synchronized retry storms.\n const jittered = Math.random() * base;\n const delay = Math.max(retryAfterOverrideMs ?? 0, jittered);\n retryAfterOverrideMs = null;\n await new Promise((resolve) => setTimeout(resolve, delay));\n emit('retry', { attempt, maxRetries: this.maxRetries, method, path });\n }\n\n const timeoutCtrl = new AbortController();\n let timeoutId = setTimeout(() => timeoutCtrl.abort(), timeoutMs);\n // With a progress listener the timeout measures silence, not the whole\n // download: each sign of life restarts it.\n const restartIdleTimer = () => {\n if (timeoutCtrl.signal.aborted) return;\n clearTimeout(timeoutId);\n timeoutId = setTimeout(() => timeoutCtrl.abort(), timeoutMs);\n };\n const combined = combineSignals(\n callerSignal ? [timeoutCtrl.signal, callerSignal] : [timeoutCtrl.signal],\n );\n\n try {\n emit('request', { method, url: safeUrl(), path });\n\n const response = await fetch(url, {\n method,\n headers,\n body: serializedBody,\n signal: combined.signal,\n ...(options?.keepalive !== undefined ? { keepalive: options.keepalive } : {}),\n });\n\n const requestId =\n response.headers?.get('x-request-id') ?? response.headers?.get('x-trace-id') ?? undefined;\n\n emit('response', { status: response.status, method, path, requestId });\n\n if (!response.ok) {\n // A 401 that is our credential's comes back as a\n // DelopayAuthenticationError; its status is never transient, so it\n // is thrown below without a retry.\n const error = await errorFromResponse(response, requestId);\n\n // Retry on 5xx and 429 (rate limit). 4xx other than 429 are not transient.\n const isTransientStatus = response.status >= 500 || response.status === 429;\n if (isTransientStatus && isRetryable && attempt < this.maxRetries) {\n if (response.status === 429) {\n retryAfterOverrideMs = parseRetryAfter(response.headers?.get('retry-after') ?? null);\n }\n lastError = error;\n continue;\n }\n\n throw error;\n }\n\n if (options?.onDownloadProgress) {\n return (await receiveWithProgress(\n response,\n options.responseType,\n options.onDownloadProgress,\n attempt,\n combined.signal,\n restartIdleTimer,\n )) as T;\n }\n if (options?.responseType === 'blob') {\n return (await response.blob()) as T;\n }\n if (options?.responseType === 'arraybuffer') {\n return (await response.arrayBuffer()) as T;\n }\n const text = await response.text();\n return (text ? JSON.parse(text) : undefined) as T;\n } catch (err) {\n if (err instanceof DelopayError || err instanceof DelopayAuthenticationError) {\n throw err;\n }\n if (err instanceof ListenerFailure) {\n throw err.cause;\n }\n if (err instanceof BodyStreamFailure) {\n const cause = err.cause;\n const detail =\n cause instanceof Error ? cause.message : String(cause ?? 'body stream failed');\n lastError = new DelopayError(`Network error: ${detail}`, {\n status: 0,\n code: 'NETWORK',\n type: 'network_error',\n });\n if (isRetryable && attempt < this.maxRetries) continue;\n throw lastError;\n }\n if (err instanceof Error && err.name === 'AbortError') {\n if (callerSignal?.aborted) {\n throw new DelopayError('Request aborted', {\n status: 0,\n code: 'ABORTED',\n type: 'abort_error',\n });\n }\n lastError = new DelopayError('Request timed out', {\n status: 0,\n code: 'TIMEOUT',\n type: 'timeout_error',\n });\n if (isRetryable && attempt < this.maxRetries) continue;\n throw lastError;\n }\n if (err instanceof TypeError) {\n lastError = new DelopayError(`Network error: ${err.message}`, {\n status: 0,\n code: 'NETWORK',\n type: 'network_error',\n });\n if (isRetryable && attempt < this.maxRetries) continue;\n throw lastError;\n }\n throw err;\n } finally {\n clearTimeout(timeoutId);\n combined.dispose();\n }\n }\n\n throw lastError;\n }\n\n /**\n * Auto-paginate a list endpoint. Yields items one by one, fetching\n * the next page automatically when the current one is exhausted.\n *\n * Delopay list endpoints use one of two pagination styles, so this helper\n * supports both:\n * - **Offset** (default) — for endpoints like `customers.list` that accept\n * `offset`/`limit`. Each page advances `offset` by the number of items returned.\n * - **Cursor** — for endpoints like `payments.list` and `payouts.list` that page\n * with `starting_after`/`limit` (they ignore `offset`). Pass a `cursor` extractor\n * that returns the id of an item; the next page is requested with\n * `starting_after` set to the last item's id.\n *\n * @param listFn - A function that takes the paging params and returns `{ data: T[] }` or `T[]`.\n * @param params - Additional parameters to pass to every page request.\n * @param options - Page size (number) for offset mode, or `{ pageSize?, cursor? }`.\n * Provide `cursor` to switch to cursor pagination.\n *\n * @example\n * ```typescript\n * // Offset endpoint (customers):\n * for await (const c of delopay.paginate((p) => delopay.customers.list(p))) {\n * console.log(c.customer_id);\n * }\n *\n * // Cursor endpoint (payments): extract the id used as the next cursor.\n * for await (const payment of delopay.paginate(\n * (p) => delopay.payments.list(p),\n * undefined,\n * { cursor: (p) => p.payment_id },\n * )) {\n * console.log(payment.payment_id);\n * }\n * ```\n */\n async *paginate<T, P extends Record<string, unknown>>(\n listFn: (\n params: P & { limit: number; offset?: number; starting_after?: string },\n ) => Promise<{ data: T[] } | T[]>,\n params?: P,\n options?: number | { pageSize?: number; cursor?: (item: T) => string | undefined },\n ): AsyncGenerator<T> {\n const pageSize = typeof options === 'number' ? options : (options?.pageSize ?? 50);\n const cursorOf = typeof options === 'object' ? options.cursor : undefined;\n let offset = 0;\n let after: string | undefined;\n while (true) {\n const page = { ...((params ?? {}) as P), limit: pageSize } as P & {\n limit: number;\n offset?: number;\n starting_after?: string;\n };\n if (cursorOf) {\n if (after !== undefined) page.starting_after = after;\n } else {\n page.offset = offset;\n }\n const result = await listFn(page);\n const items = Array.isArray(result) ? result : result.data;\n if (items.length === 0) break;\n for (const item of items) {\n yield item;\n }\n if (items.length < pageSize) break;\n if (cursorOf) {\n const last = items[items.length - 1];\n if (last === undefined) break;\n after = cursorOf(last);\n if (after === undefined) break;\n } else {\n offset += items.length;\n }\n }\n }\n}\n"],"mappings":";;;;;;;;;AAOA,IAAM,iBAAiB;AACvB,IAAM,cAAc;AAEpB,IAAM,qB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O8F,EAAA;AAChB,IAAA;AACpE,MAAA;AACP,IAAA;AACH,EAAA;AACF;ADzBgF;AACA;AACA;AACA","file":"/tmp/publish-sdk-04990/dist/chunk-BP6KDQ6I.cjs","sourcesContent":[null,"import type { MerchantSettingsQuery, SettingsResponse, UpdateSettingsRequest } from '../types';\nimport type { RequestFn } from '../client';\n\n/**\n * Settings of the caller's merchant, its projects and its shops.\n *\n * One resource for every setting: each is a key with a JSON value, listed with\n * its default, whether a value is stored, its revision and who changed it last.\n * A merchant changes only its own values; values the platform operator sets at\n * the same scope are listed beside them (`authority: 'operator'`) and are\n * read-only here.\n *\n * Every change is recorded in the audit log with the previous and the new\n * value (`entity_type: 'setting'`), so one setting's history is\n * `audit.list({ entity_type: 'setting', entity_id })`.\n *\n * Dashboard (JWT) routes. Reading the merchant's settings needs\n * `MerchantAccountRead`, a shop's `ProfileAccountRead`; each change needs the\n * permission its setting names.\n */\n/** The query string of a merchant-scope call; a null project is omitted. */\nfunction projectQuery(query: MerchantSettingsQuery): Record<string, string> {\n return query.project_id ? { project_id: query.project_id } : {};\n}\n\nexport class Settings {\n constructor(private readonly request: RequestFn) {}\n\n /**\n * The merchant's settings, or one project's.\n *\n * `GET /settings/merchant`\n */\n async retrieveMerchant(query: MerchantSettingsQuery = {}): Promise<SettingsResponse> {\n return this.request('GET', '/settings/merchant', { query: projectQuery(query) });\n }\n\n /**\n * Change the merchant's own settings, or one project's. All changes are\n * applied or none is.\n *\n * `PATCH /settings/merchant`\n */\n async updateMerchant(\n params: UpdateSettingsRequest,\n query: MerchantSettingsQuery = {},\n ): Promise<SettingsResponse> {\n return this.request('PATCH', '/settings/merchant', {\n body: params,\n query: projectQuery(query),\n });\n }\n\n /**\n * One shop's settings.\n *\n * `GET /settings/shops/{profileId}`\n */\n async retrieveShop(profileId: string): Promise<SettingsResponse> {\n return this.request('GET', `/settings/shops/${encodeURIComponent(profileId)}`);\n }\n\n /**\n * Change one shop's own settings.\n *\n * `PATCH /settings/shops/{profileId}`\n */\n async updateShop(profileId: string, params: UpdateSettingsRequest): Promise<SettingsResponse> {\n return this.request('PATCH', `/settings/shops/${encodeURIComponent(profileId)}`, {\n body: params,\n });\n }\n}\n"]}
1
+ {"version":3,"sources":["/home/anes/delo-payment/delopay-typescript-sdk/dist/chunk-BP6KDQ6I.cjs","../src/resources/settings.ts"],"names":[],"mappings":"AAAA;ACqBA,SAAS,YAAA,CAAa,KAAA,EAAsD;AAC1E,EAAA,OAAO,KAAA,CAAM,WAAA,EAAa,EAAE,UAAA,EAAY,KAAA,CAAM,WAAW,EAAA,EAAI,CAAC,CAAA;AAChE;AAEO,IAAM,SAAA,EAAN,MAAe;AAAA,EACpB,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOlD,MAAM,gBAAA,CAAiB,MAAA,EAA+B,CAAC,CAAA,EAA8B;AACnF,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,oBAAA,EAAsB,EAAE,KAAA,EAAO,YAAA,CAAa,KAAK,EAAE,CAAC,CAAA;AAAA,EACjF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,cAAA,CACJ,MAAA,EACA,MAAA,EAA+B,CAAC,CAAA,EACL;AAC3B,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,OAAA,EAAS,oBAAA,EAAsB;AAAA,MACjD,IAAA,EAAM,MAAA;AAAA,MACN,KAAA,EAAO,YAAA,CAAa,KAAK;AAAA,IAC3B,CAAC,CAAA;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,YAAA,CAAa,SAAA,EAA8C;AAC/D,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,CAAA,gBAAA,EAAmB,kBAAA,CAAmB,SAAS,CAAC,CAAA,CAAA;AAC7E,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAO8F,EAAA;AAChB,IAAA;AACpE,MAAA;AACP,IAAA;AACH,EAAA;AACF;ADzBgF;AACA;AACA;AACA","file":"/home/anes/delo-payment/delopay-typescript-sdk/dist/chunk-BP6KDQ6I.cjs","sourcesContent":[null,"import type { MerchantSettingsQuery, SettingsResponse, UpdateSettingsRequest } from '../types';\nimport type { RequestFn } from '../client';\n\n/**\n * Settings of the caller's merchant, its projects and its shops.\n *\n * One resource for every setting: each is a key with a JSON value, listed with\n * its default, whether a value is stored, its revision and who changed it last.\n * A merchant changes only its own values; values the platform operator sets at\n * the same scope are listed beside them (`authority: 'operator'`) and are\n * read-only here.\n *\n * Every change is recorded in the audit log with the previous and the new\n * value (`entity_type: 'setting'`), so one setting's history is\n * `audit.list({ entity_type: 'setting', entity_id })`.\n *\n * Dashboard (JWT) routes. Reading the merchant's settings needs\n * `MerchantAccountRead`, a shop's `ProfileAccountRead`; each change needs the\n * permission its setting names.\n */\n/** The query string of a merchant-scope call; a null project is omitted. */\nfunction projectQuery(query: MerchantSettingsQuery): Record<string, string> {\n return query.project_id ? { project_id: query.project_id } : {};\n}\n\nexport class Settings {\n constructor(private readonly request: RequestFn) {}\n\n /**\n * The merchant's settings, or one project's.\n *\n * `GET /settings/merchant`\n */\n async retrieveMerchant(query: MerchantSettingsQuery = {}): Promise<SettingsResponse> {\n return this.request('GET', '/settings/merchant', { query: projectQuery(query) });\n }\n\n /**\n * Change the merchant's own settings, or one project's. All changes are\n * applied or none is.\n *\n * `PATCH /settings/merchant`\n */\n async updateMerchant(\n params: UpdateSettingsRequest,\n query: MerchantSettingsQuery = {},\n ): Promise<SettingsResponse> {\n return this.request('PATCH', '/settings/merchant', {\n body: params,\n query: projectQuery(query),\n });\n }\n\n /**\n * One shop's settings.\n *\n * `GET /settings/shops/{profileId}`\n */\n async retrieveShop(profileId: string): Promise<SettingsResponse> {\n return this.request('GET', `/settings/shops/${encodeURIComponent(profileId)}`);\n }\n\n /**\n * Change one shop's own settings.\n *\n * `PATCH /settings/shops/{profileId}`\n */\n async updateShop(profileId: string, params: UpdateSettingsRequest): Promise<SettingsResponse> {\n return this.request('PATCH', `/settings/shops/${encodeURIComponent(profileId)}`, {\n body: params,\n });\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["/tmp/publish-sdk-04990/dist/chunk-BRY3W7N3.cjs","../src/internal/resources/adminLive.ts"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACA;ACMO,IAAM,UAAA,EAAN,MAAgB;AAAA,EACrB,WAAA,CACmB,OAAA,EACA,UAAA,EACjB;AAFiB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AACA,IAAA,IAAA,CAAA,WAAA,EAAA,UAAA;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQH,MAAM,MAAA,CAAO,OAAA,EAAuD;AAClE,IAAA,OAAO,8CAAA,IAAe,CAAK,UAAA,EAAY,2BAAA,EAA6B,OAAO,CAAA;AAAA,EAC7E;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,QAAA,CACJ,UAAA,EACA,MAAA,EACA,OAAA,EAC+B;AAC/B,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,6BAAA,EAA+B;AAAA,MACxD,KAAA,EAAO;AAAA,QACL,WAAA,EAAa,UAAA;AAAA,QACb,QAAA,EAAU,MAAA,CAAO,QAAA,CAAS,IAAA,CAAK,GAAG,CAAA;AAAA,QAClC,UAAA,EAAY,MAAA,CAAO,UAAA;AAAA,QACnB,SAAA,EAAW,MAAA,CAAO;AAAA,MACpB,CAAA;AAAA,MACA,GAAG;AAAA,IACL,CAAC,CAAA;AAAA,EACH;AACF,CAAA;ADVA;AACA;AACE;AACF,8BAAC","file":"/tmp/publish-sdk-04990/dist/chunk-BRY3W7N3.cjs","sourcesContent":[null,"import type { LiveStreamOptions, LiveVersionsParams, LiveVersionsResponse } from '../../types';\nimport type { EventStreamFn, RequestExtras, RequestFn } from '../../client';\nimport { openLiveStream } from '../../resources/live';\nimport type { LiveEventStream } from '../../resources/live';\n\n/**\n * Live updates of the admin dashboard: the same events as\n * the merchant dashboard's `live`, for every merchant, and the versions an\n * admin editor names in `If-Match`. Needs an internal platform-operator JWT.\n */\nexport class AdminLive {\n constructor(\n private readonly request: RequestFn,\n private readonly openStream: EventStreamFn,\n ) {}\n\n /**\n * Open the stream of what changed in every merchant. Each change names its\n * `merchant_id`. The SDK does not reconnect — see `LiveEventStream`.\n *\n * `GET /admin-portal/live/stream`\n */\n async stream(options?: LiveStreamOptions): Promise<LiveEventStream> {\n return openLiveStream(this.openStream, '/admin-portal/live/stream', options);\n }\n\n /**\n * The versions an admin editor of `merchantId` names in `If-Match`. A save\n * over a newer version is refused with `IR_16` (400), `error.data` a\n * `LiveChangedElsewhere`.\n *\n * `GET /admin-portal/live/versions`\n */\n async versions(\n merchantId: string,\n params: LiveVersionsParams,\n options?: RequestExtras,\n ): Promise<LiveVersionsResponse> {\n return this.request('GET', '/admin-portal/live/versions', {\n query: {\n merchant_id: merchantId,\n entities: params.entities.join(','),\n profile_id: params.profile_id,\n record_id: params.record_id,\n },\n ...options,\n });\n }\n}\n"]}
1
+ {"version":3,"sources":["/home/anes/delo-payment/delopay-typescript-sdk/dist/chunk-BRY3W7N3.cjs","../src/internal/resources/adminLive.ts"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACA;ACMO,IAAM,UAAA,EAAN,MAAgB;AAAA,EACrB,WAAA,CACmB,OAAA,EACA,UAAA,EACjB;AAFiB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AACA,IAAA,IAAA,CAAA,WAAA,EAAA,UAAA;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQH,MAAM,MAAA,CAAO,OAAA,EAAuD;AAClE,IAAA,OAAO,8CAAA,IAAe,CAAK,UAAA,EAAY,2BAAA,EAA6B,OAAO,CAAA;AAAA,EAC7E;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,QAAA,CACJ,UAAA,EACA,MAAA,EACA,OAAA,EAC+B;AAC/B,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,6BAAA,EAA+B;AAAA,MACxD,KAAA,EAAO;AAAA,QACL,WAAA,EAAa,UAAA;AAAA,QACb,QAAA,EAAU,MAAA,CAAO,QAAA,CAAS,IAAA,CAAK,GAAG,CAAA;AAAA,QAClC,UAAA,EAAY,MAAA,CAAO,UAAA;AAAA,QACnB,SAAA,EAAW,MAAA,CAAO;AAAA,MACpB,CAAA;AAAA,MACA,GAAG;AAAA,IACL,CAAC,CAAA;AAAA,EACH;AACF,CAAA;ADVA;AACA;AACE;AACF,8BAAC","file":"/home/anes/delo-payment/delopay-typescript-sdk/dist/chunk-BRY3W7N3.cjs","sourcesContent":[null,"import type { LiveStreamOptions, LiveVersionsParams, LiveVersionsResponse } from '../../types';\nimport type { EventStreamFn, RequestExtras, RequestFn } from '../../client';\nimport { openLiveStream } from '../../resources/live';\nimport type { LiveEventStream } from '../../resources/live';\n\n/**\n * Live updates of the admin dashboard: the same events as\n * the merchant dashboard's `live`, for every merchant, and the versions an\n * admin editor names in `If-Match`. Needs an internal platform-operator JWT.\n */\nexport class AdminLive {\n constructor(\n private readonly request: RequestFn,\n private readonly openStream: EventStreamFn,\n ) {}\n\n /**\n * Open the stream of what changed in every merchant. Each change names its\n * `merchant_id`. The SDK does not reconnect — see `LiveEventStream`.\n *\n * `GET /admin-portal/live/stream`\n */\n async stream(options?: LiveStreamOptions): Promise<LiveEventStream> {\n return openLiveStream(this.openStream, '/admin-portal/live/stream', options);\n }\n\n /**\n * The versions an admin editor of `merchantId` names in `If-Match`. A save\n * over a newer version is refused with `IR_16` (400), `error.data` a\n * `LiveChangedElsewhere`.\n *\n * `GET /admin-portal/live/versions`\n */\n async versions(\n merchantId: string,\n params: LiveVersionsParams,\n options?: RequestExtras,\n ): Promise<LiveVersionsResponse> {\n return this.request('GET', '/admin-portal/live/versions', {\n query: {\n merchant_id: merchantId,\n entities: params.entities.join(','),\n profile_id: params.profile_id,\n record_id: params.record_id,\n },\n ...options,\n });\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["/tmp/publish-sdk-04990/dist/chunk-BT3UAUEV.cjs","../src/resources/buyerBlocklist.ts"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACA;ACkCO,IAAM,eAAA,EAAN,MAAqB;AAAA,EAC1B,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASlD,MAAM,IAAA,CAAK,MAAA,EAAuE;AAChF,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,kBAAA,EAAoB;AAAA,MAC7C,KAAA,EAAO,wCAAA,MAAS,EAAQ,CAAC,MAAA,EAAQ,aAAA,EAAe,UAAU,CAAC;AAAA,IAC7D,CAAC,CAAA;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAM,MAAA,CAAO,MAAA,EAAgF;AAC3F,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,MAAA,EAAQ,kBAAA,EAAoB,EAAE,IAAA,EAAM,OAAO,CAAC,CAAA;AAAA,EAClE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,MAAA,CACJ,OAAA,EACA,MAAA,EACsC;AACtC,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,QAAA,EAAU,CAAA,iBAAA,EAAoB,kBAAA,CAAmB,OAAO,CAAC,CAAA,CAAA;AAC1D,MAAA;AAClB,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYwC,EAAA;AACuC,IAAA;AAC/E,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYqD,EAAA;AAC0B,IAAA;AAC/E,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWyC,EAAA;AACmC,IAAA;AACjE,MAAA;AACR,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOkE,EAAA;AACN,IAAA;AAC5D,EAAA;AAAA;AAAA;AAAA;AAAA;AAMuE,EAAA;AACM,IAAA;AAC7E,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAO8D,EAAA;AACJ,IAAA;AAC1D,EAAA;AAAA;AAAA;AAAA;AAAA;AAMyF,EAAA;AAC3E,IAAA;AACV,MAAA;AACsE,MAAA;AACxE,IAAA;AACF,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUsC,EAAA;AACxB,IAAA;AACV,MAAA;AACsE,MAAA;AACvD,MAAA;AACjB,IAAA;AACF,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOwF,EAAA;AAC1E,IAAA;AACV,MAAA;AACsE,MAAA;AACxE,IAAA;AACF,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQ4E,EAAA;AACb,IAAA;AAC/D,EAAA;AACF;ADxDkF;AACA;AACA;AACA","file":"/tmp/publish-sdk-04990/dist/chunk-BT3UAUEV.cjs","sourcesContent":[null,"import type {\n BuyerBlocklistCapabilitiesResponse,\n BuyerBlocklistEntryCreateRequest,\n BuyerBlocklistEntryDeleteRequest,\n BuyerBlocklistEntryResponse,\n BuyerBlocklistEventsQuery,\n BuyerBlocklistEventsResponse,\n BuyerBlocklistFromPaymentPreviewRequest,\n BuyerBlocklistFromPaymentPreviewResponse,\n BuyerBlocklistFromPaymentRequest,\n BuyerBlocklistListQuery,\n BuyerBlocklistListResponse,\n PaymentFraudSignalsResponse,\n RadarSyncSettingsListResponse,\n RadarSyncSettingsResponse,\n RadarSyncSettingsUpdateRequest,\n} from '../types';\nimport type { RequestFn } from '../client';\nimport { csvQuery } from '../listQuery';\n\n/**\n * Buyer blocklist: the buyers a merchant refuses to sell to again, in every\n * shop of the merchant or in one shop. One entry names the buyer by email\n * address, IP address, IP range, customer id, device id, Stripe card\n * fingerprint and card BIN, at most one of each and at least one in total,\n * and blocks a payment when any one of them matches. An entry can instead\n * block a class of network (hosting, VPN or proxy, Tor, residential proxy) on its own. A blocked buyer's hosted checkout\n * and confirms fail with error code `DE_14`, and the payments create\n * response marks the buyer with `buyer_blocked` and the entry's\n * `buyer_block_note`. Card fingerprints, emails, IPs and BINs can also be\n * copied to Stripe Radar value lists per Stripe connection; a Radar list\n * blocks only once its rule is added in Stripe (`rule_needed`).\n *\n * Every route needs a dashboard session. Reading needs the `BuyerBlocklist`\n * area at `Read`, adding and removing needs `Write`. A caller scoped to one\n * shop lists, adds and removes that shop's entries only, and never an entry\n * that blocks in every shop.\n */\nexport class BuyerBlocklist {\n constructor(private readonly request: RequestFn) {}\n\n /**\n * One page of blocked buyers, newest first unless `sort_by` says otherwise,\n * filtered by scope, by `kind` (the entries that include an identifier of\n * that kind, or of any of several) and by a search over every identifier\n * and the note. Expired entries are not listed.\n * `GET /buyer-blocklist`\n */\n async list(params?: BuyerBlocklistListQuery): Promise<BuyerBlocklistListResponse> {\n return this.request('GET', '/buyer-blocklist', {\n query: csvQuery(params, ['kind', 'profile_ids', 'industry']),\n });\n }\n\n /**\n * Block a buyer in one shop or, without `profile_id`, in every shop of the\n * merchant, named by one or more of `email`, `ip`, `customer_id` and\n * `device_id`. Each identifier is normalised as it is matched; an\n * identifier another entry already names in that scope is refused. The\n * change is recorded in the audit log before it is made.\n * `POST /buyer-blocklist`\n */\n async create(params: BuyerBlocklistEntryCreateRequest): Promise<BuyerBlocklistEntryResponse> {\n return this.request('POST', '/buyer-blocklist', { body: params });\n }\n\n /**\n * Remove an entry, so the buyer can pay again. Payments the entry already\n * refused keep their status. The removal and the optional `reason` are\n * recorded in the audit log before it is made. The route requires a body,\n * so `{}` is sent when no reason is given.\n * `DELETE /buyer-blocklist/{entry_id}`\n */\n async delete(\n entryId: string,\n params?: BuyerBlocklistEntryDeleteRequest,\n ): Promise<BuyerBlocklistEntryResponse> {\n return this.request('DELETE', `/buyer-blocklist/${encodeURIComponent(entryId)}`, {\n body: params ?? {},\n });\n }\n\n /**\n * Block the buyer of a payment by the identifiers the payment carries:\n * its card (the Stripe fingerprint), email, IP, device or customer, in the\n * payment's shop or in every shop. With `all_ips`, also every address the\n * buyer was seen paying from, one entry each, grouped under one\n * `group_id`; the answer then carries `ip_snapshot`.\n * `POST /buyer-blocklist/from-payment`\n */\n async createFromPayment(\n params: BuyerBlocklistFromPaymentRequest,\n ): Promise<BuyerBlocklistEntryResponse> {\n return this.request('POST', '/buyer-blocklist/from-payment', { body: params });\n }\n\n /**\n * The addresses an \"all IPs\" block of a payment's buyer would take: the\n * payment's own, then those its device, email or card were seen at in the\n * last 90 days, newest first, at most 20. An address shared with two or\n * more other buyers is offered but not preselected. Writes nothing; needs\n * the same permissions as the block.\n * `POST /buyer-blocklist/from-payment/preview`\n */\n async previewFromPayment(\n params: BuyerBlocklistFromPaymentPreviewRequest,\n ): Promise<BuyerBlocklistFromPaymentPreviewResponse> {\n return this.request('POST', '/buyer-blocklist/from-payment/preview', { body: params });\n }\n\n /**\n * An entry's recorded refusals, newest first, with where each happened and\n * which identifier matched. A caller scoped to one shop reaches only its own\n * shop's entries.\n * `GET /buyer-blocklist/{entry_id}/events`\n */\n async listEvents(\n entryId: string,\n params?: BuyerBlocklistEventsQuery,\n ): Promise<BuyerBlocklistEventsResponse> {\n return this.request('GET', `/buyer-blocklist/${encodeURIComponent(entryId)}/events`, {\n query: params as Record<string, string | number | null | undefined>,\n });\n }\n\n /**\n * Which classes of network an `ip_class` entry can be judged by on this\n * deployment now, and by which sources.\n * `GET /buyer-blocklist/capabilities`\n */\n async capabilities(): Promise<BuyerBlocklistCapabilitiesResponse> {\n return this.request('GET', '/buyer-blocklist/capabilities');\n }\n\n /**\n * Retry now every failed or pending Radar sync of an entry.\n * `POST /buyer-blocklist/{entry_id}/sync/retry`\n */\n async retrySync(entryId: string): Promise<BuyerBlocklistEntryResponse> {\n return this.request('POST', `/buyer-blocklist/${encodeURIComponent(entryId)}/sync/retry`);\n }\n\n /**\n * The Radar sync settings of every Stripe connection the caller sees. A\n * role that hides processor names is refused (403).\n * `GET /buyer-blocklist/radar-sync`\n */\n async listRadarSync(): Promise<RadarSyncSettingsListResponse> {\n return this.request('GET', '/buyer-blocklist/radar-sync');\n }\n\n /**\n * The Radar sync settings of one Stripe connection.\n * `GET /buyer-blocklist/radar-sync/{merchant_connector_id}`\n */\n async retrieveRadarSync(merchantConnectorId: string): Promise<RadarSyncSettingsResponse> {\n return this.request(\n 'GET',\n `/buyer-blocklist/radar-sync/${encodeURIComponent(merchantConnectorId)}`,\n );\n }\n\n /**\n * Turn Radar sync on or off for one Stripe connection and set what an\n * early fraud warning or a review does.\n * `PUT /buyer-blocklist/radar-sync/{merchant_connector_id}`\n */\n async updateRadarSync(\n merchantConnectorId: string,\n params: RadarSyncSettingsUpdateRequest,\n ): Promise<RadarSyncSettingsResponse> {\n return this.request(\n 'PUT',\n `/buyer-blocklist/radar-sync/${encodeURIComponent(merchantConnectorId)}`,\n { body: params },\n );\n }\n\n /**\n * Remove every item DeloPay synced from this connection's Radar lists. The\n * lists themselves are kept.\n * `POST /buyer-blocklist/radar-sync/{merchant_connector_id}/remove-items`\n */\n async removeRadarItems(merchantConnectorId: string): Promise<RadarSyncSettingsResponse> {\n return this.request(\n 'POST',\n `/buyer-blocklist/radar-sync/${encodeURIComponent(merchantConnectorId)}/remove-items`,\n );\n }\n\n /**\n * Stripe's fraud signals on a payment (risk, early fraud warnings,\n * reviews), what of its buyer can be blocked, and the entries that\n * already match it.\n * `GET /buyer-blocklist/fraud-signals/{payment_id}`\n */\n async fraudSignals(paymentId: string): Promise<PaymentFraudSignalsResponse> {\n return this.request('GET', `/buyer-blocklist/fraud-signals/${encodeURIComponent(paymentId)}`);\n }\n}\n"]}
1
+ {"version":3,"sources":["/home/anes/delo-payment/delopay-typescript-sdk/dist/chunk-BT3UAUEV.cjs","../src/resources/buyerBlocklist.ts"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACA;ACkCO,IAAM,eAAA,EAAN,MAAqB;AAAA,EAC1B,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASlD,MAAM,IAAA,CAAK,MAAA,EAAuE;AAChF,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,kBAAA,EAAoB;AAAA,MAC7C,KAAA,EAAO,wCAAA,MAAS,EAAQ,CAAC,MAAA,EAAQ,aAAA,EAAe,UAAU,CAAC;AAAA,IAC7D,CAAC,CAAA;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAM,MAAA,CAAO,MAAA,EAAgF;AAC3F,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,MAAA,EAAQ,kBAAA,EAAoB,EAAE,IAAA,EAAM,OAAO,CAAC,CAAA;AAAA,EAClE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,MAAA,CACJ,OAAA,EACA,MAAA,EACsC;AACtC,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,QAAA,EAAU,CAAA,iBAAA,EAAoB,kBAAA,CAAmB,OAAO,CAAC,CAAA,CAAA;AAC1D,MAAA;AAClB,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYwC,EAAA;AACuC,IAAA;AAC/E,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYqD,EAAA;AAC0B,IAAA;AAC/E,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWyC,EAAA;AACmC,IAAA;AACjE,MAAA;AACR,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOkE,EAAA;AACN,IAAA;AAC5D,EAAA;AAAA;AAAA;AAAA;AAAA;AAMuE,EAAA;AACM,IAAA;AAC7E,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAO8D,EAAA;AACJ,IAAA;AAC1D,EAAA;AAAA;AAAA;AAAA;AAAA;AAMyF,EAAA;AAC3E,IAAA;AACV,MAAA;AACsE,MAAA;AACxE,IAAA;AACF,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUsC,EAAA;AACxB,IAAA;AACV,MAAA;AACsE,MAAA;AACvD,MAAA;AACjB,IAAA;AACF,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOwF,EAAA;AAC1E,IAAA;AACV,MAAA;AACsE,MAAA;AACxE,IAAA;AACF,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQ4E,EAAA;AACb,IAAA;AAC/D,EAAA;AACF;ADxDkF;AACA;AACA;AACA","file":"/home/anes/delo-payment/delopay-typescript-sdk/dist/chunk-BT3UAUEV.cjs","sourcesContent":[null,"import type {\n BuyerBlocklistCapabilitiesResponse,\n BuyerBlocklistEntryCreateRequest,\n BuyerBlocklistEntryDeleteRequest,\n BuyerBlocklistEntryResponse,\n BuyerBlocklistEventsQuery,\n BuyerBlocklistEventsResponse,\n BuyerBlocklistFromPaymentPreviewRequest,\n BuyerBlocklistFromPaymentPreviewResponse,\n BuyerBlocklistFromPaymentRequest,\n BuyerBlocklistListQuery,\n BuyerBlocklistListResponse,\n PaymentFraudSignalsResponse,\n RadarSyncSettingsListResponse,\n RadarSyncSettingsResponse,\n RadarSyncSettingsUpdateRequest,\n} from '../types';\nimport type { RequestFn } from '../client';\nimport { csvQuery } from '../listQuery';\n\n/**\n * Buyer blocklist: the buyers a merchant refuses to sell to again, in every\n * shop of the merchant or in one shop. One entry names the buyer by email\n * address, IP address, IP range, customer id, device id, Stripe card\n * fingerprint and card BIN, at most one of each and at least one in total,\n * and blocks a payment when any one of them matches. An entry can instead\n * block a class of network (hosting, VPN or proxy, Tor, residential proxy) on its own. A blocked buyer's hosted checkout\n * and confirms fail with error code `DE_14`, and the payments create\n * response marks the buyer with `buyer_blocked` and the entry's\n * `buyer_block_note`. Card fingerprints, emails, IPs and BINs can also be\n * copied to Stripe Radar value lists per Stripe connection; a Radar list\n * blocks only once its rule is added in Stripe (`rule_needed`).\n *\n * Every route needs a dashboard session. Reading needs the `BuyerBlocklist`\n * area at `Read`, adding and removing needs `Write`. A caller scoped to one\n * shop lists, adds and removes that shop's entries only, and never an entry\n * that blocks in every shop.\n */\nexport class BuyerBlocklist {\n constructor(private readonly request: RequestFn) {}\n\n /**\n * One page of blocked buyers, newest first unless `sort_by` says otherwise,\n * filtered by scope, by `kind` (the entries that include an identifier of\n * that kind, or of any of several) and by a search over every identifier\n * and the note. Expired entries are not listed.\n * `GET /buyer-blocklist`\n */\n async list(params?: BuyerBlocklistListQuery): Promise<BuyerBlocklistListResponse> {\n return this.request('GET', '/buyer-blocklist', {\n query: csvQuery(params, ['kind', 'profile_ids', 'industry']),\n });\n }\n\n /**\n * Block a buyer in one shop or, without `profile_id`, in every shop of the\n * merchant, named by one or more of `email`, `ip`, `customer_id` and\n * `device_id`. Each identifier is normalised as it is matched; an\n * identifier another entry already names in that scope is refused. The\n * change is recorded in the audit log before it is made.\n * `POST /buyer-blocklist`\n */\n async create(params: BuyerBlocklistEntryCreateRequest): Promise<BuyerBlocklistEntryResponse> {\n return this.request('POST', '/buyer-blocklist', { body: params });\n }\n\n /**\n * Remove an entry, so the buyer can pay again. Payments the entry already\n * refused keep their status. The removal and the optional `reason` are\n * recorded in the audit log before it is made. The route requires a body,\n * so `{}` is sent when no reason is given.\n * `DELETE /buyer-blocklist/{entry_id}`\n */\n async delete(\n entryId: string,\n params?: BuyerBlocklistEntryDeleteRequest,\n ): Promise<BuyerBlocklistEntryResponse> {\n return this.request('DELETE', `/buyer-blocklist/${encodeURIComponent(entryId)}`, {\n body: params ?? {},\n });\n }\n\n /**\n * Block the buyer of a payment by the identifiers the payment carries:\n * its card (the Stripe fingerprint), email, IP, device or customer, in the\n * payment's shop or in every shop. With `all_ips`, also every address the\n * buyer was seen paying from, one entry each, grouped under one\n * `group_id`; the answer then carries `ip_snapshot`.\n * `POST /buyer-blocklist/from-payment`\n */\n async createFromPayment(\n params: BuyerBlocklistFromPaymentRequest,\n ): Promise<BuyerBlocklistEntryResponse> {\n return this.request('POST', '/buyer-blocklist/from-payment', { body: params });\n }\n\n /**\n * The addresses an \"all IPs\" block of a payment's buyer would take: the\n * payment's own, then those its device, email or card were seen at in the\n * last 90 days, newest first, at most 20. An address shared with two or\n * more other buyers is offered but not preselected. Writes nothing; needs\n * the same permissions as the block.\n * `POST /buyer-blocklist/from-payment/preview`\n */\n async previewFromPayment(\n params: BuyerBlocklistFromPaymentPreviewRequest,\n ): Promise<BuyerBlocklistFromPaymentPreviewResponse> {\n return this.request('POST', '/buyer-blocklist/from-payment/preview', { body: params });\n }\n\n /**\n * An entry's recorded refusals, newest first, with where each happened and\n * which identifier matched. A caller scoped to one shop reaches only its own\n * shop's entries.\n * `GET /buyer-blocklist/{entry_id}/events`\n */\n async listEvents(\n entryId: string,\n params?: BuyerBlocklistEventsQuery,\n ): Promise<BuyerBlocklistEventsResponse> {\n return this.request('GET', `/buyer-blocklist/${encodeURIComponent(entryId)}/events`, {\n query: params as Record<string, string | number | null | undefined>,\n });\n }\n\n /**\n * Which classes of network an `ip_class` entry can be judged by on this\n * deployment now, and by which sources.\n * `GET /buyer-blocklist/capabilities`\n */\n async capabilities(): Promise<BuyerBlocklistCapabilitiesResponse> {\n return this.request('GET', '/buyer-blocklist/capabilities');\n }\n\n /**\n * Retry now every failed or pending Radar sync of an entry.\n * `POST /buyer-blocklist/{entry_id}/sync/retry`\n */\n async retrySync(entryId: string): Promise<BuyerBlocklistEntryResponse> {\n return this.request('POST', `/buyer-blocklist/${encodeURIComponent(entryId)}/sync/retry`);\n }\n\n /**\n * The Radar sync settings of every Stripe connection the caller sees. A\n * role that hides processor names is refused (403).\n * `GET /buyer-blocklist/radar-sync`\n */\n async listRadarSync(): Promise<RadarSyncSettingsListResponse> {\n return this.request('GET', '/buyer-blocklist/radar-sync');\n }\n\n /**\n * The Radar sync settings of one Stripe connection.\n * `GET /buyer-blocklist/radar-sync/{merchant_connector_id}`\n */\n async retrieveRadarSync(merchantConnectorId: string): Promise<RadarSyncSettingsResponse> {\n return this.request(\n 'GET',\n `/buyer-blocklist/radar-sync/${encodeURIComponent(merchantConnectorId)}`,\n );\n }\n\n /**\n * Turn Radar sync on or off for one Stripe connection and set what an\n * early fraud warning or a review does.\n * `PUT /buyer-blocklist/radar-sync/{merchant_connector_id}`\n */\n async updateRadarSync(\n merchantConnectorId: string,\n params: RadarSyncSettingsUpdateRequest,\n ): Promise<RadarSyncSettingsResponse> {\n return this.request(\n 'PUT',\n `/buyer-blocklist/radar-sync/${encodeURIComponent(merchantConnectorId)}`,\n { body: params },\n );\n }\n\n /**\n * Remove every item DeloPay synced from this connection's Radar lists. The\n * lists themselves are kept.\n * `POST /buyer-blocklist/radar-sync/{merchant_connector_id}/remove-items`\n */\n async removeRadarItems(merchantConnectorId: string): Promise<RadarSyncSettingsResponse> {\n return this.request(\n 'POST',\n `/buyer-blocklist/radar-sync/${encodeURIComponent(merchantConnectorId)}/remove-items`,\n );\n }\n\n /**\n * Stripe's fraud signals on a payment (risk, early fraud warnings,\n * reviews), what of its buyer can be blocked, and the entries that\n * already match it.\n * `GET /buyer-blocklist/fraud-signals/{payment_id}`\n */\n async fraudSignals(paymentId: string): Promise<PaymentFraudSignalsResponse> {\n return this.request('GET', `/buyer-blocklist/fraud-signals/${encodeURIComponent(paymentId)}`);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["/tmp/publish-sdk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AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAwBH,MAAM,MAAA,CAAO,OAAA,EAAuD;AAClE,IAAA,OAAO,cAAA,CAAe,IAAA,CAAK,UAAA,EAAY,cAAA,EAAgB,OAAO,CAAA;AAAA,EAChE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAM,QAAA,CACJ,MAAA,EACA,OAAA,EAC+B;AAC/B,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,gBAAA,EAAkB;AAAA,MAC3C,KAAA,EAAO;AAAA,QACL,QAAA,EAAU,MAAA,CAAO,QAAA,CAAS,IAAA,CAAK,GAAG,CAAA;AAAA,QAClC,UAAA,EAAY,MAAA,CAAO,UAAA;AAAA,QACnB,SAAA,EAAW,MAAA,CAAO;AAAA,MACpB,CAAA;AAAA,MACA,GAAG;AAAA,IACL,CAAC,CAAA;AAAA,EACH;AACF,CAAA;AD7DA;AACA;AACE;AACA;AACA;AACA;AACF,uJAAC","file":"/tmp/publish-sdk-04990/dist/chunk-CCN44NZJ.cjs","sourcesContent":[null,"import type {\n LiveChange,\n LiveStreamEvent,\n LiveStreamOptions,\n LiveVersionsParams,\n LiveVersionsResponse,\n} from '../types';\nimport type { EventStreamConnection, EventStreamFn, RequestExtras, RequestFn } from '../client';\nimport type { EventStreamDispatch } from '../eventStream';\n\n/** `key` of the JSON object `data` holds; `undefined` when it holds none. */\nfunction readField(data: string, key: string): unknown {\n let value: unknown;\n try {\n value = JSON.parse(data);\n } catch {\n return undefined;\n }\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return undefined;\n return Object.getOwnPropertyDescriptor(value, key)?.value as unknown;\n}\n\n/** The typed event a dispatch carries, or `null` for a kind the SDK does not know. */\nexport function toLiveStreamEvent(\n event: { type: string; data: string },\n id: string | null,\n retry: number | null,\n): LiveStreamEvent | null {\n switch (event.type) {\n case 'ready': {\n const resumed = readField(event.data, 'resumed');\n return { type: 'ready', id, retry, resumed: typeof resumed === 'boolean' ? resumed : null };\n }\n case 'change': {\n const changes = readField(event.data, 'changes');\n // A change the SDK cannot read still says that something changed: the\n // dashboard reads everything again rather than miss it.\n if (!Array.isArray(changes)) return { type: 'resync', id };\n return { type: 'change', id, changes: changes as LiveChange[] };\n }\n case 'resync':\n return { type: 'resync', id };\n default:\n return null;\n }\n}\n\n/**\n * An open live stream: iterate it with `for await` for its events.\n *\n * It is not reconnected. The iteration ends without an error when the server\n * ends the stream (the session expired, 30 minutes passed, the server\n * restarted) and when the stream is aborted or closed; the dashboard then\n * opens a new one after {@link LiveEventStream.retry}, passing\n * {@link LiveEventStream.lastEventId}. It throws a `DelopayError` with code\n * `TIMEOUT` when the stream stays silent past `idleTimeoutMs` and `NETWORK`\n * when the connection fails; reconnect on those too.\n *\n * Iterate it once. Call {@link LiveEventStream.close} (or abort the signal)\n * to release a stream that is not iterated to its end.\n */\nexport class LiveEventStream implements AsyncIterable<LiveStreamEvent> {\n private _lastEventId: string | null;\n private _retry: number | null = null;\n private iterator?: AsyncGenerator<LiveStreamEvent, void, undefined>;\n\n constructor(\n private readonly connection: EventStreamConnection,\n lastEventId: string | null = null,\n ) {\n this._lastEventId = lastEventId || null;\n }\n\n /**\n * The position to resume after: the id of the last event read, advanced by\n * keepalives too. `null` before the server named one. Send it as\n * `lastEventId` when reconnecting.\n */\n get lastEventId(): string | null {\n return this._lastEventId;\n }\n\n /** The wait before reconnecting the server asked for, in ms; `null` until it says. */\n get retry(): number | null {\n return this._retry;\n }\n\n /** Close the stream; the iteration ends without an error. */\n close(): void {\n this.connection.close();\n }\n\n [Symbol.asyncIterator](): AsyncGenerator<LiveStreamEvent, void, undefined> {\n this.iterator ??= this.events();\n return this.iterator;\n }\n\n private async *events(): AsyncGenerator<LiveStreamEvent, void, undefined> {\n for await (const dispatch of this.connection.dispatches) {\n const event = this.read(dispatch);\n if (event) yield event;\n }\n }\n\n private read(dispatch: EventStreamDispatch): LiveStreamEvent | null {\n this._lastEventId = dispatch.lastEventId || null;\n if (dispatch.retry !== null) this._retry = dispatch.retry;\n if (!dispatch.event) return null;\n return toLiveStreamEvent(dispatch.event, this._lastEventId, this._retry);\n }\n}\n\n/** Open a live stream at `path`. */\nexport async function openLiveStream(\n openStream: EventStreamFn,\n path: string,\n options: LiveStreamOptions = {},\n): Promise<LiveEventStream> {\n const connection = await openStream(path, {\n ...(options.lastEventId ? { lastEventId: options.lastEventId } : {}),\n ...(options.signal ? { signal: options.signal } : {}),\n ...(options.idleTimeoutMs !== undefined ? { idleTimeoutMs: options.idleTimeoutMs } : {}),\n ...(options.headers ? { headers: options.headers } : {}),\n });\n return new LiveEventStream(connection, options.lastEventId ?? null);\n}\n\n/**\n * Live updates of the merchant dashboard: a stream that\n * says what kind of record changed, and the versions an editor names in\n * `If-Match` so a save never overwrites a newer change. Both need a dashboard\n * JWT (`setJwtToken`), not an API key.\n */\nexport class Live {\n constructor(\n private readonly request: RequestFn,\n private readonly openStream: EventStreamFn,\n ) {}\n\n /**\n * Open the stream of what changed in the caller's merchant, as their role\n * may read it. Resolves once the server answered; a `401` rejects with\n * `DelopayAuthenticationError`.\n *\n * The first event is `ready`. `change` names the kinds of record and, when\n * few, the ids that changed: read them again through the usual endpoints.\n * `resync`, and `ready` with `resumed: false`, mean read everything again.\n * The SDK does not reconnect — see {@link LiveEventStream}.\n *\n * `GET /live/stream`\n *\n * @example\n * ```typescript\n * const stream = await delopay.live.stream({ lastEventId, signal });\n * for await (const event of stream) {\n * if (event.type === 'change') refresh(event.changes);\n * else if (event.type === 'resync' || event.resumed === false) refreshAll();\n * }\n * lastEventId = stream.lastEventId; // reconnect after stream.retry\n * ```\n */\n async stream(options?: LiveStreamOptions): Promise<LiveEventStream> {\n return openLiveStream(this.openStream, '/live/stream', options);\n }\n\n /**\n * The current version of each kind of record named, in the caller's\n * merchant and shop. Read it before the record and send the entry's\n * `if_match` in the `If-Match` header of the save: a save over a newer\n * version is refused with `IR_16` (400), `error.data` a\n * `LiveChangedElsewhere` naming who made the change.\n *\n * `GET /live/versions`\n */\n async versions(\n params: LiveVersionsParams,\n options?: RequestExtras,\n ): Promise<LiveVersionsResponse> {\n return this.request('GET', '/live/versions', {\n query: {\n entities: params.entities.join(','),\n profile_id: params.profile_id,\n record_id: params.record_id,\n },\n ...options,\n });\n }\n}\n"]}
1
+ {"version":3,"sources":["/home/anes/delo-payment/delopay-typescript-sdk/dist/chunk-CCN44NZJ.cjs","../src/resources/live.ts"],"names":[],"mappings":"AAAA;ACWA,SAAS,SAAA,CAAU,IAAA,EAAc,GAAA,EAAsB;AACrD,EAAA,IAAI,KAAA;AACJ,EAAA,IAAI;AACF,IAAA,MAAA,EAAQ,IAAA,CAAK,KAAA,CAAM,IAAI,CAAA;AAAA,EACzB,EAAA,UAAQ;AACN,IAAA,OAAO,KAAA,CAAA;AAAA,EACT;AACA,EAAA,GAAA,CAAI,MAAA,IAAU,KAAA,GAAQ,OAAO,MAAA,IAAU,SAAA,GAAY,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,EAAG,OAAO,KAAA,CAAA;AAChF,EAAA,uBAAO,MAAA,mBAAO,wBAAA,mBAAyB,KAAA,EAAO,GAAG,CAAA,6BAAG,OAAA;AACtD;AAGO,SAAS,iBAAA,CACd,KAAA,EACA,EAAA,EACA,KAAA,EACwB;AACxB,EAAA,OAAA,CAAQ,KAAA,CAAM,IAAA,EAAM;AAAA,IAClB,KAAK,OAAA,EAAS;AACZ,MAAA,MAAM,QAAA,EAAU,SAAA,CAAU,KAAA,CAAM,IAAA,EAAM,SAAS,CAAA;AAC/C,MAAA,OAAO,EAAE,IAAA,EAAM,OAAA,EAAS,EAAA,EAAI,KAAA,EAAO,OAAA,EAAS,OAAO,QAAA,IAAY,UAAA,EAAY,QAAA,EAAU,KAAK,CAAA;AAAA,IAC5F;AAAA,IACA,KAAK,QAAA,EAAU;AACb,MAAA,MAAM,QAAA,EA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I,eAAA,CAAgB,UAAA,mBAAY,OAAA,CAAQ,WAAA,UAAe,MAAI,CAAA;AACpE;AAQO,IAAM,KAAA,EAAN,MAAW;AAAA,EAChB,WAAA,CACmB,OAAA,EACA,UAAA,EACjB;AAFiB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AACA,IAAA,IAAA,CAAA,WAAA,EAAA,UAAA;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAwBH,MAAM,MAAA,CAAO,OAAA,EAAuD;AAClE,IAAA,OAAO,cAAA,CAAe,IAAA,CAAK,UAAA,EAAY,cAAA,EAAgB,OAAO,CAAA;AAAA,EAChE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAM,QAAA,CACJ,MAAA,EACA,OAAA,EAC+B;AAC/B,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,gBAAA,EAAkB;AAAA,MAC3C,KAAA,EAAO;AAAA,QACL,QAAA,EAAU,MAAA,CAAO,QAAA,CAAS,IAAA,CAAK,GAAG,CAAA;AAAA,QAClC,UAAA,EAAY,MAAA,CAAO,UAAA;AAAA,QACnB,SAAA,EAAW,MAAA,CAAO;AAAA,MACpB,CAAA;AAAA,MACA,GAAG;AAAA,IACL,CAAC,CAAA;AAAA,EACH;AACF,CAAA;AD7DA;AACA;AACE;AACA;AACA;AACA;AACF,uJAAC","file":"/home/anes/delo-payment/delopay-typescript-sdk/dist/chunk-CCN44NZJ.cjs","sourcesContent":[null,"import type {\n LiveChange,\n LiveStreamEvent,\n LiveStreamOptions,\n LiveVersionsParams,\n LiveVersionsResponse,\n} from '../types';\nimport type { EventStreamConnection, EventStreamFn, RequestExtras, RequestFn } from '../client';\nimport type { EventStreamDispatch } from '../eventStream';\n\n/** `key` of the JSON object `data` holds; `undefined` when it holds none. */\nfunction readField(data: string, key: string): unknown {\n let value: unknown;\n try {\n value = JSON.parse(data);\n } catch {\n return undefined;\n }\n if (value === null || typeof value !== 'object' || Array.isArray(value)) return undefined;\n return Object.getOwnPropertyDescriptor(value, key)?.value as unknown;\n}\n\n/** The typed event a dispatch carries, or `null` for a kind the SDK does not know. */\nexport function toLiveStreamEvent(\n event: { type: string; data: string },\n id: string | null,\n retry: number | null,\n): LiveStreamEvent | null {\n switch (event.type) {\n case 'ready': {\n const resumed = readField(event.data, 'resumed');\n return { type: 'ready', id, retry, resumed: typeof resumed === 'boolean' ? resumed : null };\n }\n case 'change': {\n const changes = readField(event.data, 'changes');\n // A change the SDK cannot read still says that something changed: the\n // dashboard reads everything again rather than miss it.\n if (!Array.isArray(changes)) return { type: 'resync', id };\n return { type: 'change', id, changes: changes as LiveChange[] };\n }\n case 'resync':\n return { type: 'resync', id };\n default:\n return null;\n }\n}\n\n/**\n * An open live stream: iterate it with `for await` for its events.\n *\n * It is not reconnected. The iteration ends without an error when the server\n * ends the stream (the session expired, 30 minutes passed, the server\n * restarted) and when the stream is aborted or closed; the dashboard then\n * opens a new one after {@link LiveEventStream.retry}, passing\n * {@link LiveEventStream.lastEventId}. It throws a `DelopayError` with code\n * `TIMEOUT` when the stream stays silent past `idleTimeoutMs` and `NETWORK`\n * when the connection fails; reconnect on those too.\n *\n * Iterate it once. Call {@link LiveEventStream.close} (or abort the signal)\n * to release a stream that is not iterated to its end.\n */\nexport class LiveEventStream implements AsyncIterable<LiveStreamEvent> {\n private _lastEventId: string | null;\n private _retry: number | null = null;\n private iterator?: AsyncGenerator<LiveStreamEvent, void, undefined>;\n\n constructor(\n private readonly connection: EventStreamConnection,\n lastEventId: string | null = null,\n ) {\n this._lastEventId = lastEventId || null;\n }\n\n /**\n * The position to resume after: the id of the last event read, advanced by\n * keepalives too. `null` before the server named one. Send it as\n * `lastEventId` when reconnecting.\n */\n get lastEventId(): string | null {\n return this._lastEventId;\n }\n\n /** The wait before reconnecting the server asked for, in ms; `null` until it says. */\n get retry(): number | null {\n return this._retry;\n }\n\n /** Close the stream; the iteration ends without an error. */\n close(): void {\n this.connection.close();\n }\n\n [Symbol.asyncIterator](): AsyncGenerator<LiveStreamEvent, void, undefined> {\n this.iterator ??= this.events();\n return this.iterator;\n }\n\n private async *events(): AsyncGenerator<LiveStreamEvent, void, undefined> {\n for await (const dispatch of this.connection.dispatches) {\n const event = this.read(dispatch);\n if (event) yield event;\n }\n }\n\n private read(dispatch: EventStreamDispatch): LiveStreamEvent | null {\n this._lastEventId = dispatch.lastEventId || null;\n if (dispatch.retry !== null) this._retry = dispatch.retry;\n if (!dispatch.event) return null;\n return toLiveStreamEvent(dispatch.event, this._lastEventId, this._retry);\n }\n}\n\n/** Open a live stream at `path`. */\nexport async function openLiveStream(\n openStream: EventStreamFn,\n path: string,\n options: LiveStreamOptions = {},\n): Promise<LiveEventStream> {\n const connection = await openStream(path, {\n ...(options.lastEventId ? { lastEventId: options.lastEventId } : {}),\n ...(options.signal ? { signal: options.signal } : {}),\n ...(options.idleTimeoutMs !== undefined ? { idleTimeoutMs: options.idleTimeoutMs } : {}),\n ...(options.headers ? { headers: options.headers } : {}),\n });\n return new LiveEventStream(connection, options.lastEventId ?? null);\n}\n\n/**\n * Live updates of the merchant dashboard: a stream that\n * says what kind of record changed, and the versions an editor names in\n * `If-Match` so a save never overwrites a newer change. Both need a dashboard\n * JWT (`setJwtToken`), not an API key.\n */\nexport class Live {\n constructor(\n private readonly request: RequestFn,\n private readonly openStream: EventStreamFn,\n ) {}\n\n /**\n * Open the stream of what changed in the caller's merchant, as their role\n * may read it. Resolves once the server answered; a `401` rejects with\n * `DelopayAuthenticationError`.\n *\n * The first event is `ready`. `change` names the kinds of record and, when\n * few, the ids that changed: read them again through the usual endpoints.\n * `resync`, and `ready` with `resumed: false`, mean read everything again.\n * The SDK does not reconnect — see {@link LiveEventStream}.\n *\n * `GET /live/stream`\n *\n * @example\n * ```typescript\n * const stream = await delopay.live.stream({ lastEventId, signal });\n * for await (const event of stream) {\n * if (event.type === 'change') refresh(event.changes);\n * else if (event.type === 'resync' || event.resumed === false) refreshAll();\n * }\n * lastEventId = stream.lastEventId; // reconnect after stream.retry\n * ```\n */\n async stream(options?: LiveStreamOptions): Promise<LiveEventStream> {\n return openLiveStream(this.openStream, '/live/stream', options);\n }\n\n /**\n * The current version of each kind of record named, in the caller's\n * merchant and shop. Read it before the record and send the entry's\n * `if_match` in the `If-Match` header of the save: a save over a newer\n * version is refused with `IR_16` (400), `error.data` a\n * `LiveChangedElsewhere` naming who made the change.\n *\n * `GET /live/versions`\n */\n async versions(\n params: LiveVersionsParams,\n options?: RequestExtras,\n ): Promise<LiveVersionsResponse> {\n return this.request('GET', '/live/versions', {\n query: {\n entities: params.entities.join(','),\n profile_id: params.profile_id,\n record_id: params.record_id,\n },\n ...options,\n });\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["/tmp/publish-sdk-04990/dist/chunk-CR3JBTP3.cjs","../src/internal/resources/adminBranding.ts"],"names":[],"mappings":"AAAA;ACYO,IAAM,cAAA,EAAN,MAAoB;AAAA,EACzB,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQlD,MAAM,QAAA,CAAS,OAAA,EAAyD;AACtE,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,wBAAA,EAA0B,EAAE,GAAG,QAAQ,CAAC,CAAA;AAAA,EACrE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAM,MAAA,CACJ,MAAA,EACA,OAAA,EACgC;AAChC,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,wBAAA,EAA0B,EAAE,IAAA,EAAM,MAAA,EAAQ,GAAG,QAAQ,CAAC,CAAA;AAAA,EACnF;AACF,CAAA;ADbA;AACA;AACE;AACF,sCAAC","file":"/tmp/publish-sdk-04990/dist/chunk-CR3JBTP3.cjs","sourcesContent":[null,"import type { RequestExtras, RequestFn } from '../../client';\nimport type { BrandingAdminResponse, BrandingUpdateRequest } from '../types';\n\n/**\n * The deployment's branding as the platform operator edits it: name, logos,\n * favicon, email font and accent, and the default checkout, status page and\n * redirect page colours.\n *\n * Needs the admin API key or an internal user with permission to change\n * accounts, for reading too. Every change is recorded in the audit log as a\n * change of the setting `deployment.branding` (`entity_type: 'setting'`).\n */\nexport class AdminBranding {\n constructor(private readonly request: RequestFn) {}\n\n /**\n * What is saved, the value in force for each unset field, and the revision\n * to send back on the next update.\n *\n * `GET /admin-portal/branding`\n */\n async retrieve(options?: RequestExtras): Promise<BrandingAdminResponse> {\n return this.request('GET', '/admin-portal/branding', { ...options });\n }\n\n /**\n * Replace the whole branding; all fields `null` clears it. A changed image\n * or font address is fetched first and refused unless it answers with the\n * right kind of file. A stale `expected_revision` is refused and changes\n * nothing.\n *\n * `PUT /admin-portal/branding`\n */\n async update(\n params: BrandingUpdateRequest,\n options?: RequestExtras,\n ): Promise<BrandingAdminResponse> {\n return this.request('PUT', '/admin-portal/branding', { body: params, ...options });\n }\n}\n"]}
1
+ {"version":3,"sources":["/home/anes/delo-payment/delopay-typescript-sdk/dist/chunk-CR3JBTP3.cjs","../src/internal/resources/adminBranding.ts"],"names":[],"mappings":"AAAA;ACYO,IAAM,cAAA,EAAN,MAAoB;AAAA,EACzB,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQlD,MAAM,QAAA,CAAS,OAAA,EAAyD;AACtE,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,wBAAA,EAA0B,EAAE,GAAG,QAAQ,CAAC,CAAA;AAAA,EACrE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAM,MAAA,CACJ,MAAA,EACA,OAAA,EACgC;AAChC,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,wBAAA,EAA0B,EAAE,IAAA,EAAM,MAAA,EAAQ,GAAG,QAAQ,CAAC,CAAA;AAAA,EACnF;AACF,CAAA;ADbA;AACA;AACE;AACF,sCAAC","file":"/home/anes/delo-payment/delopay-typescript-sdk/dist/chunk-CR3JBTP3.cjs","sourcesContent":[null,"import type { RequestExtras, RequestFn } from '../../client';\nimport type { BrandingAdminResponse, BrandingUpdateRequest } from '../types';\n\n/**\n * The deployment's branding as the platform operator edits it: name, logos,\n * favicon, email font and accent, and the default checkout, status page and\n * redirect page colours.\n *\n * Needs the admin API key or an internal user with permission to change\n * accounts, for reading too. Every change is recorded in the audit log as a\n * change of the setting `deployment.branding` (`entity_type: 'setting'`).\n */\nexport class AdminBranding {\n constructor(private readonly request: RequestFn) {}\n\n /**\n * What is saved, the value in force for each unset field, and the revision\n * to send back on the next update.\n *\n * `GET /admin-portal/branding`\n */\n async retrieve(options?: RequestExtras): Promise<BrandingAdminResponse> {\n return this.request('GET', '/admin-portal/branding', { ...options });\n }\n\n /**\n * Replace the whole branding; all fields `null` clears it. A changed image\n * or font address is fetched first and refused unless it answers with the\n * right kind of file. A stale `expected_revision` is refused and changes\n * nothing.\n *\n * `PUT /admin-portal/branding`\n */\n async update(\n params: BrandingUpdateRequest,\n options?: RequestExtras,\n ): Promise<BrandingAdminResponse> {\n return this.request('PUT', '/admin-portal/branding', { body: params, ...options });\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["/tmp/publish-sdk-04990/dist/chunk-DJASVBOJ.cjs","../src/resources/shopLabels.ts"],"names":[],"mappings":"AAAA;ACUA,IAAM,WAAA,EAAa,CAAC,UAAA,EAAA,GAClB,CAAA,SAAA,EAAY,kBAAA,CAAmB,UAAU,CAAC,CAAA,wBAAA,CAAA;AAcrC,IAAM,WAAA,EAAN,MAAiB;AAAA,EACtB,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASlD,MAAM,IAAA,CAAK,UAAA,EAAkD;AAC3D,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,UAAA,CAAW,UAAU,CAAC,CAAA;AAAA,EACnD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,MAAA,CAAO,UAAA,EAAoB,MAAA,EAA4D;AAC3F,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,MAAA,EAAQ,UAAA,CAAW,UAAU,CAAA,EAAG,EAAE,IAAA,EAAM,OAAO,CAAC,CAAA;AAAA,EACtE;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,MAAA,CACJ,UAAA,EACA,OAAA,EACA,MAAA,EAC4B;AAC5B,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,OAAA,EAAS,CAAA,EAAA;AACrB,MAAA;AACP,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAMiC,EAAA;AACD,IAAA;AAChC,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUE,EAAA;AAGY,IAAA;AACV,MAAA;AACY,MAAA;AACG,MAAA;AACjB,IAAA;AACF,EAAA;AACF;ADjCkC;AACA;AACA;AACA","file":"/tmp/publish-sdk-04990/dist/chunk-DJASVBOJ.cjs","sourcesContent":[null,"import type {\n ShopLabelCreateRequest,\n ShopLabelDeleteResponse,\n ShopLabelResponse,\n ShopLabelsResponse,\n ShopLabelsSetRequest,\n ShopLabelUpdateRequest,\n} from '../types';\nimport type { RequestFn } from '../client';\n\nconst labelsPath = (merchantId: string): string =>\n `/account/${encodeURIComponent(merchantId)}/business-profile/labels`;\n\n/**\n * Shop labels: the merchant's own tags for grouping shops, for example by\n * industry, brand or region. A shop can carry several\n * labels and a label is shared by every shop of the merchant. Labels are\n * separate from projects and change nothing about a shop's project, payments\n * or routing.\n *\n * Reading needs the `Account` area at `Read`; every change needs `Write`.\n * Renaming and deleting change every shop that carries the label, so a caller\n * limited to one shop may not do either; it may create labels and set its own\n * shop's labels. Labels of one merchant are never visible to another.\n */\nexport class ShopLabels {\n constructor(private readonly request: RequestFn) {}\n\n /**\n * Every label of the merchant, ordered by name, each with the ids of the\n * shops that carry it. A shop with several labels appears under each of\n * them; a shop with none appears under no label. A caller limited to one\n * shop sees every label but only its own shop in `profile_ids`.\n * `GET /account/{merchantId}/business-profile/labels`\n */\n async list(merchantId: string): Promise<ShopLabelResponse[]> {\n return this.request('GET', labelsPath(merchantId));\n }\n\n /**\n * Create a label. The name is trimmed and inner whitespace collapsed; a\n * name that differs from an existing label only in letter case is refused\n * (`IR_38`), so one category is never spelled two ways. A merchant holds at\n * most 200 labels.\n * `POST /account/{merchantId}/business-profile/labels`\n */\n async create(merchantId: string, params: ShopLabelCreateRequest): Promise<ShopLabelResponse> {\n return this.request('POST', labelsPath(merchantId), { body: params });\n }\n\n /**\n * Rename a label on every shop that carries it.\n * `PATCH /account/{merchantId}/business-profile/labels/{labelId}`\n */\n async update(\n merchantId: string,\n labelId: string,\n params: ShopLabelUpdateRequest,\n ): Promise<ShopLabelResponse> {\n return this.request('PATCH', `${labelsPath(merchantId)}/${encodeURIComponent(labelId)}`, {\n body: params,\n });\n }\n\n /**\n * Delete a label and remove it from every shop. The shops are unchanged.\n * `DELETE /account/{merchantId}/business-profile/labels/{labelId}`\n */\n async delete(merchantId: string, labelId: string): Promise<ShopLabelDeleteResponse> {\n return this.request('DELETE', `${labelsPath(merchantId)}/${encodeURIComponent(labelId)}`);\n }\n\n /**\n * Replace the labels of one shop: `label_ids` is the complete set\n * afterwards, so a label left out is removed from the shop and an empty\n * list removes them all. At most 20 per shop.\n * `PUT /account/{merchantId}/business-profile/{profileId}/labels`\n */\n async setForShop(\n merchantId: string,\n profileId: string,\n params: ShopLabelsSetRequest,\n ): Promise<ShopLabelsResponse> {\n return this.request(\n 'PUT',\n `/account/${encodeURIComponent(merchantId)}/business-profile/${encodeURIComponent(profileId)}/labels`,\n { body: params },\n );\n }\n}\n"]}
1
+ {"version":3,"sources":["/home/anes/delo-payment/delopay-typescript-sdk/dist/chunk-DJASVBOJ.cjs","../src/resources/shopLabels.ts"],"names":[],"mappings":"AAAA;ACUA,IAAM,WAAA,EAAa,CAAC,UAAA,EAAA,GAClB,CAAA,SAAA,EAAY,kBAAA,CAAmB,UAAU,CAAC,CAAA,wBAAA,CAAA;AAcrC,IAAM,WAAA,EAAN,MAAiB;AAAA,EACtB,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASlD,MAAM,IAAA,CAAK,UAAA,EAAkD;AAC3D,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,UAAA,CAAW,UAAU,CAAC,CAAA;AAAA,EACnD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,MAAA,CAAO,UAAA,EAAoB,MAAA,EAA4D;AAC3F,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,MAAA,EAAQ,UAAA,CAAW,UAAU,CAAA,EAAG,EAAE,IAAA,EAAM,OAAO,CAAC,CAAA;AAAA,EACtE;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,MAAA,CACJ,UAAA,EACA,OAAA,EACA,MAAA,EAC4B;AAC5B,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,OAAA,EAAS,CAAA,EAAA;AACrB,MAAA;AACP,IAAA;AACH,EAAA;AAAA;AAAA;AAAA;AAAA;AAMiC,EAAA;AACD,IAAA;AAChC,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUE,EAAA;AAGY,IAAA;AACV,MAAA;AACY,MAAA;AACG,MAAA;AACjB,IAAA;AACF,EAAA;AACF;ADjCkC;AACA;AACA;AACA","file":"/home/anes/delo-payment/delopay-typescript-sdk/dist/chunk-DJASVBOJ.cjs","sourcesContent":[null,"import type {\n ShopLabelCreateRequest,\n ShopLabelDeleteResponse,\n ShopLabelResponse,\n ShopLabelsResponse,\n ShopLabelsSetRequest,\n ShopLabelUpdateRequest,\n} from '../types';\nimport type { RequestFn } from '../client';\n\nconst labelsPath = (merchantId: string): string =>\n `/account/${encodeURIComponent(merchantId)}/business-profile/labels`;\n\n/**\n * Shop labels: the merchant's own tags for grouping shops, for example by\n * industry, brand or region. A shop can carry several\n * labels and a label is shared by every shop of the merchant. Labels are\n * separate from projects and change nothing about a shop's project, payments\n * or routing.\n *\n * Reading needs the `Account` area at `Read`; every change needs `Write`.\n * Renaming and deleting change every shop that carries the label, so a caller\n * limited to one shop may not do either; it may create labels and set its own\n * shop's labels. Labels of one merchant are never visible to another.\n */\nexport class ShopLabels {\n constructor(private readonly request: RequestFn) {}\n\n /**\n * Every label of the merchant, ordered by name, each with the ids of the\n * shops that carry it. A shop with several labels appears under each of\n * them; a shop with none appears under no label. A caller limited to one\n * shop sees every label but only its own shop in `profile_ids`.\n * `GET /account/{merchantId}/business-profile/labels`\n */\n async list(merchantId: string): Promise<ShopLabelResponse[]> {\n return this.request('GET', labelsPath(merchantId));\n }\n\n /**\n * Create a label. The name is trimmed and inner whitespace collapsed; a\n * name that differs from an existing label only in letter case is refused\n * (`IR_38`), so one category is never spelled two ways. A merchant holds at\n * most 200 labels.\n * `POST /account/{merchantId}/business-profile/labels`\n */\n async create(merchantId: string, params: ShopLabelCreateRequest): Promise<ShopLabelResponse> {\n return this.request('POST', labelsPath(merchantId), { body: params });\n }\n\n /**\n * Rename a label on every shop that carries it.\n * `PATCH /account/{merchantId}/business-profile/labels/{labelId}`\n */\n async update(\n merchantId: string,\n labelId: string,\n params: ShopLabelUpdateRequest,\n ): Promise<ShopLabelResponse> {\n return this.request('PATCH', `${labelsPath(merchantId)}/${encodeURIComponent(labelId)}`, {\n body: params,\n });\n }\n\n /**\n * Delete a label and remove it from every shop. The shops are unchanged.\n * `DELETE /account/{merchantId}/business-profile/labels/{labelId}`\n */\n async delete(merchantId: string, labelId: string): Promise<ShopLabelDeleteResponse> {\n return this.request('DELETE', `${labelsPath(merchantId)}/${encodeURIComponent(labelId)}`);\n }\n\n /**\n * Replace the labels of one shop: `label_ids` is the complete set\n * afterwards, so a label left out is removed from the shop and an empty\n * list removes them all. At most 20 per shop.\n * `PUT /account/{merchantId}/business-profile/{profileId}/labels`\n */\n async setForShop(\n merchantId: string,\n profileId: string,\n params: ShopLabelsSetRequest,\n ): Promise<ShopLabelsResponse> {\n return this.request(\n 'PUT',\n `/account/${encodeURIComponent(merchantId)}/business-profile/${encodeURIComponent(profileId)}/labels`,\n { body: params },\n );\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["/tmp/publish-sdk-04990/dist/chunk-EEB2HDYL.cjs","../src/resources/industries.ts"],"names":[],"mappings":"AAAA;ACgDO,IAAM,WAAA,EAAN,MAAiB;AAAA,EACtB,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOlD,MAAM,gBAAA,CAAA,EAAoD;AACxD,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,sBAAsB,CAAA;AAAA,EACnD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,WAAA,CACJ,MAAA,EACA,OAAA,EACiC;AACjC,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,sBAAA,EAAwB,EAAE,IAAA,EAAM,MAAA,EAAQ,KAAA,EAAO,EAAE,GAAG,QAAQ,EAAE,CAAC,CAAA;AAAA,EAC5F;AAAA;AAAA;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B,EAAA;AACF;AAEgD;AACvC,EAAA;AACT;AAE6C;AACf,EAAA;AAC9B;AAE6C;AACjB,EAAA;AAC5B;AD1FgC;AACA;AACA;AACA","file":"/tmp/publish-sdk-04990/dist/chunk-EEB2HDYL.cjs","sourcesContent":[null,"import type {\n IndustryApplyQuery,\n IndustryChangeImpact,\n IndustryClassification,\n IndustryImpactQuery,\n IndustrySelectionRequest,\n IndustrySuggestQuery,\n IndustrySuggestions,\n OwnIndustry,\n OwnIndustryCreateRequest,\n OwnIndustryList,\n OwnIndustryRemoveQuery,\n OwnIndustryRemoved,\n OwnIndustryRenameRequest,\n} from '../types';\nimport type { RequestFn } from '../client';\n\n/**\n * The industry of the caller's merchant, its projects and its shops.\n *\n * One primary industry per merchant, project or shop: an industry or a\n * sub-industry, which implies its industry. A shop without its own selection\n * inherits the nearest one of its project and that project's parents, then the\n * merchant's. A project inherits from its parents, then the merchant. Every\n * call answers the target's `IndustryClassification`: what is stored there,\n * what it inherits, what applies, what can be selected and whether the caller\n * may change it.\n *\n * Classification only: payments, routing, risk policies, the merchant\n * category code and shop labels do not read it, and a change writes none of\n * them. Every change is recorded in the audit log\n * (`entity_type: 'industry_selection'`).\n *\n * A payment counts in the industry its shop had when the payment was created.\n * Every write that changes a shop's industry takes an optional\n * `IndustryApplyQuery`: which of its existing payments follow the change\n * (`all`, the default; from a `from_date`; or from today). The `impact*`\n * methods preview how many would move before writing. Besides DeloPay's\n * industries, a merchant can define its own (`createOwn`), which only it sees\n * and selects.\n *\n * Dashboard (JWT) routes; the merchant comes from the token. Reading needs\n * `MerchantIndustryRead` (merchant, project) or `ProfileIndustryRead` (shop);\n * changing needs `MerchantIndustryWrite`, `MerchantIndustryEdit` or\n * `ProfileIndustryEdit`. A scope the caller may not address answers 403\n * (`IR_22`); a project or shop the merchant does not hold answers 404\n * (`IR_37`); an id that cannot be selected there answers 400 (`IR_16`).\n */\nexport class Industries {\n constructor(private readonly request: RequestFn) {}\n\n /**\n * The merchant's industry: the default its projects and shops inherit.\n *\n * `GET /industries/merchant`\n */\n async retrieveMerchant(): Promise<IndustryClassification> {\n return this.request('GET', '/industries/merchant');\n }\n\n /**\n * Select the merchant's industry.\n *\n * `PUT /industries/merchant`\n */\n async setMerchant(\n params: IndustrySelectionRequest,\n options?: IndustryApplyQuery,\n ): Promise<IndustryClassification> {\n return this.request('PUT', '/industries/merchant', { body: params, query: { ...options } });\n }\n\n /**\n * Clear the merchant's industry.\n *\n * `DELETE /industries/merchant`\n */\n async clearMerchant(options?: IndustryApplyQuery): Promise<IndustryClassification> {\n return this.request('DELETE', '/industries/merchant', { query: { ...options } });\n }\n\n /**\n * One project's industry.\n *\n * `GET /industries/projects/{projectId}`\n */\n async retrieveProject(projectId: string): Promise<IndustryClassification> {\n return this.request('GET', projectPath(projectId));\n }\n\n /**\n * Select one project's industry.\n *\n * `PUT /industries/projects/{projectId}`\n */\n async setProject(\n projectId: string,\n params: IndustrySelectionRequest,\n options?: IndustryApplyQuery,\n ): Promise<IndustryClassification> {\n return this.request('PUT', projectPath(projectId), { body: params, query: { ...options } });\n }\n\n /**\n * Clear one project's industry, so it inherits again.\n *\n * `DELETE /industries/projects/{projectId}`\n */\n async clearProject(\n projectId: string,\n options?: IndustryApplyQuery,\n ): Promise<IndustryClassification> {\n return this.request('DELETE', projectPath(projectId), { query: { ...options } });\n }\n\n /**\n * One shop's industry.\n *\n * `GET /industries/shops/{profileId}`\n */\n async retrieveShop(profileId: string): Promise<IndustryClassification> {\n return this.request('GET', shopPath(profileId));\n }\n\n /**\n * Select one shop's industry.\n *\n * `PUT /industries/shops/{profileId}`\n */\n async setShop(\n profileId: string,\n params: IndustrySelectionRequest,\n options?: IndustryApplyQuery,\n ): Promise<IndustryClassification> {\n return this.request('PUT', shopPath(profileId), { body: params, query: { ...options } });\n }\n\n /**\n * Clear one shop's industry, so it inherits again.\n *\n * `DELETE /industries/shops/{profileId}`\n */\n async clearShop(\n profileId: string,\n options?: IndustryApplyQuery,\n ): Promise<IndustryClassification> {\n return this.request('DELETE', shopPath(profileId), { query: { ...options } });\n }\n\n /**\n * What selecting `industry_id` for the merchant (or clearing it, when\n * omitted) would move: the shops whose effective industry changes and their\n * payments, test and live, in total, from `from_date` and from today.\n * Writes nothing. Same permission as reading the classification.\n *\n * `GET /industries/merchant/impact`\n */\n async impactMerchant(query: IndustryImpactQuery = {}): Promise<IndustryChangeImpact> {\n return this.request('GET', '/industries/merchant/impact', { query: { ...query } });\n }\n\n /**\n * As `impactMerchant`, for one project's selection.\n *\n * `GET /industries/projects/{projectId}/impact`\n */\n async impactProject(\n projectId: string,\n query: IndustryImpactQuery = {},\n ): Promise<IndustryChangeImpact> {\n return this.request('GET', `${projectPath(projectId)}/impact`, { query: { ...query } });\n }\n\n /**\n * As `impactMerchant`, for one shop's selection.\n *\n * `GET /industries/shops/{profileId}/impact`\n */\n async impactShop(\n profileId: string,\n query: IndustryImpactQuery = {},\n ): Promise<IndustryChangeImpact> {\n return this.request('GET', `${shopPath(profileId)}/impact`, { query: { ...query } });\n }\n\n /**\n * The merchant's own industries: the active ones, and those mapped to one of\n * DeloPay's in the last 90 days, with the selections naming each. Needs\n * `MerchantIndustryRead` at merchant level.\n *\n * `GET /industries/own`\n */\n async listOwn(): Promise<OwnIndustryList> {\n return this.request('GET', '/industries/own');\n }\n\n /**\n * Define an industry only this merchant sees and selects, optionally under\n * one of DeloPay's industries it can select. It never has sub-industries; at\n * most 100 are active at once (422, `IR_06`). Needs `MerchantIndustryWrite`\n * at merchant level.\n *\n * `POST /industries/own`\n */\n async createOwn(params: OwnIndustryCreateRequest): Promise<OwnIndustry> {\n return this.request('POST', '/industries/own', { body: params });\n }\n\n /**\n * Rename an active own industry. With `apply_to` `from` or `today` the answer\n * is the new own industry that carries the new name (see\n * `OwnIndustryRenameRequest`). Needs `MerchantIndustryWrite`.\n *\n * `PATCH /industries/own/{industryId}`\n */\n async renameOwn(industryId: string, params: OwnIndustryRenameRequest): Promise<OwnIndustry> {\n return this.request('PATCH', ownPath(industryId), { body: params });\n }\n\n /**\n * Archive an active own industry. While a selection names it, `replacement`\n * is required: an industry the merchant can select, which every such\n * selection then names, or `'inherit'`, which clears them. The shops whose\n * industry changes move their payments from `apply_to` on. Needs\n * `MerchantIndustryWrite`.\n *\n * `DELETE /industries/own/{industryId}`\n */\n async removeOwn(\n industryId: string,\n query: OwnIndustryRemoveQuery = {},\n ): Promise<OwnIndustryRemoved> {\n return this.request('DELETE', ownPath(industryId), { query: { ...query } });\n }\n\n /**\n * At most three of DeloPay's industries and sub-industries the merchant can\n * select that are like `name`, closest first: a hint before defining an own\n * industry. Needs `MerchantIndustryRead` at merchant level.\n *\n * `GET /industries/suggest`\n */\n async suggest(query: IndustrySuggestQuery): Promise<IndustrySuggestions> {\n return this.request('GET', '/industries/suggest', { query: { ...query } });\n }\n}\n\nfunction projectPath(projectId: string): string {\n return `/industries/projects/${encodeURIComponent(projectId)}`;\n}\n\nfunction shopPath(profileId: string): string {\n return `/industries/shops/${encodeURIComponent(profileId)}`;\n}\n\nfunction ownPath(industryId: string): string {\n return `/industries/own/${encodeURIComponent(industryId)}`;\n}\n"]}
1
+ {"version":3,"sources":["/home/anes/delo-payment/delopay-typescript-sdk/dist/chunk-EEB2HDYL.cjs","../src/resources/industries.ts"],"names":[],"mappings":"AAAA;ACgDO,IAAM,WAAA,EAAN,MAAiB;AAAA,EACtB,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOlD,MAAM,gBAAA,CAAA,EAAoD;AACxD,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,sBAAsB,CAAA;AAAA,EACnD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,WAAA,CACJ,MAAA,EACA,OAAA,EACiC;AACjC,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,sBAAA,EAAwB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aE,EAAA;AAEoB,IAAA;AACtB,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASyE,EAAA;AAC5C,IAAA;AAC7B,EAAA;AACF;AAEgD;AACvC,EAAA;AACT;AAE6C;AACf,EAAA;AAC9B;AAE6C;AACjB,EAAA;AAC5B;AD1FgC;AACA;AACA;AACA","file":"/home/anes/delo-payment/delopay-typescript-sdk/dist/chunk-EEB2HDYL.cjs","sourcesContent":[null,"import type {\n IndustryApplyQuery,\n IndustryChangeImpact,\n IndustryClassification,\n IndustryImpactQuery,\n IndustrySelectionRequest,\n IndustrySuggestQuery,\n IndustrySuggestions,\n OwnIndustry,\n OwnIndustryCreateRequest,\n OwnIndustryList,\n OwnIndustryRemoveQuery,\n OwnIndustryRemoved,\n OwnIndustryRenameRequest,\n} from '../types';\nimport type { RequestFn } from '../client';\n\n/**\n * The industry of the caller's merchant, its projects and its shops.\n *\n * One primary industry per merchant, project or shop: an industry or a\n * sub-industry, which implies its industry. A shop without its own selection\n * inherits the nearest one of its project and that project's parents, then the\n * merchant's. A project inherits from its parents, then the merchant. Every\n * call answers the target's `IndustryClassification`: what is stored there,\n * what it inherits, what applies, what can be selected and whether the caller\n * may change it.\n *\n * Classification only: payments, routing, risk policies, the merchant\n * category code and shop labels do not read it, and a change writes none of\n * them. Every change is recorded in the audit log\n * (`entity_type: 'industry_selection'`).\n *\n * A payment counts in the industry its shop had when the payment was created.\n * Every write that changes a shop's industry takes an optional\n * `IndustryApplyQuery`: which of its existing payments follow the change\n * (`all`, the default; from a `from_date`; or from today). The `impact*`\n * methods preview how many would move before writing. Besides DeloPay's\n * industries, a merchant can define its own (`createOwn`), which only it sees\n * and selects.\n *\n * Dashboard (JWT) routes; the merchant comes from the token. Reading needs\n * `MerchantIndustryRead` (merchant, project) or `ProfileIndustryRead` (shop);\n * changing needs `MerchantIndustryWrite`, `MerchantIndustryEdit` or\n * `ProfileIndustryEdit`. A scope the caller may not address answers 403\n * (`IR_22`); a project or shop the merchant does not hold answers 404\n * (`IR_37`); an id that cannot be selected there answers 400 (`IR_16`).\n */\nexport class Industries {\n constructor(private readonly request: RequestFn) {}\n\n /**\n * The merchant's industry: the default its projects and shops inherit.\n *\n * `GET /industries/merchant`\n */\n async retrieveMerchant(): Promise<IndustryClassification> {\n return this.request('GET', '/industries/merchant');\n }\n\n /**\n * Select the merchant's industry.\n *\n * `PUT /industries/merchant`\n */\n async setMerchant(\n params: IndustrySelectionRequest,\n options?: IndustryApplyQuery,\n ): Promise<IndustryClassification> {\n return this.request('PUT', '/industries/merchant', { body: params, query: { ...options } });\n }\n\n /**\n * Clear the merchant's industry.\n *\n * `DELETE /industries/merchant`\n */\n async clearMerchant(options?: IndustryApplyQuery): Promise<IndustryClassification> {\n return this.request('DELETE', '/industries/merchant', { query: { ...options } });\n }\n\n /**\n * One project's industry.\n *\n * `GET /industries/projects/{projectId}`\n */\n async retrieveProject(projectId: string): Promise<IndustryClassification> {\n return this.request('GET', projectPath(projectId));\n }\n\n /**\n * Select one project's industry.\n *\n * `PUT /industries/projects/{projectId}`\n */\n async setProject(\n projectId: string,\n params: IndustrySelectionRequest,\n options?: IndustryApplyQuery,\n ): Promise<IndustryClassification> {\n return this.request('PUT', projectPath(projectId), { body: params, query: { ...options } });\n }\n\n /**\n * Clear one project's industry, so it inherits again.\n *\n * `DELETE /industries/projects/{projectId}`\n */\n async clearProject(\n projectId: string,\n options?: IndustryApplyQuery,\n ): Promise<IndustryClassification> {\n return this.request('DELETE', projectPath(projectId), { query: { ...options } });\n }\n\n /**\n * One shop's industry.\n *\n * `GET /industries/shops/{profileId}`\n */\n async retrieveShop(profileId: string): Promise<IndustryClassification> {\n return this.request('GET', shopPath(profileId));\n }\n\n /**\n * Select one shop's industry.\n *\n * `PUT /industries/shops/{profileId}`\n */\n async setShop(\n profileId: string,\n params: IndustrySelectionRequest,\n options?: IndustryApplyQuery,\n ): Promise<IndustryClassification> {\n return this.request('PUT', shopPath(profileId), { body: params, query: { ...options } });\n }\n\n /**\n * Clear one shop's industry, so it inherits again.\n *\n * `DELETE /industries/shops/{profileId}`\n */\n async clearShop(\n profileId: string,\n options?: IndustryApplyQuery,\n ): Promise<IndustryClassification> {\n return this.request('DELETE', shopPath(profileId), { query: { ...options } });\n }\n\n /**\n * What selecting `industry_id` for the merchant (or clearing it, when\n * omitted) would move: the shops whose effective industry changes and their\n * payments, test and live, in total, from `from_date` and from today.\n * Writes nothing. Same permission as reading the classification.\n *\n * `GET /industries/merchant/impact`\n */\n async impactMerchant(query: IndustryImpactQuery = {}): Promise<IndustryChangeImpact> {\n return this.request('GET', '/industries/merchant/impact', { query: { ...query } });\n }\n\n /**\n * As `impactMerchant`, for one project's selection.\n *\n * `GET /industries/projects/{projectId}/impact`\n */\n async impactProject(\n projectId: string,\n query: IndustryImpactQuery = {},\n ): Promise<IndustryChangeImpact> {\n return this.request('GET', `${projectPath(projectId)}/impact`, { query: { ...query } });\n }\n\n /**\n * As `impactMerchant`, for one shop's selection.\n *\n * `GET /industries/shops/{profileId}/impact`\n */\n async impactShop(\n profileId: string,\n query: IndustryImpactQuery = {},\n ): Promise<IndustryChangeImpact> {\n return this.request('GET', `${shopPath(profileId)}/impact`, { query: { ...query } });\n }\n\n /**\n * The merchant's own industries: the active ones, and those mapped to one of\n * DeloPay's in the last 90 days, with the selections naming each. Needs\n * `MerchantIndustryRead` at merchant level.\n *\n * `GET /industries/own`\n */\n async listOwn(): Promise<OwnIndustryList> {\n return this.request('GET', '/industries/own');\n }\n\n /**\n * Define an industry only this merchant sees and selects, optionally under\n * one of DeloPay's industries it can select. It never has sub-industries; at\n * most 100 are active at once (422, `IR_06`). Needs `MerchantIndustryWrite`\n * at merchant level.\n *\n * `POST /industries/own`\n */\n async createOwn(params: OwnIndustryCreateRequest): Promise<OwnIndustry> {\n return this.request('POST', '/industries/own', { body: params });\n }\n\n /**\n * Rename an active own industry. With `apply_to` `from` or `today` the answer\n * is the new own industry that carries the new name (see\n * `OwnIndustryRenameRequest`). Needs `MerchantIndustryWrite`.\n *\n * `PATCH /industries/own/{industryId}`\n */\n async renameOwn(industryId: string, params: OwnIndustryRenameRequest): Promise<OwnIndustry> {\n return this.request('PATCH', ownPath(industryId), { body: params });\n }\n\n /**\n * Archive an active own industry. While a selection names it, `replacement`\n * is required: an industry the merchant can select, which every such\n * selection then names, or `'inherit'`, which clears them. The shops whose\n * industry changes move their payments from `apply_to` on. Needs\n * `MerchantIndustryWrite`.\n *\n * `DELETE /industries/own/{industryId}`\n */\n async removeOwn(\n industryId: string,\n query: OwnIndustryRemoveQuery = {},\n ): Promise<OwnIndustryRemoved> {\n return this.request('DELETE', ownPath(industryId), { query: { ...query } });\n }\n\n /**\n * At most three of DeloPay's industries and sub-industries the merchant can\n * select that are like `name`, closest first: a hint before defining an own\n * industry. Needs `MerchantIndustryRead` at merchant level.\n *\n * `GET /industries/suggest`\n */\n async suggest(query: IndustrySuggestQuery): Promise<IndustrySuggestions> {\n return this.request('GET', '/industries/suggest', { query: { ...query } });\n }\n}\n\nfunction projectPath(projectId: string): string {\n return `/industries/projects/${encodeURIComponent(projectId)}`;\n}\n\nfunction shopPath(profileId: string): string {\n return `/industries/shops/${encodeURIComponent(profileId)}`;\n}\n\nfunction ownPath(industryId: string): string {\n return `/industries/own/${encodeURIComponent(industryId)}`;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["/tmp/publish-sdk-04990/dist/chunk-ENPSUWTS.cjs","../src/internal/resources/connectorRestrictions.ts"],"names":[],"mappings":"AAAA;ACWO,IAAM,sBAAA,EAAN,MAA4B;AAAA,EACjC,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOlD,MAAM,MAAA,CAAO,IAAA,EAAgF;AAC3F,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,MAAA,EAAQ,+BAAA,EAAiC,EAAE,KAAK,CAAC,CAAA;AAAA,EACvE;AAAA,EAEA,MAAM,IAAA,CAAA,EAAgD;AACpD,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,+BAA+B,CAAA;AAAA,EAC5D;AAAA,EAEA,MAAM,QAAA,CAAS,aAAA,EAA8D;AAC3E,IAAA,OAAO,IAAA,CAAK,OAAA;AAAA,MACV,KAAA;AAAA,MACA,CAAA,8BAAA,EAAiC,kBAAA,CAAmB,aAAa,CAAC,CAAA;AAAA,IAAA;AACpE,EAAA;AACF;AAAA,EAAA;AAIE,IAAA;AAAY,MAAA;AACV,MAAA;AACkE,IAAA;AACpE,EAAA;AAEJ;ADXA;AACA;AACA;AACA","file":"/tmp/publish-sdk-04990/dist/chunk-ENPSUWTS.cjs","sourcesContent":[null,"import type { ConnectorRestrictionResponse, UpsertConnectorRestrictionRequest } from '../types';\nimport type { RequestFn } from '../../client';\n\n/**\n * Admin-only allowlist for phased connector rollouts.\n *\n * Default-open semantics: a connector with no restriction row is\n * usable by every merchant (current behavior). A connector with a\n * row is gated — only merchants in `allowed_merchant_ids` can attach\n * a connector account. Enforced server-side at MCA-create time.\n */\nexport class ConnectorRestrictions {\n constructor(private readonly request: RequestFn) {}\n\n /**\n * Idempotent upsert. If a row exists for `connector_name`, its\n * allowlist + reason are replaced. To open the connector to\n * everyone again, call `delete()`.\n */\n async upsert(body: UpsertConnectorRestrictionRequest): Promise<ConnectorRestrictionResponse> {\n return this.request('POST', '/admin/connector-restrictions', { body });\n }\n\n async list(): Promise<ConnectorRestrictionResponse[]> {\n return this.request('GET', '/admin/connector-restrictions');\n }\n\n async retrieve(connectorName: string): Promise<ConnectorRestrictionResponse> {\n return this.request(\n 'GET',\n `/admin/connector-restrictions/${encodeURIComponent(connectorName)}`,\n );\n }\n\n /** Removing the row makes the connector public again. */\n async delete(connectorName: string): Promise<{ connector_name: string; deleted: boolean }> {\n return this.request(\n 'DELETE',\n `/admin/connector-restrictions/${encodeURIComponent(connectorName)}`,\n );\n }\n}\n"]}
1
+ {"version":3,"sources":["/home/anes/delo-payment/delopay-typescript-sdk/dist/chunk-ENPSUWTS.cjs","../src/internal/resources/connectorRestrictions.ts"],"names":[],"mappings":"AAAA;ACWO,IAAM,sBAAA,EAAN,MAA4B;AAAA,EACjC,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOlD,MAAM,MAAA,CAAO,IAAA,EAAgF;AAC3F,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,MAAA,EAAQ,+BAAA,EAAiC,EAAE,KAAK,CAAC,CAAA;AAAA,EACvE;AAAA,EAEA,MAAM,IAAA,CAAA,EAAgD;AACpD,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,+BAA+B,CAAA;AAAA,EAC5D;AAAA,EAEA,MAAM,QAAA,CAAS,aAAA,EAA8D;AAC3E,IAAA,OAAO,IAAA,CAAK,OAAA;AAAA,MACV,KAAA;AAAA,MACA,CAAA,8BAAA,EAAiC,kBAAA,CAAmB,aAAa,CAAC,CAAA;AAAA,IAAA;AACpE,EAAA;AACF;AAAA,EAAA;AAIE,IAAA;AAAY,MAAA;AACV,MAAA;AACkE,IAAA;AACpE,EAAA;AAEJ;ADXA;AACA;AACA;AACA","file":"/home/anes/delo-payment/delopay-typescript-sdk/dist/chunk-ENPSUWTS.cjs","sourcesContent":[null,"import type { ConnectorRestrictionResponse, UpsertConnectorRestrictionRequest } from '../types';\nimport type { RequestFn } from '../../client';\n\n/**\n * Admin-only allowlist for phased connector rollouts.\n *\n * Default-open semantics: a connector with no restriction row is\n * usable by every merchant (current behavior). A connector with a\n * row is gated — only merchants in `allowed_merchant_ids` can attach\n * a connector account. Enforced server-side at MCA-create time.\n */\nexport class ConnectorRestrictions {\n constructor(private readonly request: RequestFn) {}\n\n /**\n * Idempotent upsert. If a row exists for `connector_name`, its\n * allowlist + reason are replaced. To open the connector to\n * everyone again, call `delete()`.\n */\n async upsert(body: UpsertConnectorRestrictionRequest): Promise<ConnectorRestrictionResponse> {\n return this.request('POST', '/admin/connector-restrictions', { body });\n }\n\n async list(): Promise<ConnectorRestrictionResponse[]> {\n return this.request('GET', '/admin/connector-restrictions');\n }\n\n async retrieve(connectorName: string): Promise<ConnectorRestrictionResponse> {\n return this.request(\n 'GET',\n `/admin/connector-restrictions/${encodeURIComponent(connectorName)}`,\n );\n }\n\n /** Removing the row makes the connector public again. */\n async delete(connectorName: string): Promise<{ connector_name: string; deleted: boolean }> {\n return this.request(\n 'DELETE',\n `/admin/connector-restrictions/${encodeURIComponent(connectorName)}`,\n );\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["/tmp/publish-sdk-04990/dist/chunk-EQ6P6ZND.cjs","../src/feeProgram.ts"],"names":[],"mappings":"AAAA;ACoCO,SAAS,IAAA,CACd,GAAA,EACA,UAAA,EACA,KAAA,EACU;AACV,EAAA,MAAM,OAAA,EACJ,OAAO,MAAA,IAAU,SAAA,EAAW,EAAE,IAAA,EAAM,QAAA,EAAU,MAAM,EAAA,EAAI,EAAE,IAAA,EAAM,cAAA,EAAgB,MAAM,CAAA;AACxF,EAAA,OAAO,EAAE,IAAA,EAAM,MAAA,EAAQ,GAAA,EAAK,UAAA,EAAY,KAAA,EAAO,OAAO,CAAA;AACxD;AAOO,SAAS,YAAA,CACd,GAAA,EACA,UAAA,EACA,KAAA,EACU;AACV,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,MAAA;AAAA,IACN,GAAA,EAAK,UAAA;AAAA,IACL,UAAA;AAAA,IACA,KAAA,EAAO,EAAE,IAAA,EAAM,kBAAA,EAAoB,KAAA,EAAO,EAAE,GAAA,EAAK,MAAM,EAAE;AAAA,EAC3D,CAAA;AACF;AAGO,SAAS,KAAA,CAAA,GAAS,QAAA,EAAsC;AAC7D,EAAA,OAAO,EAAE,IAAA,EAAM,KAAA,EAAO,SAAS,CAAA;AACjC;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7MA;AACA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,6VAAC","file":"/tmp/publish-sdk-04990/dist/chunk-EQ6P6ZND.cjs","sourcesContent":[null,"import type {\n Connector,\n Currency,\n EuclidComparison,\n EuclidComparisonType,\n EuclidIfStatement,\n EuclidValue,\n PaymentMethod,\n PlatformFeeKind,\n PlatformFeeOutput,\n PlatformFeeProgram,\n PlatformFeeRule,\n RuleSchedule,\n} from './types';\n\n/** A single condition leaf in the builder's condition tree. */\nexport interface LeafNode {\n kind: 'leaf';\n lhs: string;\n comparison: EuclidComparisonType;\n value: EuclidValue;\n}\n\n/** An AND (`all`) or OR (`any`) group of condition nodes. */\nexport interface GroupNode {\n kind: 'all' | 'any';\n children: ConditionNode[];\n}\n\nexport type ConditionNode = LeafNode | GroupNode;\n\n/**\n * A condition leaf. Numeric values (amount, merchant_volume) tag as `number`;\n * string values (payment_method, connector, currency, card_network) tag as\n * `enum_variant`.\n */\nexport function leaf(\n lhs: string,\n comparison: EuclidComparisonType,\n value: string | number,\n): LeafNode {\n const tagged: EuclidValue =\n typeof value === 'number' ? { type: 'number', value } : { type: 'enum_variant', value };\n return { kind: 'leaf', lhs, comparison, value: tagged };\n}\n\n/**\n * A condition on one entry of the payment's merchant-supplied metadata (the\n * `routing_parameters` string map). `equal` and `not_equal` compare the\n * stored string with `value`; a payment without the key never matches `equal`.\n */\nexport function metadataLeaf(\n key: string,\n comparison: 'equal' | 'not_equal',\n value: string,\n): LeafNode {\n return {\n kind: 'leaf',\n lhs: 'metadata',\n comparison,\n value: { type: 'metadata_variant', value: { key, value } },\n };\n}\n\n/** AND group — all children must match. */\nexport function allOf(...children: ConditionNode[]): GroupNode {\n return { kind: 'all', children };\n}\n\n/** OR group — any child matching is enough. */\nexport function anyOf(...children: ConditionNode[]): GroupNode {\n return { kind: 'any', children };\n}\n\n/**\n * How a rule (or the default) prices a transaction. `fee_type` is inferred:\n * percentage-only → `percentage`, flat-only → `flat`, both → `combined`.\n */\nexport interface FeeSpecInput {\n /** Percentage fee, e.g. `2.5` means 2.5%. */\n percentage?: number;\n /** Flat fee in minor units. */\n flat?: number;\n /** ISO 4217 currency for the flat fee. */\n flatCurrency?: string;\n /** Clamp floor in minor units. */\n min?: number;\n /** Clamp ceiling in minor units. */\n max?: number;\n}\n\n/**\n * Friendly conditions for a rule. Every provided key becomes one condition and\n * they are ANDed together. For dimensions not covered here (payment-method-type\n * keys like `crypto`/`wallet`, metadata, value arrays) use `rawConditions`.\n */\nexport interface FeeRuleConditions {\n paymentMethod?: PaymentMethod;\n connector?: Connector;\n currency?: Currency;\n cardNetwork?: string;\n /**\n * Customer billing-address country. Must be the exact backend `Country` enum\n * variant (PascalCase full name, e.g. `Germany`/`UnitedStatesOfAmerica`), not\n * an ISO code — the engine lowers `billing_country` via case-sensitive\n * `from_str`.\n */\n billingCountry?: string;\n /** `amount == n` (minor units). */\n amountEquals?: number;\n /** `amount > n` (minor units). */\n amountGreaterThan?: number;\n /** `amount < n` (minor units). */\n amountLessThan?: number;\n /**\n * `merchant_volume == n` — the merchant's previous-month volume snapshot\n * (USD minor units). Combine with any other condition, e.g.\n * `{ paymentMethod: 'crypto', merchantVolumeGreaterThan: 1_000_000 }`.\n */\n merchantVolumeEquals?: number;\n /** `merchant_volume > n` (USD minor units). */\n merchantVolumeGreaterThan?: number;\n /** `merchant_volume < n` (USD minor units). */\n merchantVolumeLessThan?: number;\n}\n\nexport interface FeeRuleInput {\n name: string;\n /** Friendly conditions (ANDed). Omit for an always-matching rule (prefer `otherwise`). */\n when?: FeeRuleConditions;\n /** Extra raw conditions ANDed in, for dimensions `when` does not cover. */\n rawConditions?: EuclidComparison[];\n /** Nested AND/OR condition tree. Mutually exclusive with `when`/`rawConditions`. */\n match?: ConditionNode;\n fee: FeeSpecInput;\n /**\n * A recurring window outside which the rule is skipped and the next rule or\n * `otherwise` applies. Omit for a rule that applies at all times.\n */\n schedule?: RuleSchedule;\n}\n\nfunction toFeeOutput(spec: FeeSpecInput): PlatformFeeOutput {\n const hasPct = spec.percentage != null;\n const hasFlat = spec.flat != null;\n const feeType: PlatformFeeKind = hasPct && hasFlat ? 'combined' : hasFlat ? 'flat' : 'percentage';\n return {\n fee_type: feeType,\n percentage_fee: spec.percentage ?? null,\n flat_fee_amount: spec.flat ?? null,\n flat_fee_currency: spec.flatCurrency ?? null,\n min_fee_amount: spec.min ?? null,\n max_fee_amount: spec.max ?? null,\n };\n}\n\nfunction enumCondition(lhs: string, value: string): EuclidComparison {\n return { lhs, comparison: 'equal', value: { type: 'enum_variant', value }, metadata: {} };\n}\n\nfunction numberCondition(\n lhs: string,\n comparison: EuclidComparisonType,\n value: number,\n): EuclidComparison {\n return { lhs, comparison, value: { type: 'number', value }, metadata: {} };\n}\n\nfunction buildConditions(\n when: FeeRuleConditions = {},\n raw: EuclidComparison[] = [],\n): EuclidComparison[] {\n const out: EuclidComparison[] = [];\n if (when.paymentMethod != null) out.push(enumCondition('payment_method', when.paymentMethod));\n if (when.connector != null) out.push(enumCondition('connector', when.connector));\n if (when.currency != null) out.push(enumCondition('currency', when.currency));\n if (when.cardNetwork != null) out.push(enumCondition('card_network', when.cardNetwork));\n if (when.billingCountry != null) out.push(enumCondition('billing_country', when.billingCountry));\n if (when.amountEquals != null) out.push(numberCondition('amount', 'equal', when.amountEquals));\n if (when.amountGreaterThan != null) {\n out.push(numberCondition('amount', 'greater_than', when.amountGreaterThan));\n }\n if (when.amountLessThan != null) {\n out.push(numberCondition('amount', 'less_than', when.amountLessThan));\n }\n if (when.merchantVolumeEquals != null) {\n out.push(numberCondition('merchant_volume', 'equal', when.merchantVolumeEquals));\n }\n if (when.merchantVolumeGreaterThan != null) {\n out.push(numberCondition('merchant_volume', 'greater_than', when.merchantVolumeGreaterThan));\n }\n if (when.merchantVolumeLessThan != null) {\n out.push(numberCondition('merchant_volume', 'less_than', when.merchantVolumeLessThan));\n }\n out.push(...raw);\n return out;\n}\n\nfunction leafToComparison(node: LeafNode): EuclidComparison {\n return { lhs: node.lhs, comparison: node.comparison, value: node.value, metadata: {} };\n}\n\n/**\n * Flatten associativity (nested all-in-all / any-in-any) and collapse\n * single-child groups, so every group child of an `all` is an `any`.\n * @internal\n */\nexport function normalizeNode(node: ConditionNode): ConditionNode {\n if (node.kind === 'leaf') return node;\n const children = node.children.map(normalizeNode);\n const flat: ConditionNode[] = [];\n for (const c of children) {\n if (c.kind === node.kind) flat.push(...c.children);\n else flat.push(c);\n }\n if (flat.length === 1) return flat[0];\n return { kind: node.kind, children: flat };\n}\n\nfunction toStatement(node: ConditionNode): EuclidIfStatement {\n if (node.kind === 'leaf') return { condition: [leafToComparison(node)], nested: null };\n // Unreachable via current callers (encodeStatements strips top-level any); kept for totality.\n if (node.kind === 'any') {\n return { condition: [], nested: node.children.map(toStatement) };\n }\n // 'all': after normalize, group children are all 'any'.\n const leaves = node.children.filter((c): c is LeafNode => c.kind === 'leaf');\n const groups = node.children.filter((c): c is GroupNode => c.kind !== 'leaf');\n const condition = leaves.map(leafToComparison);\n if (groups.length === 0) return { condition, nested: null };\n const [first, ...rest] = groups;\n // `first` is an OR; AND each of its branches with the remaining OR groups.\n const nested = first.children.map((branch) => toStatement(normalizeNode(allOf(branch, ...rest))));\n return { condition, nested };\n}\n\nfunction assertNoEmptyAnyOf(node: ConditionNode): void {\n if (node.kind === 'leaf') return;\n if (node.kind === 'any' && node.children.length === 0) {\n throw new Error('feeProgram: an anyOf() group must have at least one condition');\n }\n node.children.forEach(assertNoEmptyAnyOf);\n}\n\n/**\n * Encode a rule's match (a condition tree) into the engine's `statements[]`.\n * A top-level OR spreads across statements; anything else is a single statement.\n * @internal\n */\nexport function encodeStatements(match: ConditionNode): EuclidIfStatement[] {\n const m = normalizeNode(match);\n if (m.kind === 'any') return m.children.map(toStatement);\n return [toStatement(m)];\n}\n\nfunction comparisonToLeaf(c: EuclidComparison): LeafNode {\n return { kind: 'leaf', lhs: c.lhs, comparison: c.comparison, value: c.value };\n}\n\nfunction statementToNode(stmt: EuclidIfStatement): ConditionNode {\n const leaves = stmt.condition.map(comparisonToLeaf);\n if (stmt.nested && stmt.nested.length > 0) {\n const orNode = anyOf(...stmt.nested.map(statementToNode));\n if (leaves.length === 0) return orNode;\n return allOf(...leaves, orNode);\n }\n return leaves.length === 1 ? leaves[0] : allOf(...leaves);\n}\n\n/**\n * Decode a rule's `statements[]` back into a condition tree.\n *\n * Returns a tree that is **logically equivalent** to the source. It is\n * deep-equal to `normalizeNode(input)` only when no `all` group contains two\n * or more `any` groups; where the encoder distributed AND over OR, the decoded\n * shape differs (still equivalent).\n */\nexport function ruleMatchToTree(statements: EuclidIfStatement[]): ConditionNode {\n if (statements.length === 1) return normalizeNode(statementToNode(statements[0]));\n return normalizeNode(anyOf(...statements.map(statementToNode)));\n}\n\n/**\n * Decode a stored program into the builder's editable model.\n *\n * Returns a tree that is **logically equivalent** to the source. It is\n * deep-equal to `normalizeNode(input)` only when no `all` group contains two\n * or more `any` groups; where the encoder distributed AND over OR, the decoded\n * shape differs (still equivalent).\n */\nexport function programToTree(program: PlatformFeeProgram): {\n rules: {\n name: string;\n match: ConditionNode;\n fee: PlatformFeeOutput | null;\n schedule: RuleSchedule | null;\n }[];\n otherwise: PlatformFeeOutput | null;\n} {\n return {\n rules: program.rules.map((r) => ({\n name: r.name,\n match: ruleMatchToTree(r.statements),\n fee: r.connectorSelection.fee ?? null,\n schedule: r.connectorSelection.schedule ?? null,\n })),\n otherwise: program.defaultSelection.fee ?? null,\n };\n}\n\n/**\n * Fluent builder for a platform fee-rule program. Emits the exact Euclid wire\n * shape (camelCase tree, tagged values, `metadata: {}` everywhere) so callers\n * never hand-write the AST. Rules are evaluated in order; the first match wins,\n * else `otherwise` (the default selection).\n *\n * @example\n * ```ts\n * const algorithm = feeProgram()\n * .rule({ name: 'crypto', when: { paymentMethod: 'crypto' }, fee: { percentage: 1.0 } })\n * .rule({\n * name: 'card_on_cryptomus',\n * when: { paymentMethod: 'card', connector: 'cryptomus' },\n * fee: { percentage: 2.0 },\n * })\n * .otherwise({ percentage: 3.0 })\n * .build();\n *\n * await delopay.fees.rules.upsert({ algorithm }, merchantId);\n * ```\n */\nexport class FeeProgramBuilder {\n private readonly rules: PlatformFeeRule[] = [];\n private defaultFee: PlatformFeeOutput | null = null;\n\n /** Append a rule. Provided `when`/`rawConditions` are ANDed. */\n rule(input: FeeRuleInput): this {\n if (input.match) assertNoEmptyAnyOf(input.match);\n const statements: PlatformFeeRule['statements'] = input.match\n ? encodeStatements(input.match)\n : [{ condition: buildConditions(input.when, input.rawConditions) }];\n const connectorSelection: PlatformFeeRule['connectorSelection'] = {\n fee: toFeeOutput(input.fee),\n };\n if (input.schedule !== undefined) connectorSelection.schedule = input.schedule;\n this.rules.push({ name: input.name, connectorSelection, statements });\n return this;\n }\n\n /** Set the default selection (applied when no rule matches). */\n otherwise(fee: FeeSpecInput): this {\n this.defaultFee = toFeeOutput(fee);\n return this;\n }\n\n /** Produce the wire-ready program. */\n build(): PlatformFeeProgram {\n return {\n defaultSelection: { fee: this.defaultFee },\n rules: this.rules,\n metadata: {},\n };\n }\n}\n\n/** Start building a platform fee-rule program. See {@link FeeProgramBuilder}. */\nexport function feeProgram(): FeeProgramBuilder {\n return new FeeProgramBuilder();\n}\n"]}
1
+ {"version":3,"sources":["/home/anes/delo-payment/delopay-typescript-sdk/dist/chunk-EQ6P6ZND.cjs","../src/feeProgram.ts"],"names":[],"mappings":"AAAA;ACoCO,SAAS,IAAA,CACd,GAAA,EACA,UAAA,EACA,KAAA,EACU;AACV,EAAA,MAAM,OAAA,EACJ,OAAO,MAAA,IAAU,SAAA,EAAW,EAAE,IAAA,EAAM,QAAA,EAAU,MAAM,EAAA,EAAI,EAAE,IAAA,EAAM,cAAA,EAAgB,MAAM,CAAA;AACxF,EAAA,OAAO,EAAE,IAAA,EAAM,MAAA,EAAQ,GAAA,EAAK,UAAA,EAAY,KAAA,EAAO,OAAO,CAAA;AACxD;AAOO,SAAS,YAAA,CACd,GAAA,EACA,UAAA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O,IAAA;AAAA,EACT;AAAA;AAAA,EAGA,KAAA,CAAA,EAA4B;AAC1B,IAAA,OAAO;AAAA,MACL,gBAAA,EAAkB,EAAE,GAAA,EAAK,IAAA,CAAK,WAAW,CAAA;AAAA,MACzC,KAAA,EAAO,IAAA,CAAK,KAAA;AAAA,MACZ,QAAA,EAAU,CAAC;AAAA,IACb,CAAA;AAAA,EACF;AACF,CAAA;AAGO,SAAS,UAAA,CAAA,EAAgC;AAC9C,EAAA,OAAO,IAAI,iBAAA,CAAkB,CAAA;AAC/B;AD7MA;AACA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,6VAAC","file":"/home/anes/delo-payment/delopay-typescript-sdk/dist/chunk-EQ6P6ZND.cjs","sourcesContent":[null,"import type {\n Connector,\n Currency,\n EuclidComparison,\n EuclidComparisonType,\n EuclidIfStatement,\n EuclidValue,\n PaymentMethod,\n PlatformFeeKind,\n PlatformFeeOutput,\n PlatformFeeProgram,\n PlatformFeeRule,\n RuleSchedule,\n} from './types';\n\n/** A single condition leaf in the builder's condition tree. */\nexport interface LeafNode {\n kind: 'leaf';\n lhs: string;\n comparison: EuclidComparisonType;\n value: EuclidValue;\n}\n\n/** An AND (`all`) or OR (`any`) group of condition nodes. */\nexport interface GroupNode {\n kind: 'all' | 'any';\n children: ConditionNode[];\n}\n\nexport type ConditionNode = LeafNode | GroupNode;\n\n/**\n * A condition leaf. Numeric values (amount, merchant_volume) tag as `number`;\n * string values (payment_method, connector, currency, card_network) tag as\n * `enum_variant`.\n */\nexport function leaf(\n lhs: string,\n comparison: EuclidComparisonType,\n value: string | number,\n): LeafNode {\n const tagged: EuclidValue =\n typeof value === 'number' ? { type: 'number', value } : { type: 'enum_variant', value };\n return { kind: 'leaf', lhs, comparison, value: tagged };\n}\n\n/**\n * A condition on one entry of the payment's merchant-supplied metadata (the\n * `routing_parameters` string map). `equal` and `not_equal` compare the\n * stored string with `value`; a payment without the key never matches `equal`.\n */\nexport function metadataLeaf(\n key: string,\n comparison: 'equal' | 'not_equal',\n value: string,\n): LeafNode {\n return {\n kind: 'leaf',\n lhs: 'metadata',\n comparison,\n value: { type: 'metadata_variant', value: { key, value } },\n };\n}\n\n/** AND group — all children must match. */\nexport function allOf(...children: ConditionNode[]): GroupNode {\n return { kind: 'all', children };\n}\n\n/** OR group — any child matching is enough. */\nexport function anyOf(...children: ConditionNode[]): GroupNode {\n return { kind: 'any', children };\n}\n\n/**\n * How a rule (or the default) prices a transaction. `fee_type` is inferred:\n * percentage-only → `percentage`, flat-only → `flat`, both → `combined`.\n */\nexport interface FeeSpecInput {\n /** Percentage fee, e.g. `2.5` means 2.5%. */\n percentage?: number;\n /** Flat fee in minor units. */\n flat?: number;\n /** ISO 4217 currency for the flat fee. */\n flatCurrency?: string;\n /** Clamp floor in minor units. */\n min?: number;\n /** Clamp ceiling in minor units. */\n max?: number;\n}\n\n/**\n * Friendly conditions for a rule. Every provided key becomes one condition and\n * they are ANDed together. For dimensions not covered here (payment-method-type\n * keys like `crypto`/`wallet`, metadata, value arrays) use `rawConditions`.\n */\nexport interface FeeRuleConditions {\n paymentMethod?: PaymentMethod;\n connector?: Connector;\n currency?: Currency;\n cardNetwork?: string;\n /**\n * Customer billing-address country. Must be the exact backend `Country` enum\n * variant (PascalCase full name, e.g. `Germany`/`UnitedStatesOfAmerica`), not\n * an ISO code — the engine lowers `billing_country` via case-sensitive\n * `from_str`.\n */\n billingCountry?: string;\n /** `amount == n` (minor units). */\n amountEquals?: number;\n /** `amount > n` (minor units). */\n amountGreaterThan?: number;\n /** `amount < n` (minor units). */\n amountLessThan?: number;\n /**\n * `merchant_volume == n` — the merchant's previous-month volume snapshot\n * (USD minor units). Combine with any other condition, e.g.\n * `{ paymentMethod: 'crypto', merchantVolumeGreaterThan: 1_000_000 }`.\n */\n merchantVolumeEquals?: number;\n /** `merchant_volume > n` (USD minor units). */\n merchantVolumeGreaterThan?: number;\n /** `merchant_volume < n` (USD minor units). */\n merchantVolumeLessThan?: number;\n}\n\nexport interface FeeRuleInput {\n name: string;\n /** Friendly conditions (ANDed). Omit for an always-matching rule (prefer `otherwise`). */\n when?: FeeRuleConditions;\n /** Extra raw conditions ANDed in, for dimensions `when` does not cover. */\n rawConditions?: EuclidComparison[];\n /** Nested AND/OR condition tree. Mutually exclusive with `when`/`rawConditions`. */\n match?: ConditionNode;\n fee: FeeSpecInput;\n /**\n * A recurring window outside which the rule is skipped and the next rule or\n * `otherwise` applies. Omit for a rule that applies at all times.\n */\n schedule?: RuleSchedule;\n}\n\nfunction toFeeOutput(spec: FeeSpecInput): PlatformFeeOutput {\n const hasPct = spec.percentage != null;\n const hasFlat = spec.flat != null;\n const feeType: PlatformFeeKind = hasPct && hasFlat ? 'combined' : hasFlat ? 'flat' : 'percentage';\n return {\n fee_type: feeType,\n percentage_fee: spec.percentage ?? null,\n flat_fee_amount: spec.flat ?? null,\n flat_fee_currency: spec.flatCurrency ?? null,\n min_fee_amount: spec.min ?? null,\n max_fee_amount: spec.max ?? null,\n };\n}\n\nfunction enumCondition(lhs: string, value: string): EuclidComparison {\n return { lhs, comparison: 'equal', value: { type: 'enum_variant', value }, metadata: {} };\n}\n\nfunction numberCondition(\n lhs: string,\n comparison: EuclidComparisonType,\n value: number,\n): EuclidComparison {\n return { lhs, comparison, value: { type: 'number', value }, metadata: {} };\n}\n\nfunction buildConditions(\n when: FeeRuleConditions = {},\n raw: EuclidComparison[] = [],\n): EuclidComparison[] {\n const out: EuclidComparison[] = [];\n if (when.paymentMethod != null) out.push(enumCondition('payment_method', when.paymentMethod));\n if (when.connector != null) out.push(enumCondition('connector', when.connector));\n if (when.currency != null) out.push(enumCondition('currency', when.currency));\n if (when.cardNetwork != null) out.push(enumCondition('card_network', when.cardNetwork));\n if (when.billingCountry != null) out.push(enumCondition('billing_country', when.billingCountry));\n if (when.amountEquals != null) out.push(numberCondition('amount', 'equal', when.amountEquals));\n if (when.amountGreaterThan != null) {\n out.push(numberCondition('amount', 'greater_than', when.amountGreaterThan));\n }\n if (when.amountLessThan != null) {\n out.push(numberCondition('amount', 'less_than', when.amountLessThan));\n }\n if (when.merchantVolumeEquals != null) {\n out.push(numberCondition('merchant_volume', 'equal', when.merchantVolumeEquals));\n }\n if (when.merchantVolumeGreaterThan != null) {\n out.push(numberCondition('merchant_volume', 'greater_than', when.merchantVolumeGreaterThan));\n }\n if (when.merchantVolumeLessThan != null) {\n out.push(numberCondition('merchant_volume', 'less_than', when.merchantVolumeLessThan));\n }\n out.push(...raw);\n return out;\n}\n\nfunction leafToComparison(node: LeafNode): EuclidComparison {\n return { lhs: node.lhs, comparison: node.comparison, value: node.value, metadata: {} };\n}\n\n/**\n * Flatten associativity (nested all-in-all / any-in-any) and collapse\n * single-child groups, so every group child of an `all` is an `any`.\n * @internal\n */\nexport function normalizeNode(node: ConditionNode): ConditionNode {\n if (node.kind === 'leaf') return node;\n const children = node.children.map(normalizeNode);\n const flat: ConditionNode[] = [];\n for (const c of children) {\n if (c.kind === node.kind) flat.push(...c.children);\n else flat.push(c);\n }\n if (flat.length === 1) return flat[0];\n return { kind: node.kind, children: flat };\n}\n\nfunction toStatement(node: ConditionNode): EuclidIfStatement {\n if (node.kind === 'leaf') return { condition: [leafToComparison(node)], nested: null };\n // Unreachable via current callers (encodeStatements strips top-level any); kept for totality.\n if (node.kind === 'any') {\n return { condition: [], nested: node.children.map(toStatement) };\n }\n // 'all': after normalize, group children are all 'any'.\n const leaves = node.children.filter((c): c is LeafNode => c.kind === 'leaf');\n const groups = node.children.filter((c): c is GroupNode => c.kind !== 'leaf');\n const condition = leaves.map(leafToComparison);\n if (groups.length === 0) return { condition, nested: null };\n const [first, ...rest] = groups;\n // `first` is an OR; AND each of its branches with the remaining OR groups.\n const nested = first.children.map((branch) => toStatement(normalizeNode(allOf(branch, ...rest))));\n return { condition, nested };\n}\n\nfunction assertNoEmptyAnyOf(node: ConditionNode): void {\n if (node.kind === 'leaf') return;\n if (node.kind === 'any' && node.children.length === 0) {\n throw new Error('feeProgram: an anyOf() group must have at least one condition');\n }\n node.children.forEach(assertNoEmptyAnyOf);\n}\n\n/**\n * Encode a rule's match (a condition tree) into the engine's `statements[]`.\n * A top-level OR spreads across statements; anything else is a single statement.\n * @internal\n */\nexport function encodeStatements(match: ConditionNode): EuclidIfStatement[] {\n const m = normalizeNode(match);\n if (m.kind === 'any') return m.children.map(toStatement);\n return [toStatement(m)];\n}\n\nfunction comparisonToLeaf(c: EuclidComparison): LeafNode {\n return { kind: 'leaf', lhs: c.lhs, comparison: c.comparison, value: c.value };\n}\n\nfunction statementToNode(stmt: EuclidIfStatement): ConditionNode {\n const leaves = stmt.condition.map(comparisonToLeaf);\n if (stmt.nested && stmt.nested.length > 0) {\n const orNode = anyOf(...stmt.nested.map(statementToNode));\n if (leaves.length === 0) return orNode;\n return allOf(...leaves, orNode);\n }\n return leaves.length === 1 ? leaves[0] : allOf(...leaves);\n}\n\n/**\n * Decode a rule's `statements[]` back into a condition tree.\n *\n * Returns a tree that is **logically equivalent** to the source. It is\n * deep-equal to `normalizeNode(input)` only when no `all` group contains two\n * or more `any` groups; where the encoder distributed AND over OR, the decoded\n * shape differs (still equivalent).\n */\nexport function ruleMatchToTree(statements: EuclidIfStatement[]): ConditionNode {\n if (statements.length === 1) return normalizeNode(statementToNode(statements[0]));\n return normalizeNode(anyOf(...statements.map(statementToNode)));\n}\n\n/**\n * Decode a stored program into the builder's editable model.\n *\n * Returns a tree that is **logically equivalent** to the source. It is\n * deep-equal to `normalizeNode(input)` only when no `all` group contains two\n * or more `any` groups; where the encoder distributed AND over OR, the decoded\n * shape differs (still equivalent).\n */\nexport function programToTree(program: PlatformFeeProgram): {\n rules: {\n name: string;\n match: ConditionNode;\n fee: PlatformFeeOutput | null;\n schedule: RuleSchedule | null;\n }[];\n otherwise: PlatformFeeOutput | null;\n} {\n return {\n rules: program.rules.map((r) => ({\n name: r.name,\n match: ruleMatchToTree(r.statements),\n fee: r.connectorSelection.fee ?? null,\n schedule: r.connectorSelection.schedule ?? null,\n })),\n otherwise: program.defaultSelection.fee ?? null,\n };\n}\n\n/**\n * Fluent builder for a platform fee-rule program. Emits the exact Euclid wire\n * shape (camelCase tree, tagged values, `metadata: {}` everywhere) so callers\n * never hand-write the AST. Rules are evaluated in order; the first match wins,\n * else `otherwise` (the default selection).\n *\n * @example\n * ```ts\n * const algorithm = feeProgram()\n * .rule({ name: 'crypto', when: { paymentMethod: 'crypto' }, fee: { percentage: 1.0 } })\n * .rule({\n * name: 'card_on_cryptomus',\n * when: { paymentMethod: 'card', connector: 'cryptomus' },\n * fee: { percentage: 2.0 },\n * })\n * .otherwise({ percentage: 3.0 })\n * .build();\n *\n * await delopay.fees.rules.upsert({ algorithm }, merchantId);\n * ```\n */\nexport class FeeProgramBuilder {\n private readonly rules: PlatformFeeRule[] = [];\n private defaultFee: PlatformFeeOutput | null = null;\n\n /** Append a rule. Provided `when`/`rawConditions` are ANDed. */\n rule(input: FeeRuleInput): this {\n if (input.match) assertNoEmptyAnyOf(input.match);\n const statements: PlatformFeeRule['statements'] = input.match\n ? encodeStatements(input.match)\n : [{ condition: buildConditions(input.when, input.rawConditions) }];\n const connectorSelection: PlatformFeeRule['connectorSelection'] = {\n fee: toFeeOutput(input.fee),\n };\n if (input.schedule !== undefined) connectorSelection.schedule = input.schedule;\n this.rules.push({ name: input.name, connectorSelection, statements });\n return this;\n }\n\n /** Set the default selection (applied when no rule matches). */\n otherwise(fee: FeeSpecInput): this {\n this.defaultFee = toFeeOutput(fee);\n return this;\n }\n\n /** Produce the wire-ready program. */\n build(): PlatformFeeProgram {\n return {\n defaultSelection: { fee: this.defaultFee },\n rules: this.rules,\n metadata: {},\n };\n }\n}\n\n/** Start building a platform fee-rule program. See {@link FeeProgramBuilder}. */\nexport function feeProgram(): FeeProgramBuilder {\n return new FeeProgramBuilder();\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["/tmp/publish-sdk-04990/dist/chunk-EXPWQBI3.cjs","../src/resources/files.ts"],"names":[],"mappings":"AAAA;ACEO,IAAM,MAAA,EAAN,MAAY;AAAA,EACjB,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EAAqB;AAAA;AAAA,EAGlD,MAAM,MAAA,CAAO,MAAA,EAAmE;AAC9E,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,MAAA,EAAQ,QAAA,EAAU,EAAE,IAAA,EAAM,OAAO,CAAC,CAAA;AAAA,EACxD;AAAA;AAAA,EAGA,MAAM,QAAA,CAAS,MAAA,EAAkD;AAC/D,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,CAAA,OAAA,EAAU,kBAAA,CAAmB,MAAM,CAAC,CAAA,CAAA;AACjE,EAAA;AAAA;AAG+D,EAAA;AACF,IAAA;AAC7D,EAAA;AACF;ADDoE;AACA;AACA;AACA","file":"/tmp/publish-sdk-04990/dist/chunk-EXPWQBI3.cjs","sourcesContent":[null,"import type { RequestFn } from '../client';\n\nexport class Files {\n constructor(private readonly request: RequestFn) {}\n\n /** Upload a file. `POST /files` */\n async create(params: Record<string, unknown>): Promise<Record<string, unknown>> {\n return this.request('POST', '/files', { body: params });\n }\n\n /** Retrieve/download a file. `GET /files/{fileId}` */\n async retrieve(fileId: string): Promise<Record<string, unknown>> {\n return this.request('GET', `/files/${encodeURIComponent(fileId)}`);\n }\n\n /** Delete a file. `DELETE /files/{fileId}` */\n async delete(fileId: string): Promise<Record<string, unknown>> {\n return this.request('DELETE', `/files/${encodeURIComponent(fileId)}`);\n }\n}\n"]}
1
+ {"version":3,"sources":["/home/anes/delo-payment/delopay-typescript-sdk/dist/chunk-EXPWQBI3.cjs","../src/resources/files.ts"],"names":[],"mappings":"AAAA;ACEO,IAAM,MAAA,EAAN,MAAY;AAAA,EACjB,WAAA,CAA6B,OAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,QAAA,EAAA,OAAA;AAAA,EAAqB;AAAA;AAAA,EAGlD,MAAM,MAAA,CAAO,MAAA,EAAmE;AAC9E,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,MAAA,EAAQ,QAAA,EAAU,EAAE,IAAA,EAAM,OAAO,CAAC,CAAA;AAAA,EACxD;AAAA;AAAA,EAGA,MAAM,QAAA,CAAS,MAAA,EAAkD;AAC/D,IAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,CAAA,OAAA,EAAU,kBAAA,CAAmB,MAAM,CAAC,CAAA,CAAA;AACjE,EAAA;AAAA;AAG+D,EAAA;AACF,IAAA;AAC7D,EAAA;AACF;ADDoE;AACA;AACA;AACA","file":"/home/anes/delo-payment/delopay-typescript-sdk/dist/chunk-EXPWQBI3.cjs","sourcesContent":[null,"import type { RequestFn } from '../client';\n\nexport class Files {\n constructor(private readonly request: RequestFn) {}\n\n /** Upload a file. `POST /files` */\n async create(params: Record<string, unknown>): Promise<Record<string, unknown>> {\n return this.request('POST', '/files', { body: params });\n }\n\n /** Retrieve/download a file. `GET /files/{fileId}` */\n async retrieve(fileId: string): Promise<Record<string, unknown>> {\n return this.request('GET', `/files/${encodeURIComponent(fileId)}`);\n }\n\n /** Delete a file. `DELETE /files/{fileId}` */\n async delete(fileId: string): Promise<Record<string, unknown>> {\n return this.request('DELETE', `/files/${encodeURIComponent(fileId)}`);\n }\n}\n"]}