@dalmore/api-contracts 0.0.0-dev.d8ef117 → 0.0.0-dev.ee0e6b6
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/common/types/account-setting.types.ts +31 -0
- package/common/types/common.types.ts +16 -6
- package/common/types/dashboard.types.ts +2 -9
- package/common/types/issuer-offering.types.ts +11 -17
- package/common/types/notification.types.ts +239 -29
- package/common/types/offering.types.ts +2 -9
- 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 +1 -1
- package/common/types/user.types.ts +9 -27
- package/contracts/clients/trade-line-items/index.ts +1 -1
- package/contracts/clients/trades/index.ts +1 -1
- package/contracts/compliance/trade-line-items/index.ts +1 -1
- package/contracts/investors/trade-line-items/index.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { extendZodWithOpenApi } from '@anatine/zod-openapi';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { TypeID } from 'typeid-js';
|
|
4
|
+
import { IBaseEntity } from './entity.types';
|
|
5
|
+
|
|
6
|
+
extendZodWithOpenApi(z);
|
|
7
|
+
|
|
8
|
+
export const accountSettingIdSchema = z.string().refine(
|
|
9
|
+
(value) => {
|
|
10
|
+
try {
|
|
11
|
+
const tid = TypeID.fromString(value);
|
|
12
|
+
return tid.getType() === 'account_setting';
|
|
13
|
+
} catch {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
message:
|
|
19
|
+
'Invalid account setting ID format. Must be a valid TypeID with "account_setting" prefix.',
|
|
20
|
+
},
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
export const IAccountSettingZod = IBaseEntity.extend({
|
|
24
|
+
id: accountSettingIdSchema.openapi({
|
|
25
|
+
example: 'account_setting_01j5y5ghx8fvc83dmx3pznq7hv',
|
|
26
|
+
}),
|
|
27
|
+
accountId: z.string().openapi({
|
|
28
|
+
example: 'account_01j5y5ghx8fvc83dmx3pznq7hv',
|
|
29
|
+
}),
|
|
30
|
+
});
|
|
31
|
+
export type IAccountSettingZod = z.infer<typeof IAccountSettingZod>;
|
|
@@ -111,6 +111,10 @@ export enum HttpMethod {
|
|
|
111
111
|
OPTIONS = 'OPTIONS',
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
export enum UserStatus {
|
|
115
|
+
ACTIVE = 'ACTIVE',
|
|
116
|
+
LOCKED = 'LOCKED',
|
|
117
|
+
}
|
|
114
118
|
export const SENSITIVE_PATTERNS = [
|
|
115
119
|
/password/i,
|
|
116
120
|
/credit.*card/i,
|
|
@@ -200,11 +204,6 @@ export enum UserType {
|
|
|
200
204
|
DEMO = 'DEMO',
|
|
201
205
|
}
|
|
202
206
|
|
|
203
|
-
export enum UserStatus {
|
|
204
|
-
ACTIVE = 'ACTIVE',
|
|
205
|
-
LOCKED = 'LOCKED',
|
|
206
|
-
}
|
|
207
|
-
|
|
208
207
|
export enum UserRole {
|
|
209
208
|
API_KEY = 'API_KEY',
|
|
210
209
|
IMPORT = 'IMPORT',
|
|
@@ -306,7 +305,7 @@ export const AuthUserReq = BaseAuthReq.extend({
|
|
|
306
305
|
lastName: z.string(),
|
|
307
306
|
email: z.string().email(),
|
|
308
307
|
provider: z.string(),
|
|
309
|
-
|
|
308
|
+
locked: z.boolean(),
|
|
310
309
|
lastLoginAt: z.date().nullable(),
|
|
311
310
|
loginCount: z.number(),
|
|
312
311
|
requiresTwoFactorSetup: z.boolean().optional(),
|
|
@@ -1518,3 +1517,14 @@ export const SUBJECT_TYPE_MAP: Record<BulkExportType, string> = {
|
|
|
1518
1517
|
[BulkExportType.SECONDARY_CUSTOMERS]: 'Secondary Customers',
|
|
1519
1518
|
[BulkExportType.SECONDARY_TRADES]: 'Secondary Trades',
|
|
1520
1519
|
};
|
|
1520
|
+
|
|
1521
|
+
export const StringToBooleanSchema = z.preprocess(
|
|
1522
|
+
(val) =>
|
|
1523
|
+
val === 'true' || val === '1'
|
|
1524
|
+
? true
|
|
1525
|
+
: val === 'false' || val === '0'
|
|
1526
|
+
? false
|
|
1527
|
+
: val,
|
|
1528
|
+
z.boolean(),
|
|
1529
|
+
);
|
|
1530
|
+
export type StringToBooleanSchema = z.infer<typeof StringToBooleanSchema>;
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
FileLabels,
|
|
8
8
|
IPaginationMeta,
|
|
9
9
|
OfferingType,
|
|
10
|
+
StringToBooleanSchema,
|
|
10
11
|
} from './common.types';
|
|
11
12
|
import { accountIdSchema } from './account.types';
|
|
12
13
|
|
|
@@ -330,15 +331,7 @@ export const GetInvestmentDashboardQueryZod = z.object({
|
|
|
330
331
|
offerings: OfferingsArrayQueryZod.optional(),
|
|
331
332
|
offeringTypes: OfferingTypesQueryZod.optional(),
|
|
332
333
|
timeFilteringType: z.nativeEnum(DashboardTimeFilteringType),
|
|
333
|
-
debug:
|
|
334
|
-
(val) =>
|
|
335
|
-
val === 'true' || val === '1'
|
|
336
|
-
? true
|
|
337
|
-
: val === 'false' || val === '0'
|
|
338
|
-
? false
|
|
339
|
-
: val,
|
|
340
|
-
z.boolean().optional(),
|
|
341
|
-
),
|
|
334
|
+
debug: StringToBooleanSchema.optional(),
|
|
342
335
|
});
|
|
343
336
|
export type GetInvestmentDashboardQueryZod = z.infer<
|
|
344
337
|
typeof GetInvestmentDashboardQueryZod
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
ComplianceReview,
|
|
11
11
|
DurationType,
|
|
12
12
|
AssetType,
|
|
13
|
+
StringToBooleanSchema,
|
|
13
14
|
} from './common.types';
|
|
14
15
|
import { IBaseEntity } from './entity.types';
|
|
15
16
|
import { IIssuer, issuerIdSchema } from './issuer.types';
|
|
@@ -193,38 +194,39 @@ export const PatchIssuerOffering = z.object({
|
|
|
193
194
|
.max(100)
|
|
194
195
|
.optional()
|
|
195
196
|
.openapi({ example: 'Airbnb IPO' }),
|
|
197
|
+
type: z
|
|
198
|
+
.nativeEnum(OfferingType)
|
|
199
|
+
.optional()
|
|
200
|
+
.openapi({ example: OfferingType.REG_D }),
|
|
196
201
|
targetAmount: z
|
|
197
202
|
.number()
|
|
198
203
|
.min(0)
|
|
199
204
|
.max(10000000000)
|
|
200
205
|
.optional()
|
|
201
206
|
.openapi({ example: 120000 }),
|
|
202
|
-
raiseAmount: z
|
|
203
|
-
.number()
|
|
204
|
-
.min(0)
|
|
205
|
-
.max(10000000000)
|
|
206
|
-
.optional()
|
|
207
|
-
.openapi({ example: 200000 }),
|
|
208
207
|
minInvestment: z
|
|
209
208
|
.number()
|
|
210
209
|
.min(0)
|
|
211
210
|
.max(10000000000)
|
|
211
|
+
.nullable()
|
|
212
212
|
.optional()
|
|
213
213
|
.openapi({ example: 1000 }),
|
|
214
214
|
maxInvestment: z
|
|
215
215
|
.number()
|
|
216
216
|
.min(0)
|
|
217
217
|
.max(10000000000)
|
|
218
|
+
.nullable()
|
|
218
219
|
.optional()
|
|
219
220
|
.openapi({ example: 20000 }),
|
|
220
221
|
contingencyAmount: z
|
|
221
222
|
.number()
|
|
222
223
|
.min(0)
|
|
223
224
|
.max(10000000000)
|
|
225
|
+
.nullable()
|
|
224
226
|
.optional()
|
|
225
227
|
.openapi({ example: 5000 }),
|
|
226
|
-
startAt: dateSchema.optional().openapi({ example: '10/20/2024' }),
|
|
227
|
-
endAt: dateSchema.optional().openapi({ example: '10/27/2024' }),
|
|
228
|
+
startAt: dateSchema.nullable().optional().openapi({ example: '10/20/2024' }),
|
|
229
|
+
endAt: dateSchema.nullable().optional().openapi({ example: '10/27/2024' }),
|
|
228
230
|
cancellationPeriod: z
|
|
229
231
|
.number()
|
|
230
232
|
.min(1)
|
|
@@ -370,15 +372,7 @@ export const IssuerOfferingsFilterZod = z.object({
|
|
|
370
372
|
issuerId: z.lazy(() => issuerIdSchema).optional(),
|
|
371
373
|
type: z.nativeEnum(OfferingType).optional(),
|
|
372
374
|
status: z.nativeEnum(ComplianceReview).optional(),
|
|
373
|
-
enabled:
|
|
374
|
-
(val) =>
|
|
375
|
-
val === 'true' || val === '1'
|
|
376
|
-
? true
|
|
377
|
-
: val === 'false' || val === '0'
|
|
378
|
-
? false
|
|
379
|
-
: val,
|
|
380
|
-
z.boolean().optional(),
|
|
381
|
-
),
|
|
375
|
+
enabled: StringToBooleanSchema.optional(),
|
|
382
376
|
managedBy: z.nativeEnum(ManagedByType).optional(),
|
|
383
377
|
versioningType: z.nativeEnum(OfferingVersioningType).optional(),
|
|
384
378
|
combinedStatus: z.nativeEnum(OfferingStatus).optional(),
|
|
@@ -1,58 +1,268 @@
|
|
|
1
1
|
import { extendZodWithOpenApi } from '@anatine/zod-openapi';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { TypeID } from 'typeid-js';
|
|
4
|
-
import {
|
|
4
|
+
import { IBaseEntity } from './entity.types';
|
|
5
5
|
|
|
6
6
|
extendZodWithOpenApi(z);
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
export enum NotificationChannelType {
|
|
8
9
|
EMAIL = 'EMAIL',
|
|
9
10
|
SLACK = 'SLACK',
|
|
11
|
+
WEBHOOK = 'WEBHOOK',
|
|
10
12
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
|
|
14
|
+
export enum NotificationRecordStatus {
|
|
15
|
+
PENDING = 'PENDING',
|
|
16
|
+
SENT = 'SENT',
|
|
17
|
+
FAILED = 'FAILED',
|
|
14
18
|
}
|
|
15
19
|
|
|
16
|
-
export const
|
|
20
|
+
export const notificationChannelIdSchema = z.string().refine(
|
|
17
21
|
(value) => {
|
|
18
22
|
try {
|
|
19
23
|
const tid = TypeID.fromString(value);
|
|
20
|
-
return tid.getType() === '
|
|
24
|
+
return tid.getType() === 'notification_channel';
|
|
21
25
|
} catch {
|
|
22
26
|
return false;
|
|
23
27
|
}
|
|
24
28
|
},
|
|
25
29
|
{
|
|
26
30
|
message:
|
|
27
|
-
'Invalid notification ID format. Must be a valid TypeID with "
|
|
31
|
+
'Invalid notification channel ID format. Must be a valid TypeID with "notification_channel" prefix.',
|
|
28
32
|
},
|
|
29
33
|
);
|
|
30
34
|
|
|
31
|
-
export const
|
|
32
|
-
|
|
35
|
+
export const notificationChannelTriggerIdSchema = z.string().refine(
|
|
36
|
+
(value) => {
|
|
37
|
+
try {
|
|
38
|
+
const tid = TypeID.fromString(value);
|
|
39
|
+
return tid.getType() === 'notification_channel_trigger';
|
|
40
|
+
} catch {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
message:
|
|
46
|
+
'Invalid notification channel trigger ID format. Must be a valid TypeID with "notification_channel_trigger" prefix.',
|
|
47
|
+
},
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
export const notificationRecordIdSchema = z.string().refine(
|
|
51
|
+
(value) => {
|
|
52
|
+
try {
|
|
53
|
+
const tid = TypeID.fromString(value);
|
|
54
|
+
return tid.getType() === 'notification_record';
|
|
55
|
+
} catch {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
message:
|
|
61
|
+
'Invalid notification record ID format. Must be a valid TypeID with "notification_record" prefix.',
|
|
62
|
+
},
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
export const EmailChannelSettingsSchema = z.object({
|
|
66
|
+
recipients: z.array(z.string().email()).min(1),
|
|
67
|
+
subjectTemplate: z.string().optional(),
|
|
68
|
+
});
|
|
69
|
+
export type EmailChannelSettings = z.infer<typeof EmailChannelSettingsSchema>;
|
|
70
|
+
|
|
71
|
+
export const SlackChannelSettingsSchema = z
|
|
72
|
+
.object({
|
|
73
|
+
webhookUrl: z.string().url().optional(),
|
|
74
|
+
channelEmail: z.string().email().optional(),
|
|
75
|
+
})
|
|
76
|
+
.refine((data) => data.webhookUrl || data.channelEmail, {
|
|
77
|
+
message: 'Either webhookUrl or channelEmail is required',
|
|
78
|
+
});
|
|
79
|
+
export type SlackChannelSettings = z.infer<typeof SlackChannelSettingsSchema>;
|
|
80
|
+
|
|
81
|
+
export const WebhookChannelSettingsSchema = z.object({
|
|
82
|
+
url: z.string().url(),
|
|
83
|
+
method: z.enum(['POST', 'PUT']),
|
|
84
|
+
headers: z.record(z.string()).optional(),
|
|
85
|
+
authType: z.enum(['none', 'bearer', 'basic', 'api_key']).default('none'),
|
|
86
|
+
authValue: z.string().optional(),
|
|
87
|
+
});
|
|
88
|
+
export type WebhookChannelSettings = z.infer<
|
|
89
|
+
typeof WebhookChannelSettingsSchema
|
|
90
|
+
>;
|
|
91
|
+
|
|
92
|
+
export const NotificationChannelSettingsSchema = z.discriminatedUnion('type', [
|
|
93
|
+
z.object({
|
|
94
|
+
type: z.literal(NotificationChannelType.EMAIL),
|
|
95
|
+
config: EmailChannelSettingsSchema,
|
|
96
|
+
}),
|
|
97
|
+
z.object({
|
|
98
|
+
type: z.literal(NotificationChannelType.SLACK),
|
|
99
|
+
config: SlackChannelSettingsSchema,
|
|
100
|
+
}),
|
|
101
|
+
z.object({
|
|
102
|
+
type: z.literal(NotificationChannelType.WEBHOOK),
|
|
103
|
+
config: WebhookChannelSettingsSchema,
|
|
104
|
+
}),
|
|
105
|
+
]);
|
|
106
|
+
export type NotificationChannelSettings = z.infer<
|
|
107
|
+
typeof NotificationChannelSettingsSchema
|
|
108
|
+
>;
|
|
109
|
+
|
|
110
|
+
export const EmailNotificationPayloadSchema = z.object({
|
|
111
|
+
to: z.array(z.string().email()),
|
|
33
112
|
subject: z.string(),
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
debug: z.boolean().default(false),
|
|
37
|
-
notificationChannel: z.nativeEnum(NotificationChannel),
|
|
38
|
-
channelName: z.string(),
|
|
39
|
-
channelEmail: z.string().email(),
|
|
40
|
-
notificationType: z.nativeEnum(NotificationType),
|
|
113
|
+
body: z.string(),
|
|
114
|
+
html: z.string().optional(),
|
|
41
115
|
});
|
|
42
|
-
export type
|
|
116
|
+
export type EmailNotificationPayload = z.infer<
|
|
117
|
+
typeof EmailNotificationPayloadSchema
|
|
118
|
+
>;
|
|
43
119
|
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
channelEmail: z.string().email(),
|
|
120
|
+
export const SlackNotificationPayloadSchema = z.object({
|
|
121
|
+
webhookUrl: z.string().url().optional(),
|
|
122
|
+
channelEmail: z.string().email().optional(),
|
|
123
|
+
message: z.string(),
|
|
124
|
+
blocks: z.array(z.record(z.unknown())).optional(),
|
|
47
125
|
});
|
|
126
|
+
export type SlackNotificationPayload = z.infer<
|
|
127
|
+
typeof SlackNotificationPayloadSchema
|
|
128
|
+
>;
|
|
48
129
|
|
|
49
|
-
export const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
debug: z.boolean().default(false),
|
|
55
|
-
settings: SlackSettingsSchema,
|
|
130
|
+
export const WebhookNotificationPayloadSchema = z.object({
|
|
131
|
+
url: z.string().url(),
|
|
132
|
+
method: z.enum(['POST', 'PUT']),
|
|
133
|
+
headers: z.record(z.string()),
|
|
134
|
+
body: z.record(z.unknown()),
|
|
56
135
|
});
|
|
136
|
+
export type WebhookNotificationPayload = z.infer<
|
|
137
|
+
typeof WebhookNotificationPayloadSchema
|
|
138
|
+
>;
|
|
139
|
+
|
|
140
|
+
export const NotificationPayloadSchema = z.discriminatedUnion('type', [
|
|
141
|
+
z.object({
|
|
142
|
+
type: z.literal(NotificationChannelType.EMAIL),
|
|
143
|
+
data: EmailNotificationPayloadSchema,
|
|
144
|
+
}),
|
|
145
|
+
z.object({
|
|
146
|
+
type: z.literal(NotificationChannelType.SLACK),
|
|
147
|
+
data: SlackNotificationPayloadSchema,
|
|
148
|
+
}),
|
|
149
|
+
z.object({
|
|
150
|
+
type: z.literal(NotificationChannelType.WEBHOOK),
|
|
151
|
+
data: WebhookNotificationPayloadSchema,
|
|
152
|
+
}),
|
|
153
|
+
]);
|
|
154
|
+
export type NotificationPayload = z.infer<typeof NotificationPayloadSchema>;
|
|
57
155
|
|
|
58
|
-
export
|
|
156
|
+
export const EmailNotificationResponseSchema = z.object({
|
|
157
|
+
messageId: z.string().optional(),
|
|
158
|
+
accepted: z.array(z.string()).optional(),
|
|
159
|
+
rejected: z.array(z.string()).optional(),
|
|
160
|
+
});
|
|
161
|
+
export type EmailNotificationResponse = z.infer<
|
|
162
|
+
typeof EmailNotificationResponseSchema
|
|
163
|
+
>;
|
|
164
|
+
|
|
165
|
+
export const SlackNotificationResponseSchema = z.object({
|
|
166
|
+
ok: z.boolean().optional(),
|
|
167
|
+
error: z.string().optional(),
|
|
168
|
+
responseBody: z.string().optional(),
|
|
169
|
+
});
|
|
170
|
+
export type SlackNotificationResponse = z.infer<
|
|
171
|
+
typeof SlackNotificationResponseSchema
|
|
172
|
+
>;
|
|
173
|
+
|
|
174
|
+
export const WebhookNotificationResponseSchema = z.object({
|
|
175
|
+
statusCode: z.number(),
|
|
176
|
+
headers: z.record(z.string()).optional(),
|
|
177
|
+
body: z.unknown().optional(),
|
|
178
|
+
});
|
|
179
|
+
export type WebhookNotificationResponse = z.infer<
|
|
180
|
+
typeof WebhookNotificationResponseSchema
|
|
181
|
+
>;
|
|
182
|
+
|
|
183
|
+
export const NotificationResponseSchema = z.discriminatedUnion('type', [
|
|
184
|
+
z.object({
|
|
185
|
+
type: z.literal(NotificationChannelType.EMAIL),
|
|
186
|
+
data: EmailNotificationResponseSchema,
|
|
187
|
+
}),
|
|
188
|
+
z.object({
|
|
189
|
+
type: z.literal(NotificationChannelType.SLACK),
|
|
190
|
+
data: SlackNotificationResponseSchema,
|
|
191
|
+
}),
|
|
192
|
+
z.object({
|
|
193
|
+
type: z.literal(NotificationChannelType.WEBHOOK),
|
|
194
|
+
data: WebhookNotificationResponseSchema,
|
|
195
|
+
}),
|
|
196
|
+
]);
|
|
197
|
+
export type NotificationResponse = z.infer<typeof NotificationResponseSchema>;
|
|
198
|
+
|
|
199
|
+
export const INotificationChannelZod = IBaseEntity.extend({
|
|
200
|
+
id: notificationChannelIdSchema.openapi({
|
|
201
|
+
example: 'notification_channel_01j5y5ghx8fvc83dmx3pznq7hv',
|
|
202
|
+
}),
|
|
203
|
+
accountSettingsId: z.string().openapi({
|
|
204
|
+
example: 'account_setting_01j5y5ghx8fvc83dmx3pznq7hv',
|
|
205
|
+
}),
|
|
206
|
+
channelType: z.nativeEnum(NotificationChannelType).openapi({
|
|
207
|
+
example: NotificationChannelType.SLACK,
|
|
208
|
+
}),
|
|
209
|
+
name: z.string().openapi({
|
|
210
|
+
example: 'Compliance Alerts',
|
|
211
|
+
}),
|
|
212
|
+
enabled: z.boolean().openapi({
|
|
213
|
+
example: true,
|
|
214
|
+
}),
|
|
215
|
+
settings: NotificationChannelSettingsSchema,
|
|
216
|
+
});
|
|
217
|
+
export type INotificationChannelZod = z.infer<typeof INotificationChannelZod>;
|
|
218
|
+
|
|
219
|
+
export const INotificationChannelTriggerZod = IBaseEntity.extend({
|
|
220
|
+
id: notificationChannelTriggerIdSchema.openapi({
|
|
221
|
+
example: 'notification_channel_trigger_01j5y5ghx8fvc83dmx3pznq7hv',
|
|
222
|
+
}),
|
|
223
|
+
notificationChannelId: notificationChannelIdSchema.openapi({
|
|
224
|
+
example: 'notification_channel_01j5y5ghx8fvc83dmx3pznq7hv',
|
|
225
|
+
}),
|
|
226
|
+
activityTypeId: z.string().openapi({
|
|
227
|
+
example: 'activity_type_01j5y5ghx8fvc83dmx3pznq7hv',
|
|
228
|
+
}),
|
|
229
|
+
enabled: z.boolean().openapi({
|
|
230
|
+
example: true,
|
|
231
|
+
}),
|
|
232
|
+
});
|
|
233
|
+
export type INotificationChannelTriggerZod = z.infer<
|
|
234
|
+
typeof INotificationChannelTriggerZod
|
|
235
|
+
>;
|
|
236
|
+
|
|
237
|
+
export const INotificationRecordZod = IBaseEntity.extend({
|
|
238
|
+
id: notificationRecordIdSchema.openapi({
|
|
239
|
+
example: 'notification_record_01j5y5ghx8fvc83dmx3pznq7hv',
|
|
240
|
+
}),
|
|
241
|
+
notificationChannelId: notificationChannelIdSchema.openapi({
|
|
242
|
+
example: 'notification_channel_01j5y5ghx8fvc83dmx3pznq7hv',
|
|
243
|
+
}),
|
|
244
|
+
activityId: z.string().nullable().openapi({
|
|
245
|
+
example: 'activity_01j5y5ghx8fvc83dmx3pznq7hv',
|
|
246
|
+
}),
|
|
247
|
+
targetTable: z.string().openapi({
|
|
248
|
+
example: 'trades',
|
|
249
|
+
}),
|
|
250
|
+
targetId: z.string().openapi({
|
|
251
|
+
example: 'trade_01j5y5ghx8fvc83dmx3pznq7hv',
|
|
252
|
+
}),
|
|
253
|
+
status: z.nativeEnum(NotificationRecordStatus).openapi({
|
|
254
|
+
example: NotificationRecordStatus.SENT,
|
|
255
|
+
}),
|
|
256
|
+
payload: NotificationPayloadSchema,
|
|
257
|
+
response: NotificationResponseSchema.nullable(),
|
|
258
|
+
errorMessage: z.string().nullable().openapi({
|
|
259
|
+
example: null,
|
|
260
|
+
}),
|
|
261
|
+
retryCount: z.number().openapi({
|
|
262
|
+
example: 0,
|
|
263
|
+
}),
|
|
264
|
+
sentAt: z.date().nullable().openapi({
|
|
265
|
+
example: new Date(),
|
|
266
|
+
}),
|
|
267
|
+
});
|
|
268
|
+
export type INotificationRecordZod = z.infer<typeof INotificationRecordZod>;
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
OfferingOnboardingStatus,
|
|
18
18
|
AssetType,
|
|
19
19
|
DurationType,
|
|
20
|
+
StringToBooleanSchema,
|
|
20
21
|
} from './common.types';
|
|
21
22
|
import { IBaseEntity } from './entity.types';
|
|
22
23
|
import { fileIdSchema, FileZod } from './file.types';
|
|
@@ -346,15 +347,7 @@ export const OfferingFiltersZod = z.object({
|
|
|
346
347
|
issuerId: z.lazy(() => issuerIdSchema).optional(),
|
|
347
348
|
type: z.nativeEnum(OfferingType).optional(),
|
|
348
349
|
status: z.nativeEnum(ComplianceReview).optional(),
|
|
349
|
-
enabled:
|
|
350
|
-
(val) =>
|
|
351
|
-
val === 'true' || val === '1'
|
|
352
|
-
? true
|
|
353
|
-
: val === 'false' || val === '0'
|
|
354
|
-
? false
|
|
355
|
-
: val,
|
|
356
|
-
z.boolean().optional(),
|
|
357
|
-
),
|
|
350
|
+
enabled: StringToBooleanSchema.optional(),
|
|
358
351
|
managedBy: z.nativeEnum(ManagedByType).optional(),
|
|
359
352
|
versioningType: z.nativeEnum(OfferingVersioningType).optional(),
|
|
360
353
|
combinedStatus: z.nativeEnum(OfferingStatus).optional(),
|
|
@@ -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:
|
|
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:
|
|
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(),
|
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
import {
|
|
40
40
|
tradeLineItemIdSchema,
|
|
41
41
|
TradeLineItemZod,
|
|
42
|
-
} from './trade-line-item.
|
|
42
|
+
} from './trade-line-item.types';
|
|
43
43
|
import { TradeAdjustmentZod } from './trade-adjustment.type';
|
|
44
44
|
import { TransactionZod } from './transaction.types';
|
|
45
45
|
import { accountIdSchema } from './account.types';
|
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
ManagedByType,
|
|
9
9
|
OfferingType,
|
|
10
10
|
PortalType,
|
|
11
|
+
StringToBooleanSchema,
|
|
11
12
|
UserRole,
|
|
12
|
-
UserStatus,
|
|
13
13
|
UserType,
|
|
14
14
|
} from './common.types';
|
|
15
15
|
import { dateOrString, IBaseEntity } from './entity.types';
|
|
@@ -64,7 +64,7 @@ export const GetMeResponse = IBaseEntity.extend({
|
|
|
64
64
|
email: z.string().email(),
|
|
65
65
|
provider: z.string(),
|
|
66
66
|
active: z.boolean(),
|
|
67
|
-
|
|
67
|
+
locked: z.boolean(),
|
|
68
68
|
lastLoginAt: dateOrString.nullable(),
|
|
69
69
|
loginCount: z.number(),
|
|
70
70
|
role: z.string(),
|
|
@@ -162,7 +162,7 @@ export const UserZod = IBaseEntity.extend({
|
|
|
162
162
|
onboarding: z.string().nullable(),
|
|
163
163
|
account: AccountWithoutUsersZod.optional(),
|
|
164
164
|
active: z.boolean(),
|
|
165
|
-
|
|
165
|
+
locked: z.boolean(),
|
|
166
166
|
userLogin: IBaseEntity.extend({
|
|
167
167
|
firstName: z.string(),
|
|
168
168
|
lastName: z.string(),
|
|
@@ -184,27 +184,9 @@ export const UserFiltersZod = z.object({
|
|
|
184
184
|
search: z.string().max(50).optional(),
|
|
185
185
|
role: z.nativeEnum(UserRole).optional(),
|
|
186
186
|
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
|
-
}),
|
|
187
|
+
locked: StringToBooleanSchema.optional(),
|
|
188
|
+
active: StringToBooleanSchema.optional(),
|
|
189
|
+
twoFactorEnabled: StringToBooleanSchema.optional(),
|
|
208
190
|
});
|
|
209
191
|
|
|
210
192
|
const usersInclude = z.enum(['account', 'role']);
|
|
@@ -279,7 +261,7 @@ export type IssuerUsersStatusUpdateResponse = z.infer<
|
|
|
279
261
|
>;
|
|
280
262
|
|
|
281
263
|
export const UpdateLockedStatus = z.object({
|
|
282
|
-
|
|
264
|
+
locked: z.boolean(),
|
|
283
265
|
});
|
|
284
266
|
|
|
285
267
|
export type UpdateLockedStatus = z.infer<typeof UpdateLockedStatus>;
|
|
@@ -290,7 +272,7 @@ export const UsersSummaryFilterZod = z.object({
|
|
|
290
272
|
portalType: z.nativeEnum(PortalType).optional(),
|
|
291
273
|
search: z.string().trim().max(50).optional(),
|
|
292
274
|
selectRole: z.nativeEnum(UserRole).optional(),
|
|
293
|
-
|
|
275
|
+
locked: StringToBooleanSchema.optional(),
|
|
294
276
|
});
|
|
295
277
|
export type UsersSummaryFilterZod = z.infer<typeof UsersSummaryFilterZod>;
|
|
296
278
|
|
|
@@ -304,7 +286,7 @@ export const UsersSummaryZod = z.object({
|
|
|
304
286
|
portalType: z.string(),
|
|
305
287
|
loginCount: z.number().int(),
|
|
306
288
|
lastLogin: z.date(),
|
|
307
|
-
|
|
289
|
+
locked: z.boolean(),
|
|
308
290
|
});
|
|
309
291
|
export type UsersSummaryZod = z.infer<typeof UsersSummaryZod>;
|
|
310
292
|
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
ReviewTradeLineItemStatus,
|
|
14
14
|
TradeLineItemFiltersQuery,
|
|
15
15
|
TradeLineItemResponse,
|
|
16
|
-
} from '../../../common/types/trade-line-item.
|
|
16
|
+
} from '../../../common/types/trade-line-item.types';
|
|
17
17
|
|
|
18
18
|
import { z } from 'zod';
|
|
19
19
|
const c = initContract();
|
package/package.json
CHANGED