@dalmore/api-contracts 0.0.0-dev.d07da18 → 0.0.0-dev.d29fb02

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 (205) hide show
  1. package/README.md +23 -19
  2. package/common/types/account-contact.types.ts +2 -1
  3. package/common/types/account-manager.types.ts +3 -7
  4. package/common/types/account-setting.types.ts +65 -0
  5. package/common/types/account.types.ts +1 -0
  6. package/common/types/activity.types.ts +1 -1
  7. package/common/types/auth.types.ts +7 -18
  8. package/common/types/bonus-tier.types.ts +33 -0
  9. package/common/types/cart.types.ts +4 -1
  10. package/common/types/common.types.ts +38 -6
  11. package/common/types/contact-us.types.ts +6 -2
  12. package/common/types/covered-person.types.ts +2 -1
  13. package/common/types/dashboard.types.ts +2 -9
  14. package/common/types/disbursements.types.ts +119 -3
  15. package/common/types/escrow-account.types.ts +3 -3
  16. package/common/types/file.types.ts +17 -1
  17. package/common/types/i-will-do-it-later.types.ts +68 -0
  18. package/common/types/index.ts +2 -0
  19. package/common/types/individuals.types.ts +5 -17
  20. package/common/types/investor-account.types.ts +2 -1
  21. package/common/types/invite.types.ts +27 -1
  22. package/common/types/issuer-offering.types.ts +13 -17
  23. package/common/types/issuer-payment-method.types.ts +41 -0
  24. package/common/types/issuer.types.ts +9 -0
  25. package/common/types/legal-entity.types.ts +3 -2
  26. package/common/types/mail-template.types.ts +34 -0
  27. package/common/types/note.types.ts +1 -1
  28. package/common/types/notification.types.ts +525 -29
  29. package/common/types/offering.types.ts +4 -9
  30. package/common/types/site-settings.types.ts +2 -1
  31. package/common/types/site.types.ts +2 -9
  32. package/common/types/{trade-line-item.type.ts → trade-line-item.types.ts} +2 -9
  33. package/common/types/trade.types.ts +48 -2
  34. package/common/types/transaction.types.ts +12 -1
  35. package/common/types/trusted-contact.types.ts +7 -7
  36. package/common/types/user.types.ts +17 -33
  37. package/contracts/clients/cart/index.ts +21 -1
  38. package/contracts/clients/index.ts +6 -0
  39. package/contracts/{investors → clients}/issuer-payment-methods/index.ts +5 -2
  40. package/contracts/{compliance → clients}/payment-methods/index.ts +40 -12
  41. package/contracts/clients/trade-line-items/index.ts +1 -1
  42. package/contracts/clients/trades/index.ts +1 -1
  43. package/contracts/{investors → clients}/transactions/index.ts +3 -3
  44. package/index.ts +10 -0
  45. package/package.json +23 -32
  46. package/contracts/compliance/account-contacts/index.ts +0 -82
  47. package/contracts/compliance/account-managers/index.ts +0 -142
  48. package/contracts/compliance/accounts/index.ts +0 -187
  49. package/contracts/compliance/activities/index.ts +0 -55
  50. package/contracts/compliance/aic/index.ts +0 -60
  51. package/contracts/compliance/api-keys/index.ts +0 -91
  52. package/contracts/compliance/assets/index.ts +0 -122
  53. package/contracts/compliance/auth/index.ts +0 -134
  54. package/contracts/compliance/batch-jobs/index.ts +0 -62
  55. package/contracts/compliance/bonus-tiers/index.ts +0 -55
  56. package/contracts/compliance/checklist/index.ts +0 -87
  57. package/contracts/compliance/checklist-items/index.ts +0 -86
  58. package/contracts/compliance/covered-persons/index.ts +0 -97
  59. package/contracts/compliance/dashboard/index.ts +0 -111
  60. package/contracts/compliance/data-records/index.ts +0 -116
  61. package/contracts/compliance/data-rooms/index.ts +0 -113
  62. package/contracts/compliance/default-theme-configs/index.ts +0 -95
  63. package/contracts/compliance/disbursement/index.ts +0 -165
  64. package/contracts/compliance/disbursement-approval-users/index.ts +0 -84
  65. package/contracts/compliance/disbursement-transactions/index.ts +0 -37
  66. package/contracts/compliance/domain-filters/index.ts +0 -117
  67. package/contracts/compliance/email-themes/index.ts +0 -284
  68. package/contracts/compliance/escrow-accounts/index.ts +0 -85
  69. package/contracts/compliance/exchange-api-keys/index.ts +0 -129
  70. package/contracts/compliance/exchange-imports/index.ts +0 -137
  71. package/contracts/compliance/files/index.ts +0 -267
  72. package/contracts/compliance/files-public/index.ts +0 -188
  73. package/contracts/compliance/health/index.ts +0 -26
  74. package/contracts/compliance/index.ts +0 -147
  75. package/contracts/compliance/individuals/index.ts +0 -57
  76. package/contracts/compliance/investor-accounts/index.ts +0 -141
  77. package/contracts/compliance/invites/index.ts +0 -137
  78. package/contracts/compliance/issuer-bank-accounts/index.ts +0 -81
  79. package/contracts/compliance/issuer-payment-methods/index.ts +0 -81
  80. package/contracts/compliance/issuers/index.ts +0 -97
  81. package/contracts/compliance/job-items/index.ts +0 -58
  82. package/contracts/compliance/jobs/index.ts +0 -59
  83. package/contracts/compliance/kyb/index.ts +0 -54
  84. package/contracts/compliance/kyc/index.ts +0 -77
  85. package/contracts/compliance/legal-entities/index.ts +0 -57
  86. package/contracts/compliance/login-histories/index.ts +0 -37
  87. package/contracts/compliance/notes/index.ts +0 -69
  88. package/contracts/compliance/notion-databases/index.ts +0 -107
  89. package/contracts/compliance/notion-pages/index.ts +0 -105
  90. package/contracts/compliance/offering-reports/index.ts +0 -149
  91. package/contracts/compliance/offerings/index.ts +0 -233
  92. package/contracts/compliance/pages/index.ts +0 -178
  93. package/contracts/compliance/rejection-reasons/index.ts +0 -32
  94. package/contracts/compliance/review/index.ts +0 -169
  95. package/contracts/compliance/roles/index.ts +0 -34
  96. package/contracts/compliance/secondary-customers/index.ts +0 -77
  97. package/contracts/compliance/secondary-orders/index.ts +0 -60
  98. package/contracts/compliance/secondary-trades/index.ts +0 -100
  99. package/contracts/compliance/secure-requests/index.ts +0 -54
  100. package/contracts/compliance/signer/index.ts +0 -369
  101. package/contracts/compliance/site-links/index.ts +0 -128
  102. package/contracts/compliance/site-settings/index.ts +0 -669
  103. package/contracts/compliance/sites/index.ts +0 -56
  104. package/contracts/compliance/state-machine/index.ts +0 -94
  105. package/contracts/compliance/tasks/index.ts +0 -91
  106. package/contracts/compliance/third-parties/index.ts +0 -52
  107. package/contracts/compliance/trade-line-items/index.ts +0 -59
  108. package/contracts/compliance/trades/index.ts +0 -230
  109. package/contracts/compliance/transactions/index.ts +0 -161
  110. package/contracts/compliance/user-manuals/index.ts +0 -271
  111. package/contracts/compliance/user-settings/index.ts +0 -189
  112. package/contracts/compliance/users/index.ts +0 -200
  113. package/contracts/compliance/webhooks/index.ts +0 -41
  114. package/contracts/compliance-apikey/accounts/index.ts +0 -58
  115. package/contracts/compliance-apikey/index.ts +0 -14
  116. package/contracts/index.ts +0 -6
  117. package/contracts/investors/account-contacts/index.ts +0 -58
  118. package/contracts/investors/aic/index.ts +0 -59
  119. package/contracts/investors/assets/index.ts +0 -61
  120. package/contracts/investors/auth/index.ts +0 -116
  121. package/contracts/investors/bonus-tiers/index.ts +0 -37
  122. package/contracts/investors/cart/index.ts +0 -75
  123. package/contracts/investors/contact-us/index.ts +0 -48
  124. package/contracts/investors/data-records/index.ts +0 -113
  125. package/contracts/investors/data-rooms/index.ts +0 -96
  126. package/contracts/investors/files/index.ts +0 -167
  127. package/contracts/investors/files-public/index.ts +0 -185
  128. package/contracts/investors/index.ts +0 -72
  129. package/contracts/investors/individuals/index.ts +0 -99
  130. package/contracts/investors/investor-accounts/index.ts +0 -110
  131. package/contracts/investors/issuers/index.ts +0 -30
  132. package/contracts/investors/legal-entities/index.ts +0 -93
  133. package/contracts/investors/notes/index.ts +0 -69
  134. package/contracts/investors/offerings/index.ts +0 -93
  135. package/contracts/investors/pages/index.ts +0 -88
  136. package/contracts/investors/payment-methods/index.ts +0 -149
  137. package/contracts/investors/portfolios/index.ts +0 -53
  138. package/contracts/investors/sites/index.ts +0 -96
  139. package/contracts/investors/tasks/index.ts +0 -111
  140. package/contracts/investors/trade-line-items/index.ts +0 -75
  141. package/contracts/investors/trades/index.ts +0 -114
  142. package/contracts/investors/trusted-contacts/index.ts +0 -93
  143. package/contracts/investors/user-manuals/index.ts +0 -62
  144. package/contracts/investors/user-settings/index.ts +0 -170
  145. package/contracts/investors/users/index.ts +0 -45
  146. package/contracts/investors/webhooks/index.ts +0 -30
  147. package/contracts/issuers/account-contacts/index.ts +0 -76
  148. package/contracts/issuers/account-integrations/index.ts +0 -97
  149. package/contracts/issuers/accounts/index.ts +0 -97
  150. package/contracts/issuers/activities/index.ts +0 -54
  151. package/contracts/issuers/aic/index.ts +0 -39
  152. package/contracts/issuers/api-key-logs/index.ts +0 -53
  153. package/contracts/issuers/api-keys/index.ts +0 -93
  154. package/contracts/issuers/assets/index.ts +0 -122
  155. package/contracts/issuers/auth/index.ts +0 -152
  156. package/contracts/issuers/bonus-tiers/index.ts +0 -55
  157. package/contracts/issuers/contact-us/index.ts +0 -48
  158. package/contracts/issuers/covered-persons/index.ts +0 -136
  159. package/contracts/issuers/dashboard/index.ts +0 -72
  160. package/contracts/issuers/data-records/index.ts +0 -257
  161. package/contracts/issuers/data-rooms/index.ts +0 -134
  162. package/contracts/issuers/disbursement-approval-users/index.ts +0 -82
  163. package/contracts/issuers/disbursement-transactions/index.ts +0 -53
  164. package/contracts/issuers/disbursements/index.ts +0 -153
  165. package/contracts/issuers/email-themes/index.ts +0 -242
  166. package/contracts/issuers/escrow-accounts/index.ts +0 -81
  167. package/contracts/issuers/exchange-api-keys/index.ts +0 -144
  168. package/contracts/issuers/files/index.ts +0 -166
  169. package/contracts/issuers/files-public/index.ts +0 -166
  170. package/contracts/issuers/health/index.ts +0 -24
  171. package/contracts/issuers/index.ts +0 -112
  172. package/contracts/issuers/investor-accounts/index.ts +0 -148
  173. package/contracts/issuers/invites/index.ts +0 -129
  174. package/contracts/issuers/issuer/index.ts +0 -94
  175. package/contracts/issuers/issuer-bank-accounts/index.ts +0 -81
  176. package/contracts/issuers/issuer-payment-methods/index.ts +0 -136
  177. package/contracts/issuers/kyc/index.ts +0 -38
  178. package/contracts/issuers/login-histories/index.ts +0 -51
  179. package/contracts/issuers/notes/index.ts +0 -69
  180. package/contracts/issuers/offerings/index.ts +0 -206
  181. package/contracts/issuers/pages/index.ts +0 -138
  182. package/contracts/issuers/payment-methods/index.ts +0 -61
  183. package/contracts/issuers/portfolios/index.ts +0 -36
  184. package/contracts/issuers/rejection-reasons/index.ts +0 -32
  185. package/contracts/issuers/review/index.ts +0 -63
  186. package/contracts/issuers/secondary-customers/index.ts +0 -55
  187. package/contracts/issuers/secondary-orders/index.ts +0 -57
  188. package/contracts/issuers/secondary-trades/index.ts +0 -57
  189. package/contracts/issuers/secure-requests/index.ts +0 -34
  190. package/contracts/issuers/site-links/index.ts +0 -116
  191. package/contracts/issuers/site-settings/index.ts +0 -585
  192. package/contracts/issuers/sites/index.ts +0 -32
  193. package/contracts/issuers/tasks/index.ts +0 -111
  194. package/contracts/issuers/trades/index.ts +0 -132
  195. package/contracts/issuers/transactions/index.ts +0 -158
  196. package/contracts/issuers/user-manuals/index.ts +0 -62
  197. package/contracts/issuers/user-settings/index.ts +0 -170
  198. package/contracts/issuers/users/index.ts +0 -126
  199. package/contracts/secondaries/accounts/index.ts +0 -58
  200. package/contracts/secondaries/index.ts +0 -23
  201. package/contracts/secondaries/secondary-customers/index.ts +0 -55
  202. package/contracts/secondaries/secondary-issuers/index.ts +0 -94
  203. package/contracts/secondaries/secondary-orders/index.ts +0 -56
  204. package/contracts/secondaries/secondary-securities/index.ts +0 -95
  205. package/contracts/secondaries/secondary-trades/index.ts +0 -56
@@ -314,8 +314,23 @@ export const reviewFiles = z.object({
314
314
  });
315
315
  export type reviewFiles = z.infer<typeof reviewFiles>;
316
316
 
317
+ /**
318
+ * Zod preprocessor that trims strings and converts empty/whitespace-only strings to null
319
+ */
320
+ const trimAndNullifyString = z.preprocess((val) => {
321
+ if (typeof val === 'string') {
322
+ const trimmed = val.trim();
323
+ return trimmed === '' ? null : trimmed;
324
+ }
325
+ return val;
326
+ }, z.unknown());
327
+
317
328
  export const PatchFileMetadata = z.object({
318
- corrected: z.record(z.string(), z.unknown()),
329
+ corrected: z.record(z.string(), trimAndNullifyString),
330
+ expectedCorrected: z
331
+ .record(z.string(), trimAndNullifyString)
332
+ .nullable()
333
+ .optional(),
319
334
  });
320
335
  export type PatchFileMetadata = z.infer<typeof PatchFileMetadata>;
321
336
 
@@ -343,6 +358,7 @@ export const FileMetadataSchema = z.object({
343
358
  },
344
359
  ),
345
360
  corrected: z.record(z.any()).optional(),
361
+ expectedCorrected: z.record(z.any()).optional(),
346
362
  });
347
363
  export type FileMetadata = z.infer<typeof FileMetadataSchema>;
348
364
 
@@ -0,0 +1,68 @@
1
+ import { z } from 'zod';
2
+ import { PortalType, TargetTableEnum } from './common.types';
3
+ import { TaskPriority, TaskType } from './task.types';
4
+
5
+ export enum IWillDoItLaterType {
6
+ KYC = 'KYC',
7
+ // Future types can be added here:
8
+ // AIC = 'AIC',
9
+ // AML = 'AML',
10
+ }
11
+
12
+ export const IWillDoItLaterBodySchema = z.object({
13
+ type: z.nativeEnum(IWillDoItLaterType).default(IWillDoItLaterType.KYC),
14
+ });
15
+
16
+ export type IWillDoItLaterBodyType = z.infer<typeof IWillDoItLaterBodySchema>;
17
+
18
+ export const IWillDoItLaterResponseSchema = z.object({
19
+ message: z.string(),
20
+ });
21
+
22
+ export type IWillDoItLaterResponseType = z.infer<
23
+ typeof IWillDoItLaterResponseSchema
24
+ >;
25
+
26
+ /**
27
+ * @description Context required for processing "I'll do it later" actions.
28
+ */
29
+ export interface IWillDoItLaterContext {
30
+ /** The ID of the target entity */
31
+ targetId: string;
32
+ /** The table name of the target entity */
33
+ targetTable: (typeof TargetTableEnum)[number];
34
+ /** The account ID associated with the action */
35
+ accountId: string;
36
+ /** The user ID who will be assigned the task */
37
+ assigneeId: string;
38
+ }
39
+
40
+ /**
41
+ * @description Configuration for each "I'll do it later" action type.
42
+ * Maps action types to their corresponding task configuration.
43
+ */
44
+ export interface IWillDoItLaterTaskConfig {
45
+ taskType: TaskType;
46
+ portalType: PortalType;
47
+ title: string;
48
+ description: string;
49
+ priority: TaskPriority;
50
+ }
51
+
52
+ /**
53
+ * @description Mapping of "I'll do it later" types to their task configurations.
54
+ * This allows for easy extension of new action types without modifying the service logic.
55
+ */
56
+ export const IWillDoItLaterTaskConfigMap: Record<
57
+ IWillDoItLaterType,
58
+ IWillDoItLaterTaskConfig
59
+ > = {
60
+ [IWillDoItLaterType.KYC]: {
61
+ taskType: TaskType.COMPLETE_KYC,
62
+ portalType: PortalType.INVESTOR,
63
+ title: 'Complete KYC',
64
+ description:
65
+ 'We are unable to verify your KYC information. Please complete your KYC.',
66
+ priority: TaskPriority.HIGH,
67
+ },
68
+ };
@@ -42,6 +42,8 @@ export * from './domain-filter.types';
42
42
  export * from './aic.types';
43
43
  export * from './default-theme-config.types';
44
44
  export * from './offering-reports.types';
45
+ export * from './i-will-do-it-later.types';
46
+ export * from './payment-methods.types';
45
47
 
46
48
  export enum Versions {
47
49
  V1 = 'v1',
@@ -12,12 +12,11 @@ import {
12
12
  InvestorAccountType,
13
13
  SetupStatusType,
14
14
  SetupStepType,
15
- ComplianceReview,
16
15
  RetirementAccountType,
17
- TradeStatus,
18
16
  EmploymentStatus,
19
17
  SourceOfIncome,
20
18
  AMLProvider,
19
+ EmailSchema,
21
20
  } from './common.types';
22
21
  import { IBaseEntity } from './entity.types';
23
22
  import { IInvestorAccount } from './investor-account.types';
@@ -60,8 +59,8 @@ export enum aicQuestionnaireQuestionType {
60
59
  }
61
60
 
62
61
  export enum FilterBy {
63
- TRADE = 'TRADE',
64
- INVESTOR = 'INVESTOR',
62
+ ALL = 'ALL',
63
+ PENDING_TRADES = 'PENDING_TRADES',
65
64
  }
66
65
 
67
66
  export const aicQuestionnaireQuestion = z.object({
@@ -243,17 +242,6 @@ export const IndividualFiltersZod = z.object({
243
242
 
244
243
  export const ComplianceIndividualFiltersZod = IndividualFiltersZod.extend({
245
244
  filterBy: z.nativeEnum(FilterBy).optional(),
246
- tradeStatus: z.nativeEnum(TradeStatus).optional(),
247
- complianceReview: z.nativeEnum(ComplianceReview).optional(),
248
- hasPendingTrades: z.preprocess(
249
- (val) =>
250
- val === 'true' || val === '1'
251
- ? true
252
- : val === 'false' || val === '0'
253
- ? false
254
- : val,
255
- z.boolean().optional(),
256
- ),
257
245
  });
258
246
 
259
247
  /**
@@ -301,7 +289,7 @@ export const PostIndividualBodySchema = z
301
289
  .string()
302
290
  .length(3, 'currencyCode must be 3 digits')
303
291
  .optional(),
304
- email: z.string().email().optional(),
292
+ email: EmailSchema.optional(),
305
293
  role: z.nativeEnum(IndividualRole),
306
294
  phone: PhoneZodSchema.openapi({ example: '+12124567890' }).optional(),
307
295
  ownership: z.coerce
@@ -400,7 +388,7 @@ export const UpdateIndividualBodySchema = z
400
388
  .length(3, 'currencyCode must be 3 digits')
401
389
  .optional(),
402
390
  phone: PhoneZodSchema.openapi({ example: '+12124567890' }).optional(),
403
- email: z.string().email().optional(),
391
+ email: EmailSchema.optional(),
404
392
  ownership: z.coerce
405
393
  .number()
406
394
  .min(0, 'Ownership is less than 0')
@@ -24,6 +24,7 @@ import {
24
24
  SortBy,
25
25
  SortOrder,
26
26
  AMLProvider,
27
+ EmailSchema,
27
28
  } from './common.types';
28
29
  import { accountIdSchema } from './account.types';
29
30
  import { SaStatus, tradeIdSchema, TradeZod } from './trade.types';
@@ -131,7 +132,7 @@ export type PostClientInvestorAccountBody = z.infer<
131
132
 
132
133
  export const UpdateInvestorAccountBodySchema = z.object({
133
134
  name: z.string().optional(),
134
- email: z.string().email().optional(),
135
+ email: EmailSchema.optional(),
135
136
  });
136
137
  export type UpdateInvestorAccountBody = z.infer<
137
138
  typeof UpdateInvestorAccountBodySchema
@@ -3,7 +3,9 @@ import {
3
3
  AccountZod,
4
4
  IPaginationMeta,
5
5
  IssuerRole,
6
+ PortalType,
6
7
  UserRole,
8
+ EmailSchema,
7
9
  } from './common.types';
8
10
  import { extendZodWithOpenApi } from '@anatine/zod-openapi';
9
11
  import { TypeID } from 'typeid-js';
@@ -48,7 +50,7 @@ export const InviteWithUrl = InviteWithoutSecretZod.extend({
48
50
  export type InviteWithUrl = z.infer<typeof InviteWithUrl>;
49
51
 
50
52
  export const PostIssuerInviteZod = z.object({
51
- email: z.string().email(),
53
+ email: EmailSchema,
52
54
  role: z.nativeEnum(IssuerRole),
53
55
  });
54
56
 
@@ -131,3 +133,27 @@ export const PatchInviteForComplianceZod = PatchInviteRoleZod.extend({
131
133
  export type PatchInviteForComplianceZod = z.infer<
132
134
  typeof PatchInviteForComplianceZod
133
135
  >;
136
+
137
+ export const PostInviteZod = z.object({
138
+ email: EmailSchema,
139
+ role: z.nativeEnum(UserRole).openapi({
140
+ example: UserRole.ADMIN,
141
+ }),
142
+ accountId: z.string().optional().openapi({
143
+ example: 'account_01j5y5ghx5fg68d663j1fvy2x7',
144
+ }),
145
+ portalType: z.nativeEnum(PortalType).optional().openapi({
146
+ example: PortalType.ISSUER,
147
+ }),
148
+ });
149
+
150
+ export type PostInviteZod = z.infer<typeof PostInviteZod>;
151
+
152
+ export const CompliancePostInviteZod = z.object({
153
+ email: EmailSchema,
154
+ role: z.nativeEnum(UserRole).openapi({
155
+ example: UserRole.ADMIN,
156
+ }),
157
+ });
158
+
159
+ export type CompliancePostInviteZod = z.infer<typeof CompliancePostInviteZod>;
@@ -10,6 +10,7 @@ import {
10
10
  ComplianceReview,
11
11
  DurationType,
12
12
  AssetType,
13
+ StringToBooleanSchema,
13
14
  } from './common.types';
14
15
  import { IBaseEntity } from './entity.types';
15
16
  import { IIssuer, issuerIdSchema } from './issuer.types';
@@ -168,6 +169,7 @@ export const PostIssuerOffering = z
168
169
  .default(AssetTemplateType.STANDARD)
169
170
  .openapi({ example: AssetTemplateType.STANDARD }),
170
171
  tiers: z.array(z.number().positive()).nullable().optional(),
172
+ enableBonus: z.boolean().default(false).optional(),
171
173
  })
172
174
  .superRefine((data, ctx) => {
173
175
  // Check if both values are present, and if so, ensure minInvestment is less than maxInvestment
@@ -192,38 +194,39 @@ export const PatchIssuerOffering = z.object({
192
194
  .max(100)
193
195
  .optional()
194
196
  .openapi({ example: 'Airbnb IPO' }),
197
+ type: z
198
+ .nativeEnum(OfferingType)
199
+ .optional()
200
+ .openapi({ example: OfferingType.REG_D }),
195
201
  targetAmount: z
196
202
  .number()
197
203
  .min(0)
198
204
  .max(10000000000)
199
205
  .optional()
200
206
  .openapi({ example: 120000 }),
201
- raiseAmount: z
202
- .number()
203
- .min(0)
204
- .max(10000000000)
205
- .optional()
206
- .openapi({ example: 200000 }),
207
207
  minInvestment: z
208
208
  .number()
209
209
  .min(0)
210
210
  .max(10000000000)
211
+ .nullable()
211
212
  .optional()
212
213
  .openapi({ example: 1000 }),
213
214
  maxInvestment: z
214
215
  .number()
215
216
  .min(0)
216
217
  .max(10000000000)
218
+ .nullable()
217
219
  .optional()
218
220
  .openapi({ example: 20000 }),
219
221
  contingencyAmount: z
220
222
  .number()
221
223
  .min(0)
222
224
  .max(10000000000)
225
+ .nullable()
223
226
  .optional()
224
227
  .openapi({ example: 5000 }),
225
- startAt: dateSchema.optional().openapi({ example: '10/20/2024' }),
226
- endAt: dateSchema.optional().openapi({ example: '10/27/2024' }),
228
+ startAt: dateSchema.nullable().optional().openapi({ example: '10/20/2024' }),
229
+ endAt: dateSchema.nullable().optional().openapi({ example: '10/27/2024' }),
227
230
  cancellationPeriod: z
228
231
  .number()
229
232
  .min(1)
@@ -299,6 +302,7 @@ export const PatchIssuerOffering = z.object({
299
302
  .optional(),
300
303
  tiers: z.array(z.number().positive()).nullable().optional(),
301
304
  enabled: z.boolean().optional(),
305
+ enableBonus: z.boolean().optional(),
302
306
  });
303
307
  export type PatchIssuerOffering = z.infer<typeof PatchIssuerOffering>;
304
308
 
@@ -368,15 +372,7 @@ export const IssuerOfferingsFilterZod = z.object({
368
372
  issuerId: z.lazy(() => issuerIdSchema).optional(),
369
373
  type: z.nativeEnum(OfferingType).optional(),
370
374
  status: z.nativeEnum(ComplianceReview).optional(),
371
- enabled: z.preprocess(
372
- (val) =>
373
- val === 'true' || val === '1'
374
- ? true
375
- : val === 'false' || val === '0'
376
- ? false
377
- : val,
378
- z.boolean().optional(),
379
- ),
375
+ enabled: StringToBooleanSchema.optional(),
380
376
  managedBy: z.nativeEnum(ManagedByType).optional(),
381
377
  versioningType: z.nativeEnum(OfferingVersioningType).optional(),
382
378
  combinedStatus: z.nativeEnum(OfferingStatus).optional(),
@@ -222,10 +222,51 @@ export type IPaginatedIssuerPaymentMethod = z.infer<
222
222
  typeof IPaginatedIssuerPaymentMethod
223
223
  >;
224
224
 
225
+ const issuerPaymentMethodsInclude = z.enum(['issuer', 'integration']);
226
+
227
+ /**
228
+ * @description Query parameters for including related entities
229
+ * @example in contract use as -> query: PaginationOptionsZod.merge(GetIssuerPaymentMethodZod).merge(IssuerPaymentMethodsIncludeQuery)
230
+ */
231
+ export const IssuerPaymentMethodsIncludeQuery = z.object({
232
+ include: z
233
+ .string()
234
+ .optional()
235
+ .transform((str) => (str ? str.split(',') : []))
236
+ .refine(
237
+ (includes) =>
238
+ includes.every((include) =>
239
+ issuerPaymentMethodsInclude.options.includes(include as any),
240
+ ),
241
+ {
242
+ message: `Invalid include option provided. Valid options are: ${issuerPaymentMethodsInclude.options.join(',')}`,
243
+ },
244
+ )
245
+ .openapi({
246
+ example: `${issuerPaymentMethodsInclude.options.join(',')}`,
247
+ }),
248
+ });
249
+ export type IssuerPaymentMethodsIncludeQuery = z.infer<
250
+ typeof IssuerPaymentMethodsIncludeQuery
251
+ >;
252
+
225
253
  export const GetIssuerPaymentMethodZod = z.object({
226
254
  issuerId: issuerIdSchema.openapi({
227
255
  example: 'issuer_01jdq2crwke8xskjd840cj79pw',
228
256
  }),
257
+ enabled: z
258
+ .string()
259
+ .optional()
260
+ .refine((v) => !v || v === 'true' || v === 'false', {
261
+ message: 'enabled must be a boolean string',
262
+ })
263
+ .transform((v) => {
264
+ if (!v) return undefined;
265
+ return v === 'true';
266
+ })
267
+ .openapi({
268
+ example: 'true',
269
+ }),
229
270
  });
230
271
  export type GetIssuerPaymentMethodZod = z.infer<
231
272
  typeof GetIssuerPaymentMethodZod
@@ -152,6 +152,10 @@ export const PutIssuerZod = z
152
152
  .lazy(() => fileIdSchema)
153
153
  .optional()
154
154
  .nullable(),
155
+ formationDocumentFileId: z
156
+ .lazy(() => fileIdSchema)
157
+ .optional()
158
+ .nullable(),
155
159
  coverArtId: z
156
160
  .lazy(() => fileIdSchema)
157
161
  .optional()
@@ -188,6 +192,11 @@ export const IIssuer = IBaseEntity.extend({
188
192
  accountId: z.string(),
189
193
  account: AccountZod.optional().nullable(),
190
194
  ss4LetterFileId: z.string().nullable(),
195
+ formationDocumentFileId: z.string().nullable(),
196
+ formationDocument: z
197
+ .lazy(() => FileZod)
198
+ .nullable()
199
+ .optional(),
191
200
  status: z
192
201
  .nativeEnum(IssuerStatus)
193
202
  .openapi({ example: IssuerStatus.SUBMITTED }),
@@ -2,6 +2,7 @@ import { z } from 'zod';
2
2
  import { IBaseEntity } from './entity.types';
3
3
  import {
4
4
  dateSchema,
5
+ EmailSchema,
5
6
  IPaginationMeta,
6
7
  KYBStatus,
7
8
  SanctionsStatus,
@@ -138,7 +139,7 @@ export const PostLegalEntitySchema = z
138
139
  investorAccountId: investorAccountIdSchema,
139
140
  name: CompanyNameSchema,
140
141
  ein: EINSchema,
141
- email: z.string().email().optional(),
142
+ email: EmailSchema.optional(),
142
143
  companyType: CompanyTypeSchema.optional(),
143
144
  phone: PhoneZodSchema.openapi({ example: '+12124567890' }).optional(),
144
145
  dateOfIncorporation: z.lazy(() => dateSchema).optional(),
@@ -153,7 +154,7 @@ export const UpdateLegalEntitySchema = z
153
154
  id: legalEntityIdSchema.optional(),
154
155
  name: CompanyNameSchema.optional(),
155
156
  ein: EINSchema,
156
- email: z.string().email().optional(),
157
+ email: EmailSchema.optional(),
157
158
  companyType: CompanyTypeSchema.optional(),
158
159
  phone: PhoneZodSchema.openapi({ example: '+12124567890' }).optional(),
159
160
  dateOfIncorporation: z.lazy(() => dateSchema).optional(),
@@ -434,3 +434,37 @@ export type EmailThemeSetting = z.infer<typeof EmailThemeSettingZod>;
434
434
 
435
435
  export const EmailThemeSettingsZod = z.array(EmailThemeSettingZod);
436
436
  export type EmailThemeSettingsZod = z.infer<typeof EmailThemeSettingsZod>;
437
+
438
+ /**
439
+ * Response from a successful email send operation.
440
+ * Based on SendGrid SDK's ClientResponse structure.
441
+ */
442
+ export const EmailSendResponseSchema = z.object({
443
+ /** HTTP status code from SendGrid (e.g., 202 for accepted) */
444
+ statusCode: z.number(),
445
+ /** SendGrid's x-message-id header for tracking emails in their dashboard */
446
+ messageId: z.string().optional(),
447
+ /** Full response headers, available for debugging if needed */
448
+ headers: z.record(z.string(), z.unknown()).optional(),
449
+ });
450
+ export type EmailSendResponse = z.infer<typeof EmailSendResponseSchema>;
451
+
452
+ /**
453
+ * Error from a failed email send operation.
454
+ * Fields are optional because error shapes vary depending on failure type
455
+ * (network errors vs SendGrid API errors).
456
+ */
457
+ export const EmailSendErrorSchema = z.object({
458
+ /** Human-readable error message */
459
+ message: z.string(),
460
+ /** Network-level error code (e.g., 'ECONNREFUSED', 'ETIMEDOUT') */
461
+ code: z.string().optional(),
462
+ /** HTTP status code if request reached SendGrid (e.g., 400, 401, 403, 413, 500) */
463
+ statusCode: z.number().optional(),
464
+ /**
465
+ * SendGrid's error response body. Structure: { errors: [{ message, field, help, id }] }
466
+ * @see https://www.twilio.com/docs/sendgrid/api-reference/mail-send/mail-send#responses
467
+ */
468
+ response: z.unknown().optional(),
469
+ });
470
+ export type EmailSendError = z.infer<typeof EmailSendErrorSchema>;
@@ -79,7 +79,7 @@ export const PostNoteBody = z.object({
79
79
  export type PostNoteBody = z.infer<typeof PostNoteBody>;
80
80
 
81
81
  export const CompliancePostNoteBody = PostNoteBody.extend({
82
- accountId: accountIdSchema,
82
+ accountId: accountIdSchema.nullable().default(null),
83
83
  });
84
84
 
85
85
  export type CompliancePostNoteBody = z.infer<typeof CompliancePostNoteBody>;