@cranberry-money/shared-services 1.12.1 → 3.0.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 (450) hide show
  1. package/CHANGELOG.md +240 -0
  2. package/README.md +464 -190
  3. package/dist/api/functional-client.d.ts +66 -0
  4. package/dist/api/functional-client.d.ts.map +1 -0
  5. package/dist/api/functional-client.js +165 -0
  6. package/dist/auth/functional/auth-operations.d.ts +116 -0
  7. package/dist/auth/functional/auth-operations.d.ts.map +1 -0
  8. package/dist/auth/functional/auth-operations.js +246 -0
  9. package/dist/auth/functional/auth-state.d.ts +38 -0
  10. package/dist/auth/functional/auth-state.d.ts.map +1 -0
  11. package/dist/auth/functional/auth-state.js +87 -0
  12. package/dist/auth/functional/token-storage.d.ts +44 -0
  13. package/dist/auth/functional/token-storage.d.ts.map +1 -0
  14. package/dist/auth/functional/token-storage.js +178 -0
  15. package/dist/auth/react/AuthProvider.d.ts +92 -0
  16. package/dist/auth/react/AuthProvider.d.ts.map +1 -0
  17. package/dist/auth/react/AuthProvider.js +207 -0
  18. package/dist/index.d.ts +25 -34
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +114 -40
  21. package/dist/integration/blueberry-integration.d.ts +21 -0
  22. package/dist/integration/blueberry-integration.d.ts.map +1 -0
  23. package/dist/integration/blueberry-integration.js +109 -0
  24. package/dist/integration/index.d.ts +8 -0
  25. package/dist/integration/index.d.ts.map +1 -0
  26. package/dist/integration/index.js +18 -0
  27. package/dist/services/accounts.d.ts +220 -0
  28. package/dist/services/accounts.d.ts.map +1 -0
  29. package/dist/services/accounts.js +175 -0
  30. package/dist/services/banks.d.ts +123 -0
  31. package/dist/services/banks.d.ts.map +1 -0
  32. package/dist/services/banks.js +151 -0
  33. package/dist/services/cash-accounts.d.ts +112 -0
  34. package/dist/services/cash-accounts.d.ts.map +1 -0
  35. package/dist/services/cash-accounts.js +222 -0
  36. package/dist/services/documents.d.ts +143 -0
  37. package/dist/services/documents.d.ts.map +1 -0
  38. package/dist/services/documents.js +253 -0
  39. package/dist/services/factories/account-factory.d.ts +16 -0
  40. package/dist/services/factories/account-factory.d.ts.map +1 -0
  41. package/dist/services/factories/account-factory.js +79 -0
  42. package/dist/services/factories/auth-factory.d.ts +23 -0
  43. package/dist/services/factories/auth-factory.d.ts.map +1 -0
  44. package/dist/services/factories/auth-factory.js +75 -0
  45. package/dist/services/factories/bank-factory.d.ts +16 -0
  46. package/dist/services/factories/bank-factory.d.ts.map +1 -0
  47. package/dist/services/factories/bank-factory.js +72 -0
  48. package/dist/services/factories/cash-account-factory.d.ts +16 -0
  49. package/dist/services/factories/cash-account-factory.d.ts.map +1 -0
  50. package/dist/services/factories/cash-account-factory.js +74 -0
  51. package/dist/services/factories/document-factory.d.ts +16 -0
  52. package/dist/services/factories/document-factory.d.ts.map +1 -0
  53. package/dist/services/factories/document-factory.js +85 -0
  54. package/dist/services/factories/index.d.ts +21 -0
  55. package/dist/services/factories/index.d.ts.map +1 -0
  56. package/dist/services/factories/index.js +40 -0
  57. package/dist/services/factories/instrument-factory.d.ts +16 -0
  58. package/dist/services/factories/instrument-factory.d.ts.map +1 -0
  59. package/dist/services/factories/instrument-factory.js +68 -0
  60. package/dist/services/factories/master-factory.d.ts +74 -0
  61. package/dist/services/factories/master-factory.d.ts.map +1 -0
  62. package/dist/services/factories/master-factory.js +183 -0
  63. package/dist/services/factories/portfolio-factory.d.ts +16 -0
  64. package/dist/services/factories/portfolio-factory.d.ts.map +1 -0
  65. package/dist/services/factories/portfolio-factory.js +74 -0
  66. package/dist/services/factories/portfolio-template-factory.d.ts +16 -0
  67. package/dist/services/factories/portfolio-template-factory.d.ts.map +1 -0
  68. package/dist/services/factories/portfolio-template-factory.js +76 -0
  69. package/dist/services/factories/reference-data-factory.d.ts +16 -0
  70. package/dist/services/factories/reference-data-factory.d.ts.map +1 -0
  71. package/dist/services/factories/reference-data-factory.js +86 -0
  72. package/dist/services/factories/tax-residency-factory.d.ts +16 -0
  73. package/dist/services/factories/tax-residency-factory.d.ts.map +1 -0
  74. package/dist/services/factories/tax-residency-factory.js +73 -0
  75. package/dist/services/factories/trade-factory.d.ts +16 -0
  76. package/dist/services/factories/trade-factory.d.ts.map +1 -0
  77. package/dist/services/factories/trade-factory.js +79 -0
  78. package/dist/services/factories/types.d.ts +250 -0
  79. package/dist/services/factories/types.d.ts.map +1 -0
  80. package/dist/services/factories/types.js +32 -0
  81. package/dist/services/factories/withdrawal-factory.d.ts +16 -0
  82. package/dist/services/factories/withdrawal-factory.d.ts.map +1 -0
  83. package/dist/services/factories/withdrawal-factory.js +78 -0
  84. package/dist/services/instruments.d.ts +138 -0
  85. package/dist/services/instruments.d.ts.map +1 -0
  86. package/dist/services/instruments.js +178 -0
  87. package/dist/services/portfolio-templates.d.ts +142 -0
  88. package/dist/services/portfolio-templates.d.ts.map +1 -0
  89. package/dist/services/portfolio-templates.js +201 -0
  90. package/dist/services/portfolios.d.ts +161 -0
  91. package/dist/services/portfolios.d.ts.map +1 -0
  92. package/dist/services/portfolios.js +144 -0
  93. package/dist/services/reference-data.d.ts +185 -0
  94. package/dist/services/reference-data.d.ts.map +1 -0
  95. package/dist/services/reference-data.js +245 -0
  96. package/dist/services/tax-residencies.d.ts +83 -0
  97. package/dist/services/tax-residencies.d.ts.map +1 -0
  98. package/dist/services/tax-residencies.js +179 -0
  99. package/dist/services/trades.d.ts +190 -0
  100. package/dist/services/trades.d.ts.map +1 -0
  101. package/dist/services/trades.js +207 -0
  102. package/dist/services/withdrawals.d.ts +236 -0
  103. package/dist/services/withdrawals.d.ts.map +1 -0
  104. package/dist/services/withdrawals.js +345 -0
  105. package/package.json +43 -16
  106. package/dist/adapters/MobileApiClient.d.ts +0 -68
  107. package/dist/adapters/MobileApiClient.d.ts.map +0 -1
  108. package/dist/adapters/MobileApiClient.js +0 -240
  109. package/dist/adapters/MobileTokenStorage.d.ts +0 -43
  110. package/dist/adapters/MobileTokenStorage.d.ts.map +0 -1
  111. package/dist/adapters/MobileTokenStorage.js +0 -128
  112. package/dist/adapters/WebApiClient.d.ts +0 -28
  113. package/dist/adapters/WebApiClient.d.ts.map +0 -1
  114. package/dist/adapters/WebApiClient.js +0 -119
  115. package/dist/adapters/WebTokenStorage.d.ts +0 -38
  116. package/dist/adapters/WebTokenStorage.d.ts.map +0 -1
  117. package/dist/adapters/WebTokenStorage.js +0 -86
  118. package/dist/api/apiClient.d.ts +0 -31
  119. package/dist/api/apiClient.d.ts.map +0 -1
  120. package/dist/api/apiClient.js +0 -49
  121. package/dist/api/types.d.ts +0 -51
  122. package/dist/api/types.d.ts.map +0 -1
  123. package/dist/api/types.js +0 -4
  124. package/dist/auth/AuthManager.d.ts +0 -81
  125. package/dist/auth/AuthManager.d.ts.map +0 -1
  126. package/dist/auth/AuthManager.js +0 -223
  127. package/dist/auth/createAuthManager.d.ts +0 -63
  128. package/dist/auth/createAuthManager.d.ts.map +0 -1
  129. package/dist/auth/createAuthManager.js +0 -103
  130. package/dist/auth/useAuthManager.d.ts +0 -66
  131. package/dist/auth/useAuthManager.d.ts.map +0 -1
  132. package/dist/auth/useAuthManager.js +0 -133
  133. package/dist/core/BaseApiClient.d.ts +0 -82
  134. package/dist/core/BaseApiClient.d.ts.map +0 -1
  135. package/dist/core/BaseApiClient.js +0 -89
  136. package/dist/core/TokenStorage.d.ts +0 -45
  137. package/dist/core/TokenStorage.d.ts.map +0 -1
  138. package/dist/core/TokenStorage.js +0 -23
  139. package/dist/query/QueryClient.d.ts +0 -82
  140. package/dist/query/QueryClient.d.ts.map +0 -1
  141. package/dist/query/QueryClient.js +0 -136
  142. package/dist/query/useAuth.d.ts +0 -64
  143. package/dist/query/useAuth.d.ts.map +0 -1
  144. package/dist/query/useAuth.js +0 -144
  145. package/dist/query/usePortfolios.d.ts +0 -79
  146. package/dist/query/usePortfolios.d.ts.map +0 -1
  147. package/dist/query/usePortfolios.js +0 -172
  148. package/dist/services/AuthService.d.ts +0 -75
  149. package/dist/services/AuthService.d.ts.map +0 -1
  150. package/dist/services/AuthService.js +0 -83
  151. package/dist/services/BaseService.d.ts +0 -48
  152. package/dist/services/BaseService.d.ts.map +0 -1
  153. package/dist/services/BaseService.js +0 -51
  154. package/dist/services/PortfolioService.d.ts +0 -100
  155. package/dist/services/PortfolioService.d.ts.map +0 -1
  156. package/dist/services/PortfolioService.js +0 -68
  157. package/dist/services/accounts/constants.d.ts +0 -24
  158. package/dist/services/accounts/constants.d.ts.map +0 -1
  159. package/dist/services/accounts/constants.js +0 -30
  160. package/dist/services/accounts/index.d.ts +0 -7
  161. package/dist/services/accounts/index.d.ts.map +0 -1
  162. package/dist/services/accounts/index.js +0 -6
  163. package/dist/services/accounts/service.d.ts +0 -11
  164. package/dist/services/accounts/service.d.ts.map +0 -1
  165. package/dist/services/accounts/service.js +0 -19
  166. package/dist/services/accounts/types.d.ts +0 -15
  167. package/dist/services/accounts/types.d.ts.map +0 -1
  168. package/dist/services/accounts/types.js +0 -4
  169. package/dist/services/auth/constants.d.ts +0 -30
  170. package/dist/services/auth/constants.d.ts.map +0 -1
  171. package/dist/services/auth/constants.js +0 -37
  172. package/dist/services/auth/index.d.ts +0 -8
  173. package/dist/services/auth/index.d.ts.map +0 -1
  174. package/dist/services/auth/index.js +0 -7
  175. package/dist/services/auth/service.d.ts +0 -8
  176. package/dist/services/auth/service.d.ts.map +0 -1
  177. package/dist/services/auth/service.js +0 -23
  178. package/dist/services/auth/types.d.ts +0 -38
  179. package/dist/services/auth/types.d.ts.map +0 -1
  180. package/dist/services/auth/types.js +0 -1
  181. package/dist/services/auth/utils.d.ts +0 -46
  182. package/dist/services/auth/utils.d.ts.map +0 -1
  183. package/dist/services/auth/utils.js +0 -113
  184. package/dist/services/banks/constants.d.ts +0 -47
  185. package/dist/services/banks/constants.d.ts.map +0 -1
  186. package/dist/services/banks/constants.js +0 -98
  187. package/dist/services/banks/index.d.ts +0 -8
  188. package/dist/services/banks/index.d.ts.map +0 -1
  189. package/dist/services/banks/index.js +0 -7
  190. package/dist/services/banks/service.d.ts +0 -9
  191. package/dist/services/banks/service.d.ts.map +0 -1
  192. package/dist/services/banks/service.js +0 -38
  193. package/dist/services/banks/types.d.ts +0 -36
  194. package/dist/services/banks/types.d.ts.map +0 -1
  195. package/dist/services/banks/types.js +0 -4
  196. package/dist/services/cash_accounts/constants.d.ts +0 -7
  197. package/dist/services/cash_accounts/constants.d.ts.map +0 -1
  198. package/dist/services/cash_accounts/constants.js +0 -7
  199. package/dist/services/cash_accounts/index.d.ts +0 -5
  200. package/dist/services/cash_accounts/index.d.ts.map +0 -1
  201. package/dist/services/cash_accounts/index.js +0 -6
  202. package/dist/services/cash_accounts/service.d.ts +0 -8
  203. package/dist/services/cash_accounts/service.d.ts.map +0 -1
  204. package/dist/services/cash_accounts/service.js +0 -32
  205. package/dist/services/cash_accounts/transactions/constants.d.ts +0 -18
  206. package/dist/services/cash_accounts/transactions/constants.d.ts.map +0 -1
  207. package/dist/services/cash_accounts/transactions/constants.js +0 -25
  208. package/dist/services/cash_accounts/transactions/index.d.ts +0 -5
  209. package/dist/services/cash_accounts/transactions/index.d.ts.map +0 -1
  210. package/dist/services/cash_accounts/transactions/index.js +0 -6
  211. package/dist/services/cash_accounts/transactions/service.d.ts +0 -13
  212. package/dist/services/cash_accounts/transactions/service.d.ts.map +0 -1
  213. package/dist/services/cash_accounts/transactions/service.js +0 -75
  214. package/dist/services/cash_accounts/transactions/types.d.ts +0 -38
  215. package/dist/services/cash_accounts/transactions/types.d.ts.map +0 -1
  216. package/dist/services/cash_accounts/transactions/types.js +0 -11
  217. package/dist/services/cash_accounts/types.d.ts +0 -24
  218. package/dist/services/cash_accounts/types.d.ts.map +0 -1
  219. package/dist/services/cash_accounts/types.js +0 -4
  220. package/dist/services/countries/constants.d.ts +0 -9
  221. package/dist/services/countries/constants.d.ts.map +0 -1
  222. package/dist/services/countries/constants.js +0 -10
  223. package/dist/services/countries/index.d.ts +0 -5
  224. package/dist/services/countries/index.d.ts.map +0 -1
  225. package/dist/services/countries/index.js +0 -6
  226. package/dist/services/countries/service.d.ts +0 -18
  227. package/dist/services/countries/service.d.ts.map +0 -1
  228. package/dist/services/countries/service.js +0 -32
  229. package/dist/services/countries/types.d.ts +0 -24
  230. package/dist/services/countries/types.d.ts.map +0 -1
  231. package/dist/services/countries/types.js +0 -1
  232. package/dist/services/countries/utils.d.ts +0 -38
  233. package/dist/services/countries/utils.d.ts.map +0 -1
  234. package/dist/services/countries/utils.js +0 -62
  235. package/dist/services/documents/constants.d.ts +0 -55
  236. package/dist/services/documents/constants.d.ts.map +0 -1
  237. package/dist/services/documents/constants.js +0 -50
  238. package/dist/services/documents/index.d.ts +0 -6
  239. package/dist/services/documents/index.d.ts.map +0 -1
  240. package/dist/services/documents/index.js +0 -6
  241. package/dist/services/documents/service.d.ts +0 -50
  242. package/dist/services/documents/service.d.ts.map +0 -1
  243. package/dist/services/documents/service.js +0 -116
  244. package/dist/services/documents/types.d.ts +0 -47
  245. package/dist/services/documents/types.d.ts.map +0 -1
  246. package/dist/services/documents/types.js +0 -1
  247. package/dist/services/documents/utils.d.ts +0 -26
  248. package/dist/services/documents/utils.d.ts.map +0 -1
  249. package/dist/services/documents/utils.js +0 -37
  250. package/dist/services/industries/constants.d.ts +0 -8
  251. package/dist/services/industries/constants.d.ts.map +0 -1
  252. package/dist/services/industries/constants.js +0 -9
  253. package/dist/services/industries/index.d.ts +0 -6
  254. package/dist/services/industries/index.d.ts.map +0 -1
  255. package/dist/services/industries/index.js +0 -6
  256. package/dist/services/industries/service.d.ts +0 -18
  257. package/dist/services/industries/service.d.ts.map +0 -1
  258. package/dist/services/industries/service.js +0 -43
  259. package/dist/services/industries/types.d.ts +0 -21
  260. package/dist/services/industries/types.d.ts.map +0 -1
  261. package/dist/services/industries/types.js +0 -1
  262. package/dist/services/industries/utils.d.ts +0 -47
  263. package/dist/services/industries/utils.d.ts.map +0 -1
  264. package/dist/services/industries/utils.js +0 -86
  265. package/dist/services/instruments/constants.d.ts +0 -38
  266. package/dist/services/instruments/constants.d.ts.map +0 -1
  267. package/dist/services/instruments/constants.js +0 -36
  268. package/dist/services/instruments/index.d.ts +0 -5
  269. package/dist/services/instruments/index.d.ts.map +0 -1
  270. package/dist/services/instruments/index.js +0 -6
  271. package/dist/services/instruments/service.d.ts +0 -54
  272. package/dist/services/instruments/service.d.ts.map +0 -1
  273. package/dist/services/instruments/service.js +0 -106
  274. package/dist/services/instruments/types.d.ts +0 -83
  275. package/dist/services/instruments/types.d.ts.map +0 -1
  276. package/dist/services/instruments/types.js +0 -1
  277. package/dist/services/instruments/utils.d.ts +0 -50
  278. package/dist/services/instruments/utils.d.ts.map +0 -1
  279. package/dist/services/instruments/utils.js +0 -111
  280. package/dist/services/portfolio_templates/constants.d.ts +0 -8
  281. package/dist/services/portfolio_templates/constants.d.ts.map +0 -1
  282. package/dist/services/portfolio_templates/constants.js +0 -8
  283. package/dist/services/portfolio_templates/index.d.ts +0 -5
  284. package/dist/services/portfolio_templates/index.d.ts.map +0 -1
  285. package/dist/services/portfolio_templates/index.js +0 -5
  286. package/dist/services/portfolio_templates/service.d.ts +0 -6
  287. package/dist/services/portfolio_templates/service.d.ts.map +0 -1
  288. package/dist/services/portfolio_templates/service.js +0 -14
  289. package/dist/services/portfolio_templates/types.d.ts +0 -49
  290. package/dist/services/portfolio_templates/types.d.ts.map +0 -1
  291. package/dist/services/portfolio_templates/types.js +0 -1
  292. package/dist/services/portfolio_templates/utils.d.ts +0 -8
  293. package/dist/services/portfolio_templates/utils.d.ts.map +0 -1
  294. package/dist/services/portfolio_templates/utils.js +0 -13
  295. package/dist/services/portfolios/allocations/index.d.ts +0 -7
  296. package/dist/services/portfolios/allocations/index.d.ts.map +0 -1
  297. package/dist/services/portfolios/allocations/index.js +0 -6
  298. package/dist/services/portfolios/allocations/service.d.ts +0 -6
  299. package/dist/services/portfolios/allocations/service.d.ts.map +0 -1
  300. package/dist/services/portfolios/allocations/service.js +0 -19
  301. package/dist/services/portfolios/allocations/types.d.ts +0 -17
  302. package/dist/services/portfolios/allocations/types.d.ts.map +0 -1
  303. package/dist/services/portfolios/allocations/types.js +0 -4
  304. package/dist/services/portfolios/allocations/utils.d.ts +0 -3
  305. package/dist/services/portfolios/allocations/utils.d.ts.map +0 -1
  306. package/dist/services/portfolios/allocations/utils.js +0 -7
  307. package/dist/services/portfolios/constants.d.ts +0 -45
  308. package/dist/services/portfolios/constants.d.ts.map +0 -1
  309. package/dist/services/portfolios/constants.js +0 -57
  310. package/dist/services/portfolios/holdings/index.d.ts +0 -7
  311. package/dist/services/portfolios/holdings/index.d.ts.map +0 -1
  312. package/dist/services/portfolios/holdings/index.js +0 -6
  313. package/dist/services/portfolios/holdings/service.d.ts +0 -10
  314. package/dist/services/portfolios/holdings/service.d.ts.map +0 -1
  315. package/dist/services/portfolios/holdings/service.js +0 -53
  316. package/dist/services/portfolios/holdings/types.d.ts +0 -42
  317. package/dist/services/portfolios/holdings/types.d.ts.map +0 -1
  318. package/dist/services/portfolios/holdings/types.js +0 -4
  319. package/dist/services/portfolios/holdings/utils.d.ts +0 -8
  320. package/dist/services/portfolios/holdings/utils.d.ts.map +0 -1
  321. package/dist/services/portfolios/holdings/utils.js +0 -82
  322. package/dist/services/portfolios/index.d.ts +0 -10
  323. package/dist/services/portfolios/index.d.ts.map +0 -1
  324. package/dist/services/portfolios/index.js +0 -10
  325. package/dist/services/portfolios/service.d.ts +0 -7
  326. package/dist/services/portfolios/service.d.ts.map +0 -1
  327. package/dist/services/portfolios/service.js +0 -19
  328. package/dist/services/portfolios/types.d.ts +0 -29
  329. package/dist/services/portfolios/types.d.ts.map +0 -1
  330. package/dist/services/portfolios/types.js +0 -1
  331. package/dist/services/portfolios/utils.d.ts +0 -5
  332. package/dist/services/portfolios/utils.d.ts.map +0 -1
  333. package/dist/services/portfolios/utils.js +0 -26
  334. package/dist/services/sectors/constants.d.ts +0 -7
  335. package/dist/services/sectors/constants.d.ts.map +0 -1
  336. package/dist/services/sectors/constants.js +0 -7
  337. package/dist/services/sectors/index.d.ts +0 -6
  338. package/dist/services/sectors/index.d.ts.map +0 -1
  339. package/dist/services/sectors/index.js +0 -6
  340. package/dist/services/sectors/service.d.ts +0 -14
  341. package/dist/services/sectors/service.d.ts.map +0 -1
  342. package/dist/services/sectors/service.js +0 -32
  343. package/dist/services/sectors/types.d.ts +0 -19
  344. package/dist/services/sectors/types.d.ts.map +0 -1
  345. package/dist/services/sectors/types.js +0 -1
  346. package/dist/services/sectors/utils.d.ts +0 -31
  347. package/dist/services/sectors/utils.d.ts.map +0 -1
  348. package/dist/services/sectors/utils.js +0 -54
  349. package/dist/services/stock_exchanges/constants.d.ts +0 -7
  350. package/dist/services/stock_exchanges/constants.d.ts.map +0 -1
  351. package/dist/services/stock_exchanges/constants.js +0 -7
  352. package/dist/services/stock_exchanges/index.d.ts +0 -6
  353. package/dist/services/stock_exchanges/index.d.ts.map +0 -1
  354. package/dist/services/stock_exchanges/index.js +0 -6
  355. package/dist/services/stock_exchanges/service.d.ts +0 -4
  356. package/dist/services/stock_exchanges/service.d.ts.map +0 -1
  357. package/dist/services/stock_exchanges/service.js +0 -26
  358. package/dist/services/stock_exchanges/types.d.ts +0 -28
  359. package/dist/services/stock_exchanges/types.d.ts.map +0 -1
  360. package/dist/services/stock_exchanges/types.js +0 -1
  361. package/dist/services/stock_exchanges/utils.d.ts +0 -8
  362. package/dist/services/stock_exchanges/utils.d.ts.map +0 -1
  363. package/dist/services/stock_exchanges/utils.js +0 -37
  364. package/dist/services/tax_residencies/constants.d.ts +0 -7
  365. package/dist/services/tax_residencies/constants.d.ts.map +0 -1
  366. package/dist/services/tax_residencies/constants.js +0 -7
  367. package/dist/services/tax_residencies/index.d.ts +0 -10
  368. package/dist/services/tax_residencies/index.d.ts.map +0 -1
  369. package/dist/services/tax_residencies/index.js +0 -11
  370. package/dist/services/tax_residencies/service.d.ts +0 -6
  371. package/dist/services/tax_residencies/service.d.ts.map +0 -1
  372. package/dist/services/tax_residencies/service.js +0 -20
  373. package/dist/services/tax_residencies/types.d.ts +0 -26
  374. package/dist/services/tax_residencies/types.d.ts.map +0 -1
  375. package/dist/services/tax_residencies/types.js +0 -4
  376. package/dist/services/tax_residencies/utils.d.ts +0 -9
  377. package/dist/services/tax_residencies/utils.d.ts.map +0 -1
  378. package/dist/services/tax_residencies/utils.js +0 -19
  379. package/dist/services/trades/constants.d.ts +0 -47
  380. package/dist/services/trades/constants.d.ts.map +0 -1
  381. package/dist/services/trades/constants.js +0 -61
  382. package/dist/services/trades/index.d.ts +0 -4
  383. package/dist/services/trades/index.d.ts.map +0 -1
  384. package/dist/services/trades/index.js +0 -12
  385. package/dist/services/trades/service.d.ts +0 -19
  386. package/dist/services/trades/service.d.ts.map +0 -1
  387. package/dist/services/trades/service.js +0 -177
  388. package/dist/services/trades/types.d.ts +0 -114
  389. package/dist/services/trades/types.d.ts.map +0 -1
  390. package/dist/services/trades/types.js +0 -1
  391. package/dist/services/users/constants.d.ts +0 -7
  392. package/dist/services/users/constants.d.ts.map +0 -1
  393. package/dist/services/users/constants.js +0 -8
  394. package/dist/services/users/index.d.ts +0 -9
  395. package/dist/services/users/index.d.ts.map +0 -1
  396. package/dist/services/users/index.js +0 -9
  397. package/dist/services/users/investment_preferences/constants.d.ts +0 -7
  398. package/dist/services/users/investment_preferences/constants.d.ts.map +0 -1
  399. package/dist/services/users/investment_preferences/constants.js +0 -7
  400. package/dist/services/users/investment_preferences/index.d.ts +0 -7
  401. package/dist/services/users/investment_preferences/index.d.ts.map +0 -1
  402. package/dist/services/users/investment_preferences/index.js +0 -6
  403. package/dist/services/users/investment_preferences/service.d.ts +0 -5
  404. package/dist/services/users/investment_preferences/service.d.ts.map +0 -1
  405. package/dist/services/users/investment_preferences/service.js +0 -12
  406. package/dist/services/users/investment_preferences/types.d.ts +0 -23
  407. package/dist/services/users/investment_preferences/types.d.ts.map +0 -1
  408. package/dist/services/users/investment_preferences/types.js +0 -1
  409. package/dist/services/users/service.d.ts +0 -6
  410. package/dist/services/users/service.d.ts.map +0 -1
  411. package/dist/services/users/service.js +0 -15
  412. package/dist/services/users/types.d.ts +0 -32
  413. package/dist/services/users/types.d.ts.map +0 -1
  414. package/dist/services/users/types.js +0 -1
  415. package/dist/services/users/utils.d.ts +0 -2
  416. package/dist/services/users/utils.d.ts.map +0 -1
  417. package/dist/services/users/utils.js +0 -6
  418. package/dist/services/withdrawals/constants.d.ts +0 -67
  419. package/dist/services/withdrawals/constants.d.ts.map +0 -1
  420. package/dist/services/withdrawals/constants.js +0 -91
  421. package/dist/services/withdrawals/index.d.ts +0 -6
  422. package/dist/services/withdrawals/index.d.ts.map +0 -1
  423. package/dist/services/withdrawals/index.js +0 -7
  424. package/dist/services/withdrawals/service.d.ts +0 -4
  425. package/dist/services/withdrawals/service.d.ts.map +0 -1
  426. package/dist/services/withdrawals/service.js +0 -5
  427. package/dist/services/withdrawals/types.d.ts +0 -81
  428. package/dist/services/withdrawals/types.d.ts.map +0 -1
  429. package/dist/services/withdrawals/types.js +0 -1
  430. package/dist/services/withdrawals/utils.d.ts +0 -20
  431. package/dist/services/withdrawals/utils.d.ts.map +0 -1
  432. package/dist/services/withdrawals/utils.js +0 -110
  433. package/dist/services/withdrawals/withdrawal_liquidations/index.d.ts +0 -3
  434. package/dist/services/withdrawals/withdrawal_liquidations/index.d.ts.map +0 -1
  435. package/dist/services/withdrawals/withdrawal_liquidations/index.js +0 -2
  436. package/dist/services/withdrawals/withdrawal_liquidations/service.d.ts +0 -8
  437. package/dist/services/withdrawals/withdrawal_liquidations/service.d.ts.map +0 -1
  438. package/dist/services/withdrawals/withdrawal_liquidations/service.js +0 -68
  439. package/dist/services/withdrawals/withdrawal_liquidations/types.d.ts +0 -2
  440. package/dist/services/withdrawals/withdrawal_liquidations/types.d.ts.map +0 -1
  441. package/dist/services/withdrawals/withdrawal_liquidations/types.js +0 -1
  442. package/dist/services/withdrawals/withdrawal_requests/index.d.ts +0 -3
  443. package/dist/services/withdrawals/withdrawal_requests/index.d.ts.map +0 -1
  444. package/dist/services/withdrawals/withdrawal_requests/index.js +0 -2
  445. package/dist/services/withdrawals/withdrawal_requests/service.d.ts +0 -7
  446. package/dist/services/withdrawals/withdrawal_requests/service.d.ts.map +0 -1
  447. package/dist/services/withdrawals/withdrawal_requests/service.js +0 -55
  448. package/dist/services/withdrawals/withdrawal_requests/types.d.ts +0 -2
  449. package/dist/services/withdrawals/withdrawal_requests/types.d.ts.map +0 -1
  450. package/dist/services/withdrawals/withdrawal_requests/types.js +0 -1
@@ -1,86 +0,0 @@
1
- /**
2
- * Web-specific token storage using HTTP-only cookies
3
- *
4
- * This implementation relies on the backend to set HTTP-only cookies
5
- * and doesn't directly manage tokens on the client side for security.
6
- *
7
- * For web applications using cookie-based authentication, the tokens
8
- * are automatically included in requests via browser cookie handling.
9
- */
10
- import { BaseTokenStorage } from '../core/TokenStorage';
11
- export class WebTokenStorage extends BaseTokenStorage {
12
- /**
13
- * For cookie-based auth, tokens are managed by the browser/server
14
- * This method would typically not store anything client-side
15
- */
16
- async storeTokens(tokens) {
17
- // In cookie-based systems, tokens are set by the server as HTTP-only cookies
18
- // The client doesn't need to manually store them
19
- // For development/testing, we could store in sessionStorage
20
- // but in production, this would be handled by server-set cookies
21
- if (typeof window !== 'undefined' && window.sessionStorage) {
22
- sessionStorage.setItem('auth_tokens', JSON.stringify(tokens));
23
- }
24
- }
25
- /**
26
- * For cookie-based auth, we can't directly access HTTP-only cookies
27
- * This method checks if authentication cookies likely exist
28
- */
29
- async retrieveTokens() {
30
- // In a real cookie-based system, we can't access HTTP-only cookies from JS
31
- // This would typically make a request to a /auth/status endpoint
32
- // For development/testing, check sessionStorage
33
- if (typeof window !== 'undefined' && window.sessionStorage) {
34
- const stored = sessionStorage.getItem('auth_tokens');
35
- if (stored) {
36
- try {
37
- const tokens = JSON.parse(stored);
38
- if (this.validateTokens(tokens)) {
39
- return tokens;
40
- }
41
- }
42
- catch {
43
- // Invalid stored data, clear it
44
- sessionStorage.removeItem('auth_tokens');
45
- }
46
- }
47
- }
48
- return null;
49
- }
50
- /**
51
- * Clear authentication state
52
- * In cookie systems, this would typically call a logout endpoint
53
- */
54
- async clearTokens() {
55
- // Clear any client-side storage
56
- if (typeof window !== 'undefined' && window.sessionStorage) {
57
- sessionStorage.removeItem('auth_tokens');
58
- }
59
- // In a real implementation, this would make a POST to /auth/signout
60
- // to clear the HTTP-only cookies on the server side
61
- }
62
- /**
63
- * Check authentication status
64
- * In cookie systems, this would check if auth cookies exist
65
- */
66
- async hasTokens() {
67
- // For cookie-based systems, we'd typically check document.cookie
68
- // or make a request to an auth status endpoint
69
- // For development, check sessionStorage
70
- if (typeof window !== 'undefined' && window.sessionStorage) {
71
- return sessionStorage.getItem('auth_tokens') !== null;
72
- }
73
- return false;
74
- }
75
- /**
76
- * Check if authentication cookies exist
77
- * This is a web-specific method for cookie-based auth
78
- */
79
- hasCookies() {
80
- if (typeof document === 'undefined')
81
- return false;
82
- // Check for common auth cookie names
83
- const cookies = document.cookie;
84
- return cookies.includes('access') || cookies.includes('sessionid') || cookies.includes('auth');
85
- }
86
- }
@@ -1,31 +0,0 @@
1
- /**
2
- * Platform-agnostic API client factory
3
- * Supports both web and mobile environments
4
- */
5
- export interface ApiClientConfig {
6
- baseURL: string;
7
- withCredentials?: boolean;
8
- headers?: Record<string, string>;
9
- }
10
- export declare const createApiClient: (config: ApiClientConfig) => import("axios").AxiosInstance;
11
- /**
12
- * Web API client factory (for blueberry/strawberry)
13
- */
14
- export declare const createWebApiClient: (baseURL?: string) => import("axios").AxiosInstance;
15
- /**
16
- * Mobile API client factory (for blackberry)
17
- */
18
- export declare const createMobileApiClient: (baseURL: string) => import("axios").AxiosInstance;
19
- /**
20
- * Default web API client instance
21
- * This maintains compatibility with existing blueberry services
22
- */
23
- declare let webApiClient: import("axios").AxiosInstance;
24
- /**
25
- * Configure the global webApiClient with the correct base URL
26
- * This should be called early in the application initialization
27
- */
28
- export declare const configureWebApiClient: (baseURL: string) => import("axios").AxiosInstance;
29
- export { webApiClient };
30
- export default webApiClient;
31
- //# sourceMappingURL=apiClient.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"apiClient.d.ts","sourceRoot":"","sources":["../../src/api/apiClient.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,eAAO,MAAM,eAAe,GAAI,QAAQ,eAAe,kCAStD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAAI,UAAU,MAAM,kCAWlD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB,GAAI,SAAS,MAAM,kCAKpD,CAAC;AAEF;;;GAGG;AACH,QAAA,IAAI,YAAY,+BAAuB,CAAC;AAExC;;;GAGG;AACH,eAAO,MAAM,qBAAqB,GAAI,SAAS,MAAM,kCAGpD,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC;AACxB,eAAe,YAAY,CAAC"}
@@ -1,49 +0,0 @@
1
- import axios from 'axios';
2
- export const createApiClient = (config) => {
3
- return axios.create({
4
- baseURL: config.baseURL,
5
- headers: {
6
- 'Content-Type': 'application/json',
7
- ...config.headers,
8
- },
9
- withCredentials: config.withCredentials ?? true,
10
- });
11
- };
12
- /**
13
- * Web API client factory (for blueberry/strawberry)
14
- */
15
- export const createWebApiClient = (baseURL) => {
16
- // Try multiple sources for the API URL
17
- const apiUrl = baseURL ||
18
- (typeof window !== 'undefined' && window.ENV?.VITE_API_URL) ||
19
- (typeof process !== 'undefined' && process.env?.VITE_API_URL) ||
20
- '';
21
- return createApiClient({
22
- baseURL: apiUrl,
23
- withCredentials: true,
24
- });
25
- };
26
- /**
27
- * Mobile API client factory (for blackberry)
28
- */
29
- export const createMobileApiClient = (baseURL) => {
30
- return createApiClient({
31
- baseURL,
32
- withCredentials: false, // Mobile doesn't use cookies
33
- });
34
- };
35
- /**
36
- * Default web API client instance
37
- * This maintains compatibility with existing blueberry services
38
- */
39
- let webApiClient = createWebApiClient();
40
- /**
41
- * Configure the global webApiClient with the correct base URL
42
- * This should be called early in the application initialization
43
- */
44
- export const configureWebApiClient = (baseURL) => {
45
- webApiClient = createWebApiClient(baseURL);
46
- return webApiClient;
47
- };
48
- export { webApiClient };
49
- export default webApiClient;
@@ -1,51 +0,0 @@
1
- /**
2
- * Common API types shared across all services
3
- */
4
- export interface FormErrors {
5
- [key: string]: string[];
6
- }
7
- export interface PaginatedResponse<T> {
8
- count: number;
9
- next: string | null;
10
- previous: string | null;
11
- results: T[];
12
- }
13
- export interface PaginationParams {
14
- page?: number;
15
- page_size?: number;
16
- }
17
- export interface OrderingParams {
18
- ordering?: string;
19
- order_by?: string;
20
- }
21
- /**
22
- * Base filters interface for API requests
23
- */
24
- export interface BaseListFilters extends PaginationParams, OrderingParams {
25
- search?: string;
26
- [key: string]: unknown;
27
- }
28
- /**
29
- * Common date range filters
30
- */
31
- export interface DateRangeFilters {
32
- date_from?: string;
33
- date_to?: string;
34
- }
35
- /**
36
- * Standard API response wrapper
37
- */
38
- export interface ApiResponse<T> {
39
- data: T;
40
- status: number;
41
- statusText: string;
42
- }
43
- /**
44
- * Error response structure
45
- */
46
- export interface ApiErrorResponse {
47
- detail?: string;
48
- errors?: FormErrors;
49
- message?: string;
50
- }
51
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,UAAU;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,EAAE,CAAC,EAAE,CAAC;CACd;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,eAAgB,SAAQ,gBAAgB,EAAE,cAAc;IACvE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,IAAI,EAAE,CAAC,CAAC;IACR,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
package/dist/api/types.js DELETED
@@ -1,4 +0,0 @@
1
- /**
2
- * Common API types shared across all services
3
- */
4
- export {};
@@ -1,81 +0,0 @@
1
- /**
2
- * Cross-platform Authentication Manager
3
- *
4
- * Centralizes authentication logic and state management across web and mobile platforms.
5
- * Handles token storage, automatic refresh, and authentication state persistence.
6
- */
7
- import type { TokenStorage } from '../core/TokenStorage';
8
- import type { BaseApiClient } from '../core/BaseApiClient';
9
- import { type SigninPayload, type SignupPayload, type UserProfile } from '../services/AuthService';
10
- export interface AuthState {
11
- isAuthenticated: boolean;
12
- isLoading: boolean;
13
- user: UserProfile | null;
14
- error: string | null;
15
- }
16
- export interface AuthManagerConfig {
17
- apiClient: BaseApiClient;
18
- tokenStorage: TokenStorage;
19
- onAuthStateChange?: (state: AuthState) => void;
20
- autoRefreshEnabled?: boolean;
21
- refreshThreshold?: number;
22
- }
23
- export declare class AuthManager {
24
- private apiClient;
25
- private tokenStorage;
26
- private authService;
27
- private onAuthStateChange?;
28
- private autoRefreshEnabled;
29
- private refreshTimer?;
30
- private currentState;
31
- constructor(config: AuthManagerConfig);
32
- /**
33
- * Get current authentication state
34
- */
35
- getState(): AuthState;
36
- /**
37
- * Initialize authentication manager
38
- * Checks for existing tokens and validates authentication state
39
- */
40
- initialize(): Promise<AuthState>;
41
- /**
42
- * Sign in user with credentials
43
- */
44
- signin(credentials: SigninPayload): Promise<AuthState>;
45
- /**
46
- * Sign out user
47
- */
48
- signout(): Promise<AuthState>;
49
- /**
50
- * Sign up new user
51
- */
52
- signup(userData: SignupPayload): Promise<{
53
- success: boolean;
54
- error?: string;
55
- }>;
56
- /**
57
- * Refresh authentication tokens
58
- */
59
- refreshTokens(): Promise<boolean>;
60
- /**
61
- * Update user profile in state
62
- */
63
- refreshProfile(): Promise<void>;
64
- /**
65
- * Start automatic token refresh
66
- */
67
- private startAutoRefresh;
68
- /**
69
- * Stop automatic token refresh
70
- */
71
- private stopAutoRefresh;
72
- /**
73
- * Update authentication state and notify listeners
74
- */
75
- private updateState;
76
- /**
77
- * Clean up resources
78
- */
79
- dispose(): void;
80
- }
81
- //# sourceMappingURL=AuthManager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AuthManager.d.ts","sourceRoot":"","sources":["../../src/auth/AuthManager.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAa,MAAM,sBAAsB,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAe,KAAK,aAAa,EAAE,KAAK,aAAa,EAAE,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEhH,MAAM,WAAW,SAAS;IACxB,eAAe,EAAE,OAAO,CAAC;IACzB,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;IACzB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,aAAa,CAAC;IACzB,YAAY,EAAE,YAAY,CAAC;IAC3B,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IAC/C,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,qBAAa,WAAW;IACtB,OAAO,CAAC,SAAS,CAAgB;IACjC,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,iBAAiB,CAAC,CAA6B;IACvD,OAAO,CAAC,kBAAkB,CAAU;IACpC,OAAO,CAAC,YAAY,CAAC,CAAiB;IAEtC,OAAO,CAAC,YAAY,CAKlB;gBAEU,MAAM,EAAE,iBAAiB;IAWrC;;OAEG;IACH,QAAQ,IAAI,SAAS;IAIrB;;;OAGG;IACG,UAAU,IAAI,OAAO,CAAC,SAAS,CAAC;IA6CtC;;OAEG;IACG,MAAM,CAAC,WAAW,EAAE,aAAa,GAAG,OAAO,CAAC,SAAS,CAAC;IAsC5D;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,SAAS,CAAC;IAyBnC;;OAEG;IACG,MAAM,CAAC,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAsBpF;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC;IA2BvC;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAWrC;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAWxB;;OAEG;IACH,OAAO,CAAC,eAAe;IAOvB;;OAEG;IACH,OAAO,CAAC,WAAW;IAMnB;;OAEG;IACH,OAAO,IAAI,IAAI;CAGhB"}
@@ -1,223 +0,0 @@
1
- /**
2
- * Cross-platform Authentication Manager
3
- *
4
- * Centralizes authentication logic and state management across web and mobile platforms.
5
- * Handles token storage, automatic refresh, and authentication state persistence.
6
- */
7
- import { AuthService } from '../services/AuthService';
8
- export class AuthManager {
9
- constructor(config) {
10
- this.currentState = {
11
- isAuthenticated: false,
12
- isLoading: false,
13
- user: null,
14
- error: null,
15
- };
16
- this.apiClient = config.apiClient;
17
- this.tokenStorage = config.tokenStorage;
18
- this.authService = new AuthService(config.apiClient);
19
- this.onAuthStateChange = config.onAuthStateChange;
20
- this.autoRefreshEnabled = config.autoRefreshEnabled ?? true;
21
- // Set token storage on API client
22
- this.apiClient.setTokenStorage(this.tokenStorage);
23
- }
24
- /**
25
- * Get current authentication state
26
- */
27
- getState() {
28
- return { ...this.currentState };
29
- }
30
- /**
31
- * Initialize authentication manager
32
- * Checks for existing tokens and validates authentication state
33
- */
34
- async initialize() {
35
- this.updateState({ isLoading: true, error: null });
36
- try {
37
- const hasTokens = await this.tokenStorage.hasTokens();
38
- if (!hasTokens) {
39
- this.updateState({
40
- isAuthenticated: false,
41
- isLoading: false,
42
- user: null
43
- });
44
- return this.currentState;
45
- }
46
- // Validate tokens by fetching user profile
47
- const user = await this.authService.getProfile();
48
- this.updateState({
49
- isAuthenticated: true,
50
- isLoading: false,
51
- user,
52
- error: null,
53
- });
54
- // Start auto-refresh if enabled
55
- if (this.autoRefreshEnabled) {
56
- this.startAutoRefresh();
57
- }
58
- }
59
- catch (error) {
60
- // Tokens are invalid, clear them
61
- await this.tokenStorage.clearTokens();
62
- this.updateState({
63
- isAuthenticated: false,
64
- isLoading: false,
65
- user: null,
66
- error: error instanceof Error ? error.message : 'Authentication failed',
67
- });
68
- }
69
- return this.currentState;
70
- }
71
- /**
72
- * Sign in user with credentials
73
- */
74
- async signin(credentials) {
75
- this.updateState({ isLoading: true, error: null });
76
- try {
77
- const response = await this.authService.signin(credentials);
78
- // Store tokens if provided in response (mobile)
79
- if (response && typeof response === 'object' && 'access' in response && 'refresh' in response) {
80
- await this.tokenStorage.storeTokens(response);
81
- }
82
- // Fetch user profile
83
- const user = await this.authService.getProfile();
84
- this.updateState({
85
- isAuthenticated: true,
86
- isLoading: false,
87
- user,
88
- error: null,
89
- });
90
- // Start auto-refresh if enabled
91
- if (this.autoRefreshEnabled) {
92
- this.startAutoRefresh();
93
- }
94
- }
95
- catch (error) {
96
- this.updateState({
97
- isAuthenticated: false,
98
- isLoading: false,
99
- user: null,
100
- error: error instanceof Error ? error.message : 'Sign in failed',
101
- });
102
- }
103
- return this.currentState;
104
- }
105
- /**
106
- * Sign out user
107
- */
108
- async signout() {
109
- this.updateState({ isLoading: true, error: null });
110
- try {
111
- // Call sign out endpoint
112
- await this.authService.signout();
113
- }
114
- catch (error) {
115
- // Log error but continue with local cleanup
116
- console.warn('Sign out API call failed:', error);
117
- }
118
- // Always clear local state regardless of API call result
119
- await this.tokenStorage.clearTokens();
120
- this.stopAutoRefresh();
121
- this.updateState({
122
- isAuthenticated: false,
123
- isLoading: false,
124
- user: null,
125
- error: null,
126
- });
127
- return this.currentState;
128
- }
129
- /**
130
- * Sign up new user
131
- */
132
- async signup(userData) {
133
- this.updateState({ isLoading: true, error: null });
134
- try {
135
- await this.authService.signup(userData);
136
- this.updateState({ isLoading: false, error: null });
137
- return { success: true };
138
- }
139
- catch (error) {
140
- this.updateState({
141
- isLoading: false,
142
- error: error instanceof Error ? error.message : 'Sign up failed',
143
- });
144
- return {
145
- success: false,
146
- error: error instanceof Error ? error.message : 'Sign up failed'
147
- };
148
- }
149
- }
150
- /**
151
- * Refresh authentication tokens
152
- */
153
- async refreshTokens() {
154
- try {
155
- const tokens = await this.tokenStorage.retrieveTokens();
156
- if (!tokens?.refresh) {
157
- return false;
158
- }
159
- const newTokens = await this.authService.refreshToken({ refresh: tokens.refresh });
160
- await this.tokenStorage.storeTokens(newTokens);
161
- return true;
162
- }
163
- catch (error) {
164
- console.error('Token refresh failed:', error);
165
- // Clear invalid tokens
166
- await this.tokenStorage.clearTokens();
167
- this.updateState({
168
- isAuthenticated: false,
169
- user: null,
170
- error: 'Session expired',
171
- });
172
- return false;
173
- }
174
- }
175
- /**
176
- * Update user profile in state
177
- */
178
- async refreshProfile() {
179
- if (!this.currentState.isAuthenticated)
180
- return;
181
- try {
182
- const user = await this.authService.getProfile();
183
- this.updateState({ user });
184
- }
185
- catch (error) {
186
- console.error('Profile refresh failed:', error);
187
- }
188
- }
189
- /**
190
- * Start automatic token refresh
191
- */
192
- startAutoRefresh() {
193
- this.stopAutoRefresh();
194
- // Check every 5 minutes
195
- this.refreshTimer = setInterval(async () => {
196
- if (this.currentState.isAuthenticated) {
197
- await this.refreshTokens();
198
- }
199
- }, 5 * 60 * 1000);
200
- }
201
- /**
202
- * Stop automatic token refresh
203
- */
204
- stopAutoRefresh() {
205
- if (this.refreshTimer) {
206
- clearInterval(this.refreshTimer);
207
- this.refreshTimer = undefined;
208
- }
209
- }
210
- /**
211
- * Update authentication state and notify listeners
212
- */
213
- updateState(updates) {
214
- this.currentState = { ...this.currentState, ...updates };
215
- this.onAuthStateChange?.(this.currentState);
216
- }
217
- /**
218
- * Clean up resources
219
- */
220
- dispose() {
221
- this.stopAutoRefresh();
222
- }
223
- }
@@ -1,63 +0,0 @@
1
- /**
2
- * Factory functions to create platform-specific AuthManager instances
3
- *
4
- * Provides convenient setup for web and mobile authentication with
5
- * appropriate API clients and token storage implementations.
6
- */
7
- import { AuthManager, type AuthManagerConfig } from './AuthManager';
8
- import { type SecureStoreInterface } from '../adapters/MobileTokenStorage';
9
- export interface WebAuthManagerConfig {
10
- apiBaseUrl: string;
11
- onAuthStateChange?: AuthManagerConfig['onAuthStateChange'];
12
- autoRefreshEnabled?: boolean;
13
- apiTimeout?: number;
14
- }
15
- export interface MobileAuthManagerConfig {
16
- apiBaseUrl: string;
17
- secureStore: SecureStoreInterface;
18
- onAuthStateChange?: AuthManagerConfig['onAuthStateChange'];
19
- autoRefreshEnabled?: boolean;
20
- retryAttempts?: number;
21
- offlineQueueEnabled?: boolean;
22
- apiTimeout?: number;
23
- }
24
- /**
25
- * Create AuthManager for web applications
26
- * Uses cookie-based authentication with fetch API
27
- */
28
- export declare function createWebAuthManager(config: WebAuthManagerConfig): AuthManager;
29
- /**
30
- * Create AuthManager for mobile applications
31
- * Uses secure storage with token-based authentication
32
- */
33
- export declare function createMobileAuthManager(config: MobileAuthManagerConfig): AuthManager;
34
- /**
35
- * Create Expo-specific AuthManager
36
- * Convenience function for Expo applications using SecureStore
37
- */
38
- export declare function createExpoAuthManager(config: Omit<MobileAuthManagerConfig, 'secureStore'> & {
39
- expoSecureStore: SecureStoreInterface;
40
- }): AuthManager;
41
- /**
42
- * AuthManager factory for different platforms
43
- */
44
- export declare const authManagerFactory: {
45
- readonly web: typeof createWebAuthManager;
46
- readonly mobile: typeof createMobileAuthManager;
47
- readonly expo: typeof createExpoAuthManager;
48
- };
49
- /**
50
- * Platform detection utility
51
- */
52
- export declare function detectPlatform(): 'web' | 'mobile';
53
- /**
54
- * Auto-create AuthManager based on platform
55
- */
56
- export declare function createAuthManagerForPlatform(config: {
57
- apiBaseUrl: string;
58
- onAuthStateChange?: AuthManagerConfig['onAuthStateChange'];
59
- secureStore?: SecureStoreInterface;
60
- retryAttempts?: number;
61
- offlineQueueEnabled?: boolean;
62
- }): AuthManager;
63
- //# sourceMappingURL=createAuthManager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createAuthManager.d.ts","sourceRoot":"","sources":["../../src/auth/createAuthManager.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,KAAK,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAIpE,OAAO,EAAsB,KAAK,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAE/F,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC,mBAAmB,CAAC,CAAC;IAC3D,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,oBAAoB,CAAC;IAClC,iBAAiB,CAAC,EAAE,iBAAiB,CAAC,mBAAmB,CAAC,CAAC;IAC3D,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,oBAAoB,GAAG,WAAW,CAe9E;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,uBAAuB,GAAG,WAAW,CAgBpF;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,IAAI,CAAC,uBAAuB,EAAE,aAAa,CAAC,GAAG;IACrD,eAAe,EAAE,oBAAoB,CAAC;CACvC,GACA,WAAW,CAKb;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;CAIrB,CAAC;AAEX;;GAEG;AACH,wBAAgB,cAAc,IAAI,KAAK,GAAG,QAAQ,CAajD;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE;IACnD,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC,mBAAmB,CAAC,CAAC;IAE3D,WAAW,CAAC,EAAE,oBAAoB,CAAC;IACnC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,GAAG,WAAW,CAqBd"}