@dalmore/api-contracts 1.0.6 → 1.0.7

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 (137) hide show
  1. package/dist/contracts/clients/index.d.ts +19 -0
  2. package/index.mjs +4 -1
  3. package/package.json +4 -4
  4. package/src/common/types/account-contact.types.ts +0 -98
  5. package/src/common/types/account-detail.types.ts +0 -27
  6. package/src/common/types/account-integration.types.ts +0 -143
  7. package/src/common/types/account-manager.types.ts +0 -124
  8. package/src/common/types/account.types.ts +0 -296
  9. package/src/common/types/activity.types.ts +0 -274
  10. package/src/common/types/address.spec.ts +0 -203
  11. package/src/common/types/address.types.ts +0 -41
  12. package/src/common/types/aic.types.ts +0 -246
  13. package/src/common/types/aml.types.ts +0 -18
  14. package/src/common/types/api-key-logs.types.ts +0 -66
  15. package/src/common/types/api-keys.types.ts +0 -69
  16. package/src/common/types/asset.types.ts +0 -338
  17. package/src/common/types/auth.types.ts +0 -370
  18. package/src/common/types/batch-jobs.types.ts +0 -151
  19. package/src/common/types/bonus-tier.types.ts +0 -147
  20. package/src/common/types/cart.types.ts +0 -18
  21. package/src/common/types/checklist-items.types.ts +0 -70
  22. package/src/common/types/checklist.types.ts +0 -97
  23. package/src/common/types/common.types.spec.ts +0 -336
  24. package/src/common/types/common.types.ts +0 -1520
  25. package/src/common/types/comply-advantage-api.types.ts +0 -316
  26. package/src/common/types/comply-advantage.types.ts +0 -25
  27. package/src/common/types/contact-us.types.ts +0 -107
  28. package/src/common/types/contract-helpers.ts +0 -205
  29. package/src/common/types/countries.types.ts +0 -375
  30. package/src/common/types/covered-person.types.ts +0 -274
  31. package/src/common/types/dashboard.types.ts +0 -799
  32. package/src/common/types/data-record.types.ts +0 -325
  33. package/src/common/types/data-room.types.ts +0 -242
  34. package/src/common/types/default-theme-config.types.ts +0 -87
  35. package/src/common/types/disbursement-adjustment.types.ts +0 -32
  36. package/src/common/types/disbursement-approval-user.types.ts +0 -100
  37. package/src/common/types/disbursement-review.types.ts +0 -110
  38. package/src/common/types/disbursement-transaction.types.ts +0 -72
  39. package/src/common/types/disbursements.types.ts +0 -310
  40. package/src/common/types/domain-filter.types.ts +0 -55
  41. package/src/common/types/email-theme.types.ts +0 -442
  42. package/src/common/types/entity.types.ts +0 -15
  43. package/src/common/types/error-responses.types.ts +0 -135
  44. package/src/common/types/escrow-account.types.ts +0 -104
  45. package/src/common/types/exchange-api-key.types.ts +0 -121
  46. package/src/common/types/exchange-import.types.ts +0 -36
  47. package/src/common/types/exchange-provider.types.ts +0 -329
  48. package/src/common/types/file.types.ts +0 -461
  49. package/src/common/types/files.types.spec.ts +0 -154
  50. package/src/common/types/health.types.ts +0 -29
  51. package/src/common/types/index.ts +0 -48
  52. package/src/common/types/individuals.types.ts +0 -554
  53. package/src/common/types/investor-account.types.ts +0 -1239
  54. package/src/common/types/investorAccountIdSchema.type.ts +0 -0
  55. package/src/common/types/investors-offering.types.ts +0 -65
  56. package/src/common/types/invite.types.ts +0 -133
  57. package/src/common/types/issuer-bank-account.types.ts +0 -107
  58. package/src/common/types/issuer-offering.types.ts +0 -306
  59. package/src/common/types/issuer-payment-method.types.spec.ts +0 -612
  60. package/src/common/types/issuer-payment-method.types.ts +0 -341
  61. package/src/common/types/issuer.types.ts +0 -312
  62. package/src/common/types/job-item.types.ts +0 -119
  63. package/src/common/types/jobs.types.ts +0 -171
  64. package/src/common/types/kyb.types.ts +0 -53
  65. package/src/common/types/kyc.types.ts +0 -188
  66. package/src/common/types/legal-entity.types.ts +0 -185
  67. package/src/common/types/login-history.types.ts +0 -46
  68. package/src/common/types/mail-template.types.ts +0 -436
  69. package/src/common/types/north-cap-integration.types.ts +0 -190
  70. package/src/common/types/note.types.ts +0 -109
  71. package/src/common/types/notification.types.ts +0 -58
  72. package/src/common/types/notion-api.types.ts +0 -374
  73. package/src/common/types/notion-database.types.ts +0 -125
  74. package/src/common/types/notion-page.types.ts +0 -267
  75. package/src/common/types/offering-reports.types.ts +0 -153
  76. package/src/common/types/offering-submission.types.ts +0 -314
  77. package/src/common/types/offering.types.spec.ts +0 -91
  78. package/src/common/types/offering.types.ts +0 -590
  79. package/src/common/types/page-revision.types.ts +0 -86
  80. package/src/common/types/page.types.ts +0 -436
  81. package/src/common/types/password.type.ts +0 -15
  82. package/src/common/types/payment-methods.types.ts +0 -298
  83. package/src/common/types/phone.spec.ts +0 -76
  84. package/src/common/types/phone.type.ts +0 -27
  85. package/src/common/types/portfolio.types.ts +0 -50
  86. package/src/common/types/privacy-policy-and-tos.types.ts +0 -231
  87. package/src/common/types/queue.types.ts +0 -112
  88. package/src/common/types/registered-reps.types.ts +0 -25
  89. package/src/common/types/rejection-reasons.types.ts +0 -56
  90. package/src/common/types/reminder-config.types.ts +0 -40
  91. package/src/common/types/review.types.ts +0 -133
  92. package/src/common/types/role.types.ts +0 -26
  93. package/src/common/types/secondary-customer.types.ts +0 -66
  94. package/src/common/types/secondary-issuer.types.ts +0 -50
  95. package/src/common/types/secondary-order.types.ts +0 -58
  96. package/src/common/types/secondary-security.types.ts +0 -60
  97. package/src/common/types/secondary-trade.entity.ts +0 -16
  98. package/src/common/types/secondary-trade.types.ts +0 -95
  99. package/src/common/types/secure-request.types.ts +0 -68
  100. package/src/common/types/signer.types.ts +0 -651
  101. package/src/common/types/site-link.types.spec.ts +0 -134
  102. package/src/common/types/site-link.types.ts +0 -166
  103. package/src/common/types/site-settings.types.ts +0 -726
  104. package/src/common/types/site.types.ts +0 -270
  105. package/src/common/types/sms.types.ts +0 -30
  106. package/src/common/types/state-machine.types.ts +0 -177
  107. package/src/common/types/states.types.ts +0 -163
  108. package/src/common/types/subdoc-preview.types.ts +0 -35
  109. package/src/common/types/task.types.ts +0 -258
  110. package/src/common/types/trade-adjustment.type.ts +0 -33
  111. package/src/common/types/trade-line-item.type.ts +0 -132
  112. package/src/common/types/trade.types.ts +0 -929
  113. package/src/common/types/transaction.types.ts +0 -198
  114. package/src/common/types/trusted-contact.types.ts +0 -122
  115. package/src/common/types/typography.types.ts +0 -75
  116. package/src/common/types/user-manual.types.ts +0 -290
  117. package/src/common/types/user-setting.types.ts +0 -133
  118. package/src/common/types/user.types.ts +0 -320
  119. package/src/common/types/webhook.types.ts +0 -588
  120. package/src/common/types/zip.type.ts +0 -36
  121. package/src/contracts/clients/accounts/index.ts +0 -61
  122. package/src/contracts/clients/aic/index.ts +0 -59
  123. package/src/contracts/clients/api-key-logs/index.ts +0 -53
  124. package/src/contracts/clients/api-keys/index.ts +0 -73
  125. package/src/contracts/clients/assets/index.ts +0 -102
  126. package/src/contracts/clients/auth/index.ts +0 -50
  127. package/src/contracts/clients/files/index.ts +0 -166
  128. package/src/contracts/clients/files-public/index.ts +0 -166
  129. package/src/contracts/clients/index.ts +0 -44
  130. package/src/contracts/clients/individuals/index.ts +0 -93
  131. package/src/contracts/clients/investor-accounts/index.ts +0 -93
  132. package/src/contracts/clients/issuers/index.ts +0 -94
  133. package/src/contracts/clients/legal-entities/index.ts +0 -93
  134. package/src/contracts/clients/offerings/index.ts +0 -117
  135. package/src/contracts/clients/secure-requests/index.ts +0 -34
  136. package/src/contracts/clients/sites/index.ts +0 -56
  137. package/src/contracts/clients/trades/index.ts +0 -122
@@ -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
- >;