@dalmore/api-contracts 1.0.9 → 1.0.10

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 (147) hide show
  1. package/README.md +48 -39
  2. package/common/helpers/index.ts +59 -0
  3. package/{src/common → common}/types/account-contact.types.ts +2 -1
  4. package/{src/common → common}/types/account-manager.types.ts +3 -7
  5. package/common/types/account-setting.types.ts +65 -0
  6. package/{src/common → common}/types/account.types.ts +1 -0
  7. package/{src/common → common}/types/activity.types.ts +1 -1
  8. package/{src/common → common}/types/api-key-logs.types.ts +1 -1
  9. package/{src/common → common}/types/asset.types.ts +14 -14
  10. package/{src/common → common}/types/auth.types.ts +7 -18
  11. package/{src/common → common}/types/bonus-tier.types.ts +33 -0
  12. package/{src/common → common}/types/cart.types.ts +4 -1
  13. package/{src/common → common}/types/common.types.ts +39 -7
  14. package/{src/common → common}/types/contact-us.types.ts +6 -2
  15. package/{src/common → common}/types/covered-person.types.ts +2 -1
  16. package/{src/common → common}/types/dashboard.types.ts +2 -9
  17. package/{src/common → common}/types/data-record.types.ts +1 -1
  18. package/{src/common → common}/types/disbursements.types.ts +119 -3
  19. package/{src/common → common}/types/escrow-account.types.ts +3 -3
  20. package/{src/common → common}/types/file.types.ts +20 -4
  21. package/common/types/i-will-do-it-later.types.ts +68 -0
  22. package/{src/common → common}/types/index.ts +2 -0
  23. package/{src/common → common}/types/individuals.types.ts +5 -17
  24. package/{src/common → common}/types/investor-account.types.ts +2 -1
  25. package/{src/common → common}/types/invite.types.ts +27 -1
  26. package/{src/common → common}/types/issuer-offering.types.ts +113 -30
  27. package/{src/common → common}/types/issuer-payment-method.types.ts +41 -0
  28. package/{src/common → common}/types/issuer.types.ts +9 -0
  29. package/{src/common → common}/types/legal-entity.types.ts +3 -2
  30. package/{src/common → common}/types/note.types.ts +1 -1
  31. package/common/types/notification.types.ts +544 -0
  32. package/{src/common → common}/types/offering.types.ts +106 -20
  33. package/{src/common → common}/types/page.types.ts +1 -1
  34. package/{src/common → common}/types/phone.type.ts +1 -1
  35. package/{src/common → common}/types/site-settings.types.ts +2 -1
  36. package/{src/common → common}/types/site.types.ts +2 -9
  37. package/{src/common/types/trade-line-item.type.ts → common/types/trade-line-item.types.ts} +2 -9
  38. package/{src/common → common}/types/trade.types.ts +137 -4
  39. package/{src/common → common}/types/transaction.types.ts +12 -1
  40. package/{src/common → common}/types/trusted-contact.types.ts +7 -7
  41. package/{src/common → common}/types/user.types.ts +17 -33
  42. package/{src/common → common}/types/zip.type.ts +1 -1
  43. package/contracts/clients/cart/index.ts +80 -0
  44. package/{src/contracts → contracts}/clients/files/index.ts +14 -1
  45. package/{src/contracts → contracts}/clients/files-public/index.ts +15 -1
  46. package/{src/contracts → contracts}/clients/index.ts +10 -0
  47. package/contracts/clients/issuer-payment-methods/index.ts +39 -0
  48. package/contracts/clients/payment-methods/index.ts +85 -0
  49. package/contracts/clients/trade-line-items/index.ts +66 -0
  50. package/{src/contracts → contracts}/clients/trades/index.ts +65 -1
  51. package/contracts/clients/transactions/index.ts +37 -0
  52. package/index.ts +10 -0
  53. package/package.json +32 -11
  54. package/index.mjs +0 -10876
  55. package/src/common/types/address.spec.ts +0 -203
  56. package/src/common/types/common.types.spec.ts +0 -336
  57. package/src/common/types/contract-helpers.ts +0 -205
  58. package/src/common/types/files.types.spec.ts +0 -154
  59. package/src/common/types/issuer-payment-method.types.spec.ts +0 -612
  60. package/src/common/types/notification.types.ts +0 -58
  61. package/src/common/types/offering.types.spec.ts +0 -91
  62. package/src/common/types/phone.spec.ts +0 -76
  63. package/src/common/types/site-link.types.spec.ts +0 -134
  64. /package/{src/common → common}/types/account-detail.types.ts +0 -0
  65. /package/{src/common → common}/types/account-integration.types.ts +0 -0
  66. /package/{src/common → common}/types/address.types.ts +0 -0
  67. /package/{src/common → common}/types/aic.types.ts +0 -0
  68. /package/{src/common → common}/types/aml.types.ts +0 -0
  69. /package/{src/common → common}/types/api-keys.types.ts +0 -0
  70. /package/{src/common → common}/types/batch-jobs.types.ts +0 -0
  71. /package/{src/common → common}/types/checklist-items.types.ts +0 -0
  72. /package/{src/common → common}/types/checklist.types.ts +0 -0
  73. /package/{src/common → common}/types/comply-advantage-api.types.ts +0 -0
  74. /package/{src/common → common}/types/comply-advantage.types.ts +0 -0
  75. /package/{src/common → common}/types/countries.types.ts +0 -0
  76. /package/{src/common → common}/types/data-room.types.ts +0 -0
  77. /package/{src/common → common}/types/default-theme-config.types.ts +0 -0
  78. /package/{src/common → common}/types/disbursement-adjustment.types.ts +0 -0
  79. /package/{src/common → common}/types/disbursement-approval-user.types.ts +0 -0
  80. /package/{src/common → common}/types/disbursement-review.types.ts +0 -0
  81. /package/{src/common → common}/types/disbursement-transaction.types.ts +0 -0
  82. /package/{src/common → common}/types/domain-filter.types.ts +0 -0
  83. /package/{src/common → common}/types/email-theme.types.ts +0 -0
  84. /package/{src/common → common}/types/entity.types.ts +0 -0
  85. /package/{src/common → common}/types/error-responses.types.ts +0 -0
  86. /package/{src/common → common}/types/exchange-api-key.types.ts +0 -0
  87. /package/{src/common → common}/types/exchange-import.types.ts +0 -0
  88. /package/{src/common → common}/types/exchange-provider.types.ts +0 -0
  89. /package/{src/common → common}/types/health.types.ts +0 -0
  90. /package/{src/common → common}/types/investorAccountIdSchema.type.ts +0 -0
  91. /package/{src/common → common}/types/investors-offering.types.ts +0 -0
  92. /package/{src/common → common}/types/issuer-bank-account.types.ts +0 -0
  93. /package/{src/common → common}/types/job-item.types.ts +0 -0
  94. /package/{src/common → common}/types/jobs.types.ts +0 -0
  95. /package/{src/common → common}/types/kyb.types.ts +0 -0
  96. /package/{src/common → common}/types/kyc.types.ts +0 -0
  97. /package/{src/common → common}/types/login-history.types.ts +0 -0
  98. /package/{src/common → common}/types/mail-template.types.ts +0 -0
  99. /package/{src/common → common}/types/north-cap-integration.types.ts +0 -0
  100. /package/{src/common → common}/types/notion-api.types.ts +0 -0
  101. /package/{src/common → common}/types/notion-database.types.ts +0 -0
  102. /package/{src/common → common}/types/notion-page.types.ts +0 -0
  103. /package/{src/common → common}/types/offering-reports.types.ts +0 -0
  104. /package/{src/common → common}/types/offering-submission.types.ts +0 -0
  105. /package/{src/common → common}/types/page-revision.types.ts +0 -0
  106. /package/{src/common → common}/types/password.type.ts +0 -0
  107. /package/{src/common → common}/types/payment-methods.types.ts +0 -0
  108. /package/{src/common → common}/types/portfolio.types.ts +0 -0
  109. /package/{src/common → common}/types/privacy-policy-and-tos.types.ts +0 -0
  110. /package/{src/common → common}/types/queue.types.ts +0 -0
  111. /package/{src/common → common}/types/registered-reps.types.ts +0 -0
  112. /package/{src/common → common}/types/rejection-reasons.types.ts +0 -0
  113. /package/{src/common → common}/types/reminder-config.types.ts +0 -0
  114. /package/{src/common → common}/types/review.types.ts +0 -0
  115. /package/{src/common → common}/types/role.types.ts +0 -0
  116. /package/{src/common → common}/types/secondary-customer.types.ts +0 -0
  117. /package/{src/common → common}/types/secondary-issuer.types.ts +0 -0
  118. /package/{src/common → common}/types/secondary-order.types.ts +0 -0
  119. /package/{src/common → common}/types/secondary-security.types.ts +0 -0
  120. /package/{src/common → common}/types/secondary-trade.entity.ts +0 -0
  121. /package/{src/common → common}/types/secondary-trade.types.ts +0 -0
  122. /package/{src/common → common}/types/secure-request.types.ts +0 -0
  123. /package/{src/common → common}/types/signer.types.ts +0 -0
  124. /package/{src/common → common}/types/site-link.types.ts +0 -0
  125. /package/{src/common → common}/types/sms.types.ts +0 -0
  126. /package/{src/common → common}/types/state-machine.types.ts +0 -0
  127. /package/{src/common → common}/types/states.types.ts +0 -0
  128. /package/{src/common → common}/types/subdoc-preview.types.ts +0 -0
  129. /package/{src/common → common}/types/task.types.ts +0 -0
  130. /package/{src/common → common}/types/trade-adjustment.type.ts +0 -0
  131. /package/{src/common → common}/types/typography.types.ts +0 -0
  132. /package/{src/common → common}/types/user-manual.types.ts +0 -0
  133. /package/{src/common → common}/types/user-setting.types.ts +0 -0
  134. /package/{src/common → common}/types/webhook.types.ts +0 -0
  135. /package/{src/contracts → contracts}/clients/accounts/index.ts +0 -0
  136. /package/{src/contracts → contracts}/clients/aic/index.ts +0 -0
  137. /package/{src/contracts → contracts}/clients/api-key-logs/index.ts +0 -0
  138. /package/{src/contracts → contracts}/clients/api-keys/index.ts +0 -0
  139. /package/{src/contracts → contracts}/clients/assets/index.ts +0 -0
  140. /package/{src/contracts → contracts}/clients/auth/index.ts +0 -0
  141. /package/{src/contracts → contracts}/clients/individuals/index.ts +0 -0
  142. /package/{src/contracts → contracts}/clients/investor-accounts/index.ts +0 -0
  143. /package/{src/contracts → contracts}/clients/issuers/index.ts +0 -0
  144. /package/{src/contracts → contracts}/clients/legal-entities/index.ts +0 -0
  145. /package/{src/contracts → contracts}/clients/offerings/index.ts +0 -0
  146. /package/{src/contracts → contracts}/clients/secure-requests/index.ts +0 -0
  147. /package/{src/contracts → contracts}/clients/sites/index.ts +0 -0
@@ -15,6 +15,9 @@ import {
15
15
  SortBy,
16
16
  OfferingVersioningType,
17
17
  OfferingOnboardingStatus,
18
+ AssetType,
19
+ DurationType,
20
+ StringToBooleanSchema,
18
21
  } from './common.types';
19
22
  import { IBaseEntity } from './entity.types';
20
23
  import { fileIdSchema, FileZod } from './file.types';
@@ -24,6 +27,7 @@ import {
24
27
  InvestorsOfferingsIncludeQuery,
25
28
  } from './investors-offering.types';
26
29
  import { OfferingStatus } from './issuer-offering.types';
30
+ import { postAssetRefinement, AssetTemplateType } from './asset.types';
27
31
 
28
32
  export enum OfferingFeeType {
29
33
  FIXED = 'FIXED',
@@ -115,7 +119,7 @@ export const IPaginatedOffering = z.object({
115
119
  });
116
120
  export type IPaginatedOffering = z.infer<typeof IPaginatedOffering>;
117
121
 
118
- export const PatchOffering = z.object({
122
+ export const PatchOfferingBase = z.object({
119
123
  name: z.string().optional(),
120
124
  description: z.string().nullable().optional(),
121
125
  tid: z.string().optional(),
@@ -148,8 +152,8 @@ export const PatchOffering = z.object({
148
152
  .openapi({ example: 5000 })
149
153
  .optional()
150
154
  .nullable(),
151
- startAt: dateSchema.optional(),
152
- endAt: dateSchema.optional(),
155
+ startAt: dateSchema.optional().openapi({ example: '10/20/2024' }),
156
+ endAt: dateSchema.optional().openapi({ example: '10/27/2024' }),
153
157
  platform: z.string().optional(),
154
158
  coverArtId: z
155
159
  .lazy(() => fileIdSchema)
@@ -175,16 +179,108 @@ export const PatchOffering = z.object({
175
179
  showTotalRaised: z.boolean().optional(),
176
180
  issuerId: issuerIdSchema.optional(),
177
181
  });
178
-
182
+ export const PatchOffering = PatchOfferingBase.merge(
183
+ z.object({
184
+ assetName: z
185
+ .string()
186
+ .min(2)
187
+ .max(50)
188
+ .optional()
189
+ .openapi({ example: 'Asset name' }),
190
+ assetType: z
191
+ .nativeEnum(AssetType)
192
+ .optional()
193
+ .openapi({ example: AssetType.STOCK }),
194
+ pricePerUnit: z
195
+ .number()
196
+ .min(0.01)
197
+ .max(10000000000)
198
+ .nullable()
199
+ .optional()
200
+ .openapi({ example: 2000 }),
201
+ totalUnits: z
202
+ .number()
203
+ .min(1)
204
+ .max(10000000000)
205
+ .nullable()
206
+ .optional()
207
+ .openapi({ example: 5200 }),
208
+ yield: z
209
+ .number()
210
+ .min(0.01)
211
+ .max(10000000000)
212
+ .nullable()
213
+ .optional()
214
+ .openapi({ example: 1200 }),
215
+ duration: z
216
+ .number()
217
+ .min(1)
218
+ .max(1000)
219
+ .nullable()
220
+ .optional()
221
+ .openapi({ example: 1 }),
222
+ durationType: z
223
+ .nativeEnum(DurationType)
224
+ .nullable()
225
+ .optional()
226
+ .openapi({ example: DurationType.DAY }),
227
+ template: z
228
+ .nativeEnum(AssetTemplateType)
229
+ .default(AssetTemplateType.STANDARD)
230
+ .openapi({ example: AssetTemplateType.STANDARD })
231
+ .nullable()
232
+ .optional(),
233
+ tiers: z.array(z.number().positive()).nullable().optional(),
234
+ enableBonus: z.boolean().optional(),
235
+ }),
236
+ );
179
237
  export type PatchOffering = z.infer<typeof PatchOffering>;
180
238
 
181
- export const PostComplianceOffering = PatchOffering.merge(
239
+ export const PostComplianceOffering = PatchOfferingBase.merge(
182
240
  z.object({
183
241
  accountId: accountIdSchema,
242
+ managedBy: z.nativeEnum(ManagedByType).optional(),
243
+ assetName: z.string().min(2).max(50).openapi({ example: 'Asset name' }),
244
+ assetType: z.nativeEnum(AssetType).openapi({ example: AssetType.STOCK }),
245
+ pricePerUnit: z
246
+ .number()
247
+ .min(0.01)
248
+ .max(10000000000)
249
+ .nullable()
250
+ .openapi({ example: 2000 }),
251
+ totalUnits: z
252
+ .number()
253
+ .min(1)
254
+ .max(10000000000)
255
+ .nullable()
256
+ .openapi({ example: 5200 }),
257
+ yield: z
258
+ .number()
259
+ .min(0.01)
260
+ .max(10000000000)
261
+ .nullable()
262
+ .optional()
263
+ .openapi({ example: 1200 }),
264
+ duration: z
265
+ .number()
266
+ .min(1)
267
+ .max(1000)
268
+ .nullable()
269
+ .optional()
270
+ .openapi({ example: 1 }),
271
+ durationType: z
272
+ .nativeEnum(DurationType)
273
+ .nullable()
274
+ .optional()
275
+ .openapi({ example: DurationType.DAY }),
276
+ template: z
277
+ .nativeEnum(AssetTemplateType)
278
+ .default(AssetTemplateType.STANDARD)
279
+ .openapi({ example: AssetTemplateType.STANDARD }),
280
+ tiers: z.array(z.number().positive()).nullable().optional(),
281
+ enableBonus: z.boolean().default(false).optional(),
184
282
  }),
185
- ).extend({
186
- managedBy: z.nativeEnum(ManagedByType).optional(),
187
- });
283
+ ).superRefine(postAssetRefinement);
188
284
  export type PostComplianceOffering = z.infer<typeof PostComplianceOffering>;
189
285
 
190
286
  export const offeringsInclude = z.enum([
@@ -251,15 +347,7 @@ export const OfferingFiltersZod = z.object({
251
347
  issuerId: z.lazy(() => issuerIdSchema).optional(),
252
348
  type: z.nativeEnum(OfferingType).optional(),
253
349
  status: z.nativeEnum(ComplianceReview).optional(),
254
- enabled: z.preprocess(
255
- (val) =>
256
- val === 'true' || val === '1'
257
- ? true
258
- : val === 'false' || val === '0'
259
- ? false
260
- : val,
261
- z.boolean().optional(),
262
- ),
350
+ enabled: StringToBooleanSchema.optional(),
263
351
  managedBy: z.nativeEnum(ManagedByType).optional(),
264
352
  versioningType: z.nativeEnum(OfferingVersioningType).optional(),
265
353
  combinedStatus: z.nativeEnum(OfferingStatus).optional(),
@@ -546,11 +634,9 @@ export type PaginatedPendingOfferingSummaryResponse = z.infer<
546
634
  >;
547
635
 
548
636
  export type OfferingUpdateFields = {
549
- platform?: string;
550
- platformSettings?: string | null;
551
637
  managedBy?: ManagedByType | null;
552
- enabled?: boolean;
553
638
  showTotalRaised?: boolean;
639
+ enabled?: boolean;
554
640
  };
555
641
 
556
642
  export const ReviewOfferingOnboarding = z.object({
@@ -14,7 +14,7 @@ import {
14
14
  UrlSchema,
15
15
  } from './common.types';
16
16
  import { accountIdSchema } from './account.types';
17
- import { slugify } from './contract-helpers';
17
+ import { slugify } from '../helpers';
18
18
  import { fileIdSchema } from './file.types';
19
19
 
20
20
  extendZodWithOpenApi(z);
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { normalizePhoneNumber } from './contract-helpers';
2
+ import { normalizePhoneNumber } from '../helpers';
3
3
  import { CountryCodes } from './countries.types';
4
4
  import { CountryCode } from 'libphonenumber-js';
5
5
  import { ok } from 'neverthrow';
@@ -3,6 +3,7 @@ import { z } from 'zod';
3
3
  import { fileIdSchema } from './file.types';
4
4
  import {
5
5
  AccountZod,
6
+ EmailSchema,
6
7
  HexCodeColorSchema,
7
8
  IPaginationMeta,
8
9
  SubdomainSchema,
@@ -462,7 +463,7 @@ export const GetSenderEmailZod = z.object({
462
463
  export type GetSenderEmailZod = z.infer<typeof GetSenderEmailZod>;
463
464
 
464
465
  export const PatchSenderEmailZod = z.object({
465
- senderEmail: z.string().email().openapi({ example: 'example@example.com' }),
466
+ senderEmail: EmailSchema,
466
467
  });
467
468
  export type PatchSenderEmailZod = z.infer<typeof PatchSenderEmailZod>;
468
469
 
@@ -5,6 +5,7 @@ import {
5
5
  AccountStatus,
6
6
  AccountZod,
7
7
  IPaginationMeta,
8
+ StringToBooleanSchema,
8
9
  UrlSchema,
9
10
  } from './common.types';
10
11
  import { accountIdSchema } from './account.types';
@@ -73,15 +74,7 @@ export const SitesParamSchema = z.object({
73
74
  export const SitesFiltersZod = z.object({
74
75
  url: z.string().optional(),
75
76
  accountId: accountIdSchema.optional(),
76
- enabled: z.preprocess(
77
- (val) =>
78
- val === 'true' || val === '1'
79
- ? true
80
- : val === 'false' || val === '0'
81
- ? false
82
- : val,
83
- z.boolean().optional(),
84
- ),
77
+ enabled: StringToBooleanSchema.optional(),
85
78
  });
86
79
 
87
80
  const sitesInclude = z.enum(['account']);
@@ -8,6 +8,7 @@ import {
8
8
  IPaginationMeta,
9
9
  OfferingType,
10
10
  SignatureStatus,
11
+ StringToBooleanSchema,
11
12
  } from './common.types';
12
13
  import { fileIdSchema } from './file.types';
13
14
  import { accountIdSchema } from './account.types';
@@ -107,15 +108,7 @@ export type TradeLineItemQuery = z.infer<typeof TradeLineItemQuery>;
107
108
 
108
109
  export const TradeLineItemFiltersQuery = z.object({
109
110
  accountId: accountIdSchema.optional(),
110
- hasSubdoc: z.preprocess(
111
- (val) =>
112
- val === 'true' || val === '1'
113
- ? true
114
- : val === 'false' || val === '0'
115
- ? false
116
- : val,
117
- z.boolean().optional(),
118
- ),
111
+ hasSubdoc: StringToBooleanSchema.optional(),
119
112
  saStatus: z.nativeEnum(SignatureStatus).optional(),
120
113
  offeringId: z.lazy(() => offeringIdSchema).optional(),
121
114
  search: z.string().max(50).optional(),
@@ -22,31 +22,106 @@ import {
22
22
  AccountStatus,
23
23
  SavedQuery,
24
24
  } from './common.types';
25
- import { offeringIdSchema } from './offering.types';
25
+ import { IOffering, offeringIdSchema } from './offering.types';
26
26
  import { IBaseEntity } from './entity.types';
27
27
  import { extendZodWithOpenApi } from '@anatine/zod-openapi';
28
28
  import { TypeID } from 'typeid-js';
29
29
  import {
30
30
  paymentMethodIdSchema,
31
+ PaymentMethodResponse,
31
32
  PaymentMethodType,
32
33
  } from './payment-methods.types';
33
34
  import {
34
35
  investorAccountIdSchema,
35
36
  InvestorAccountExportFilters,
36
37
  ComplianceInvestorAccountExportFilters,
38
+ RegisteredInvestorUserRawZod,
39
+ IInvestorAccount,
37
40
  } from './investor-account.types';
38
41
  import {
39
42
  tradeLineItemIdSchema,
40
43
  TradeLineItemZod,
41
- } from './trade-line-item.type';
44
+ } from './trade-line-item.types';
42
45
  import { TradeAdjustmentZod } from './trade-adjustment.type';
43
46
  import { TransactionZod } from './transaction.types';
44
47
  import { accountIdSchema } from './account.types';
45
48
  import { userIdSchema } from './user.types';
46
49
  import { issuerIdSchema } from './issuer.types';
47
- import { GetSecondaryCustomerFiltersZod } from './secondary-customer.types';
48
- import { SecondaryTradeFiltersZod } from './secondary-trade.types';
50
+ import {
51
+ GetSecondaryCustomerFiltersZod,
52
+ SecondaryCustomer,
53
+ } from './secondary-customer.types';
54
+ import {
55
+ SecondaryTrade,
56
+ SecondaryTradeFiltersZod,
57
+ } from './secondary-trade.types';
58
+ import { InvestorAccount } from '../../investor-accounts/entities/investor-account.entity';
59
+ import { Trade } from '../../trades/entities/trade.entity';
60
+ import { fileIdSchema } from './file.types';
61
+
49
62
  extendZodWithOpenApi(z);
63
+
64
+ // Zod schemas for attach subdoc endpoints
65
+ export const PostAttachSubdocBody = z.object({
66
+ lineItemId: tradeLineItemIdSchema.openapi({
67
+ example: 'trade_line_item_01kctsycw3fq7sj6hedvy62cja',
68
+ }),
69
+ fileId: z
70
+ .lazy(() => fileIdSchema)
71
+ .openapi({ example: 'file_01je6ht4b8fbmttkzh2hs82xqp' }),
72
+ primarySignatureStatus: z
73
+ .nativeEnum(SignatureStatus)
74
+ .openapi({ example: 'SIGNED' }),
75
+ secondarySignatureStatus: z
76
+ .nativeEnum(SignatureStatus)
77
+ .optional()
78
+ .openapi({ example: 'SIGNED' }),
79
+ });
80
+ export type PostAttachSubdocBody = z.infer<typeof PostAttachSubdocBody>;
81
+
82
+ export const PutAttachSubdocBody = z.object({
83
+ lineItemId: tradeLineItemIdSchema
84
+ .optional()
85
+ .openapi({ example: 'trade_line_item_01kctsycw3fq7sj6hedvy62cja' }),
86
+ fileId: z
87
+ .lazy(() => fileIdSchema)
88
+ .optional()
89
+ .openapi({ example: 'file_01je6ht4b8fbmttkzh2hs82xqp' }),
90
+ primarySignatureStatus: z
91
+ .nativeEnum(SignatureStatus)
92
+ .optional()
93
+ .openapi({ example: 'SIGNED' }),
94
+ secondarySignatureStatus: z
95
+ .nativeEnum(SignatureStatus)
96
+ .optional()
97
+ .openapi({ example: 'SIGNED' }),
98
+ });
99
+ export type PutAttachSubdocBody = z.infer<typeof PutAttachSubdocBody>;
100
+
101
+ export const PatchSubdocSignatureBody = z.object({
102
+ lineItemId: tradeLineItemIdSchema.optional().openapi({
103
+ example: 'trade_line_item_01kctsycw3fq7sj6hedvy62cja',
104
+ description:
105
+ 'Optional. If not provided, updates the first line item with an attached subdoc. Required for trades with multiple line items.',
106
+ }),
107
+ primarySignatureStatus: z.nativeEnum(SignatureStatus).optional().openapi({
108
+ example: 'SIGNED',
109
+ description: 'Primary signer signature status',
110
+ }),
111
+ secondarySignatureStatus: z.nativeEnum(SignatureStatus).optional().openapi({
112
+ example: 'SIGNED',
113
+ description:
114
+ 'Secondary signer signature status. Only applicable for JOINT investor accounts.',
115
+ }),
116
+ });
117
+ export type PatchSubdocSignatureBody = z.infer<typeof PatchSubdocSignatureBody>;
118
+
119
+ export const AttachSubdocResponse = z.object({
120
+ success: z.boolean(),
121
+ message: z.string(),
122
+ });
123
+ export type AttachSubdocResponse = z.infer<typeof AttachSubdocResponse>;
124
+
50
125
  export const CheckResultsSchema = z.object({
51
126
  fundingStatus: z.boolean(),
52
127
  agreementStatus: z.boolean(),
@@ -59,6 +134,7 @@ export const CheckResultsSchema = z.object({
59
134
  export type CheckResults = z.infer<typeof CheckResultsSchema>;
60
135
 
61
136
  export const TradeIdPrefix = 'trade';
137
+ export const TradeSnapshotIdPrefix = 'trade_snapshot';
62
138
 
63
139
  export const tradeIdSchema = z.string().refine(
64
140
  (value) => {
@@ -97,6 +173,21 @@ export const tradeIdOrTidSchema = z.union([
97
173
  .openapi({ example: 'tid_00041061050r3gg28a1c60t3gf' }),
98
174
  ]);
99
175
 
176
+ export const tradeSnapshotIdSchema = z.string().refine(
177
+ (value) => {
178
+ try {
179
+ const tid = TypeID.fromString(value);
180
+ return tid.getType() === TradeSnapshotIdPrefix;
181
+ } catch {
182
+ return false;
183
+ }
184
+ },
185
+ {
186
+ message:
187
+ 'Invalid trade snapshot ID format. Must be a valid TypeID with "trade_snapshot" prefix. ex: trade_snapshot_00041061050r3gg28a1c60t3gf',
188
+ },
189
+ );
190
+
100
191
  export enum SaStatus {
101
192
  PENDING = BaseStatus.PENDING,
102
193
  SIGNED = BaseStatus.SIGNED,
@@ -192,11 +283,30 @@ export const PatchSaLogSchema = z.object({
192
283
 
193
284
  export type PatchSaLogSchema = z.infer<typeof PatchSaLogSchema>;
194
285
 
286
+ export const TradeBalanceResultZod = z.object({
287
+ tradeAdjustments: z.number().multipleOf(0.01),
288
+ chargedAmount: z.number().multipleOf(0.01),
289
+ balance: z.number().multipleOf(0.01),
290
+ });
291
+ export type TradeBalanceResultZod = z.infer<typeof TradeBalanceResultZod>;
292
+
195
293
  export const TradeZod = IBaseEntity.extend({
196
294
  investorAccountId: z.lazy(() => investorAccountIdSchema.nullable()),
295
+ investorAccount: z
296
+ .lazy(() => IInvestorAccount)
297
+ .optional()
298
+ .nullable(),
299
+ offering: z
300
+ .lazy(() => IOffering)
301
+ .optional()
302
+ .nullable(),
197
303
  accountId: accountIdSchema.nullable(),
198
304
  offeringId: z.lazy(() => offeringIdSchema.nullable()),
199
305
  paymentMethodId: z.lazy(() => paymentMethodIdSchema).nullable(),
306
+ paymentMethod: z
307
+ .lazy(() => PaymentMethodResponse)
308
+ .optional()
309
+ .nullable(),
200
310
  userId: z.lazy(() => userIdSchema.nullable()),
201
311
  tradeNumber: z.string(),
202
312
  ip: z.string().nullable(),
@@ -262,6 +372,21 @@ export const TradeZod = IBaseEntity.extend({
262
372
  });
263
373
  export type TradeZod = z.infer<typeof TradeZod>;
264
374
 
375
+ export enum SnapshotEvent {
376
+ COMPLIANCE_APPROVED = 'COMPLIANCE_APPROVED',
377
+ COMPLIANCE_REJECTED = 'COMPLIANCE_REJECTED',
378
+ CANCELLED = 'CANCELLED',
379
+ PLACED = 'PLACED',
380
+ SETTLED = 'SETTLED',
381
+ }
382
+
383
+ export const GetTradeSnapshotEventsResponse = z.object({
384
+ events: z.array(z.nativeEnum(SnapshotEvent)),
385
+ });
386
+ export type GetTradeSnapshotEventsResponse = z.infer<
387
+ typeof GetTradeSnapshotEventsResponse
388
+ >;
389
+
265
390
  export const IPaginatedTrade = z.object({
266
391
  items: z.array(TradeZod),
267
392
  meta: IPaginationMeta,
@@ -344,6 +469,7 @@ export const TradeFiltersZod = z.object({
344
469
  .openapi({
345
470
  example: 'issuer_01jfw4q6qef30s6fpqtsxw94ya',
346
471
  }),
472
+ snapshotEvent: z.nativeEnum(SnapshotEvent).optional(),
347
473
  offeringType: z.nativeEnum(OfferingType).optional(),
348
474
  managedBy: z.nativeEnum(ManagedByType).optional(),
349
475
  platform: z.nativeEnum(Platforms).optional(),
@@ -910,3 +1036,10 @@ export type BulkExportFilters =
910
1036
  | ComplianceTradeExportFilters
911
1037
  | SecondaryCustomerExportFilters
912
1038
  | SecondaryTradeExportFilters;
1039
+
1040
+ export type BulkExportResponse =
1041
+ | InvestorAccount[]
1042
+ | RegisteredInvestorUserRawZod[]
1043
+ | Trade[]
1044
+ | SecondaryCustomer[]
1045
+ | SecondaryTrade[];
@@ -1,10 +1,11 @@
1
+ import { z } from 'zod';
2
+ import { extendZodWithOpenApi } from '@anatine/zod-openapi';
1
3
  import { TypeID } from 'typeid-js';
2
4
  import {
3
5
  dateSchema,
4
6
  InvestorAccountType,
5
7
  numberPrecisionSchema,
6
8
  } from './common.types';
7
- import { z } from 'zod';
8
9
  import { IBaseEntity } from './entity.types';
9
10
  import { accountIdSchema } from './account.types';
10
11
  import {
@@ -18,7 +19,9 @@ import {
18
19
  investorAccountIdSchema,
19
20
  } from './investor-account.types';
20
21
  import { TransactionStatus, TransactionType } from './common.types';
22
+ import { userIdSchema } from './user.types';
21
23
  export { TransactionStatus, TransactionType };
24
+ extendZodWithOpenApi(z);
22
25
 
23
26
  export enum RefundPaymentMethod {
24
27
  CHECK = 'CHECK',
@@ -115,6 +118,14 @@ export type InvestorPostTransactionZod = z.infer<
115
118
  typeof InvestorPostTransactionZod
116
119
  >;
117
120
 
121
+ export const ClientPostTransactionZod = InvestorPostTransactionZod.extend({
122
+ userId: z
123
+ .lazy(() => userIdSchema)
124
+ .openapi({ example: 'user_01j5y5ghx5fg68d663j1fvy2x7' }),
125
+ });
126
+
127
+ export type ClientPostTransactionZod = z.infer<typeof ClientPostTransactionZod>;
128
+
118
129
  export const refundTransactionIdSchema = z.string().refine(
119
130
  (value) => {
120
131
  try {
@@ -2,7 +2,11 @@ import { extendZodWithOpenApi } from '@anatine/zod-openapi';
2
2
  import { TypeID } from 'typeid-js';
3
3
  import { z } from 'zod';
4
4
  import { IBaseEntity } from './entity.types';
5
- import { IPaginationMeta, TrustedContactRelationship } from './common.types';
5
+ import {
6
+ EmailSchema,
7
+ IPaginationMeta,
8
+ TrustedContactRelationship,
9
+ } from './common.types';
6
10
  import { PhoneZodSchema } from './phone.type';
7
11
  import { AddressSchema } from './address.types';
8
12
  import { investorAccountIdSchema } from './investor-account.types';
@@ -68,7 +72,7 @@ export const PostTrustedContactZod = z
68
72
  .object({
69
73
  firstName: z.string().min(1).max(255).openapi({ example: 'John' }),
70
74
  lastName: z.string().min(1).max(255).openapi({ example: 'Doe' }),
71
- email: z.string().email().openapi({ example: 'john.doe@example.com' }),
75
+ email: EmailSchema.openapi({ example: 'john.doe@example.com' }),
72
76
  phone: PhoneZodSchema.nullable().optional(),
73
77
  relationship: z
74
78
  .nativeEnum(TrustedContactRelationship)
@@ -92,11 +96,7 @@ export const PatchTrustedContactZod = z
92
96
  .optional()
93
97
  .openapi({ example: 'John' }),
94
98
  lastName: z.string().min(1).max(255).optional().openapi({ example: 'Doe' }),
95
- email: z
96
- .string()
97
- .email()
98
- .optional()
99
- .openapi({ example: 'john.doe@example.com' }),
99
+ email: EmailSchema.optional(),
100
100
  phone: PhoneZodSchema.nullable().optional(),
101
101
  relationship: z.nativeEnum(TrustedContactRelationship).optional().openapi({
102
102
  example: TrustedContactRelationship.CHILD,
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ import { extendZodWithOpenApi } from '@anatine/zod-openapi';
2
3
  import {
3
4
  AccountStatus,
4
5
  AccountWithoutUsersZod,
@@ -7,12 +8,12 @@ import {
7
8
  ManagedByType,
8
9
  OfferingType,
9
10
  PortalType,
11
+ StringToBooleanSchema,
10
12
  UserRole,
11
- UserStatus,
12
13
  UserType,
14
+ EmailSchema,
13
15
  } from './common.types';
14
16
  import { dateOrString, IBaseEntity } from './entity.types';
15
- import { extendZodWithOpenApi } from '@anatine/zod-openapi';
16
17
  import { PhoneZodSchema } from './phone.type';
17
18
  import { IInvestorAccount } from './investor-account.types';
18
19
  import { TradeZod } from './trade.types';
@@ -51,6 +52,11 @@ export const UserDeleteResponse = z.object({
51
52
  });
52
53
  export type UserDeleteResponse = z.infer<typeof UserDeleteResponse>;
53
54
 
55
+ export const UserRestoreResponse = z.object({
56
+ message: z.string(),
57
+ });
58
+ export type UserRestoreResponse = z.infer<typeof UserRestoreResponse>;
59
+
54
60
  export const GetMeResponse = IBaseEntity.extend({
55
61
  accountId: z.string().nullable(),
56
62
  accountName: z.string().nullable(),
@@ -59,7 +65,7 @@ export const GetMeResponse = IBaseEntity.extend({
59
65
  email: z.string().email(),
60
66
  provider: z.string(),
61
67
  active: z.boolean(),
62
- status: z.lazy(() => z.nativeEnum(UserStatus)),
68
+ locked: z.boolean(),
63
69
  lastLoginAt: dateOrString.nullable(),
64
70
  loginCount: z.number(),
65
71
  role: z.string(),
@@ -142,11 +148,7 @@ export const UserMeUpdateZod = z.object({
142
148
  firstName: z.string().optional(),
143
149
  lastName: z.string().optional(),
144
150
  password: z.string().min(6).optional(),
145
- email: z
146
- .string()
147
- .email()
148
- .transform((val) => val.toLowerCase())
149
- .optional(),
151
+ email: EmailSchema.optional(),
150
152
  });
151
153
 
152
154
  export const UserZod = IBaseEntity.extend({
@@ -157,7 +159,7 @@ export const UserZod = IBaseEntity.extend({
157
159
  onboarding: z.string().nullable(),
158
160
  account: AccountWithoutUsersZod.optional(),
159
161
  active: z.boolean(),
160
- status: z.nativeEnum(UserStatus),
162
+ locked: z.boolean(),
161
163
  userLogin: IBaseEntity.extend({
162
164
  firstName: z.string(),
163
165
  lastName: z.string(),
@@ -179,27 +181,9 @@ export const UserFiltersZod = z.object({
179
181
  search: z.string().max(50).optional(),
180
182
  role: z.nativeEnum(UserRole).optional(),
181
183
  portal: z.string().optional(),
182
- status: z.nativeEnum(UserStatus).optional(),
183
- active: z
184
- .string()
185
- .optional()
186
- .refine((v) => !v || v === 'true' || v === 'false', {
187
- message: 'active must be a boolean string',
188
- })
189
- .transform((v) => {
190
- if (!v) return undefined;
191
- return v === 'true';
192
- }),
193
- twoFactorEnabled: z
194
- .string()
195
- .optional()
196
- .refine((v) => !v || v === 'true' || v === 'false', {
197
- message: 'twoFactorEnabled must be a boolean string',
198
- })
199
- .transform((v) => {
200
- if (!v) return undefined;
201
- return v === 'true';
202
- }),
184
+ locked: StringToBooleanSchema.optional(),
185
+ active: StringToBooleanSchema.optional(),
186
+ twoFactorEnabled: StringToBooleanSchema.optional(),
203
187
  });
204
188
 
205
189
  const usersInclude = z.enum(['account', 'role']);
@@ -274,7 +258,7 @@ export type IssuerUsersStatusUpdateResponse = z.infer<
274
258
  >;
275
259
 
276
260
  export const UpdateLockedStatus = z.object({
277
- status: z.nativeEnum(UserStatus),
261
+ locked: z.boolean(),
278
262
  });
279
263
 
280
264
  export type UpdateLockedStatus = z.infer<typeof UpdateLockedStatus>;
@@ -285,7 +269,7 @@ export const UsersSummaryFilterZod = z.object({
285
269
  portalType: z.nativeEnum(PortalType).optional(),
286
270
  search: z.string().trim().max(50).optional(),
287
271
  selectRole: z.nativeEnum(UserRole).optional(),
288
- status: z.nativeEnum(UserStatus).optional(),
272
+ locked: StringToBooleanSchema.optional(),
289
273
  });
290
274
  export type UsersSummaryFilterZod = z.infer<typeof UsersSummaryFilterZod>;
291
275
 
@@ -299,7 +283,7 @@ export const UsersSummaryZod = z.object({
299
283
  portalType: z.string(),
300
284
  loginCount: z.number().int(),
301
285
  lastLogin: z.date(),
302
- status: z.nativeEnum(UserStatus),
286
+ locked: z.boolean(),
303
287
  });
304
288
  export type UsersSummaryZod = z.infer<typeof UsersSummaryZod>;
305
289
 
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { validateCanadaZipCode, validateUSZipCode } from './contract-helpers';
2
+ import { validateCanadaZipCode, validateUSZipCode } from '../helpers';
3
3
  import { CountryCode, CountryEnumSchema } from './countries.types';
4
4
 
5
5
  export function refineAddressZip(