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