@dalmore/api-contracts 0.0.0-dev.d8ef117 → 0.0.0-dev.dc7fdf8
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/auth.types.ts +7 -18
- package/common/types/bonus-tier.types.ts +9 -0
- package/common/types/common.types.ts +38 -6
- package/common/types/comply-advantage-api.types.ts +3 -3
- 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/escrow-account.types.ts +3 -3
- package/common/types/individuals.types.ts +3 -2
- package/common/types/investor-account.types.ts +2 -1
- package/common/types/invite.types.ts +27 -1
- package/common/types/issuer-offering.types.ts +11 -17
- 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 +2 -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 +50 -2
- package/common/types/trusted-contact.types.ts +7 -7
- package/common/types/user.types.ts +11 -32
- package/common/types/webhook.types.ts +142 -0
- package/contracts/clients/trade-line-items/index.ts +1 -1
- package/contracts/clients/trades/index.ts +1 -1
- 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 -74
- 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/payment-methods/index.ts +0 -57
- 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 -221
- 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 -55
- 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 -121
- package/contracts/investors/investor-accounts/index.ts +0 -110
- package/contracts/investors/issuer-payment-methods/index.ts +0 -36
- 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/transactions/index.ts +0 -37
- 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 -73
- 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 -189
- 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
|
@@ -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:
|
|
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(),
|
|
@@ -21,13 +21,15 @@ import {
|
|
|
21
21
|
createDateSchema,
|
|
22
22
|
AccountStatus,
|
|
23
23
|
SavedQuery,
|
|
24
|
+
AccountZod,
|
|
24
25
|
} from './common.types';
|
|
25
|
-
import { offeringIdSchema } from './offering.types';
|
|
26
|
+
import { IOffering, offeringIdSchema } from './offering.types';
|
|
26
27
|
import { IBaseEntity } from './entity.types';
|
|
27
28
|
import { extendZodWithOpenApi } from '@anatine/zod-openapi';
|
|
28
29
|
import { TypeID } from 'typeid-js';
|
|
29
30
|
import {
|
|
30
31
|
paymentMethodIdSchema,
|
|
32
|
+
PaymentMethodResponse,
|
|
31
33
|
PaymentMethodType,
|
|
32
34
|
} from './payment-methods.types';
|
|
33
35
|
import {
|
|
@@ -35,11 +37,12 @@ import {
|
|
|
35
37
|
InvestorAccountExportFilters,
|
|
36
38
|
ComplianceInvestorAccountExportFilters,
|
|
37
39
|
RegisteredInvestorUserRawZod,
|
|
40
|
+
IInvestorAccount,
|
|
38
41
|
} from './investor-account.types';
|
|
39
42
|
import {
|
|
40
43
|
tradeLineItemIdSchema,
|
|
41
44
|
TradeLineItemZod,
|
|
42
|
-
} from './trade-line-item.
|
|
45
|
+
} from './trade-line-item.types';
|
|
43
46
|
import { TradeAdjustmentZod } from './trade-adjustment.type';
|
|
44
47
|
import { TransactionZod } from './transaction.types';
|
|
45
48
|
import { accountIdSchema } from './account.types';
|
|
@@ -132,6 +135,7 @@ export const CheckResultsSchema = z.object({
|
|
|
132
135
|
export type CheckResults = z.infer<typeof CheckResultsSchema>;
|
|
133
136
|
|
|
134
137
|
export const TradeIdPrefix = 'trade';
|
|
138
|
+
export const TradeSnapshotIdPrefix = 'trade_snapshot';
|
|
135
139
|
|
|
136
140
|
export const tradeIdSchema = z.string().refine(
|
|
137
141
|
(value) => {
|
|
@@ -170,6 +174,21 @@ export const tradeIdOrTidSchema = z.union([
|
|
|
170
174
|
.openapi({ example: 'tid_00041061050r3gg28a1c60t3gf' }),
|
|
171
175
|
]);
|
|
172
176
|
|
|
177
|
+
export const tradeSnapshotIdSchema = z.string().refine(
|
|
178
|
+
(value) => {
|
|
179
|
+
try {
|
|
180
|
+
const tid = TypeID.fromString(value);
|
|
181
|
+
return tid.getType() === TradeSnapshotIdPrefix;
|
|
182
|
+
} catch {
|
|
183
|
+
return false;
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
message:
|
|
188
|
+
'Invalid trade snapshot ID format. Must be a valid TypeID with "trade_snapshot" prefix. ex: trade_snapshot_00041061050r3gg28a1c60t3gf',
|
|
189
|
+
},
|
|
190
|
+
);
|
|
191
|
+
|
|
173
192
|
export enum SaStatus {
|
|
174
193
|
PENDING = BaseStatus.PENDING,
|
|
175
194
|
SIGNED = BaseStatus.SIGNED,
|
|
@@ -274,9 +293,22 @@ export type TradeBalanceResultZod = z.infer<typeof TradeBalanceResultZod>;
|
|
|
274
293
|
|
|
275
294
|
export const TradeZod = IBaseEntity.extend({
|
|
276
295
|
investorAccountId: z.lazy(() => investorAccountIdSchema.nullable()),
|
|
296
|
+
investorAccount: z
|
|
297
|
+
.lazy(() => IInvestorAccount)
|
|
298
|
+
.optional()
|
|
299
|
+
.nullable(),
|
|
300
|
+
offering: z
|
|
301
|
+
.lazy(() => IOffering)
|
|
302
|
+
.optional()
|
|
303
|
+
.nullable(),
|
|
277
304
|
accountId: accountIdSchema.nullable(),
|
|
305
|
+
account: z.lazy(() => AccountZod).nullable(),
|
|
278
306
|
offeringId: z.lazy(() => offeringIdSchema.nullable()),
|
|
279
307
|
paymentMethodId: z.lazy(() => paymentMethodIdSchema).nullable(),
|
|
308
|
+
paymentMethod: z
|
|
309
|
+
.lazy(() => PaymentMethodResponse)
|
|
310
|
+
.optional()
|
|
311
|
+
.nullable(),
|
|
280
312
|
userId: z.lazy(() => userIdSchema.nullable()),
|
|
281
313
|
tradeNumber: z.string(),
|
|
282
314
|
ip: z.string().nullable(),
|
|
@@ -342,6 +374,21 @@ export const TradeZod = IBaseEntity.extend({
|
|
|
342
374
|
});
|
|
343
375
|
export type TradeZod = z.infer<typeof TradeZod>;
|
|
344
376
|
|
|
377
|
+
export enum SnapshotEvent {
|
|
378
|
+
COMPLIANCE_APPROVED = 'COMPLIANCE_APPROVED',
|
|
379
|
+
COMPLIANCE_REJECTED = 'COMPLIANCE_REJECTED',
|
|
380
|
+
CANCELLED = 'CANCELLED',
|
|
381
|
+
PLACED = 'PLACED',
|
|
382
|
+
SETTLED = 'SETTLED',
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
export const GetTradeSnapshotEventsResponse = z.object({
|
|
386
|
+
events: z.array(z.nativeEnum(SnapshotEvent)),
|
|
387
|
+
});
|
|
388
|
+
export type GetTradeSnapshotEventsResponse = z.infer<
|
|
389
|
+
typeof GetTradeSnapshotEventsResponse
|
|
390
|
+
>;
|
|
391
|
+
|
|
345
392
|
export const IPaginatedTrade = z.object({
|
|
346
393
|
items: z.array(TradeZod),
|
|
347
394
|
meta: IPaginationMeta,
|
|
@@ -424,6 +471,7 @@ export const TradeFiltersZod = z.object({
|
|
|
424
471
|
.openapi({
|
|
425
472
|
example: 'issuer_01jfw4q6qef30s6fpqtsxw94ya',
|
|
426
473
|
}),
|
|
474
|
+
snapshotEvent: z.nativeEnum(SnapshotEvent).optional(),
|
|
427
475
|
offeringType: z.nativeEnum(OfferingType).optional(),
|
|
428
476
|
managedBy: z.nativeEnum(ManagedByType).optional(),
|
|
429
477
|
platform: z.nativeEnum(Platforms).optional(),
|
|
@@ -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,
|
|
@@ -8,9 +8,10 @@ import {
|
|
|
8
8
|
ManagedByType,
|
|
9
9
|
OfferingType,
|
|
10
10
|
PortalType,
|
|
11
|
+
StringToBooleanSchema,
|
|
11
12
|
UserRole,
|
|
12
|
-
UserStatus,
|
|
13
13
|
UserType,
|
|
14
|
+
EmailSchema,
|
|
14
15
|
} from './common.types';
|
|
15
16
|
import { dateOrString, IBaseEntity } from './entity.types';
|
|
16
17
|
import { PhoneZodSchema } from './phone.type';
|
|
@@ -64,7 +65,7 @@ export const GetMeResponse = IBaseEntity.extend({
|
|
|
64
65
|
email: z.string().email(),
|
|
65
66
|
provider: z.string(),
|
|
66
67
|
active: z.boolean(),
|
|
67
|
-
|
|
68
|
+
locked: z.boolean(),
|
|
68
69
|
lastLoginAt: dateOrString.nullable(),
|
|
69
70
|
loginCount: z.number(),
|
|
70
71
|
role: z.string(),
|
|
@@ -147,11 +148,7 @@ export const UserMeUpdateZod = z.object({
|
|
|
147
148
|
firstName: z.string().optional(),
|
|
148
149
|
lastName: z.string().optional(),
|
|
149
150
|
password: z.string().min(6).optional(),
|
|
150
|
-
email:
|
|
151
|
-
.string()
|
|
152
|
-
.email()
|
|
153
|
-
.transform((val) => val.toLowerCase())
|
|
154
|
-
.optional(),
|
|
151
|
+
email: EmailSchema.optional(),
|
|
155
152
|
});
|
|
156
153
|
|
|
157
154
|
export const UserZod = IBaseEntity.extend({
|
|
@@ -162,7 +159,7 @@ export const UserZod = IBaseEntity.extend({
|
|
|
162
159
|
onboarding: z.string().nullable(),
|
|
163
160
|
account: AccountWithoutUsersZod.optional(),
|
|
164
161
|
active: z.boolean(),
|
|
165
|
-
|
|
162
|
+
locked: z.boolean(),
|
|
166
163
|
userLogin: IBaseEntity.extend({
|
|
167
164
|
firstName: z.string(),
|
|
168
165
|
lastName: z.string(),
|
|
@@ -184,27 +181,9 @@ export const UserFiltersZod = z.object({
|
|
|
184
181
|
search: z.string().max(50).optional(),
|
|
185
182
|
role: z.nativeEnum(UserRole).optional(),
|
|
186
183
|
portal: z.string().optional(),
|
|
187
|
-
|
|
188
|
-
active:
|
|
189
|
-
|
|
190
|
-
.optional()
|
|
191
|
-
.refine((v) => !v || v === 'true' || v === 'false', {
|
|
192
|
-
message: 'active must be a boolean string',
|
|
193
|
-
})
|
|
194
|
-
.transform((v) => {
|
|
195
|
-
if (!v) return undefined;
|
|
196
|
-
return v === 'true';
|
|
197
|
-
}),
|
|
198
|
-
twoFactorEnabled: z
|
|
199
|
-
.string()
|
|
200
|
-
.optional()
|
|
201
|
-
.refine((v) => !v || v === 'true' || v === 'false', {
|
|
202
|
-
message: 'twoFactorEnabled must be a boolean string',
|
|
203
|
-
})
|
|
204
|
-
.transform((v) => {
|
|
205
|
-
if (!v) return undefined;
|
|
206
|
-
return v === 'true';
|
|
207
|
-
}),
|
|
184
|
+
locked: StringToBooleanSchema.optional(),
|
|
185
|
+
active: StringToBooleanSchema.optional(),
|
|
186
|
+
twoFactorEnabled: StringToBooleanSchema.optional(),
|
|
208
187
|
});
|
|
209
188
|
|
|
210
189
|
const usersInclude = z.enum(['account', 'role']);
|
|
@@ -279,7 +258,7 @@ export type IssuerUsersStatusUpdateResponse = z.infer<
|
|
|
279
258
|
>;
|
|
280
259
|
|
|
281
260
|
export const UpdateLockedStatus = z.object({
|
|
282
|
-
|
|
261
|
+
locked: z.boolean(),
|
|
283
262
|
});
|
|
284
263
|
|
|
285
264
|
export type UpdateLockedStatus = z.infer<typeof UpdateLockedStatus>;
|
|
@@ -290,7 +269,7 @@ export const UsersSummaryFilterZod = z.object({
|
|
|
290
269
|
portalType: z.nativeEnum(PortalType).optional(),
|
|
291
270
|
search: z.string().trim().max(50).optional(),
|
|
292
271
|
selectRole: z.nativeEnum(UserRole).optional(),
|
|
293
|
-
|
|
272
|
+
locked: StringToBooleanSchema.optional(),
|
|
294
273
|
});
|
|
295
274
|
export type UsersSummaryFilterZod = z.infer<typeof UsersSummaryFilterZod>;
|
|
296
275
|
|
|
@@ -304,7 +283,7 @@ export const UsersSummaryZod = z.object({
|
|
|
304
283
|
portalType: z.string(),
|
|
305
284
|
loginCount: z.number().int(),
|
|
306
285
|
lastLogin: z.date(),
|
|
307
|
-
|
|
286
|
+
locked: z.boolean(),
|
|
308
287
|
});
|
|
309
288
|
export type UsersSummaryZod = z.infer<typeof UsersSummaryZod>;
|
|
310
289
|
|
|
@@ -1,6 +1,148 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { PersonaStatus } from './common.types';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Hook0 Webhook Provider Types
|
|
6
|
+
*
|
|
7
|
+
* Types for interacting with Hook0's webhooks-as-a-service API.
|
|
8
|
+
* @see https://documentation.hook0.com/api - API Reference
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Hook0 API error response format.
|
|
13
|
+
* @see https://documentation.hook0.com/api
|
|
14
|
+
*/
|
|
15
|
+
export const Hook0ApiErrorSchema = z.object({
|
|
16
|
+
type: z.string(),
|
|
17
|
+
status: z.number(),
|
|
18
|
+
title: z.string(),
|
|
19
|
+
detail: z.string(),
|
|
20
|
+
validation: z.unknown().nullable(),
|
|
21
|
+
id: z.string(),
|
|
22
|
+
});
|
|
23
|
+
export type Hook0ApiError = z.infer<typeof Hook0ApiErrorSchema>;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Error returned from Hook0 provider operations.
|
|
27
|
+
* Wraps Hook0 API errors with additional context.
|
|
28
|
+
*/
|
|
29
|
+
export const Hook0ProviderErrorSchema = z.object({
|
|
30
|
+
message: z.string(),
|
|
31
|
+
statusCode: z.number().optional(),
|
|
32
|
+
code: z.string().optional(),
|
|
33
|
+
apiError: Hook0ApiErrorSchema.optional(),
|
|
34
|
+
});
|
|
35
|
+
export type Hook0ProviderError = z.infer<typeof Hook0ProviderErrorSchema>;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Hook0 subscription target configuration.
|
|
39
|
+
* Defines where and how webhooks are delivered.
|
|
40
|
+
* @see https://documentation.hook0.com/reference/subscriptionscreate
|
|
41
|
+
*/
|
|
42
|
+
export const Hook0SubscriptionTargetSchema = z.object({
|
|
43
|
+
type: z.literal('http'),
|
|
44
|
+
method: z.string(),
|
|
45
|
+
url: z.string().url(),
|
|
46
|
+
headers: z.record(z.string()).optional(),
|
|
47
|
+
});
|
|
48
|
+
export type Hook0SubscriptionTarget = z.infer<
|
|
49
|
+
typeof Hook0SubscriptionTargetSchema
|
|
50
|
+
>;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Hook0 subscription response from create/get operations.
|
|
54
|
+
* @see https://documentation.hook0.com/reference/subscriptionscreate
|
|
55
|
+
* @see https://documentation.hook0.com/reference/subscriptionsget
|
|
56
|
+
*/
|
|
57
|
+
export const Hook0SubscriptionResponseSchema = z.object({
|
|
58
|
+
subscription_id: z.string().uuid(),
|
|
59
|
+
application_id: z.string().uuid(),
|
|
60
|
+
created_at: z.string().datetime().optional(),
|
|
61
|
+
dedicated_workers: z.array(z.string()).optional(),
|
|
62
|
+
description: z.string().optional(),
|
|
63
|
+
event_types: z.array(z.string()).optional(),
|
|
64
|
+
is_enabled: z.boolean().optional(),
|
|
65
|
+
label_key: z.string().optional(),
|
|
66
|
+
label_value: z.string().optional(),
|
|
67
|
+
labels: z.record(z.string()).optional(),
|
|
68
|
+
metadata: z.record(z.string()).optional(),
|
|
69
|
+
secret: z.string(),
|
|
70
|
+
target: Hook0SubscriptionTargetSchema.optional(),
|
|
71
|
+
});
|
|
72
|
+
export type Hook0SubscriptionResponse = z.infer<
|
|
73
|
+
typeof Hook0SubscriptionResponseSchema
|
|
74
|
+
>;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Simplified subscription result returned to callers.
|
|
78
|
+
*/
|
|
79
|
+
export const WebhookSubscriptionSchema = z.object({
|
|
80
|
+
subscriptionId: z.string(),
|
|
81
|
+
secret: z.string(),
|
|
82
|
+
});
|
|
83
|
+
export type WebhookSubscription = z.infer<typeof WebhookSubscriptionSchema>;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Hook0 event type response from create operation.
|
|
87
|
+
* @see https://documentation.hook0.com/reference/eventtypescreate
|
|
88
|
+
*/
|
|
89
|
+
export const Hook0EventTypeResponseSchema = z.object({
|
|
90
|
+
service_name: z.string(),
|
|
91
|
+
resource_type_name: z.string(),
|
|
92
|
+
verb_name: z.string(),
|
|
93
|
+
event_type_name: z.string(),
|
|
94
|
+
});
|
|
95
|
+
export type Hook0EventTypeResponse = z.infer<
|
|
96
|
+
typeof Hook0EventTypeResponseSchema
|
|
97
|
+
>;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Hook0 event type list item.
|
|
101
|
+
* @see https://documentation.hook0.com/reference/eventtypeslist
|
|
102
|
+
*/
|
|
103
|
+
export const Hook0EventTypeSchema = z.object({
|
|
104
|
+
name: z.string(),
|
|
105
|
+
service: z.string().optional(),
|
|
106
|
+
resource_type: z.string().optional(),
|
|
107
|
+
verb: z.string().optional(),
|
|
108
|
+
});
|
|
109
|
+
export type Hook0EventType = z.infer<typeof Hook0EventTypeSchema>;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Hook0 event ingestion response.
|
|
113
|
+
* @see https://documentation.hook0.com/api/#tag/events-ingestion/POST/api/v1/event/
|
|
114
|
+
*/
|
|
115
|
+
export const Hook0EventResponseSchema = z.object({
|
|
116
|
+
event_id: z.string().uuid().optional(),
|
|
117
|
+
received_at: z.string().datetime().optional(),
|
|
118
|
+
});
|
|
119
|
+
export type Hook0EventResponse = z.infer<typeof Hook0EventResponseSchema>;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Simplified event response returned to callers.
|
|
123
|
+
*/
|
|
124
|
+
export const WebhookEventResponseSchema = z.object({
|
|
125
|
+
eventId: z.string(),
|
|
126
|
+
receivedAt: z.string(),
|
|
127
|
+
});
|
|
128
|
+
export type WebhookEventResponse = z.infer<typeof WebhookEventResponseSchema>;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Payload sent when ingesting events to Hook0.
|
|
132
|
+
* Contains activity data to be delivered to webhook subscribers.
|
|
133
|
+
*/
|
|
134
|
+
export const WebhookEventPayloadSchema = z.object({
|
|
135
|
+
activityId: z.string(),
|
|
136
|
+
activityType: z.string(),
|
|
137
|
+
accountId: z.string(),
|
|
138
|
+
targetId: z.string().nullable(),
|
|
139
|
+
targetTable: z.string().nullable(),
|
|
140
|
+
message: z.string(),
|
|
141
|
+
metadata: z.record(z.unknown()),
|
|
142
|
+
occurredAt: z.string(),
|
|
143
|
+
});
|
|
144
|
+
export type WebhookEventPayload = z.infer<typeof WebhookEventPayloadSchema>;
|
|
145
|
+
|
|
4
146
|
export const WebhookReceived = z.object({
|
|
5
147
|
received: z.boolean(),
|
|
6
148
|
});
|
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.dc7fdf8",
|
|
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
|
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { initContract } from '@ts-rest/core';
|
|
2
|
-
import {
|
|
3
|
-
accountIdSchema,
|
|
4
|
-
BadRequestError,
|
|
5
|
-
ForbiddenError,
|
|
6
|
-
InternalError,
|
|
7
|
-
NotFoundError,
|
|
8
|
-
UnauthorizedError,
|
|
9
|
-
} from '../../../common/types';
|
|
10
|
-
import {
|
|
11
|
-
accountContactIdSchema,
|
|
12
|
-
CompliancePatchAccountContactZod,
|
|
13
|
-
IAccountContact,
|
|
14
|
-
} from '../../../common/types/account-contact.types';
|
|
15
|
-
import { z } from 'zod';
|
|
16
|
-
|
|
17
|
-
const c = initContract();
|
|
18
|
-
|
|
19
|
-
export const accountContactsContract = c.router(
|
|
20
|
-
{
|
|
21
|
-
getAccountContacts: {
|
|
22
|
-
summary: '[ADMIN] Get Account Contacts',
|
|
23
|
-
method: 'GET',
|
|
24
|
-
path: '',
|
|
25
|
-
metadata: {
|
|
26
|
-
auth: true,
|
|
27
|
-
},
|
|
28
|
-
query: z.object({
|
|
29
|
-
accountId: accountIdSchema,
|
|
30
|
-
}),
|
|
31
|
-
responses: {
|
|
32
|
-
200: z.array(IAccountContact),
|
|
33
|
-
401: UnauthorizedError,
|
|
34
|
-
403: ForbiddenError,
|
|
35
|
-
500: InternalError,
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
getAccountContact: {
|
|
39
|
-
summary: '[ADMIN] Get account contact by id',
|
|
40
|
-
method: 'GET',
|
|
41
|
-
path: '/:id',
|
|
42
|
-
metadata: {
|
|
43
|
-
auth: true,
|
|
44
|
-
},
|
|
45
|
-
pathParams: z.object({
|
|
46
|
-
id: accountContactIdSchema,
|
|
47
|
-
}),
|
|
48
|
-
query: z.object({
|
|
49
|
-
accountId: accountIdSchema,
|
|
50
|
-
}),
|
|
51
|
-
responses: {
|
|
52
|
-
200: IAccountContact,
|
|
53
|
-
401: UnauthorizedError,
|
|
54
|
-
403: ForbiddenError,
|
|
55
|
-
404: NotFoundError,
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
patchAccountContact: {
|
|
59
|
-
summary: '[ADMIN] Update account contact',
|
|
60
|
-
method: 'PATCH',
|
|
61
|
-
path: '/:id',
|
|
62
|
-
metadata: {
|
|
63
|
-
auth: true,
|
|
64
|
-
},
|
|
65
|
-
pathParams: z.object({
|
|
66
|
-
id: accountContactIdSchema,
|
|
67
|
-
}),
|
|
68
|
-
body: CompliancePatchAccountContactZod,
|
|
69
|
-
responses: {
|
|
70
|
-
200: IAccountContact,
|
|
71
|
-
400: BadRequestError,
|
|
72
|
-
401: UnauthorizedError,
|
|
73
|
-
403: ForbiddenError,
|
|
74
|
-
404: NotFoundError,
|
|
75
|
-
500: InternalError,
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
pathPrefix: 'account-contacts',
|
|
81
|
-
},
|
|
82
|
-
);
|