@naturalpay/sdk 0.2.0 → 0.3.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 (507) hide show
  1. package/CHANGELOG.md +148 -0
  2. package/LICENSE +7 -0
  3. package/README.md +340 -26
  4. package/api-promise.d.mts +3 -0
  5. package/api-promise.d.mts.map +1 -0
  6. package/api-promise.d.ts +3 -0
  7. package/api-promise.d.ts.map +1 -0
  8. package/api-promise.js +6 -0
  9. package/api-promise.js.map +1 -0
  10. package/api-promise.mjs +3 -0
  11. package/api-promise.mjs.map +1 -0
  12. package/client.d.mts +267 -0
  13. package/client.d.mts.map +1 -0
  14. package/client.d.ts +267 -0
  15. package/client.d.ts.map +1 -0
  16. package/client.js +560 -0
  17. package/client.js.map +1 -0
  18. package/client.mjs +556 -0
  19. package/client.mjs.map +1 -0
  20. package/core/api-promise.d.mts +46 -0
  21. package/core/api-promise.d.mts.map +1 -0
  22. package/core/api-promise.d.ts +46 -0
  23. package/core/api-promise.d.ts.map +1 -0
  24. package/core/api-promise.js +74 -0
  25. package/core/api-promise.js.map +1 -0
  26. package/core/api-promise.mjs +70 -0
  27. package/core/api-promise.mjs.map +1 -0
  28. package/core/error.d.mts +46 -0
  29. package/core/error.d.mts.map +1 -0
  30. package/core/error.d.ts +46 -0
  31. package/core/error.d.ts.map +1 -0
  32. package/core/error.js +113 -0
  33. package/core/error.js.map +1 -0
  34. package/core/error.mjs +97 -0
  35. package/core/error.mjs.map +1 -0
  36. package/core/resource.d.mts +6 -0
  37. package/core/resource.d.mts.map +1 -0
  38. package/core/resource.d.ts +6 -0
  39. package/core/resource.d.ts.map +1 -0
  40. package/core/resource.js +11 -0
  41. package/core/resource.js.map +1 -0
  42. package/core/resource.mjs +7 -0
  43. package/core/resource.mjs.map +1 -0
  44. package/core/uploads.d.mts +3 -0
  45. package/core/uploads.d.mts.map +1 -0
  46. package/core/uploads.d.ts +3 -0
  47. package/core/uploads.d.ts.map +1 -0
  48. package/core/uploads.js +6 -0
  49. package/core/uploads.js.map +1 -0
  50. package/core/uploads.mjs +2 -0
  51. package/core/uploads.mjs.map +1 -0
  52. package/error.d.mts +3 -0
  53. package/error.d.mts.map +1 -0
  54. package/error.d.ts +3 -0
  55. package/error.d.ts.map +1 -0
  56. package/error.js +6 -0
  57. package/error.js.map +1 -0
  58. package/error.mjs +3 -0
  59. package/error.mjs.map +1 -0
  60. package/index.d.mts +6 -0
  61. package/index.d.mts.map +1 -0
  62. package/index.d.ts +6 -0
  63. package/index.d.ts.map +1 -0
  64. package/index.js +30 -0
  65. package/index.js.map +1 -0
  66. package/index.mjs +7 -0
  67. package/index.mjs.map +1 -0
  68. package/internal/builtin-types.d.mts +73 -0
  69. package/internal/builtin-types.d.mts.map +1 -0
  70. package/internal/builtin-types.d.ts +73 -0
  71. package/internal/builtin-types.d.ts.map +1 -0
  72. package/internal/builtin-types.js +4 -0
  73. package/internal/builtin-types.js.map +1 -0
  74. package/internal/builtin-types.mjs +3 -0
  75. package/internal/builtin-types.mjs.map +1 -0
  76. package/internal/detect-platform.d.mts +15 -0
  77. package/internal/detect-platform.d.mts.map +1 -0
  78. package/internal/detect-platform.d.ts +15 -0
  79. package/internal/detect-platform.d.ts.map +1 -0
  80. package/internal/detect-platform.js +162 -0
  81. package/internal/detect-platform.js.map +1 -0
  82. package/internal/detect-platform.mjs +157 -0
  83. package/internal/detect-platform.mjs.map +1 -0
  84. package/internal/errors.d.mts +3 -0
  85. package/internal/errors.d.mts.map +1 -0
  86. package/internal/errors.d.ts +3 -0
  87. package/internal/errors.d.ts.map +1 -0
  88. package/internal/errors.js +41 -0
  89. package/internal/errors.js.map +1 -0
  90. package/internal/errors.mjs +36 -0
  91. package/internal/errors.mjs.map +1 -0
  92. package/internal/headers.d.mts +20 -0
  93. package/internal/headers.d.mts.map +1 -0
  94. package/internal/headers.d.ts +20 -0
  95. package/internal/headers.d.ts.map +1 -0
  96. package/internal/headers.js +79 -0
  97. package/internal/headers.js.map +1 -0
  98. package/internal/headers.mjs +74 -0
  99. package/internal/headers.mjs.map +1 -0
  100. package/internal/parse.d.mts +12 -0
  101. package/internal/parse.d.mts.map +1 -0
  102. package/internal/parse.d.ts +12 -0
  103. package/internal/parse.d.ts.map +1 -0
  104. package/internal/parse.js +40 -0
  105. package/internal/parse.js.map +1 -0
  106. package/internal/parse.mjs +37 -0
  107. package/internal/parse.mjs.map +1 -0
  108. package/internal/qs/formats.d.mts +7 -0
  109. package/internal/qs/formats.d.mts.map +1 -0
  110. package/internal/qs/formats.d.ts +7 -0
  111. package/internal/qs/formats.d.ts.map +1 -0
  112. package/internal/qs/formats.js +13 -0
  113. package/internal/qs/formats.js.map +1 -0
  114. package/internal/qs/formats.mjs +9 -0
  115. package/internal/qs/formats.mjs.map +1 -0
  116. package/internal/qs/index.d.mts +10 -0
  117. package/internal/qs/index.d.mts.map +1 -0
  118. package/internal/qs/index.d.ts +10 -0
  119. package/internal/qs/index.d.ts.map +1 -0
  120. package/internal/qs/index.js +14 -0
  121. package/internal/qs/index.js.map +1 -0
  122. package/internal/qs/index.mjs +10 -0
  123. package/internal/qs/index.mjs.map +1 -0
  124. package/internal/qs/stringify.d.mts +3 -0
  125. package/internal/qs/stringify.d.mts.map +1 -0
  126. package/internal/qs/stringify.d.ts +3 -0
  127. package/internal/qs/stringify.d.ts.map +1 -0
  128. package/internal/qs/stringify.js +277 -0
  129. package/internal/qs/stringify.js.map +1 -0
  130. package/internal/qs/stringify.mjs +274 -0
  131. package/internal/qs/stringify.mjs.map +1 -0
  132. package/internal/qs/types.d.mts +57 -0
  133. package/internal/qs/types.d.mts.map +1 -0
  134. package/internal/qs/types.d.ts +57 -0
  135. package/internal/qs/types.d.ts.map +1 -0
  136. package/internal/qs/types.js +3 -0
  137. package/internal/qs/types.js.map +1 -0
  138. package/internal/qs/types.mjs +2 -0
  139. package/internal/qs/types.mjs.map +1 -0
  140. package/internal/qs/utils.d.mts +15 -0
  141. package/internal/qs/utils.d.mts.map +1 -0
  142. package/internal/qs/utils.d.ts +15 -0
  143. package/internal/qs/utils.d.ts.map +1 -0
  144. package/internal/qs/utils.js +230 -0
  145. package/internal/qs/utils.js.map +1 -0
  146. package/internal/qs/utils.mjs +217 -0
  147. package/internal/qs/utils.mjs.map +1 -0
  148. package/internal/request-options.d.mts +75 -0
  149. package/internal/request-options.d.mts.map +1 -0
  150. package/internal/request-options.d.ts +75 -0
  151. package/internal/request-options.d.ts.map +1 -0
  152. package/internal/request-options.js +14 -0
  153. package/internal/request-options.js.map +1 -0
  154. package/internal/request-options.mjs +10 -0
  155. package/internal/request-options.mjs.map +1 -0
  156. package/internal/shim-types.d.mts +17 -0
  157. package/internal/shim-types.d.mts.map +1 -0
  158. package/internal/shim-types.d.ts +17 -0
  159. package/internal/shim-types.d.ts.map +1 -0
  160. package/internal/shim-types.js +4 -0
  161. package/internal/shim-types.js.map +1 -0
  162. package/internal/shim-types.mjs +3 -0
  163. package/internal/shim-types.mjs.map +1 -0
  164. package/internal/shims.d.mts +26 -0
  165. package/internal/shims.d.mts.map +1 -0
  166. package/internal/shims.d.ts +26 -0
  167. package/internal/shims.d.ts.map +1 -0
  168. package/internal/shims.js +92 -0
  169. package/internal/shims.js.map +1 -0
  170. package/internal/shims.mjs +85 -0
  171. package/internal/shims.mjs.map +1 -0
  172. package/internal/to-file.d.mts +45 -0
  173. package/internal/to-file.d.mts.map +1 -0
  174. package/internal/to-file.d.ts +45 -0
  175. package/internal/to-file.d.ts.map +1 -0
  176. package/internal/to-file.js +91 -0
  177. package/internal/to-file.js.map +1 -0
  178. package/internal/to-file.mjs +88 -0
  179. package/internal/to-file.mjs.map +1 -0
  180. package/internal/tslib.js +81 -0
  181. package/internal/tslib.mjs +17 -0
  182. package/internal/types.d.mts +69 -0
  183. package/internal/types.d.mts.map +1 -0
  184. package/internal/types.d.ts +69 -0
  185. package/internal/types.d.ts.map +1 -0
  186. package/internal/types.js +4 -0
  187. package/internal/types.js.map +1 -0
  188. package/internal/types.mjs +3 -0
  189. package/internal/types.mjs.map +1 -0
  190. package/internal/uploads.d.mts +42 -0
  191. package/internal/uploads.d.mts.map +1 -0
  192. package/internal/uploads.d.ts +42 -0
  193. package/internal/uploads.d.ts.map +1 -0
  194. package/internal/uploads.js +141 -0
  195. package/internal/uploads.js.map +1 -0
  196. package/internal/uploads.mjs +131 -0
  197. package/internal/uploads.mjs.map +1 -0
  198. package/internal/utils/base64.d.mts +3 -0
  199. package/internal/utils/base64.d.mts.map +1 -0
  200. package/internal/utils/base64.d.ts +3 -0
  201. package/internal/utils/base64.d.ts.map +1 -0
  202. package/internal/utils/base64.js +38 -0
  203. package/internal/utils/base64.js.map +1 -0
  204. package/internal/utils/base64.mjs +33 -0
  205. package/internal/utils/base64.mjs.map +1 -0
  206. package/internal/utils/bytes.d.mts +4 -0
  207. package/internal/utils/bytes.d.mts.map +1 -0
  208. package/internal/utils/bytes.d.ts +4 -0
  209. package/internal/utils/bytes.d.ts.map +1 -0
  210. package/internal/utils/bytes.js +31 -0
  211. package/internal/utils/bytes.js.map +1 -0
  212. package/internal/utils/bytes.mjs +26 -0
  213. package/internal/utils/bytes.mjs.map +1 -0
  214. package/internal/utils/env.d.mts +9 -0
  215. package/internal/utils/env.d.mts.map +1 -0
  216. package/internal/utils/env.d.ts +9 -0
  217. package/internal/utils/env.d.ts.map +1 -0
  218. package/internal/utils/env.js +22 -0
  219. package/internal/utils/env.js.map +1 -0
  220. package/internal/utils/env.mjs +18 -0
  221. package/internal/utils/env.mjs.map +1 -0
  222. package/internal/utils/log.d.mts +37 -0
  223. package/internal/utils/log.d.mts.map +1 -0
  224. package/internal/utils/log.d.ts +37 -0
  225. package/internal/utils/log.d.ts.map +1 -0
  226. package/internal/utils/log.js +87 -0
  227. package/internal/utils/log.js.map +1 -0
  228. package/internal/utils/log.mjs +81 -0
  229. package/internal/utils/log.mjs.map +1 -0
  230. package/internal/utils/path.d.mts +15 -0
  231. package/internal/utils/path.d.mts.map +1 -0
  232. package/internal/utils/path.d.ts +15 -0
  233. package/internal/utils/path.d.ts.map +1 -0
  234. package/internal/utils/path.js +79 -0
  235. package/internal/utils/path.js.map +1 -0
  236. package/internal/utils/path.mjs +74 -0
  237. package/internal/utils/path.mjs.map +1 -0
  238. package/internal/utils/query.d.mts +2 -0
  239. package/internal/utils/query.d.mts.map +1 -0
  240. package/internal/utils/query.d.ts +2 -0
  241. package/internal/utils/query.d.ts.map +1 -0
  242. package/internal/utils/query.js +10 -0
  243. package/internal/utils/query.js.map +1 -0
  244. package/internal/utils/query.mjs +6 -0
  245. package/internal/utils/query.mjs.map +1 -0
  246. package/internal/utils/sleep.d.mts +2 -0
  247. package/internal/utils/sleep.d.mts.map +1 -0
  248. package/internal/utils/sleep.d.ts +2 -0
  249. package/internal/utils/sleep.d.ts.map +1 -0
  250. package/internal/utils/sleep.js +7 -0
  251. package/internal/utils/sleep.js.map +1 -0
  252. package/internal/utils/sleep.mjs +3 -0
  253. package/internal/utils/sleep.mjs.map +1 -0
  254. package/internal/utils/uuid.d.mts +5 -0
  255. package/internal/utils/uuid.d.mts.map +1 -0
  256. package/internal/utils/uuid.d.ts +5 -0
  257. package/internal/utils/uuid.d.ts.map +1 -0
  258. package/internal/utils/uuid.js +19 -0
  259. package/internal/utils/uuid.js.map +1 -0
  260. package/internal/utils/uuid.mjs +15 -0
  261. package/internal/utils/uuid.mjs.map +1 -0
  262. package/internal/utils/values.d.mts +18 -0
  263. package/internal/utils/values.d.mts.map +1 -0
  264. package/internal/utils/values.d.ts +18 -0
  265. package/internal/utils/values.d.ts.map +1 -0
  266. package/internal/utils/values.js +112 -0
  267. package/internal/utils/values.js.map +1 -0
  268. package/internal/utils/values.mjs +94 -0
  269. package/internal/utils/values.mjs.map +1 -0
  270. package/internal/utils.d.mts +8 -0
  271. package/internal/utils.d.mts.map +1 -0
  272. package/internal/utils.d.ts +8 -0
  273. package/internal/utils.d.ts.map +1 -0
  274. package/internal/utils.js +12 -0
  275. package/internal/utils.js.map +1 -0
  276. package/internal/utils.mjs +9 -0
  277. package/internal/utils.mjs.map +1 -0
  278. package/lib/envelope.d.mts +4 -0
  279. package/lib/envelope.d.mts.map +1 -0
  280. package/lib/envelope.d.ts +4 -0
  281. package/lib/envelope.d.ts.map +1 -0
  282. package/lib/envelope.js +43 -0
  283. package/lib/envelope.js.map +1 -0
  284. package/lib/envelope.mjs +39 -0
  285. package/lib/envelope.mjs.map +1 -0
  286. package/package.json +142 -76
  287. package/resource.d.mts +3 -0
  288. package/resource.d.mts.map +1 -0
  289. package/resource.d.ts +3 -0
  290. package/resource.d.ts.map +1 -0
  291. package/resource.js +6 -0
  292. package/resource.js.map +1 -0
  293. package/resource.mjs +3 -0
  294. package/resource.mjs.map +1 -0
  295. package/resources/agents.d.mts +1243 -0
  296. package/resources/agents.d.mts.map +1 -0
  297. package/resources/agents.d.ts +1243 -0
  298. package/resources/agents.d.ts.map +1 -0
  299. package/resources/agents.js +192 -0
  300. package/resources/agents.js.map +1 -0
  301. package/resources/agents.mjs +188 -0
  302. package/resources/agents.mjs.map +1 -0
  303. package/resources/api-keys.d.mts +539 -0
  304. package/resources/api-keys.d.mts.map +1 -0
  305. package/resources/api-keys.d.ts +539 -0
  306. package/resources/api-keys.d.ts.map +1 -0
  307. package/resources/api-keys.js +100 -0
  308. package/resources/api-keys.js.map +1 -0
  309. package/resources/api-keys.mjs +96 -0
  310. package/resources/api-keys.mjs.map +1 -0
  311. package/resources/counterparties.d.mts +89 -0
  312. package/resources/counterparties.d.mts.map +1 -0
  313. package/resources/counterparties.d.ts +89 -0
  314. package/resources/counterparties.d.ts.map +1 -0
  315. package/resources/counterparties.js +30 -0
  316. package/resources/counterparties.js.map +1 -0
  317. package/resources/counterparties.mjs +26 -0
  318. package/resources/counterparties.mjs.map +1 -0
  319. package/resources/customers.d.mts +272 -0
  320. package/resources/customers.d.mts.map +1 -0
  321. package/resources/customers.d.ts +272 -0
  322. package/resources/customers.d.ts.map +1 -0
  323. package/resources/customers.js +48 -0
  324. package/resources/customers.js.map +1 -0
  325. package/resources/customers.mjs +44 -0
  326. package/resources/customers.mjs.map +1 -0
  327. package/resources/delegations.d.mts +458 -0
  328. package/resources/delegations.d.mts.map +1 -0
  329. package/resources/delegations.d.ts +458 -0
  330. package/resources/delegations.d.ts.map +1 -0
  331. package/resources/delegations.js +47 -0
  332. package/resources/delegations.js.map +1 -0
  333. package/resources/delegations.mjs +43 -0
  334. package/resources/delegations.mjs.map +1 -0
  335. package/resources/external-accounts.d.mts +239 -0
  336. package/resources/external-accounts.d.mts.map +1 -0
  337. package/resources/external-accounts.d.ts +239 -0
  338. package/resources/external-accounts.d.ts.map +1 -0
  339. package/resources/external-accounts.js +47 -0
  340. package/resources/external-accounts.js.map +1 -0
  341. package/resources/external-accounts.mjs +43 -0
  342. package/resources/external-accounts.mjs.map +1 -0
  343. package/resources/index.d.mts +14 -0
  344. package/resources/index.d.mts.map +1 -0
  345. package/resources/index.d.ts +14 -0
  346. package/resources/index.d.ts.map +1 -0
  347. package/resources/index.js +31 -0
  348. package/resources/index.js.map +1 -0
  349. package/resources/index.mjs +15 -0
  350. package/resources/index.mjs.map +1 -0
  351. package/resources/invitations.d.mts +304 -0
  352. package/resources/invitations.d.mts.map +1 -0
  353. package/resources/invitations.d.ts +304 -0
  354. package/resources/invitations.d.ts.map +1 -0
  355. package/resources/invitations.js +85 -0
  356. package/resources/invitations.js.map +1 -0
  357. package/resources/invitations.mjs +81 -0
  358. package/resources/invitations.mjs.map +1 -0
  359. package/resources/parties.d.mts +364 -0
  360. package/resources/parties.d.mts.map +1 -0
  361. package/resources/parties.d.ts +364 -0
  362. package/resources/parties.d.ts.map +1 -0
  363. package/resources/parties.js +78 -0
  364. package/resources/parties.js.map +1 -0
  365. package/resources/parties.mjs +74 -0
  366. package/resources/parties.mjs.map +1 -0
  367. package/resources/payment-requests.d.mts +449 -0
  368. package/resources/payment-requests.d.mts.map +1 -0
  369. package/resources/payment-requests.d.ts +449 -0
  370. package/resources/payment-requests.d.ts.map +1 -0
  371. package/resources/payment-requests.js +86 -0
  372. package/resources/payment-requests.js.map +1 -0
  373. package/resources/payment-requests.mjs +82 -0
  374. package/resources/payment-requests.mjs.map +1 -0
  375. package/resources/payments.d.mts +174 -0
  376. package/resources/payments.d.mts.map +1 -0
  377. package/resources/payments.d.ts +174 -0
  378. package/resources/payments.d.ts.map +1 -0
  379. package/resources/payments.js +40 -0
  380. package/resources/payments.js.map +1 -0
  381. package/resources/payments.mjs +36 -0
  382. package/resources/payments.mjs.map +1 -0
  383. package/resources/transactions.d.mts +486 -0
  384. package/resources/transactions.d.mts.map +1 -0
  385. package/resources/transactions.d.ts +486 -0
  386. package/resources/transactions.d.ts.map +1 -0
  387. package/resources/transactions.js +48 -0
  388. package/resources/transactions.js.map +1 -0
  389. package/resources/transactions.mjs +44 -0
  390. package/resources/transactions.mjs.map +1 -0
  391. package/resources/wallet.d.mts +496 -0
  392. package/resources/wallet.d.mts.map +1 -0
  393. package/resources/wallet.d.ts +496 -0
  394. package/resources/wallet.d.ts.map +1 -0
  395. package/resources/wallet.js +114 -0
  396. package/resources/wallet.js.map +1 -0
  397. package/resources/wallet.mjs +110 -0
  398. package/resources/wallet.mjs.map +1 -0
  399. package/resources/webhooks.d.mts +775 -0
  400. package/resources/webhooks.d.mts.map +1 -0
  401. package/resources/webhooks.d.ts +775 -0
  402. package/resources/webhooks.d.ts.map +1 -0
  403. package/resources/webhooks.js +163 -0
  404. package/resources/webhooks.js.map +1 -0
  405. package/resources/webhooks.mjs +159 -0
  406. package/resources/webhooks.mjs.map +1 -0
  407. package/resources.d.mts +2 -0
  408. package/resources.d.mts.map +1 -0
  409. package/resources.d.ts +2 -0
  410. package/resources.d.ts.map +1 -0
  411. package/resources.js +5 -0
  412. package/resources.js.map +1 -0
  413. package/resources.mjs +2 -0
  414. package/resources.mjs.map +1 -0
  415. package/src/api-promise.ts +2 -0
  416. package/src/client.ts +1068 -0
  417. package/src/core/README.md +3 -0
  418. package/src/core/api-promise.ts +92 -0
  419. package/src/core/error.ts +130 -0
  420. package/src/core/resource.ts +11 -0
  421. package/src/core/uploads.ts +2 -0
  422. package/src/error.ts +2 -0
  423. package/src/index.ts +22 -0
  424. package/src/internal/README.md +3 -0
  425. package/src/internal/builtin-types.ts +93 -0
  426. package/src/internal/detect-platform.ts +196 -0
  427. package/src/internal/errors.ts +33 -0
  428. package/src/internal/headers.ts +97 -0
  429. package/src/internal/parse.ts +56 -0
  430. package/src/internal/qs/LICENSE.md +13 -0
  431. package/src/internal/qs/README.md +3 -0
  432. package/src/internal/qs/formats.ts +10 -0
  433. package/src/internal/qs/index.ts +13 -0
  434. package/src/internal/qs/stringify.ts +385 -0
  435. package/src/internal/qs/types.ts +71 -0
  436. package/src/internal/qs/utils.ts +265 -0
  437. package/src/internal/request-options.ts +91 -0
  438. package/src/internal/shim-types.ts +26 -0
  439. package/src/internal/shims.ts +107 -0
  440. package/src/internal/to-file.ts +154 -0
  441. package/src/internal/types.ts +93 -0
  442. package/src/internal/uploads.ts +187 -0
  443. package/src/internal/utils/base64.ts +40 -0
  444. package/src/internal/utils/bytes.ts +32 -0
  445. package/src/internal/utils/env.ts +18 -0
  446. package/src/internal/utils/log.ts +128 -0
  447. package/src/internal/utils/path.ts +88 -0
  448. package/src/internal/utils/query.ts +7 -0
  449. package/src/internal/utils/sleep.ts +3 -0
  450. package/src/internal/utils/uuid.ts +17 -0
  451. package/src/internal/utils/values.ts +105 -0
  452. package/src/internal/utils.ts +9 -0
  453. package/src/lib/.keep +4 -0
  454. package/src/lib/envelope.ts +32 -0
  455. package/src/resource.ts +2 -0
  456. package/src/resources/agents.ts +1605 -0
  457. package/src/resources/api-keys.ts +743 -0
  458. package/src/resources/counterparties.ts +128 -0
  459. package/src/resources/customers.ts +365 -0
  460. package/src/resources/delegations.ts +580 -0
  461. package/src/resources/external-accounts.ts +324 -0
  462. package/src/resources/index.ts +113 -0
  463. package/src/resources/invitations.ts +414 -0
  464. package/src/resources/parties.ts +493 -0
  465. package/src/resources/payment-requests.ts +611 -0
  466. package/src/resources/payments.ts +228 -0
  467. package/src/resources/transactions.ts +620 -0
  468. package/src/resources/wallet.ts +668 -0
  469. package/src/resources/webhooks.ts +1225 -0
  470. package/src/resources.ts +1 -0
  471. package/src/tsconfig.json +11 -0
  472. package/src/uploads.ts +2 -0
  473. package/src/version.ts +1 -0
  474. package/uploads.d.mts +3 -0
  475. package/uploads.d.mts.map +1 -0
  476. package/uploads.d.ts +3 -0
  477. package/uploads.d.ts.map +1 -0
  478. package/uploads.js +6 -0
  479. package/uploads.js.map +1 -0
  480. package/uploads.mjs +3 -0
  481. package/uploads.mjs.map +1 -0
  482. package/version.d.mts +2 -0
  483. package/version.d.mts.map +1 -0
  484. package/version.d.ts +2 -0
  485. package/version.d.ts.map +1 -0
  486. package/version.js +5 -0
  487. package/version.js.map +1 -0
  488. package/version.mjs +2 -0
  489. package/version.mjs.map +1 -0
  490. package/dist/index.cjs +0 -1737
  491. package/dist/index.cjs.map +0 -1
  492. package/dist/index.d.cts +0 -929
  493. package/dist/index.d.ts +0 -929
  494. package/dist/index.js +0 -1705
  495. package/dist/index.js.map +0 -1
  496. package/dist/mcp/cli.cjs +0 -166
  497. package/dist/mcp/cli.cjs.map +0 -1
  498. package/dist/mcp/cli.d.cts +0 -1
  499. package/dist/mcp/cli.d.ts +0 -1
  500. package/dist/mcp/cli.js +0 -164
  501. package/dist/mcp/cli.js.map +0 -1
  502. package/dist/mcp/index.cjs +0 -8
  503. package/dist/mcp/index.cjs.map +0 -1
  504. package/dist/mcp/index.d.cts +0 -9
  505. package/dist/mcp/index.d.ts +0 -9
  506. package/dist/mcp/index.js +0 -6
  507. package/dist/mcp/index.js.map +0 -1
package/CHANGELOG.md ADDED
@@ -0,0 +1,148 @@
1
+ # Changelog
2
+
3
+ ## 0.3.0 (2026-05-19)
4
+
5
+ Full Changelog: [v0.2.1...v0.3.0](https://github.com/naturalpay/naturalpay-ts/compare/v0.2.1...v0.3.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** api update ([d5020ed](https://github.com/naturalpay/naturalpay-ts/commit/d5020edec88d76b85e6e1c2c1400f37bbae177c6))
10
+ * **api:** api update ([bc55079](https://github.com/naturalpay/naturalpay-ts/commit/bc550791bb24a388e0b7744e67dd49d5e1dc22bd))
11
+ * **api:** api update ([07374ea](https://github.com/naturalpay/naturalpay-ts/commit/07374eaef208f1a5657251cfaf551ac9b42859f3))
12
+ * **api:** api update ([efba1a7](https://github.com/naturalpay/naturalpay-ts/commit/efba1a78ed1fbde724dcfdd4497e8584e2b30ad2))
13
+ * **api:** api update ([9389666](https://github.com/naturalpay/naturalpay-ts/commit/9389666329e5faddcc6643fc48252486b9ada59a))
14
+ * **api:** api update ([34c273a](https://github.com/naturalpay/naturalpay-ts/commit/34c273a46b677a62fe2e2e0e89b992e5744de1a4))
15
+ * **api:** api update ([93f89eb](https://github.com/naturalpay/naturalpay-ts/commit/93f89ebb2d0590701d592fd70704b2cdfe033d9d))
16
+ * **api:** api update ([d441f09](https://github.com/naturalpay/naturalpay-ts/commit/d441f09cbad7594664aea362d3e91c908d6d8c97))
17
+ * **api:** api update ([b556304](https://github.com/naturalpay/naturalpay-ts/commit/b556304d31b31a9764f63feaa241637d4607329d))
18
+ * **api:** api update ([f0462e1](https://github.com/naturalpay/naturalpay-ts/commit/f0462e1499637c939bfa179b87933b154b2ec9bc))
19
+ * **api:** api update ([653536b](https://github.com/naturalpay/naturalpay-ts/commit/653536bcd83c19271072c3a6ac1393e8cb30e2e1))
20
+ * **api:** api update ([9c90585](https://github.com/naturalpay/naturalpay-ts/commit/9c905854e7b48c976ad842ed3d10d9cfbb83e905))
21
+
22
+
23
+ ### Bug Fixes
24
+
25
+ * **typescript:** upgrade tsc-multi so that it works with Node 26 ([b8f448b](https://github.com/naturalpay/naturalpay-ts/commit/b8f448b0d9d857f48e4282d9bc7d8d5f532eff2e))
26
+
27
+
28
+ ### Chores
29
+
30
+ * **tests:** remove redundant File import ([120a5e0](https://github.com/naturalpay/naturalpay-ts/commit/120a5e068a9bdecc71683842f45ca45ba153397f))
31
+
32
+ ## 0.2.1 (2026-05-16)
33
+
34
+ Full Changelog: [v0.0.1...v0.2.1](https://github.com/naturalpay/naturalpay-ts/compare/v0.0.1...v0.2.1)
35
+
36
+ ### ⚠ BREAKING CHANGES
37
+
38
+ * **sdk:** align implemented endpoints with public OpenAPI ([#45](https://github.com/naturalpay/naturalpay-ts/issues/45))
39
+
40
+ ### Features
41
+
42
+ * add context param and fill instanceId gaps across all methods ([#11](https://github.com/naturalpay/naturalpay-ts/issues/11)) ([8aee6b5](https://github.com/naturalpay/naturalpay-ts/commit/8aee6b5c8565719d245c1d02ac7e6c77de1ac797))
43
+ * add instanceId for agent observability ([#10](https://github.com/naturalpay/naturalpay-ts/issues/10)) ([63c9a32](https://github.com/naturalpay/naturalpay-ts/commit/63c9a328f4ce7062a4c20e9d164812938a230ddc))
44
+ * add ModelContext and ModelUsage for observability ([#25](https://github.com/naturalpay/naturalpay-ts/issues/25)) ([fc50eb0](https://github.com/naturalpay/naturalpay-ts/commit/fc50eb0eedc1c1afe9d49a51f8f1af49fc136dab))
45
+ * add structured logging with Datadog support ([c34e43f](https://github.com/naturalpay/naturalpay-ts/commit/c34e43fbb7b43ea61d424497718e7326f1a40575))
46
+ * add traceId parameter for distributed tracing ([#32](https://github.com/naturalpay/naturalpay-ts/issues/32)) ([2165263](https://github.com/naturalpay/naturalpay-ts/commit/21652635622d40b02bfc8c81857459c32f9c2cb3))
47
+ * add type filter to transactions, remove wallet.transfers() ([c9c7559](https://github.com/naturalpay/naturalpay-ts/commit/c9c75599a1bdc7d5811aa063778e6a2ae9b277a2))
48
+ * align SDK endpoints with public API ([#12](https://github.com/naturalpay/naturalpay-ts/issues/12)) ([c942396](https://github.com/naturalpay/naturalpay-ts/commit/c942396d1f7daf794ce8eb51205cd0c942218284))
49
+ * **api:** api update ([c0b355c](https://github.com/naturalpay/naturalpay-ts/commit/c0b355cda288b6adaede8165f65c407c07fdee11))
50
+ * **api:** api update ([40cf543](https://github.com/naturalpay/naturalpay-ts/commit/40cf543332c3cc7297f1815aa68ca13c56635c02))
51
+ * **api:** api update ([e609cb8](https://github.com/naturalpay/naturalpay-ts/commit/e609cb831ad29e0abcc594a1e69d51afb010a25e))
52
+ * **api:** api update ([07ca3a8](https://github.com/naturalpay/naturalpay-ts/commit/07ca3a891b7974c86a2369b02774c99af04be26d))
53
+ * **api:** api update ([4103315](https://github.com/naturalpay/naturalpay-ts/commit/41033156995bd42332842f5077e6a53a7e289eb5))
54
+ * **api:** api update ([9e01255](https://github.com/naturalpay/naturalpay-ts/commit/9e012559a0e89a7c9817536b8ba7889d567507bb))
55
+ * **api:** api update ([5276f7c](https://github.com/naturalpay/naturalpay-ts/commit/5276f7c56bd6ea6d21fbb8b91c6d2115d788d776))
56
+ * **api:** api update ([75d0d85](https://github.com/naturalpay/naturalpay-ts/commit/75d0d851c517fece28e0e61aa1370fd2d86ae0db))
57
+ * **api:** api update ([e88ad5d](https://github.com/naturalpay/naturalpay-ts/commit/e88ad5d6e4be8ea95c6fcac3b510693d03912872))
58
+ * **api:** api update ([f5565eb](https://github.com/naturalpay/naturalpay-ts/commit/f5565eb1488ee8048c25b989c3cc02afeb09bd79))
59
+ * **api:** api update ([54140dd](https://github.com/naturalpay/naturalpay-ts/commit/54140dde4a811c84a1ecf5819770259472d06400))
60
+ * **api:** api update ([ff8b849](https://github.com/naturalpay/naturalpay-ts/commit/ff8b8493c918551a4d754763aff74de964a10c90))
61
+ * **api:** api update ([ee5f3c1](https://github.com/naturalpay/naturalpay-ts/commit/ee5f3c1f3619d7f544be8f8afe04ffb6d82417f2))
62
+ * **api:** api update ([148ff21](https://github.com/naturalpay/naturalpay-ts/commit/148ff21f969415e8a0c4f51ae7b5e670e2b7df55))
63
+ * **api:** api update ([06f3637](https://github.com/naturalpay/naturalpay-ts/commit/06f36375dc16aa98dea0f15ac0c1796a1305ed2e))
64
+ * **api:** api update ([7610ef6](https://github.com/naturalpay/naturalpay-ts/commit/7610ef6677957dd3d05239d773962f113ca08a8a))
65
+ * **api:** api update ([d8f7b3f](https://github.com/naturalpay/naturalpay-ts/commit/d8f7b3f183058347b28f03dba72144e58ebd0ba1))
66
+ * **api:** api update ([45b409f](https://github.com/naturalpay/naturalpay-ts/commit/45b409f149c6b1a14ed0a1eab7373092f5e8607c))
67
+ * **api:** api update ([195e031](https://github.com/naturalpay/naturalpay-ts/commit/195e0310f4b73a372adb6d1184f17d9e9844c510))
68
+ * **api:** api update ([56ee513](https://github.com/naturalpay/naturalpay-ts/commit/56ee513159a8c6a26694d02445e90f95e5908e40))
69
+ * **api:** api update ([0d1ca15](https://github.com/naturalpay/naturalpay-ts/commit/0d1ca1505b28f925e6c8170467cfef8cdd7fb8d4))
70
+ * **api:** api update ([4581b56](https://github.com/naturalpay/naturalpay-ts/commit/4581b56f2b3e8139bde75fa2a3f56b5f66dad894))
71
+ * **api:** api update ([65babd2](https://github.com/naturalpay/naturalpay-ts/commit/65babd2717e40697f12770422bc503070fade7e2))
72
+ * **api:** Require Instance ID when Agent ID Present ([#27](https://github.com/naturalpay/naturalpay-ts/issues/27)) ([0e9524d](https://github.com/naturalpay/naturalpay-ts/commit/0e9524d69491f75132d30f23ec24e410b7dcdc3b))
73
+ * improve create_payment MCP tool ([#4](https://github.com/naturalpay/naturalpay-ts/issues/4)) ([7cb463f](https://github.com/naturalpay/naturalpay-ts/commit/7cb463f3d6d6995c47a66d28182a8bc9029b7995))
74
+ * make customerPartyId optional in payments SDK ([#34](https://github.com/naturalpay/naturalpay-ts/issues/34)) ([070d81d](https://github.com/naturalpay/naturalpay-ts/commit/070d81d2e0701759a701ef6e494046965a08b065))
75
+ * **mcp:** Move to Proxy ([#26](https://github.com/naturalpay/naturalpay-ts/issues/26)) ([2584e15](https://github.com/naturalpay/naturalpay-ts/commit/2584e151771a2fa8b3d274e1779be6894579d644))
76
+ * payments.create() returns Transaction, remove Payment interface ([#16](https://github.com/naturalpay/naturalpay-ts/issues/16)) ([1007b10](https://github.com/naturalpay/naturalpay-ts/commit/1007b1035f30de4c4f7f1c6a0ce114f47a0d2dcf))
77
+ * per-agent invitation SDK (0.2.0) ([#43](https://github.com/naturalpay/naturalpay-ts/issues/43)) ([46625dc](https://github.com/naturalpay/naturalpay-ts/commit/46625dc03e0b1ee412abb696cfe5c172e4b1ccbc))
78
+ * rename counterparties to customers in TypeScript SDK ([#15](https://github.com/naturalpay/naturalpay-ts/issues/15)) ([4fcd683](https://github.com/naturalpay/naturalpay-ts/commit/4fcd68368820582b7133cae2e7705adb4dd4a56a))
79
+ * **sdk:** Achieve SDK Parity ([#30](https://github.com/naturalpay/naturalpay-ts/issues/30)) ([548beba](https://github.com/naturalpay/naturalpay-ts/commit/548beba167438b1eb4128b5e66c7b1090f972a56))
80
+ * **sdk:** Allow Txn Queryable by Party ([#29](https://github.com/naturalpay/naturalpay-ts/issues/29)) ([edfa0a9](https://github.com/naturalpay/naturalpay-ts/commit/edfa0a9d50737ac4093a5a70790dd55c9af9077a))
81
+ * **sdk:** enforce canonical Natural tool names via typed enum ([#36](https://github.com/naturalpay/naturalpay-ts/issues/36)) ([df2cff2](https://github.com/naturalpay/naturalpay-ts/commit/df2cff2299b243a0959c80822f5c8cab06032fed))
82
+ * **sdk:** Retry and Webhook Signatures ([#33](https://github.com/naturalpay/naturalpay-ts/issues/33)) ([1e3056b](https://github.com/naturalpay/naturalpay-ts/commit/1e3056b77dc78db54ee7dcc6fce03466bb309281))
83
+ * update SDK to match camelCase API shapes ([#24](https://github.com/naturalpay/naturalpay-ts/issues/24)) ([e5cfe83](https://github.com/naturalpay/naturalpay-ts/commit/e5cfe83d0a226f02434dacc39724080c9ec2f06f))
84
+
85
+
86
+ ### Bug Fixes
87
+
88
+ * address codex review feedback ([5fa9b61](https://github.com/naturalpay/naturalpay-ts/commit/5fa9b618d3fcb3e07bce06a0b657b426f7c46f5a))
89
+ * address review feedback ([12b335c](https://github.com/naturalpay/naturalpay-ts/commit/12b335c4b8cb805b4af4d215590d043c8d16fb02))
90
+ * address review feedback for e2e testing ([4049706](https://github.com/naturalpay/naturalpay-ts/commit/4049706bef7ea65600cac463a5a62175aa0ae269))
91
+ * **api:** Conform to new API Shape ([545b860](https://github.com/naturalpay/naturalpay-ts/commit/545b860995536e2d8637dff2f3e76a906048ae3d))
92
+ * **api:** Unify Remaining Resources ([#8](https://github.com/naturalpay/naturalpay-ts/issues/8)) ([8b558e2](https://github.com/naturalpay/naturalpay-ts/commit/8b558e2526bdf7efbdc80ef63ee7ce2fc792ddef))
93
+ * **CI:** Fix Release Workflow ([7ce6b24](https://github.com/naturalpay/naturalpay-ts/commit/7ce6b243e494e47543015dca1b683b8b0603e221))
94
+ * **CI:** Remove Provenance ([749f1fb](https://github.com/naturalpay/naturalpay-ts/commit/749f1fbcdfad4c45cea419d7952c9ee420eb7af6))
95
+ * **CI:** Update Node for Trusted Publisher ([8f327b7](https://github.com/naturalpay/naturalpay-ts/commit/8f327b7d532247fd779a480ad5cd7712e02f17db))
96
+ * format transactions types ([71623c9](https://github.com/naturalpay/naturalpay-ts/commit/71623c9dfda7906fa1a0b275a0f1a5d66541b5e6))
97
+ * only run release-drafter on push to main ([7a31510](https://github.com/naturalpay/naturalpay-ts/commit/7a31510a7df4e5d12d42368fd88cc82380a7f1c5))
98
+ * prettier formatting and update Dockerfile to Node 22 ([eee3d29](https://github.com/naturalpay/naturalpay-ts/commit/eee3d29ff93c34dc3529488bbdbdda0f5cc85b36))
99
+ * remove /v1 prefix from wallet API paths ([97aa86c](https://github.com/naturalpay/naturalpay-ts/commit/97aa86ccc1952206afa80cf6d677b09cb7824010))
100
+ * restore agentId to payments.create(), pass as X-Agent-ID header ([#9](https://github.com/naturalpay/naturalpay-ts/issues/9)) ([b71b9c0](https://github.com/naturalpay/naturalpay-ts/commit/b71b9c0c6982c6bc9a6af180d664de350c8373ce))
101
+ * **routes:** Unify SDK ([#18](https://github.com/naturalpay/naturalpay-ts/issues/18)) ([57245f2](https://github.com/naturalpay/naturalpay-ts/commit/57245f205d6c6005bad5110e8e0bf4724725cdad))
102
+ * **sdk:** align implemented endpoints with public OpenAPI ([#45](https://github.com/naturalpay/naturalpay-ts/issues/45)) ([6e99127](https://github.com/naturalpay/naturalpay-ts/commit/6e991270a4e0bb8428fef87bfca3d1c255ebb5da))
103
+ * update README - remove stale wallet methods, add type filter docs ([b064a7a](https://github.com/naturalpay/naturalpay-ts/commit/b064a7a944231b169dc4bba50f3098a908df50e3))
104
+ * use /auth/api/token for JWT exchange ([#23](https://github.com/naturalpay/naturalpay-ts/issues/23)) ([30a0b33](https://github.com/naturalpay/naturalpay-ts/commit/30a0b33157bc36fe49e09e81087dc9af738b4bc8))
105
+ * use correct customer party ID from seed_test_data.py ([878871d](https://github.com/naturalpay/naturalpay-ts/commit/878871dd9d3e14cc6d4fe856d2dc4bb25e079e38))
106
+ * use getContext() in formatters for AsyncLocalStorage support ([228664d](https://github.com/naturalpay/naturalpay-ts/commit/228664d1a2d5cfe7ae5f1c845fe348e1ee336f44))
107
+ * use integer minor units for amounts ([#22](https://github.com/naturalpay/naturalpay-ts/issues/22)) ([6750522](https://github.com/naturalpay/naturalpay-ts/commit/67505221c2d8551793799415651f693bc1e94141))
108
+
109
+
110
+ ### Chores
111
+
112
+ * add package-lock.json to gitignore (repo uses pnpm) ([b2b4d31](https://github.com/naturalpay/naturalpay-ts/commit/b2b4d31dd90a255365fc5aeb23f1bd17c6ff28c0))
113
+ * baseline main to Stainless next ([22f68df](https://github.com/naturalpay/naturalpay-ts/commit/22f68dfe9fbb4c5b8874dc6d6eb1d2717d522e93))
114
+ * Bump Version ([58d890d](https://github.com/naturalpay/naturalpay-ts/commit/58d890d3630aa9171c03e90d81f6308ea0ee1aec))
115
+ * **CI:** Fix Naming ([db60961](https://github.com/naturalpay/naturalpay-ts/commit/db6096110c95531190e3c76b2d911070154c9d35))
116
+ * **CI:** Move Towards Trusted Publisher ([1564541](https://github.com/naturalpay/naturalpay-ts/commit/15645412fd98b848f565b20a34425d1c5629956b))
117
+ * **deps:** update dependency @modelcontextprotocol/sdk to v1.26.0 [security] ([#49](https://github.com/naturalpay/naturalpay-ts/issues/49)) ([a8ec77d](https://github.com/naturalpay/naturalpay-ts/commit/a8ec77d6c3b7fe8afd246cf103bc9d923a467c8e))
118
+ * **docs:** Fix README ([91893d7](https://github.com/naturalpay/naturalpay-ts/commit/91893d7fe25fac8df7ced3abe18f05fdf381af40))
119
+ * **docs:** Update README ([319efe0](https://github.com/naturalpay/naturalpay-ts/commit/319efe02ef8d2216732c18e59157a1e03e5a9d7b))
120
+ * rename BFF → server-ts in SDK docstrings ([#44](https://github.com/naturalpay/naturalpay-ts/issues/44)) ([a1fd526](https://github.com/naturalpay/naturalpay-ts/commit/a1fd526a0a37c6130ac7f1f88026e340875a6460))
121
+ * **sdk:** Bump Patch Version ([ca3f58d](https://github.com/naturalpay/naturalpay-ts/commit/ca3f58dc6d6801da72f5f4047eb904dad17dff91))
122
+ * **sdk:** Reset Version to 0.1.0 ([32c2117](https://github.com/naturalpay/naturalpay-ts/commit/32c2117a0bec17844502e0d4fda6d8f52b105e48))
123
+ * sync repo ([b45d508](https://github.com/naturalpay/naturalpay-ts/commit/b45d508cef8057fd504c489be87be3ae0b52b39b))
124
+ * **tests:** remove client-coupled envelope canary ([14aabfd](https://github.com/naturalpay/naturalpay-ts/commit/14aabfd42154ba3a2e2c7d78a39a7e4fbcaea55b))
125
+ * update SDK settings ([8ad2341](https://github.com/naturalpay/naturalpay-ts/commit/8ad2341538beeaa2b50d304a8e6ccca620e362d3))
126
+ * update SDK settings ([0cd65a9](https://github.com/naturalpay/naturalpay-ts/commit/0cd65a9f77acb5f15cf60978c33ad54a967d10be))
127
+ * update SDK settings ([ebf5496](https://github.com/naturalpay/naturalpay-ts/commit/ebf5496369cf9b0c48b16a8e0d1b506f7c86eeee))
128
+ * update SDK settings ([331a82b](https://github.com/naturalpay/naturalpay-ts/commit/331a82b186b351bc4704ae9c801bbec6e90f66f3))
129
+ * update SDK settings ([9cc741a](https://github.com/naturalpay/naturalpay-ts/commit/9cc741a4b276016a2cae8543f9fc3556c8a7efba))
130
+ * **version:** Bump Version ([2e126fc](https://github.com/naturalpay/naturalpay-ts/commit/2e126fc8f35e67b78a825b00262217ad7e37bbc6))
131
+
132
+
133
+ ### Documentation
134
+
135
+ * **README:** Pare Down Readme ([#31](https://github.com/naturalpay/naturalpay-ts/issues/31)) ([0f34778](https://github.com/naturalpay/naturalpay-ts/commit/0f347784b96359ce9ab4d5be2c4b273c3b4ba932))
136
+
137
+
138
+ ### Styles
139
+
140
+ * fix formatting with prettier ([d97479e](https://github.com/naturalpay/naturalpay-ts/commit/d97479e0d807eed7e77cf6484985e0b716194a4e))
141
+
142
+
143
+ ### Refactors
144
+
145
+ * **models:** consolidate wallet balance to breakdown + available ([#17](https://github.com/naturalpay/naturalpay-ts/issues/17)) ([da08731](https://github.com/naturalpay/naturalpay-ts/commit/da08731fece1e004ad23fe2989fec272b8c0a1ba))
146
+ * remove X-On-Behalf-Of header, use body/query params ([#14](https://github.com/naturalpay/naturalpay-ts/issues/14)) ([87853e2](https://github.com/naturalpay/naturalpay-ts/commit/87853e2aef03df11153b2440b53b9cbf3a724d2f))
147
+ * **sdk:** drop developer_context — header-only v2 ([#38](https://github.com/naturalpay/naturalpay-ts/issues/38)) ([98d3fef](https://github.com/naturalpay/naturalpay-ts/commit/98d3fef32a28183bf0648ff823f3f64d05e50d90))
148
+ * standardize ID prefixes to 3-letter format ([#13](https://github.com/naturalpay/naturalpay-ts/issues/13)) ([8a5a7c0](https://github.com/naturalpay/naturalpay-ts/commit/8a5a7c074813b379e2aa04615ae9727453027dae))
package/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright 2026 naturalpay
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,12 +1,12 @@
1
- # Natural Payments SDK
1
+ # Naturalpay TypeScript API Library
2
2
 
3
- [![NPM version](https://img.shields.io/npm/v/@naturalpay/sdk.svg)](https://npmjs.org/package/@naturalpay/sdk)
3
+ [![NPM version](<https://img.shields.io/npm/v/@naturalpay/sdk.svg?label=npm%20(stable)>)](https://npmjs.org/package/@naturalpay/sdk) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/@naturalpay/sdk)
4
4
 
5
- The Natural Payments SDK provides access to the [Natural API](https://docs.natural.co) from server-side TypeScript and JavaScript applications, for building AI agents that send, receive, and manage money.
5
+ This library provides convenient access to the Naturalpay REST API from server-side TypeScript or JavaScript.
6
6
 
7
- ## Documentation
7
+ The REST API documentation can be found on [docs.natural.co](https://docs.natural.co). The full API of this library can be found in [api.md](api.md).
8
8
 
9
- Full documentation, guides, and API reference are available at **[docs.natural.co/guides/platform/sdks](https://docs.natural.co/guides/platform/sdks)**.
9
+ It is generated with [Stainless](https://www.stainless.com/).
10
10
 
11
11
  ## Installation
12
12
 
@@ -14,40 +14,354 @@ Full documentation, guides, and API reference are available at **[docs.natural.c
14
14
  npm install @naturalpay/sdk
15
15
  ```
16
16
 
17
- ## Getting started
17
+ ## Usage
18
18
 
19
- ```typescript
20
- import { NaturalClient } from '@naturalpay/sdk';
19
+ The full API of this library can be found in [api.md](api.md).
21
20
 
22
- const client = new NaturalClient({ apiKey: process.env['NATURAL_API_KEY'] });
21
+ <!-- prettier-ignore -->
22
+ ```js
23
+ import Natural from '@naturalpay/sdk';
23
24
 
24
- const payment = await client.payments.create({
25
- recipient: 'alice@example.com',
26
- amount: 5000,
27
- memo: 'Payment for consulting',
28
- agentId: 'agt_019cd1798d637a4da75dce386343931d',
29
- instanceId: 'session-abc123',
30
- customerPartyId: 'pty_019cd34e27c179bfbbe6870486b11b67',
31
- idempotencyKey: 'pay_unique_key',
25
+ const client = new Natural({
26
+ apiKey: process.env['NATURAL_API_KEY'], // This is the default and can be omitted
27
+ environment: 'dev', // defaults to 'production'
32
28
  });
33
29
 
34
- console.log(payment.transactionId);
30
+ const agent = await client.agents.create({ name: 'x', 'Idempotency-Key': 'Idempotency-Key' });
31
+
32
+ console.log(agent.data);
35
33
  ```
36
34
 
37
- ## MCP server
35
+ ### Request & Response types
38
36
 
39
- The SDK ships with an MCP server for AI agent integration with Claude Desktop, Cursor, and other MCP clients:
37
+ This library includes TypeScript definitions for all request params and response fields. You may import and use them like so:
40
38
 
41
- ```sh
42
- npx @naturalpay/sdk mcp serve
39
+ <!-- prettier-ignore -->
40
+ ```ts
41
+ import Natural from '@naturalpay/sdk';
42
+
43
+ const client = new Natural({
44
+ apiKey: process.env['NATURAL_API_KEY'], // This is the default and can be omitted
45
+ environment: 'dev', // defaults to 'production'
46
+ });
47
+
48
+ const params: Natural.AgentCreateParams = { name: 'x', 'Idempotency-Key': 'Idempotency-Key' };
49
+ const agent: Natural.AgentCreateResponse = await client.agents.create(params);
50
+ ```
51
+
52
+ Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
53
+
54
+ ## Handling errors
55
+
56
+ When the library is unable to connect to the API,
57
+ or if the API returns a non-success status code (i.e., 4xx or 5xx response),
58
+ a subclass of `APIError` will be thrown:
59
+
60
+ <!-- prettier-ignore -->
61
+ ```ts
62
+ const agent = await client.agents
63
+ .create({ name: 'x', 'Idempotency-Key': 'Idempotency-Key' })
64
+ .catch(async (err) => {
65
+ if (err instanceof Natural.APIError) {
66
+ console.log(err.status); // 400
67
+ console.log(err.name); // BadRequestError
68
+ console.log(err.headers); // {server: 'nginx', ...}
69
+ } else {
70
+ throw err;
71
+ }
72
+ });
73
+ ```
74
+
75
+ Error codes are as follows:
76
+
77
+ | Status Code | Error Type |
78
+ | ----------- | -------------------------- |
79
+ | 400 | `BadRequestError` |
80
+ | 401 | `AuthenticationError` |
81
+ | 403 | `PermissionDeniedError` |
82
+ | 404 | `NotFoundError` |
83
+ | 422 | `UnprocessableEntityError` |
84
+ | 429 | `RateLimitError` |
85
+ | >=500 | `InternalServerError` |
86
+ | N/A | `APIConnectionError` |
87
+
88
+ ### Retries
89
+
90
+ Certain errors will be automatically retried 2 times by default, with a short exponential backoff.
91
+ Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,
92
+ 429 Rate Limit, and >=500 Internal errors will all be retried by default.
93
+
94
+ You can use the `maxRetries` option to configure or disable this:
95
+
96
+ <!-- prettier-ignore -->
97
+ ```js
98
+ // Configure the default for all requests:
99
+ const client = new Natural({
100
+ maxRetries: 0, // default is 2
101
+ });
102
+
103
+ // Or, configure per-request:
104
+ await client.agents.create({ name: 'x', 'Idempotency-Key': 'Idempotency-Key' }, {
105
+ maxRetries: 5,
106
+ });
107
+ ```
108
+
109
+ ### Timeouts
110
+
111
+ Requests time out after 1 minute by default. You can configure this with a `timeout` option:
112
+
113
+ <!-- prettier-ignore -->
114
+ ```ts
115
+ // Configure the default for all requests:
116
+ const client = new Natural({
117
+ timeout: 20 * 1000, // 20 seconds (default is 1 minute)
118
+ });
119
+
120
+ // Override per-request:
121
+ await client.agents.create({ name: 'x', 'Idempotency-Key': 'Idempotency-Key' }, {
122
+ timeout: 5 * 1000,
123
+ });
124
+ ```
125
+
126
+ On timeout, an `APIConnectionTimeoutError` is thrown.
127
+
128
+ Note that requests which time out will be [retried twice by default](#retries).
129
+
130
+ ## Advanced Usage
131
+
132
+ ### Accessing raw Response data (e.g., headers)
133
+
134
+ The "raw" `Response` returned by `fetch()` can be accessed through the `.asResponse()` method on the `APIPromise` type that all methods return.
135
+ This method returns as soon as the headers for a successful response are received and does not consume the response body, so you are free to write custom parsing or streaming logic.
136
+
137
+ You can also use the `.withResponse()` method to get the raw `Response` along with the parsed data.
138
+ Unlike `.asResponse()` this method consumes the body, returning once it is parsed.
139
+
140
+ <!-- prettier-ignore -->
141
+ ```ts
142
+ const client = new Natural();
143
+
144
+ const response = await client.agents
145
+ .create({ name: 'x', 'Idempotency-Key': 'Idempotency-Key' })
146
+ .asResponse();
147
+ console.log(response.headers.get('X-My-Header'));
148
+ console.log(response.statusText); // access the underlying Response object
149
+
150
+ const { data: agent, response: raw } = await client.agents
151
+ .create({ name: 'x', 'Idempotency-Key': 'Idempotency-Key' })
152
+ .withResponse();
153
+ console.log(raw.headers.get('X-My-Header'));
154
+ console.log(agent.data);
43
155
  ```
44
156
 
45
- See [docs.natural.co/guides/platform/sdks#mcp-server](https://docs.natural.co/guides/platform/sdks#mcp-server) for client configuration.
157
+ ### Logging
158
+
159
+ > [!IMPORTANT]
160
+ > All log messages are intended for debugging only. The format and content of log messages
161
+ > may change between releases.
162
+
163
+ #### Log levels
164
+
165
+ The log level can be configured in two ways:
166
+
167
+ 1. Via the `NATURALPAY_LOG` environment variable
168
+ 2. Using the `logLevel` client option (overrides the environment variable if set)
169
+
170
+ ```ts
171
+ import Natural from '@naturalpay/sdk';
172
+
173
+ const client = new Natural({
174
+ logLevel: 'debug', // Show all log messages
175
+ });
176
+ ```
177
+
178
+ Available log levels, from most to least verbose:
179
+
180
+ - `'debug'` - Show debug messages, info, warnings, and errors
181
+ - `'info'` - Show info messages, warnings, and errors
182
+ - `'warn'` - Show warnings and errors (default)
183
+ - `'error'` - Show only errors
184
+ - `'off'` - Disable all logging
185
+
186
+ At the `'debug'` level, all HTTP requests and responses are logged, including headers and bodies.
187
+ Some authentication-related headers are redacted, but sensitive data in request and response bodies
188
+ may still be visible.
189
+
190
+ #### Custom logger
191
+
192
+ By default, this library logs to `globalThis.console`. You can also provide a custom logger.
193
+ Most logging libraries are supported, including [pino](https://www.npmjs.com/package/pino), [winston](https://www.npmjs.com/package/winston), [bunyan](https://www.npmjs.com/package/bunyan), [consola](https://www.npmjs.com/package/consola), [signale](https://www.npmjs.com/package/signale), and [@std/log](https://jsr.io/@std/log). If your logger doesn't work, please open an issue.
194
+
195
+ When providing a custom logger, the `logLevel` option still controls which messages are emitted, messages
196
+ below the configured level will not be sent to your logger.
197
+
198
+ ```ts
199
+ import Natural from '@naturalpay/sdk';
200
+ import pino from 'pino';
201
+
202
+ const logger = pino();
203
+
204
+ const client = new Natural({
205
+ logger: logger.child({ name: 'Natural' }),
206
+ logLevel: 'debug', // Send all messages to pino, allowing it to filter
207
+ });
208
+ ```
209
+
210
+ ### Making custom/undocumented requests
211
+
212
+ This library is typed for convenient access to the documented API. If you need to access undocumented
213
+ endpoints, params, or response properties, the library can still be used.
214
+
215
+ #### Undocumented endpoints
216
+
217
+ To make requests to undocumented endpoints, you can use `client.get`, `client.post`, and other HTTP verbs.
218
+ Options on the client, such as retries, will be respected when making these requests.
219
+
220
+ ```ts
221
+ await client.post('/some/path', {
222
+ body: { some_prop: 'foo' },
223
+ query: { some_query_arg: 'bar' },
224
+ });
225
+ ```
226
+
227
+ #### Undocumented request params
228
+
229
+ To make requests using undocumented parameters, you may use `// @ts-expect-error` on the undocumented
230
+ parameter. This library doesn't validate at runtime that the request matches the type, so any extra values you
231
+ send will be sent as-is.
232
+
233
+ ```ts
234
+ client.agents.create({
235
+ // ...
236
+ // @ts-expect-error baz is not yet public
237
+ baz: 'undocumented option',
238
+ });
239
+ ```
240
+
241
+ For requests with the `GET` verb, any extra params will be in the query, all other requests will send the
242
+ extra param in the body.
243
+
244
+ If you want to explicitly send an extra argument, you can do so with the `query`, `body`, and `headers` request
245
+ options.
246
+
247
+ #### Undocumented response properties
248
+
249
+ To access undocumented response properties, you may access the response object with `// @ts-expect-error` on
250
+ the response object, or cast the response object to the requisite type. Like the request params, we do not
251
+ validate or strip extra properties from the response from the API.
252
+
253
+ ### Customizing the fetch client
254
+
255
+ By default, this library expects a global `fetch` function is defined.
256
+
257
+ If you want to use a different `fetch` function, you can either polyfill the global:
258
+
259
+ ```ts
260
+ import fetch from 'my-fetch';
261
+
262
+ globalThis.fetch = fetch;
263
+ ```
264
+
265
+ Or pass it to the client:
266
+
267
+ ```ts
268
+ import Natural from '@naturalpay/sdk';
269
+ import fetch from 'my-fetch';
270
+
271
+ const client = new Natural({ fetch });
272
+ ```
273
+
274
+ ### Fetch options
275
+
276
+ If you want to set custom `fetch` options without overriding the `fetch` function, you can provide a `fetchOptions` object when instantiating the client or making a request. (Request-specific options override client options.)
277
+
278
+ ```ts
279
+ import Natural from '@naturalpay/sdk';
280
+
281
+ const client = new Natural({
282
+ fetchOptions: {
283
+ // `RequestInit` options
284
+ },
285
+ });
286
+ ```
287
+
288
+ #### Configuring proxies
289
+
290
+ To modify proxy behavior, you can provide custom `fetchOptions` that add runtime-specific proxy
291
+ options to requests:
292
+
293
+ <img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/node.svg" align="top" width="18" height="21"> **Node** <sup>[[docs](https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md#example---proxyagent-with-fetch)]</sup>
294
+
295
+ ```ts
296
+ import Natural from '@naturalpay/sdk';
297
+ import * as undici from 'undici';
298
+
299
+ const proxyAgent = new undici.ProxyAgent('http://localhost:8888');
300
+ const client = new Natural({
301
+ fetchOptions: {
302
+ dispatcher: proxyAgent,
303
+ },
304
+ });
305
+ ```
306
+
307
+ <img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/bun.svg" align="top" width="18" height="21"> **Bun** <sup>[[docs](https://bun.sh/guides/http/proxy)]</sup>
308
+
309
+ ```ts
310
+ import Natural from '@naturalpay/sdk';
311
+
312
+ const client = new Natural({
313
+ fetchOptions: {
314
+ proxy: 'http://localhost:8888',
315
+ },
316
+ });
317
+ ```
318
+
319
+ <img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/deno.svg" align="top" width="18" height="21"> **Deno** <sup>[[docs](https://docs.deno.com/api/deno/~/Deno.createHttpClient)]</sup>
320
+
321
+ ```ts
322
+ import Natural from 'npm:@naturalpay/sdk';
323
+
324
+ const httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } });
325
+ const client = new Natural({
326
+ fetchOptions: {
327
+ client: httpClient,
328
+ },
329
+ });
330
+ ```
331
+
332
+ ## Frequently Asked Questions
333
+
334
+ ## Semantic versioning
335
+
336
+ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:
337
+
338
+ 1. Changes that only affect static types, without breaking runtime behavior.
339
+ 2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_
340
+ 3. Changes that we do not expect to impact the vast majority of users in practice.
341
+
342
+ We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
343
+
344
+ We are keen for your feedback; please open an [issue](https://www.github.com/naturalpay/naturalpay-ts/issues) with questions, bugs, or suggestions.
46
345
 
47
346
  ## Requirements
48
347
 
49
- Node.js 18+
348
+ TypeScript >= 4.9 is supported.
349
+
350
+ The following runtimes are supported:
351
+
352
+ - Web browsers (Up-to-date Chrome, Firefox, Safari, Edge, and more)
353
+ - Node.js 20 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions.
354
+ - Deno v1.28.0 or higher.
355
+ - Bun 1.0 or later.
356
+ - Cloudflare Workers.
357
+ - Vercel Edge Runtime.
358
+ - Jest 28 or greater with the `"node"` environment (`"jsdom"` is not supported at this time).
359
+ - Nitro v2.6 or greater.
360
+
361
+ Note that React Native is not supported at this time.
362
+
363
+ If you are interested in other runtime environments, please open or upvote an issue on GitHub.
50
364
 
51
- ## License
365
+ ## Contributing
52
366
 
53
- MIT
367
+ See [the contributing documentation](./CONTRIBUTING.md).
@@ -0,0 +1,3 @@
1
+ /** @deprecated Import from ./core/api-promise instead */
2
+ export * from "./core/api-promise.mjs";
3
+ //# sourceMappingURL=api-promise.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-promise.d.mts","sourceRoot":"","sources":["src/api-promise.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,uCAAmC"}
@@ -0,0 +1,3 @@
1
+ /** @deprecated Import from ./core/api-promise instead */
2
+ export * from "./core/api-promise.js";
3
+ //# sourceMappingURL=api-promise.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-promise.d.ts","sourceRoot":"","sources":["src/api-promise.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,sCAAmC"}
package/api-promise.js ADDED
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("./internal/tslib.js");
4
+ /** @deprecated Import from ./core/api-promise instead */
5
+ tslib_1.__exportStar(require("./core/api-promise.js"), exports);
6
+ //# sourceMappingURL=api-promise.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-promise.js","sourceRoot":"","sources":["src/api-promise.ts"],"names":[],"mappings":";;;AAAA,yDAAyD;AACzD,gEAAmC"}
@@ -0,0 +1,3 @@
1
+ /** @deprecated Import from ./core/api-promise instead */
2
+ export * from "./core/api-promise.mjs";
3
+ //# sourceMappingURL=api-promise.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-promise.mjs","sourceRoot":"","sources":["src/api-promise.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,uCAAmC"}