project-cpu-mcp 0.10.0 → 0.12.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 (574) hide show
  1. package/README.md +111 -35
  2. package/dist/api/authentication-required.error.d.ts +6 -0
  3. package/dist/api/authentication-required.error.d.ts.map +1 -0
  4. package/dist/api/authentication-required.error.js +9 -0
  5. package/dist/api/authentication-required.error.js.map +1 -0
  6. package/dist/api/client.d.ts +7 -5
  7. package/dist/api/client.d.ts.map +1 -1
  8. package/dist/api/client.js +29 -14
  9. package/dist/api/client.js.map +1 -1
  10. package/dist/api/constants.d.ts +2 -0
  11. package/dist/api/constants.d.ts.map +1 -1
  12. package/dist/api/constants.js +6 -0
  13. package/dist/api/constants.js.map +1 -1
  14. package/dist/api/types.d.ts +189 -220
  15. package/dist/api/types.d.ts.map +1 -1
  16. package/dist/api/types.js +43 -29
  17. package/dist/api/types.js.map +1 -1
  18. package/dist/config/constants.d.ts +6 -2
  19. package/dist/config/constants.d.ts.map +1 -1
  20. package/dist/config/constants.js +6 -2
  21. package/dist/config/constants.js.map +1 -1
  22. package/dist/config/types.js +2 -2
  23. package/dist/config/types.js.map +1 -1
  24. package/dist/contracts/cell.abi.d.ts +26 -2
  25. package/dist/contracts/cell.abi.d.ts.map +1 -1
  26. package/dist/contracts/cell.abi.js +21 -2
  27. package/dist/contracts/cell.abi.js.map +1 -1
  28. package/dist/contracts/erc20.abi.d.ts.map +1 -1
  29. package/dist/contracts/erc20.abi.js +1 -2
  30. package/dist/contracts/erc20.abi.js.map +1 -1
  31. package/dist/contracts/trade.abi.d.ts +341 -0
  32. package/dist/contracts/trade.abi.d.ts.map +1 -1
  33. package/dist/contracts/trade.abi.js +163 -0
  34. package/dist/contracts/trade.abi.js.map +1 -1
  35. package/dist/contracts/trade.types.d.ts +14 -0
  36. package/dist/contracts/trade.types.d.ts.map +1 -0
  37. package/dist/contracts/trade.types.js +15 -0
  38. package/dist/contracts/trade.types.js.map +1 -0
  39. package/dist/contracts/transport.abi.d.ts +4 -0
  40. package/dist/contracts/transport.abi.d.ts.map +1 -1
  41. package/dist/contracts/transport.abi.js +1 -0
  42. package/dist/contracts/transport.abi.js.map +1 -1
  43. package/dist/index.js +40 -3
  44. package/dist/index.js.map +1 -1
  45. package/dist/logger/constants.d.ts +7 -0
  46. package/dist/logger/constants.d.ts.map +1 -1
  47. package/dist/logger/constants.js +11 -0
  48. package/dist/logger/constants.js.map +1 -1
  49. package/dist/logger/file-log.utils.d.ts +4 -0
  50. package/dist/logger/file-log.utils.d.ts.map +1 -0
  51. package/dist/logger/file-log.utils.js +23 -0
  52. package/dist/logger/file-log.utils.js.map +1 -0
  53. package/dist/logger/index.d.ts +1 -1
  54. package/dist/logger/index.d.ts.map +1 -1
  55. package/dist/logger/index.js +5 -3
  56. package/dist/logger/index.js.map +1 -1
  57. package/dist/logger/logger.d.ts +4 -0
  58. package/dist/logger/logger.d.ts.map +1 -1
  59. package/dist/logger/logger.js +48 -3
  60. package/dist/logger/logger.js.map +1 -1
  61. package/dist/logger/redact.utils.d.ts.map +1 -1
  62. package/dist/logger/redact.utils.js +7 -2
  63. package/dist/logger/redact.utils.js.map +1 -1
  64. package/dist/logger/types.d.ts +8 -0
  65. package/dist/logger/types.d.ts.map +1 -1
  66. package/dist/map/attention.utils.d.ts.map +1 -1
  67. package/dist/map/attention.utils.js +1 -0
  68. package/dist/map/attention.utils.js.map +1 -1
  69. package/dist/map/cell-view.utils.d.ts.map +1 -1
  70. package/dist/map/cell-view.utils.js +5 -3
  71. package/dist/map/cell-view.utils.js.map +1 -1
  72. package/dist/map/process-projection.utils.js +2 -2
  73. package/dist/map/process-projection.utils.js.map +1 -1
  74. package/dist/map/reader.utils.d.ts.map +1 -1
  75. package/dist/map/reader.utils.js +3 -2
  76. package/dist/map/reader.utils.js.map +1 -1
  77. package/dist/map/storage.utils.d.ts.map +1 -1
  78. package/dist/map/storage.utils.js +5 -1
  79. package/dist/map/storage.utils.js.map +1 -1
  80. package/dist/map/types.d.ts +21 -0
  81. package/dist/map/types.d.ts.map +1 -1
  82. package/dist/map/types.js +6 -0
  83. package/dist/map/types.js.map +1 -1
  84. package/dist/paybox/auth/authority.d.ts +46 -0
  85. package/dist/paybox/auth/authority.d.ts.map +1 -0
  86. package/dist/paybox/auth/authority.js +410 -0
  87. package/dist/paybox/auth/authority.js.map +1 -0
  88. package/dist/paybox/auth/browser-opener.d.ts +8 -0
  89. package/dist/paybox/auth/browser-opener.d.ts.map +1 -0
  90. package/dist/paybox/auth/browser-opener.js +22 -0
  91. package/dist/paybox/auth/browser-opener.js.map +1 -0
  92. package/dist/paybox/auth/browser-opener.utils.d.ts +2 -0
  93. package/dist/paybox/auth/browser-opener.utils.d.ts.map +1 -0
  94. package/dist/paybox/auth/browser-opener.utils.js +10 -0
  95. package/dist/paybox/auth/browser-opener.utils.js.map +1 -0
  96. package/dist/paybox/auth/constants.d.ts +16 -0
  97. package/dist/paybox/auth/constants.d.ts.map +1 -0
  98. package/dist/paybox/auth/constants.js +16 -0
  99. package/dist/paybox/auth/constants.js.map +1 -0
  100. package/dist/paybox/auth/coordinator.d.ts +21 -0
  101. package/dist/paybox/auth/coordinator.d.ts.map +1 -0
  102. package/dist/paybox/auth/coordinator.factory.d.ts +5 -0
  103. package/dist/paybox/auth/coordinator.factory.d.ts.map +1 -0
  104. package/dist/paybox/auth/coordinator.factory.js +5 -0
  105. package/dist/paybox/auth/coordinator.factory.js.map +1 -0
  106. package/dist/paybox/auth/coordinator.js +87 -0
  107. package/dist/paybox/auth/coordinator.js.map +1 -0
  108. package/dist/paybox/auth/coordinator.utils.d.ts +4 -0
  109. package/dist/paybox/auth/coordinator.utils.d.ts.map +1 -0
  110. package/dist/paybox/auth/coordinator.utils.js +8 -0
  111. package/dist/paybox/auth/coordinator.utils.js.map +1 -0
  112. package/dist/paybox/auth/flow-session.d.ts +24 -0
  113. package/dist/paybox/auth/flow-session.d.ts.map +1 -0
  114. package/dist/paybox/auth/flow-session.js +155 -0
  115. package/dist/paybox/auth/flow-session.js.map +1 -0
  116. package/dist/paybox/auth/loopback-flow.d.ts +49 -0
  117. package/dist/paybox/auth/loopback-flow.d.ts.map +1 -0
  118. package/dist/paybox/auth/loopback-flow.js +381 -0
  119. package/dist/paybox/auth/loopback-flow.js.map +1 -0
  120. package/dist/paybox/auth/loopback-flow.utils.d.ts +7 -0
  121. package/dist/paybox/auth/loopback-flow.utils.d.ts.map +1 -0
  122. package/dist/paybox/auth/loopback-flow.utils.js +47 -0
  123. package/dist/paybox/auth/loopback-flow.utils.js.map +1 -0
  124. package/dist/paybox/auth/loopback-page-fonts.constants.d.ts +3 -0
  125. package/dist/paybox/auth/loopback-page-fonts.constants.d.ts.map +1 -0
  126. package/dist/paybox/auth/loopback-page-fonts.constants.js +228 -0
  127. package/dist/paybox/auth/loopback-page-fonts.constants.js.map +1 -0
  128. package/dist/paybox/auth/loopback-page.utils.d.ts +4 -0
  129. package/dist/paybox/auth/loopback-page.utils.d.ts.map +1 -0
  130. package/dist/paybox/auth/loopback-page.utils.js +261 -0
  131. package/dist/paybox/auth/loopback-page.utils.js.map +1 -0
  132. package/dist/paybox/auth/provisioning.utils.d.ts +3 -0
  133. package/dist/paybox/auth/provisioning.utils.d.ts.map +1 -0
  134. package/dist/paybox/auth/provisioning.utils.js +27 -0
  135. package/dist/paybox/auth/provisioning.utils.js.map +1 -0
  136. package/dist/paybox/auth/signing-key.utils.d.ts +2 -0
  137. package/dist/paybox/auth/signing-key.utils.d.ts.map +1 -0
  138. package/dist/paybox/auth/signing-key.utils.js +14 -0
  139. package/dist/paybox/auth/signing-key.utils.js.map +1 -0
  140. package/dist/paybox/auth/types.d.ts +18 -0
  141. package/dist/paybox/auth/types.d.ts.map +1 -0
  142. package/dist/paybox/auth/types.js +6 -0
  143. package/dist/paybox/auth/types.js.map +1 -0
  144. package/dist/paybox/auth/utils.d.ts +5 -0
  145. package/dist/paybox/auth/utils.d.ts.map +1 -0
  146. package/dist/paybox/auth/utils.js +17 -0
  147. package/dist/paybox/auth/utils.js.map +1 -0
  148. package/dist/paybox/constants.d.ts +11 -0
  149. package/dist/paybox/constants.d.ts.map +1 -0
  150. package/dist/paybox/constants.js +11 -0
  151. package/dist/paybox/constants.js.map +1 -0
  152. package/dist/paybox/errors.d.ts +43 -0
  153. package/dist/paybox/errors.d.ts.map +1 -0
  154. package/dist/paybox/errors.js +141 -0
  155. package/dist/paybox/errors.js.map +1 -0
  156. package/dist/paybox/sdk/adapter.d.ts +16 -0
  157. package/dist/paybox/sdk/adapter.d.ts.map +1 -0
  158. package/dist/paybox/sdk/adapter.js +127 -0
  159. package/dist/paybox/sdk/adapter.js.map +1 -0
  160. package/dist/paybox/sdk/constants.d.ts +14 -0
  161. package/dist/paybox/sdk/constants.d.ts.map +1 -0
  162. package/dist/paybox/sdk/constants.js +23 -0
  163. package/dist/paybox/sdk/constants.js.map +1 -0
  164. package/dist/paybox/sdk/factory.d.ts +4 -0
  165. package/dist/paybox/sdk/factory.d.ts.map +1 -0
  166. package/dist/paybox/sdk/factory.js +24 -0
  167. package/dist/paybox/sdk/factory.js.map +1 -0
  168. package/dist/paybox/sdk/logging.utils.d.ts +4 -0
  169. package/dist/paybox/sdk/logging.utils.d.ts.map +1 -0
  170. package/dist/paybox/sdk/logging.utils.js +19 -0
  171. package/dist/paybox/sdk/logging.utils.js.map +1 -0
  172. package/dist/paybox/sdk/utils.d.ts +7 -0
  173. package/dist/paybox/sdk/utils.d.ts.map +1 -0
  174. package/dist/paybox/sdk/utils.js +182 -0
  175. package/dist/paybox/sdk/utils.js.map +1 -0
  176. package/dist/paybox/storage.d.ts +17 -0
  177. package/dist/paybox/storage.d.ts.map +1 -0
  178. package/dist/paybox/storage.js +87 -0
  179. package/dist/paybox/storage.js.map +1 -0
  180. package/dist/paybox/types.d.ts +481 -0
  181. package/dist/paybox/types.d.ts.map +1 -0
  182. package/dist/paybox/types.js +144 -0
  183. package/dist/paybox/types.js.map +1 -0
  184. package/dist/paybox/wallet/manager.d.ts +22 -0
  185. package/dist/paybox/wallet/manager.d.ts.map +1 -0
  186. package/dist/paybox/wallet/manager.js +111 -0
  187. package/dist/paybox/wallet/manager.js.map +1 -0
  188. package/dist/paybox/wallet/rpc.client.d.ts +16 -0
  189. package/dist/paybox/wallet/rpc.client.d.ts.map +1 -0
  190. package/dist/paybox/wallet/rpc.client.js +53 -0
  191. package/dist/paybox/wallet/rpc.client.js.map +1 -0
  192. package/dist/paybox/wallet/utils.d.ts +5 -0
  193. package/dist/paybox/wallet/utils.d.ts.map +1 -0
  194. package/dist/paybox/wallet/utils.js +82 -0
  195. package/dist/paybox/wallet/utils.js.map +1 -0
  196. package/dist/server.constants.d.ts.map +1 -1
  197. package/dist/server.constants.js +5 -2
  198. package/dist/server.constants.js.map +1 -1
  199. package/dist/server.d.ts.map +1 -1
  200. package/dist/server.js +8 -2
  201. package/dist/server.js.map +1 -1
  202. package/dist/services/app-config.utils.d.ts.map +1 -1
  203. package/dist/services/app-config.utils.js +22 -11
  204. package/dist/services/app-config.utils.js.map +1 -1
  205. package/dist/services/auth.service.d.ts +3 -5
  206. package/dist/services/auth.service.d.ts.map +1 -1
  207. package/dist/services/auth.service.js +20 -77
  208. package/dist/services/auth.service.js.map +1 -1
  209. package/dist/services/cell.client.d.ts.map +1 -1
  210. package/dist/services/cell.client.js +22 -9
  211. package/dist/services/cell.client.js.map +1 -1
  212. package/dist/services/lot-return.constants.d.ts +3 -0
  213. package/dist/services/lot-return.constants.d.ts.map +1 -0
  214. package/dist/services/lot-return.constants.js +35 -0
  215. package/dist/services/lot-return.constants.js.map +1 -0
  216. package/dist/services/lot-return.service.d.ts +25 -0
  217. package/dist/services/lot-return.service.d.ts.map +1 -0
  218. package/dist/services/lot-return.service.js +151 -0
  219. package/dist/services/lot-return.service.js.map +1 -0
  220. package/dist/services/lot-return.types.d.ts +19 -0
  221. package/dist/services/lot-return.types.d.ts.map +1 -0
  222. package/dist/services/lot-return.types.js +2 -0
  223. package/dist/services/lot-return.types.js.map +1 -0
  224. package/dist/services/lot-return.utils.d.ts +33 -0
  225. package/dist/services/lot-return.utils.d.ts.map +1 -0
  226. package/dist/services/lot-return.utils.js +128 -0
  227. package/dist/services/lot-return.utils.js.map +1 -0
  228. package/dist/services/lot-terms.constants.d.ts +4 -0
  229. package/dist/services/lot-terms.constants.d.ts.map +1 -0
  230. package/dist/services/lot-terms.constants.js +5 -0
  231. package/dist/services/lot-terms.constants.js.map +1 -0
  232. package/dist/services/lot-terms.helpers.d.ts +11 -0
  233. package/dist/services/lot-terms.helpers.d.ts.map +1 -0
  234. package/dist/services/lot-terms.helpers.js +45 -0
  235. package/dist/services/lot-terms.helpers.js.map +1 -0
  236. package/dist/services/lot-terms.service.d.ts +20 -0
  237. package/dist/services/lot-terms.service.d.ts.map +1 -0
  238. package/dist/services/lot-terms.service.js +119 -0
  239. package/dist/services/lot-terms.service.js.map +1 -0
  240. package/dist/services/lot-terms.types.d.ts +25 -0
  241. package/dist/services/lot-terms.types.d.ts.map +1 -0
  242. package/dist/services/lot-terms.types.js +2 -0
  243. package/dist/services/lot-terms.types.js.map +1 -0
  244. package/dist/services/reveal-revert.utils.d.ts +1 -0
  245. package/dist/services/reveal-revert.utils.d.ts.map +1 -1
  246. package/dist/services/reveal-revert.utils.js +20 -0
  247. package/dist/services/reveal-revert.utils.js.map +1 -1
  248. package/dist/services/reveal.constants.d.ts +1 -1
  249. package/dist/services/reveal.constants.d.ts.map +1 -1
  250. package/dist/services/reveal.constants.js +1 -1
  251. package/dist/services/reveal.constants.js.map +1 -1
  252. package/dist/services/reveal.service.d.ts +4 -3
  253. package/dist/services/reveal.service.d.ts.map +1 -1
  254. package/dist/services/reveal.service.js +35 -10
  255. package/dist/services/reveal.service.js.map +1 -1
  256. package/dist/services/reveal.utils.d.ts +7 -8
  257. package/dist/services/reveal.utils.d.ts.map +1 -1
  258. package/dist/services/reveal.utils.js +15 -8
  259. package/dist/services/reveal.utils.js.map +1 -1
  260. package/dist/services/route.constants.d.ts +12 -1
  261. package/dist/services/route.constants.d.ts.map +1 -1
  262. package/dist/services/route.constants.js +66 -15
  263. package/dist/services/route.constants.js.map +1 -1
  264. package/dist/services/route.lots.d.ts +18 -0
  265. package/dist/services/route.lots.d.ts.map +1 -0
  266. package/dist/services/route.lots.js +33 -0
  267. package/dist/services/route.lots.js.map +1 -0
  268. package/dist/services/route.service.d.ts +13 -4
  269. package/dist/services/route.service.d.ts.map +1 -1
  270. package/dist/services/route.service.js +95 -13
  271. package/dist/services/route.service.js.map +1 -1
  272. package/dist/services/route.types.d.ts +76 -0
  273. package/dist/services/route.types.d.ts.map +1 -0
  274. package/dist/services/route.types.js +8 -0
  275. package/dist/services/route.types.js.map +1 -0
  276. package/dist/services/route.utils.d.ts +19 -0
  277. package/dist/services/route.utils.d.ts.map +1 -1
  278. package/dist/services/route.utils.js +35 -0
  279. package/dist/services/route.utils.js.map +1 -1
  280. package/dist/services/trade-eviction.constants.d.ts +12 -0
  281. package/dist/services/trade-eviction.constants.d.ts.map +1 -0
  282. package/dist/services/trade-eviction.constants.js +25 -0
  283. package/dist/services/trade-eviction.constants.js.map +1 -0
  284. package/dist/services/trade-eviction.service.d.ts +22 -0
  285. package/dist/services/trade-eviction.service.d.ts.map +1 -0
  286. package/dist/services/trade-eviction.service.js +101 -0
  287. package/dist/services/trade-eviction.service.js.map +1 -0
  288. package/dist/services/trade-eviction.types.d.ts +30 -0
  289. package/dist/services/trade-eviction.types.d.ts.map +1 -0
  290. package/dist/services/trade-eviction.types.js +2 -0
  291. package/dist/services/trade-eviction.types.js.map +1 -0
  292. package/dist/services/trade-eviction.utils.d.ts +9 -0
  293. package/dist/services/trade-eviction.utils.d.ts.map +1 -0
  294. package/dist/services/trade-eviction.utils.js +38 -0
  295. package/dist/services/trade-eviction.utils.js.map +1 -0
  296. package/dist/services/trade-rules.service.d.ts +15 -0
  297. package/dist/services/trade-rules.service.d.ts.map +1 -0
  298. package/dist/services/trade-rules.service.js +45 -0
  299. package/dist/services/trade-rules.service.js.map +1 -0
  300. package/dist/services/trade.client.d.ts +11 -1
  301. package/dist/services/trade.client.d.ts.map +1 -1
  302. package/dist/services/trade.client.js +87 -0
  303. package/dist/services/trade.client.js.map +1 -1
  304. package/dist/services/trade.constants.d.ts +9 -0
  305. package/dist/services/trade.constants.d.ts.map +1 -0
  306. package/dist/services/trade.constants.js +28 -0
  307. package/dist/services/trade.constants.js.map +1 -0
  308. package/dist/services/trade.helpers.d.ts +9 -1
  309. package/dist/services/trade.helpers.d.ts.map +1 -1
  310. package/dist/services/trade.helpers.js +40 -27
  311. package/dist/services/trade.helpers.js.map +1 -1
  312. package/dist/services/transport-revert.utils.d.ts +3 -0
  313. package/dist/services/transport-revert.utils.d.ts.map +1 -0
  314. package/dist/services/transport-revert.utils.js +15 -0
  315. package/dist/services/transport-revert.utils.js.map +1 -0
  316. package/dist/services/transport.client.d.ts.map +1 -1
  317. package/dist/services/transport.client.js +14 -6
  318. package/dist/services/transport.client.js.map +1 -1
  319. package/dist/services/types.d.ts +249 -21
  320. package/dist/services/types.d.ts.map +1 -1
  321. package/dist/services/types.js +25 -0
  322. package/dist/services/types.js.map +1 -1
  323. package/dist/services/warehouse.utils.d.ts +8 -0
  324. package/dist/services/warehouse.utils.d.ts.map +1 -1
  325. package/dist/services/warehouse.utils.js +25 -0
  326. package/dist/services/warehouse.utils.js.map +1 -1
  327. package/dist/session/manager.d.ts +1 -0
  328. package/dist/session/manager.d.ts.map +1 -1
  329. package/dist/session/manager.js +13 -0
  330. package/dist/session/manager.js.map +1 -1
  331. package/dist/session/storage.d.ts +0 -3
  332. package/dist/session/storage.d.ts.map +1 -1
  333. package/dist/session/storage.js +6 -43
  334. package/dist/session/storage.js.map +1 -1
  335. package/dist/session/types.d.ts +4 -98
  336. package/dist/session/types.d.ts.map +1 -1
  337. package/dist/session/types.js +0 -15
  338. package/dist/session/types.js.map +1 -1
  339. package/dist/tools/authenticate.d.ts +1 -1
  340. package/dist/tools/authenticate.d.ts.map +1 -1
  341. package/dist/tools/authenticate.js +19 -45
  342. package/dist/tools/authenticate.js.map +1 -1
  343. package/dist/tools/config/get-game-config/constants.d.ts +3 -0
  344. package/dist/tools/config/get-game-config/constants.d.ts.map +1 -1
  345. package/dist/tools/config/get-game-config/constants.js +13 -2
  346. package/dist/tools/config/get-game-config/constants.js.map +1 -1
  347. package/dist/tools/config/get-game-config/get-game-config.d.ts.map +1 -1
  348. package/dist/tools/config/get-game-config/get-game-config.js +6 -3
  349. package/dist/tools/config/get-game-config/get-game-config.js.map +1 -1
  350. package/dist/tools/config/get-game-config/get-game-config.utils.d.ts +4 -4
  351. package/dist/tools/config/get-game-config/get-game-config.utils.d.ts.map +1 -1
  352. package/dist/tools/config/get-game-config/get-game-config.utils.js +26 -9
  353. package/dist/tools/config/get-game-config/get-game-config.utils.js.map +1 -1
  354. package/dist/tools/config/get-game-config/types.d.ts +6 -2
  355. package/dist/tools/config/get-game-config/types.d.ts.map +1 -1
  356. package/dist/tools/config/resource-lens/resource-lens.utils.d.ts.map +1 -1
  357. package/dist/tools/config/resource-lens/resource-lens.utils.js +5 -4
  358. package/dist/tools/config/resource-lens/resource-lens.utils.js.map +1 -1
  359. package/dist/tools/map/attention/attention.d.ts.map +1 -1
  360. package/dist/tools/map/attention/attention.js +16 -5
  361. package/dist/tools/map/attention/attention.js.map +1 -1
  362. package/dist/tools/map/attention/constants.d.ts +6 -0
  363. package/dist/tools/map/attention/constants.d.ts.map +1 -1
  364. package/dist/tools/map/attention/constants.js +16 -2
  365. package/dist/tools/map/attention/constants.js.map +1 -1
  366. package/dist/tools/map/attention/evicted.service.d.ts +19 -0
  367. package/dist/tools/map/attention/evicted.service.d.ts.map +1 -0
  368. package/dist/tools/map/attention/evicted.service.js +73 -0
  369. package/dist/tools/map/attention/evicted.service.js.map +1 -0
  370. package/dist/tools/map/attention/evicted.utils.d.ts +16 -0
  371. package/dist/tools/map/attention/evicted.utils.d.ts.map +1 -0
  372. package/dist/tools/map/attention/evicted.utils.js +72 -0
  373. package/dist/tools/map/attention/evicted.utils.js.map +1 -0
  374. package/dist/tools/map/attention/panel.utils.d.ts.map +1 -1
  375. package/dist/tools/map/attention/panel.utils.js +1 -0
  376. package/dist/tools/map/attention/panel.utils.js.map +1 -1
  377. package/dist/tools/map/attention/types.d.ts +17 -0
  378. package/dist/tools/map/attention/types.d.ts.map +1 -1
  379. package/dist/tools/map/attention/types.js.map +1 -1
  380. package/dist/tools/map/get-map/constants.d.ts.map +1 -1
  381. package/dist/tools/map/get-map/constants.js +4 -2
  382. package/dist/tools/map/get-map/constants.js.map +1 -1
  383. package/dist/tools/reveal/constants.d.ts.map +1 -1
  384. package/dist/tools/reveal/constants.js +3 -1
  385. package/dist/tools/reveal/constants.js.map +1 -1
  386. package/dist/tools/trade/buy-lot/buy-lot.d.ts.map +1 -1
  387. package/dist/tools/trade/buy-lot/buy-lot.js +2 -0
  388. package/dist/tools/trade/buy-lot/buy-lot.js.map +1 -1
  389. package/dist/tools/trade/buy-lot/constants.d.ts.map +1 -1
  390. package/dist/tools/trade/buy-lot/constants.js +2 -0
  391. package/dist/tools/trade/buy-lot/constants.js.map +1 -1
  392. package/dist/tools/trade/buyer-guard/constants.d.ts +4 -0
  393. package/dist/tools/trade/buyer-guard/constants.d.ts.map +1 -0
  394. package/dist/tools/trade/buyer-guard/constants.js +11 -0
  395. package/dist/tools/trade/buyer-guard/constants.js.map +1 -0
  396. package/dist/tools/trade/buyer-guard/lot-open.guard.d.ts +9 -0
  397. package/dist/tools/trade/buyer-guard/lot-open.guard.d.ts.map +1 -0
  398. package/dist/tools/trade/buyer-guard/lot-open.guard.js +15 -0
  399. package/dist/tools/trade/buyer-guard/lot-open.guard.js.map +1 -0
  400. package/dist/tools/trade/buyer-guard/types.d.ts +6 -0
  401. package/dist/tools/trade/buyer-guard/types.d.ts.map +1 -0
  402. package/dist/tools/trade/buyer-guard/types.js +2 -0
  403. package/dist/tools/trade/buyer-guard/types.js.map +1 -0
  404. package/dist/tools/trade/constants.d.ts +5 -0
  405. package/dist/tools/trade/constants.d.ts.map +1 -0
  406. package/dist/tools/trade/constants.js +14 -0
  407. package/dist/tools/trade/constants.js.map +1 -0
  408. package/dist/tools/trade/create-lot/constants.d.ts.map +1 -1
  409. package/dist/tools/trade/create-lot/constants.js +4 -1
  410. package/dist/tools/trade/create-lot/constants.js.map +1 -1
  411. package/dist/tools/trade/create-lot/create-lot.d.ts +2 -1
  412. package/dist/tools/trade/create-lot/create-lot.d.ts.map +1 -1
  413. package/dist/tools/trade/create-lot/create-lot.js +15 -1
  414. package/dist/tools/trade/create-lot/create-lot.js.map +1 -1
  415. package/dist/tools/trade/evict-lot/constants.d.ts +4 -0
  416. package/dist/tools/trade/evict-lot/constants.d.ts.map +1 -0
  417. package/dist/tools/trade/evict-lot/constants.js +13 -0
  418. package/dist/tools/trade/evict-lot/constants.js.map +1 -0
  419. package/dist/tools/trade/evict-lot/evict-lot.d.ts +6 -0
  420. package/dist/tools/trade/evict-lot/evict-lot.d.ts.map +1 -0
  421. package/dist/tools/trade/evict-lot/evict-lot.js +35 -0
  422. package/dist/tools/trade/evict-lot/evict-lot.js.map +1 -0
  423. package/dist/tools/trade/evict-lot/format.utils.d.ts +5 -0
  424. package/dist/tools/trade/evict-lot/format.utils.d.ts.map +1 -0
  425. package/dist/tools/trade/evict-lot/format.utils.js +10 -0
  426. package/dist/tools/trade/evict-lot/format.utils.js.map +1 -0
  427. package/dist/tools/trade/evict-lot/types.d.ts +5 -0
  428. package/dist/tools/trade/evict-lot/types.d.ts.map +1 -0
  429. package/dist/tools/trade/evict-lot/types.js +8 -0
  430. package/dist/tools/trade/evict-lot/types.js.map +1 -0
  431. package/dist/tools/trade/format.utils.d.ts +2 -4
  432. package/dist/tools/trade/format.utils.d.ts.map +1 -1
  433. package/dist/tools/trade/format.utils.js +11 -13
  434. package/dist/tools/trade/format.utils.js.map +1 -1
  435. package/dist/tools/trade/get-lot/constants.d.ts.map +1 -1
  436. package/dist/tools/trade/get-lot/constants.js +2 -1
  437. package/dist/tools/trade/get-lot/constants.js.map +1 -1
  438. package/dist/tools/trade/list-lots/constants.d.ts +2 -0
  439. package/dist/tools/trade/list-lots/constants.d.ts.map +1 -1
  440. package/dist/tools/trade/list-lots/constants.js +5 -1
  441. package/dist/tools/trade/list-lots/constants.js.map +1 -1
  442. package/dist/tools/trade/list-lots/list-lots.d.ts.map +1 -1
  443. package/dist/tools/trade/list-lots/list-lots.js +2 -1
  444. package/dist/tools/trade/list-lots/list-lots.js.map +1 -1
  445. package/dist/tools/trade/list-lots/list-lots.utils.d.ts +8 -0
  446. package/dist/tools/trade/list-lots/list-lots.utils.d.ts.map +1 -0
  447. package/dist/tools/trade/list-lots/list-lots.utils.js +10 -0
  448. package/dist/tools/trade/list-lots/list-lots.utils.js.map +1 -0
  449. package/dist/tools/trade/list-mine/constants.d.ts.map +1 -1
  450. package/dist/tools/trade/list-mine/constants.js +3 -1
  451. package/dist/tools/trade/list-mine/constants.js.map +1 -1
  452. package/dist/tools/trade/lot-terms/constants.d.ts +5 -0
  453. package/dist/tools/trade/lot-terms/constants.d.ts.map +1 -0
  454. package/dist/tools/trade/lot-terms/constants.js +13 -0
  455. package/dist/tools/trade/lot-terms/constants.js.map +1 -0
  456. package/dist/tools/trade/lot-terms/factory.d.ts +4 -0
  457. package/dist/tools/trade/lot-terms/factory.d.ts.map +1 -0
  458. package/dist/tools/trade/lot-terms/factory.js +14 -0
  459. package/dist/tools/trade/lot-terms/factory.js.map +1 -0
  460. package/dist/tools/trade/lot-terms/format.utils.d.ts +4 -0
  461. package/dist/tools/trade/lot-terms/format.utils.d.ts.map +1 -0
  462. package/dist/tools/trade/lot-terms/format.utils.js +30 -0
  463. package/dist/tools/trade/lot-terms/format.utils.js.map +1 -0
  464. package/dist/tools/trade/lot-terms/lot-terms.d.ts +5 -0
  465. package/dist/tools/trade/lot-terms/lot-terms.d.ts.map +1 -0
  466. package/dist/tools/trade/lot-terms/lot-terms.js +23 -0
  467. package/dist/tools/trade/lot-terms/lot-terms.js.map +1 -0
  468. package/dist/tools/trade/lot-terms/types.d.ts +6 -0
  469. package/dist/tools/trade/lot-terms/types.d.ts.map +1 -0
  470. package/dist/tools/trade/lot-terms/types.js +7 -0
  471. package/dist/tools/trade/lot-terms/types.js.map +1 -0
  472. package/dist/tools/trade/market-index/constants.d.ts.map +1 -1
  473. package/dist/tools/trade/market-index/constants.js +2 -0
  474. package/dist/tools/trade/market-index/constants.js.map +1 -1
  475. package/dist/tools/trade/markets/constants.d.ts.map +1 -1
  476. package/dist/tools/trade/markets/constants.js +2 -1
  477. package/dist/tools/trade/markets/constants.js.map +1 -1
  478. package/dist/tools/trade/quote-buy/constants.d.ts.map +1 -1
  479. package/dist/tools/trade/quote-buy/constants.js +4 -2
  480. package/dist/tools/trade/quote-buy/constants.js.map +1 -1
  481. package/dist/tools/trade/quote-buy/quote-buy.d.ts.map +1 -1
  482. package/dist/tools/trade/quote-buy/quote-buy.js +2 -0
  483. package/dist/tools/trade/quote-buy/quote-buy.js.map +1 -1
  484. package/dist/tools/trade/quote-lot-return/constants.d.ts +2 -0
  485. package/dist/tools/trade/quote-lot-return/constants.d.ts.map +1 -0
  486. package/dist/tools/trade/quote-lot-return/constants.js +11 -0
  487. package/dist/tools/trade/quote-lot-return/constants.js.map +1 -0
  488. package/dist/tools/trade/quote-lot-return/quote-lot-return.d.ts +5 -0
  489. package/dist/tools/trade/quote-lot-return/quote-lot-return.d.ts.map +1 -0
  490. package/dist/tools/trade/quote-lot-return/quote-lot-return.js +20 -0
  491. package/dist/tools/trade/quote-lot-return/quote-lot-return.js.map +1 -0
  492. package/dist/tools/trade/return-lot/constants.d.ts +5 -0
  493. package/dist/tools/trade/return-lot/constants.d.ts.map +1 -0
  494. package/dist/tools/trade/return-lot/constants.js +26 -0
  495. package/dist/tools/trade/return-lot/constants.js.map +1 -0
  496. package/dist/tools/trade/return-lot/factory.d.ts +4 -0
  497. package/dist/tools/trade/return-lot/factory.d.ts.map +1 -0
  498. package/dist/tools/trade/return-lot/factory.js +18 -0
  499. package/dist/tools/trade/return-lot/factory.js.map +1 -0
  500. package/dist/tools/trade/return-lot/format.utils.d.ts +5 -0
  501. package/dist/tools/trade/return-lot/format.utils.d.ts.map +1 -0
  502. package/dist/tools/trade/return-lot/format.utils.js +39 -0
  503. package/dist/tools/trade/return-lot/format.utils.js.map +1 -0
  504. package/dist/tools/trade/return-lot/return-lot.d.ts +5 -0
  505. package/dist/tools/trade/return-lot/return-lot.d.ts.map +1 -0
  506. package/dist/tools/trade/return-lot/return-lot.js +25 -0
  507. package/dist/tools/trade/return-lot/return-lot.js.map +1 -0
  508. package/dist/tools/trade/return-lot/types.d.ts +11 -0
  509. package/dist/tools/trade/return-lot/types.d.ts.map +1 -0
  510. package/dist/tools/trade/return-lot/types.js +21 -0
  511. package/dist/tools/trade/return-lot/types.js.map +1 -0
  512. package/dist/tools/trade/types.d.ts +0 -4
  513. package/dist/tools/trade/types.d.ts.map +1 -1
  514. package/dist/tools/trade/types.js +4 -12
  515. package/dist/tools/trade/types.js.map +1 -1
  516. package/dist/tools/transport/constants.d.ts.map +1 -1
  517. package/dist/tools/transport/constants.js +9 -0
  518. package/dist/tools/transport/constants.js.map +1 -1
  519. package/dist/tools/transport/network/constants.d.ts +2 -0
  520. package/dist/tools/transport/network/constants.d.ts.map +1 -1
  521. package/dist/tools/transport/network/constants.js +2 -0
  522. package/dist/tools/transport/network/constants.js.map +1 -1
  523. package/dist/tools/transport/network/panel.utils.d.ts +2 -2
  524. package/dist/tools/transport/network/panel.utils.d.ts.map +1 -1
  525. package/dist/tools/transport/network/panel.utils.js +20 -0
  526. package/dist/tools/transport/network/panel.utils.js.map +1 -1
  527. package/dist/tools/transport/network/route-network.d.ts.map +1 -1
  528. package/dist/tools/transport/network/route-network.js +1 -1
  529. package/dist/tools/transport/network/route-network.js.map +1 -1
  530. package/dist/tools/transport/next-hops/next-hops.d.ts.map +1 -1
  531. package/dist/tools/transport/next-hops/next-hops.js +13 -3
  532. package/dist/tools/transport/next-hops/next-hops.js.map +1 -1
  533. package/dist/tools/transport/quote/constants.d.ts.map +1 -1
  534. package/dist/tools/transport/quote/constants.js +5 -3
  535. package/dist/tools/transport/quote/constants.js.map +1 -1
  536. package/dist/tools/transport/types.d.ts +2 -0
  537. package/dist/tools/transport/types.d.ts.map +1 -1
  538. package/dist/tools/transport/types.js +16 -0
  539. package/dist/tools/transport/types.js.map +1 -1
  540. package/dist/tools/types.d.ts +7 -1
  541. package/dist/tools/types.d.ts.map +1 -1
  542. package/dist/tools/types.js +16 -1
  543. package/dist/tools/types.js.map +1 -1
  544. package/dist/types.d.ts +3 -1
  545. package/dist/types.d.ts.map +1 -1
  546. package/dist/types.js +1 -1
  547. package/dist/types.js.map +1 -1
  548. package/dist/utils/wei.constants.d.ts +6 -0
  549. package/dist/utils/wei.constants.d.ts.map +1 -0
  550. package/dist/utils/wei.constants.js +6 -0
  551. package/dist/utils/wei.constants.js.map +1 -0
  552. package/dist/wallet/index.d.ts.map +1 -1
  553. package/dist/wallet/index.js +2 -3
  554. package/dist/wallet/index.js.map +1 -1
  555. package/dist/wallet/types.d.ts +0 -9
  556. package/dist/wallet/types.d.ts.map +1 -1
  557. package/dist/wallet/types.js.map +1 -1
  558. package/package.json +2 -2
  559. package/dist/tools/trade/cancel-lot/cancel-lot.d.ts +0 -4
  560. package/dist/tools/trade/cancel-lot/cancel-lot.d.ts.map +0 -1
  561. package/dist/tools/trade/cancel-lot/cancel-lot.js +0 -20
  562. package/dist/tools/trade/cancel-lot/cancel-lot.js.map +0 -1
  563. package/dist/tools/trade/cancel-lot/constants.d.ts +0 -2
  564. package/dist/tools/trade/cancel-lot/constants.d.ts.map +0 -1
  565. package/dist/tools/trade/cancel-lot/constants.js +0 -8
  566. package/dist/tools/trade/cancel-lot/constants.js.map +0 -1
  567. package/dist/wallet/agw.manager.d.ts +0 -20
  568. package/dist/wallet/agw.manager.d.ts.map +0 -1
  569. package/dist/wallet/agw.manager.js +0 -90
  570. package/dist/wallet/agw.manager.js.map +0 -1
  571. package/dist/wallet/agw.provider.d.ts +0 -14
  572. package/dist/wallet/agw.provider.d.ts.map +0 -1
  573. package/dist/wallet/agw.provider.js +0 -48
  574. package/dist/wallet/agw.provider.js.map +0 -1
@@ -0,0 +1,410 @@
1
+ import { getAddress } from 'viem';
2
+ import { PAYBOX_SCHEMA_VERSION, PAYBOX_TOKEN_REFRESH_WINDOW_MS } from '../constants.js';
3
+ import { payboxRefreshState, withPayboxRefreshState } from './coordinator.utils.js';
4
+ import { PayboxAuthInvalidError, PayboxFullAccessWalletRequiredError, PayboxTemporarilyUnavailableError, PayboxWalletSelectionError, } from '../errors.js';
5
+ import { PayboxAuthStatus, PayboxErrorCode, PayboxRefreshFailureDisposition, PayboxRefreshState, PayboxResetCause, PayboxSelectionPhase, } from '../types.js';
6
+ export class PayboxAuthority {
7
+ options;
8
+ onInvalidated;
9
+ wallet = null;
10
+ walletGeneration = null;
11
+ address = null;
12
+ authenticating = null;
13
+ restoring = null;
14
+ continuing = null;
15
+ material = null;
16
+ selection = null;
17
+ credentialId = null;
18
+ refreshing = null;
19
+ refreshPersistenceError = null;
20
+ generation = 0;
21
+ constructor(options, onInvalidated) {
22
+ this.options = options;
23
+ this.onInvalidated = onInvalidated;
24
+ const stored = options.storage.load();
25
+ if (stored?.tokens === null || stored?.signingKey === null || stored === null)
26
+ return;
27
+ if (payboxRefreshState(stored) === PayboxRefreshState.ExchangePending) {
28
+ this.refreshPersistenceError = new PayboxTemporarilyUnavailableError(null, PayboxRefreshFailureDisposition.Ambiguous);
29
+ }
30
+ this.material = { tokens: stored.tokens, signingKey: stored.signingKey };
31
+ if (stored.credentialId === null || stored.address === null)
32
+ return;
33
+ this.credentialId = stored.credentialId;
34
+ this.address = stored.address;
35
+ this.wallet = this.createWallet(this.material, stored.credentialId, stored.address, this.generation);
36
+ this.walletGeneration = this.generation;
37
+ }
38
+ isReady() {
39
+ return this.wallet !== null && this.walletGeneration === this.generation;
40
+ }
41
+ get() {
42
+ if (!this.isReady() || this.wallet === null) {
43
+ throw new Error('Paybox wallet is not authenticated. Call cpu_authenticate first.');
44
+ }
45
+ return this.wallet;
46
+ }
47
+ hasMaterial() {
48
+ return this.material !== null;
49
+ }
50
+ async authenticate(material, requestedCredentialId) {
51
+ if (material !== null) {
52
+ return this.continueAuthentication(material, requestedCredentialId, this.generation);
53
+ }
54
+ if (this.isReady())
55
+ return this.authenticateReadyWallet(requestedCredentialId);
56
+ const generation = await this.refreshIfExpiring();
57
+ if (this.material === null)
58
+ throw new Error('Paybox auth material is unavailable.');
59
+ return this.continueAuthentication(this.material, requestedCredentialId, generation);
60
+ }
61
+ reset() {
62
+ const authentication = this.authenticating;
63
+ this.generation += 1;
64
+ this.wallet = null;
65
+ this.walletGeneration = null;
66
+ this.address = null;
67
+ this.authenticating = null;
68
+ this.restoring = null;
69
+ this.continuing = null;
70
+ this.material = null;
71
+ this.selection = null;
72
+ this.credentialId = null;
73
+ this.refreshing = null;
74
+ this.refreshPersistenceError = null;
75
+ authentication?.controller.abort(new Error('Paybox authentication was invalidated.'));
76
+ let resetError = null;
77
+ for (const clear of [() => this.options.storage.clear(), () => this.options.authenticator.clearSession()]) {
78
+ try {
79
+ clear();
80
+ }
81
+ catch (error) {
82
+ resetError ??= error instanceof Error ? error : new Error('Paybox authentication reset failed.');
83
+ }
84
+ }
85
+ if (resetError !== null)
86
+ throw resetError;
87
+ }
88
+ async authenticateReadyWallet(requestedCredentialId) {
89
+ this.assertNoWalletSelection(requestedCredentialId);
90
+ if (this.wallet === null || this.address === null || this.credentialId === null) {
91
+ throw new Error('Paybox Wallet identity is incomplete.');
92
+ }
93
+ const generation = await this.refreshIfExpiring();
94
+ if (!this.isReady() || this.wallet === null || this.material === null) {
95
+ throw new Error('Paybox Wallet restoration failed.');
96
+ }
97
+ return this.authenticateRestored(this.wallet, this.material, generation, this.credentialId, this.address);
98
+ }
99
+ assertNoWalletSelection(requestedCredentialId) {
100
+ if (requestedCredentialId !== null) {
101
+ throw new PayboxWalletSelectionError(PayboxErrorCode.WalletSelectionNotPending);
102
+ }
103
+ }
104
+ authenticateRestored(wallet, material, generation, credentialId, address) {
105
+ if (this.restoring !== null) {
106
+ if (this.restoring.generation === generation &&
107
+ this.restoring.credentialId === credentialId &&
108
+ this.restoring.address === address) {
109
+ return this.restoring.promise;
110
+ }
111
+ throw new Error('Paybox authentication is already in progress for another Wallet.');
112
+ }
113
+ const authentication = this.runRestoredAuthentication(wallet, material, generation, credentialId, address);
114
+ this.restoring = { credentialId, address, generation, promise: authentication };
115
+ return authentication;
116
+ }
117
+ async runRestoredAuthentication(wallet, material, generation, credentialId, address) {
118
+ try {
119
+ const discovery = await this.options.sdk.listEligibleAutonomousEvmGrants(material.tokens, material.signingKey);
120
+ this.assertCurrent(generation);
121
+ const selected = discovery.grants.find((grant) => grant.credentialId === credentialId);
122
+ if (selected === undefined || getAddress(selected.address) !== address) {
123
+ throw new PayboxAuthInvalidError('The selected Paybox Wallet grant is no longer valid.', PayboxResetCause.SelectedGrantMissing);
124
+ }
125
+ await this.authenticateFresh(wallet, generation, credentialId, address);
126
+ this.assertCurrent(generation);
127
+ return { status: PayboxAuthStatus.Authenticated, address };
128
+ }
129
+ finally {
130
+ if (this.restoring?.generation === generation &&
131
+ this.restoring.credentialId === credentialId &&
132
+ this.restoring.address === address) {
133
+ this.restoring = null;
134
+ }
135
+ }
136
+ }
137
+ continueAuthentication(material, requestedCredentialId, generation) {
138
+ if (this.continuing !== null) {
139
+ if (this.continuing.generation !== generation || this.continuing.material !== material) {
140
+ throw new Error('Paybox authentication is already in progress for another auth state.');
141
+ }
142
+ if (this.continuing.requestedCredentialId === requestedCredentialId ||
143
+ (requestedCredentialId === null && this.continuing.requestedCredentialId !== null)) {
144
+ return this.continuing.promise;
145
+ }
146
+ throw new PayboxWalletSelectionError(PayboxErrorCode.WalletSelectionNotPending);
147
+ }
148
+ const continuation = this.runContinuation(material, requestedCredentialId, generation);
149
+ this.continuing = { material, requestedCredentialId, generation, promise: continuation };
150
+ return continuation;
151
+ }
152
+ async runContinuation(material, requestedCredentialId, generation) {
153
+ try {
154
+ return await this.continueWithMaterial(material, requestedCredentialId, generation);
155
+ }
156
+ finally {
157
+ if (this.continuing?.generation === generation &&
158
+ this.continuing.material === material &&
159
+ this.continuing.requestedCredentialId === requestedCredentialId) {
160
+ this.continuing = null;
161
+ }
162
+ }
163
+ }
164
+ async continueWithMaterial(material, requestedCredentialId, generation) {
165
+ if (this.selection?.phase === PayboxSelectionPhase.Activating) {
166
+ if (requestedCredentialId === null || this.selection.credentialId === requestedCredentialId) {
167
+ return this.selection.promise;
168
+ }
169
+ throw new PayboxWalletSelectionError(PayboxErrorCode.WalletSelectionNotPending);
170
+ }
171
+ if (this.selection?.phase === PayboxSelectionPhase.AwaitingChoice) {
172
+ if (requestedCredentialId === null) {
173
+ return { status: PayboxAuthStatus.WalletSelectionRequired, choices: this.selection.choices };
174
+ }
175
+ const choices = this.selection.choices;
176
+ const activation = this.selectGrant(material, requestedCredentialId, choices, generation);
177
+ this.selection = {
178
+ phase: PayboxSelectionPhase.Activating,
179
+ choices,
180
+ credentialId: requestedCredentialId,
181
+ promise: activation,
182
+ };
183
+ return activation;
184
+ }
185
+ if (requestedCredentialId !== null) {
186
+ throw new PayboxWalletSelectionError(PayboxErrorCode.WalletSelectionNotPending);
187
+ }
188
+ const discovery = await this.options.sdk.listEligibleAutonomousEvmGrants(material.tokens, material.signingKey);
189
+ this.assertCurrent(generation);
190
+ if (discovery.grants.length === 0) {
191
+ this.rememberMaterial(material);
192
+ throw new PayboxFullAccessWalletRequiredError(discovery.managementUrl);
193
+ }
194
+ if (discovery.grants.length > 1) {
195
+ this.rememberMaterial(material);
196
+ this.selection = { phase: PayboxSelectionPhase.AwaitingChoice, choices: discovery.grants };
197
+ return { status: PayboxAuthStatus.WalletSelectionRequired, choices: discovery.grants };
198
+ }
199
+ return this.activateGrant(material, discovery.grants[0], generation);
200
+ }
201
+ async selectGrant(material, requestedCredentialId, previousChoices, generation) {
202
+ let discovery;
203
+ try {
204
+ discovery = await this.options.sdk.listEligibleAutonomousEvmGrants(material.tokens, material.signingKey);
205
+ this.assertCurrent(generation);
206
+ }
207
+ catch (error) {
208
+ this.restoreSelection(requestedCredentialId, previousChoices, generation);
209
+ throw error;
210
+ }
211
+ const selected = discovery.grants.find((grant) => grant.credentialId === requestedCredentialId);
212
+ if (selected === undefined) {
213
+ if (this.isSelectionActivation(requestedCredentialId, generation)) {
214
+ this.selection =
215
+ discovery.grants.length === 0
216
+ ? null
217
+ : { phase: PayboxSelectionPhase.AwaitingChoice, choices: discovery.grants };
218
+ }
219
+ throw new PayboxWalletSelectionError(PayboxErrorCode.WalletSelectionInvalid);
220
+ }
221
+ try {
222
+ return await this.activateGrant(material, selected, generation);
223
+ }
224
+ catch (error) {
225
+ this.restoreSelection(requestedCredentialId, discovery.grants, generation);
226
+ throw error;
227
+ }
228
+ }
229
+ async activateGrant(material, grant, generation) {
230
+ const address = getAddress(grant.address);
231
+ const wallet = this.createWallet(material, grant.credentialId, address, generation);
232
+ await this.authenticateFresh(wallet, generation, grant.credentialId, address);
233
+ this.assertCurrent(generation);
234
+ this.options.storage.save({
235
+ version: PAYBOX_SCHEMA_VERSION,
236
+ tokens: material.tokens,
237
+ signingKey: material.signingKey,
238
+ credentialId: grant.credentialId,
239
+ address,
240
+ });
241
+ this.wallet = wallet;
242
+ this.walletGeneration = generation;
243
+ this.address = address;
244
+ this.credentialId = grant.credentialId;
245
+ this.material = material;
246
+ this.selection = null;
247
+ return { status: PayboxAuthStatus.Authenticated, address };
248
+ }
249
+ rememberMaterial(material) {
250
+ this.options.storage.save({
251
+ version: PAYBOX_SCHEMA_VERSION,
252
+ tokens: material.tokens,
253
+ signingKey: material.signingKey,
254
+ credentialId: null,
255
+ address: null,
256
+ });
257
+ this.material = material;
258
+ }
259
+ async refreshIfExpiring() {
260
+ if (this.refreshPersistenceError !== null)
261
+ throw this.refreshPersistenceError;
262
+ const material = this.material;
263
+ if (material === null ||
264
+ material.tokens.expiresAt === null ||
265
+ material.tokens.expiresAt > Date.now() + PAYBOX_TOKEN_REFRESH_WINDOW_MS) {
266
+ return this.generation;
267
+ }
268
+ if (this.refreshing !== null) {
269
+ await this.refreshing.promise;
270
+ return this.generation;
271
+ }
272
+ const generation = this.generation;
273
+ const refresh = this.rotateTokens(material, generation);
274
+ const flight = { generation, promise: refresh };
275
+ this.refreshing = flight;
276
+ try {
277
+ await refresh;
278
+ }
279
+ finally {
280
+ if (this.refreshing === flight)
281
+ this.refreshing = null;
282
+ }
283
+ return this.generation;
284
+ }
285
+ async rotateTokens(material, generation) {
286
+ if (material.tokens.refreshToken === null) {
287
+ throw new PayboxAuthInvalidError('Paybox OAuth refresh token is unavailable.', PayboxResetCause.InvalidRefresh);
288
+ }
289
+ const currentRecord = this.record(material);
290
+ this.options.storage.save(withPayboxRefreshState(currentRecord, PayboxRefreshState.ExchangePending));
291
+ let tokens;
292
+ try {
293
+ tokens = await this.options.sdk.refreshTokens(material.tokens);
294
+ }
295
+ catch (error) {
296
+ const refreshError = error instanceof Error ? error : new Error('Paybox OAuth tokens could not be refreshed safely.');
297
+ if (this.generation === generation)
298
+ this.recoverRefreshFailure(currentRecord, refreshError);
299
+ throw refreshError;
300
+ }
301
+ this.assertCurrent(generation);
302
+ const refreshed = { tokens, signingKey: material.signingKey };
303
+ try {
304
+ this.options.storage.save(this.record(refreshed));
305
+ }
306
+ catch (error) {
307
+ this.refreshPersistenceError =
308
+ error instanceof Error ? error : new Error('Rotated Paybox OAuth tokens could not be persisted.');
309
+ throw this.refreshPersistenceError;
310
+ }
311
+ this.assertCurrent(generation);
312
+ this.material = refreshed;
313
+ }
314
+ recoverRefreshFailure(currentRecord, refreshError) {
315
+ if (!(refreshError instanceof PayboxTemporarilyUnavailableError)) {
316
+ this.refreshPersistenceError = refreshError;
317
+ return;
318
+ }
319
+ try {
320
+ this.options.storage.save(withPayboxRefreshState(currentRecord, PayboxRefreshState.Ready));
321
+ this.refreshPersistenceError = null;
322
+ }
323
+ catch (error) {
324
+ this.refreshPersistenceError =
325
+ error instanceof Error ? error : new Error('Paybox refresh recovery could not be persisted.');
326
+ throw this.refreshPersistenceError;
327
+ }
328
+ }
329
+ record(material) {
330
+ return {
331
+ version: PAYBOX_SCHEMA_VERSION,
332
+ tokens: material.tokens,
333
+ signingKey: material.signingKey,
334
+ credentialId: this.credentialId,
335
+ address: this.address,
336
+ };
337
+ }
338
+ createWallet(material, credentialId, address, generation) {
339
+ return this.options.sdk.createWallet(material.tokens, material.signingKey, credentialId, address, this.walletAuthority(material, credentialId, address, generation));
340
+ }
341
+ walletAuthority(candidate, credentialId, address, generation) {
342
+ let authorityGeneration = generation;
343
+ return {
344
+ current: async () => {
345
+ this.assertCurrent(authorityGeneration);
346
+ if (this.credentialId === credentialId && this.address === address) {
347
+ await this.refreshIfExpiring();
348
+ if (this.credentialId !== credentialId || this.address !== address || this.material === null) {
349
+ throw new Error('Paybox Wallet authority was invalidated.');
350
+ }
351
+ authorityGeneration = this.generation;
352
+ return this.material;
353
+ }
354
+ return candidate;
355
+ },
356
+ invalidate: () => {
357
+ if (this.generation !== authorityGeneration)
358
+ return;
359
+ try {
360
+ this.reset();
361
+ }
362
+ finally {
363
+ this.onInvalidated();
364
+ }
365
+ },
366
+ };
367
+ }
368
+ async authenticateFresh(wallet, generation, credentialId, address) {
369
+ if (this.authenticating !== null) {
370
+ if (this.authenticating.generation === generation &&
371
+ this.authenticating.credentialId === credentialId &&
372
+ this.authenticating.address === address) {
373
+ return this.authenticating.promise;
374
+ }
375
+ throw new Error('Paybox authentication is already in progress for another Wallet.');
376
+ }
377
+ const controller = new AbortController();
378
+ const authentication = this.options.authenticator.authenticate(wallet, controller.signal);
379
+ const flight = {
380
+ credentialId,
381
+ address,
382
+ generation,
383
+ controller,
384
+ promise: authentication,
385
+ };
386
+ this.authenticating = flight;
387
+ try {
388
+ return await authentication;
389
+ }
390
+ finally {
391
+ if (this.authenticating === flight)
392
+ this.authenticating = null;
393
+ }
394
+ }
395
+ restoreSelection(requestedCredentialId, choices, generation) {
396
+ if (this.isSelectionActivation(requestedCredentialId, generation)) {
397
+ this.selection = { phase: PayboxSelectionPhase.AwaitingChoice, choices };
398
+ }
399
+ }
400
+ isSelectionActivation(requestedCredentialId, generation) {
401
+ return (this.generation === generation &&
402
+ this.selection?.phase === PayboxSelectionPhase.Activating &&
403
+ this.selection.credentialId === requestedCredentialId);
404
+ }
405
+ assertCurrent(generation) {
406
+ if (this.generation !== generation)
407
+ throw new Error('Paybox authentication was invalidated.');
408
+ }
409
+ }
410
+ //# sourceMappingURL=authority.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authority.js","sourceRoot":"","sources":["../../../src/paybox/auth/authority.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAgB,MAAM,MAAM,CAAC;AAEhD,OAAO,EAAE,qBAAqB,EAAE,8BAA8B,EAAE,MAAM,iBAAiB,CAAC;AACxF,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAGpF,OAAO,EACH,sBAAsB,EACtB,mCAAmC,EACnC,iCAAiC,EACjC,0BAA0B,GAC7B,MAAM,cAAc,CAAC;AACtB,OAAO,EACH,gBAAgB,EAChB,eAAe,EACf,+BAA+B,EAC/B,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,GAWvB,MAAM,aAAa,CAAC;AAErB,MAAM,OAAO,eAAe;IAeH;IACA;IAfb,MAAM,GAAyB,IAAI,CAAC;IACpC,gBAAgB,GAAkB,IAAI,CAAC;IACvC,OAAO,GAAmB,IAAI,CAAC;IAC/B,cAAc,GAAsC,IAAI,CAAC;IACzD,SAAS,GAA8C,IAAI,CAAC;IAC5D,UAAU,GAAoC,IAAI,CAAC;IACnD,QAAQ,GAA8B,IAAI,CAAC;IAC3C,SAAS,GAAgC,IAAI,CAAC;IAC9C,YAAY,GAAkB,IAAI,CAAC;IACnC,UAAU,GAA+B,IAAI,CA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,EAAE,OAAO,EAAE,CAAC;QAC7E,CAAC;IACL,CAAC;IAEO,qBAAqB,CAAC,qBAA6B,EAAE,UAAkB;QAC3E,OAAO,CACH,IAAI,CAAC,UAAU,KAAK,UAAU;YAC9B,IAAI,CAAC,SAAS,EAAE,KAAK,KAAK,oBAAoB,CAAC,UAAU;YACzD,IAAI,CAAC,SAAS,CAAC,YAAY,KAAK,qBAAqB,CACxD,CAAC;IACN,CAAC;IAEO,aAAa,CAAC,UAAkB;QACpC,IAAI,IAAI,CAAC,UAAU,KAAK,UAAU;YAAE,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAClG,CAAC;CACJ"}
@@ -0,0 +1,8 @@
1
+ import type { IPayboxBrowserOpener, PayboxBrowserSpawn } from '../types.js';
2
+ export declare class SystemBrowserOpener implements IPayboxBrowserOpener {
3
+ private readonly platform;
4
+ private readonly spawnProcess;
5
+ constructor(platform?: NodeJS.Platform, spawnProcess?: PayboxBrowserSpawn);
6
+ open(url: string): void;
7
+ }
8
+ //# sourceMappingURL=browser-opener.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-opener.d.ts","sourceRoot":"","sources":["../../../src/paybox/auth/browser-opener.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAE5E,qBAAa,mBAAoB,YAAW,oBAAoB;IAExD,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,YAAY;gBADZ,QAAQ,GAAE,MAAM,CAAC,QAA2B,EAC5C,YAAY,GAAE,kBAA0B;IAGtD,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;CAUjC"}
@@ -0,0 +1,22 @@
1
+ import { spawn } from 'node:child_process';
2
+ import { browserLaunchCommand } from './browser-opener.utils.js';
3
+ export class SystemBrowserOpener {
4
+ platform;
5
+ spawnProcess;
6
+ constructor(platform = process.platform, spawnProcess = spawn) {
7
+ this.platform = platform;
8
+ this.spawnProcess = spawnProcess;
9
+ }
10
+ open(url) {
11
+ const [command, args] = browserLaunchCommand(url, this.platform);
12
+ try {
13
+ const child = this.spawnProcess(command, args, { stdio: 'ignore', detached: true });
14
+ child.once('error', () => undefined);
15
+ child.unref();
16
+ }
17
+ catch {
18
+ // The authorization URL returned to the caller remains the headless fallback.
19
+ }
20
+ }
21
+ }
22
+ //# sourceMappingURL=browser-opener.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-opener.js","sourceRoot":"","sources":["../../../src/paybox/auth/browser-opener.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAGjE,MAAM,OAAO,mBAAmB;IAEP;IACA;IAFrB,YACqB,WAA4B,OAAO,CAAC,QAAQ,EAC5C,eAAmC,KAAK;QADxC,aAAQ,GAAR,QAAQ,CAAoC;QAC5C,iBAAY,GAAZ,YAAY,CAA4B;IAC1D,CAAC;IAEG,IAAI,CAAC,GAAW;QACnB,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,oBAAoB,CAAC,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QACjE,IAAI,CAAC;YACD,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;YACpF,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;YACrC,KAAK,CAAC,KAAK,EAAE,CAAC;QAClB,CAAC;QAAC,MAAM,CAAC;YACL,8EAA8E;QAClF,CAAC;IACL,CAAC;CACJ"}
@@ -0,0 +1,2 @@
1
+ export declare function browserLaunchCommand(url: string, platform: NodeJS.Platform): readonly [string, ReadonlyArray<string>];
2
+ //# sourceMappingURL=browser-opener.utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-opener.utils.d.ts","sourceRoot":"","sources":["../../../src/paybox/auth/browser-opener.utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,GAAG,SAAS,CAAC,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,CAQrH"}
@@ -0,0 +1,10 @@
1
+ export function browserLaunchCommand(url, platform) {
2
+ if (platform === 'darwin') {
3
+ return ['open', [url]];
4
+ }
5
+ if (platform === 'win32') {
6
+ return ['rundll32', ['url.dll,FileProtocolHandler', url]];
7
+ }
8
+ return ['xdg-open', [url]];
9
+ }
10
+ //# sourceMappingURL=browser-opener.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-opener.utils.js","sourceRoot":"","sources":["../../../src/paybox/auth/browser-opener.utils.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,oBAAoB,CAAC,GAAW,EAAE,QAAyB;IACvE,IAAI,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACxB,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3B,CAAC;IACD,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;QACvB,OAAO,CAAC,UAAU,EAAE,CAAC,6BAA6B,EAAE,GAAG,CAAC,CAAC,CAAC;IAC9D,CAAC;IACD,OAAO,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/B,CAAC"}
@@ -0,0 +1,16 @@
1
+ export declare const OAUTH_DISCOVERY_PATH = "/.well-known/oauth-authorization-server";
2
+ export declare const OAUTH_SCOPE = "mcp offline_access";
3
+ export declare const PAYBOX_OAUTH_CLIENT_NAME = "Project CPU MCP";
4
+ export declare const OAUTH_CONFIRMED_AUTH_HTTP_STATUSES: Set<number>;
5
+ export declare const LOOPBACK_HOST = "127.0.0.1";
6
+ export declare const LOOPBACK_CALLBACK_PREFIX = "/oauth/callback/";
7
+ export declare const LOOPBACK_KEY_PREFIX = "/oauth/key/";
8
+ export declare const PAYBOX_AGENT_KEY_PATH = "/agent-key";
9
+ export declare const DEFAULT_LOOPBACK_TIMEOUT_MS: number;
10
+ export declare const KEY_BODY_LIMIT_BYTES = 4096;
11
+ export declare const HTML_HEADERS: {
12
+ 'cache-control': string;
13
+ 'content-security-policy': string;
14
+ 'content-type': string;
15
+ };
16
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/paybox/auth/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,4CAA4C,CAAC;AAC9E,eAAO,MAAM,WAAW,uBAAuB,CAAC;AAChD,eAAO,MAAM,wBAAwB,oBAAoB,CAAC;AAC1D,eAAO,MAAM,kCAAkC,aAA2B,CAAC;AAC3E,eAAO,MAAM,aAAa,cAAc,CAAC;AACzC,eAAO,MAAM,wBAAwB,qBAAqB,CAAC;AAC3D,eAAO,MAAM,mBAAmB,gBAAgB,CAAC;AACjD,eAAO,MAAM,qBAAqB,eAAe,CAAC;AAClD,eAAO,MAAM,2BAA2B,QAAgB,CAAC;AACzD,eAAO,MAAM,oBAAoB,OAAO,CAAC;AACzC,eAAO,MAAM,YAAY;;;;CAKxB,CAAC"}
@@ -0,0 +1,16 @@
1
+ export const OAUTH_DISCOVERY_PATH = '/.well-known/oauth-authorization-server';
2
+ export const OAUTH_SCOPE = 'mcp offline_access';
3
+ export const PAYBOX_OAUTH_CLIENT_NAME = 'Project CPU MCP';
4
+ export const OAUTH_CONFIRMED_AUTH_HTTP_STATUSES = new Set([400, 401, 403]);
5
+ export const LOOPBACK_HOST = '127.0.0.1';
6
+ export const LOOPBACK_CALLBACK_PREFIX = '/oauth/callback/';
7
+ export const LOOPBACK_KEY_PREFIX = '/oauth/key/';
8
+ export const PAYBOX_AGENT_KEY_PATH = '/agent-key';
9
+ export const DEFAULT_LOOPBACK_TIMEOUT_MS = 5 * 60 * 1000;
10
+ export const KEY_BODY_LIMIT_BYTES = 4096;
11
+ export const HTML_HEADERS = {
12
+ 'cache-control': 'no-store',
13
+ 'content-security-policy': "default-src 'none'; style-src 'unsafe-inline'; font-src data:; form-action 'self'; base-uri 'none'",
14
+ 'content-type': 'text/html; charset=utf-8',
15
+ };
16
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/paybox/auth/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAG,yCAAyC,CAAC;AAC9E,MAAM,CAAC,MAAM,WAAW,GAAG,oBAAoB,CAAC;AAChD,MAAM,CAAC,MAAM,wBAAwB,GAAG,iBAAiB,CAAC;AAC1D,MAAM,CAAC,MAAM,kCAAkC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AAC3E,MAAM,CAAC,MAAM,aAAa,GAAG,WAAW,CAAC;AACzC,MAAM,CAAC,MAAM,wBAAwB,GAAG,kBAAkB,CAAC;AAC3D,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAAC;AACjD,MAAM,CAAC,MAAM,qBAAqB,GAAG,YAAY,CAAC;AAClD,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AACzD,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAC;AACzC,MAAM,CAAC,MAAM,YAAY,GAAG;IACxB,eAAe,EAAE,UAAU;IAC3B,yBAAyB,EACrB,oGAAoG;IACxG,cAAc,EAAE,0BAA0B;CAC7C,CAAC"}
@@ -0,0 +1,21 @@
1
+ import type { ILogger } from '../../logger/types.js';
2
+ import type { WalletManager, WalletProvider } from '../../wallet/types.js';
3
+ import { type PayboxAuthenticateInput, type PayboxAuthenticateResult, type PayboxCoordinatorOptions } from '../types.js';
4
+ /** The sole lifecycle owner: auth transport returns material, this module decides persistence and selection. */
5
+ export declare class PayboxCoordinator implements WalletProvider {
6
+ private readonly logger;
7
+ private readonly authFlow;
8
+ private readonly authority;
9
+ private forcing;
10
+ constructor(options: PayboxCoordinatorOptions, logger?: ILogger);
11
+ isReady(): boolean;
12
+ get(): WalletManager;
13
+ authenticate(input: PayboxAuthenticateInput): Promise<PayboxAuthenticateResult>;
14
+ private runForcedAuthentication;
15
+ private authenticateForced;
16
+ private authenticateWithRecovery;
17
+ private advanceAuthentication;
18
+ private pollAuthFlow;
19
+ private resetAuthState;
20
+ }
21
+ //# sourceMappingURL=coordinator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coordinator.d.ts","sourceRoot":"","sources":["../../../src/paybox/auth/coordinator.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAO3E,OAAO,EAGH,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAChC,MAAM,aAAa,CAAC;AAErB,gHAAgH;AAChH,qBAAa,iBAAkB,YAAW,cAAc;IAOhD,OAAO,CAAC,QAAQ,CAAC,MAAM;IAN3B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAwB;IACjD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAkB;IAC5C,OAAO,CAAC,OAAO,CAAkD;gBAG7D,OAAO,EAAE,wBAAwB,EAChB,MAAM,GAAE,OAA0B;IASvD,OAAO,IAAI,OAAO;IAIlB,GAAG,IAAI,aAAa;IAIpB,YAAY,CAAC,KAAK,EAAE,uBAAuB,GAAG,OAAO,CAAC,wBAAwB,CAAC;YAQjE,uBAAuB;YAQvB,kBAAkB;YAKlB,wBAAwB;IAgBtC,OAAO,CAAC,qBAAqB;YAMf,YAAY;IAa1B,OAAO,CAAC,cAAc;CAIzB"}
@@ -0,0 +1,5 @@
1
+ import { PayboxCoordinator } from './coordinator.js';
2
+ import type { ILogger } from '../../logger/types.js';
3
+ import type { PayboxCoordinatorOptions } from '../types.js';
4
+ export declare function createPayboxCoordinator(options: PayboxCoordinatorOptions, logger: ILogger): PayboxCoordinator;
5
+ //# sourceMappingURL=coordinator.factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coordinator.factory.d.ts","sourceRoot":"","sources":["../../../src/paybox/auth/coordinator.factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAE5D,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,wBAAwB,EAAE,MAAM,EAAE,OAAO,GAAG,iBAAiB,CAE7G"}
@@ -0,0 +1,5 @@
1
+ import { PayboxCoordinator } from './coordinator.js';
2
+ export function createPayboxCoordinator(options, logger) {
3
+ return new PayboxCoordinator(options, logger.child('paybox:coordinator'));
4
+ }
5
+ //# sourceMappingURL=coordinator.factory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coordinator.factory.js","sourceRoot":"","sources":["../../../src/paybox/auth/coordinator.factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAIrD,MAAM,UAAU,uBAAuB,CAAC,OAAiC,EAAE,MAAe;IACtF,OAAO,IAAI,iBAAiB,CAAC,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC,CAAC;AAC9E,CAAC"}