@dalmore/api-contracts 1.0.2 → 1.0.5

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 (295) hide show
  1. package/README.md +34 -55
  2. package/index.d.mts +17 -0
  3. package/index.d.ts +17 -0
  4. package/index.mjs +10970 -0
  5. package/package.json +10 -46
  6. package/common/helpers/index.ts +0 -205
  7. package/common/types/account-contact.types.ts +0 -98
  8. package/common/types/account-detail.types.ts +0 -27
  9. package/common/types/account-integration.types.ts +0 -143
  10. package/common/types/account-manager.types.ts +0 -124
  11. package/common/types/account.types.ts +0 -296
  12. package/common/types/activity.types.ts +0 -274
  13. package/common/types/address.types.ts +0 -41
  14. package/common/types/aic.types.ts +0 -246
  15. package/common/types/aml.types.ts +0 -18
  16. package/common/types/api-key-logs.types.ts +0 -66
  17. package/common/types/api-keys.types.ts +0 -69
  18. package/common/types/asset.types.ts +0 -338
  19. package/common/types/auth.types.ts +0 -370
  20. package/common/types/batch-jobs.types.ts +0 -150
  21. package/common/types/bonus-tier.types.ts +0 -147
  22. package/common/types/cart.types.ts +0 -18
  23. package/common/types/checklist-items.types.ts +0 -70
  24. package/common/types/checklist.types.ts +0 -97
  25. package/common/types/common.types.ts +0 -1520
  26. package/common/types/comply-advantage-api.types.ts +0 -316
  27. package/common/types/comply-advantage.types.ts +0 -25
  28. package/common/types/contact-us.types.ts +0 -107
  29. package/common/types/contract-helpers.ts +0 -205
  30. package/common/types/countries.types.ts +0 -375
  31. package/common/types/covered-person.types.ts +0 -274
  32. package/common/types/dashboard.types.ts +0 -799
  33. package/common/types/data-record.types.ts +0 -325
  34. package/common/types/data-room.types.ts +0 -242
  35. package/common/types/default-theme-config.types.ts +0 -87
  36. package/common/types/disbursement-adjustment.types.ts +0 -32
  37. package/common/types/disbursement-approval-user.types.ts +0 -100
  38. package/common/types/disbursement-review.types.ts +0 -110
  39. package/common/types/disbursement-transaction.types.ts +0 -72
  40. package/common/types/disbursements.types.ts +0 -310
  41. package/common/types/domain-filter.types.ts +0 -55
  42. package/common/types/email-theme.types.ts +0 -442
  43. package/common/types/entity.types.ts +0 -15
  44. package/common/types/error-responses.types.ts +0 -135
  45. package/common/types/escrow-account.types.ts +0 -104
  46. package/common/types/exchange-api-key.types.ts +0 -121
  47. package/common/types/exchange-import.types.ts +0 -36
  48. package/common/types/exchange-provider.types.ts +0 -329
  49. package/common/types/file.types.ts +0 -461
  50. package/common/types/health.types.ts +0 -29
  51. package/common/types/index.ts +0 -48
  52. package/common/types/individuals.types.ts +0 -554
  53. package/common/types/investor-account.types.ts +0 -1239
  54. package/common/types/investorAccountIdSchema.type.ts +0 -0
  55. package/common/types/investors-offering.types.ts +0 -65
  56. package/common/types/invite.types.ts +0 -133
  57. package/common/types/issuer-bank-account.types.ts +0 -107
  58. package/common/types/issuer-offering.types.ts +0 -306
  59. package/common/types/issuer-payment-method.types.ts +0 -341
  60. package/common/types/issuer.types.ts +0 -312
  61. package/common/types/job-item.types.ts +0 -119
  62. package/common/types/jobs.types.ts +0 -171
  63. package/common/types/kyb.types.ts +0 -53
  64. package/common/types/kyc.types.ts +0 -188
  65. package/common/types/legal-entity.types.ts +0 -185
  66. package/common/types/login-history.types.ts +0 -46
  67. package/common/types/mail-template.types.ts +0 -436
  68. package/common/types/north-cap-integration.types.ts +0 -190
  69. package/common/types/note.types.ts +0 -109
  70. package/common/types/notification.types.ts +0 -58
  71. package/common/types/notion-api.types.ts +0 -374
  72. package/common/types/notion-database.types.ts +0 -125
  73. package/common/types/notion-page.types.ts +0 -267
  74. package/common/types/offering-reports.types.ts +0 -153
  75. package/common/types/offering-submission.types.ts +0 -314
  76. package/common/types/offering.types.ts +0 -590
  77. package/common/types/page-revision.types.ts +0 -86
  78. package/common/types/page.types.ts +0 -436
  79. package/common/types/password.type.ts +0 -15
  80. package/common/types/payment-methods.types.ts +0 -298
  81. package/common/types/phone.type.ts +0 -27
  82. package/common/types/portfolio.types.ts +0 -50
  83. package/common/types/privacy-policy-and-tos.types.ts +0 -231
  84. package/common/types/queue.types.ts +0 -111
  85. package/common/types/registered-reps.types.ts +0 -25
  86. package/common/types/rejection-reasons.types.ts +0 -56
  87. package/common/types/review.types.ts +0 -133
  88. package/common/types/role.types.ts +0 -26
  89. package/common/types/secondary-customer.types.ts +0 -66
  90. package/common/types/secondary-issuer.types.ts +0 -50
  91. package/common/types/secondary-order.types.ts +0 -58
  92. package/common/types/secondary-security.types.ts +0 -60
  93. package/common/types/secondary-trade.entity.ts +0 -16
  94. package/common/types/secondary-trade.types.ts +0 -95
  95. package/common/types/secure-request.types.ts +0 -68
  96. package/common/types/signer.types.ts +0 -651
  97. package/common/types/site-link.types.ts +0 -166
  98. package/common/types/site-settings.types.ts +0 -726
  99. package/common/types/site.types.ts +0 -270
  100. package/common/types/sms.types.ts +0 -30
  101. package/common/types/state-machine.types.ts +0 -177
  102. package/common/types/states.types.ts +0 -163
  103. package/common/types/subdoc-preview.types.ts +0 -35
  104. package/common/types/task.types.ts +0 -258
  105. package/common/types/trade-adjustment.type.ts +0 -33
  106. package/common/types/trade-line-item.type.ts +0 -132
  107. package/common/types/trade.types.ts +0 -931
  108. package/common/types/transaction.types.ts +0 -198
  109. package/common/types/trusted-contact.types.ts +0 -122
  110. package/common/types/typography.types.ts +0 -75
  111. package/common/types/user-manual.types.ts +0 -290
  112. package/common/types/user-setting.types.ts +0 -133
  113. package/common/types/user.types.ts +0 -320
  114. package/common/types/webhook.types.ts +0 -588
  115. package/common/types/zip.type.ts +0 -36
  116. package/contracts/clients/accounts/index.ts +0 -61
  117. package/contracts/clients/aic/index.ts +0 -59
  118. package/contracts/clients/api-key-logs/index.ts +0 -53
  119. package/contracts/clients/api-keys/index.ts +0 -73
  120. package/contracts/clients/assets/index.ts +0 -102
  121. package/contracts/clients/auth/index.ts +0 -50
  122. package/contracts/clients/files/index.ts +0 -166
  123. package/contracts/clients/files-public/index.ts +0 -166
  124. package/contracts/clients/index.ts +0 -44
  125. package/contracts/clients/individuals/index.ts +0 -93
  126. package/contracts/clients/investor-accounts/index.ts +0 -93
  127. package/contracts/clients/issuers/index.ts +0 -94
  128. package/contracts/clients/legal-entities/index.ts +0 -93
  129. package/contracts/clients/offerings/index.ts +0 -117
  130. package/contracts/clients/secure-requests/index.ts +0 -34
  131. package/contracts/clients/sites/index.ts +0 -56
  132. package/contracts/clients/trades/index.ts +0 -122
  133. package/contracts/compliance/account-contacts/index.ts +0 -82
  134. package/contracts/compliance/account-managers/index.ts +0 -142
  135. package/contracts/compliance/accounts/index.ts +0 -187
  136. package/contracts/compliance/activities/index.ts +0 -55
  137. package/contracts/compliance/aic/index.ts +0 -60
  138. package/contracts/compliance/api-keys/index.ts +0 -91
  139. package/contracts/compliance/assets/index.ts +0 -122
  140. package/contracts/compliance/auth/index.ts +0 -134
  141. package/contracts/compliance/batch-jobs/index.ts +0 -62
  142. package/contracts/compliance/bonus-tiers/index.ts +0 -55
  143. package/contracts/compliance/checklist/index.ts +0 -87
  144. package/contracts/compliance/checklist-items/index.ts +0 -86
  145. package/contracts/compliance/covered-persons/index.ts +0 -97
  146. package/contracts/compliance/dashboard/index.ts +0 -111
  147. package/contracts/compliance/data-records/index.ts +0 -116
  148. package/contracts/compliance/data-rooms/index.ts +0 -113
  149. package/contracts/compliance/default-theme-configs/index.ts +0 -95
  150. package/contracts/compliance/disbursement/index.ts +0 -165
  151. package/contracts/compliance/disbursement-approval-users/index.ts +0 -84
  152. package/contracts/compliance/disbursement-transactions/index.ts +0 -37
  153. package/contracts/compliance/domain-filters/index.ts +0 -117
  154. package/contracts/compliance/email-themes/index.ts +0 -284
  155. package/contracts/compliance/escrow-accounts/index.ts +0 -85
  156. package/contracts/compliance/exchange-api-keys/index.ts +0 -129
  157. package/contracts/compliance/exchange-imports/index.ts +0 -137
  158. package/contracts/compliance/files/index.ts +0 -267
  159. package/contracts/compliance/files-public/index.ts +0 -188
  160. package/contracts/compliance/health/index.ts +0 -26
  161. package/contracts/compliance/index.ts +0 -147
  162. package/contracts/compliance/individuals/index.ts +0 -57
  163. package/contracts/compliance/investor-accounts/index.ts +0 -141
  164. package/contracts/compliance/invites/index.ts +0 -137
  165. package/contracts/compliance/issuer-bank-accounts/index.ts +0 -81
  166. package/contracts/compliance/issuer-payment-methods/index.ts +0 -81
  167. package/contracts/compliance/issuers/index.ts +0 -97
  168. package/contracts/compliance/job-items/index.ts +0 -58
  169. package/contracts/compliance/jobs/index.ts +0 -59
  170. package/contracts/compliance/kyb/index.ts +0 -54
  171. package/contracts/compliance/kyc/index.ts +0 -77
  172. package/contracts/compliance/legal-entities/index.ts +0 -57
  173. package/contracts/compliance/login-histories/index.ts +0 -37
  174. package/contracts/compliance/notes/index.ts +0 -69
  175. package/contracts/compliance/notion-databases/index.ts +0 -107
  176. package/contracts/compliance/notion-pages/index.ts +0 -105
  177. package/contracts/compliance/offering-reports/index.ts +0 -149
  178. package/contracts/compliance/offerings/index.ts +0 -233
  179. package/contracts/compliance/pages/index.ts +0 -178
  180. package/contracts/compliance/payment-methods/index.ts +0 -57
  181. package/contracts/compliance/rejection-reasons/index.ts +0 -32
  182. package/contracts/compliance/review/index.ts +0 -169
  183. package/contracts/compliance/roles/index.ts +0 -34
  184. package/contracts/compliance/secondary-customers/index.ts +0 -77
  185. package/contracts/compliance/secondary-orders/index.ts +0 -60
  186. package/contracts/compliance/secondary-trades/index.ts +0 -100
  187. package/contracts/compliance/secure-requests/index.ts +0 -54
  188. package/contracts/compliance/signer/index.ts +0 -369
  189. package/contracts/compliance/site-links/index.ts +0 -128
  190. package/contracts/compliance/site-settings/index.ts +0 -669
  191. package/contracts/compliance/sites/index.ts +0 -56
  192. package/contracts/compliance/state-machine/index.ts +0 -94
  193. package/contracts/compliance/tasks/index.ts +0 -91
  194. package/contracts/compliance/third-parties/index.ts +0 -52
  195. package/contracts/compliance/trade-line-items/index.ts +0 -59
  196. package/contracts/compliance/trades/index.ts +0 -230
  197. package/contracts/compliance/transactions/index.ts +0 -161
  198. package/contracts/compliance/user-manuals/index.ts +0 -271
  199. package/contracts/compliance/user-settings/index.ts +0 -189
  200. package/contracts/compliance/users/index.ts +0 -200
  201. package/contracts/compliance/webhooks/index.ts +0 -41
  202. package/contracts/compliance-apikey/accounts/index.ts +0 -58
  203. package/contracts/compliance-apikey/index.ts +0 -14
  204. package/contracts/index.ts +0 -6
  205. package/contracts/investors/account-contacts/index.ts +0 -58
  206. package/contracts/investors/aic/index.ts +0 -59
  207. package/contracts/investors/assets/index.ts +0 -61
  208. package/contracts/investors/auth/index.ts +0 -116
  209. package/contracts/investors/bonus-tiers/index.ts +0 -37
  210. package/contracts/investors/cart/index.ts +0 -75
  211. package/contracts/investors/contact-us/index.ts +0 -48
  212. package/contracts/investors/data-records/index.ts +0 -113
  213. package/contracts/investors/data-rooms/index.ts +0 -96
  214. package/contracts/investors/files/index.ts +0 -167
  215. package/contracts/investors/files-public/index.ts +0 -185
  216. package/contracts/investors/index.ts +0 -72
  217. package/contracts/investors/individuals/index.ts +0 -99
  218. package/contracts/investors/investor-accounts/index.ts +0 -110
  219. package/contracts/investors/issuer-payment-methods/index.ts +0 -36
  220. package/contracts/investors/issuers/index.ts +0 -30
  221. package/contracts/investors/legal-entities/index.ts +0 -93
  222. package/contracts/investors/notes/index.ts +0 -69
  223. package/contracts/investors/offerings/index.ts +0 -93
  224. package/contracts/investors/pages/index.ts +0 -88
  225. package/contracts/investors/payment-methods/index.ts +0 -149
  226. package/contracts/investors/portfolios/index.ts +0 -53
  227. package/contracts/investors/sites/index.ts +0 -96
  228. package/contracts/investors/tasks/index.ts +0 -111
  229. package/contracts/investors/trade-line-items/index.ts +0 -75
  230. package/contracts/investors/trades/index.ts +0 -114
  231. package/contracts/investors/transactions/index.ts +0 -37
  232. package/contracts/investors/trusted-contacts/index.ts +0 -93
  233. package/contracts/investors/user-manuals/index.ts +0 -62
  234. package/contracts/investors/user-settings/index.ts +0 -170
  235. package/contracts/investors/users/index.ts +0 -45
  236. package/contracts/investors/webhooks/index.ts +0 -30
  237. package/contracts/issuers/account-contacts/index.ts +0 -76
  238. package/contracts/issuers/account-integrations/index.ts +0 -97
  239. package/contracts/issuers/accounts/index.ts +0 -97
  240. package/contracts/issuers/activities/index.ts +0 -54
  241. package/contracts/issuers/aic/index.ts +0 -39
  242. package/contracts/issuers/api-key-logs/index.ts +0 -53
  243. package/contracts/issuers/api-keys/index.ts +0 -93
  244. package/contracts/issuers/assets/index.ts +0 -122
  245. package/contracts/issuers/auth/index.ts +0 -152
  246. package/contracts/issuers/bonus-tiers/index.ts +0 -55
  247. package/contracts/issuers/contact-us/index.ts +0 -48
  248. package/contracts/issuers/covered-persons/index.ts +0 -136
  249. package/contracts/issuers/dashboard/index.ts +0 -72
  250. package/contracts/issuers/data-records/index.ts +0 -257
  251. package/contracts/issuers/data-rooms/index.ts +0 -134
  252. package/contracts/issuers/disbursement-approval-users/index.ts +0 -82
  253. package/contracts/issuers/disbursement-transactions/index.ts +0 -53
  254. package/contracts/issuers/disbursements/index.ts +0 -153
  255. package/contracts/issuers/email-themes/index.ts +0 -242
  256. package/contracts/issuers/escrow-accounts/index.ts +0 -81
  257. package/contracts/issuers/exchange-api-keys/index.ts +0 -144
  258. package/contracts/issuers/files/index.ts +0 -166
  259. package/contracts/issuers/files-public/index.ts +0 -166
  260. package/contracts/issuers/health/index.ts +0 -24
  261. package/contracts/issuers/index.ts +0 -112
  262. package/contracts/issuers/investor-accounts/index.ts +0 -148
  263. package/contracts/issuers/invites/index.ts +0 -129
  264. package/contracts/issuers/issuer/index.ts +0 -94
  265. package/contracts/issuers/issuer-bank-accounts/index.ts +0 -81
  266. package/contracts/issuers/issuer-payment-methods/index.ts +0 -136
  267. package/contracts/issuers/kyc/index.ts +0 -38
  268. package/contracts/issuers/login-histories/index.ts +0 -51
  269. package/contracts/issuers/notes/index.ts +0 -69
  270. package/contracts/issuers/offerings/index.ts +0 -206
  271. package/contracts/issuers/pages/index.ts +0 -138
  272. package/contracts/issuers/payment-methods/index.ts +0 -61
  273. package/contracts/issuers/portfolios/index.ts +0 -36
  274. package/contracts/issuers/rejection-reasons/index.ts +0 -32
  275. package/contracts/issuers/review/index.ts +0 -63
  276. package/contracts/issuers/secondary-customers/index.ts +0 -55
  277. package/contracts/issuers/secondary-orders/index.ts +0 -57
  278. package/contracts/issuers/secondary-trades/index.ts +0 -57
  279. package/contracts/issuers/secure-requests/index.ts +0 -34
  280. package/contracts/issuers/site-links/index.ts +0 -116
  281. package/contracts/issuers/site-settings/index.ts +0 -585
  282. package/contracts/issuers/sites/index.ts +0 -32
  283. package/contracts/issuers/tasks/index.ts +0 -111
  284. package/contracts/issuers/trades/index.ts +0 -132
  285. package/contracts/issuers/transactions/index.ts +0 -158
  286. package/contracts/issuers/user-manuals/index.ts +0 -62
  287. package/contracts/issuers/user-settings/index.ts +0 -170
  288. package/contracts/issuers/users/index.ts +0 -126
  289. package/contracts/secondaries/accounts/index.ts +0 -58
  290. package/contracts/secondaries/index.ts +0 -23
  291. package/contracts/secondaries/secondary-customers/index.ts +0 -55
  292. package/contracts/secondaries/secondary-issuers/index.ts +0 -94
  293. package/contracts/secondaries/secondary-orders/index.ts +0 -56
  294. package/contracts/secondaries/secondary-securities/index.ts +0 -95
  295. package/contracts/secondaries/secondary-trades/index.ts +0 -56
@@ -1,1239 +0,0 @@
1
- import { z } from 'zod';
2
- import { IBaseEntity } from './entity.types';
3
- import {
4
- AccountZod,
5
- AicStatus,
6
- AMLStatus,
7
- BaseStatus,
8
- dateSchema,
9
- InvestorAccountType,
10
- IPaginationMeta,
11
- KYBStatus,
12
- KYCDocumentType,
13
- KYCStatus,
14
- numberFromStringOrNumber,
15
- RetirementAccountType,
16
- SetupStatusType,
17
- TradeType,
18
- TradeStatus,
19
- EmploymentStatus,
20
- dateSchemaWithNormalization,
21
- UserType,
22
- PaginationOptionsZod,
23
- SourceOfIncome,
24
- SortBy,
25
- SortOrder,
26
- AMLProvider,
27
- } from './common.types';
28
- import { accountIdSchema } from './account.types';
29
- import { SaStatus, tradeIdSchema, TradeZod } from './trade.types';
30
- import { legalEntityIdSchema, LegalEntityZod } from './legal-entity.types';
31
- import { extendZodWithOpenApi } from '@anatine/zod-openapi';
32
- import { offeringIdSchema } from './offering.types';
33
- import { userIdSchema, UserZod } from './user.types';
34
- import { IIndividualZod, individualIdSchema } from './individuals.types';
35
- import { TypeID } from 'typeid-js';
36
- import { ErrorResponseZod } from './common.types';
37
- import { PhoneZodSchema } from './phone.type';
38
- import { RequiredAddressSchema } from './address.types';
39
- import { PaymentMethodType } from './payment-methods.types';
40
- import { TransactionStatus } from './transaction.types';
41
- import { CanadaProvinceCode, StateCode } from './states.types';
42
- import { refineAddressZip } from './zip.type';
43
- import { CountryCode } from './countries.types';
44
-
45
- extendZodWithOpenApi(z);
46
-
47
- export const investorAccountIdSchema = z.string().refine(
48
- (value) => {
49
- try {
50
- const tid = TypeID.fromString(value);
51
- return tid.getType() === 'investor_account';
52
- } catch {
53
- return false;
54
- }
55
- },
56
- {
57
- message:
58
- 'Invalid investor_account ID format. Must be a valid TypeID with "investor_account" prefix.',
59
- },
60
- );
61
-
62
- export enum AccreditationVerificationRequestStatus {
63
- PENDING = BaseStatus.PENDING,
64
- APPROVED = BaseStatus.APPROVED,
65
- DECLINED = BaseStatus.DECLINED,
66
- }
67
-
68
- export const IInvestorAccount = IBaseEntity.extend({
69
- tid: z.string().nullable(),
70
- investorAccountType: z.nativeEnum(InvestorAccountType),
71
- user: z.lazy(() => UserZod.nullish()),
72
- userId: z.string().optional().nullable(),
73
- email: z.string().email().optional().nullable(),
74
- name: z.string().optional().nullable(),
75
- regAQualified: z.boolean(),
76
- regCfQualified: z.boolean(),
77
- regDQualified: z.boolean(),
78
- accountId: z.string(),
79
- account: z.lazy(() => AccountZod).optional(),
80
- trades: z.array(z.lazy(() => TradeZod)).optional(),
81
- individuals: z.array(z.lazy(() => IIndividualZod)).optional(), // circular dependency requires lazy
82
- legalEntities: z.array(z.lazy(() => LegalEntityZod)).optional(),
83
- setupStatus: z.nativeEnum(SetupStatusType),
84
- systemReviewLog: z.string().nullable(),
85
- totalAmount: z.number().optional(),
86
- statusCheck: z.lazy(() => InvestorStatusCheckZod).optional(),
87
- });
88
-
89
- export type IInvestorAccount = z.infer<typeof IInvestorAccount>;
90
-
91
- export const IInvestorAccountSummary = z.object({
92
- liquidNetWorth: z.number(),
93
- householdNetWorth: z.number(),
94
- currentAnnualIncome: z.number(),
95
- currentHouseholdIncome: z.number(),
96
- totalInvestments: z.number(),
97
- totalPending: z.number(),
98
- concentrationLiquidNetWorth: z.number(),
99
- concentrationTotalNetWorth: z.number(),
100
- postTradeConcentration: z.number().optional(),
101
- });
102
-
103
- export type IInvestorAccountSummary = z.infer<typeof IInvestorAccountSummary>;
104
-
105
- export const InvestorUpdatePathParamsSchema = z.object({
106
- id: investorAccountIdSchema,
107
- });
108
-
109
- export const PostInvestorAccountBodySchema = z.object({
110
- investorAccountType: z.nativeEnum(InvestorAccountType),
111
- name: z.string().optional(),
112
- });
113
-
114
- export type PostInvestorAccountBody = z.infer<
115
- typeof PostInvestorAccountBodySchema
116
- >;
117
-
118
- export const PostClientInvestorAccountBodySchema = z.object({
119
- investorAccountType: z.nativeEnum(InvestorAccountType),
120
- email: z.string().email().optional(),
121
- name: z.string().min(1).max(100).optional(),
122
- tid: z.string().optional(),
123
- userId: z.lazy(() => {
124
- return userIdSchema;
125
- }),
126
- });
127
-
128
- export type PostClientInvestorAccountBody = z.infer<
129
- typeof PostClientInvestorAccountBodySchema
130
- >;
131
-
132
- export const UpdateInvestorAccountBodySchema = z.object({
133
- name: z.string().optional(),
134
- email: z.string().email().optional(),
135
- });
136
- export type UpdateInvestorAccountBody = z.infer<
137
- typeof UpdateInvestorAccountBodySchema
138
- >;
139
-
140
- export const IPaginatedInvestorAccounts = z.object({
141
- items: z.array(IInvestorAccount),
142
- meta: IPaginationMeta,
143
- });
144
- export type IPaginatedInvestorAccounts = z.infer<
145
- typeof IPaginatedInvestorAccounts
146
- >;
147
-
148
- const investorAccountsInclude = z.enum([
149
- 'account',
150
- 'trades',
151
- 'individuals',
152
- 'legalEntities',
153
- 'trustedContacts',
154
- ]);
155
-
156
- export const InvestorAccountsFiltersZod = z.object({
157
- investorAccountType: z.nativeEnum(InvestorAccountType).optional(),
158
- kycStatus: z.nativeEnum(KYCStatus).optional(),
159
- kybStatus: z.nativeEnum(KYBStatus).optional(),
160
- amlStatus: z.nativeEnum(AMLStatus).optional(),
161
- aicStatus: z.nativeEnum(AicStatus).optional(),
162
- offeringId: z.lazy(() => offeringIdSchema).optional(),
163
- regAQualified: z.preprocess(
164
- (val) =>
165
- val === 'true' || val === '1'
166
- ? true
167
- : val === 'false' || val === '0'
168
- ? false
169
- : val,
170
- z.boolean().optional(),
171
- ),
172
- regCfQualified: z.preprocess(
173
- (val) =>
174
- val === 'true' || val === '1'
175
- ? true
176
- : val === 'false' || val === '0'
177
- ? false
178
- : val,
179
- z.boolean().optional(),
180
- ),
181
- regDQualified: z.preprocess(
182
- (val) =>
183
- val === 'true' || val === '1'
184
- ? true
185
- : val === 'false' || val === '0'
186
- ? false
187
- : val,
188
- z.boolean().optional(),
189
- ),
190
- email: z.string().optional(),
191
- accountId: accountIdSchema.optional(),
192
- userType: z.nativeEnum(UserType).optional(),
193
- startDate: dateSchema.optional(),
194
- endDate: dateSchema.optional(),
195
- userId: z.string().optional(),
196
- });
197
-
198
- export const InvestorAccountsSortZod = z.object({
199
- sort: z.enum([SortBy.NAME, SortBy.CREATED_AT, SortBy.UPDATED_AT]).optional(),
200
- dir: z.nativeEnum(SortOrder).optional(),
201
- });
202
- export type InvestorAccountsSortZod = z.infer<typeof InvestorAccountsSortZod>;
203
-
204
- /**
205
- * @description Query parameters for including related entities
206
- * @xample in contract us as -> query: z.object({}).merge(UsersIncludeQuery),
207
- */
208
- export const InvestorAccountsIncludeQuery = z.object({
209
- include: z
210
- .string()
211
- .optional()
212
- .transform((str) => (str ? str.split(',') : []))
213
- .refine(
214
- (includes) =>
215
- includes.every((include) =>
216
- investorAccountsInclude.options.includes(include as any),
217
- ),
218
- {
219
- message: `Invalid include option provided. Valid options are: ${investorAccountsInclude.options.join(',')}`,
220
- },
221
- )
222
- .openapi({
223
- example: `${investorAccountsInclude.options.join(',')}`,
224
- }),
225
- });
226
-
227
- export const IssuerInvestorAccountsFiltersZod = z.object({
228
- userType: z.nativeEnum(UserType).optional(),
229
- investorAccountType: z.nativeEnum(InvestorAccountType).optional(),
230
- kycStatus: z.nativeEnum(KYCStatus).optional(),
231
- kybStatus: z.nativeEnum(KYBStatus).optional(),
232
- amlStatus: z.nativeEnum(AMLStatus).optional(),
233
- aicStatus: z.nativeEnum(AicStatus).optional(),
234
- offeringId: z.lazy(() => offeringIdSchema).optional(),
235
- regAQualified: z.preprocess(
236
- (val) =>
237
- val === 'true' || val === '1'
238
- ? true
239
- : val === 'false' || val === '0'
240
- ? false
241
- : val,
242
- z.boolean().optional(),
243
- ),
244
- regCfQualified: z.preprocess(
245
- (val) =>
246
- val === 'true' || val === '1'
247
- ? true
248
- : val === 'false' || val === '0'
249
- ? false
250
- : val,
251
- z.boolean().optional(),
252
- ),
253
- regDQualified: z.preprocess(
254
- (val) =>
255
- val === 'true' || val === '1'
256
- ? true
257
- : val === 'false' || val === '0'
258
- ? false
259
- : val,
260
- z.boolean().optional(),
261
- ),
262
- email: z.string().optional(),
263
- startDate: dateSchema.optional(),
264
- endDate: dateSchema.optional(),
265
- userId: z.string().optional(),
266
- });
267
-
268
- export const InvestorAccountsFilters = z.object({
269
- investorAccountType: z.nativeEnum(InvestorAccountType).optional(),
270
- regAQualified: z.preprocess(
271
- (val) =>
272
- val === 'true' || val === '1'
273
- ? true
274
- : val === 'false' || val === '0'
275
- ? false
276
- : val,
277
- z.boolean().optional(),
278
- ),
279
- regCfQualified: z.preprocess(
280
- (val) =>
281
- val === 'true' || val === '1'
282
- ? true
283
- : val === 'false' || val === '0'
284
- ? false
285
- : val,
286
- z.boolean().optional(),
287
- ),
288
- regDQualified: z.preprocess(
289
- (val) =>
290
- val === 'true' || val === '1'
291
- ? true
292
- : val === 'false' || val === '0'
293
- ? false
294
- : val,
295
- z.boolean().optional(),
296
- ),
297
- withPortfolio: z.preprocess(
298
- (val) =>
299
- val === 'true' || val === '1'
300
- ? true
301
- : val === 'false' || val === '0'
302
- ? false
303
- : val,
304
- z.boolean().optional(),
305
- ),
306
- });
307
-
308
- export const InvestorAccountExportFilters =
309
- IssuerInvestorAccountsFiltersZod.extend({
310
- startDate: dateSchema.optional().openapi({ example: 'MM/DD/YYYY' }),
311
- endDate: dateSchema.optional().openapi({ example: 'MM/DD/YYYY' }),
312
- });
313
-
314
- export type InvestorAccountExportFilters = z.infer<
315
- typeof InvestorAccountExportFilters
316
- >;
317
-
318
- export const ComplianceInvestorAccountExportFilters =
319
- InvestorAccountsFiltersZod.extend({
320
- startDate: dateSchema.optional().openapi({ example: 'MM/DD/YYYY' }),
321
- endDate: dateSchema.optional().openapi({ example: 'MM/DD/YYYY' }),
322
- }).merge(InvestorAccountsSortZod);
323
-
324
- export type ComplianceInvestorAccountExportFilters = z.infer<
325
- typeof ComplianceInvestorAccountExportFilters
326
- >;
327
-
328
- export const AmlReviewDetailsZod = z.object({
329
- firstName: z.string(),
330
- lastName: z.string().nullable(),
331
- tid: z.string().nullable(),
332
- provider: z.nativeEnum(AMLProvider).nullable(),
333
- dashboardLink: z.string().nullable(),
334
- reportLink: z.string().nullable(),
335
- reviewedBy: z.lazy(() => UserZod.nullable()),
336
- reviewedStatus: z.nativeEnum(AMLStatus),
337
- reviewedAt: z.date().nullable(),
338
- });
339
-
340
- export type AmlReviewDetailsZod = z.infer<typeof AmlReviewDetailsZod>;
341
-
342
- export const KycReviewDetailsZod = z.object({
343
- firstName: z.string().nullable(),
344
- lastName: z.string().nullable(),
345
- documentType: z.string(),
346
- documentIssuer: z.string().nullable(),
347
- documentNumber: z.string().nullable(),
348
- issuedDate: z.string().nullable(),
349
- expiredDate: z.string().nullable(),
350
- reviewedBy: z.lazy(() => UserZod.nullable()),
351
- reviewedStatus: z.nativeEnum(KYCStatus),
352
- });
353
-
354
- export type KycReviewDetailsZod = z.infer<typeof KycReviewDetailsZod>;
355
-
356
- export const AicReviewDetailsZod = z.object({
357
- accreditationType: z.string(),
358
- expirationDate: z.date().nullable(),
359
- });
360
-
361
- export type AicReviewDetailsZod = z.infer<typeof AicReviewDetailsZod>;
362
-
363
- export enum InvestorAccountDetailsType {
364
- AML = 'AML',
365
- KYC = 'KYC',
366
- AIC = 'AIC',
367
- }
368
- export const GetInvestorAccountDetailsQuery = z.object({
369
- type: z.nativeEnum(InvestorAccountDetailsType),
370
- individualId: z.lazy(() => individualIdSchema),
371
- });
372
-
373
- export type GetInvestorAccountDetailsQuery = z.infer<
374
- typeof GetInvestorAccountDetailsQuery
375
- >;
376
-
377
- export const RegisteredInvestorUserZod = z.object({
378
- id: z.string(),
379
- email: z.string().email(),
380
- name: z.string(),
381
- userType: z.nativeEnum(UserType).nullable(),
382
- numberOfTrades: z.number().default(0),
383
- invested: z.number().default(0),
384
- createdAt: z.date(),
385
- });
386
-
387
- export type RegisteredInvestorUserZod = z.infer<
388
- typeof RegisteredInvestorUserZod
389
- >;
390
-
391
- export const IPaginatedRegisteredInvestorUserZod = z.object({
392
- items: z.array(RegisteredInvestorUserZod),
393
- meta: IPaginationMeta,
394
- });
395
-
396
- export type IPaginatedRegisteredInvestorUserZod = z.infer<
397
- typeof IPaginatedRegisteredInvestorUserZod
398
- >;
399
-
400
- /**
401
- * Schema for raw query result from queryRegisteredInvestorUsers
402
- * Matches the structure returned by getRawMany() with JSON aggregations.
403
- * PostgreSQL/TypeORM automatically parses JSON fields, so they come as arrays.
404
- */
405
- const IndividualAggregationZod = z.object({
406
- id: z.lazy(() => individualIdSchema),
407
- phone: z.lazy(() => PhoneZodSchema),
408
- firstName: z.string().nullable(),
409
- lastName: z.string().nullable(),
410
- });
411
-
412
- const LegalEntityAggregationZod = z.object({
413
- id: z.lazy(() => legalEntityIdSchema),
414
- phone: z.lazy(() => PhoneZodSchema),
415
- name: z.string().nullable(),
416
- });
417
-
418
- export const RegisteredInvestorUserRawZod = z.object({
419
- id: z.lazy(() => userIdSchema),
420
- name: z.string(),
421
- email: z.string().email(),
422
- investorAccountType: z.nativeEnum(InvestorAccountType).nullable(),
423
- numberOfTrades: z.coerce.number().default(0),
424
- invested: z.coerce.number().default(0),
425
- createdAt: z.coerce.date(),
426
- type: z.nativeEnum(UserType).nullable(),
427
- investorAccountId: z.string().nullable(),
428
- individuals: z.array(IndividualAggregationZod),
429
- legalEntities: z.array(LegalEntityAggregationZod),
430
- });
431
-
432
- export type RegisteredInvestorUserRawZod = z.infer<
433
- typeof RegisteredInvestorUserRawZod
434
- >;
435
-
436
- export const RegisteredInvestorUserFiltersZod = z.object({
437
- search: z.string().optional().openapi({ example: 'John Doe' }),
438
- startDate: dateSchema.optional().openapi({ example: 'MM/DD/YYYY' }),
439
- endDate: dateSchema.optional().openapi({ example: 'MM/DD/YYYY' }),
440
- userType: z
441
- .nativeEnum(UserType)
442
- .optional()
443
- .openapi({ example: UserType.INVESTOR }),
444
- });
445
-
446
- export type RegisteredInvestorUserFiltersZod = z.infer<
447
- typeof RegisteredInvestorUserFiltersZod
448
- >;
449
-
450
- export const ExportInvestorAccountsResponse = z.object({
451
- message: z.string(),
452
- });
453
-
454
- export type ExportInvestorAccountsResponse = z.infer<
455
- typeof ExportInvestorAccountsResponse
456
- >;
457
-
458
- export const IndividualsValidationResponseZod = z.object({
459
- errors: ErrorResponseZod,
460
- regDFieldStatus: z.boolean(),
461
- });
462
- export type IndividualsValidationResponseZod = z.infer<
463
- typeof IndividualsValidationResponseZod
464
- >;
465
- export const BaseIndividualValidationSchemaZod = z
466
- .object({
467
- lastName: z.string({ message: 'Last Name is required' }),
468
- firstName: z.string({ message: 'First Name is required' }),
469
- dob: z.coerce.date({ required_error: 'Date of Birth is required' }),
470
- phone: PhoneZodSchema,
471
- email: z.string().email('Email is required'),
472
- ownership: numberFromStringOrNumber('Ownership').pipe(
473
- z.number().min(0, { message: 'Ownership is required' }),
474
- ),
475
- liquidNetWorth: numberFromStringOrNumber('Liquid Net Worth').pipe(
476
- z.number().min(0, { message: 'Liquid Net Worth is required' }),
477
- ),
478
- currentAnnualIncome: numberFromStringOrNumber('Current Annual Income').pipe(
479
- z.number().min(0, { message: 'Current Annual Income is required' }),
480
- ),
481
- employerName: z.string().nullable().optional(),
482
- sourceOfIncome: z.nativeEnum(SourceOfIncome, {
483
- message: 'Source of Income is required',
484
- }),
485
- kycDocumentType: z.nativeEnum(KYCDocumentType, {
486
- required_error: 'KYC Document Type is required',
487
- }),
488
- kycDocumentIssuer: z.string({ message: 'KYC Document Issuer is required' }),
489
- kycExpirationDate: z.coerce.date({
490
- required_error: 'KYC Expiration Date is required',
491
- }),
492
- kycIssuerDate: z.coerce.date({
493
- required_error: 'KYC Issuer Date is required',
494
- }),
495
- kycDocumentNumber: z.string({ message: 'KYC Document Number is required' }),
496
- kycStatus: z.nativeEnum(KYCStatus, {
497
- required_error: 'KYC Status is required',
498
- }),
499
- kycProvider: z.string({ message: 'KYC Provider is required' }),
500
- kycTid: z.string({ message: 'KYC TID is required' }),
501
- })
502
- .and(RequiredAddressSchema)
503
- .superRefine((data, ctx) => {
504
- if (data.sourceOfIncome === SourceOfIncome.EMPLOYED) {
505
- if (!data.employerName || data.employerName.trim() === '') {
506
- ctx.addIssue({
507
- code: z.ZodIssueCode.custom,
508
- message:
509
- 'Employer Name is required when Source of Income is Employed',
510
- path: ['employerName'],
511
- });
512
- }
513
- }
514
- });
515
-
516
- // Schema for US citizens or green card holders
517
- export const UsCitizenSchemaZod = z.object({
518
- ssn: z
519
- .string()
520
- .min(1, 'SSN is required for US citizens or green card holders')
521
- .regex(/^(\d{3}-\d{2}-\d{4}|\d{9})$/, 'SSN must be 9 digits'),
522
- });
523
-
524
- // Schema for custodian managed retirement accounts
525
- export const CustodianManagedRetirementSchemaZod = z.object({
526
- retirementAccountType: z.nativeEnum(RetirementAccountType, {
527
- required_error: 'Retirement Account Type is required',
528
- }),
529
- custodianName: z.string().min(1, 'Custodian Name is required'),
530
- custodianAccountNumber: z
531
- .string()
532
- .min(1, 'Custodian Account Number is required'),
533
- custodianRepresentativeName: z
534
- .string()
535
- .min(1, 'Custodian Representative Name is required'),
536
- custodianEmail: z.string().email('Custodian Email is required'),
537
- });
538
-
539
- export const SystemReviewLogZod = z.object({
540
- regA: ErrorResponseZod,
541
- regCf: ErrorResponseZod,
542
- regD: ErrorResponseZod,
543
- });
544
-
545
- export type SystemReviewLogZod = z.infer<typeof SystemReviewLogZod>;
546
-
547
- export enum SeedType {
548
- SYSTEM = 'SYSTEM',
549
- EXTERNAL = 'EXTERNAL',
550
- }
551
-
552
- export const SeedInvestorAccountsForDemoUsersZod = z.object({
553
- accountId: accountIdSchema,
554
- seedType: z.nativeEnum(SeedType),
555
- });
556
-
557
- export type SeedInvestorAccountsForDemoUsersZod = z.infer<
558
- typeof SeedInvestorAccountsForDemoUsersZod
559
- >;
560
-
561
- export const SeedTradeCsvRowZod = z.object({
562
- id: tradeIdSchema,
563
- tradeType: z.nativeEnum(TradeType).openapi({ example: TradeType.PURCHASE }),
564
- issuer: z.string(),
565
- offering: z.string(),
566
- asset: z.string(),
567
- numberOfShares: numberFromStringOrNumber('Number of Shares').pipe(
568
- z.number().int().min(1, { message: 'Number of Shares is required' }),
569
- ),
570
- pricePerShare: numberFromStringOrNumber('Price Per Share').pipe(
571
- z.number().min(0, { message: 'Price Per Share is required' }),
572
- ),
573
- totalAmount: numberFromStringOrNumber('Total Amount').pipe(
574
- z.number().min(0, { message: 'Total Amount is required' }),
575
- ),
576
- tradeStatus: z.nativeEnum(TradeStatus).openapi({ example: TradeStatus.CART }),
577
- placedAt: z.coerce.date(),
578
- ip: z.string().ip(),
579
- subAgreementStatus: z.nativeEnum(SaStatus),
580
- subAgreementFile: z.string().url(),
581
- tradeLog: z.string().nullable().optional(),
582
- });
583
-
584
- export const SeedTransactionCsvRowZod = z.object({
585
- txnId: z.string().nullable().optional(),
586
- txnResponse: z.string().nullable().optional(),
587
- txnPaymentMethod: z.nativeEnum(PaymentMethodType),
588
- txnCurrencyCode: z.string().nullable().optional(),
589
- txnChargedAmount: numberFromStringOrNumber('Transaction Charged Amount').pipe(
590
- z.number().min(0, { message: 'Transaction Charged Amount is required' }),
591
- ),
592
- txnDate: z
593
- .string()
594
- .transform((val) => (val === '' ? null : val))
595
- .pipe(z.coerce.date())
596
- .nullable()
597
- .optional(),
598
- txnSettledDate: z
599
- .string()
600
- .transform((val) => (val === '' ? null : val))
601
- .pipe(z.coerce.date())
602
- .nullable()
603
- .optional(),
604
- txnStatus: z.nativeEnum(TransactionStatus),
605
- txnLog: z.string().nullable().optional(),
606
- });
607
-
608
- export const AdministrativeFieldsCsvRowZod = z.object({
609
- closedAt: z.coerce.date().nullable().optional(),
610
- cancellationPeriod: z.string().nullable().optional(),
611
- cancelledAt: z.coerce.date().nullable().optional(),
612
- cancelledReason: z.string().nullable().optional(),
613
- rejectionReason: z.string().nullable().optional(),
614
- registeredRep: z.string().nullable().optional(),
615
- });
616
-
617
- export const InvestorAccountCsvRowZod = z.object({
618
- investorAccountId: investorAccountIdSchema,
619
- email: z.string().email(),
620
- name: z.string(),
621
- investorAccountType: z.nativeEnum(InvestorAccountType),
622
- });
623
-
624
- export const PrimaryIndividualCsvRowZod = z
625
- .object({
626
- primary_id: z.string(),
627
- primary_kycFirstName: z.string(),
628
- primary_kycLastName: z.string(),
629
- primary_kycDocumentType: z.nativeEnum(KYCDocumentType),
630
- primary_kycProviderId: z.string(),
631
- primary_kycDocumentNumber: z.string(),
632
- primary_kycDocumentIssuer: z.string(),
633
- primary_kycIssuerDate: dateSchemaWithNormalization,
634
- primary_kycExpirationDate: dateSchemaWithNormalization,
635
- primary_kycCheckedAt: z.coerce.date(),
636
- primary_kycStatus: z.nativeEnum(KYCStatus),
637
- primary_kycLog: z.string(),
638
- primary_kycProvider: z.string(),
639
- primary_firstName: z.string(),
640
- primary_lastName: z.string(),
641
- primary_dob: dateSchemaWithNormalization,
642
- primary_ssn: z.string().regex(/^\d{9}$/, 'SSN must be 9 digits'),
643
- primary_address: z.string().min(2, 'Address must be at least 2 characters'),
644
- primary_address2: z
645
- .string()
646
- .max(100, 'Address2 cannot exceed 100 characters')
647
- .nullable()
648
- .optional(),
649
- primary_city: z
650
- .string()
651
- .min(2, 'City must be at least 2 characters')
652
- .max(50, 'City cannot exceed 50 characters'),
653
- primary_state: z.string().min(2, 'State must be at least 2 characters'),
654
- primary_zip: z.string().min(5, 'Zip must be at least 5 characters'),
655
- primary_country: z.string().min(2, 'Country must be at least 2 characters'),
656
- primary_email: z.string().email(),
657
- primary_phone: PhoneZodSchema,
658
- primary_citizenship: z
659
- .string()
660
- .min(2, 'Citizenship must be at least 2 characters'),
661
- primary_currentAnnualIncome: numberFromStringOrNumber(
662
- 'Primary Current Annual Income',
663
- ).pipe(
664
- z
665
- .number()
666
- .min(0, { message: 'Primary Current Annual Income is required' }),
667
- ),
668
- primary_currentHouseholdIncome: numberFromStringOrNumber(
669
- 'Primary Current Household Income',
670
- ).pipe(
671
- z
672
- .number()
673
- .min(0, { message: 'Primary Current Household Income is required' }),
674
- ),
675
- primary_householdNetWorth: numberFromStringOrNumber(
676
- 'Primary Household Net Worth',
677
- ).pipe(
678
- z.number().min(0, { message: 'Primary Household Net Worth is required' }),
679
- ),
680
- primary_liquidNetWorth: numberFromStringOrNumber(
681
- 'Primary Liquid Net Worth',
682
- ).pipe(
683
- z.number().min(0, { message: 'Primary Liquid Net Worth is required' }),
684
- ),
685
- primary_investedInCrowdfunding: numberFromStringOrNumber(
686
- 'Primary Invested In Crowdfunding',
687
- ).pipe(
688
- z
689
- .number()
690
- .min(0, { message: 'Primary Invested In Crowdfunding is required' }),
691
- ),
692
- primary_occupation: z.string().nullable().optional(),
693
- primary_employmentStatus: z.nativeEnum(EmploymentStatus),
694
- primary_employerName: z.string(),
695
- primary_sourceOfIncome: z.nativeEnum(SourceOfIncome),
696
- primary_isUsCitizenOrGreenCardHolder: z.coerce.boolean(),
697
- primary_accredited: z.coerce.boolean(),
698
- })
699
- .refine(
700
- ({ primary_state, primary_country }) => {
701
- if (primary_country === CountryCode['US']) {
702
- return z.nativeEnum(StateCode).safeParse(primary_state).success;
703
- }
704
- if (primary_country === CountryCode['CA']) {
705
- return z.nativeEnum(CanadaProvinceCode).safeParse(primary_state)
706
- .success;
707
- }
708
- return z.string().min(2).max(35).safeParse(primary_state).success;
709
- },
710
- {
711
- message: `state value is not valid. It should be 2 uppercase letters representing the valid state for the country.`,
712
- },
713
- )
714
- .refine(
715
- ({ primary_zip, primary_country }) =>
716
- refineAddressZip(primary_country, primary_zip),
717
- {
718
- message:
719
- 'zip value is not valid, it shall follow the US(12345 or 12345-6789), CANADA(A1A 1A1) format! it shall be a string for other states',
720
- },
721
- );
722
-
723
- export const JointIndividualCsvRowZod = z
724
- .object({
725
- joint_id: z.string(),
726
- joint_kycFirstName: z.string(),
727
- joint_kycLastName: z.string(),
728
- joint_kycDocumentType: z.nativeEnum(KYCDocumentType),
729
- joint_kycDocumentIssuer: z.string(),
730
- joint_kycDocumentNumber: z.string(),
731
- joint_kycIssuerDate: dateSchemaWithNormalization,
732
- joint_kycExpirationDate: dateSchemaWithNormalization,
733
- joint_kycCheckedAt: z.string(),
734
- joint_kycStatus: z.nativeEnum(KYCStatus),
735
- joint_kycLog: z.string(),
736
- joint_kycProviderId: z.string(),
737
- joint_kycProvider: z.string(),
738
- joint_firstName: z.string(),
739
- joint_lastName: z.string(),
740
- joint_dob: dateSchemaWithNormalization,
741
- joint_ssn: z.string().regex(/^\d{9}$/, 'SSN must be 9 digits'),
742
- joint_address: z.string().min(2, 'Address must be at least 2 characters'),
743
- joint_address2: z
744
- .string()
745
- .max(100, 'Address2 cannot exceed 100 characters')
746
- .nullable()
747
- .optional(),
748
- joint_city: z
749
- .string()
750
- .min(2, 'City must be at least 2 characters')
751
- .max(50, 'City cannot exceed 50 characters'),
752
- joint_state: z.string().min(2, 'State must be at least 2 characters'),
753
- joint_zip: z.string().min(5, 'Zip must be at least 5 characters'),
754
- joint_country: z.string().min(2, 'Country must be at least 2 characters'),
755
- joint_email: z.string().email(),
756
- joint_phone: PhoneZodSchema,
757
- joint_citizenship: z
758
- .string()
759
- .min(2, 'Citizenship must be at least 2 characters'),
760
- joint_currentAnnualIncome: numberFromStringOrNumber(
761
- 'Joint Current Annual Income',
762
- ).pipe(
763
- z.number().min(0, { message: 'Joint Current Annual Income is required' }),
764
- ),
765
- joint_currentHouseholdIncome: numberFromStringOrNumber(
766
- 'Joint Current Household Income',
767
- ).pipe(
768
- z
769
- .number()
770
- .min(0, { message: 'Joint Current Household Income is required' }),
771
- ),
772
- joint_householdNetWorth: numberFromStringOrNumber(
773
- 'Joint Household Net Worth',
774
- ).pipe(
775
- z.number().min(0, { message: 'Joint Household Net Worth is required' }),
776
- ),
777
- joint_liquidNetWorth: numberFromStringOrNumber(
778
- 'Joint Liquid Net Worth',
779
- ).pipe(
780
- z.number().min(0, { message: 'Joint Liquid Net Worth is required' }),
781
- ),
782
- joint_investedInCrowdfunding: numberFromStringOrNumber(
783
- 'Joint Invested In Crowdfunding',
784
- ).pipe(
785
- z
786
- .number()
787
- .min(0, { message: 'Joint Invested In Crowdfunding is required' }),
788
- ),
789
- joint_occupation: z.string().nullable().optional(),
790
- joint_employmentStatus: z.nativeEnum(EmploymentStatus),
791
- joint_employerName: z.string(),
792
- joint_sourceOfIncome: z.nativeEnum(SourceOfIncome),
793
- joint_isUsCitizenOrGreenCardHolder: z.coerce.boolean(),
794
- joint_accredited: z.coerce.boolean(),
795
- })
796
- .refine(
797
- ({ joint_state, joint_country }) => {
798
- if (joint_country === CountryCode['US']) {
799
- return z.nativeEnum(StateCode).safeParse(joint_state).success;
800
- }
801
- if (joint_country === CountryCode['CA']) {
802
- return z.nativeEnum(CanadaProvinceCode).safeParse(joint_state).success;
803
- }
804
- return z.string().min(2).max(35).safeParse(joint_state).success;
805
- },
806
- {
807
- message: `state value is not valid. It should be 2 uppercase letters representing the valid state for the country.`,
808
- },
809
- )
810
- .refine(
811
- ({ joint_zip, joint_country }) =>
812
- refineAddressZip(joint_country, joint_zip),
813
- {
814
- message:
815
- 'zip value is not valid, it shall follow the US(12345 or 12345-6789), CANADA(A1A 1A1) format! it shall be a string for other states',
816
- },
817
- );
818
-
819
- export const LegalEntityCsvRowZod = z
820
- .object({
821
- entity_id: z.string(),
822
- entity_name: z.string(),
823
- entity_ein: z.string(),
824
- entity_entityType: z.string(),
825
- entity_address: z.string().min(2, 'Address must be at least 2 characters'),
826
- entity_address2: z
827
- .string()
828
- .max(100, 'Address2 cannot exceed 100 characters')
829
- .nullable()
830
- .optional(),
831
- entity_city: z
832
- .string()
833
- .min(2, 'City must be at least 2 characters')
834
- .max(50, 'City cannot exceed 50 characters'),
835
- entity_state: z.string().min(2, 'State must be at least 2 characters'),
836
- entity_zip: z.string().min(5, 'Zip must be at least 5 characters'),
837
- entity_country: z.string().min(2, 'Country must be at least 2 characters'),
838
- entity_dateOfIncorporation: dateSchemaWithNormalization,
839
- entity_stateOfIncorporation: z
840
- .string()
841
- .min(2, 'State must be at least 2 characters'),
842
- entity_phone: PhoneZodSchema,
843
- })
844
- .refine(
845
- ({ entity_state, entity_country }) => {
846
- if (entity_country === CountryCode['US']) {
847
- return z.nativeEnum(StateCode).safeParse(entity_state).success;
848
- }
849
- if (entity_country === CountryCode['CA']) {
850
- return z.nativeEnum(CanadaProvinceCode).safeParse(entity_state).success;
851
- }
852
- return z.string().min(2).max(35).safeParse(entity_state).success;
853
- },
854
- {
855
- message: `state value is not valid. It should be 2 uppercase letters representing the valid state for the country.`,
856
- },
857
- )
858
- .refine(
859
- ({ entity_zip, entity_country }) =>
860
- refineAddressZip(entity_country, entity_zip),
861
- {
862
- message:
863
- 'zip value is not valid, it shall follow the US(12345 or 12345-6789), CANADA(A1A 1A1) format! it shall be a string for other states',
864
- },
865
- );
866
- export const RetirementAccountTypeCsvRowZod = z.object({
867
- retirement_accountType: z.nativeEnum(RetirementAccountType),
868
- retirement_custodianName: z.string(),
869
- retirement_custodianAccountNumber: z.string(),
870
- retirement_custodianRepresentativeName: z.string(),
871
- retirement_custodianEmail: z.string().email(),
872
- });
873
- export const IParsedSeedDataZod = z.object({
874
- ...SeedTradeCsvRowZod.shape,
875
- ...SeedTransactionCsvRowZod.shape,
876
- ...AdministrativeFieldsCsvRowZod.shape,
877
- ...InvestorAccountCsvRowZod.shape,
878
- primary_id: z.string(),
879
- primary_kycFirstName: z.string(),
880
- primary_kycLastName: z.string(),
881
- primary_kycDocumentType: z.nativeEnum(KYCDocumentType),
882
- primary_kycProviderId: z.string(),
883
- primary_kycDocumentNumber: z.string(),
884
- primary_kycDocumentIssuer: z.string(),
885
- primary_kycIssuerDate: z.string(),
886
- primary_kycExpirationDate: z.string(),
887
- primary_kycCheckedAt: z.coerce.date(),
888
- primary_kycStatus: z.nativeEnum(KYCStatus),
889
- primary_kycLog: z.string(),
890
- primary_kycProvider: z.string(),
891
- primary_firstName: z.string(),
892
- primary_lastName: z.string(),
893
- primary_dob: z.string(),
894
- primary_ssn: z.string().regex(/^\d{9}$/, 'SSN must be 9 digits'),
895
- primary_address: z.string().min(2, 'Address must be at least 2 characters'),
896
- primary_address2: z
897
- .string()
898
- .max(100, 'Address2 cannot exceed 100 characters')
899
- .nullable()
900
- .optional(),
901
- primary_city: z
902
- .string()
903
- .min(2, 'City must be at least 2 characters')
904
- .max(50, 'City cannot exceed 50 characters'),
905
- primary_state: z.string().min(2, 'State must be at least 2 characters'),
906
- primary_zip: z.string().min(5, 'Zip must be at least 5 characters'),
907
- primary_country: z.string().min(2, 'Country must be at least 2 characters'),
908
- primary_email: z.string().email(),
909
- primary_phone: PhoneZodSchema,
910
- primary_citizenship: z
911
- .string()
912
- .min(2, 'Citizenship must be at least 2 characters'),
913
- primary_currentAnnualIncome: numberFromStringOrNumber(
914
- 'Primary Current Annual Income',
915
- ).pipe(
916
- z.number().min(0, { message: 'Primary Current Annual Income is required' }),
917
- ),
918
- primary_currentHouseholdIncome: numberFromStringOrNumber(
919
- 'Primary Current Household Income',
920
- ).pipe(
921
- z
922
- .number()
923
- .min(0, { message: 'Primary Current Household Income is required' }),
924
- ),
925
- primary_householdNetWorth: numberFromStringOrNumber(
926
- 'Primary Household Net Worth',
927
- ).pipe(
928
- z.number().min(0, { message: 'Primary Household Net Worth is required' }),
929
- ),
930
- primary_liquidNetWorth: numberFromStringOrNumber(
931
- 'Primary Liquid Net Worth',
932
- ).pipe(
933
- z.number().min(0, { message: 'Primary Liquid Net Worth is required' }),
934
- ),
935
- primary_investedInCrowdfunding: numberFromStringOrNumber(
936
- 'Primary Invested In Crowdfunding',
937
- ).pipe(
938
- z
939
- .number()
940
- .min(0, { message: 'Primary Invested In Crowdfunding is required' }),
941
- ),
942
- primary_occupation: z.string().nullable().optional(),
943
- primary_employmentStatus: z.nativeEnum(EmploymentStatus),
944
- primary_employerName: z.string(),
945
- primary_sourceOfIncome: z.nativeEnum(SourceOfIncome),
946
- primary_isUsCitizenOrGreenCardHolder: z.coerce.boolean(),
947
- primary_accredited: z.coerce.boolean(),
948
- joint_id: z.string().nullable().optional(),
949
- joint_kycFirstName: z.string().nullable().optional(),
950
- joint_kycLastName: z.string().nullable().optional(),
951
- joint_kycDocumentType: z.nativeEnum(KYCDocumentType).nullable().optional(),
952
- joint_kycDocumentIssuer: z.string().nullable().optional(),
953
- joint_kycDocumentNumber: z.string().nullable().optional(),
954
- joint_kycIssuerDate: dateSchemaWithNormalization.nullable().optional(),
955
- joint_kycExpirationDate: dateSchemaWithNormalization.nullable().optional(),
956
- joint_kycCheckedAt: z.string().nullable().optional(),
957
- joint_kycStatus: z.nativeEnum(KYCStatus).nullable().optional(),
958
- joint_kycLog: z.string().nullable().optional(),
959
- joint_kycProviderId: z.string().nullable().optional(),
960
- joint_kycProvider: z.string().nullable().optional(),
961
- joint_firstName: z.string().nullable().optional(),
962
- joint_lastName: z.string().nullable().optional(),
963
- joint_dob: dateSchemaWithNormalization.nullable().optional(),
964
- joint_ssn: z
965
- .string()
966
- .regex(/^\d{9}$/, 'SSN must be 9 digits')
967
- .nullable()
968
- .optional(),
969
- joint_address: z
970
- .string()
971
- .min(2, 'Address must be at least 2 characters')
972
- .nullable()
973
- .optional(),
974
- joint_address2: z
975
- .string()
976
- .max(100, 'Address2 cannot exceed 100 characters')
977
- .nullable()
978
- .optional(),
979
- joint_city: z
980
- .string()
981
- .min(2, 'City must be at least 2 characters')
982
- .max(50, 'City cannot exceed 50 characters')
983
- .nullable()
984
- .optional(),
985
- joint_state: z
986
- .string()
987
- .min(2, 'State must be at least 2 characters')
988
- .nullable()
989
- .optional(),
990
- joint_zip: z
991
- .string()
992
- .min(5, 'Zip must be at least 5 characters')
993
- .nullable()
994
- .optional(),
995
- joint_country: z
996
- .string()
997
- .min(2, 'Country must be at least 2 characters')
998
- .nullable()
999
- .optional(),
1000
- joint_email: z.string().email().nullable().optional(),
1001
- joint_phone: PhoneZodSchema.nullable().optional(),
1002
- joint_citizenship: z
1003
- .string()
1004
- .min(2, 'Citizenship must be at least 2 characters')
1005
- .nullable()
1006
- .optional(),
1007
- joint_currentAnnualIncome: numberFromStringOrNumber(
1008
- 'Joint Current Annual Income',
1009
- )
1010
- .pipe(
1011
- z.number().min(0, { message: 'Joint Current Annual Income is required' }),
1012
- )
1013
- .nullable()
1014
- .optional(),
1015
- joint_currentHouseholdIncome: numberFromStringOrNumber(
1016
- 'Joint Current Household Income',
1017
- )
1018
- .pipe(
1019
- z
1020
- .number()
1021
- .min(0, { message: 'Joint Current Household Income is required' }),
1022
- )
1023
- .nullable()
1024
- .optional(),
1025
- joint_householdNetWorth: numberFromStringOrNumber('Joint Household Net Worth')
1026
- .pipe(
1027
- z.number().min(0, { message: 'Joint Household Net Worth is required' }),
1028
- )
1029
- .nullable()
1030
- .optional(),
1031
- joint_liquidNetWorth: numberFromStringOrNumber('Joint Liquid Net Worth')
1032
- .pipe(z.number().min(0, { message: 'Joint Liquid Net Worth is required' }))
1033
- .nullable()
1034
- .optional(),
1035
- joint_investedInCrowdfunding: numberFromStringOrNumber(
1036
- 'Joint Invested In Crowdfunding',
1037
- )
1038
- .pipe(
1039
- z
1040
- .number()
1041
- .min(0, { message: 'Joint Invested In Crowdfunding is required' }),
1042
- )
1043
- .nullable()
1044
- .optional(),
1045
- joint_occupation: z.string().nullable().optional(),
1046
- joint_employmentStatus: z.nativeEnum(EmploymentStatus).nullable().optional(),
1047
- joint_employerName: z.string().nullable().optional(),
1048
- joint_sourceOfIncome: z.nativeEnum(SourceOfIncome).nullable().optional(),
1049
- joint_isUsCitizenOrGreenCardHolder: z.coerce.boolean().nullable().optional(),
1050
- joint_accredited: z.coerce.boolean().nullable().optional(),
1051
- entity_id: z.string().nullable().optional(),
1052
- entity_name: z.string().nullable().optional(),
1053
- entity_ein: z.string().nullable().optional(),
1054
- entity_entityType: z.string().nullable().optional(),
1055
- entity_address: z
1056
- .string()
1057
- .min(2, 'Address must be at least 2 characters')
1058
- .nullable()
1059
- .optional(),
1060
- entity_address2: z
1061
- .string()
1062
- .max(100, 'Address2 cannot exceed 100 characters')
1063
- .nullable()
1064
- .optional(),
1065
- entity_city: z
1066
- .string()
1067
- .min(2, 'City must be at least 2 characters')
1068
- .max(50, 'City cannot exceed 50 characters')
1069
- .nullable()
1070
- .optional(),
1071
- entity_state: z
1072
- .string()
1073
- .min(2, 'State must be at least 2 characters')
1074
- .nullable()
1075
- .optional(),
1076
- entity_zip: z
1077
- .string()
1078
- .min(5, 'Zip must be at least 5 characters')
1079
- .nullable()
1080
- .optional(),
1081
- entity_country: z
1082
- .string()
1083
- .min(2, 'Country must be at least 2 characters')
1084
- .nullable()
1085
- .optional(),
1086
- entity_dateOfIncorporation: dateSchemaWithNormalization.nullable().optional(),
1087
- entity_stateOfIncorporation: z
1088
- .string()
1089
- .min(2, 'State must be at least 2 characters')
1090
- .nullable()
1091
- .optional(),
1092
- entity_phone: PhoneZodSchema.nullable().optional(),
1093
- retirement_accountType: z
1094
- .nativeEnum(RetirementAccountType)
1095
- .nullable()
1096
- .optional(),
1097
- retirement_custodianName: z.string().nullable().optional(),
1098
- retirement_custodianAccountNumber: z.string().nullable().optional(),
1099
- retirement_custodianRepresentativeName: z.string().nullable().optional(),
1100
- retirement_custodianEmail: z.string().email().nullable().optional(),
1101
- });
1102
- export type IParsedSeedDataZod = z.infer<typeof IParsedSeedDataZod>;
1103
-
1104
- export const GetInvestorAccountsFilters = PaginationOptionsZod.merge(
1105
- InvestorAccountsIncludeQuery,
1106
- ).merge(InvestorAccountsFilters);
1107
-
1108
- export type GetInvestorAccountsFilters = z.infer<
1109
- typeof GetInvestorAccountsFilters
1110
- >;
1111
-
1112
- export const InvestorStatusCheckZod = z.object({
1113
- entity: z
1114
- .object({
1115
- information: z.boolean().default(true),
1116
- address: z.boolean().default(true),
1117
- })
1118
- .optional(),
1119
- primary: z
1120
- .object({
1121
- account: z.boolean().default(true),
1122
- personal: z.boolean().default(true),
1123
- residential: z.boolean().default(true),
1124
- identity: z.boolean().default(true),
1125
- financial: z.boolean().default(true),
1126
- investorQuestionnaire: z.boolean().default(true),
1127
- accreditation: z.boolean().default(true),
1128
- trustedContact: z.boolean().default(true),
1129
- retirement: z.boolean().optional(),
1130
- })
1131
- .optional(),
1132
- secondary: z
1133
- .object({
1134
- personal: z.boolean().default(true),
1135
- residential: z.boolean().default(true),
1136
- identity: z.boolean().default(true),
1137
- financial: z.boolean().default(true),
1138
- })
1139
- .optional(),
1140
- });
1141
-
1142
- export type InvestorStatusCheckZod = z.infer<typeof InvestorStatusCheckZod>;
1143
-
1144
- export const INVESTOR_ACCOUNT_FIELDS_MAP = {
1145
- entity: {
1146
- information: [
1147
- 'companyType',
1148
- 'name',
1149
- 'ein',
1150
- 'dateOfIncorporation',
1151
- 'stateOfIncorporation',
1152
- ],
1153
- address: ['address', 'address2', 'city', 'zip', 'state', 'country'],
1154
- },
1155
- primary: {
1156
- account: ['investorAccountType', 'name', 'email'],
1157
- personal: [
1158
- 'firstName',
1159
- 'lastName',
1160
- 'email',
1161
- 'phoneNumber',
1162
- 'dob',
1163
- 'citizenship',
1164
- 'ssn',
1165
- ],
1166
- residential: [
1167
- 'address',
1168
- 'address2',
1169
- 'city',
1170
- 'postalCode',
1171
- 'state',
1172
- 'country',
1173
- ],
1174
- identity: [
1175
- 'kycDocumentType',
1176
- 'kycDocumentIssuer',
1177
- 'kycDocumentNumber',
1178
- 'kycIssuerDate',
1179
- 'kycExpirationDate',
1180
- 'kycStatus',
1181
- 'kycProvider',
1182
- 'kycTid',
1183
- ],
1184
- financial: [
1185
- 'liquidNetWorth',
1186
- 'currentAnnualIncome',
1187
- 'sourceOfIncome',
1188
- 'employerName',
1189
- ],
1190
- investorQuestionnaire: ['aicQuestionnaire'],
1191
- accreditation: ['accreditationFile'],
1192
- retirement: [
1193
- 'retirementAccountType',
1194
- 'retirementCustodianName',
1195
- 'retirementCustodianAccountNumber',
1196
- 'retirementCustodianRepresentativeName',
1197
- 'retirementCustodianEmail',
1198
- ],
1199
- },
1200
- secondary: {
1201
- personal: [
1202
- 'firstName',
1203
- 'lastName',
1204
- 'email',
1205
- 'phoneNumber',
1206
- 'dob',
1207
- 'citizenship',
1208
- 'ssn',
1209
- ],
1210
- residential: ['address', 'address2', 'city', 'zip', 'state', 'country'],
1211
- identity: [
1212
- 'kycDocumentType',
1213
- 'kycDocumentIssuer',
1214
- 'kycDocumentNumber',
1215
- 'kycIssuerDate',
1216
- 'kycExpirationDate',
1217
- 'kycStatus',
1218
- 'kycProvider',
1219
- 'kycTid',
1220
- ],
1221
- financial: [
1222
- 'liquidNetWorth',
1223
- 'currentAnnualIncome',
1224
- 'sourceOfIncome',
1225
- 'employerName',
1226
- ],
1227
- },
1228
- };
1229
-
1230
- export const ExportRegisteredInvestorUsersFiltersZod = z.object({
1231
- search: z.string().optional(),
1232
- startDate: dateSchema.optional(),
1233
- endDate: dateSchema.optional(),
1234
- userType: z.nativeEnum(UserType).optional(),
1235
- });
1236
-
1237
- export type ExportRegisteredInvestorUsersFiltersZod = z.infer<
1238
- typeof ExportRegisteredInvestorUsersFiltersZod
1239
- >;