@dalmore/api-contracts 0.0.0-dev.ee0e6b6 → 0.0.0-dev.f0b9301

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 (716) hide show
  1. package/README.md +23 -19
  2. package/common/constants.d.ts +33 -0
  3. package/common/constants.js +67 -0
  4. package/common/constants.js.map +1 -0
  5. package/common/helpers/index.d.ts +58 -0
  6. package/common/helpers/index.js +151 -0
  7. package/common/helpers/index.js.map +1 -0
  8. package/common/types/account-contact.types.d.ts +485 -0
  9. package/common/types/account-contact.types.js +75 -0
  10. package/common/types/account-contact.types.js.map +1 -0
  11. package/common/types/account-detail.types.d.ts +304 -0
  12. package/common/types/account-detail.types.js +20 -0
  13. package/common/types/account-detail.types.js.map +1 -0
  14. package/common/types/account-integration.types.d.ts +242 -0
  15. package/common/types/account-integration.types.js +121 -0
  16. package/common/types/account-integration.types.js.map +1 -0
  17. package/common/types/account-manager.types.d.ts +917 -0
  18. package/common/types/account-manager.types.js +89 -0
  19. package/common/types/account-manager.types.js.map +1 -0
  20. package/common/types/account-setting.types.d.ts +140 -0
  21. package/common/types/account-setting.types.js +23 -0
  22. package/common/types/account-setting.types.js.map +1 -0
  23. package/common/types/account.types.d.ts +640 -0
  24. package/common/types/account.types.js +218 -0
  25. package/common/types/account.types.js.map +1 -0
  26. package/common/types/activity.types.d.ts +590 -0
  27. package/common/types/activity.types.js +258 -0
  28. package/common/types/activity.types.js.map +1 -0
  29. package/common/types/address.types.d.ts +89 -0
  30. package/common/types/address.types.js +36 -0
  31. package/common/types/address.types.js.map +1 -0
  32. package/common/types/aic.types.d.ts +434 -0
  33. package/common/types/aic.types.js +170 -0
  34. package/common/types/aic.types.js.map +1 -0
  35. package/common/types/aml.types.d.ts +41 -0
  36. package/common/types/aml.types.js +16 -0
  37. package/common/types/aml.types.js.map +1 -0
  38. package/common/types/api-key-logs.types.d.ts +204 -0
  39. package/common/types/api-key-logs.types.js +52 -0
  40. package/common/types/api-key-logs.types.js.map +1 -0
  41. package/common/types/api-keys.types.d.ts +192 -0
  42. package/common/types/api-keys.types.js +57 -0
  43. package/common/types/api-keys.types.js.map +1 -0
  44. package/common/types/asset.types.d.ts +1100 -0
  45. package/common/types/asset.types.js +353 -0
  46. package/common/types/asset.types.js.map +1 -0
  47. package/common/types/auth.types.d.ts +523 -0
  48. package/common/types/auth.types.js +280 -0
  49. package/common/types/auth.types.js.map +1 -0
  50. package/common/types/batch-jobs.types.d.ts +321 -0
  51. package/common/types/batch-jobs.types.js +111 -0
  52. package/common/types/batch-jobs.types.js.map +1 -0
  53. package/common/types/bonus-tier.types.d.ts +991 -0
  54. package/common/types/bonus-tier.types.js +166 -0
  55. package/common/types/bonus-tier.types.js.map +1 -0
  56. package/common/types/cap-table.types.d.ts +1248 -0
  57. package/common/types/cap-table.types.js +437 -0
  58. package/common/types/cap-table.types.js.map +1 -0
  59. package/common/types/cart.types.d.ts +28 -0
  60. package/common/types/cart.types.js +19 -0
  61. package/common/types/cart.types.js.map +1 -0
  62. package/common/types/checklist-items.types.d.ts +195 -0
  63. package/common/types/checklist-items.types.js +54 -0
  64. package/common/types/checklist-items.types.js.map +1 -0
  65. package/common/types/checklist.types.d.ts +140 -0
  66. package/common/types/checklist.types.js +71 -0
  67. package/common/types/checklist.types.js.map +1 -0
  68. package/common/types/common.types.d.ts +1852 -0
  69. package/common/types/common.types.js +1502 -0
  70. package/common/types/common.types.js.map +1 -0
  71. package/common/types/comply-advantage-api.types.d.ts +3626 -0
  72. package/common/types/comply-advantage-api.types.js +291 -0
  73. package/common/types/comply-advantage-api.types.js.map +1 -0
  74. package/common/types/comply-advantage.types.d.ts +48 -0
  75. package/common/types/comply-advantage.types.js +21 -0
  76. package/common/types/comply-advantage.types.js.map +1 -0
  77. package/common/types/contact-us.types.d.ts +126 -0
  78. package/common/types/contact-us.types.js +91 -0
  79. package/common/types/contact-us.types.js.map +1 -0
  80. package/common/types/countries.types.d.ts +77 -0
  81. package/common/types/countries.types.js +349 -0
  82. package/common/types/countries.types.js.map +1 -0
  83. package/common/types/covered-person.types.d.ts +204 -0
  84. package/common/types/covered-person.types.js +234 -0
  85. package/common/types/covered-person.types.js.map +1 -0
  86. package/common/types/csv.types.d.ts +3606 -0
  87. package/common/types/csv.types.js +290 -0
  88. package/common/types/csv.types.js.map +1 -0
  89. package/common/types/dashboard.types.d.ts +2086 -0
  90. package/common/types/dashboard.types.js +690 -0
  91. package/common/types/dashboard.types.js.map +1 -0
  92. package/common/types/data-record.types.d.ts +347 -0
  93. package/common/types/data-record.types.js +261 -0
  94. package/common/types/data-record.types.js.map +1 -0
  95. package/common/types/data-room.types.d.ts +1277 -0
  96. package/common/types/data-room.types.js +167 -0
  97. package/common/types/data-room.types.js.map +1 -0
  98. package/common/types/default-theme-config.types.d.ts +445 -0
  99. package/common/types/default-theme-config.types.js +63 -0
  100. package/common/types/default-theme-config.types.js.map +1 -0
  101. package/common/types/disbursement-adjustment.types.d.ts +21 -0
  102. package/common/types/disbursement-adjustment.types.js +25 -0
  103. package/common/types/disbursement-adjustment.types.js.map +1 -0
  104. package/common/types/disbursement-approval-user.types.d.ts +935 -0
  105. package/common/types/disbursement-approval-user.types.js +68 -0
  106. package/common/types/disbursement-approval-user.types.js.map +1 -0
  107. package/common/types/disbursement-review.types.d.ts +923 -0
  108. package/common/types/disbursement-review.types.js +76 -0
  109. package/common/types/disbursement-review.types.js.map +1 -0
  110. package/common/types/disbursement-transaction.types.d.ts +621 -0
  111. package/common/types/disbursement-transaction.types.js +51 -0
  112. package/common/types/disbursement-transaction.types.js.map +1 -0
  113. package/common/types/disbursements.types.d.ts +3496 -0
  114. package/common/types/disbursements.types.js +435 -0
  115. package/common/types/disbursements.types.js.map +1 -0
  116. package/common/types/domain-filter.types.d.ts +135 -0
  117. package/common/types/domain-filter.types.js +40 -0
  118. package/common/types/domain-filter.types.js.map +1 -0
  119. package/common/types/email-theme.types.d.ts +1359 -0
  120. package/common/types/email-theme.types.js +318 -0
  121. package/common/types/email-theme.types.js.map +1 -0
  122. package/common/types/entity.types.d.ts +21 -0
  123. package/common/types/entity.types.js +14 -0
  124. package/common/types/entity.types.js.map +1 -0
  125. package/common/types/error-responses.types.d.ts +144 -0
  126. package/common/types/error-responses.types.js +125 -0
  127. package/common/types/error-responses.types.js.map +1 -0
  128. package/common/types/escrow-account.types.d.ts +415 -0
  129. package/common/types/escrow-account.types.js +78 -0
  130. package/common/types/escrow-account.types.js.map +1 -0
  131. package/common/types/exchange-api-key.types.d.ts +1010 -0
  132. package/common/types/exchange-api-key.types.js +90 -0
  133. package/common/types/exchange-api-key.types.js.map +1 -0
  134. package/common/types/exchange-import.types.d.ts +23 -0
  135. package/common/types/exchange-import.types.js +23 -0
  136. package/common/types/exchange-import.types.js.map +1 -0
  137. package/common/types/exchange-provider.types.d.ts +1308 -0
  138. package/common/types/exchange-provider.types.js +268 -0
  139. package/common/types/exchange-provider.types.js.map +1 -0
  140. package/common/types/file.types.d.ts +428 -0
  141. package/common/types/file.types.js +392 -0
  142. package/common/types/file.types.js.map +1 -0
  143. package/common/types/health.types.d.ts +112 -0
  144. package/common/types/health.types.js +22 -0
  145. package/common/types/health.types.js.map +1 -0
  146. package/common/types/i-will-do-it-later.types.d.ts +51 -0
  147. package/common/types/i-will-do-it-later.types.js +30 -0
  148. package/common/types/i-will-do-it-later.types.js.map +1 -0
  149. package/common/types/{index.ts → index.d.ts} +7 -3
  150. package/common/types/index.js +56 -0
  151. package/common/types/index.js.map +1 -0
  152. package/common/types/individuals.types.d.ts +2101 -0
  153. package/common/types/individuals.types.js +500 -0
  154. package/common/types/individuals.types.js.map +1 -0
  155. package/common/types/investor-account.types.d.ts +2996 -0
  156. package/common/types/investor-account.types.js +929 -0
  157. package/common/types/investor-account.types.js.map +1 -0
  158. package/common/types/investorAccountIdSchema.type.js +1 -0
  159. package/common/types/investorAccountIdSchema.type.js.map +1 -0
  160. package/common/types/investors-offering.types.d.ts +399 -0
  161. package/common/types/investors-offering.types.js +50 -0
  162. package/common/types/investors-offering.types.js.map +1 -0
  163. package/common/types/invite.types.d.ts +644 -0
  164. package/common/types/invite.types.js +114 -0
  165. package/common/types/invite.types.js.map +1 -0
  166. package/common/types/issuer-bank-account.types.d.ts +113 -0
  167. package/common/types/issuer-bank-account.types.js +81 -0
  168. package/common/types/issuer-bank-account.types.js.map +1 -0
  169. package/common/types/issuer-offering.types.d.ts +2236 -0
  170. package/common/types/issuer-offering.types.js +605 -0
  171. package/common/types/issuer-offering.types.js.map +1 -0
  172. package/common/types/issuer-payment-method.types.d.ts +1100 -0
  173. package/common/types/issuer-payment-method.types.js +311 -0
  174. package/common/types/issuer-payment-method.types.js.map +1 -0
  175. package/common/types/issuer.types.d.ts +539 -0
  176. package/common/types/issuer.types.js +275 -0
  177. package/common/types/issuer.types.js.map +1 -0
  178. package/common/types/job-item.types.d.ts +230 -0
  179. package/common/types/job-item.types.js +89 -0
  180. package/common/types/job-item.types.js.map +1 -0
  181. package/common/types/jobs.types.d.ts +296 -0
  182. package/common/types/jobs.types.js +150 -0
  183. package/common/types/jobs.types.js.map +1 -0
  184. package/common/types/kyb.types.d.ts +167 -0
  185. package/common/types/kyb.types.js +45 -0
  186. package/common/types/kyb.types.js.map +1 -0
  187. package/common/types/kyc.types.d.ts +2197 -0
  188. package/common/types/kyc.types.js +301 -0
  189. package/common/types/kyc.types.js.map +1 -0
  190. package/common/types/legal-entity.types.d.ts +676 -0
  191. package/common/types/legal-entity.types.js +151 -0
  192. package/common/types/legal-entity.types.js.map +1 -0
  193. package/common/types/login-history.types.d.ts +160 -0
  194. package/common/types/login-history.types.js +39 -0
  195. package/common/types/login-history.types.js.map +1 -0
  196. package/common/types/mail-template.types.d.ts +595 -0
  197. package/common/types/mail-template.types.js +401 -0
  198. package/common/types/mail-template.types.js.map +1 -0
  199. package/common/types/north-cap-integration.types.d.ts +1303 -0
  200. package/common/types/north-cap-integration.types.js +145 -0
  201. package/common/types/north-cap-integration.types.js.map +1 -0
  202. package/common/types/note.types.d.ts +216 -0
  203. package/common/types/note.types.js +82 -0
  204. package/common/types/note.types.js.map +1 -0
  205. package/common/types/notification.types.d.ts +2689 -0
  206. package/common/types/notification.types.js +408 -0
  207. package/common/types/notification.types.js.map +1 -0
  208. package/common/types/notion-api.types.d.ts +3626 -0
  209. package/common/types/notion-api.types.js +271 -0
  210. package/common/types/notion-api.types.js.map +1 -0
  211. package/common/types/notion-database.types.d.ts +191 -0
  212. package/common/types/notion-database.types.js +95 -0
  213. package/common/types/notion-database.types.js.map +1 -0
  214. package/common/types/notion-page.types.d.ts +3482 -0
  215. package/common/types/notion-page.types.js +208 -0
  216. package/common/types/notion-page.types.js.map +1 -0
  217. package/common/types/offering-reports.types.d.ts +525 -0
  218. package/common/types/offering-reports.types.js +111 -0
  219. package/common/types/offering-reports.types.js.map +1 -0
  220. package/common/types/offering-submission.types.d.ts +785 -0
  221. package/common/types/offering-submission.types.js +291 -0
  222. package/common/types/offering-submission.types.js.map +1 -0
  223. package/common/types/offering.types.d.ts +2859 -0
  224. package/common/types/offering.types.js +832 -0
  225. package/common/types/offering.types.js.map +1 -0
  226. package/common/types/page-revision.types.d.ts +74 -0
  227. package/common/types/page-revision.types.js +68 -0
  228. package/common/types/page-revision.types.js.map +1 -0
  229. package/common/types/page.types.d.ts +540 -0
  230. package/common/types/page.types.js +361 -0
  231. package/common/types/page.types.js.map +1 -0
  232. package/common/types/password.type.d.ts +2 -0
  233. package/common/types/password.type.js +14 -0
  234. package/common/types/password.type.js.map +1 -0
  235. package/common/types/payment-methods.types.d.ts +800 -0
  236. package/common/types/payment-methods.types.js +260 -0
  237. package/common/types/payment-methods.types.js.map +1 -0
  238. package/common/types/phone.type.d.ts +12 -0
  239. package/common/types/phone.type.js +29 -0
  240. package/common/types/phone.type.js.map +1 -0
  241. package/common/types/portfolio.types.d.ts +185 -0
  242. package/common/types/portfolio.types.js +36 -0
  243. package/common/types/portfolio.types.js.map +1 -0
  244. package/common/types/privacy-policy-and-tos.types.d.ts +2 -0
  245. package/common/types/{privacy-policy-and-tos.types.ts → privacy-policy-and-tos.types.js} +1 -1
  246. package/common/types/privacy-policy-and-tos.types.js.map +1 -0
  247. package/common/types/queue.types.d.ts +22 -0
  248. package/common/types/queue.types.js +73 -0
  249. package/common/types/queue.types.js.map +1 -0
  250. package/common/types/registered-reps.types.d.ts +6 -0
  251. package/common/types/registered-reps.types.js +21 -0
  252. package/common/types/registered-reps.types.js.map +1 -0
  253. package/common/types/rejection-reasons.types.d.ts +35 -0
  254. package/common/types/rejection-reasons.types.js +49 -0
  255. package/common/types/rejection-reasons.types.js.map +1 -0
  256. package/common/types/reports.types.d.ts +345 -0
  257. package/common/types/reports.types.js +69 -0
  258. package/common/types/reports.types.js.map +1 -0
  259. package/common/types/review.types.d.ts +419 -0
  260. package/common/types/review.types.js +101 -0
  261. package/common/types/review.types.js.map +1 -0
  262. package/common/types/role.types.d.ts +30 -0
  263. package/common/types/role.types.js +21 -0
  264. package/common/types/role.types.js.map +1 -0
  265. package/common/types/secondary-customer.types.d.ts +586 -0
  266. package/common/types/secondary-customer.types.js +39 -0
  267. package/common/types/secondary-customer.types.js.map +1 -0
  268. package/common/types/secondary-issuer.types.d.ts +283 -0
  269. package/common/types/secondary-issuer.types.js +37 -0
  270. package/common/types/secondary-issuer.types.js.map +1 -0
  271. package/common/types/secondary-order.types.d.ts +508 -0
  272. package/common/types/secondary-order.types.js +40 -0
  273. package/common/types/secondary-order.types.js.map +1 -0
  274. package/common/types/secondary-security.types.d.ts +175 -0
  275. package/common/types/secondary-security.types.js +45 -0
  276. package/common/types/secondary-security.types.js.map +1 -0
  277. package/common/types/secondary-trade.entity.d.ts +16 -0
  278. package/common/types/secondary-trade.entity.js +12 -0
  279. package/common/types/secondary-trade.entity.js.map +1 -0
  280. package/common/types/secondary-trade.types.d.ts +465 -0
  281. package/common/types/secondary-trade.types.js +61 -0
  282. package/common/types/secondary-trade.types.js.map +1 -0
  283. package/common/types/secure-request.types.d.ts +171 -0
  284. package/common/types/secure-request.types.js +51 -0
  285. package/common/types/secure-request.types.js.map +1 -0
  286. package/common/types/signer.types.d.ts +3406 -0
  287. package/common/types/signer.types.js +532 -0
  288. package/common/types/signer.types.js.map +1 -0
  289. package/common/types/site-link.types.d.ts +875 -0
  290. package/common/types/site-link.types.js +126 -0
  291. package/common/types/site-link.types.js.map +1 -0
  292. package/common/types/site-settings.types.d.ts +1673 -0
  293. package/common/types/site-settings.types.js +500 -0
  294. package/common/types/site-settings.types.js.map +1 -0
  295. package/common/types/site.types.d.ts +1481 -0
  296. package/common/types/site.types.js +213 -0
  297. package/common/types/site.types.js.map +1 -0
  298. package/common/types/sms.types.d.ts +40 -0
  299. package/common/types/sms.types.js +27 -0
  300. package/common/types/sms.types.js.map +1 -0
  301. package/common/types/state-machine.types.d.ts +591 -0
  302. package/common/types/state-machine.types.js +144 -0
  303. package/common/types/state-machine.types.js.map +1 -0
  304. package/common/types/states.types.d.ts +77 -0
  305. package/common/types/states.types.js +137 -0
  306. package/common/types/states.types.js.map +1 -0
  307. package/common/types/subdoc-preview.types.d.ts +379 -0
  308. package/common/types/subdoc-preview.types.js +24 -0
  309. package/common/types/subdoc-preview.types.js.map +1 -0
  310. package/common/types/task.types.d.ts +545 -0
  311. package/common/types/task.types.js +214 -0
  312. package/common/types/task.types.js.map +1 -0
  313. package/common/types/trade-adjustment.type.d.ts +40 -0
  314. package/common/types/trade-adjustment.type.js +26 -0
  315. package/common/types/trade-adjustment.type.js.map +1 -0
  316. package/common/types/trade-line-item.types.d.ts +353 -0
  317. package/common/types/trade-line-item.types.js +103 -0
  318. package/common/types/trade-line-item.types.js.map +1 -0
  319. package/common/types/trade.types.d.ts +2016 -0
  320. package/common/types/trade.types.js +805 -0
  321. package/common/types/trade.types.js.map +1 -0
  322. package/common/types/transaction.types.d.ts +453 -0
  323. package/common/types/transaction.types.js +173 -0
  324. package/common/types/transaction.types.js.map +1 -0
  325. package/common/types/trusted-contact.types.d.ts +440 -0
  326. package/common/types/trusted-contact.types.js +95 -0
  327. package/common/types/trusted-contact.types.js.map +1 -0
  328. package/common/types/typography.types.d.ts +52 -0
  329. package/common/types/typography.types.js +67 -0
  330. package/common/types/typography.types.js.map +1 -0
  331. package/common/types/user-manual.types.d.ts +287 -0
  332. package/common/types/user-manual.types.js +192 -0
  333. package/common/types/user-manual.types.js.map +1 -0
  334. package/common/types/user-setting.types.d.ts +273 -0
  335. package/common/types/user-setting.types.js +85 -0
  336. package/common/types/user-setting.types.js.map +1 -0
  337. package/common/types/user.types.d.ts +1977 -0
  338. package/common/types/user.types.js +225 -0
  339. package/common/types/user.types.js.map +1 -0
  340. package/common/types/webhook.types.d.ts +10829 -0
  341. package/common/types/webhook.types.js +658 -0
  342. package/common/types/webhook.types.js.map +1 -0
  343. package/common/types/zip.type.d.ts +35 -0
  344. package/common/types/zip.type.js +28 -0
  345. package/common/types/zip.type.js.map +1 -0
  346. package/contracts/clients/accounts/index.d.ts +308 -0
  347. package/contracts/clients/accounts/index.js +43 -0
  348. package/contracts/clients/accounts/index.js.map +1 -0
  349. package/contracts/clients/aic/index.d.ts +280 -0
  350. package/contracts/clients/aic/index.js +47 -0
  351. package/contracts/clients/aic/index.js.map +1 -0
  352. package/contracts/clients/api-key-logs/index.d.ts +287 -0
  353. package/contracts/clients/api-key-logs/index.js +37 -0
  354. package/contracts/clients/api-key-logs/index.js.map +1 -0
  355. package/contracts/clients/api-keys/index.d.ts +374 -0
  356. package/contracts/clients/api-keys/index.js +59 -0
  357. package/contracts/clients/api-keys/index.js.map +1 -0
  358. package/contracts/clients/assets/index.d.ts +1050 -0
  359. package/contracts/clients/assets/index.js +80 -0
  360. package/contracts/clients/assets/index.js.map +1 -0
  361. package/contracts/clients/auth/index.d.ts +236 -0
  362. package/contracts/clients/auth/index.js +38 -0
  363. package/contracts/clients/auth/index.js.map +1 -0
  364. package/contracts/clients/cart/index.d.ts +229 -0
  365. package/contracts/clients/cart/index.js +63 -0
  366. package/contracts/clients/cart/index.js.map +1 -0
  367. package/contracts/clients/csv/index.d.ts +1800 -0
  368. package/contracts/clients/csv/index.js +96 -0
  369. package/contracts/clients/csv/index.js.map +1 -0
  370. package/contracts/clients/files/index.d.ts +552 -0
  371. package/contracts/clients/files/index.js +142 -0
  372. package/contracts/clients/files/index.js.map +1 -0
  373. package/contracts/clients/files-public/index.d.ts +552 -0
  374. package/contracts/clients/files-public/index.js +142 -0
  375. package/contracts/clients/files-public/index.js.map +1 -0
  376. package/contracts/clients/index.d.ts +14689 -0
  377. package/contracts/clients/index.js +56 -0
  378. package/contracts/clients/index.js.map +1 -0
  379. package/contracts/clients/individuals/index.d.ts +3199 -0
  380. package/contracts/clients/individuals/index.js +74 -0
  381. package/contracts/clients/individuals/index.js.map +1 -0
  382. package/contracts/clients/investor-accounts/index.d.ts +339 -0
  383. package/contracts/clients/investor-accounts/index.js +73 -0
  384. package/contracts/clients/investor-accounts/index.js.map +1 -0
  385. package/contracts/clients/issuer-payment-methods/index.d.ts +276 -0
  386. package/contracts/clients/issuer-payment-methods/index.js +24 -0
  387. package/contracts/clients/issuer-payment-methods/index.js.map +1 -0
  388. package/contracts/clients/issuers/index.d.ts +449 -0
  389. package/contracts/clients/issuers/index.js +75 -0
  390. package/contracts/clients/issuers/index.js.map +1 -0
  391. package/contracts/clients/kyc/index.d.ts +345 -0
  392. package/contracts/clients/kyc/index.js +49 -0
  393. package/contracts/clients/kyc/index.js.map +1 -0
  394. package/contracts/clients/legal-entities/index.d.ts +887 -0
  395. package/contracts/clients/legal-entities/index.js +74 -0
  396. package/contracts/clients/legal-entities/index.js.map +1 -0
  397. package/contracts/clients/offerings/index.d.ts +1068 -0
  398. package/contracts/clients/offerings/index.js +95 -0
  399. package/contracts/clients/offerings/index.js.map +1 -0
  400. package/contracts/clients/payment-methods/index.d.ts +456 -0
  401. package/contracts/clients/payment-methods/index.js +68 -0
  402. package/contracts/clients/payment-methods/index.js.map +1 -0
  403. package/contracts/clients/review/index.d.ts +85 -0
  404. package/contracts/clients/review/index.js +27 -0
  405. package/contracts/clients/review/index.js.map +1 -0
  406. package/contracts/clients/secure-requests/index.d.ts +100 -0
  407. package/contracts/clients/secure-requests/index.js +22 -0
  408. package/contracts/clients/secure-requests/index.js.map +1 -0
  409. package/contracts/clients/sites/index.d.ts +657 -0
  410. package/contracts/clients/sites/index.js +40 -0
  411. package/contracts/clients/sites/index.js.map +1 -0
  412. package/contracts/clients/trade-line-items/index.d.ts +216 -0
  413. package/contracts/clients/trade-line-items/index.js +47 -0
  414. package/contracts/clients/trade-line-items/index.js.map +1 -0
  415. package/contracts/clients/trades/index.d.ts +871 -0
  416. package/contracts/clients/trades/index.js +156 -0
  417. package/contracts/clients/trades/index.js.map +1 -0
  418. package/contracts/clients/transactions/index.d.ts +88 -0
  419. package/contracts/clients/transactions/index.js +25 -0
  420. package/contracts/clients/transactions/index.js.map +1 -0
  421. package/package.json +27 -36
  422. package/common/helpers/index.ts +0 -59
  423. package/common/types/account-contact.types.ts +0 -98
  424. package/common/types/account-detail.types.ts +0 -27
  425. package/common/types/account-integration.types.ts +0 -143
  426. package/common/types/account-manager.types.ts +0 -124
  427. package/common/types/account-setting.types.ts +0 -31
  428. package/common/types/account.types.ts +0 -296
  429. package/common/types/activity.types.ts +0 -274
  430. package/common/types/address.types.ts +0 -41
  431. package/common/types/aic.types.ts +0 -246
  432. package/common/types/aml.types.ts +0 -18
  433. package/common/types/api-key-logs.types.ts +0 -66
  434. package/common/types/api-keys.types.ts +0 -69
  435. package/common/types/asset.types.ts +0 -338
  436. package/common/types/auth.types.ts +0 -370
  437. package/common/types/batch-jobs.types.ts +0 -151
  438. package/common/types/bonus-tier.types.ts +0 -171
  439. package/common/types/cart.types.ts +0 -21
  440. package/common/types/checklist-items.types.ts +0 -70
  441. package/common/types/checklist.types.ts +0 -97
  442. package/common/types/common.types.ts +0 -1530
  443. package/common/types/comply-advantage-api.types.ts +0 -316
  444. package/common/types/comply-advantage.types.ts +0 -25
  445. package/common/types/contact-us.types.ts +0 -107
  446. package/common/types/countries.types.ts +0 -375
  447. package/common/types/covered-person.types.ts +0 -274
  448. package/common/types/dashboard.types.ts +0 -792
  449. package/common/types/data-record.types.ts +0 -325
  450. package/common/types/data-room.types.ts +0 -242
  451. package/common/types/default-theme-config.types.ts +0 -87
  452. package/common/types/disbursement-adjustment.types.ts +0 -32
  453. package/common/types/disbursement-approval-user.types.ts +0 -100
  454. package/common/types/disbursement-review.types.ts +0 -110
  455. package/common/types/disbursement-transaction.types.ts +0 -72
  456. package/common/types/disbursements.types.ts +0 -426
  457. package/common/types/domain-filter.types.ts +0 -55
  458. package/common/types/email-theme.types.ts +0 -442
  459. package/common/types/entity.types.ts +0 -15
  460. package/common/types/error-responses.types.ts +0 -135
  461. package/common/types/escrow-account.types.ts +0 -104
  462. package/common/types/exchange-api-key.types.ts +0 -121
  463. package/common/types/exchange-import.types.ts +0 -36
  464. package/common/types/exchange-provider.types.ts +0 -329
  465. package/common/types/file.types.ts +0 -477
  466. package/common/types/health.types.ts +0 -29
  467. package/common/types/i-will-do-it-later.types.ts +0 -68
  468. package/common/types/individuals.types.ts +0 -541
  469. package/common/types/investor-account.types.ts +0 -1239
  470. package/common/types/investors-offering.types.ts +0 -65
  471. package/common/types/invite.types.ts +0 -133
  472. package/common/types/issuer-bank-account.types.ts +0 -107
  473. package/common/types/issuer-offering.types.ts +0 -389
  474. package/common/types/issuer-payment-method.types.ts +0 -382
  475. package/common/types/issuer.types.ts +0 -321
  476. package/common/types/job-item.types.ts +0 -119
  477. package/common/types/jobs.types.ts +0 -171
  478. package/common/types/kyb.types.ts +0 -53
  479. package/common/types/kyc.types.ts +0 -188
  480. package/common/types/legal-entity.types.ts +0 -185
  481. package/common/types/login-history.types.ts +0 -46
  482. package/common/types/mail-template.types.ts +0 -436
  483. package/common/types/north-cap-integration.types.ts +0 -190
  484. package/common/types/note.types.ts +0 -109
  485. package/common/types/notification.types.ts +0 -268
  486. package/common/types/notion-api.types.ts +0 -374
  487. package/common/types/notion-database.types.ts +0 -125
  488. package/common/types/notion-page.types.ts +0 -267
  489. package/common/types/offering-reports.types.ts +0 -153
  490. package/common/types/offering-submission.types.ts +0 -314
  491. package/common/types/offering.types.ts +0 -676
  492. package/common/types/page-revision.types.ts +0 -86
  493. package/common/types/page.types.ts +0 -436
  494. package/common/types/password.type.ts +0 -15
  495. package/common/types/payment-methods.types.ts +0 -298
  496. package/common/types/phone.type.ts +0 -27
  497. package/common/types/portfolio.types.ts +0 -50
  498. package/common/types/queue.types.ts +0 -112
  499. package/common/types/registered-reps.types.ts +0 -25
  500. package/common/types/rejection-reasons.types.ts +0 -56
  501. package/common/types/reminder-config.types.ts +0 -40
  502. package/common/types/review.types.ts +0 -133
  503. package/common/types/role.types.ts +0 -26
  504. package/common/types/secondary-customer.types.ts +0 -66
  505. package/common/types/secondary-issuer.types.ts +0 -50
  506. package/common/types/secondary-order.types.ts +0 -58
  507. package/common/types/secondary-security.types.ts +0 -60
  508. package/common/types/secondary-trade.entity.ts +0 -16
  509. package/common/types/secondary-trade.types.ts +0 -95
  510. package/common/types/secure-request.types.ts +0 -68
  511. package/common/types/signer.types.ts +0 -651
  512. package/common/types/site-link.types.ts +0 -166
  513. package/common/types/site-settings.types.ts +0 -726
  514. package/common/types/site.types.ts +0 -263
  515. package/common/types/sms.types.ts +0 -30
  516. package/common/types/state-machine.types.ts +0 -177
  517. package/common/types/states.types.ts +0 -163
  518. package/common/types/subdoc-preview.types.ts +0 -35
  519. package/common/types/task.types.ts +0 -258
  520. package/common/types/trade-adjustment.type.ts +0 -33
  521. package/common/types/trade-line-item.types.ts +0 -125
  522. package/common/types/trade.types.ts +0 -999
  523. package/common/types/transaction.types.ts +0 -209
  524. package/common/types/trusted-contact.types.ts +0 -122
  525. package/common/types/typography.types.ts +0 -75
  526. package/common/types/user-manual.types.ts +0 -290
  527. package/common/types/user-setting.types.ts +0 -133
  528. package/common/types/user.types.ts +0 -307
  529. package/common/types/webhook.types.ts +0 -588
  530. package/common/types/zip.type.ts +0 -36
  531. package/contracts/clients/accounts/index.ts +0 -61
  532. package/contracts/clients/aic/index.ts +0 -59
  533. package/contracts/clients/api-key-logs/index.ts +0 -53
  534. package/contracts/clients/api-keys/index.ts +0 -73
  535. package/contracts/clients/assets/index.ts +0 -102
  536. package/contracts/clients/auth/index.ts +0 -50
  537. package/contracts/clients/cart/index.ts +0 -80
  538. package/contracts/clients/files/index.ts +0 -166
  539. package/contracts/clients/files-public/index.ts +0 -166
  540. package/contracts/clients/index.ts +0 -54
  541. package/contracts/clients/individuals/index.ts +0 -93
  542. package/contracts/clients/investor-accounts/index.ts +0 -93
  543. package/contracts/clients/issuer-payment-methods/index.ts +0 -39
  544. package/contracts/clients/issuers/index.ts +0 -94
  545. package/contracts/clients/legal-entities/index.ts +0 -93
  546. package/contracts/clients/offerings/index.ts +0 -117
  547. package/contracts/clients/payment-methods/index.ts +0 -85
  548. package/contracts/clients/secure-requests/index.ts +0 -34
  549. package/contracts/clients/sites/index.ts +0 -56
  550. package/contracts/clients/trade-line-items/index.ts +0 -66
  551. package/contracts/clients/trades/index.ts +0 -186
  552. package/contracts/clients/transactions/index.ts +0 -37
  553. package/contracts/compliance/account-contacts/index.ts +0 -82
  554. package/contracts/compliance/account-managers/index.ts +0 -142
  555. package/contracts/compliance/accounts/index.ts +0 -187
  556. package/contracts/compliance/activities/index.ts +0 -55
  557. package/contracts/compliance/aic/index.ts +0 -60
  558. package/contracts/compliance/api-keys/index.ts +0 -91
  559. package/contracts/compliance/assets/index.ts +0 -122
  560. package/contracts/compliance/auth/index.ts +0 -134
  561. package/contracts/compliance/batch-jobs/index.ts +0 -62
  562. package/contracts/compliance/bonus-tiers/index.ts +0 -74
  563. package/contracts/compliance/checklist/index.ts +0 -87
  564. package/contracts/compliance/checklist-items/index.ts +0 -86
  565. package/contracts/compliance/covered-persons/index.ts +0 -97
  566. package/contracts/compliance/dashboard/index.ts +0 -111
  567. package/contracts/compliance/data-records/index.ts +0 -116
  568. package/contracts/compliance/data-rooms/index.ts +0 -113
  569. package/contracts/compliance/default-theme-configs/index.ts +0 -95
  570. package/contracts/compliance/disbursement/index.ts +0 -165
  571. package/contracts/compliance/disbursement-approval-users/index.ts +0 -84
  572. package/contracts/compliance/disbursement-transactions/index.ts +0 -37
  573. package/contracts/compliance/domain-filters/index.ts +0 -117
  574. package/contracts/compliance/email-themes/index.ts +0 -284
  575. package/contracts/compliance/escrow-accounts/index.ts +0 -85
  576. package/contracts/compliance/exchange-api-keys/index.ts +0 -129
  577. package/contracts/compliance/exchange-imports/index.ts +0 -137
  578. package/contracts/compliance/files/index.ts +0 -267
  579. package/contracts/compliance/files-public/index.ts +0 -188
  580. package/contracts/compliance/health/index.ts +0 -26
  581. package/contracts/compliance/index.ts +0 -147
  582. package/contracts/compliance/individuals/index.ts +0 -57
  583. package/contracts/compliance/investor-accounts/index.ts +0 -141
  584. package/contracts/compliance/invites/index.ts +0 -137
  585. package/contracts/compliance/issuer-bank-accounts/index.ts +0 -81
  586. package/contracts/compliance/issuer-payment-methods/index.ts +0 -81
  587. package/contracts/compliance/issuers/index.ts +0 -97
  588. package/contracts/compliance/job-items/index.ts +0 -58
  589. package/contracts/compliance/jobs/index.ts +0 -59
  590. package/contracts/compliance/kyb/index.ts +0 -54
  591. package/contracts/compliance/kyc/index.ts +0 -77
  592. package/contracts/compliance/legal-entities/index.ts +0 -57
  593. package/contracts/compliance/login-histories/index.ts +0 -37
  594. package/contracts/compliance/notes/index.ts +0 -69
  595. package/contracts/compliance/notion-databases/index.ts +0 -107
  596. package/contracts/compliance/notion-pages/index.ts +0 -105
  597. package/contracts/compliance/offering-reports/index.ts +0 -149
  598. package/contracts/compliance/offerings/index.ts +0 -233
  599. package/contracts/compliance/pages/index.ts +0 -178
  600. package/contracts/compliance/payment-methods/index.ts +0 -57
  601. package/contracts/compliance/rejection-reasons/index.ts +0 -32
  602. package/contracts/compliance/review/index.ts +0 -169
  603. package/contracts/compliance/roles/index.ts +0 -34
  604. package/contracts/compliance/secondary-customers/index.ts +0 -77
  605. package/contracts/compliance/secondary-orders/index.ts +0 -60
  606. package/contracts/compliance/secondary-trades/index.ts +0 -100
  607. package/contracts/compliance/secure-requests/index.ts +0 -54
  608. package/contracts/compliance/signer/index.ts +0 -369
  609. package/contracts/compliance/site-links/index.ts +0 -128
  610. package/contracts/compliance/site-settings/index.ts +0 -669
  611. package/contracts/compliance/sites/index.ts +0 -56
  612. package/contracts/compliance/state-machine/index.ts +0 -94
  613. package/contracts/compliance/tasks/index.ts +0 -91
  614. package/contracts/compliance/third-parties/index.ts +0 -52
  615. package/contracts/compliance/trade-line-items/index.ts +0 -59
  616. package/contracts/compliance/trades/index.ts +0 -230
  617. package/contracts/compliance/transactions/index.ts +0 -161
  618. package/contracts/compliance/user-manuals/index.ts +0 -271
  619. package/contracts/compliance/user-settings/index.ts +0 -189
  620. package/contracts/compliance/users/index.ts +0 -221
  621. package/contracts/compliance/webhooks/index.ts +0 -41
  622. package/contracts/compliance-apikey/accounts/index.ts +0 -58
  623. package/contracts/compliance-apikey/index.ts +0 -14
  624. package/contracts/index.ts +0 -6
  625. package/contracts/investors/account-contacts/index.ts +0 -58
  626. package/contracts/investors/aic/index.ts +0 -59
  627. package/contracts/investors/assets/index.ts +0 -61
  628. package/contracts/investors/auth/index.ts +0 -116
  629. package/contracts/investors/bonus-tiers/index.ts +0 -55
  630. package/contracts/investors/cart/index.ts +0 -75
  631. package/contracts/investors/contact-us/index.ts +0 -48
  632. package/contracts/investors/data-records/index.ts +0 -113
  633. package/contracts/investors/data-rooms/index.ts +0 -96
  634. package/contracts/investors/files/index.ts +0 -167
  635. package/contracts/investors/files-public/index.ts +0 -185
  636. package/contracts/investors/index.ts +0 -72
  637. package/contracts/investors/individuals/index.ts +0 -121
  638. package/contracts/investors/investor-accounts/index.ts +0 -110
  639. package/contracts/investors/issuer-payment-methods/index.ts +0 -36
  640. package/contracts/investors/issuers/index.ts +0 -30
  641. package/contracts/investors/legal-entities/index.ts +0 -93
  642. package/contracts/investors/notes/index.ts +0 -69
  643. package/contracts/investors/offerings/index.ts +0 -93
  644. package/contracts/investors/pages/index.ts +0 -88
  645. package/contracts/investors/payment-methods/index.ts +0 -149
  646. package/contracts/investors/portfolios/index.ts +0 -53
  647. package/contracts/investors/sites/index.ts +0 -96
  648. package/contracts/investors/tasks/index.ts +0 -111
  649. package/contracts/investors/trade-line-items/index.ts +0 -75
  650. package/contracts/investors/trades/index.ts +0 -114
  651. package/contracts/investors/transactions/index.ts +0 -37
  652. package/contracts/investors/trusted-contacts/index.ts +0 -93
  653. package/contracts/investors/user-manuals/index.ts +0 -62
  654. package/contracts/investors/user-settings/index.ts +0 -170
  655. package/contracts/investors/users/index.ts +0 -45
  656. package/contracts/investors/webhooks/index.ts +0 -30
  657. package/contracts/issuers/account-contacts/index.ts +0 -76
  658. package/contracts/issuers/account-integrations/index.ts +0 -97
  659. package/contracts/issuers/accounts/index.ts +0 -97
  660. package/contracts/issuers/activities/index.ts +0 -54
  661. package/contracts/issuers/aic/index.ts +0 -39
  662. package/contracts/issuers/api-key-logs/index.ts +0 -53
  663. package/contracts/issuers/api-keys/index.ts +0 -93
  664. package/contracts/issuers/assets/index.ts +0 -122
  665. package/contracts/issuers/auth/index.ts +0 -152
  666. package/contracts/issuers/bonus-tiers/index.ts +0 -73
  667. package/contracts/issuers/contact-us/index.ts +0 -48
  668. package/contracts/issuers/covered-persons/index.ts +0 -136
  669. package/contracts/issuers/dashboard/index.ts +0 -72
  670. package/contracts/issuers/data-records/index.ts +0 -257
  671. package/contracts/issuers/data-rooms/index.ts +0 -134
  672. package/contracts/issuers/disbursement-approval-users/index.ts +0 -82
  673. package/contracts/issuers/disbursement-transactions/index.ts +0 -53
  674. package/contracts/issuers/disbursements/index.ts +0 -189
  675. package/contracts/issuers/email-themes/index.ts +0 -242
  676. package/contracts/issuers/escrow-accounts/index.ts +0 -81
  677. package/contracts/issuers/exchange-api-keys/index.ts +0 -144
  678. package/contracts/issuers/files/index.ts +0 -166
  679. package/contracts/issuers/files-public/index.ts +0 -166
  680. package/contracts/issuers/health/index.ts +0 -24
  681. package/contracts/issuers/index.ts +0 -112
  682. package/contracts/issuers/investor-accounts/index.ts +0 -148
  683. package/contracts/issuers/invites/index.ts +0 -129
  684. package/contracts/issuers/issuer/index.ts +0 -94
  685. package/contracts/issuers/issuer-bank-accounts/index.ts +0 -81
  686. package/contracts/issuers/issuer-payment-methods/index.ts +0 -136
  687. package/contracts/issuers/kyc/index.ts +0 -38
  688. package/contracts/issuers/login-histories/index.ts +0 -51
  689. package/contracts/issuers/notes/index.ts +0 -69
  690. package/contracts/issuers/offerings/index.ts +0 -206
  691. package/contracts/issuers/pages/index.ts +0 -138
  692. package/contracts/issuers/payment-methods/index.ts +0 -61
  693. package/contracts/issuers/portfolios/index.ts +0 -36
  694. package/contracts/issuers/rejection-reasons/index.ts +0 -32
  695. package/contracts/issuers/review/index.ts +0 -63
  696. package/contracts/issuers/secondary-customers/index.ts +0 -55
  697. package/contracts/issuers/secondary-orders/index.ts +0 -57
  698. package/contracts/issuers/secondary-trades/index.ts +0 -57
  699. package/contracts/issuers/secure-requests/index.ts +0 -34
  700. package/contracts/issuers/site-links/index.ts +0 -116
  701. package/contracts/issuers/site-settings/index.ts +0 -585
  702. package/contracts/issuers/sites/index.ts +0 -32
  703. package/contracts/issuers/tasks/index.ts +0 -111
  704. package/contracts/issuers/trades/index.ts +0 -132
  705. package/contracts/issuers/transactions/index.ts +0 -158
  706. package/contracts/issuers/user-manuals/index.ts +0 -62
  707. package/contracts/issuers/user-settings/index.ts +0 -170
  708. package/contracts/issuers/users/index.ts +0 -126
  709. package/contracts/secondaries/accounts/index.ts +0 -58
  710. package/contracts/secondaries/index.ts +0 -23
  711. package/contracts/secondaries/secondary-customers/index.ts +0 -55
  712. package/contracts/secondaries/secondary-issuers/index.ts +0 -94
  713. package/contracts/secondaries/secondary-orders/index.ts +0 -56
  714. package/contracts/secondaries/secondary-securities/index.ts +0 -95
  715. package/contracts/secondaries/secondary-trades/index.ts +0 -56
  716. /package/common/types/{investorAccountIdSchema.type.ts → investorAccountIdSchema.type.d.ts} +0 -0
@@ -1,1530 +0,0 @@
1
- import { extendZodWithOpenApi } from '@anatine/zod-openapi';
2
- import { IBaseEntity } from './entity.types';
3
- import { z } from 'zod';
4
- import { TypeID } from 'typeid-js';
5
- import { ErrorHttpStatusCode } from '@ts-rest/core';
6
- import { TwoFactorMethod } from './sms.types';
7
- import { normalizeShortDate } from '../helpers';
8
- import { HttpStatus } from '@nestjs/common';
9
-
10
- extendZodWithOpenApi(z);
11
-
12
- // All possible statuses for the system
13
- export enum BaseStatus {
14
- NEEDS_REVIEW = 'NEEDS_REVIEW',
15
- PENDING = 'PENDING',
16
- APPROVED = 'APPROVED',
17
- REJECTED = 'REJECTED',
18
- IN_REVIEW = 'IN_REVIEW',
19
- ADDITIONAL_INFO = 'ADDITIONAL_INFO',
20
- SUBMITTED = 'SUBMITTED',
21
- IN_PROGRESS = 'IN_PROGRESS',
22
- CANCELLED = 'CANCELLED',
23
- SETTLED = 'SETTLED',
24
- REFUNDED = 'REFUNDED',
25
- RESUBMIT = 'RESUBMIT',
26
- FUNDED = 'FUNDED',
27
- COMPLETED = 'COMPLETED',
28
- SIGNED = 'SIGNED',
29
- DECLINED = 'DECLINED',
30
- CART = 'CART',
31
- PLACED = 'PLACED',
32
- NEEDS_INFO = 'NEEDS_INFO',
33
- NEEDS_PAYMENT_INFO = 'NEEDS_PAYMENT_INFO',
34
- FUNDING = 'FUNDING',
35
- CHARGED = 'CHARGED',
36
- NEW = 'NEW',
37
- IMPORT_ERROR = 'IMPORT_ERROR',
38
- ERROR = 'ERROR',
39
- UPDATE_PAYMENT_METHOD = 'UPDATE_PAYMENT_METHOD',
40
- RE_SIGN = 'RE_SIGN',
41
- RESET_2FA = 'RESET_2FA',
42
- FORGOT_PASSWORD = 'FORGOT_PASSWORD',
43
- RESET_PASSWORD = 'RESET_PASSWORD',
44
- TWO_FACTOR_LOGIN = 'TWO_FACTOR_LOGIN',
45
- LOGIN = 'LOGIN',
46
- FAILED = 'FAILED',
47
- AUTHORIZING = 'AUTHORIZING',
48
- VALID = 'VALID',
49
- DELETED = 'DELETED',
50
- REVOKED = 'REVOKED',
51
- WARNING = 'WARNING',
52
- READY_TO_APPROVE = 'READY_TO_APPROVE',
53
- INCOMPLETE = 'INCOMPLETE',
54
- RE_PROCESS = 'RE_PROCESS',
55
- INVALID = 'INVALID',
56
- NOT_PROCESSED = 'NOT_PROCESSED',
57
- PROCESSING = 'PROCESSING',
58
- PROCESSING_ERROR = 'PROCESSING_ERROR',
59
- REVIEW_ERROR = 'REVIEW_ERROR',
60
- PROCESSED = 'PROCESSED',
61
- SAVE = 'SAVE',
62
- ACCEPTED = 'ACCEPTED',
63
- ONBOARDING = 'ONBOARDING',
64
- LIVE = 'LIVE',
65
- OVERDUE = 'OVERDUE',
66
- SUSPENDED = 'SUSPENDED',
67
- INACTIVE = 'INACTIVE',
68
- PARTIALLY_REFUNDED = 'PARTIALLY_REFUNDED',
69
- VOIDED = 'VOIDED',
70
- JOIN = 'JOIN',
71
- RESTORE = 'RESTORE',
72
- }
73
-
74
- export const UserWithoutPasswordAccountZod = IBaseEntity.extend({
75
- firstName: z.string().openapi({ example: 'Daniel' }),
76
- lastName: z.string().openapi({ example: 'Ice' }),
77
- email: z.string().email().openapi({ example: 'test@test.com' }),
78
- provider: z.string().openapi({ example: 'email' }),
79
- active: z.boolean().openapi({ example: true }),
80
- lastLoginAt: z.date().nullable().openapi({ example: new Date() }),
81
- loginCount: z.number().openapi({ example: 1 }),
82
- inviteId: z
83
- .string()
84
- .nullable()
85
- .openapi({ example: 'invite_01j1xgme5mfrasd02hmfwsy13a' }),
86
- accountId: z
87
- .string()
88
- .nullable()
89
- .openapi({ example: 'account_01j1xgme5mfrasd02hmfwsy13a' }),
90
- });
91
- export type UserWithoutPasswordAccountZod = z.infer<
92
- typeof UserWithoutPasswordAccountZod
93
- >;
94
- export enum ManagedByType {
95
- DALMORE = 'DALMORE',
96
- ISSUER = 'ISSUER',
97
- }
98
-
99
- export enum Platform {
100
- DALMORE = 'DALMORE',
101
- INTEGRATION = 'INTEGRATION',
102
- }
103
-
104
- export enum HttpMethod {
105
- GET = 'GET',
106
- POST = 'POST',
107
- PUT = 'PUT',
108
- PATCH = 'PATCH',
109
- DELETE = 'DELETE',
110
- HEAD = 'HEAD',
111
- OPTIONS = 'OPTIONS',
112
- }
113
-
114
- export enum UserStatus {
115
- ACTIVE = 'ACTIVE',
116
- LOCKED = 'LOCKED',
117
- }
118
- export const SENSITIVE_PATTERNS = [
119
- /password/i,
120
- /credit.*card/i,
121
- /ssn/i,
122
- /social.*security/i,
123
- /token/i,
124
- /access.*token/i,
125
- /code/i,
126
- /apiKey/i,
127
- /key/i,
128
- /stripeSecretKey/i,
129
- /usAccountNumber/i,
130
- /recoveryCodes/i,
131
- /totpSecret/i,
132
- /totpTemporarySecret/i,
133
- /smsVerificationCode/i,
134
- ];
135
-
136
- export enum AccountStatus {
137
- ONBOARDING = BaseStatus.ONBOARDING,
138
- LIVE = BaseStatus.LIVE,
139
- OVERDUE = BaseStatus.OVERDUE,
140
- SUSPENDED = BaseStatus.SUSPENDED,
141
- INACTIVE = BaseStatus.INACTIVE,
142
- }
143
- // CHANGES TO THIS WILL REQUIRE:
144
- // - Migrations to update the database
145
- // - Update to createDefaultIssuerPaymentMethods
146
- // - Update to existing issuers payment methods, see UpdateIssuerPaymentMethod1755035846643
147
- // - Updates to TradeFundingTransitionWorker
148
- export enum PaymentMethodType {
149
- CREDIT_CARD = 'CREDIT_CARD',
150
- WIRE = 'WIRE',
151
- ACH = 'ACH',
152
- BANK_ACCOUNT = 'BANK_ACCOUNT',
153
- CHECK = 'CHECK',
154
- RETIREMENT = 'RETIREMENT',
155
- }
156
-
157
- export const AccountZod = IBaseEntity.extend({
158
- name: z.string().openapi({ example: 'Dalmore' }),
159
- status: z.nativeEnum(AccountStatus).openapi({ example: AccountStatus.LIVE }),
160
- managedBy: z
161
- .nativeEnum(ManagedByType)
162
- .nullable()
163
- .openapi({ example: ManagedByType.DALMORE }),
164
- platform: z.nativeEnum(Platform).openapi({ example: Platform.INTEGRATION }),
165
- onboardingReviewerId: z
166
- .string()
167
- .nullable()
168
- .openapi({ example: 'user_01j1xgme5mfrasd02hmfwsy13a' }),
169
- onboardingReviewAt: z.date().nullable(),
170
- allowPendingComplianceReview: z.boolean().openapi({ example: false }),
171
- });
172
- export type AccountZod = z.infer<typeof AccountZod>;
173
-
174
- export const AccountWithoutUsersZod = IBaseEntity.extend({
175
- name: z.string().openapi({ example: 'Dalmore' }),
176
- status: z.nativeEnum(AccountStatus).openapi({ example: AccountStatus.LIVE }),
177
- managedBy: z
178
- .nativeEnum(ManagedByType)
179
- .nullable()
180
- .openapi({ example: ManagedByType.DALMORE }),
181
- platform: z.nativeEnum(Platform).openapi({ example: Platform.INTEGRATION }),
182
- onboardingReviewerId: z
183
- .string()
184
- .nullable()
185
- .openapi({ example: 'user_01j1xgme5mfrasd02hmfwsy13a' }),
186
- onboardingReviewAt: z.date().nullable(),
187
- allowPendingComplianceReview: z.boolean().openapi({ example: false }),
188
- });
189
- export type AccountWithoutUsersZod = z.infer<typeof AccountWithoutUsersZod>;
190
-
191
- export enum PortalType {
192
- COMPLIANCE = 'COMPLIANCE',
193
- ISSUER = 'ISSUER',
194
- INVESTOR = 'INVESTOR',
195
- CLIENT = 'CLIENT',
196
- SECONDARIES = 'SECONDARIES',
197
- COMPLIANCE_APIKEY = 'COMPLIANCE_APIKEY',
198
- }
199
-
200
- export enum UserType {
201
- USER = 'USER',
202
- LEAD = 'LEAD',
203
- INVESTOR = 'INVESTOR',
204
- DEMO = 'DEMO',
205
- }
206
-
207
- export enum UserRole {
208
- API_KEY = 'API_KEY',
209
- IMPORT = 'IMPORT',
210
- VIEWER = 'VIEWER',
211
- SUPPORT = 'SUPPORT',
212
- COMPLIANCE = 'COMPLIANCE',
213
- ADMIN = 'ADMIN',
214
- MARKETER = 'MARKETER',
215
- OWNER = 'OWNER',
216
- LEGAL = 'LEGAL',
217
- COMMUNITY_MANAGER = 'COMMUNITY_MANAGER',
218
- ESCROW_AGENT = 'ESCROW_AGENT',
219
- AGENT = 'AGENT',
220
- ONBOARDING = 'ONBOARDING',
221
- }
222
- export enum IssuerRole {
223
- VIEWER = 'VIEWER',
224
- OWNER = 'OWNER',
225
- MARKETER = 'MARKETER',
226
- LEGAL = 'LEGAL',
227
- COMMUNITY_MANAGER = 'COMMUNITY_MANAGER',
228
- COMPLIANCE = 'COMPLIANCE',
229
- ADMIN = 'ADMIN',
230
- SUPPORT = 'SUPPORT',
231
- }
232
-
233
- export enum FileContainerType {
234
- SITE = 'SITE',
235
- PRIVATE = 'PRIVATE',
236
- PUBLIC = 'PUBLIC',
237
- ASSET = 'ASSET',
238
- }
239
- export enum UserDataType {
240
- LIVE = 'LIVE',
241
- TEST = 'TEST',
242
- }
243
- // Base interface for role hierarchies
244
- interface RoleHierarchy {
245
- type: PortalType;
246
- roles: string[];
247
- }
248
-
249
- export enum AccountContactType {
250
- GENERAL = 'GENERAL',
251
- INVESTOR = 'INVESTOR',
252
- ISSUER = 'ISSUER',
253
- }
254
-
255
- // Configuration for portals and their roles - in order of hierarchy
256
- export const PortalConfig: Record<PortalType, RoleHierarchy> = {
257
- // JWT AUTH
258
- [PortalType.COMPLIANCE]: {
259
- type: PortalType.COMPLIANCE,
260
- roles: [
261
- UserRole.IMPORT,
262
- UserRole.VIEWER,
263
- UserRole.SUPPORT,
264
- UserRole.COMPLIANCE,
265
- UserRole.ADMIN,
266
- ],
267
- },
268
- [PortalType.ISSUER]: {
269
- type: PortalType.ISSUER,
270
- roles: [UserRole.MARKETER, UserRole.OWNER],
271
- },
272
- [PortalType.INVESTOR]: {
273
- type: PortalType.INVESTOR,
274
- roles: [UserRole.VIEWER, UserRole.OWNER],
275
- },
276
- // API KEY AUTH
277
- [PortalType.CLIENT]: {
278
- type: PortalType.CLIENT,
279
- roles: [UserRole.API_KEY],
280
- },
281
- [PortalType.SECONDARIES]: {
282
- type: PortalType.SECONDARIES,
283
- roles: [UserRole.API_KEY],
284
- },
285
- [PortalType.COMPLIANCE_APIKEY]: {
286
- type: PortalType.COMPLIANCE_APIKEY,
287
- roles: [UserRole.API_KEY],
288
- },
289
- };
290
-
291
- export const BaseAuthReq = z.object({
292
- id: z.string(),
293
- accountId: z.string(),
294
- isInactiveAccount: z.boolean(),
295
- active: z.boolean(),
296
- role: z.nativeEnum(UserRole),
297
- type: z.nativeEnum(PortalType),
298
- roleId: z.string(),
299
- });
300
-
301
- // Regular user type extending base
302
- export const AuthUserReq = BaseAuthReq.extend({
303
- userLoginId: z.string(),
304
- firstName: z.string(),
305
- lastName: z.string(),
306
- email: z.string().email(),
307
- provider: z.string(),
308
- locked: z.boolean(),
309
- lastLoginAt: z.date().nullable(),
310
- loginCount: z.number(),
311
- requiresTwoFactorSetup: z.boolean().optional(),
312
- twoFactorEnabled: z.boolean().optional(),
313
- twoFactorMethod: z.nativeEnum(TwoFactorMethod).optional(),
314
- managedBy: z.nativeEnum(ManagedByType).optional(),
315
- userType: z.nativeEnum(UserType).optional(),
316
- });
317
-
318
- // API key type extending base
319
- export const AuthApiKeyReq = BaseAuthReq.extend({
320
- name: z.string(),
321
- description: z.string().nullable(),
322
- lastUsedAt: z.date().nullable(),
323
- });
324
-
325
- export type BaseAuthReq = z.infer<typeof BaseAuthReq>;
326
- export type AuthUserReq = z.infer<typeof AuthUserReq>;
327
- export type AuthApiKeyReq = z.infer<typeof AuthApiKeyReq>;
328
-
329
- export const UserWithoutPasswordZod = IBaseEntity.extend({
330
- firstName: z.string().openapi({ example: 'Daniel' }),
331
- lastName: z.string().openapi({ example: 'Ice' }),
332
- email: z.string().email().openapi({ example: 'test@test.com' }),
333
- provider: z.string().openapi({ example: 'email' }),
334
- active: z.boolean().openapi({ example: true }),
335
- lastLoginAt: z.date().nullable().openapi({ example: new Date() }),
336
- loginCount: z.number().openapi({ example: 1 }),
337
- inviteId: z
338
- .string()
339
- .nullable()
340
- .openapi({ example: 'invite_01j1xgme5mfrasd02hmfwsy13a' }),
341
- accountId: z
342
- .string()
343
- .nullable()
344
- .openapi({ example: 'account_01j1xgme5mfrasd02hmfwsy13a' }),
345
- account: AccountWithoutUsersZod.optional(),
346
- });
347
- export type UserWithoutPasswordZod = z.infer<typeof UserWithoutPasswordZod>;
348
-
349
- export type ErrorResult = {
350
- status: ErrorHttpStatusCode;
351
- message: string;
352
- };
353
-
354
- export type ExtendedErrorResult = ErrorResult & {
355
- errors?: ErrorResponseZod;
356
- };
357
-
358
- export const IPaginationMeta = z.object({
359
- itemCount: z.number().openapi({ example: 1 }),
360
- totalItems: z.number().optional().openapi({ example: 10 }),
361
- itemsPerPage: z.number().openapi({ example: 1 }),
362
- totalPages: z.number().optional().openapi({ example: 10 }),
363
- currentPage: z.number().openapi({ example: 1 }),
364
- });
365
- export type IPaginationMeta = z.infer<typeof IPaginationMeta>;
366
-
367
- export const PaginationOptionsZod = z.object({
368
- page: z.coerce
369
- .number()
370
- .transform((val) => (val === 0 ? 1 : val))
371
- .optional()
372
- .default(1),
373
- limit: z.coerce
374
- .number()
375
- .transform((val) => (val === 0 ? 10 : val))
376
- .optional()
377
- .default(10),
378
- });
379
- export type PaginationOptionsZod = z.infer<typeof PaginationOptionsZod>;
380
-
381
- export interface IPaginationOptions
382
- extends z.infer<typeof PaginationOptionsZod> {}
383
-
384
- // The base action types for the system
385
- export enum BaseAction {
386
- CREATE = 'CREATE',
387
- READ = 'READ',
388
- UPDATE = 'UPDATE',
389
- DELETE = 'DELETE',
390
- IMPORT = 'IMPORT',
391
- }
392
-
393
- export enum KYCStatus {
394
- NEEDS_REVIEW = BaseStatus.NEEDS_REVIEW,
395
- PENDING = BaseStatus.PENDING,
396
- APPROVED = BaseStatus.APPROVED,
397
- REJECTED = BaseStatus.REJECTED,
398
- CANCELLED = BaseStatus.CANCELLED,
399
- RESUBMIT = BaseStatus.RESUBMIT,
400
- ERROR = BaseStatus.ERROR,
401
- }
402
- export enum AMLStatus {
403
- NEEDS_REVIEW = BaseStatus.NEEDS_REVIEW,
404
- PENDING = BaseStatus.PENDING,
405
- APPROVED = BaseStatus.APPROVED,
406
- REJECTED = BaseStatus.REJECTED,
407
- ERROR = BaseStatus.ERROR,
408
- }
409
-
410
- export enum AicStatus {
411
- NEEDS_REVIEW = BaseStatus.NEEDS_REVIEW,
412
- PENDING = BaseStatus.PENDING,
413
- APPROVED = BaseStatus.APPROVED,
414
- REJECTED = BaseStatus.REJECTED,
415
- PROCESSED = BaseStatus.PROCESSED,
416
- }
417
- export enum IssuerStatus {
418
- REJECTED = BaseStatus.REJECTED,
419
- IN_REVIEW = BaseStatus.IN_REVIEW,
420
- ADDITIONAL_INFO = BaseStatus.ADDITIONAL_INFO,
421
- SUBMITTED = BaseStatus.SUBMITTED,
422
- IN_PROGRESS = BaseStatus.IN_PROGRESS,
423
- APPROVED = BaseStatus.APPROVED,
424
- }
425
-
426
- export enum KYBStatus {
427
- NEEDS_REVIEW = BaseStatus.NEEDS_REVIEW,
428
- PENDING = BaseStatus.PENDING,
429
- APPROVED = BaseStatus.APPROVED,
430
- REJECTED = BaseStatus.REJECTED,
431
- }
432
-
433
- export enum SanctionsStatus {
434
- NEEDS_REVIEW = BaseStatus.NEEDS_REVIEW,
435
- PENDING = BaseStatus.PENDING,
436
- APPROVED = BaseStatus.APPROVED,
437
- REJECTED = BaseStatus.REJECTED,
438
- }
439
-
440
- export enum FundingStatus {
441
- PENDING = BaseStatus.PENDING,
442
- CANCELLED = BaseStatus.CANCELLED,
443
- SETTLED = BaseStatus.SETTLED,
444
- REFUNDED = BaseStatus.REFUNDED,
445
- DECLINED = BaseStatus.DECLINED,
446
- FUNDING = BaseStatus.FUNDING,
447
- AUTHORIZING = BaseStatus.AUTHORIZING,
448
- FAILED = BaseStatus.FAILED,
449
- }
450
-
451
- export enum TxnCheck {
452
- PENDING = BaseStatus.PENDING,
453
- NEEDS_REVIEW = BaseStatus.NEEDS_REVIEW,
454
- APPROVED = BaseStatus.APPROVED,
455
- REJECTED = BaseStatus.REJECTED,
456
- }
457
-
458
- export enum ApprovalStatus {
459
- PENDING = BaseStatus.PENDING,
460
- FUNDED = BaseStatus.FUNDED,
461
- APPROVED = BaseStatus.APPROVED,
462
- REJECTED = BaseStatus.REJECTED,
463
- REFUNDED = BaseStatus.REFUNDED,
464
- }
465
-
466
- export enum IraCheck {
467
- PENDING = BaseStatus.PENDING,
468
- APPROVED = BaseStatus.APPROVED,
469
- NEEDS_REVIEW = BaseStatus.NEEDS_REVIEW,
470
- REJECTED = BaseStatus.REJECTED,
471
- }
472
-
473
- export enum CoveredPersonsStatus {
474
- REJECTED = BaseStatus.REJECTED,
475
- IN_REVIEW = BaseStatus.IN_REVIEW,
476
- IN_PROGRESS = BaseStatus.IN_PROGRESS,
477
- COMPLETED = BaseStatus.COMPLETED,
478
- }
479
-
480
- export enum ComplianceReview {
481
- PENDING = BaseStatus.PENDING,
482
- APPROVED = BaseStatus.APPROVED,
483
- REJECTED = BaseStatus.REJECTED,
484
- NEEDS_REVIEW = BaseStatus.NEEDS_REVIEW,
485
- CANCELLED = BaseStatus.CANCELLED,
486
- READY_TO_APPROVE = BaseStatus.READY_TO_APPROVE,
487
- }
488
-
489
- export enum KYCDocumentType {
490
- PASSPORT = 'PASSPORT',
491
- DRIVER_LICENSE = 'DRIVER_LICENSE',
492
- STATE_ID = 'STATE_ID',
493
- }
494
-
495
- export enum InvestmentType {
496
- INDIVIDUAL = 'INDIVIDUAL',
497
- JOINT = 'JOINT',
498
- ENTITY = 'ENTITY',
499
- }
500
-
501
- export enum AicAccreditationType {
502
- PENDING = 'PENDING',
503
- INCOME = 'INCOME',
504
- NET_WORTH = 'NET_WORTH',
505
- PROFESSIONAL_CERTIFICATION = 'PROFESSIONAL_CERTIFICATION',
506
- KNOWLEDGEABLE_EMPLOYEE = 'KNOWLEDGEABLE_EMPLOYEE',
507
- }
508
-
509
- export enum InvestorAccountType {
510
- INDIVIDUAL = 'INDIVIDUAL',
511
- JOINT = 'JOINT',
512
- RETIREMENT = 'RETIREMENT',
513
- LEGAL_ENTITY = 'LEGAL_ENTITY',
514
- }
515
-
516
- export enum SetupStatusType {
517
- IN_PROGRESS = 'IN_PROGRESS',
518
- COMPLETE = 'COMPLETE',
519
- }
520
-
521
- export enum SetupStepType {
522
- NEW = 'NEW',
523
- PERSONAL_INFO = 'PERSONAL_INFO',
524
- ADDRESS = 'ADDRESS',
525
- KYC = 'KYC',
526
- INCOME = 'INCOME',
527
- AIC_QUESTIONS = 'AIC_QUESTIONS',
528
- AIC_FILES = 'AIC_FILES',
529
- }
530
-
531
- export enum OfferingType {
532
- REG_A = 'REG_A',
533
- REG_CF = 'REG_CF',
534
- REG_D = 'REG_D',
535
- S1 = 'S1',
536
- EXCHANGE_NOTE = 'EXCHANGE_NOTE',
537
- }
538
-
539
- export enum AssetType {
540
- BOND = 'BOND',
541
- STOCK = 'STOCK',
542
- }
543
-
544
- export enum AdjustmentType {
545
- CREDIT_CARD_FEES = 'CREDIT_CARD_FEES',
546
- SERVICE_CHARGES = 'SERVICE_CHARGES',
547
- SUBSCRIPTION_DISCOUNT = 'SUBSCRIPTION_DISCOUNT',
548
- }
549
-
550
- export enum SignatureStatus {
551
- PENDING = BaseStatus.PENDING,
552
- SIGNED = BaseStatus.SIGNED,
553
- DECLINED = BaseStatus.DECLINED,
554
- NEEDS_REVIEW = BaseStatus.NEEDS_REVIEW,
555
- RE_SIGN = BaseStatus.RE_SIGN,
556
- }
557
-
558
- export enum TemplateType {
559
- INDIVIDUAL = 'INDIVIDUAL',
560
- JOINT = 'JOINT',
561
- ENTITY = 'ENTITY',
562
- RETIREMENT = 'RETIREMENT',
563
- GENERAL = 'GENERAL',
564
- }
565
-
566
- export enum TemplateStatus {
567
- PENDING = BaseStatus.PENDING,
568
- VALID = BaseStatus.VALID,
569
- ERROR = BaseStatus.ERROR,
570
- }
571
-
572
- export enum SenderIdentityStatus {
573
- PENDING = BaseStatus.PENDING,
574
- APPROVED = BaseStatus.APPROVED,
575
- REJECTED = BaseStatus.DECLINED,
576
- DELETED = BaseStatus.DELETED,
577
- REVOKED = BaseStatus.REVOKED,
578
- }
579
-
580
- export enum DurationType {
581
- DAY = 'DAYS',
582
- WEEK = 'WEEKS',
583
- MONTH = 'MONTHS',
584
- YEAR = 'YEARS',
585
- }
586
- export enum CoveredPersonsRoleType {
587
- ENTITY = 'ENTITY',
588
- BOARD_MEMBER = 'BOARD_MEMBER',
589
- ADVISOR = 'ADVISOR',
590
- CEO = 'CEO',
591
- CFO = 'CFO',
592
- ACCOUNTING = 'ACCOUNTING',
593
- CPA = 'CPA',
594
- LEGAL = 'LEGAL',
595
- EXECUTIVE = 'EXECUTIVE',
596
- EMPLOYEE = 'EMPLOYEE',
597
- INVESTOR = 'INVESTOR',
598
- PROMOTER = 'PROMOTER',
599
- OWNER = 'OWNER',
600
- AFFILIATED = 'AFFILIATED',
601
- }
602
- export enum IDType {
603
- PASSPORT = 'PASSPORT',
604
- DRIVERS_LICENSE = 'DRIVERS_LICENSE',
605
- }
606
- export enum CoveredPersonType {
607
- CHILD = 'CHILD',
608
- PARENT = 'PARENT',
609
- }
610
-
611
- export enum CoveredPersonFileLabels {
612
- IDENTITY_FRONT = 'IDENTITY_FRONT',
613
- IDENTITY_BACK = 'IDENTITY_BACK',
614
- BAD_ACTOR_REPORT_FILE = 'BAD_ACTOR_REPORT_FILE',
615
- }
616
-
617
- export enum IdentityFileLabels {
618
- IDENTITY_FRONT = 'IDENTITY_FRONT',
619
- IDENTITY_BACK = 'IDENTITY_BACK',
620
- PASSPORT = 'PASSPORT',
621
- }
622
-
623
- export enum IssuerFileLabels {
624
- SS4_LETTER = 'SS4_LETTER',
625
- FORMATION_DOCUMENT = 'FORMATION_DOCUMENT',
626
- COVER_ART = 'COVER_ART',
627
- }
628
-
629
- export enum OfferingFileLabels {
630
- MEMORANDUM = 'MEMORANDUM',
631
- SUBSCRIPTION_AGREEMENT = 'SUBSCRIPTION_AGREEMENT',
632
- COVER_ART = 'COVER_ART',
633
- }
634
- export enum SiteBrandingFileLabels {
635
- LOGO = 'LOGO',
636
- FAVICON = 'FAVICON',
637
- BACKGROUND_IMAGE = 'BACKGROUND_IMAGE',
638
- }
639
-
640
- export enum TradeFileLables {
641
- TRADE_DOCUMENT = 'TRADE_DOCUMENT',
642
- }
643
-
644
- export enum RetirementFileLabels {
645
- CUSTODIAN_INSTRUCTION_DOCUMENT = 'CUSTODIAN_INSTRUCTION_DOCUMENT',
646
- }
647
- export enum AccreditationFileLabels {
648
- PROOF_OF_INCOME = 'PROOF_OF_INCOME',
649
- PROOF_OF_NET_WORTH = 'PROOF_OF_NET_WORTH',
650
- EMPLOYEE = 'EMPLOYEE',
651
- TAX_RETURNS = 'TAX_RETURNS',
652
- ACCOUNT_STATEMENT = 'ACCOUNT_STATEMENT',
653
- ACCREDITATION_LETTER = 'ACCREDITATION_LETTER',
654
- LICENSE = 'LICENSE',
655
- }
656
-
657
- export enum OtherFileLabels {
658
- OTHER = 'OTHER',
659
- COMPLIANCE_REQUEST = 'COMPLIANCE_REQUEST',
660
- SUB_DOC = 'SUB_DOC',
661
- }
662
-
663
- export const FileLabels = {
664
- ...AccreditationFileLabels,
665
- ...CoveredPersonFileLabels,
666
- ...OtherFileLabels,
667
- ...RetirementFileLabels,
668
- ...SiteBrandingFileLabels,
669
- ...OfferingFileLabels,
670
- ...IssuerFileLabels,
671
- ...IdentityFileLabels,
672
- ...TradeFileLables,
673
- } as const;
674
-
675
- export type FileLabels = (typeof FileLabels)[keyof typeof FileLabels];
676
- export const FileLabelsEnum = z.enum(
677
- Object.values(FileLabels) as [string, ...string[]],
678
- );
679
-
680
- export enum TradeType {
681
- PURCHASE = 'PURCHASE',
682
- CONVERSION = 'CONVERSION',
683
- TRANSFER = 'TRANSFER',
684
- }
685
- export enum TradeStatus {
686
- CART = BaseStatus.CART,
687
- PLACED = BaseStatus.PLACED,
688
- IN_REVIEW = BaseStatus.IN_REVIEW,
689
- NEEDS_INFO = BaseStatus.NEEDS_INFO,
690
- NEEDS_PAYMENT_INFO = BaseStatus.NEEDS_PAYMENT_INFO,
691
- FUNDING = BaseStatus.FUNDING,
692
- CANCELLED = BaseStatus.CANCELLED,
693
- SETTLED = BaseStatus.SETTLED,
694
- IMPORT_ERROR = BaseStatus.IMPORT_ERROR,
695
- ERROR = BaseStatus.ERROR,
696
- UPDATE_PAYMENT_METHOD = BaseStatus.UPDATE_PAYMENT_METHOD,
697
- }
698
-
699
- export enum SavedQuery {
700
- ERROR_REPORT = 'ERROR_REPORT',
701
- STUCK_TRADES = 'STUCK_TRADES',
702
- }
703
-
704
- export enum SystemReviewLogTrigger {
705
- AML_STATUS_UPDATE = 'AML_STATUS_UPDATE',
706
- AIC_STATUS_UPDATE = 'AIC_STATUS_UPDATE',
707
- INDIVIDUAL_UPDATE = 'INDIVIDUAL_UPDATE',
708
- TRADE_STATUS_UPDATE = 'TRADE_STATUS_UPDATE',
709
- KYC_STATUS_UPDATE = 'KYC_STATUS_UPDATE',
710
- SUBDOC_STATUS_UPDATE = 'SUBDOC_STATUS_UPDATE',
711
- VALIDATE_PLACED_TRADES_WORKER = 'VALIDATE_PLACED_TRADES_WORKER',
712
- }
713
-
714
- export enum OfferingOnboardingStatus {
715
- IN_REVIEW = BaseStatus.IN_REVIEW,
716
- COMPLETE = BaseStatus.COMPLETED,
717
- }
718
-
719
- export enum ExchangeProvider {
720
- PPEX = 'PPEX',
721
- PHOENIX = 'PHOENIX',
722
- NORTHCAP = 'NORTHCAP',
723
- }
724
-
725
- export enum RunnerType {
726
- WORKER = 'WORKER',
727
- PIPELINE = 'PIPELINE',
728
- }
729
- export enum PublicDataType {
730
- DATA_ROOM = 'DATA_ROOM',
731
- PAGE = 'PAGE',
732
- OFFERING = 'OFFERING',
733
- }
734
-
735
- export enum TrustedContactRelationship {
736
- SIBLING = 'SIBLING',
737
- GUARDIAN = 'GUARDIAN',
738
- CHILD = 'CHILD',
739
- FRIEND = 'FRIEND',
740
- OTHER = 'OTHER',
741
- }
742
- export enum FileStatus {
743
- PENDING = BaseStatus.PENDING,
744
- ERROR = BaseStatus.ERROR,
745
- VALID = BaseStatus.VALID,
746
- INVALID = BaseStatus.INVALID,
747
- NOT_PROCESSED = BaseStatus.NOT_PROCESSED,
748
- PROCESSING = BaseStatus.PROCESSING,
749
- PROCESSING_ERROR = BaseStatus.PROCESSING_ERROR,
750
- REVIEW_ERROR = BaseStatus.REVIEW_ERROR,
751
- PROCESSED = BaseStatus.PROCESSED,
752
- }
753
- export enum SystemReviewStatus {
754
- PENDING = BaseStatus.PENDING,
755
- NEEDS_INFO = BaseStatus.NEEDS_INFO,
756
- READY_TO_APPROVE = BaseStatus.READY_TO_APPROVE,
757
- NEEDS_REVIEW = BaseStatus.NEEDS_REVIEW,
758
- APPROVED = BaseStatus.APPROVED,
759
- REJECTED = BaseStatus.REJECTED,
760
- }
761
-
762
- export enum FilingStatus {
763
- SINGLE = 'SINGLE',
764
- JOINT = 'JOINT',
765
- }
766
- export enum AccountType {
767
- CHECKING = 'CHECKING',
768
- SAVINGS = 'SAVINGS',
769
- BROKERAGE = 'BROKERAGE',
770
- REAL_ESTATE = 'REAL_ESTATE',
771
- OTHER = 'OTHER',
772
- }
773
- export enum SourceOfIncome {
774
- EMPLOYED = 'EMPLOYED',
775
- SELF_EMPLOYED = 'SELF_EMPLOYED',
776
- UNEMPLOYED = 'UNEMPLOYED',
777
- RETIREMENT = 'RETIREMENT',
778
- STUDENT = 'STUDENT',
779
- }
780
-
781
- export enum DateField {
782
- RAW_ORDER_CREATED_DATE = 'rawOrder.createdDate',
783
- RAW_TRADE_CREATED_DATE = 'rawTrade.createdDate',
784
- CREATED_AT = 'createdAt',
785
- }
786
-
787
- export const DateFieldMap = {
788
- [DateField.RAW_ORDER_CREATED_DATE]: "raw_order_data->>'createdDate'",
789
- [DateField.RAW_TRADE_CREATED_DATE]: "raw_trade_data->>'createdDate'",
790
- [DateField.CREATED_AT]: 'entity.createdAt',
791
- };
792
-
793
- /**
794
- * Event fields represent database entity columns that can be changed using status.changed events.
795
- * These enum values correspond to actual column names in various database entities
796
- * and are used to track field-level changes in the system's activity logging.
797
- */
798
- export enum EventField {
799
- STATUS = 'status',
800
- TRADE_STATUS = 'tradeStatus',
801
- FUNDING_STATUS = 'fundingStatus',
802
- COMPLIANCE_REVIEW = 'complianceReview',
803
- SYSTEM_REVIEW_CHECK = 'systemReviewCheck',
804
- SYSTEM_REVIEW = 'systemReview',
805
- KYC_STATUS = 'kycStatus',
806
- AML_STATUS = 'amlStatus',
807
- AIC_STATUS = 'aicStatus',
808
- SA_STATUS = 'saStatus',
809
- ONBOARDING_STATUS = 'onboardingStatus',
810
- TRANSACTION_STATUS = 'transactionStatus',
811
- }
812
-
813
- export enum EventName {
814
- STATUS_CHANGED = 'status.changed',
815
- UPDATE_FIELD = 'update.field',
816
- ACTION_PERFORMED = 'action.performed',
817
- PENDING_OVERDUE_TRADES_ALERT = 'pending_overdue.trades.alert',
818
- IN_REVIEW_TRADES_ALERT = 'trade.inreview.alert',
819
- INDIVIDUAL_AML_STATUS_CHANGED = 'individual.aml_status.changed',
820
- }
821
-
822
- // pending charged settled refunded cancelled
823
- export enum TransactionStatus {
824
- PENDING = BaseStatus.PENDING,
825
- CHARGED = BaseStatus.CHARGED,
826
- APPROVED = BaseStatus.APPROVED,
827
- SETTLED = BaseStatus.SETTLED,
828
- REFUNDED = BaseStatus.REFUNDED,
829
- CANCELLED = BaseStatus.CANCELLED,
830
- DECLINED = BaseStatus.DECLINED,
831
- FAILED = BaseStatus.FAILED,
832
- AUTHORIZING = BaseStatus.AUTHORIZING,
833
- FUNDING = BaseStatus.FUNDING,
834
- PARTIALLY_REFUNDED = BaseStatus.PARTIALLY_REFUNDED,
835
- VOIDED = BaseStatus.VOIDED,
836
- }
837
-
838
- //charge, refund, adjustment
839
- export enum TransactionType {
840
- CHARGE = 'CHARGE',
841
- REFUND = 'REFUND',
842
- ADJUSTMENT = 'ADJUSTMENT',
843
- }
844
-
845
- const parseDate = (str: string | null): Date | null => {
846
- if (!str) return null;
847
- const [monthStr, dayStr, yearStr] = str.split('/');
848
- const month = Number(monthStr);
849
- const day = Number(dayStr);
850
- const year = Number(yearStr);
851
- if (isNaN(month) || isNaN(day) || isNaN(year)) {
852
- return null;
853
- }
854
- return new Date(year, month - 1, day);
855
- };
856
-
857
- export const dateSchema = z
858
- .string()
859
- .nullable()
860
- .refine(
861
- (val) => {
862
- if (!val) return true;
863
- const regex = /^(0[1-9]|1[0-2])\/(0[1-9]|[12][0-9]|3[01])\/\d{4}$/;
864
- return regex.test(val);
865
- },
866
- { message: 'Date must be in MM/DD/YYYY format' },
867
- )
868
- .transform((val) => (val ? parseDate(val) : null));
869
-
870
- /**
871
- * Creates a Zod schema for parsing and transforming date strings in MM/DD/YYYY format.
872
- * The schema accepts a parameter to determine if the date should be formatted as the start or end of the day.
873
- * - If param is 'START', the time is set to 00:00:00.000 (local, no timezone effect).
874
- * - If param is 'END', the time is set to 23:59:59.999 (local, no timezone effect).
875
- * - Otherwise, the time is set to 00:00:00.000.
876
- * The returned value is a Date object or null.
877
- */
878
- export const createDateSchema = (param?: 'START' | 'END') =>
879
- z
880
- .string()
881
- .nullable()
882
- .refine(
883
- (val) => {
884
- if (!val) return true;
885
- const regex = /^(0[1-9]|1[0-2])\/(0[1-9]|[12][0-9]|3[01])\/\d{4}$/;
886
- return regex.test(val);
887
- },
888
- { message: 'Date must be in MM/DD/YYYY format' },
889
- )
890
- .transform((val) => {
891
- if (!val) return null;
892
- const [monthStr, dayStr, yearStr] = val.split('/');
893
- const month = Number(monthStr);
894
- const day = Number(dayStr);
895
- const year = Number(yearStr);
896
- if (isNaN(month) || isNaN(day) || isNaN(year)) {
897
- return null;
898
- }
899
- let date: Date;
900
- if (param === 'END') {
901
- // Set to 23:59:59.999 local, then force to end of day in UTC
902
- date = new Date(Date.UTC(year, month - 1, day, 23, 59, 59, 999));
903
- } else {
904
- // Default to START or normal, set to 00:00:00.000 UTC
905
- date = new Date(Date.UTC(year, month - 1, day, 0, 0, 0, 0));
906
- }
907
- return date;
908
- });
909
-
910
- /**
911
- * Default dateSchema (no param) for backward compatibility.
912
- */
913
- export const dateSchemaWithParam = createDateSchema();
914
-
915
- export enum IssuerOnboardingSetupType {
916
- OFFERING = 'OFFERING',
917
- INVESTOR_PORTAL = 'INVESTOR_PORTAL',
918
- PAYMENT_METHOD = 'PAYMENT_METHOD',
919
- ACCOUNT_CONTACTS = 'ACCOUNT_CONTACTS',
920
- }
921
-
922
- export enum ThemeScope {
923
- ACCOUNT = 'ACCOUNT',
924
- SYSTEM = 'SYSTEM',
925
- }
926
-
927
- /**
928
- * The configuration for the target tables. Used in Notes, Files, and Activities
929
- * All tables that need to be targeted should be added here.
930
- * to determine the target table from the target ID.
931
- * TODO: UPDATE WITH MORE TABLES
932
- * CHANGES HERE WILL REQUIRE A MIGRATION
933
- */
934
- export const TargetTableConfig = {
935
- KYCS: { table: 'kycs', idPrefix: 'kyc' },
936
- AMLS: { table: 'amls', idPrefix: 'aml' },
937
- AICS: { table: 'aics', idPrefix: 'aic' },
938
- KYBS: { table: 'kybs', idPrefix: 'kyb' },
939
- INDIVIDUALS: { table: 'individuals', idPrefix: 'individual' },
940
- LEGAL_ENTITIES: { table: 'legal_entities', idPrefix: 'legal_entity' },
941
- INVESTOR_ACCOUNTS: {
942
- table: 'investor_accounts',
943
- idPrefix: 'investor_account',
944
- },
945
- TRADES: { table: 'trades', idPrefix: 'trade' },
946
- OFFERINGS: { table: 'offerings', idPrefix: 'offering' },
947
- ISSUERS: { table: 'issuers', idPrefix: 'issuer' },
948
- COVERED_PERSONS: { table: 'covered_persons', idPrefix: 'covered_person' },
949
- PAYMENT_METHODS: { table: 'payment_methods', idPrefix: 'payment_method' },
950
- NOTES: { table: 'notes', idPrefix: 'note' },
951
- USERS: { table: 'users', idPrefix: 'user' },
952
- ACCOUNTS: { table: 'accounts', idPrefix: 'account' },
953
- PAGES: { table: 'pages', idPrefix: 'page' },
954
- TASKS: { table: 'tasks', idPrefix: 'task' },
955
- FILES: { table: 'files', idPrefix: 'file' },
956
- DATA_RECORD_FILES: {
957
- table: 'data_record_files',
958
- idPrefix: 'data_record_file',
959
- },
960
- ASSETS: { table: 'assets', idPrefix: 'asset' },
961
- SITES: { table: 'sites', idPrefix: 'site' },
962
- PAGE_REVISIONS: { table: 'page_revisions', idPrefix: 'page_revision' },
963
- TRADE_LINE_ITEMS: { table: 'trade_line_items', idPrefix: 'trade_line_item' },
964
- TRANSACTIONS: { table: 'transactions', idPrefix: 'transaction' },
965
- DISBURSEMENTS: { table: 'disbursements', idPrefix: 'disbursement' },
966
- DISBURSEMENT_REVIEWS: {
967
- table: 'disbursement_reviews',
968
- idPrefix: 'disbursement_review',
969
- },
970
- ISSUER_PAYMENT_METHODS: {
971
- table: 'issuer_payment_methods',
972
- idPrefix: 'issuer_payment_method',
973
- },
974
- SIGNER_BRANDS: { table: 'signer_brands', idPrefix: 'signer_brand' },
975
- THEMES: { table: 'themes', idPrefix: 'theme' },
976
- THEME_SETTINGS: { table: 'theme_settings', idPrefix: 'theme_setting' },
977
- } as const;
978
-
979
- export type TargetTableType = keyof typeof TargetTableConfig;
980
- export const TargetTableEnum = Object.keys(TargetTableConfig) as [
981
- TargetTableType,
982
- ...TargetTableType[],
983
- ];
984
-
985
- /**
986
- * Get the target table name from a target ID.
987
- * @param targetId - The target ID to get the table name for.
988
- * @returns The target table name or null if the target ID is invalid.
989
- */
990
- export function getTargetTableFromId(targetId: string): string | null {
991
- try {
992
- const tid = TypeID.fromString(targetId);
993
- const prefix = tid.getType();
994
-
995
- for (const config of Object.values(TargetTableConfig)) {
996
- if (config.idPrefix === prefix) {
997
- return config.table;
998
- }
999
- }
1000
- } catch {
1001
- return null;
1002
- }
1003
-
1004
- return null;
1005
- }
1006
- export enum UrlClassification {
1007
- BASE64 = 'BASE64',
1008
- REGULAR = 'REGULAR',
1009
- INVALID = 'INVALID',
1010
- }
1011
-
1012
- export enum OfferingVersioningType {
1013
- PUBLISHED = 'PUBLISHED',
1014
- DRAFT = 'DRAFT',
1015
- }
1016
- /**
1017
- * Get the target table type from a target ID.
1018
- * @param targetId - The target ID to get the table type for.
1019
- * @returns The target table type or null if the target ID is invalid.
1020
- */
1021
- export function getTargetTableTypeFromId(
1022
- targetId: string,
1023
- ): TargetTableType | null {
1024
- try {
1025
- const tid = TypeID.fromString(targetId);
1026
- const prefix = tid.getType();
1027
-
1028
- for (const [tableType, config] of Object.entries(TargetTableConfig)) {
1029
- if (config.idPrefix === prefix) {
1030
- return tableType as TargetTableType;
1031
- }
1032
- }
1033
- } catch {
1034
- return null;
1035
- }
1036
-
1037
- return null;
1038
- }
1039
-
1040
- export const REDACTED = '[REDACTED]';
1041
-
1042
- /**
1043
- * Zod schema for validating and normalizing URLs.
1044
- *
1045
- * This schema ensures that the URL is valid and normalizes it by removing the protocol (http/https)
1046
- * and any path after the main domain.
1047
- *
1048
- * @example
1049
- * UrlSchema.parse('https://www.example.com'); // Valid URL, normalized to 'www.example.com'
1050
- * UrlSchema.parse('abc.example.org'); // Valid URL, normalized to 'abc.example.org'
1051
- * UrlSchema.parse('https://subdomain.example.co.uk/path'); // Valid URL, normalized to 'subdomain.example.co.uk'
1052
- * UrlSchema.parse('ftp://example.com'); // Throws validation error
1053
- * UrlSchema.parse('invalid-url'); // Throws validation error
1054
- */
1055
- export const createUrlSchema = (options?: { strict?: boolean }) => {
1056
- return z
1057
- .string()
1058
- .refine(
1059
- (value) => {
1060
- try {
1061
- // If strict mode is enabled, require abc.def.com format (at least one subdomain)
1062
- const urlPattern = options?.strict
1063
- ? /^(https?:\/\/)?([a-zA-Z0-9-]+\.[a-zA-Z0-9-]+\.[a-zA-Z]{2,})(\/.*)?$/
1064
- : /^(https?:\/\/)?(www\.)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}(\/.*)?$/;
1065
- return urlPattern.test(value);
1066
- } catch {
1067
- return false;
1068
- }
1069
- },
1070
- {
1071
- message: options?.strict
1072
- ? 'Invalid URL. Must be in format abc.def.com'
1073
- : 'Invalid URL',
1074
- },
1075
- )
1076
- .transform((value) => {
1077
- try {
1078
- const url = new URL(
1079
- value.startsWith('http') || value.startsWith('https')
1080
- ? value
1081
- : `http://${value}`,
1082
- );
1083
- return url.hostname.toLowerCase();
1084
- } catch {
1085
- return value.toLowerCase();
1086
- }
1087
- })
1088
- .openapi({
1089
- example: options?.strict ? 'subdomain.example.com' : 'www.example.com',
1090
- });
1091
- };
1092
-
1093
- export const UrlSchema = createUrlSchema();
1094
-
1095
- /**
1096
- * Zod schema for validating subdomains.
1097
- *
1098
- * This schema ensures that the subdomain contains only alphanumeric characters and hyphens,
1099
- * does not start or end with a hyphen, and follows standard subdomain naming conventions.
1100
- *
1101
- * @example
1102
- * SubdomainSchema.parse('my-site'); // Valid subdomain
1103
- * SubdomainSchema.parse('123test'); // Valid subdomain
1104
- * SubdomainSchema.parse('my_site'); // Throws validation error (underscore not allowed)
1105
- * SubdomainSchema.parse('-mysite'); // Throws validation error (cannot start with hyphen)
1106
- * SubdomainSchema.parse('mysite-'); // Throws validation error (cannot end with hyphen)
1107
- */
1108
- export const SubdomainSchema = z
1109
- .string()
1110
- .min(1, { message: 'Subdomain cannot be empty' })
1111
- .max(63, { message: 'Subdomain cannot exceed 63 characters' })
1112
- .refine(
1113
- (value) => {
1114
- // Subdomain can only contain alphanumeric characters and hyphens
1115
- // Cannot start or end with a hyphen
1116
- const subdomainPattern = /^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?$/;
1117
- return subdomainPattern.test(value);
1118
- },
1119
- {
1120
- message:
1121
- 'Subdomain can only contain letters, numbers, and hyphens, and cannot start or end with a hyphen',
1122
- },
1123
- )
1124
- .transform((value) => value.toLowerCase())
1125
- .openapi({ example: 'my-site' });
1126
-
1127
- /**
1128
- * Zod schema for validating domain names without subdomains.
1129
- *
1130
- * This schema ensures the domain is in a valid format (example.com) without subdomains.
1131
- *
1132
- * @example
1133
- * DomainSchema.parse('example.com'); // Valid domain
1134
- * DomainSchema.parse('subdomain.example.com'); // Throws validation error
1135
- */
1136
- export const DomainSchema = z
1137
- .string()
1138
- .refine(
1139
- (value) => {
1140
- // Only allow a single dot to prevent subdomains
1141
- const parts = value.split('.');
1142
- if (parts.length !== 2) return false;
1143
-
1144
- // Basic domain format validation
1145
- const domainPattern = /^[a-zA-Z0-9-]+\.[a-zA-Z]{2,}$/;
1146
- return domainPattern.test(value);
1147
- },
1148
- {
1149
- message:
1150
- 'Invalid domain format. Must be a domain without subdomains (e.g., example.com)',
1151
- },
1152
- )
1153
- .openapi({ example: 'example.com' });
1154
-
1155
- /**
1156
- * Zod schema for validating hex color codes (with optional alpha/transparency).
1157
- *
1158
- * This schema allows hex codes with or without a leading '#', and accepts 3, 4, 6, 7, or 8 hex digits (e.g., #RRGGBB, #RRGGBBA, #RRGGBBAA, #RGB, #RGBA, #XXXXXXX).
1159
- * The 7-digit form (e.g., #RRGGBBA) is supported to allow for transparency/alpha values at the end.
1160
- * It also trims whitespace and lowercases the value.
1161
- *
1162
- * @example
1163
- * HexCodeColorSchema.parse('#FF0000'); // Valid hex code
1164
- * HexCodeColorSchema.parse('FF0000'); // Valid hex code
1165
- * HexCodeColorSchema.parse('#F00'); // Valid hex code
1166
- * HexCodeColorSchema.parse('F00'); // Valid hex code
1167
- * HexCodeColorSchema.parse('#FF000080'); // Valid hex code (with alpha)
1168
- * HexCodeColorSchema.parse('#D9D9D14'); // Valid hex code (7 digits, with transparency)
1169
- * HexCodeColorSchema.parse(' #abc '); // Valid hex code, returns '#abc'
1170
- * HexCodeColorSchema.parse('#XYZ'); // Throws validation error
1171
- */
1172
- export const HexCodeColorSchema = z
1173
- .string()
1174
- .trim()
1175
- .transform((val) => (val.startsWith('#') ? val : `#${val}`))
1176
- .refine(
1177
- (val) =>
1178
- /^#[A-Fa-f0-9]{3}$/.test(val) || // #RGB
1179
- /^#[A-Fa-f0-9]{4}$/.test(val) || // #RGBA
1180
- /^#[A-Fa-f0-9]{6}$/.test(val) || // #RRGGBB
1181
- /^#[A-Fa-f0-9]{7}$/.test(val) || // #RRGGBBA (7 digits, e.g., with transparency)
1182
- /^#[A-Fa-f0-9]{8}$/.test(val), // #RRGGBBAA
1183
- {
1184
- message:
1185
- 'Invalid color hex code. It should be 3, 4, 6, 7, or 8 hex digits, with or without a leading "#".',
1186
- },
1187
- )
1188
- .openapi({ example: '#FFA500' });
1189
-
1190
- export const WithCoverArtUrl = z.object({
1191
- coverArtUrl: z.string().nullable().optional(),
1192
- });
1193
-
1194
- export const UNKNOWN = 'unknown';
1195
-
1196
- export enum UserManualType {
1197
- FAQ = 'FAQ',
1198
- USER_MANUAL = 'USER_MANUAL',
1199
- }
1200
- export enum BulkExportType {
1201
- INVESTOR_ACCOUNTS = 'INVESTOR_ACCOUNTS',
1202
- TRADES = 'TRADES',
1203
- COMPLIANCE_TRADES = 'COMPLIANCE_TRADES',
1204
- SECONDARY_CUSTOMERS = 'SECONDARY_CUSTOMERS',
1205
- SECONDARY_TRADES = 'SECONDARY_TRADES',
1206
- }
1207
- export const SubmitIssuerOfferingError = z.object({
1208
- field: z.string(),
1209
- message: z.string(),
1210
- id: z.string().optional(),
1211
- });
1212
- export type SubmitIssuerOfferingError = z.infer<
1213
- typeof SubmitIssuerOfferingError
1214
- >;
1215
- export const ErrorResponseZod = z.object({
1216
- valid: z.boolean(),
1217
- errors: z.array(SubmitIssuerOfferingError),
1218
- });
1219
- export type ErrorResponseZod = z.infer<typeof ErrorResponseZod>;
1220
-
1221
- /**
1222
- * A Zod schema that preprocesses a value to convert it to a number if it is a string.
1223
- * If the value is a string, it attempts to parse it as a float. If parsing fails, it returns `undefined`.
1224
- * If the value is already a number, it is returned as is.
1225
- *
1226
- * @example
1227
- * numberFromStringOrNumber.parse("123.45"); // returns 123.45
1228
- * numberFromStringOrNumber.parse(123.45); // returns 123.45
1229
- * numberFromStringOrNumber.parse("abc"); // throws a ZodError
1230
- *
1231
- * @type {ZodSchema<number>}
1232
- */
1233
- export const numberFromStringOrNumber = (fieldName: string) =>
1234
- z.preprocess(
1235
- (val) => {
1236
- if (typeof val === 'string') {
1237
- const parsed = parseFloat(val);
1238
- return isNaN(parsed) ? undefined : parsed;
1239
- }
1240
- return val;
1241
- },
1242
- z.number({
1243
- required_error: `${fieldName} field is required.`,
1244
- invalid_type_error: `${fieldName} field is required.`,
1245
- }),
1246
- );
1247
-
1248
- /**
1249
- * Creates a Zod schema for transforming number values to a specified decimal precision.
1250
- * Transforms the number to exactly the specified decimal places without validation.
1251
- * Accepts a base number schema with constraints (e.g., .positive(), .max()) and applies precision transformation.
1252
- *
1253
- * @param precision - The number of decimal places to enforce. Defaults to 2.
1254
- * @param baseSchema - Optional base number schema with constraints. Defaults to z.number().
1255
- * @returns A Zod schema that transforms numbers to the specified decimal precision.
1256
- *
1257
- * @example
1258
- * numberPrecisionSchema(2).parse(123.456); // returns 123.46 (transformed)
1259
- * numberPrecisionSchema(2).parse(123.45); // returns 123.45
1260
- * numberPrecisionSchema(2).parse(123.4); // returns 123.40 (transformed)
1261
- * numberPrecisionSchema(3, z.number().positive().max(1000)).parse(500.9999); // returns 501.000 (transformed)
1262
- * numberPrecisionSchema(2, z.number().positive().max(1000)).parse(500.99); // returns 500.99
1263
- */
1264
- export const numberPrecisionSchema = (
1265
- precision: number = 2,
1266
- baseSchema: z.ZodNumber = z.number(),
1267
- ) =>
1268
- baseSchema.transform((value) => {
1269
- if (!isFinite(value)) {
1270
- return value; // Return Infinity or -Infinity as-is
1271
- }
1272
-
1273
- if (precision === 0) {
1274
- return Math.round(value);
1275
- }
1276
-
1277
- // Round in two steps to reduce floating-point drift:
1278
- // 1) trim the value with extra precision
1279
- // 2) round the trimmed value at the target precision
1280
- const factor = Math.pow(10, precision);
1281
-
1282
- // Trim with extra precision (precision + 5) to keep enough significant digits
1283
- const trimmed = parseFloat(value.toFixed(Math.min(precision + 5, 20)));
1284
-
1285
- // Round at target precision
1286
- const rounded = Math.round(trimmed * factor) / factor;
1287
-
1288
- // Ensure the returned number has exact decimal places
1289
- return parseFloat(rounded.toFixed(precision));
1290
- });
1291
-
1292
- /**
1293
- * Convenience function for 2 decimal precision (backward compatibility).
1294
- * @deprecated Use numberPrecisionSchema(2) instead.
1295
- */
1296
- export const amountPrecision2Schema = (baseSchema: z.ZodNumber = z.number()) =>
1297
- numberPrecisionSchema(2, baseSchema);
1298
-
1299
- export enum RetirementAccountType {
1300
- SELF_DIRECTED = 'SELF_DIRECTED',
1301
- CUSTODIAN_MANAGED = 'CUSTODIAN_MANAGED',
1302
- }
1303
- export enum EmploymentStatus {
1304
- EMPLOYED = 'EMPLOYED',
1305
- UNEMPLOYED = 'UNEMPLOYED',
1306
- SELF_EMPLOYED = 'SELF_EMPLOYED',
1307
- RETIRED = 'RETIRED',
1308
- STUDENT = 'STUDENT',
1309
- OTHER = 'OTHER',
1310
- }
1311
-
1312
- export const dateSchemaWithNormalization = z
1313
- .string()
1314
- .nullable()
1315
- .transform((val) => (val ? normalizeShortDate(val) : null))
1316
- .refine(
1317
- (val) => {
1318
- if (!val) return true;
1319
- const regex = /^(0[1-9]|1[0-2])\/(0[1-9]|[12][0-9]|3[01])\/\d{4}$/;
1320
- return regex.test(val);
1321
- },
1322
- { message: 'Date must be in MM/DD/YYYY format' },
1323
- )
1324
- .transform((val) => (val ? parseDate(val) : null));
1325
-
1326
- export const DateRangeFiltersZod = z.object({
1327
- from: dateSchema.optional().openapi({ example: 'MM/DD/YYYY' }),
1328
- to: dateSchema.optional().openapi({ example: 'MM/DD/YYYY' }),
1329
- });
1330
-
1331
- export const metadataSchema = z
1332
- .string()
1333
- .min(2)
1334
- .max(600000)
1335
- .refine(
1336
- (data) => {
1337
- try {
1338
- if (!data) return true;
1339
- const parsedData = JSON.parse(data);
1340
- if (typeof parsedData !== 'object' || parsedData === null) return false;
1341
- return true;
1342
- } catch (error) {
1343
- return false;
1344
- }
1345
- },
1346
- {
1347
- message: 'must be a valid JSON object.',
1348
- path: [],
1349
- },
1350
- )
1351
- .transform((data) =>
1352
- data
1353
- ? { user_defined_data: JSON.parse(data), expected: JSON.parse(data) }
1354
- : null,
1355
- );
1356
-
1357
- export const LogContextZod = z.object({
1358
- queueName: z.string(),
1359
- jobId: z.string(),
1360
- jobName: z.string(),
1361
- shouldAlert: z.boolean().optional(),
1362
- });
1363
-
1364
- export type LogContext = z.infer<typeof LogContextZod>;
1365
-
1366
- /**
1367
- * Maps all documented Cloudflare Turnstile error codes to their corresponding HTTP status and user-friendly message.
1368
- *
1369
- * @see {@link https://developers.cloudflare.com/turnstile/get-started/server-side-validation/ Cloudflare Turnstile Server-side Validation}
1370
- */
1371
- export const errorMap: Record<string, { status: HttpStatus; message: string }> =
1372
- {
1373
- 'missing-input-secret': {
1374
- status: HttpStatus.INTERNAL_SERVER_ERROR,
1375
- message:
1376
- 'Captcha server configuration is missing the secret key. Please ensure the secret key is included.',
1377
- },
1378
- 'invalid-input-secret': {
1379
- status: HttpStatus.INTERNAL_SERVER_ERROR,
1380
- message:
1381
- 'Captcha server secret key is invalid or expired. Please check your secret key in the Cloudflare dashboard.',
1382
- },
1383
- 'missing-input-response': {
1384
- status: HttpStatus.BAD_REQUEST,
1385
- message:
1386
- 'Captcha response is missing. Please ensure the token is included and try again.',
1387
- },
1388
- 'invalid-input-response': {
1389
- status: HttpStatus.BAD_REQUEST,
1390
- message:
1391
- 'Captcha response is invalid, malformed, or expired. Please retry the challenge.',
1392
- },
1393
- 'bad-request': {
1394
- status: HttpStatus.BAD_REQUEST,
1395
- message:
1396
- 'The captcha verification request was malformed. Please check the request format and parameters.',
1397
- },
1398
- 'timeout-or-duplicate': {
1399
- status: HttpStatus.CONFLICT,
1400
- message:
1401
- 'Captcha token has already been validated or expired. Each token can only be used once. Please refresh and try again.',
1402
- },
1403
- 'internal-error': {
1404
- status: HttpStatus.INTERNAL_SERVER_ERROR,
1405
- message:
1406
- 'An internal error occurred during captcha verification. Please retry the request.',
1407
- },
1408
- };
1409
-
1410
- export enum BaseContactUsOptions {
1411
- ISSUER = 'ISSUER',
1412
- TECHNICAL_SUPPORT = 'TECHNICAL_SUPPORT',
1413
- SALES = 'SALES',
1414
- ACCOUNT_MANAGER = 'ACCOUNT_MANAGER',
1415
- }
1416
-
1417
- export enum SortOrder {
1418
- ASC = 'ASC',
1419
- DESC = 'DESC',
1420
- }
1421
-
1422
- export enum SortBy {
1423
- CREATED_AT = 'created_at',
1424
- UPDATED_AT = 'updated_at',
1425
- PLACEDAT = 'placedAt',
1426
- NAME = 'name',
1427
- TITLE = 'title',
1428
- LEGAL_NAME = 'legal_name',
1429
- }
1430
-
1431
- export enum PersonaStatus {
1432
- APPROVED = 'approved',
1433
- ACTIVE = 'active',
1434
- CREATED = 'created',
1435
- COMPLETED = 'completed',
1436
- DRAFT = 'draft',
1437
- DECLINED = 'declined',
1438
- EXPIRED = 'expired',
1439
- FAILED = 'failed',
1440
- NEEDS_REVIEW = 'needs_review',
1441
- PUBLISHED = 'published',
1442
- PENDING = 'pending',
1443
- REDACTED = 'redacted',
1444
- }
1445
-
1446
- export enum AMLProvider {
1447
- COMPLY_ADVANTAGE = 'ComplyAdvantage',
1448
- }
1449
-
1450
- export enum ThemeFileType {
1451
- LIGHT = 'light',
1452
- DARK = 'dark',
1453
- }
1454
-
1455
- /**
1456
- * Common timezone identifiers using IANA timezone database format.
1457
- * These are the most commonly used timezones in business applications.
1458
- */
1459
- export enum TimeZone {
1460
- // UTC
1461
- UTC = 'UTC',
1462
-
1463
- // North America
1464
- PACIFIC = 'America/Los_Angeles',
1465
- MOUNTAIN = 'America/Denver',
1466
- CENTRAL = 'America/Chicago',
1467
- EASTERN = 'America/New_York',
1468
-
1469
- // Europe
1470
- LONDON = 'Europe/London',
1471
- PARIS = 'Europe/Paris',
1472
- BERLIN = 'Europe/Berlin',
1473
- ROME = 'Europe/Rome',
1474
- MADRID = 'Europe/Madrid',
1475
- AMSTERDAM = 'Europe/Amsterdam',
1476
- ZURICH = 'Europe/Zurich',
1477
-
1478
- // Asia
1479
- TOKYO = 'Asia/Tokyo',
1480
- SHANGHAI = 'Asia/Shanghai',
1481
- HONG_KONG = 'Asia/Hong_Kong',
1482
- SINGAPORE = 'Asia/Singapore',
1483
- MUMBAI = 'Asia/Kolkata',
1484
- DUBAI = 'Asia/Dubai',
1485
-
1486
- // Australia
1487
- SYDNEY = 'Australia/Sydney',
1488
- MELBOURNE = 'Australia/Melbourne',
1489
-
1490
- // Other major business centers
1491
- SAO_PAULO = 'America/Sao_Paulo',
1492
- TORONTO = 'America/Toronto',
1493
- VANCOUVER = 'America/Vancouver',
1494
- }
1495
-
1496
- export const SenderDataZod = z.object({
1497
- senderName: z.string().nullable(),
1498
- senderEmail: z.string().nullable(),
1499
- });
1500
-
1501
- export type SenderDataZod = z.infer<typeof SenderDataZod>;
1502
-
1503
- export enum JobState {
1504
- COMPLETED = 'completed',
1505
- FAILED = 'failed',
1506
- WAITING = 'waiting',
1507
- ACTIVE = 'active',
1508
- DELAYED = 'delayed',
1509
- PRIORITIZED = 'prioritized',
1510
- WAITING_CHILDREN = 'waiting-children',
1511
- }
1512
-
1513
- export const SUBJECT_TYPE_MAP: Record<BulkExportType, string> = {
1514
- [BulkExportType.INVESTOR_ACCOUNTS]: 'Investor Accounts',
1515
- [BulkExportType.TRADES]: 'Trades',
1516
- [BulkExportType.COMPLIANCE_TRADES]: 'Compliance Trades',
1517
- [BulkExportType.SECONDARY_CUSTOMERS]: 'Secondary Customers',
1518
- [BulkExportType.SECONDARY_TRADES]: 'Secondary Trades',
1519
- };
1520
-
1521
- export const StringToBooleanSchema = z.preprocess(
1522
- (val) =>
1523
- val === 'true' || val === '1'
1524
- ? true
1525
- : val === 'false' || val === '0'
1526
- ? false
1527
- : val,
1528
- z.boolean(),
1529
- );
1530
- export type StringToBooleanSchema = z.infer<typeof StringToBooleanSchema>;