@dalmore/api-contracts 1.0.7 → 1.0.8
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 +18 -2
- package/index.mjs +1 -4
- package/package.json +4 -4
- package/src/common/types/account-contact.types.ts +98 -0
- package/src/common/types/account-detail.types.ts +27 -0
- package/src/common/types/account-integration.types.ts +143 -0
- package/src/common/types/account-manager.types.ts +124 -0
- package/src/common/types/account.types.ts +296 -0
- package/src/common/types/activity.types.ts +274 -0
- package/src/common/types/address.spec.ts +203 -0
- package/src/common/types/address.types.ts +41 -0
- package/src/common/types/aic.types.ts +246 -0
- package/src/common/types/aml.types.ts +18 -0
- package/src/common/types/api-key-logs.types.ts +66 -0
- package/src/common/types/api-keys.types.ts +69 -0
- package/src/common/types/asset.types.ts +338 -0
- package/src/common/types/auth.types.ts +370 -0
- package/src/common/types/batch-jobs.types.ts +151 -0
- package/src/common/types/bonus-tier.types.ts +147 -0
- package/src/common/types/cart.types.ts +18 -0
- package/src/common/types/checklist-items.types.ts +70 -0
- package/src/common/types/checklist.types.ts +97 -0
- package/src/common/types/common.types.spec.ts +336 -0
- package/src/common/types/common.types.ts +1520 -0
- package/src/common/types/comply-advantage-api.types.ts +316 -0
- package/src/common/types/comply-advantage.types.ts +25 -0
- package/src/common/types/contact-us.types.ts +107 -0
- package/src/common/types/contract-helpers.ts +205 -0
- package/src/common/types/countries.types.ts +375 -0
- package/src/common/types/covered-person.types.ts +274 -0
- package/src/common/types/dashboard.types.ts +799 -0
- package/src/common/types/data-record.types.ts +325 -0
- package/src/common/types/data-room.types.ts +242 -0
- package/src/common/types/default-theme-config.types.ts +87 -0
- package/src/common/types/disbursement-adjustment.types.ts +32 -0
- package/src/common/types/disbursement-approval-user.types.ts +100 -0
- package/src/common/types/disbursement-review.types.ts +110 -0
- package/src/common/types/disbursement-transaction.types.ts +72 -0
- package/src/common/types/disbursements.types.ts +310 -0
- package/src/common/types/domain-filter.types.ts +55 -0
- package/src/common/types/email-theme.types.ts +442 -0
- package/src/common/types/entity.types.ts +15 -0
- package/src/common/types/error-responses.types.ts +135 -0
- package/src/common/types/escrow-account.types.ts +104 -0
- package/src/common/types/exchange-api-key.types.ts +121 -0
- package/src/common/types/exchange-import.types.ts +36 -0
- package/src/common/types/exchange-provider.types.ts +329 -0
- package/src/common/types/file.types.ts +461 -0
- package/src/common/types/files.types.spec.ts +154 -0
- package/src/common/types/health.types.ts +29 -0
- package/src/common/types/index.ts +48 -0
- package/src/common/types/individuals.types.ts +554 -0
- package/src/common/types/investor-account.types.ts +1239 -0
- package/src/common/types/investorAccountIdSchema.type.ts +0 -0
- package/src/common/types/investors-offering.types.ts +65 -0
- package/src/common/types/invite.types.ts +133 -0
- package/src/common/types/issuer-bank-account.types.ts +107 -0
- package/src/common/types/issuer-offering.types.ts +306 -0
- package/src/common/types/issuer-payment-method.types.spec.ts +612 -0
- package/src/common/types/issuer-payment-method.types.ts +341 -0
- package/src/common/types/issuer.types.ts +312 -0
- package/src/common/types/job-item.types.ts +119 -0
- package/src/common/types/jobs.types.ts +171 -0
- package/src/common/types/kyb.types.ts +53 -0
- package/src/common/types/kyc.types.ts +188 -0
- package/src/common/types/legal-entity.types.ts +185 -0
- package/src/common/types/login-history.types.ts +46 -0
- package/src/common/types/mail-template.types.ts +436 -0
- package/src/common/types/north-cap-integration.types.ts +190 -0
- package/src/common/types/note.types.ts +109 -0
- package/src/common/types/notification.types.ts +58 -0
- package/src/common/types/notion-api.types.ts +374 -0
- package/src/common/types/notion-database.types.ts +125 -0
- package/src/common/types/notion-page.types.ts +267 -0
- package/src/common/types/offering-reports.types.ts +153 -0
- package/src/common/types/offering-submission.types.ts +314 -0
- package/src/common/types/offering.types.spec.ts +91 -0
- package/src/common/types/offering.types.ts +590 -0
- package/src/common/types/page-revision.types.ts +86 -0
- package/src/common/types/page.types.ts +436 -0
- package/src/common/types/password.type.ts +15 -0
- package/src/common/types/payment-methods.types.ts +298 -0
- package/src/common/types/phone.spec.ts +76 -0
- package/src/common/types/phone.type.ts +27 -0
- package/src/common/types/portfolio.types.ts +50 -0
- package/src/common/types/privacy-policy-and-tos.types.ts +231 -0
- package/src/common/types/queue.types.ts +112 -0
- package/src/common/types/registered-reps.types.ts +25 -0
- package/src/common/types/rejection-reasons.types.ts +56 -0
- package/src/common/types/reminder-config.types.ts +40 -0
- package/src/common/types/review.types.ts +133 -0
- package/src/common/types/role.types.ts +26 -0
- package/src/common/types/secondary-customer.types.ts +66 -0
- package/src/common/types/secondary-issuer.types.ts +50 -0
- package/src/common/types/secondary-order.types.ts +58 -0
- package/src/common/types/secondary-security.types.ts +60 -0
- package/src/common/types/secondary-trade.entity.ts +16 -0
- package/src/common/types/secondary-trade.types.ts +95 -0
- package/src/common/types/secure-request.types.ts +68 -0
- package/src/common/types/signer.types.ts +651 -0
- package/src/common/types/site-link.types.spec.ts +134 -0
- package/src/common/types/site-link.types.ts +166 -0
- package/src/common/types/site-settings.types.ts +726 -0
- package/src/common/types/site.types.ts +270 -0
- package/src/common/types/sms.types.ts +30 -0
- package/src/common/types/state-machine.types.ts +177 -0
- package/src/common/types/states.types.ts +163 -0
- package/src/common/types/subdoc-preview.types.ts +35 -0
- package/src/common/types/task.types.ts +258 -0
- package/src/common/types/trade-adjustment.type.ts +33 -0
- package/src/common/types/trade-line-item.type.ts +132 -0
- package/src/common/types/trade.types.ts +912 -0
- package/src/common/types/transaction.types.ts +198 -0
- package/src/common/types/trusted-contact.types.ts +122 -0
- package/src/common/types/typography.types.ts +75 -0
- package/src/common/types/user-manual.types.ts +290 -0
- package/src/common/types/user-setting.types.ts +133 -0
- package/src/common/types/user.types.ts +320 -0
- package/src/common/types/webhook.types.ts +588 -0
- package/src/common/types/zip.type.ts +36 -0
- package/src/contracts/clients/accounts/index.ts +61 -0
- package/src/contracts/clients/aic/index.ts +59 -0
- package/src/contracts/clients/api-key-logs/index.ts +53 -0
- package/src/contracts/clients/api-keys/index.ts +73 -0
- package/src/contracts/clients/assets/index.ts +102 -0
- package/src/contracts/clients/auth/index.ts +50 -0
- package/src/contracts/clients/files/index.ts +166 -0
- package/src/contracts/clients/files-public/index.ts +166 -0
- package/src/contracts/clients/index.ts +44 -0
- package/src/contracts/clients/individuals/index.ts +93 -0
- package/src/contracts/clients/investor-accounts/index.ts +93 -0
- package/src/contracts/clients/issuers/index.ts +94 -0
- package/src/contracts/clients/legal-entities/index.ts +93 -0
- package/src/contracts/clients/offerings/index.ts +117 -0
- package/src/contracts/clients/secure-requests/index.ts +34 -0
- package/src/contracts/clients/sites/index.ts +56 -0
- package/src/contracts/clients/trades/index.ts +122 -0
- package/dist/contracts/clients/index.d.ts +0 -19
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { TypeID } from 'typeid-js';
|
|
3
|
+
import { IBaseEntity } from './entity.types';
|
|
4
|
+
import { IPaginationMeta } from './common.types';
|
|
5
|
+
import { extendZodWithOpenApi } from '@anatine/zod-openapi';
|
|
6
|
+
import { notionDatabaseIdSchema } from './notion-database.types';
|
|
7
|
+
import {
|
|
8
|
+
NotionPageObjectZod,
|
|
9
|
+
NotionPagePropertiesZod,
|
|
10
|
+
} from './notion-api.types';
|
|
11
|
+
extendZodWithOpenApi(z);
|
|
12
|
+
|
|
13
|
+
export const notionPageIdSchema = z.string().refine(
|
|
14
|
+
(value) => {
|
|
15
|
+
try {
|
|
16
|
+
const tid = TypeID.fromString(value);
|
|
17
|
+
return tid.getType() === 'notion_page';
|
|
18
|
+
} catch {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
message:
|
|
24
|
+
'Invalid notion_page ID format. Must be a valid TypeID with "notion_page" prefix. Example: notion_page_01j5y5ghx5fg68d663j1fvy2x7',
|
|
25
|
+
},
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
export const NotionPageZod = IBaseEntity.extend({
|
|
29
|
+
notionDatabaseId: notionDatabaseIdSchema,
|
|
30
|
+
name: z
|
|
31
|
+
.string({ message: 'Name field is required.' })
|
|
32
|
+
.min(2, { message: 'Name must have at least 2 characters.' })
|
|
33
|
+
.max(50, { message: 'Name cannot exceed 50 characters.' })
|
|
34
|
+
.openapi({ example: 'Page name' }),
|
|
35
|
+
tid: z
|
|
36
|
+
.string({ message: 'TID field is required.' })
|
|
37
|
+
.min(2, { message: 'TID must have at least 2 characters.' })
|
|
38
|
+
.max(50, { message: 'TID cannot exceed 50 characters.' })
|
|
39
|
+
.openapi({ example: 'page_tid' }),
|
|
40
|
+
display: z
|
|
41
|
+
.boolean({ message: 'Display field is required.' })
|
|
42
|
+
.openapi({ example: true }),
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
export const PostNotionPageSchema = z.object({
|
|
46
|
+
notionDatabaseId: notionDatabaseIdSchema,
|
|
47
|
+
name: z
|
|
48
|
+
.string({ message: 'Name field is required.' })
|
|
49
|
+
.min(2, { message: 'Name must have at least 2 characters.' })
|
|
50
|
+
.max(50, { message: 'Name cannot exceed 50 characters.' })
|
|
51
|
+
.openapi({ example: 'Page name' }),
|
|
52
|
+
tid: z
|
|
53
|
+
.string({ message: 'TID field is required.' })
|
|
54
|
+
.min(2, { message: 'TID must have at least 2 characters.' })
|
|
55
|
+
.max(50, { message: 'TID cannot exceed 50 characters.' })
|
|
56
|
+
.openapi({ example: 'page_tid' }),
|
|
57
|
+
display: z
|
|
58
|
+
.boolean({ message: 'Display field must be a boolean.' })
|
|
59
|
+
.optional()
|
|
60
|
+
.openapi({ example: true }),
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
export const UpdateNotionPageSchema = z.object({
|
|
64
|
+
name: z
|
|
65
|
+
.string()
|
|
66
|
+
.min(2, { message: 'Name must have at least 2 characters.' })
|
|
67
|
+
.max(50, { message: 'Name cannot exceed 50 characters.' })
|
|
68
|
+
.optional()
|
|
69
|
+
.openapi({ example: 'Page name' }),
|
|
70
|
+
tid: z
|
|
71
|
+
.string()
|
|
72
|
+
.min(2, { message: 'TID must have at least 2 characters.' })
|
|
73
|
+
.max(50, { message: 'TID cannot exceed 50 characters.' })
|
|
74
|
+
.optional()
|
|
75
|
+
.openapi({ example: 'page_tid' }),
|
|
76
|
+
display: z.boolean().optional().openapi({ example: true }),
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
export const NotionPageFiltersZod = z.object({
|
|
80
|
+
search: z
|
|
81
|
+
.string({ message: 'Search field must be a string.' })
|
|
82
|
+
.max(50, { message: 'Search cannot exceed 50 characters.' })
|
|
83
|
+
.optional()
|
|
84
|
+
.openapi({ example: 'search term' }),
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
export const IPaginatedNotionPages = z.object({
|
|
88
|
+
items: z.array(NotionPageZod),
|
|
89
|
+
meta: IPaginationMeta,
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
export const NotionPageDropdownZod = z.object({
|
|
93
|
+
id: notionPageIdSchema,
|
|
94
|
+
name: z.string(),
|
|
95
|
+
databaseName: z.string(),
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
const notionPageInclude = z.enum(['notionDatabase']);
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* @description Query parameters for including related entities
|
|
102
|
+
* @example in contract use as -> query: z.object({}).merge(NotionPageIncludeQuery),
|
|
103
|
+
*/
|
|
104
|
+
export const NotionPageIncludeQuery = z.object({
|
|
105
|
+
include: z
|
|
106
|
+
.string()
|
|
107
|
+
.optional()
|
|
108
|
+
.transform((str) => (str ? str.split(',') : []))
|
|
109
|
+
.refine(
|
|
110
|
+
(includes) =>
|
|
111
|
+
includes.every((include) =>
|
|
112
|
+
notionPageInclude.options.includes(include as any),
|
|
113
|
+
),
|
|
114
|
+
{
|
|
115
|
+
message: `Invalid include option provided. Valid options are: ${notionPageInclude.options.join(',')}`,
|
|
116
|
+
},
|
|
117
|
+
)
|
|
118
|
+
.openapi({
|
|
119
|
+
example: `${notionPageInclude.options.join(',')}`,
|
|
120
|
+
}),
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* @see https://developers.notion.com/reference/rich-text
|
|
125
|
+
*/
|
|
126
|
+
export const NotionRichTextSchema = z.object({
|
|
127
|
+
type: z.literal('text'),
|
|
128
|
+
text: z.object({
|
|
129
|
+
content: z.string(),
|
|
130
|
+
link: z
|
|
131
|
+
.object({
|
|
132
|
+
url: z.string(),
|
|
133
|
+
})
|
|
134
|
+
.nullable(),
|
|
135
|
+
}),
|
|
136
|
+
annotations: z.object({
|
|
137
|
+
bold: z.boolean(),
|
|
138
|
+
italic: z.boolean(),
|
|
139
|
+
strikethrough: z.boolean(),
|
|
140
|
+
underline: z.boolean(),
|
|
141
|
+
code: z.boolean(),
|
|
142
|
+
color: z.string(),
|
|
143
|
+
}),
|
|
144
|
+
plain_text: z.string(),
|
|
145
|
+
href: z.string().nullable(),
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
export const NotionUserSchema = z.object({
|
|
149
|
+
object: z.literal('user'),
|
|
150
|
+
id: z.string(),
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
export const NotionParentSchema = z.union([
|
|
154
|
+
z.object({
|
|
155
|
+
type: z.literal('page_id'),
|
|
156
|
+
page_id: z.string(),
|
|
157
|
+
}),
|
|
158
|
+
z.object({
|
|
159
|
+
type: z.literal('block_id'),
|
|
160
|
+
block_id: z.string(),
|
|
161
|
+
}),
|
|
162
|
+
]);
|
|
163
|
+
|
|
164
|
+
export const NotionBaseBlockSchema = z.object({
|
|
165
|
+
object: z.literal('block'),
|
|
166
|
+
id: z.string(),
|
|
167
|
+
parent: NotionParentSchema,
|
|
168
|
+
created_time: z.string(),
|
|
169
|
+
last_edited_time: z.string(),
|
|
170
|
+
created_by: NotionUserSchema,
|
|
171
|
+
last_edited_by: NotionUserSchema,
|
|
172
|
+
has_children: z.boolean(),
|
|
173
|
+
archived: z.boolean(),
|
|
174
|
+
in_trash: z.boolean(),
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
export const NotionParagraphBlockSchema = NotionBaseBlockSchema.extend({
|
|
178
|
+
type: z.literal('paragraph'),
|
|
179
|
+
paragraph: z.object({
|
|
180
|
+
rich_text: z.array(NotionRichTextSchema),
|
|
181
|
+
color: z.string(),
|
|
182
|
+
}),
|
|
183
|
+
children: z.array(z.lazy(() => NotionGenericBlockSchema)).optional(),
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
export const NotionTableBlockSchema = NotionBaseBlockSchema.extend({
|
|
187
|
+
type: z.literal('table'),
|
|
188
|
+
table: z.object({
|
|
189
|
+
table_width: z.number(),
|
|
190
|
+
has_column_header: z.boolean(),
|
|
191
|
+
has_row_header: z.boolean(),
|
|
192
|
+
}),
|
|
193
|
+
children: z.array(z.lazy(() => NotionGenericBlockSchema)).optional(),
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
export const NotionBulletedListItemBlockSchema = NotionBaseBlockSchema.extend({
|
|
197
|
+
type: z.literal('bulleted_list_item'),
|
|
198
|
+
bulleted_list_item: z.object({
|
|
199
|
+
rich_text: z.array(NotionRichTextSchema),
|
|
200
|
+
color: z.string(),
|
|
201
|
+
}),
|
|
202
|
+
children: z.array(z.lazy(() => NotionGenericBlockSchema)).optional(),
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
export const NotionNumberedListItemBlockSchema = NotionBaseBlockSchema.extend({
|
|
206
|
+
type: z.literal('numbered_list_item'),
|
|
207
|
+
numbered_list_item: z.object({
|
|
208
|
+
rich_text: z.array(NotionRichTextSchema),
|
|
209
|
+
color: z.string(),
|
|
210
|
+
}),
|
|
211
|
+
children: z.array(z.lazy(() => NotionGenericBlockSchema)).optional(),
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
export const NotionGenericBlockSchema = NotionBaseBlockSchema.extend({
|
|
215
|
+
type: z.string(),
|
|
216
|
+
children: z.array(z.lazy(() => NotionGenericBlockSchema)).optional(),
|
|
217
|
+
}).and(z.record(z.unknown()));
|
|
218
|
+
|
|
219
|
+
export const NotionPageSchema = z.object({
|
|
220
|
+
id: z.string(),
|
|
221
|
+
title: z.string(),
|
|
222
|
+
properties: NotionPagePropertiesZod,
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
export const NotionDatabaseInfoSchema = z.object({
|
|
226
|
+
id: z.string(),
|
|
227
|
+
name: z.string(),
|
|
228
|
+
tid: z.string(),
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
// Response type for page content
|
|
232
|
+
export const NotionPageContentResponseSchema = z.object({
|
|
233
|
+
object: z.literal('list'),
|
|
234
|
+
results: z.array(NotionGenericBlockSchema),
|
|
235
|
+
page: NotionPageSchema,
|
|
236
|
+
page_object: NotionPageObjectZod,
|
|
237
|
+
database: NotionDatabaseInfoSchema.optional(),
|
|
238
|
+
next_cursor: z.string().nullable(),
|
|
239
|
+
has_more: z.boolean(),
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
export type INotionPage = z.infer<typeof NotionPageZod>;
|
|
243
|
+
export type PostNotionPage = z.infer<typeof PostNotionPageSchema>;
|
|
244
|
+
export type UpdateNotionPage = z.infer<typeof UpdateNotionPageSchema>;
|
|
245
|
+
export type IPaginatedNotionPage = z.infer<typeof IPaginatedNotionPages>;
|
|
246
|
+
export type INotionPageDropdown = z.infer<typeof NotionPageDropdownZod>;
|
|
247
|
+
export interface NotionPageIncludeQuery
|
|
248
|
+
extends z.infer<typeof NotionPageIncludeQuery> {}
|
|
249
|
+
|
|
250
|
+
export type NotionRichText = z.infer<typeof NotionRichTextSchema>;
|
|
251
|
+
export type NotionUser = z.infer<typeof NotionUserSchema>;
|
|
252
|
+
export type NotionParent = z.infer<typeof NotionParentSchema>;
|
|
253
|
+
export type NotionParagraphBlock = z.infer<typeof NotionParagraphBlockSchema>;
|
|
254
|
+
export type NotionTableBlock = z.infer<typeof NotionTableBlockSchema>;
|
|
255
|
+
export type NotionBulletedListItemBlock = z.infer<
|
|
256
|
+
typeof NotionBulletedListItemBlockSchema
|
|
257
|
+
>;
|
|
258
|
+
export type NotionNumberedListItemBlock = z.infer<
|
|
259
|
+
typeof NotionNumberedListItemBlockSchema
|
|
260
|
+
>;
|
|
261
|
+
|
|
262
|
+
export type NotionGenericBlock = z.infer<typeof NotionGenericBlockSchema>;
|
|
263
|
+
export type NotionPage = z.infer<typeof NotionPageSchema>;
|
|
264
|
+
export type NotionDatabaseInfo = z.infer<typeof NotionDatabaseInfoSchema>;
|
|
265
|
+
export type NotionPageContentResponse = z.infer<
|
|
266
|
+
typeof NotionPageContentResponseSchema
|
|
267
|
+
>;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { extendZodWithOpenApi } from '@anatine/zod-openapi';
|
|
2
|
+
import { TypeID } from 'typeid-js';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { accountIdSchema } from './account.types';
|
|
5
|
+
import { dateSchema, IPaginationMeta } from './common.types';
|
|
6
|
+
import { IBaseEntity } from './entity.types';
|
|
7
|
+
import { IIssuer, issuerIdSchema } from './issuer.types';
|
|
8
|
+
|
|
9
|
+
extendZodWithOpenApi(z);
|
|
10
|
+
|
|
11
|
+
export const OfferingReportsFiltersZod = z.object({
|
|
12
|
+
issuerId: z.lazy(() => issuerIdSchema).optional(),
|
|
13
|
+
reportGeneratedAt: dateSchema.optional().openapi({ example: 'MM/DD/YYYY' }),
|
|
14
|
+
});
|
|
15
|
+
export type OfferingReportsFiltersZod = z.infer<
|
|
16
|
+
typeof OfferingReportsFiltersZod
|
|
17
|
+
>;
|
|
18
|
+
|
|
19
|
+
export const OfferingReportsGroupedByIssuerFiltersZod = z.object({
|
|
20
|
+
issuerId: z.lazy(() => issuerIdSchema).optional(),
|
|
21
|
+
accountId: z.lazy(() => accountIdSchema).optional(),
|
|
22
|
+
status: z
|
|
23
|
+
.enum(['Active', 'Inactive'])
|
|
24
|
+
.optional()
|
|
25
|
+
.transform((val) => {
|
|
26
|
+
if (val === undefined) return undefined;
|
|
27
|
+
return val === 'Active';
|
|
28
|
+
}),
|
|
29
|
+
from: dateSchema.optional().openapi({ example: 'MM/DD/YYYY' }),
|
|
30
|
+
to: dateSchema.optional().openapi({ example: 'MM/DD/YYYY' }),
|
|
31
|
+
});
|
|
32
|
+
export type OfferingReportsGroupedByIssuerFiltersZod = z.infer<
|
|
33
|
+
typeof OfferingReportsGroupedByIssuerFiltersZod
|
|
34
|
+
>;
|
|
35
|
+
|
|
36
|
+
export const offeringReportIdSchema = z.string().refine(
|
|
37
|
+
(value) => {
|
|
38
|
+
try {
|
|
39
|
+
const tid = TypeID.fromString(value);
|
|
40
|
+
return tid.getType() === 'offering_report';
|
|
41
|
+
} catch {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
message:
|
|
47
|
+
'Invalid offering report ID format. Must be a valid TypeID with "offering_report" prefix.',
|
|
48
|
+
},
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
export const IOfferingReports = IBaseEntity.extend({
|
|
52
|
+
id: offeringReportIdSchema,
|
|
53
|
+
issuerId: z.lazy(() => issuerIdSchema).optional(),
|
|
54
|
+
issuer: z
|
|
55
|
+
.lazy(() => IIssuer)
|
|
56
|
+
.optional()
|
|
57
|
+
.nullable(),
|
|
58
|
+
reportGeneratedAt: z.date().nullable(),
|
|
59
|
+
totalOfferings: z.number().nullable(),
|
|
60
|
+
totalAmountRaised: z.number().nullable(),
|
|
61
|
+
totalInvestors: z.number().nullable(),
|
|
62
|
+
totalTrades: z.number().nullable(),
|
|
63
|
+
activeOfferings: z.number().nullable(),
|
|
64
|
+
avgAmountPerOffering: z.number().nullable(),
|
|
65
|
+
avgInvestorsPerOffering: z.number().nullable(),
|
|
66
|
+
reportData: z.any().nullable(),
|
|
67
|
+
});
|
|
68
|
+
export type IOfferingReports = z.infer<typeof IOfferingReports>;
|
|
69
|
+
|
|
70
|
+
export const IPaginatedComplianceOfferingReports = z.object({
|
|
71
|
+
items: z.array(IOfferingReports),
|
|
72
|
+
meta: IPaginationMeta,
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
export const IOfferingReportsGroupedByIssuer = IOfferingReports.omit({
|
|
76
|
+
id: true,
|
|
77
|
+
issuer: true,
|
|
78
|
+
}).extend({
|
|
79
|
+
accountId: z.lazy(() => accountIdSchema).optional(),
|
|
80
|
+
accountName: z.string().nullable(),
|
|
81
|
+
issuerLegalName: z.string().nullable(),
|
|
82
|
+
issuerDba: z.string().nullable(),
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
export type IOfferingReportsGroupedByIssuer = z.infer<
|
|
86
|
+
typeof IOfferingReportsGroupedByIssuer
|
|
87
|
+
>;
|
|
88
|
+
|
|
89
|
+
export const IPaginatedComplianceOfferingReportsGroupedByIssuer = z.object({
|
|
90
|
+
items: z.array(IOfferingReportsGroupedByIssuer),
|
|
91
|
+
meta: IPaginationMeta,
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
export const GetGrowthMetricsFiltersZod = z.object({
|
|
95
|
+
days: z.coerce.number().optional(),
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
export type GetGrowthMetricsFiltersZod = z.infer<
|
|
99
|
+
typeof GetGrowthMetricsFiltersZod
|
|
100
|
+
>;
|
|
101
|
+
|
|
102
|
+
export const IGrowthMetrics = z.object({
|
|
103
|
+
date: z.date().nullable(),
|
|
104
|
+
totalAmountRaised: z.number().nullable(),
|
|
105
|
+
dailyGrowth: z.number().nullable(),
|
|
106
|
+
growthPercentage: z.number().nullable(),
|
|
107
|
+
newInvestors: z.number().nullable(),
|
|
108
|
+
newTrades: z.number().nullable(),
|
|
109
|
+
});
|
|
110
|
+
export type IGrowthMetrics = z.infer<typeof IGrowthMetrics>;
|
|
111
|
+
|
|
112
|
+
export const GetTimeSeriesMetricsFiltersZod = z.object({
|
|
113
|
+
days: z.coerce.number().optional(),
|
|
114
|
+
startDate: dateSchema.optional().openapi({ example: 'MM/DD/YYYY' }),
|
|
115
|
+
endDate: dateSchema.optional().openapi({ example: 'MM/DD/YYYY' }),
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
export type GetTimeSeriesMetricsFiltersZod = z.infer<
|
|
119
|
+
typeof GetTimeSeriesMetricsFiltersZod
|
|
120
|
+
>;
|
|
121
|
+
export enum ExportOfferingReportsGroupedByIssuerType {
|
|
122
|
+
REPORT_DATA = 'REPORT_DATA',
|
|
123
|
+
REPORT_DATA_WITH_OFFERING = 'REPORT_DATA_WITH_OFFERING',
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export const ITimeSeriesMetrics = z.object({
|
|
127
|
+
date: z.date().nullable(),
|
|
128
|
+
totalRaised: z.number().nullable(),
|
|
129
|
+
totalInvestors: z.number().nullable(),
|
|
130
|
+
totalOfferings: z.number().nullable(),
|
|
131
|
+
activeOfferings: z.number().nullable(),
|
|
132
|
+
totalTrades: z.number().nullable(),
|
|
133
|
+
avgAmountPerOffering: z.number().nullable(),
|
|
134
|
+
avgInvestorsPerOffering: z.number().nullable(),
|
|
135
|
+
});
|
|
136
|
+
export type ITimeSeriesMetrics = z.infer<typeof ITimeSeriesMetrics>;
|
|
137
|
+
|
|
138
|
+
export const ExportOfferingReportsGroupedByIssuerFiltersZod = z
|
|
139
|
+
.object({
|
|
140
|
+
type: z.nativeEnum(ExportOfferingReportsGroupedByIssuerType),
|
|
141
|
+
})
|
|
142
|
+
.merge(OfferingReportsGroupedByIssuerFiltersZod);
|
|
143
|
+
export type ExportOfferingReportsGroupedByIssuerFiltersZod = z.infer<
|
|
144
|
+
typeof ExportOfferingReportsGroupedByIssuerFiltersZod
|
|
145
|
+
>;
|
|
146
|
+
|
|
147
|
+
export const ExportOfferingReportsResponse = z.object({
|
|
148
|
+
message: z.string(),
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
export type ExportOfferingReportsResponse = z.infer<
|
|
152
|
+
typeof ExportOfferingReportsResponse
|
|
153
|
+
>;
|