@temboplus/afloat 0.1.61 → 0.1.63

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 (398) hide show
  1. package/README.md +246 -42
  2. package/{esm/src/features/admin/contract.d.ts → dist/features/admin/admin.contract.d.ts} +41 -77
  3. package/{script/npm/src/src/features/admin/schemas.d.ts → dist/features/admin/admin.dtos.d.ts} +8 -9
  4. package/dist/features/admin/admin.repository.d.ts +179 -0
  5. package/dist/features/admin/index.d.ts +2 -0
  6. package/{esm/src/features/auth/access/contract.d.ts → dist/features/auth/access/access.api-contract.d.ts} +0 -1
  7. package/dist/features/auth/access/access.repository.d.ts +55 -0
  8. package/{esm/src/features/auth/contract.d.ts → dist/features/auth/auth.contract.d.ts} +12 -8
  9. package/dist/features/auth/auth.manager.d.ts +249 -0
  10. package/dist/features/auth/auth.repository.d.ts +66 -0
  11. package/dist/features/auth/auth.store.d.ts +139 -0
  12. package/{script/npm/src/src/features/auth/identity/contract.d.ts → dist/features/auth/identity/identity.api-contract.d.ts} +0 -1
  13. package/dist/features/auth/identity/identity.repository.d.ts +58 -0
  14. package/dist/features/auth/index.d.ts +5 -0
  15. package/{script/npm/src/src/features/auth/profile/contract.d.ts → dist/features/auth/profile/profile.api-contract.d.ts} +8 -6
  16. package/dist/features/auth/profile/profile.dtos.d.ts +80 -0
  17. package/dist/features/auth/profile/profile.repository.d.ts +56 -0
  18. package/{script/npm/src/src/features/auth/storage/client_store.d.ts → dist/features/auth/storage/client-store.d.ts} +2 -3
  19. package/{esm/src/features/auth/storage/client_token_handler.d.ts → dist/features/auth/storage/client-token-handler.d.ts} +1 -2
  20. package/{script/npm/src/src → dist}/features/auth/storage/types.d.ts +1 -2
  21. package/dist/features/contact/contact-input-handler.d.ts +16 -0
  22. package/{esm/src/features/contact/contract.d.ts → dist/features/contact/contact.api-contract.d.ts} +101 -45
  23. package/dist/features/contact/contact.dtos.d.ts +90 -0
  24. package/dist/features/contact/contact.repository.d.ts +116 -0
  25. package/dist/features/contact/index.d.ts +2 -0
  26. package/dist/features/payout/index.d.ts +3 -0
  27. package/dist/features/payout/payout-channel-handler.d.ts +108 -0
  28. package/{esm/src/features/payout/contract.d.ts → dist/features/payout/payout.api-contract.d.ts} +351 -187
  29. package/dist/features/payout/payout.dtos.d.ts +365 -0
  30. package/dist/features/payout/payout.repository.d.ts +193 -0
  31. package/dist/features/wallet/index.d.ts +4 -0
  32. package/dist/features/wallet/wallet-manager.session.d.ts +143 -0
  33. package/{script/npm/src/src/features/wallet/contract.d.ts → dist/features/wallet/wallet.contract.d.ts} +9 -7
  34. package/dist/features/wallet/wallet.dtos.d.ts +204 -0
  35. package/dist/features/wallet/wallet.repository.d.ts +173 -0
  36. package/dist/features/wallet/wallet.utils.d.ts +17 -0
  37. package/dist/index.cjs.js +2 -0
  38. package/dist/index.cjs.js.map +1 -0
  39. package/dist/index.d.ts +7 -0
  40. package/dist/index.esm.js +2 -0
  41. package/dist/index.esm.js.map +1 -0
  42. package/{esm/src/shared/base_repository.d.ts → dist/lib/api/base-repository.d.ts} +137 -42
  43. package/{script/npm/src/src/shared/common_responses.d.ts → dist/lib/api/common-responses.d.ts} +0 -1
  44. package/dist/lib/api/index.d.ts +2 -0
  45. package/{esm/src/errors/api_error.d.ts → dist/lib/error/error.api.d.ts} +0 -1
  46. package/{script/npm/src/src/errors/permission_error.d.ts → dist/lib/error/error.permission.d.ts} +1 -2
  47. package/dist/lib/error/error.utils.d.ts +22 -0
  48. package/dist/lib/error/index.d.ts +3 -0
  49. package/dist/models/contact-info.model.d.ts +817 -0
  50. package/{script/npm/src/src/models/contact/derivatives/contact.d.ts → dist/models/contact.model.d.ts} +23 -16
  51. package/dist/models/index.d.ts +11 -0
  52. package/{esm/src/models/user/managed-user.d.ts → dist/models/managed-user.model.d.ts} +3 -3
  53. package/dist/models/narration.model.d.ts +184 -0
  54. package/{script/npm/src/src/models/payout/derivatives/payout.d.ts → dist/models/payout.model.d.ts} +14 -16
  55. package/{esm/src → dist}/models/permission.d.ts +1 -2
  56. package/{script/npm/src/src/models/user/profile.d.ts → dist/models/profile.model.d.ts} +37 -43
  57. package/{script/npm/src/src/models/role.d.ts → dist/models/role.model.d.ts} +2 -10
  58. package/dist/models/statement-entry.model.d.ts +248 -0
  59. package/dist/models/user.model.d.ts +65 -0
  60. package/{script/npm/src/src/models/wallet/wallet.d.ts → dist/models/wallet.model.d.ts} +3 -46
  61. package/package.json +47 -24
  62. package/LICENSE +0 -7
  63. package/esm/mod.d.ts +0 -8
  64. package/esm/mod.d.ts.map +0 -1
  65. package/esm/mod.js +0 -7
  66. package/esm/package.json +0 -3
  67. package/esm/src/errors/api_error.d.ts.map +0 -1
  68. package/esm/src/errors/api_error.js +0 -90
  69. package/esm/src/errors/index.d.ts +0 -3
  70. package/esm/src/errors/index.d.ts.map +0 -1
  71. package/esm/src/errors/index.js +0 -2
  72. package/esm/src/errors/permission_error.d.ts +0 -48
  73. package/esm/src/errors/permission_error.d.ts.map +0 -1
  74. package/esm/src/errors/permission_error.js +0 -70
  75. package/esm/src/features/admin/contract.d.ts.map +0 -1
  76. package/esm/src/features/admin/contract.js +0 -210
  77. package/esm/src/features/admin/index.d.ts +0 -4
  78. package/esm/src/features/admin/index.d.ts.map +0 -1
  79. package/esm/src/features/admin/index.js +0 -3
  80. package/esm/src/features/admin/repository.d.ts +0 -114
  81. package/esm/src/features/admin/repository.d.ts.map +0 -1
  82. package/esm/src/features/admin/repository.js +0 -248
  83. package/esm/src/features/admin/schemas.d.ts +0 -146
  84. package/esm/src/features/admin/schemas.d.ts.map +0 -1
  85. package/esm/src/features/admin/schemas.js +0 -206
  86. package/esm/src/features/auth/access/contract.d.ts.map +0 -1
  87. package/esm/src/features/auth/access/contract.js +0 -14
  88. package/esm/src/features/auth/access/repository.d.ts +0 -11
  89. package/esm/src/features/auth/access/repository.d.ts.map +0 -1
  90. package/esm/src/features/auth/access/repository.js +0 -25
  91. package/esm/src/features/auth/contract.d.ts.map +0 -1
  92. package/esm/src/features/auth/contract.js +0 -43
  93. package/esm/src/features/auth/identity/contract.d.ts +0 -23
  94. package/esm/src/features/auth/identity/contract.d.ts.map +0 -1
  95. package/esm/src/features/auth/identity/contract.js +0 -17
  96. package/esm/src/features/auth/identity/repository.d.ts +0 -22
  97. package/esm/src/features/auth/identity/repository.d.ts.map +0 -1
  98. package/esm/src/features/auth/identity/repository.js +0 -30
  99. package/esm/src/features/auth/index.d.ts +0 -6
  100. package/esm/src/features/auth/index.d.ts.map +0 -1
  101. package/esm/src/features/auth/index.js +0 -5
  102. package/esm/src/features/auth/manager.d.ts +0 -105
  103. package/esm/src/features/auth/manager.d.ts.map +0 -1
  104. package/esm/src/features/auth/manager.js +0 -181
  105. package/esm/src/features/auth/profile/contract.d.ts +0 -37
  106. package/esm/src/features/auth/profile/contract.d.ts.map +0 -1
  107. package/esm/src/features/auth/profile/contract.js +0 -14
  108. package/esm/src/features/auth/profile/repository.d.ts +0 -11
  109. package/esm/src/features/auth/profile/repository.d.ts.map +0 -1
  110. package/esm/src/features/auth/profile/repository.js +0 -25
  111. package/esm/src/features/auth/repository.d.ts +0 -30
  112. package/esm/src/features/auth/repository.d.ts.map +0 -1
  113. package/esm/src/features/auth/repository.js +0 -69
  114. package/esm/src/features/auth/storage/client_store.d.ts +0 -30
  115. package/esm/src/features/auth/storage/client_store.d.ts.map +0 -1
  116. package/esm/src/features/auth/storage/client_store.js +0 -46
  117. package/esm/src/features/auth/storage/client_token_handler.d.ts.map +0 -1
  118. package/esm/src/features/auth/storage/client_token_handler.js +0 -36
  119. package/esm/src/features/auth/storage/server_store.d.ts +0 -24
  120. package/esm/src/features/auth/storage/server_store.d.ts.map +0 -1
  121. package/esm/src/features/auth/storage/server_store.js +0 -34
  122. package/esm/src/features/auth/storage/server_token_handler.d.ts +0 -36
  123. package/esm/src/features/auth/storage/server_token_handler.d.ts.map +0 -1
  124. package/esm/src/features/auth/storage/server_token_handler.js +0 -115
  125. package/esm/src/features/auth/storage/types.d.ts +0 -42
  126. package/esm/src/features/auth/storage/types.d.ts.map +0 -1
  127. package/esm/src/features/auth/storage/types.js +0 -1
  128. package/esm/src/features/contact/contract.d.ts.map +0 -1
  129. package/esm/src/features/contact/contract.js +0 -49
  130. package/esm/src/features/contact/index.d.ts +0 -2
  131. package/esm/src/features/contact/index.d.ts.map +0 -1
  132. package/esm/src/features/contact/index.js +0 -1
  133. package/esm/src/features/contact/repository.d.ts +0 -58
  134. package/esm/src/features/contact/repository.d.ts.map +0 -1
  135. package/esm/src/features/contact/repository.js +0 -108
  136. package/esm/src/features/payout/contract.d.ts.map +0 -1
  137. package/esm/src/features/payout/contract.js +0 -75
  138. package/esm/src/features/payout/index.d.ts +0 -2
  139. package/esm/src/features/payout/index.d.ts.map +0 -1
  140. package/esm/src/features/payout/index.js +0 -1
  141. package/esm/src/features/payout/repository.d.ts +0 -67
  142. package/esm/src/features/payout/repository.d.ts.map +0 -1
  143. package/esm/src/features/payout/repository.js +0 -163
  144. package/esm/src/features/wallet/contract.d.ts +0 -137
  145. package/esm/src/features/wallet/contract.d.ts.map +0 -1
  146. package/esm/src/features/wallet/contract.js +0 -38
  147. package/esm/src/features/wallet/index.d.ts +0 -2
  148. package/esm/src/features/wallet/index.d.ts.map +0 -1
  149. package/esm/src/features/wallet/index.js +0 -1
  150. package/esm/src/features/wallet/repository.d.ts +0 -57
  151. package/esm/src/features/wallet/repository.d.ts.map +0 -1
  152. package/esm/src/features/wallet/repository.js +0 -93
  153. package/esm/src/models/contact/derivatives/contact.d.ts +0 -172
  154. package/esm/src/models/contact/derivatives/contact.d.ts.map +0 -1
  155. package/esm/src/models/contact/derivatives/contact.js +0 -266
  156. package/esm/src/models/contact/derivatives/contact_info.d.ts +0 -188
  157. package/esm/src/models/contact/derivatives/contact_info.d.ts.map +0 -1
  158. package/esm/src/models/contact/derivatives/contact_info.js +0 -255
  159. package/esm/src/models/contact/index.d.ts +0 -5
  160. package/esm/src/models/contact/index.d.ts.map +0 -1
  161. package/esm/src/models/contact/index.js +0 -4
  162. package/esm/src/models/contact/schemas.d.ts +0 -66
  163. package/esm/src/models/contact/schemas.d.ts.map +0 -1
  164. package/esm/src/models/contact/schemas.js +0 -64
  165. package/esm/src/models/contact/validation.d.ts +0 -37
  166. package/esm/src/models/contact/validation.d.ts.map +0 -1
  167. package/esm/src/models/contact/validation.js +0 -146
  168. package/esm/src/models/index.d.ts +0 -7
  169. package/esm/src/models/index.d.ts.map +0 -1
  170. package/esm/src/models/index.js +0 -6
  171. package/esm/src/models/payout/api.d.ts +0 -29
  172. package/esm/src/models/payout/api.d.ts.map +0 -1
  173. package/esm/src/models/payout/api.js +0 -1
  174. package/esm/src/models/payout/channel.d.ts +0 -58
  175. package/esm/src/models/payout/channel.d.ts.map +0 -1
  176. package/esm/src/models/payout/channel.js +0 -53
  177. package/esm/src/models/payout/derivatives/payout.d.ts +0 -158
  178. package/esm/src/models/payout/derivatives/payout.d.ts.map +0 -1
  179. package/esm/src/models/payout/derivatives/payout.js +0 -265
  180. package/esm/src/models/payout/index.d.ts +0 -7
  181. package/esm/src/models/payout/index.d.ts.map +0 -1
  182. package/esm/src/models/payout/index.js +0 -6
  183. package/esm/src/models/payout/narration.d.ts +0 -164
  184. package/esm/src/models/payout/narration.d.ts.map +0 -1
  185. package/esm/src/models/payout/narration.js +0 -308
  186. package/esm/src/models/payout/schemas.d.ts +0 -156
  187. package/esm/src/models/payout/schemas.d.ts.map +0 -1
  188. package/esm/src/models/payout/schemas.js +0 -105
  189. package/esm/src/models/payout/status.d.ts +0 -33
  190. package/esm/src/models/payout/status.d.ts.map +0 -1
  191. package/esm/src/models/payout/status.js +0 -34
  192. package/esm/src/models/permission.d.ts.map +0 -1
  193. package/esm/src/models/permission.js +0 -50
  194. package/esm/src/models/role.d.ts +0 -21
  195. package/esm/src/models/role.d.ts.map +0 -1
  196. package/esm/src/models/role.js +0 -73
  197. package/esm/src/models/user/authenticated-user.d.ts +0 -77
  198. package/esm/src/models/user/authenticated-user.d.ts.map +0 -1
  199. package/esm/src/models/user/authenticated-user.js +0 -226
  200. package/esm/src/models/user/index.d.ts +0 -4
  201. package/esm/src/models/user/index.d.ts.map +0 -1
  202. package/esm/src/models/user/index.js +0 -3
  203. package/esm/src/models/user/managed-user.d.ts.map +0 -1
  204. package/esm/src/models/user/managed-user.js +0 -255
  205. package/esm/src/models/user/profile.d.ts +0 -161
  206. package/esm/src/models/user/profile.d.ts.map +0 -1
  207. package/esm/src/models/user/profile.js +0 -334
  208. package/esm/src/models/wallet/index.d.ts +0 -4
  209. package/esm/src/models/wallet/index.d.ts.map +0 -1
  210. package/esm/src/models/wallet/index.js +0 -3
  211. package/esm/src/models/wallet/schemas.d.ts +0 -95
  212. package/esm/src/models/wallet/schemas.d.ts.map +0 -1
  213. package/esm/src/models/wallet/schemas.js +0 -35
  214. package/esm/src/models/wallet/statement_entry.d.ts +0 -160
  215. package/esm/src/models/wallet/statement_entry.d.ts.map +0 -1
  216. package/esm/src/models/wallet/statement_entry.js +0 -255
  217. package/esm/src/models/wallet/wallet.d.ts +0 -147
  218. package/esm/src/models/wallet/wallet.d.ts.map +0 -1
  219. package/esm/src/models/wallet/wallet.js +0 -279
  220. package/esm/src/shared/base_repository.d.ts.map +0 -1
  221. package/esm/src/shared/base_repository.js +0 -153
  222. package/esm/src/shared/common_responses.d.ts +0 -13
  223. package/esm/src/shared/common_responses.d.ts.map +0 -1
  224. package/esm/src/shared/common_responses.js +0 -10
  225. package/esm/src/shared/index.d.ts +0 -3
  226. package/esm/src/shared/index.d.ts.map +0 -1
  227. package/esm/src/shared/index.js +0 -2
  228. package/esm/src/shared/token_required_repository.d.ts +0 -78
  229. package/esm/src/shared/token_required_repository.d.ts.map +0 -1
  230. package/esm/src/shared/token_required_repository.js +0 -128
  231. package/script/mod.d.ts +0 -8
  232. package/script/mod.d.ts.map +0 -1
  233. package/script/mod.js +0 -23
  234. package/script/npm/src/mod.d.ts +0 -8
  235. package/script/npm/src/mod.d.ts.map +0 -1
  236. package/script/npm/src/mod.js +0 -23
  237. package/script/npm/src/src/errors/api_error.d.ts +0 -63
  238. package/script/npm/src/src/errors/api_error.d.ts.map +0 -1
  239. package/script/npm/src/src/errors/api_error.js +0 -94
  240. package/script/npm/src/src/errors/index.d.ts +0 -3
  241. package/script/npm/src/src/errors/index.d.ts.map +0 -1
  242. package/script/npm/src/src/errors/index.js +0 -18
  243. package/script/npm/src/src/errors/permission_error.d.ts.map +0 -1
  244. package/script/npm/src/src/errors/permission_error.js +0 -74
  245. package/script/npm/src/src/features/admin/contract.d.ts +0 -842
  246. package/script/npm/src/src/features/admin/contract.d.ts.map +0 -1
  247. package/script/npm/src/src/features/admin/contract.js +0 -213
  248. package/script/npm/src/src/features/admin/index.d.ts +0 -4
  249. package/script/npm/src/src/features/admin/index.d.ts.map +0 -1
  250. package/script/npm/src/src/features/admin/index.js +0 -19
  251. package/script/npm/src/src/features/admin/repository.d.ts +0 -114
  252. package/script/npm/src/src/features/admin/repository.d.ts.map +0 -1
  253. package/script/npm/src/src/features/admin/repository.js +0 -252
  254. package/script/npm/src/src/features/admin/schemas.d.ts.map +0 -1
  255. package/script/npm/src/src/features/admin/schemas.js +0 -209
  256. package/script/npm/src/src/features/auth/access/contract.d.ts +0 -14
  257. package/script/npm/src/src/features/auth/access/contract.d.ts.map +0 -1
  258. package/script/npm/src/src/features/auth/access/contract.js +0 -17
  259. package/script/npm/src/src/features/auth/access/repository.d.ts +0 -11
  260. package/script/npm/src/src/features/auth/access/repository.d.ts.map +0 -1
  261. package/script/npm/src/src/features/auth/access/repository.js +0 -29
  262. package/script/npm/src/src/features/auth/contract.d.ts +0 -112
  263. package/script/npm/src/src/features/auth/contract.d.ts.map +0 -1
  264. package/script/npm/src/src/features/auth/contract.js +0 -46
  265. package/script/npm/src/src/features/auth/identity/contract.d.ts.map +0 -1
  266. package/script/npm/src/src/features/auth/identity/contract.js +0 -20
  267. package/script/npm/src/src/features/auth/identity/repository.d.ts +0 -22
  268. package/script/npm/src/src/features/auth/identity/repository.d.ts.map +0 -1
  269. package/script/npm/src/src/features/auth/identity/repository.js +0 -34
  270. package/script/npm/src/src/features/auth/index.d.ts +0 -6
  271. package/script/npm/src/src/features/auth/index.d.ts.map +0 -1
  272. package/script/npm/src/src/features/auth/index.js +0 -21
  273. package/script/npm/src/src/features/auth/manager.d.ts +0 -105
  274. package/script/npm/src/src/features/auth/manager.d.ts.map +0 -1
  275. package/script/npm/src/src/features/auth/manager.js +0 -185
  276. package/script/npm/src/src/features/auth/profile/contract.d.ts.map +0 -1
  277. package/script/npm/src/src/features/auth/profile/contract.js +0 -17
  278. package/script/npm/src/src/features/auth/profile/repository.d.ts +0 -11
  279. package/script/npm/src/src/features/auth/profile/repository.d.ts.map +0 -1
  280. package/script/npm/src/src/features/auth/profile/repository.js +0 -29
  281. package/script/npm/src/src/features/auth/repository.d.ts +0 -30
  282. package/script/npm/src/src/features/auth/repository.d.ts.map +0 -1
  283. package/script/npm/src/src/features/auth/repository.js +0 -73
  284. package/script/npm/src/src/features/auth/storage/client_store.d.ts.map +0 -1
  285. package/script/npm/src/src/features/auth/storage/client_store.js +0 -51
  286. package/script/npm/src/src/features/auth/storage/client_token_handler.d.ts +0 -32
  287. package/script/npm/src/src/features/auth/storage/client_token_handler.d.ts.map +0 -1
  288. package/script/npm/src/src/features/auth/storage/client_token_handler.js +0 -40
  289. package/script/npm/src/src/features/auth/storage/server_store.d.ts +0 -24
  290. package/script/npm/src/src/features/auth/storage/server_store.d.ts.map +0 -1
  291. package/script/npm/src/src/features/auth/storage/server_store.js +0 -38
  292. package/script/npm/src/src/features/auth/storage/server_token_handler.d.ts +0 -36
  293. package/script/npm/src/src/features/auth/storage/server_token_handler.d.ts.map +0 -1
  294. package/script/npm/src/src/features/auth/storage/server_token_handler.js +0 -119
  295. package/script/npm/src/src/features/auth/storage/types.d.ts.map +0 -1
  296. package/script/npm/src/src/features/auth/storage/types.js +0 -2
  297. package/script/npm/src/src/features/contact/contract.d.ts +0 -170
  298. package/script/npm/src/src/features/contact/contract.d.ts.map +0 -1
  299. package/script/npm/src/src/features/contact/contract.js +0 -52
  300. package/script/npm/src/src/features/contact/index.d.ts +0 -2
  301. package/script/npm/src/src/features/contact/index.d.ts.map +0 -1
  302. package/script/npm/src/src/features/contact/index.js +0 -17
  303. package/script/npm/src/src/features/contact/repository.d.ts +0 -58
  304. package/script/npm/src/src/features/contact/repository.d.ts.map +0 -1
  305. package/script/npm/src/src/features/contact/repository.js +0 -112
  306. package/script/npm/src/src/features/payout/contract.d.ts +0 -623
  307. package/script/npm/src/src/features/payout/contract.d.ts.map +0 -1
  308. package/script/npm/src/src/features/payout/contract.js +0 -78
  309. package/script/npm/src/src/features/payout/index.d.ts +0 -2
  310. package/script/npm/src/src/features/payout/index.d.ts.map +0 -1
  311. package/script/npm/src/src/features/payout/index.js +0 -17
  312. package/script/npm/src/src/features/payout/repository.d.ts +0 -67
  313. package/script/npm/src/src/features/payout/repository.d.ts.map +0 -1
  314. package/script/npm/src/src/features/payout/repository.js +0 -167
  315. package/script/npm/src/src/features/wallet/contract.d.ts.map +0 -1
  316. package/script/npm/src/src/features/wallet/contract.js +0 -41
  317. package/script/npm/src/src/features/wallet/index.d.ts +0 -2
  318. package/script/npm/src/src/features/wallet/index.d.ts.map +0 -1
  319. package/script/npm/src/src/features/wallet/index.js +0 -17
  320. package/script/npm/src/src/features/wallet/repository.d.ts +0 -57
  321. package/script/npm/src/src/features/wallet/repository.d.ts.map +0 -1
  322. package/script/npm/src/src/features/wallet/repository.js +0 -97
  323. package/script/npm/src/src/models/contact/derivatives/contact.d.ts.map +0 -1
  324. package/script/npm/src/src/models/contact/derivatives/contact.js +0 -270
  325. package/script/npm/src/src/models/contact/derivatives/contact_info.d.ts +0 -188
  326. package/script/npm/src/src/models/contact/derivatives/contact_info.d.ts.map +0 -1
  327. package/script/npm/src/src/models/contact/derivatives/contact_info.js +0 -260
  328. package/script/npm/src/src/models/contact/index.d.ts +0 -5
  329. package/script/npm/src/src/models/contact/index.d.ts.map +0 -1
  330. package/script/npm/src/src/models/contact/index.js +0 -20
  331. package/script/npm/src/src/models/contact/schemas.d.ts +0 -66
  332. package/script/npm/src/src/models/contact/schemas.d.ts.map +0 -1
  333. package/script/npm/src/src/models/contact/schemas.js +0 -67
  334. package/script/npm/src/src/models/contact/validation.d.ts +0 -37
  335. package/script/npm/src/src/models/contact/validation.d.ts.map +0 -1
  336. package/script/npm/src/src/models/contact/validation.js +0 -153
  337. package/script/npm/src/src/models/index.d.ts +0 -7
  338. package/script/npm/src/src/models/index.d.ts.map +0 -1
  339. package/script/npm/src/src/models/index.js +0 -22
  340. package/script/npm/src/src/models/payout/api.d.ts +0 -29
  341. package/script/npm/src/src/models/payout/api.d.ts.map +0 -1
  342. package/script/npm/src/src/models/payout/api.js +0 -2
  343. package/script/npm/src/src/models/payout/channel.d.ts +0 -58
  344. package/script/npm/src/src/models/payout/channel.d.ts.map +0 -1
  345. package/script/npm/src/src/models/payout/channel.js +0 -56
  346. package/script/npm/src/src/models/payout/derivatives/payout.d.ts.map +0 -1
  347. package/script/npm/src/src/models/payout/derivatives/payout.js +0 -269
  348. package/script/npm/src/src/models/payout/index.d.ts +0 -7
  349. package/script/npm/src/src/models/payout/index.d.ts.map +0 -1
  350. package/script/npm/src/src/models/payout/index.js +0 -22
  351. package/script/npm/src/src/models/payout/narration.d.ts +0 -164
  352. package/script/npm/src/src/models/payout/narration.d.ts.map +0 -1
  353. package/script/npm/src/src/models/payout/narration.js +0 -312
  354. package/script/npm/src/src/models/payout/schemas.d.ts +0 -156
  355. package/script/npm/src/src/models/payout/schemas.d.ts.map +0 -1
  356. package/script/npm/src/src/models/payout/schemas.js +0 -108
  357. package/script/npm/src/src/models/payout/status.d.ts +0 -33
  358. package/script/npm/src/src/models/payout/status.d.ts.map +0 -1
  359. package/script/npm/src/src/models/payout/status.js +0 -37
  360. package/script/npm/src/src/models/permission.d.ts +0 -55
  361. package/script/npm/src/src/models/permission.d.ts.map +0 -1
  362. package/script/npm/src/src/models/permission.js +0 -53
  363. package/script/npm/src/src/models/role.d.ts.map +0 -1
  364. package/script/npm/src/src/models/role.js +0 -77
  365. package/script/npm/src/src/models/user/authenticated-user.d.ts +0 -77
  366. package/script/npm/src/src/models/user/authenticated-user.d.ts.map +0 -1
  367. package/script/npm/src/src/models/user/authenticated-user.js +0 -230
  368. package/script/npm/src/src/models/user/index.d.ts +0 -4
  369. package/script/npm/src/src/models/user/index.d.ts.map +0 -1
  370. package/script/npm/src/src/models/user/index.js +0 -19
  371. package/script/npm/src/src/models/user/managed-user.d.ts +0 -108
  372. package/script/npm/src/src/models/user/managed-user.d.ts.map +0 -1
  373. package/script/npm/src/src/models/user/managed-user.js +0 -260
  374. package/script/npm/src/src/models/user/profile.d.ts.map +0 -1
  375. package/script/npm/src/src/models/user/profile.js +0 -338
  376. package/script/npm/src/src/models/wallet/index.d.ts +0 -4
  377. package/script/npm/src/src/models/wallet/index.d.ts.map +0 -1
  378. package/script/npm/src/src/models/wallet/index.js +0 -19
  379. package/script/npm/src/src/models/wallet/schemas.d.ts +0 -95
  380. package/script/npm/src/src/models/wallet/schemas.d.ts.map +0 -1
  381. package/script/npm/src/src/models/wallet/schemas.js +0 -38
  382. package/script/npm/src/src/models/wallet/statement_entry.d.ts +0 -160
  383. package/script/npm/src/src/models/wallet/statement_entry.d.ts.map +0 -1
  384. package/script/npm/src/src/models/wallet/statement_entry.js +0 -259
  385. package/script/npm/src/src/models/wallet/wallet.d.ts.map +0 -1
  386. package/script/npm/src/src/models/wallet/wallet.js +0 -283
  387. package/script/npm/src/src/shared/base_repository.d.ts +0 -80
  388. package/script/npm/src/src/shared/base_repository.d.ts.map +0 -1
  389. package/script/npm/src/src/shared/base_repository.js +0 -157
  390. package/script/npm/src/src/shared/common_responses.d.ts.map +0 -1
  391. package/script/npm/src/src/shared/common_responses.js +0 -13
  392. package/script/npm/src/src/shared/index.d.ts +0 -3
  393. package/script/npm/src/src/shared/index.d.ts.map +0 -1
  394. package/script/npm/src/src/shared/index.js +0 -18
  395. package/script/npm/src/src/shared/token_required_repository.d.ts +0 -78
  396. package/script/npm/src/src/shared/token_required_repository.d.ts.map +0 -1
  397. package/script/npm/src/src/shared/token_required_repository.js +0 -132
  398. package/script/package.json +0 -3
@@ -1,105 +0,0 @@
1
- import { z } from "zod";
2
- import { PAYOUT_APPROVAL_STATUS, PAYOUT_STATUS, } from "./status.js";
3
- /**
4
- * Creates a Zod schema that transforms null values to undefined
5
- * This is useful when dealing with APIs that return null but you want to use undefined in your codebase
6
- *
7
- * @template T - The type of Zod schema being transformed
8
- * @param {T} schema - The original Zod schema to transform
9
- * @returns {MakeOptionalResult<T>} A new schema that:
10
- * - Accepts the original type or null as input
11
- * - Outputs the original type or undefined
12
- * - Automatically transforms null to undefined during validation
13
- *
14
- * @example
15
- * const userSchema = z.object({
16
- * name: makeOptional(z.string()), // accepts: string | null, outputs: string | undefined
17
- * });
18
- *
19
- * // These are all valid:
20
- * userSchema.parse({ name: "John" }) // { name: "John" }
21
- * userSchema.parse({ name: null }) // { name: undefined }
22
- */
23
- const makeOptional = (schema) => schema.nullable().transform((val) => val === null ? undefined : val);
24
- /**
25
- * Schema for identifying users in the payout process
26
- * Used to track who created or actioned a payout
27
- */
28
- const identifierSchema = z.object({
29
- name: z.string(),
30
- identity: z.string(),
31
- });
32
- /**
33
- * Schema for payout status
34
- * Defines all possible states a payout can be in
35
- */
36
- const payoutStatusSchema = z.enum([
37
- PAYOUT_STATUS.CREATED,
38
- PAYOUT_STATUS.PAID,
39
- PAYOUT_STATUS.FAILED,
40
- PAYOUT_STATUS.REJECTED,
41
- PAYOUT_STATUS.PENDING,
42
- PAYOUT_STATUS.QUEUED,
43
- PAYOUT_STATUS.REVERSED,
44
- ]);
45
- /**
46
- * Schema for payout approval status
47
- * Defines all possible approval states
48
- */
49
- const approvalPayoutStatusSchema = z.enum([
50
- PAYOUT_APPROVAL_STATUS.APPROVED,
51
- PAYOUT_APPROVAL_STATUS.PENDING,
52
- PAYOUT_APPROVAL_STATUS.REJECTED,
53
- ]);
54
- /**
55
- * Base schema for payout operations
56
- * Contains common fields used across all payout operations
57
- */
58
- const basePayoutSchema = z.object({
59
- channel: z.string(),
60
- msisdn: z.string(),
61
- amount: z.coerce.number(),
62
- description: z.string(),
63
- notes: makeOptional(z.string()).optional(),
64
- });
65
- /**
66
- * Schema for creating a new payout
67
- * Extends base payout schema with payee information
68
- */
69
- const payoutInputSchema = basePayoutSchema.extend({
70
- payeeName: z.string(),
71
- });
72
- /**
73
- * Schema for complete payout record
74
- * Extends base payout schema with additional fields for:
75
- * - Identification (id, profileId)
76
- * - Status tracking
77
- * - Timestamps
78
- * - Approval information
79
- * - User tracking (created by, actioned by)
80
- */
81
- const payoutSchema = basePayoutSchema.extend({
82
- id: z.string(),
83
- profileId: z.string(),
84
- payeeName: z.string(),
85
- status: payoutStatusSchema,
86
- statusMessage: z.string(),
87
- partnerReference: makeOptional(z.string()).optional(),
88
- createdAt: z.coerce.date(),
89
- updatedAt: z.coerce.date(),
90
- actionedAt: z.coerce.date().nullish(),
91
- approvalStatus: approvalPayoutStatusSchema,
92
- createdBy: makeOptional(identifierSchema).optional(),
93
- actionedBy: makeOptional(identifierSchema).optional(),
94
- });
95
- /**
96
- * Export object containing all payout-related schemas
97
- * Used for validation and type checking throughout the application
98
- */
99
- export const PayoutSchemas = {
100
- payoutData: payoutSchema, // Complete payout record schema
101
- payoutInput: payoutInputSchema, // New payout input schema
102
- payoutTransactionStatus: payoutStatusSchema, // Payout status enum schema
103
- payoutApprovalStatus: approvalPayoutStatusSchema, // Approval status enum schema
104
- payoutApprover: identifierSchema, // Identifier schema for approvers
105
- };
@@ -1,33 +0,0 @@
1
- /**
2
- * Represents the current status of a payout transaction.
3
- * @enum {string}
4
- * @readonly
5
- */
6
- export declare enum PAYOUT_STATUS {
7
- QUEUED = "QUEUED",
8
- /** Payout is awaiting processing */
9
- PENDING = "PENDING",
10
- /** Payout has been successfully processed */
11
- PAID = "PAID",
12
- /** Payout processing has failed */
13
- FAILED = "FAILED",
14
- /** Payout has been rejected */
15
- REJECTED = "REJECTED",
16
- /** Payout has been initially created but not yet processed */
17
- CREATED = "CREATED",
18
- REVERSED = "REVERSED"
19
- }
20
- /**
21
- * Represents the approval status for payouts that require authorization.
22
- * @enum {string}
23
- * @readonly
24
- */
25
- export declare enum PAYOUT_APPROVAL_STATUS {
26
- /** Payout is awaiting approval decision */
27
- PENDING = "Pending",
28
- /** Payout has been approved */
29
- APPROVED = "Approved",
30
- /** Payout has been rejected during approval process */
31
- REJECTED = "Rejected"
32
- }
33
- //# sourceMappingURL=status.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../../src/src/models/payout/status.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,oBAAY,aAAa;IACvB,MAAM,WAAW;IAEjB,oCAAoC;IACpC,OAAO,YAAY;IACnB,6CAA6C;IAC7C,IAAI,SAAS;IACb,mCAAmC;IACnC,MAAM,WAAW;IACjB,+BAA+B;IAC/B,QAAQ,aAAa;IACrB,8DAA8D;IAC9D,OAAO,YAAY;IAEnB,QAAQ,aAAa;CACtB;AAED;;;;GAIG;AACH,oBAAY,sBAAsB;IAChC,2CAA2C;IAC3C,OAAO,YAAY;IACnB,+BAA+B;IAC/B,QAAQ,aAAa;IACrB,uDAAuD;IACvD,QAAQ,aAAa;CACtB"}
@@ -1,34 +0,0 @@
1
- /**
2
- * Represents the current status of a payout transaction.
3
- * @enum {string}
4
- * @readonly
5
- */
6
- export var PAYOUT_STATUS;
7
- (function (PAYOUT_STATUS) {
8
- PAYOUT_STATUS["QUEUED"] = "QUEUED";
9
- /** Payout is awaiting processing */
10
- PAYOUT_STATUS["PENDING"] = "PENDING";
11
- /** Payout has been successfully processed */
12
- PAYOUT_STATUS["PAID"] = "PAID";
13
- /** Payout processing has failed */
14
- PAYOUT_STATUS["FAILED"] = "FAILED";
15
- /** Payout has been rejected */
16
- PAYOUT_STATUS["REJECTED"] = "REJECTED";
17
- /** Payout has been initially created but not yet processed */
18
- PAYOUT_STATUS["CREATED"] = "CREATED";
19
- PAYOUT_STATUS["REVERSED"] = "REVERSED";
20
- })(PAYOUT_STATUS || (PAYOUT_STATUS = {}));
21
- /**
22
- * Represents the approval status for payouts that require authorization.
23
- * @enum {string}
24
- * @readonly
25
- */
26
- export var PAYOUT_APPROVAL_STATUS;
27
- (function (PAYOUT_APPROVAL_STATUS) {
28
- /** Payout is awaiting approval decision */
29
- PAYOUT_APPROVAL_STATUS["PENDING"] = "Pending";
30
- /** Payout has been approved */
31
- PAYOUT_APPROVAL_STATUS["APPROVED"] = "Approved";
32
- /** Payout has been rejected during approval process */
33
- PAYOUT_APPROVAL_STATUS["REJECTED"] = "Rejected";
34
- })(PAYOUT_APPROVAL_STATUS || (PAYOUT_APPROVAL_STATUS = {}));
@@ -1 +0,0 @@
1
- {"version":3,"file":"permission.d.ts","sourceRoot":"","sources":["../../../src/src/models/permission.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8Cd,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,UAAU,GAClB,OAAO,WAAW,CAAC,OAAO,CAAC,MAAM,OAAO,WAAW,CAAC,OAAO,CAAC,GAC5D,OAAO,WAAW,CAAC,OAAO,CAAC,MAAM,OAAO,WAAW,CAAC,OAAO,CAAC,GAC5D,OAAO,WAAW,CAAC,OAAO,CAAC,MAAM,OAAO,WAAW,CAAC,OAAO,CAAC,GAC5D,OAAO,WAAW,CAAC,MAAM,CAAC,MAAM,OAAO,WAAW,CAAC,MAAM,CAAC,GAC1D,OAAO,WAAW,CAAC,QAAQ,CAAC,MAAM,OAAO,WAAW,CAAC,QAAQ,CAAC,GAC9D,OAAO,WAAW,CAAC,cAAc,CAAC,MAAM,OAAO,WAAW,CAAC,cAAc,CAAC,GAC1E,OAAO,WAAW,CAAC,IAAI,CAAC,MAAM,OAAO,WAAW,CAAC,IAAI,CAAC,GACtD,OAAO,WAAW,CAAC,MAAM,CAAC,MAAM,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC"}
@@ -1,50 +0,0 @@
1
- /**
2
- * All Afloat Permissions
3
- */
4
- export const Permissions = {
5
- Profile: {
6
- ViewCurrent: "profile.getCurrent",
7
- Update: "profile.update",
8
- },
9
- Contact: {
10
- View: "contact.findById",
11
- List: "contact.findAll",
12
- Create: "contact.create",
13
- Update: "contact.update",
14
- Delete: "contact.delete",
15
- },
16
- Payment: {
17
- View: "payment.findById",
18
- List: "payment.findAll",
19
- Create: "payment.create",
20
- },
21
- Payout: {
22
- View: "payout.findById",
23
- List: "payout.findAll",
24
- Create: "payout.create",
25
- Approve: "payout.approve",
26
- },
27
- Transfer: {
28
- View: "transfer.findById",
29
- List: "transfer.findAll",
30
- Create: "transfer.create",
31
- Approve: "transfer.approve",
32
- },
33
- Wallet: {
34
- ViewBalance: "wallet.getBalance",
35
- ViewStatement: "wallet.getStatement",
36
- },
37
- Role: {
38
- ViewRoles: "role.findAll",
39
- ViewRole: "role.findById",
40
- },
41
- UserManagement: {
42
- ViewUsers: "login.findAll",
43
- ViewUser: "login.findById",
44
- CreateUser: "login.create",
45
- UpdateUser: "login.update",
46
- ArchiveUser: "login.archive",
47
- UnArchiveUser: "login.unarchive",
48
- ResetPassword: "login.resetPassword",
49
- },
50
- }; // Make it deeply readonly
@@ -1,21 +0,0 @@
1
- export interface RoleData {
2
- id: string;
3
- name: string;
4
- description?: string;
5
- access: string[];
6
- createdAt: string;
7
- updatedAt: string;
8
- }
9
- export declare class Role {
10
- readonly id: string;
11
- readonly name: string;
12
- readonly description?: string;
13
- readonly permissions: ReadonlySet<string>;
14
- readonly createdAt: Date;
15
- readonly updatedAt: Date;
16
- constructor(data: RoleData);
17
- hasPermission(permission: string): boolean;
18
- static from(data: any): Role | undefined;
19
- toJSON(): any;
20
- }
21
- //# sourceMappingURL=role.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"role.d.ts","sourceRoot":"","sources":["../../../src/src/models/role.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,IAAI;IACf,SAAgB,EAAE,EAAE,MAAM,CAAC;IAC3B,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrC,SAAgB,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACjD,SAAgB,SAAS,EAAE,IAAI,CAAC;IAChC,SAAgB,SAAS,EAAE,IAAI,CAAC;gBAEpB,IAAI,EAAE,QAAQ;IAS1B,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAI1C,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,GAAG,SAAS;IAYxC,MAAM,IAAI,GAAG;CAUd"}
@@ -1,73 +0,0 @@
1
- // deno-lint-ignore-file no-explicit-any
2
- // ====================== Role Entity ====================== //
3
- export class Role {
4
- constructor(data) {
5
- Object.defineProperty(this, "id", {
6
- enumerable: true,
7
- configurable: true,
8
- writable: true,
9
- value: void 0
10
- });
11
- Object.defineProperty(this, "name", {
12
- enumerable: true,
13
- configurable: true,
14
- writable: true,
15
- value: void 0
16
- });
17
- Object.defineProperty(this, "description", {
18
- enumerable: true,
19
- configurable: true,
20
- writable: true,
21
- value: void 0
22
- });
23
- Object.defineProperty(this, "permissions", {
24
- enumerable: true,
25
- configurable: true,
26
- writable: true,
27
- value: void 0
28
- });
29
- Object.defineProperty(this, "createdAt", {
30
- enumerable: true,
31
- configurable: true,
32
- writable: true,
33
- value: void 0
34
- });
35
- Object.defineProperty(this, "updatedAt", {
36
- enumerable: true,
37
- configurable: true,
38
- writable: true,
39
- value: void 0
40
- });
41
- this.id = data.id;
42
- this.name = data.name;
43
- this.description = data.description;
44
- this.permissions = new Set(data.access);
45
- this.createdAt = new Date(data.createdAt);
46
- this.updatedAt = new Date(data.updatedAt);
47
- }
48
- hasPermission(permission) {
49
- return this.permissions.has(permission);
50
- }
51
- static from(data) {
52
- try {
53
- if (!data?.id || !data?.name || !Array.isArray(data?.access)) {
54
- return undefined;
55
- }
56
- return new Role(data);
57
- }
58
- catch (error) {
59
- console.error("Error creating Role:", error);
60
- return undefined;
61
- }
62
- }
63
- toJSON() {
64
- return {
65
- id: this.id,
66
- name: this.name,
67
- description: this.description,
68
- access: Array.from(this.permissions),
69
- createdAt: this.createdAt.toISOString(),
70
- updatedAt: this.updatedAt.toISOString(),
71
- };
72
- }
73
- }
@@ -1,77 +0,0 @@
1
- import { Profile } from "./profile.js";
2
- /**
3
- * Represents a user in Afloat.
4
- *
5
- * This class centralizes user-related logic, simplifying interaction
6
- * with user-related data and ensuring consistent permission checks across the application.
7
- */
8
- export declare class User {
9
- /**
10
- * Logged-in user name
11
- */
12
- name: string;
13
- /**
14
- * Logged-in identity: phone-number or email address
15
- */
16
- identity: string;
17
- /**
18
- * The user's Afloat profile, containing personal information such as name, contact details, and account information.
19
- */
20
- profile: Profile;
21
- /**
22
- * The user's authentication token. This token must be passed in the request headers
23
- * for all authenticated API endpoints.
24
- */
25
- token: string;
26
- /**
27
- * Indicates whether the user is required to change their default password.
28
- *
29
- * Afloat users are initially provided with a default username and password. After the first
30
- * successful login, `resetPassword` will be set to `true` to prompt the user to set a new password.
31
- */
32
- resetPassword: boolean;
33
- /**
34
- * A map of permission keys to boolean values, indicating whether the user has access
35
- * to specific actions or features in the system.
36
- */
37
- private permissionsMap;
38
- /**
39
- * Creates a new instance of the `User` class.
40
- *
41
- * @param userData - An object containing the user's profile, token,
42
- * permissions (access list), and the `resetPassword` flag.
43
- */
44
- private constructor();
45
- /**
46
- * Checks if the user has a specific permission.
47
- *
48
- * @param permission - The permission key to check.
49
- * @returns `true` if the user has the specified permission, otherwise `false`.
50
- */
51
- can(permission: string): boolean;
52
- /**
53
- * Serializes the `User` instance to a JSON string.
54
- *
55
- * @returns A JSON string representation of the `User` instance, including:
56
- * - `profile`: The user's profile information. (Requires profile.toJSON() method)
57
- * - `token`: The user's authentication token.
58
- * - `resetPassword`: Indicates whether the user must reset their password.
59
- * - `permissions`: An array of permission keys the user has.
60
- */
61
- toJSON(): string;
62
- /**
63
- * Creates a new `User` instance from a JSON string.
64
- *
65
- * @param jsonString - A JSON string containing user data.
66
- * @returns A `User` instance reconstructed from the JSON data, or undefined if jsonString is invalid.
67
- */
68
- static fromJSON(jsonString: string): User | undefined;
69
- /**
70
- * Creates a new `User` instance from a data object, JSON string, or object with a Profile instance/object.
71
- *
72
- * @param data - The data object, JSON string, or object with Profile instance/object containing user information.
73
- * @returns A `User` instance, or undefined if data is invalid.
74
- */
75
- static from(data: any): User | undefined;
76
- }
77
- //# sourceMappingURL=authenticated-user.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"authenticated-user.d.ts","sourceRoot":"","sources":["../../../../src/src/models/user/authenticated-user.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC;;;;;GAKG;AACH,qBAAa,IAAI;IACf;;OAEG;IACI,IAAI,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACI,QAAQ,EAAE,MAAM,CAAC;IAExB;;OAEG;IACI,OAAO,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACI,KAAK,EAAE,MAAM,CAAC;IAErB;;;;;OAKG;IACI,aAAa,EAAE,OAAO,CAAC;IAE9B;;;OAGG;IACH,OAAO,CAAC,cAAc,CAA0B;IAEhD;;;;;OAKG;IACH,OAAO;IAwBP;;;;;OAKG;IACI,GAAG,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAIvC;;;;;;;;OAQG;IACI,MAAM,IAAI,MAAM;IAavB;;;;;OAKG;WACW,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS;IAS5D;;;;;OAKG;WACW,IAAI,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,GAAG,SAAS;CA4FhD"}
@@ -1,226 +0,0 @@
1
- // deno-lint-ignore-file no-explicit-any
2
- import { Permissions } from "../permission.js";
3
- import { Profile } from "./profile.js";
4
- /**
5
- * Represents a user in Afloat.
6
- *
7
- * This class centralizes user-related logic, simplifying interaction
8
- * with user-related data and ensuring consistent permission checks across the application.
9
- */
10
- export class User {
11
- /**
12
- * Creates a new instance of the `User` class.
13
- *
14
- * @param userData - An object containing the user's profile, token,
15
- * permissions (access list), and the `resetPassword` flag.
16
- */
17
- constructor(data) {
18
- /**
19
- * Logged-in user name
20
- */
21
- Object.defineProperty(this, "name", {
22
- enumerable: true,
23
- configurable: true,
24
- writable: true,
25
- value: void 0
26
- });
27
- /**
28
- * Logged-in identity: phone-number or email address
29
- */
30
- Object.defineProperty(this, "identity", {
31
- enumerable: true,
32
- configurable: true,
33
- writable: true,
34
- value: void 0
35
- });
36
- /**
37
- * The user's Afloat profile, containing personal information such as name, contact details, and account information.
38
- */
39
- Object.defineProperty(this, "profile", {
40
- enumerable: true,
41
- configurable: true,
42
- writable: true,
43
- value: void 0
44
- });
45
- /**
46
- * The user's authentication token. This token must be passed in the request headers
47
- * for all authenticated API endpoints.
48
- */
49
- Object.defineProperty(this, "token", {
50
- enumerable: true,
51
- configurable: true,
52
- writable: true,
53
- value: void 0
54
- });
55
- /**
56
- * Indicates whether the user is required to change their default password.
57
- *
58
- * Afloat users are initially provided with a default username and password. After the first
59
- * successful login, `resetPassword` will be set to `true` to prompt the user to set a new password.
60
- */
61
- Object.defineProperty(this, "resetPassword", {
62
- enumerable: true,
63
- configurable: true,
64
- writable: true,
65
- value: void 0
66
- });
67
- /**
68
- * A map of permission keys to boolean values, indicating whether the user has access
69
- * to specific actions or features in the system.
70
- */
71
- Object.defineProperty(this, "permissionsMap", {
72
- enumerable: true,
73
- configurable: true,
74
- writable: true,
75
- value: void 0
76
- });
77
- const { profile, token, access, resetPassword, name, identity } = data;
78
- this.profile = profile;
79
- this.token = token;
80
- this.resetPassword = resetPassword;
81
- this.name = name;
82
- this.identity = identity;
83
- this.permissionsMap = {};
84
- for (const group of Object.values(Permissions)) {
85
- for (const perm of Object.values(group)) {
86
- this.permissionsMap[perm] = access.includes(perm);
87
- }
88
- }
89
- }
90
- /**
91
- * Checks if the user has a specific permission.
92
- *
93
- * @param permission - The permission key to check.
94
- * @returns `true` if the user has the specified permission, otherwise `false`.
95
- */
96
- can(permission) {
97
- return this.permissionsMap[permission] ?? false;
98
- }
99
- /**
100
- * Serializes the `User` instance to a JSON string.
101
- *
102
- * @returns A JSON string representation of the `User` instance, including:
103
- * - `profile`: The user's profile information. (Requires profile.toJSON() method)
104
- * - `token`: The user's authentication token.
105
- * - `resetPassword`: Indicates whether the user must reset their password.
106
- * - `permissions`: An array of permission keys the user has.
107
- */
108
- toJSON() {
109
- return JSON.stringify({
110
- profile: this.profile.toObject(),
111
- token: this.token,
112
- resetPassword: this.resetPassword,
113
- name: this.name,
114
- identity: this.identity,
115
- permissions: Object.keys(this.permissionsMap).filter((key) => this.permissionsMap[key]),
116
- });
117
- }
118
- /**
119
- * Creates a new `User` instance from a JSON string.
120
- *
121
- * @param jsonString - A JSON string containing user data.
122
- * @returns A `User` instance reconstructed from the JSON data, or undefined if jsonString is invalid.
123
- */
124
- static fromJSON(jsonString) {
125
- try {
126
- return User.from(JSON.parse(jsonString));
127
- }
128
- catch (e) {
129
- console.error("Invalid JSON string:", e);
130
- return undefined;
131
- }
132
- }
133
- /**
134
- * Creates a new `User` instance from a data object, JSON string, or object with a Profile instance/object.
135
- *
136
- * @param data - The data object, JSON string, or object with Profile instance/object containing user information.
137
- * @returns A `User` instance, or undefined if data is invalid.
138
- */
139
- static from(data) {
140
- let parsedData;
141
- // Parse JSON string if needed
142
- if (typeof data === "string") {
143
- try {
144
- parsedData = JSON.parse(data);
145
- }
146
- catch (error) {
147
- console.error("Invalid JSON string:", error);
148
- return undefined;
149
- }
150
- }
151
- else {
152
- parsedData = data;
153
- }
154
- if (!parsedData) {
155
- console.error("Data is null or undefined.");
156
- return undefined;
157
- }
158
- // Handle different profile formats
159
- let profile;
160
- let rawProfile = parsedData.profile;
161
- // Handle stringified profile (the case in the provided sample)
162
- if (typeof rawProfile === "string") {
163
- try {
164
- // Attempt to parse the stringified profile
165
- rawProfile = JSON.parse(rawProfile);
166
- }
167
- catch (error) {
168
- console.error("Failed to parse profile JSON string:", error);
169
- return undefined;
170
- }
171
- }
172
- // Create Profile instance based on what we received
173
- if (Profile.is(rawProfile)) {
174
- // Already a Profile instance
175
- profile = rawProfile;
176
- }
177
- else if (typeof rawProfile === "object" && rawProfile !== null) {
178
- // Convert object to Profile instance
179
- profile = Profile.from(rawProfile);
180
- if (!profile) {
181
- console.error("Failed to create Profile from data:", rawProfile);
182
- return undefined;
183
- }
184
- }
185
- else if (typeof rawProfile === "string") {
186
- profile = Profile.fromJSON(rawProfile);
187
- if (!profile) {
188
- console.error("Failed to create Profile from JSON data:", rawProfile);
189
- return undefined;
190
- }
191
- }
192
- else {
193
- console.error("Invalid profile format:", typeof rawProfile);
194
- return undefined;
195
- }
196
- // Validate other required fields
197
- if (!parsedData.token || typeof parsedData.token !== "string" ||
198
- !parsedData.name || typeof parsedData.name !== "string" ||
199
- !parsedData.identity || typeof parsedData.identity !== "string" ||
200
- !Array.isArray(parsedData.permissions) &&
201
- !Array.isArray(parsedData.access) ||
202
- typeof parsedData.resetPassword !== "boolean") {
203
- console.error("Missing or invalid required User fields:", {
204
- token: typeof parsedData.token,
205
- name: typeof parsedData.name,
206
- identity: typeof parsedData.identity,
207
- permissions: Array.isArray(parsedData.permissions),
208
- access: Array.isArray(parsedData.access),
209
- resetPassword: typeof parsedData.resetPassword,
210
- });
211
- return undefined;
212
- }
213
- // Support both 'permissions' and 'access' field names
214
- const access = parsedData.access || parsedData.permissions;
215
- // Create and return the User instance
216
- const args = {
217
- profile: profile,
218
- token: parsedData.token,
219
- access: access,
220
- resetPassword: parsedData.resetPassword,
221
- name: parsedData.name,
222
- identity: parsedData.identity,
223
- };
224
- return new User(args);
225
- }
226
- }
@@ -1,4 +0,0 @@
1
- export * from "./profile.js";
2
- export * from "./authenticated-user.js";
3
- export * from "./managed-user.js";
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/models/user/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC"}
@@ -1,3 +0,0 @@
1
- export * from "./profile.js";
2
- export * from "./authenticated-user.js";
3
- export * from "./managed-user.js";
@@ -1 +0,0 @@
1
- {"version":3,"file":"managed-user.d.ts","sourceRoot":"","sources":["../../../../src/src/models/user/managed-user.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;GAEG;AACH,qBAAa,UAAU;IACrB,SAAgB,EAAE,EAAE,MAAM,CAAC;IAC3B,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,QAAQ,EAAE,MAAM,CAAC;IACjC,SAAgB,SAAS,EAAE,MAAM,CAAC;IAClC,SAAgB,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;gBAErC,IAAI,EAAE,cAAc;IAQhC;;OAEG;IACH,GAAG,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAIhC;;OAEG;IACH,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,OAAO;IAItC;;OAEG;IACH,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,OAAO;CAGvC;AAID,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,GAAG,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,OAAO,CAAC;IACvB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAID,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,OAAO,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,qBAAa,WAAY,SAAQ,UAAU;IACzC,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,MAAM,EAAE,MAAM,CAAC;IAC/B,SAAgB,aAAa,EAAE,OAAO,CAAC;IACvC,SAAgB,QAAQ,EAAE,OAAO,CAAC;IAClC,SAAgB,UAAU,EAAE,OAAO,CAAC;IACpC,SAAgB,IAAI,CAAC,EAAE,IAAI,CAAC;IAC5B,SAAgB,SAAS,EAAE,IAAI,CAAC;IAChC,SAAgB,SAAS,EAAE,IAAI,CAAC;gBAEpB,IAAI,EAAE,eAAe;IA0BjC;;OAEG;IACH,eAAe,IAAI,OAAO;IAI1B;;OAEG;IACH,iBAAiB,IAAI,OAAO;IAI5B;;OAEG;IACH,kBAAkB,IAAI,OAAO;IAI7B;;OAEG;IACH,gBAAgB,IAAI;QAClB,MAAM,EAAE,QAAQ,GAAG,UAAU,GAAG,UAAU,GAAG,yBAAyB,CAAC;QACvE,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;QACnD,WAAW,EAAE,MAAM,CAAC;KACrB;IAoCD;;OAEG;IACH,WAAW,IAAI,MAAM;IAIrB;;OAEG;IACH,cAAc,IAAI,MAAM;IAIxB;;OAEG;IACH,iBAAiB,IAAI,MAAM;IAY3B,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,GAAG,WAAW,GAAG,SAAS;IAa/C,MAAM,CAAC,UAAU,CAAC,SAAS,EAAE,GAAG,EAAE,GAAG,WAAW,EAAE;IAMlD,MAAM,IAAI,GAAG;CAgBd"}