@dalmore/api-contracts 0.0.0-dev.d07da18 → 0.0.0-dev.d29fb02
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -19
- package/common/types/account-contact.types.ts +2 -1
- package/common/types/account-manager.types.ts +3 -7
- package/common/types/account-setting.types.ts +65 -0
- package/common/types/account.types.ts +1 -0
- package/common/types/activity.types.ts +1 -1
- package/common/types/auth.types.ts +7 -18
- package/common/types/bonus-tier.types.ts +33 -0
- package/common/types/cart.types.ts +4 -1
- package/common/types/common.types.ts +38 -6
- package/common/types/contact-us.types.ts +6 -2
- package/common/types/covered-person.types.ts +2 -1
- package/common/types/dashboard.types.ts +2 -9
- package/common/types/disbursements.types.ts +119 -3
- package/common/types/escrow-account.types.ts +3 -3
- package/common/types/file.types.ts +17 -1
- package/common/types/i-will-do-it-later.types.ts +68 -0
- package/common/types/index.ts +2 -0
- package/common/types/individuals.types.ts +5 -17
- package/common/types/investor-account.types.ts +2 -1
- package/common/types/invite.types.ts +27 -1
- package/common/types/issuer-offering.types.ts +13 -17
- package/common/types/issuer-payment-method.types.ts +41 -0
- package/common/types/issuer.types.ts +9 -0
- package/common/types/legal-entity.types.ts +3 -2
- package/common/types/mail-template.types.ts +34 -0
- package/common/types/note.types.ts +1 -1
- package/common/types/notification.types.ts +525 -29
- package/common/types/offering.types.ts +4 -9
- package/common/types/site-settings.types.ts +2 -1
- package/common/types/site.types.ts +2 -9
- package/common/types/{trade-line-item.type.ts → trade-line-item.types.ts} +2 -9
- package/common/types/trade.types.ts +48 -2
- package/common/types/transaction.types.ts +12 -1
- package/common/types/trusted-contact.types.ts +7 -7
- package/common/types/user.types.ts +17 -33
- package/contracts/clients/cart/index.ts +21 -1
- package/contracts/clients/index.ts +6 -0
- package/contracts/{investors → clients}/issuer-payment-methods/index.ts +5 -2
- package/contracts/{compliance → clients}/payment-methods/index.ts +40 -12
- package/contracts/clients/trade-line-items/index.ts +1 -1
- package/contracts/clients/trades/index.ts +1 -1
- package/contracts/{investors → clients}/transactions/index.ts +3 -3
- package/index.ts +10 -0
- package/package.json +23 -32
- package/contracts/compliance/account-contacts/index.ts +0 -82
- package/contracts/compliance/account-managers/index.ts +0 -142
- package/contracts/compliance/accounts/index.ts +0 -187
- package/contracts/compliance/activities/index.ts +0 -55
- package/contracts/compliance/aic/index.ts +0 -60
- package/contracts/compliance/api-keys/index.ts +0 -91
- package/contracts/compliance/assets/index.ts +0 -122
- package/contracts/compliance/auth/index.ts +0 -134
- package/contracts/compliance/batch-jobs/index.ts +0 -62
- package/contracts/compliance/bonus-tiers/index.ts +0 -55
- package/contracts/compliance/checklist/index.ts +0 -87
- package/contracts/compliance/checklist-items/index.ts +0 -86
- package/contracts/compliance/covered-persons/index.ts +0 -97
- package/contracts/compliance/dashboard/index.ts +0 -111
- package/contracts/compliance/data-records/index.ts +0 -116
- package/contracts/compliance/data-rooms/index.ts +0 -113
- package/contracts/compliance/default-theme-configs/index.ts +0 -95
- package/contracts/compliance/disbursement/index.ts +0 -165
- package/contracts/compliance/disbursement-approval-users/index.ts +0 -84
- package/contracts/compliance/disbursement-transactions/index.ts +0 -37
- package/contracts/compliance/domain-filters/index.ts +0 -117
- package/contracts/compliance/email-themes/index.ts +0 -284
- package/contracts/compliance/escrow-accounts/index.ts +0 -85
- package/contracts/compliance/exchange-api-keys/index.ts +0 -129
- package/contracts/compliance/exchange-imports/index.ts +0 -137
- package/contracts/compliance/files/index.ts +0 -267
- package/contracts/compliance/files-public/index.ts +0 -188
- package/contracts/compliance/health/index.ts +0 -26
- package/contracts/compliance/index.ts +0 -147
- package/contracts/compliance/individuals/index.ts +0 -57
- package/contracts/compliance/investor-accounts/index.ts +0 -141
- package/contracts/compliance/invites/index.ts +0 -137
- package/contracts/compliance/issuer-bank-accounts/index.ts +0 -81
- package/contracts/compliance/issuer-payment-methods/index.ts +0 -81
- package/contracts/compliance/issuers/index.ts +0 -97
- package/contracts/compliance/job-items/index.ts +0 -58
- package/contracts/compliance/jobs/index.ts +0 -59
- package/contracts/compliance/kyb/index.ts +0 -54
- package/contracts/compliance/kyc/index.ts +0 -77
- package/contracts/compliance/legal-entities/index.ts +0 -57
- package/contracts/compliance/login-histories/index.ts +0 -37
- package/contracts/compliance/notes/index.ts +0 -69
- package/contracts/compliance/notion-databases/index.ts +0 -107
- package/contracts/compliance/notion-pages/index.ts +0 -105
- package/contracts/compliance/offering-reports/index.ts +0 -149
- package/contracts/compliance/offerings/index.ts +0 -233
- package/contracts/compliance/pages/index.ts +0 -178
- package/contracts/compliance/rejection-reasons/index.ts +0 -32
- package/contracts/compliance/review/index.ts +0 -169
- package/contracts/compliance/roles/index.ts +0 -34
- package/contracts/compliance/secondary-customers/index.ts +0 -77
- package/contracts/compliance/secondary-orders/index.ts +0 -60
- package/contracts/compliance/secondary-trades/index.ts +0 -100
- package/contracts/compliance/secure-requests/index.ts +0 -54
- package/contracts/compliance/signer/index.ts +0 -369
- package/contracts/compliance/site-links/index.ts +0 -128
- package/contracts/compliance/site-settings/index.ts +0 -669
- package/contracts/compliance/sites/index.ts +0 -56
- package/contracts/compliance/state-machine/index.ts +0 -94
- package/contracts/compliance/tasks/index.ts +0 -91
- package/contracts/compliance/third-parties/index.ts +0 -52
- package/contracts/compliance/trade-line-items/index.ts +0 -59
- package/contracts/compliance/trades/index.ts +0 -230
- package/contracts/compliance/transactions/index.ts +0 -161
- package/contracts/compliance/user-manuals/index.ts +0 -271
- package/contracts/compliance/user-settings/index.ts +0 -189
- package/contracts/compliance/users/index.ts +0 -200
- package/contracts/compliance/webhooks/index.ts +0 -41
- package/contracts/compliance-apikey/accounts/index.ts +0 -58
- package/contracts/compliance-apikey/index.ts +0 -14
- package/contracts/index.ts +0 -6
- package/contracts/investors/account-contacts/index.ts +0 -58
- package/contracts/investors/aic/index.ts +0 -59
- package/contracts/investors/assets/index.ts +0 -61
- package/contracts/investors/auth/index.ts +0 -116
- package/contracts/investors/bonus-tiers/index.ts +0 -37
- package/contracts/investors/cart/index.ts +0 -75
- package/contracts/investors/contact-us/index.ts +0 -48
- package/contracts/investors/data-records/index.ts +0 -113
- package/contracts/investors/data-rooms/index.ts +0 -96
- package/contracts/investors/files/index.ts +0 -167
- package/contracts/investors/files-public/index.ts +0 -185
- package/contracts/investors/index.ts +0 -72
- package/contracts/investors/individuals/index.ts +0 -99
- package/contracts/investors/investor-accounts/index.ts +0 -110
- package/contracts/investors/issuers/index.ts +0 -30
- package/contracts/investors/legal-entities/index.ts +0 -93
- package/contracts/investors/notes/index.ts +0 -69
- package/contracts/investors/offerings/index.ts +0 -93
- package/contracts/investors/pages/index.ts +0 -88
- package/contracts/investors/payment-methods/index.ts +0 -149
- package/contracts/investors/portfolios/index.ts +0 -53
- package/contracts/investors/sites/index.ts +0 -96
- package/contracts/investors/tasks/index.ts +0 -111
- package/contracts/investors/trade-line-items/index.ts +0 -75
- package/contracts/investors/trades/index.ts +0 -114
- package/contracts/investors/trusted-contacts/index.ts +0 -93
- package/contracts/investors/user-manuals/index.ts +0 -62
- package/contracts/investors/user-settings/index.ts +0 -170
- package/contracts/investors/users/index.ts +0 -45
- package/contracts/investors/webhooks/index.ts +0 -30
- package/contracts/issuers/account-contacts/index.ts +0 -76
- package/contracts/issuers/account-integrations/index.ts +0 -97
- package/contracts/issuers/accounts/index.ts +0 -97
- package/contracts/issuers/activities/index.ts +0 -54
- package/contracts/issuers/aic/index.ts +0 -39
- package/contracts/issuers/api-key-logs/index.ts +0 -53
- package/contracts/issuers/api-keys/index.ts +0 -93
- package/contracts/issuers/assets/index.ts +0 -122
- package/contracts/issuers/auth/index.ts +0 -152
- package/contracts/issuers/bonus-tiers/index.ts +0 -55
- package/contracts/issuers/contact-us/index.ts +0 -48
- package/contracts/issuers/covered-persons/index.ts +0 -136
- package/contracts/issuers/dashboard/index.ts +0 -72
- package/contracts/issuers/data-records/index.ts +0 -257
- package/contracts/issuers/data-rooms/index.ts +0 -134
- package/contracts/issuers/disbursement-approval-users/index.ts +0 -82
- package/contracts/issuers/disbursement-transactions/index.ts +0 -53
- package/contracts/issuers/disbursements/index.ts +0 -153
- package/contracts/issuers/email-themes/index.ts +0 -242
- package/contracts/issuers/escrow-accounts/index.ts +0 -81
- package/contracts/issuers/exchange-api-keys/index.ts +0 -144
- package/contracts/issuers/files/index.ts +0 -166
- package/contracts/issuers/files-public/index.ts +0 -166
- package/contracts/issuers/health/index.ts +0 -24
- package/contracts/issuers/index.ts +0 -112
- package/contracts/issuers/investor-accounts/index.ts +0 -148
- package/contracts/issuers/invites/index.ts +0 -129
- package/contracts/issuers/issuer/index.ts +0 -94
- package/contracts/issuers/issuer-bank-accounts/index.ts +0 -81
- package/contracts/issuers/issuer-payment-methods/index.ts +0 -136
- package/contracts/issuers/kyc/index.ts +0 -38
- package/contracts/issuers/login-histories/index.ts +0 -51
- package/contracts/issuers/notes/index.ts +0 -69
- package/contracts/issuers/offerings/index.ts +0 -206
- package/contracts/issuers/pages/index.ts +0 -138
- package/contracts/issuers/payment-methods/index.ts +0 -61
- package/contracts/issuers/portfolios/index.ts +0 -36
- package/contracts/issuers/rejection-reasons/index.ts +0 -32
- package/contracts/issuers/review/index.ts +0 -63
- package/contracts/issuers/secondary-customers/index.ts +0 -55
- package/contracts/issuers/secondary-orders/index.ts +0 -57
- package/contracts/issuers/secondary-trades/index.ts +0 -57
- package/contracts/issuers/secure-requests/index.ts +0 -34
- package/contracts/issuers/site-links/index.ts +0 -116
- package/contracts/issuers/site-settings/index.ts +0 -585
- package/contracts/issuers/sites/index.ts +0 -32
- package/contracts/issuers/tasks/index.ts +0 -111
- package/contracts/issuers/trades/index.ts +0 -132
- package/contracts/issuers/transactions/index.ts +0 -158
- package/contracts/issuers/user-manuals/index.ts +0 -62
- package/contracts/issuers/user-settings/index.ts +0 -170
- package/contracts/issuers/users/index.ts +0 -126
- package/contracts/secondaries/accounts/index.ts +0 -58
- package/contracts/secondaries/index.ts +0 -23
- package/contracts/secondaries/secondary-customers/index.ts +0 -55
- package/contracts/secondaries/secondary-issuers/index.ts +0 -94
- package/contracts/secondaries/secondary-orders/index.ts +0 -56
- package/contracts/secondaries/secondary-securities/index.ts +0 -95
- package/contracts/secondaries/secondary-trades/index.ts +0 -56
|
@@ -22,12 +22,13 @@ 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 {
|
|
@@ -35,11 +36,12 @@ import {
|
|
|
35
36
|
InvestorAccountExportFilters,
|
|
36
37
|
ComplianceInvestorAccountExportFilters,
|
|
37
38
|
RegisteredInvestorUserRawZod,
|
|
39
|
+
IInvestorAccount,
|
|
38
40
|
} from './investor-account.types';
|
|
39
41
|
import {
|
|
40
42
|
tradeLineItemIdSchema,
|
|
41
43
|
TradeLineItemZod,
|
|
42
|
-
} from './trade-line-item.
|
|
44
|
+
} from './trade-line-item.types';
|
|
43
45
|
import { TradeAdjustmentZod } from './trade-adjustment.type';
|
|
44
46
|
import { TransactionZod } from './transaction.types';
|
|
45
47
|
import { accountIdSchema } from './account.types';
|
|
@@ -132,6 +134,7 @@ export const CheckResultsSchema = z.object({
|
|
|
132
134
|
export type CheckResults = z.infer<typeof CheckResultsSchema>;
|
|
133
135
|
|
|
134
136
|
export const TradeIdPrefix = 'trade';
|
|
137
|
+
export const TradeSnapshotIdPrefix = 'trade_snapshot';
|
|
135
138
|
|
|
136
139
|
export const tradeIdSchema = z.string().refine(
|
|
137
140
|
(value) => {
|
|
@@ -170,6 +173,21 @@ export const tradeIdOrTidSchema = z.union([
|
|
|
170
173
|
.openapi({ example: 'tid_00041061050r3gg28a1c60t3gf' }),
|
|
171
174
|
]);
|
|
172
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
|
+
|
|
173
191
|
export enum SaStatus {
|
|
174
192
|
PENDING = BaseStatus.PENDING,
|
|
175
193
|
SIGNED = BaseStatus.SIGNED,
|
|
@@ -274,9 +292,21 @@ export type TradeBalanceResultZod = z.infer<typeof TradeBalanceResultZod>;
|
|
|
274
292
|
|
|
275
293
|
export const TradeZod = IBaseEntity.extend({
|
|
276
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(),
|
|
277
303
|
accountId: accountIdSchema.nullable(),
|
|
278
304
|
offeringId: z.lazy(() => offeringIdSchema.nullable()),
|
|
279
305
|
paymentMethodId: z.lazy(() => paymentMethodIdSchema).nullable(),
|
|
306
|
+
paymentMethod: z
|
|
307
|
+
.lazy(() => PaymentMethodResponse)
|
|
308
|
+
.optional()
|
|
309
|
+
.nullable(),
|
|
280
310
|
userId: z.lazy(() => userIdSchema.nullable()),
|
|
281
311
|
tradeNumber: z.string(),
|
|
282
312
|
ip: z.string().nullable(),
|
|
@@ -342,6 +372,21 @@ export const TradeZod = IBaseEntity.extend({
|
|
|
342
372
|
});
|
|
343
373
|
export type TradeZod = z.infer<typeof TradeZod>;
|
|
344
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
|
+
|
|
345
390
|
export const IPaginatedTrade = z.object({
|
|
346
391
|
items: z.array(TradeZod),
|
|
347
392
|
meta: IPaginationMeta,
|
|
@@ -424,6 +469,7 @@ export const TradeFiltersZod = z.object({
|
|
|
424
469
|
.openapi({
|
|
425
470
|
example: 'issuer_01jfw4q6qef30s6fpqtsxw94ya',
|
|
426
471
|
}),
|
|
472
|
+
snapshotEvent: z.nativeEnum(SnapshotEvent).optional(),
|
|
427
473
|
offeringType: z.nativeEnum(OfferingType).optional(),
|
|
428
474
|
managedBy: z.nativeEnum(ManagedByType).optional(),
|
|
429
475
|
platform: z.nativeEnum(Platforms).optional(),
|
|
@@ -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 {
|
|
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:
|
|
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:
|
|
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
|
-
|
|
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:
|
|
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
|
-
|
|
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
|
-
|
|
183
|
-
active:
|
|
184
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
286
|
+
locked: z.boolean(),
|
|
303
287
|
});
|
|
304
288
|
export type UsersSummaryZod = z.infer<typeof UsersSummaryZod>;
|
|
305
289
|
|
|
@@ -10,7 +10,11 @@ import {
|
|
|
10
10
|
userIdSchema,
|
|
11
11
|
tradeIdSchema,
|
|
12
12
|
} from '../../../common/types';
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
PatchCartBody,
|
|
15
|
+
ClientPlacetradeBody,
|
|
16
|
+
PlaceTradeResponse,
|
|
17
|
+
} from '../../../common/types/cart.types';
|
|
14
18
|
|
|
15
19
|
const c = initContract();
|
|
16
20
|
|
|
@@ -34,6 +38,22 @@ export const cartContract = c.router(
|
|
|
34
38
|
500: InternalError,
|
|
35
39
|
},
|
|
36
40
|
},
|
|
41
|
+
postCheckout: {
|
|
42
|
+
summary: 'Place a trade (checkout button)',
|
|
43
|
+
method: 'POST',
|
|
44
|
+
path: '/checkout',
|
|
45
|
+
metadata: {
|
|
46
|
+
auth: true,
|
|
47
|
+
},
|
|
48
|
+
body: ClientPlacetradeBody,
|
|
49
|
+
responses: {
|
|
50
|
+
200: PlaceTradeResponse,
|
|
51
|
+
400: BadRequestError,
|
|
52
|
+
401: UnauthorizedError,
|
|
53
|
+
403: ForbiddenError,
|
|
54
|
+
500: InternalError,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
37
57
|
patchCart: {
|
|
38
58
|
summary: 'Patch a cart',
|
|
39
59
|
method: 'PATCH',
|
|
@@ -16,7 +16,10 @@ import { secureRequestContract } from './secure-requests';
|
|
|
16
16
|
import { aicContract } from './aic';
|
|
17
17
|
import { authContract } from './auth';
|
|
18
18
|
import { sitesContract } from './sites';
|
|
19
|
+
import { paymentMethodsContract } from './payment-methods';
|
|
20
|
+
import { issuerPaymentMethodsContract } from './issuer-payment-methods';
|
|
19
21
|
import { tradeLineItemsContract } from './trade-line-items';
|
|
22
|
+
import { clientsTransactionsContract } from './transactions';
|
|
20
23
|
|
|
21
24
|
const c = initContract();
|
|
22
25
|
|
|
@@ -34,13 +37,16 @@ export const clientsContract = c.router(
|
|
|
34
37
|
filesPublic: filesPublicContract,
|
|
35
38
|
individuals: individualsContract,
|
|
36
39
|
investorAccounts: investorAccountsContract,
|
|
40
|
+
issuerPaymentMethods: issuerPaymentMethodsContract,
|
|
37
41
|
issuers: issuersContract,
|
|
38
42
|
legalEntities: legalEntityContract,
|
|
39
43
|
offerings: offeringsContract,
|
|
44
|
+
paymentMethods: paymentMethodsContract,
|
|
40
45
|
secureRequests: secureRequestContract,
|
|
41
46
|
sites: sitesContract,
|
|
42
47
|
tradeLineItems: tradeLineItemsContract,
|
|
43
48
|
trades: tradesContract,
|
|
49
|
+
transactions: clientsTransactionsContract,
|
|
44
50
|
},
|
|
45
51
|
{
|
|
46
52
|
pathPrefix: '/clients/api/v1/',
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
UnauthorizedError,
|
|
7
7
|
GetIssuerPaymentMethodZod,
|
|
8
8
|
IPaginatedIssuerPaymentMethod,
|
|
9
|
+
IssuerPaymentMethodsIncludeQuery,
|
|
9
10
|
PaginationOptionsZod,
|
|
10
11
|
} from '../../../common/types';
|
|
11
12
|
|
|
@@ -14,13 +15,15 @@ const c = initContract();
|
|
|
14
15
|
export const issuerPaymentMethodsContract = c.router(
|
|
15
16
|
{
|
|
16
17
|
getIssuerPaymentMethods: {
|
|
17
|
-
summary: '
|
|
18
|
+
summary: 'Get issuer payment methods',
|
|
18
19
|
method: 'GET',
|
|
19
20
|
path: '',
|
|
20
21
|
metadata: {
|
|
21
22
|
auth: true,
|
|
22
23
|
},
|
|
23
|
-
query: PaginationOptionsZod.merge(GetIssuerPaymentMethodZod)
|
|
24
|
+
query: PaginationOptionsZod.merge(GetIssuerPaymentMethodZod).merge(
|
|
25
|
+
IssuerPaymentMethodsIncludeQuery,
|
|
26
|
+
),
|
|
24
27
|
responses: {
|
|
25
28
|
200: IPaginatedIssuerPaymentMethod,
|
|
26
29
|
401: UnauthorizedError,
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { initContract } from '@ts-rest/core';
|
|
2
|
+
import { z } from 'zod';
|
|
2
3
|
import {
|
|
3
|
-
|
|
4
|
+
UnauthorizedError,
|
|
4
5
|
ForbiddenError,
|
|
5
|
-
InternalError,
|
|
6
6
|
NotFoundError,
|
|
7
|
-
|
|
7
|
+
userIdSchema,
|
|
8
|
+
BadRequestError,
|
|
9
|
+
InternalError,
|
|
8
10
|
} from '../../../common/types';
|
|
9
11
|
import {
|
|
10
|
-
CompliancePostPaymentMethod,
|
|
11
|
-
PaymentMethodFilterQuery,
|
|
12
|
-
PaymentMethodResponse,
|
|
13
12
|
PaymentMethodResponseArray,
|
|
13
|
+
PaymentMethodResponse,
|
|
14
|
+
PostPaymentMethod,
|
|
15
|
+
PostSetupIntentBody,
|
|
16
|
+
SetupIntentResponse,
|
|
14
17
|
} from '../../../common/types/payment-methods.types';
|
|
15
18
|
|
|
16
19
|
const c = initContract();
|
|
@@ -18,13 +21,15 @@ const c = initContract();
|
|
|
18
21
|
export const paymentMethodsContract = c.router(
|
|
19
22
|
{
|
|
20
23
|
getPaymentMethods: {
|
|
21
|
-
summary: '
|
|
24
|
+
summary: 'Get payment methods for a user',
|
|
22
25
|
method: 'GET',
|
|
23
|
-
path: '
|
|
26
|
+
path: '',
|
|
24
27
|
metadata: {
|
|
25
28
|
auth: true,
|
|
26
29
|
},
|
|
27
|
-
query:
|
|
30
|
+
query: z.object({
|
|
31
|
+
userId: userIdSchema,
|
|
32
|
+
}),
|
|
28
33
|
responses: {
|
|
29
34
|
200: PaymentMethodResponseArray,
|
|
30
35
|
401: UnauthorizedError,
|
|
@@ -34,13 +39,16 @@ export const paymentMethodsContract = c.router(
|
|
|
34
39
|
},
|
|
35
40
|
},
|
|
36
41
|
createPaymentMethod: {
|
|
37
|
-
summary: '
|
|
42
|
+
summary: 'Create payment method for a user',
|
|
38
43
|
method: 'POST',
|
|
39
|
-
path: '
|
|
44
|
+
path: '',
|
|
40
45
|
metadata: {
|
|
41
46
|
auth: true,
|
|
42
47
|
},
|
|
43
|
-
|
|
48
|
+
query: z.object({
|
|
49
|
+
userId: userIdSchema,
|
|
50
|
+
}),
|
|
51
|
+
body: PostPaymentMethod,
|
|
44
52
|
responses: {
|
|
45
53
|
201: PaymentMethodResponse,
|
|
46
54
|
400: BadRequestError,
|
|
@@ -50,6 +58,26 @@ export const paymentMethodsContract = c.router(
|
|
|
50
58
|
500: InternalError,
|
|
51
59
|
},
|
|
52
60
|
},
|
|
61
|
+
createSetupIntent: {
|
|
62
|
+
summary: 'Create payment method setup intent for a user',
|
|
63
|
+
method: 'POST',
|
|
64
|
+
path: '/intent',
|
|
65
|
+
metadata: {
|
|
66
|
+
auth: true,
|
|
67
|
+
},
|
|
68
|
+
query: z.object({
|
|
69
|
+
userId: userIdSchema,
|
|
70
|
+
}),
|
|
71
|
+
body: PostSetupIntentBody,
|
|
72
|
+
responses: {
|
|
73
|
+
201: SetupIntentResponse,
|
|
74
|
+
400: BadRequestError,
|
|
75
|
+
401: UnauthorizedError,
|
|
76
|
+
403: ForbiddenError,
|
|
77
|
+
404: NotFoundError,
|
|
78
|
+
500: InternalError,
|
|
79
|
+
},
|
|
80
|
+
},
|
|
53
81
|
},
|
|
54
82
|
{
|
|
55
83
|
pathPrefix: 'payment-methods',
|
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
UnauthorizedError,
|
|
7
7
|
} from '../../../common/types';
|
|
8
8
|
import {
|
|
9
|
-
|
|
9
|
+
ClientPostTransactionZod,
|
|
10
10
|
TransactionZod,
|
|
11
11
|
} from '../../../common/types/transaction.types';
|
|
12
12
|
|
|
13
13
|
const c = initContract();
|
|
14
14
|
|
|
15
|
-
export const
|
|
15
|
+
export const clientsTransactionsContract = c.router(
|
|
16
16
|
{
|
|
17
17
|
postTransaction: {
|
|
18
18
|
summary: 'Create a transaction',
|
|
@@ -21,7 +21,7 @@ export const investorsTransactionsContract = c.router(
|
|
|
21
21
|
metadata: {
|
|
22
22
|
auth: true,
|
|
23
23
|
},
|
|
24
|
-
body:
|
|
24
|
+
body: ClientPostTransactionZod,
|
|
25
25
|
responses: {
|
|
26
26
|
201: TransactionZod,
|
|
27
27
|
400: BadRequestError,
|
package/index.ts
ADDED
package/package.json
CHANGED
|
@@ -1,48 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalmore/api-contracts",
|
|
3
|
-
"version": "0.0.0-dev.
|
|
3
|
+
"version": "0.0.0-dev.d29fb02",
|
|
4
4
|
"description": "Type-safe API contracts for Dalmore Client Portal",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./index.ts",
|
|
7
|
+
"types": "./index.ts",
|
|
7
8
|
"exports": {
|
|
8
9
|
".": {
|
|
9
|
-
"types": "./
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
"./compliance": {
|
|
13
|
-
"types": "./contracts/compliance/index.ts",
|
|
14
|
-
"default": "./contracts/compliance/index.ts"
|
|
15
|
-
},
|
|
16
|
-
"./investors": {
|
|
17
|
-
"types": "./contracts/investors/index.ts",
|
|
18
|
-
"default": "./contracts/investors/index.ts"
|
|
19
|
-
},
|
|
20
|
-
"./issuers": {
|
|
21
|
-
"types": "./contracts/issuers/index.ts",
|
|
22
|
-
"default": "./contracts/issuers/index.ts"
|
|
10
|
+
"types": "./index.ts",
|
|
11
|
+
"import": "./index.ts",
|
|
12
|
+
"default": "./index.ts"
|
|
23
13
|
},
|
|
24
14
|
"./clients": {
|
|
25
15
|
"types": "./contracts/clients/index.ts",
|
|
16
|
+
"import": "./contracts/clients/index.ts",
|
|
26
17
|
"default": "./contracts/clients/index.ts"
|
|
27
18
|
},
|
|
28
|
-
"./secondaries": {
|
|
29
|
-
"types": "./contracts/secondaries/index.ts",
|
|
30
|
-
"default": "./contracts/secondaries/index.ts"
|
|
31
|
-
},
|
|
32
|
-
"./compliance-apikey": {
|
|
33
|
-
"types": "./contracts/compliance-apikey/index.ts",
|
|
34
|
-
"default": "./contracts/compliance-apikey/index.ts"
|
|
35
|
-
},
|
|
36
19
|
"./types": {
|
|
37
20
|
"types": "./common/types/index.ts",
|
|
21
|
+
"import": "./common/types/index.ts",
|
|
38
22
|
"default": "./common/types/index.ts"
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"typesVersions": {
|
|
26
|
+
"*": {
|
|
27
|
+
".": [
|
|
28
|
+
"./index.ts"
|
|
29
|
+
],
|
|
30
|
+
"clients": [
|
|
31
|
+
"./contracts/clients/index.ts"
|
|
32
|
+
],
|
|
33
|
+
"types": [
|
|
34
|
+
"./common/types/index.ts"
|
|
35
|
+
]
|
|
43
36
|
}
|
|
44
37
|
},
|
|
45
38
|
"files": [
|
|
39
|
+
"index.ts",
|
|
46
40
|
"contracts",
|
|
47
41
|
"common"
|
|
48
42
|
],
|
|
@@ -68,9 +62,6 @@
|
|
|
68
62
|
"typeid-js": "^1.2.0",
|
|
69
63
|
"zod": "^3.24.4"
|
|
70
64
|
},
|
|
71
|
-
"devDependencies": {
|
|
72
|
-
"typescript": "^5.8.3"
|
|
73
|
-
},
|
|
74
65
|
"engines": {
|
|
75
66
|
"node": ">=24.0.0 <25.0.0"
|
|
76
67
|
}
|