@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,316 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ComplyAdvantageStatus } from './comply-advantage.types';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* POST /searches - Create a new search
|
|
6
|
+
* @see https://docs.complyadvantage.com/api-docs/#creating-searches
|
|
7
|
+
*/
|
|
8
|
+
export const CreateSearchRequestSchema = z.object({
|
|
9
|
+
search_term: z.union([
|
|
10
|
+
z.string(),
|
|
11
|
+
z.object({
|
|
12
|
+
first_name: z.string().optional(),
|
|
13
|
+
middle_names: z.string().optional(),
|
|
14
|
+
last_name: z.string(),
|
|
15
|
+
}),
|
|
16
|
+
]),
|
|
17
|
+
client_ref: z.string().max(255).optional(),
|
|
18
|
+
search_profile: z.string().optional(),
|
|
19
|
+
fuzziness: z.number().min(0).max(1).optional(),
|
|
20
|
+
offset: z.number().int().optional(),
|
|
21
|
+
limit: z.number().int().max(100).optional(),
|
|
22
|
+
filters: z
|
|
23
|
+
.object({
|
|
24
|
+
types: z.array(z.string()).optional(),
|
|
25
|
+
birth_year: z.union([z.string(), z.number()]).optional(),
|
|
26
|
+
remove_deceased: z.union([z.literal('0'), z.literal('1')]).optional(),
|
|
27
|
+
country_codes: z.array(z.string()).optional(),
|
|
28
|
+
entity_type: z
|
|
29
|
+
.enum(['person', 'company', 'organisation', 'vessel', 'aircraft'])
|
|
30
|
+
.optional(),
|
|
31
|
+
})
|
|
32
|
+
.optional(),
|
|
33
|
+
tags: z.record(z.string()).optional(),
|
|
34
|
+
share_url: z.union([z.literal(0), z.literal(1)]).optional(),
|
|
35
|
+
exact_match: z.boolean().optional(),
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export type CreateSearchRequest = z.infer<typeof CreateSearchRequestSchema>;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Entity model returned in search results
|
|
42
|
+
* @see https://docs.complyadvantage.com/api-docs/#concepts
|
|
43
|
+
*/
|
|
44
|
+
export const EntitySchema = z
|
|
45
|
+
.object({
|
|
46
|
+
id: z.string(),
|
|
47
|
+
entity_type: z.string().optional(),
|
|
48
|
+
last_updated_utc: z.string().optional(),
|
|
49
|
+
name: z.string(),
|
|
50
|
+
first_name: z.string().optional(),
|
|
51
|
+
middle_name: z.string().optional(),
|
|
52
|
+
last_name: z.string().optional(),
|
|
53
|
+
sources: z.array(z.string()).optional(),
|
|
54
|
+
types: z.array(z.string()).optional(),
|
|
55
|
+
fields: z
|
|
56
|
+
.array(
|
|
57
|
+
z.object({
|
|
58
|
+
name: z.string(),
|
|
59
|
+
tag: z.string().optional(),
|
|
60
|
+
value: z.string(),
|
|
61
|
+
source: z.string().optional(),
|
|
62
|
+
locale: z.string().optional(),
|
|
63
|
+
}),
|
|
64
|
+
)
|
|
65
|
+
.optional(),
|
|
66
|
+
aka: z
|
|
67
|
+
.array(
|
|
68
|
+
z.object({
|
|
69
|
+
name: z.string(),
|
|
70
|
+
}),
|
|
71
|
+
)
|
|
72
|
+
.optional(),
|
|
73
|
+
associates: z
|
|
74
|
+
.array(
|
|
75
|
+
z.object({
|
|
76
|
+
name: z.string(),
|
|
77
|
+
association: z.string().optional(),
|
|
78
|
+
}),
|
|
79
|
+
)
|
|
80
|
+
.optional(),
|
|
81
|
+
media: z
|
|
82
|
+
.array(
|
|
83
|
+
z.object({
|
|
84
|
+
date: z.string().optional(),
|
|
85
|
+
snippet: z.string().optional(),
|
|
86
|
+
title: z.string().optional(),
|
|
87
|
+
url: z.string(),
|
|
88
|
+
pdf_url: z.string().optional(),
|
|
89
|
+
}),
|
|
90
|
+
)
|
|
91
|
+
.optional(),
|
|
92
|
+
source_notes: z
|
|
93
|
+
.record(
|
|
94
|
+
z.object({
|
|
95
|
+
aml_types: z.array(z.string()).optional(),
|
|
96
|
+
country_codes: z.array(z.string()).optional(),
|
|
97
|
+
listing_started_utc: z.string().optional(),
|
|
98
|
+
listing_ended_utc: z.string().optional(),
|
|
99
|
+
name: z.string().optional(),
|
|
100
|
+
source_id: z.string().optional(),
|
|
101
|
+
url: z.string().optional(),
|
|
102
|
+
}),
|
|
103
|
+
)
|
|
104
|
+
.optional(),
|
|
105
|
+
keywords: z.array(z.string()).optional(),
|
|
106
|
+
assets: z
|
|
107
|
+
.array(
|
|
108
|
+
z.object({
|
|
109
|
+
public_url: z.string().optional(),
|
|
110
|
+
source: z.string().optional(),
|
|
111
|
+
type: z.string().optional(),
|
|
112
|
+
url: z.string(),
|
|
113
|
+
}),
|
|
114
|
+
)
|
|
115
|
+
.optional(),
|
|
116
|
+
})
|
|
117
|
+
.passthrough();
|
|
118
|
+
|
|
119
|
+
export type Entity = z.infer<typeof EntitySchema>;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Hit model - individual search result entity with metadata
|
|
123
|
+
* @see https://docs.complyadvantage.com/api-docs/#creating-searches
|
|
124
|
+
*/
|
|
125
|
+
export const HitSchema = z.object({
|
|
126
|
+
doc: EntitySchema,
|
|
127
|
+
is_whitelisted: z.boolean().optional(),
|
|
128
|
+
match_types: z.array(z.string()),
|
|
129
|
+
match_types_details: z.any().optional(),
|
|
130
|
+
score: z.number(),
|
|
131
|
+
match_status: z.nativeEnum(ComplyAdvantageStatus).optional(),
|
|
132
|
+
risk_level: z.enum(['low', 'medium', 'high', 'unknown']).optional(),
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
export type Hit = z.infer<typeof HitSchema>;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Search profile information
|
|
139
|
+
* @see https://docs.complyadvantage.com/api-docs/#creating-searches
|
|
140
|
+
*/
|
|
141
|
+
export const SearchProfileSchema = z.object({
|
|
142
|
+
name: z.string(),
|
|
143
|
+
slug: z.string(),
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
export type SearchProfile = z.infer<typeof SearchProfileSchema>;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* User information
|
|
150
|
+
* @see https://docs.complyadvantage.com/api-docs/#other-endpoints
|
|
151
|
+
*/
|
|
152
|
+
export const UserSchema = z.object({
|
|
153
|
+
id: z.number(),
|
|
154
|
+
email: z.string(),
|
|
155
|
+
name: z.string(),
|
|
156
|
+
phone: z.string().nullable(),
|
|
157
|
+
created_at: z.string(),
|
|
158
|
+
user_is_active: z.boolean().optional(),
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
export type User = z.infer<typeof UserSchema>;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* POST /searches response - Create search response
|
|
165
|
+
* @see https://docs.complyadvantage.com/api-docs/#creating-searches
|
|
166
|
+
*/
|
|
167
|
+
export const CreateSearchResponseSchema = z.object({
|
|
168
|
+
status: z.enum(['success', 'failure']),
|
|
169
|
+
code: z.number().optional(),
|
|
170
|
+
content: z.object({
|
|
171
|
+
data: z.object({
|
|
172
|
+
id: z.number(),
|
|
173
|
+
ref: z.string(),
|
|
174
|
+
searcher_id: z.number(),
|
|
175
|
+
assignee_id: z.number(),
|
|
176
|
+
search_profile: SearchProfileSchema.optional(),
|
|
177
|
+
filters: z
|
|
178
|
+
.object({
|
|
179
|
+
entity_type: z.string().optional(),
|
|
180
|
+
types: z.array(z.string()).optional(),
|
|
181
|
+
birth_year: z.union([z.string(), z.number()]).optional(),
|
|
182
|
+
passport: z.string().optional(),
|
|
183
|
+
exact_match: z.boolean().optional(),
|
|
184
|
+
fuzziness: z.number().optional(),
|
|
185
|
+
country_codes: z.array(z.string()).optional(),
|
|
186
|
+
remove_deceased: z.number().optional(),
|
|
187
|
+
})
|
|
188
|
+
.optional(),
|
|
189
|
+
match_status: z.nativeEnum(ComplyAdvantageStatus),
|
|
190
|
+
risk_level: z.enum(['low', 'medium', 'high', 'unknown']),
|
|
191
|
+
search_term: z.string(),
|
|
192
|
+
submitted_term: z.string().optional(),
|
|
193
|
+
client_ref: z.string().optional(),
|
|
194
|
+
total_hits: z.number(),
|
|
195
|
+
total_matches: z.number(),
|
|
196
|
+
updated_at: z.string(),
|
|
197
|
+
created_at: z.string(),
|
|
198
|
+
tags: z.record(z.string()).optional(),
|
|
199
|
+
labels: z
|
|
200
|
+
.array(
|
|
201
|
+
z.object({
|
|
202
|
+
type: z.string(),
|
|
203
|
+
name: z.string(),
|
|
204
|
+
value: z.string(),
|
|
205
|
+
}),
|
|
206
|
+
)
|
|
207
|
+
.optional(),
|
|
208
|
+
blacklist_filters: z
|
|
209
|
+
.object({
|
|
210
|
+
blacklist_ids: z.array(z.string()),
|
|
211
|
+
})
|
|
212
|
+
.optional(),
|
|
213
|
+
total_blacklist_hits: z.number().optional(),
|
|
214
|
+
limit: z.number().optional(),
|
|
215
|
+
offset: z.number().optional(),
|
|
216
|
+
share_url: z.string().optional(),
|
|
217
|
+
searcher: UserSchema.optional(),
|
|
218
|
+
assignee: UserSchema.optional(),
|
|
219
|
+
hits: z.array(HitSchema).optional(),
|
|
220
|
+
blacklist_hits: z.array(z.any()).optional(),
|
|
221
|
+
}),
|
|
222
|
+
}),
|
|
223
|
+
message: z.string().optional(),
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
export type CreateSearchResponse = z.infer<typeof CreateSearchResponseSchema>;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* GET /searches/{ref}/entities/comply - Get search entities response
|
|
230
|
+
* @see https://docs.complyadvantage.com/api-docs/#get-searchesrefentitiesentity_provider
|
|
231
|
+
*/
|
|
232
|
+
export const GetSearchEntitiesResponseSchema = z.array(HitSchema);
|
|
233
|
+
|
|
234
|
+
export type GetSearchEntitiesResponse = z.infer<
|
|
235
|
+
typeof GetSearchEntitiesResponseSchema
|
|
236
|
+
>;
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* GET /searches/{ref}/details - Get search details response
|
|
240
|
+
* @see https://docs.complyadvantage.com/api-docs/#get-searchesiddetails
|
|
241
|
+
*/
|
|
242
|
+
export const GetSearchDetailsResponseSchema = z.object({
|
|
243
|
+
code: z.number(),
|
|
244
|
+
status: z.enum(['success', 'failure']),
|
|
245
|
+
content: z.object({
|
|
246
|
+
data: z.object({
|
|
247
|
+
id: z.number(),
|
|
248
|
+
ref: z.string(),
|
|
249
|
+
searcher_id: z.number(),
|
|
250
|
+
assignee_id: z.number(),
|
|
251
|
+
filters: z
|
|
252
|
+
.object({
|
|
253
|
+
country_codes: z.array(z.string()).optional(),
|
|
254
|
+
remove_deceased: z.number().optional(),
|
|
255
|
+
types: z.array(z.string()).optional(),
|
|
256
|
+
exact_match: z.boolean().optional(),
|
|
257
|
+
fuzziness: z.number().optional(),
|
|
258
|
+
birth_year: z.union([z.string(), z.number()]).optional(),
|
|
259
|
+
entity_type: z.string().optional(),
|
|
260
|
+
})
|
|
261
|
+
.optional(),
|
|
262
|
+
match_status: z.nativeEnum(ComplyAdvantageStatus),
|
|
263
|
+
risk_level: z.enum(['low', 'medium', 'high', 'unknown']),
|
|
264
|
+
search_term: z.string(),
|
|
265
|
+
submitted_term: z.string().optional(),
|
|
266
|
+
client_ref: z.string().optional(),
|
|
267
|
+
total_hits: z.number(),
|
|
268
|
+
total_matches: z.number(),
|
|
269
|
+
updated_at: z.string(),
|
|
270
|
+
created_at: z.string(),
|
|
271
|
+
tags: z.record(z.string()).optional(),
|
|
272
|
+
labels: z
|
|
273
|
+
.array(
|
|
274
|
+
z.object({
|
|
275
|
+
type: z.string(),
|
|
276
|
+
name: z.string(),
|
|
277
|
+
value: z.string(),
|
|
278
|
+
}),
|
|
279
|
+
)
|
|
280
|
+
.optional(),
|
|
281
|
+
blacklist_filters: z
|
|
282
|
+
.object({
|
|
283
|
+
blacklist_ids: z.array(z.string()),
|
|
284
|
+
})
|
|
285
|
+
.optional(),
|
|
286
|
+
total_blacklist_hits: z.number().optional(),
|
|
287
|
+
limit: z.number().optional(),
|
|
288
|
+
offset: z.number().optional(),
|
|
289
|
+
search_profile: SearchProfileSchema.optional(),
|
|
290
|
+
searcher: UserSchema.optional(),
|
|
291
|
+
assignee: UserSchema.optional(),
|
|
292
|
+
hits: z.array(HitSchema),
|
|
293
|
+
blacklist_hits: z.array(z.any()).optional(),
|
|
294
|
+
share_url: z.string().optional(),
|
|
295
|
+
}),
|
|
296
|
+
}),
|
|
297
|
+
message: z.string().optional(),
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
export type GetSearchDetailsResponse = z.infer<
|
|
301
|
+
typeof GetSearchDetailsResponseSchema
|
|
302
|
+
>;
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* PATCH /searches/{ref} - Update search request
|
|
306
|
+
* @see https://docs.complyadvantage.com/api-docs/#patch-searchesid
|
|
307
|
+
*/
|
|
308
|
+
export const UpdateSearchRequestSchema = z.object({
|
|
309
|
+
match_status: z.nativeEnum(ComplyAdvantageStatus).optional(),
|
|
310
|
+
risk_level: z.enum(['low', 'medium', 'high', 'unknown']).optional(),
|
|
311
|
+
assignee_id: z.number().optional(),
|
|
312
|
+
limit: z.number().int().max(100).optional(),
|
|
313
|
+
tags: z.record(z.string()).optional(),
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
export type UpdateSearchRequest = z.infer<typeof UpdateSearchRequestSchema>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export enum ComplyAdvantageStatus {
|
|
4
|
+
FALSE_POSITIVE = 'false_positive',
|
|
5
|
+
TRUE_POSITIVE = 'true_positive',
|
|
6
|
+
POTENTIAL_MATCH = 'potential_match',
|
|
7
|
+
NO_MATCH = 'no_match',
|
|
8
|
+
UNKNOWN = 'unknown',
|
|
9
|
+
TRUE_POSITIVE_APPROVE = 'true_positive_approve',
|
|
10
|
+
TRUE_POSITIVE_REJECT = 'true_positive_reject',
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const ComplyAdvantageResponseSchema = z.object({
|
|
14
|
+
status: z.enum(['success', 'failure']),
|
|
15
|
+
content: z.object({
|
|
16
|
+
data: z.object({
|
|
17
|
+
match_status: z.nativeEnum(ComplyAdvantageStatus),
|
|
18
|
+
}),
|
|
19
|
+
}),
|
|
20
|
+
message: z.string().optional(),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export type ComplyAdvantageResponseSchema = z.infer<
|
|
24
|
+
typeof ComplyAdvantageResponseSchema
|
|
25
|
+
>;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { extendZodWithOpenApi } from '@anatine/zod-openapi';
|
|
3
|
+
import { TypeID } from 'typeid-js';
|
|
4
|
+
import { BaseContactUsOptions, createUrlSchema } from './common.types';
|
|
5
|
+
extendZodWithOpenApi(z);
|
|
6
|
+
|
|
7
|
+
export const contactUsIdSchema = z.string().refine(
|
|
8
|
+
(value) => {
|
|
9
|
+
try {
|
|
10
|
+
const tid = TypeID.fromString(value);
|
|
11
|
+
return tid.getType() === 'contact_us';
|
|
12
|
+
} catch {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
message: `Invalid contact_us ID format. Must be a valid TypeID with "contact_us" prefix. Example: contact_us_01j5y5ghx5fg68d663j1fvy2x7`,
|
|
18
|
+
},
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
export enum InvestorContactOptions {
|
|
22
|
+
ISSUER = BaseContactUsOptions.ISSUER,
|
|
23
|
+
TECHNICAL_SUPPORT = BaseContactUsOptions.TECHNICAL_SUPPORT,
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export enum PublicIssuerContactOptions {
|
|
27
|
+
TECHNICAL_SUPPORT = BaseContactUsOptions.TECHNICAL_SUPPORT,
|
|
28
|
+
SALES = BaseContactUsOptions.SALES,
|
|
29
|
+
ACCOUNT_MANAGER = BaseContactUsOptions.ACCOUNT_MANAGER,
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export enum IssuerContactOptions {
|
|
33
|
+
TECHNICAL_SUPPORT = BaseContactUsOptions.TECHNICAL_SUPPORT,
|
|
34
|
+
ACCOUNT_MANAGER = BaseContactUsOptions.ACCOUNT_MANAGER,
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const PostContactUsZod = z.object({
|
|
38
|
+
contactOption: z
|
|
39
|
+
.nativeEnum(IssuerContactOptions)
|
|
40
|
+
.openapi({ example: IssuerContactOptions.TECHNICAL_SUPPORT }),
|
|
41
|
+
subject: z.string().min(1).max(60).openapi({ example: 'subject' }),
|
|
42
|
+
message: z.string().min(1).max(1000).openapi({ example: 'message' }),
|
|
43
|
+
});
|
|
44
|
+
export type PostContactUsZod = z.infer<typeof PostContactUsZod>;
|
|
45
|
+
|
|
46
|
+
export const PostContactUsResponse = z.object({
|
|
47
|
+
message: z.string(),
|
|
48
|
+
});
|
|
49
|
+
export type PostContactUsResponse = z.infer<typeof PostContactUsResponse>;
|
|
50
|
+
export const InvestorPostContactUsZod = PostContactUsZod.extend({
|
|
51
|
+
contactOption: z.nativeEnum(InvestorContactOptions).openapi({
|
|
52
|
+
example: InvestorContactOptions.TECHNICAL_SUPPORT,
|
|
53
|
+
}),
|
|
54
|
+
});
|
|
55
|
+
export type InvestorPostContactUsZod = z.infer<typeof InvestorPostContactUsZod>;
|
|
56
|
+
|
|
57
|
+
export const PublicInvestorContactUsZod = PostContactUsZod.extend({
|
|
58
|
+
email: z.string().email().openapi({ example: 'email@example.com' }),
|
|
59
|
+
firstName: z.string().min(1).max(100).openapi({ example: 'John' }),
|
|
60
|
+
lastName: z.string().min(1).max(100).openapi({ example: 'Doe' }),
|
|
61
|
+
contactOption: z.nativeEnum(InvestorContactOptions).openapi({
|
|
62
|
+
example: InvestorContactOptions.TECHNICAL_SUPPORT,
|
|
63
|
+
}),
|
|
64
|
+
url: createUrlSchema({ strict: true }).openapi({
|
|
65
|
+
example: 'test-dev.test.com',
|
|
66
|
+
}),
|
|
67
|
+
turnstileToken: z
|
|
68
|
+
.string()
|
|
69
|
+
.min(1)
|
|
70
|
+
.max(10000)
|
|
71
|
+
.openapi({ example: '0.WdnEAAAAAIjVJHV...8V1ffXx0Q' }),
|
|
72
|
+
});
|
|
73
|
+
export type PublicInvestorContactUsZod = z.infer<
|
|
74
|
+
typeof PublicInvestorContactUsZod
|
|
75
|
+
>;
|
|
76
|
+
|
|
77
|
+
export const PublicIssuerContactUsZod = PostContactUsZod.extend({
|
|
78
|
+
email: z.string().email().openapi({ example: 'email@example.com' }),
|
|
79
|
+
firstName: z.string().min(1).max(100).openapi({ example: 'John' }),
|
|
80
|
+
lastName: z.string().min(1).max(100).openapi({ example: 'Doe' }),
|
|
81
|
+
contactOption: z.nativeEnum(PublicIssuerContactOptions).openapi({
|
|
82
|
+
example: PublicIssuerContactOptions.TECHNICAL_SUPPORT,
|
|
83
|
+
}),
|
|
84
|
+
turnstileToken: z
|
|
85
|
+
.string()
|
|
86
|
+
.min(1)
|
|
87
|
+
.max(10000)
|
|
88
|
+
.openapi({ example: '0.WdnEAAAAAIjVJHV...8V1ffXx0Q' }),
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
export type PublicIssuerContactUsZod = z.infer<typeof PublicIssuerContactUsZod>;
|
|
92
|
+
|
|
93
|
+
export const HandleContactOptionZod = z.object({
|
|
94
|
+
email: z.string().email().openapi({ example: 'email@example.com' }),
|
|
95
|
+
accountId: z.string().optional().nullable().openapi({ example: 'accountId' }),
|
|
96
|
+
senderName: z
|
|
97
|
+
.string()
|
|
98
|
+
.optional()
|
|
99
|
+
.nullable()
|
|
100
|
+
.openapi({ example: 'senderName' }),
|
|
101
|
+
senderEmail: z
|
|
102
|
+
.string()
|
|
103
|
+
.optional()
|
|
104
|
+
.nullable()
|
|
105
|
+
.openapi({ example: 'senderEmail' }),
|
|
106
|
+
});
|
|
107
|
+
export type HandleContactOptionZod = z.infer<typeof HandleContactOptionZod>;
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contract helpers - minimal subset for API contracts package
|
|
3
|
+
* This file is copied directly to @dalmore/api-contracts
|
|
4
|
+
*/
|
|
5
|
+
import { HttpStatus } from '@nestjs/common';
|
|
6
|
+
import parsePhoneNumberFromString, {
|
|
7
|
+
CountryCode,
|
|
8
|
+
PhoneNumber,
|
|
9
|
+
} from 'libphonenumber-js';
|
|
10
|
+
import { err, ok, Result } from 'neverthrow';
|
|
11
|
+
import { ErrorResult } from './common.types';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Validates a US zip code format (12345 or 12345-6789)
|
|
15
|
+
*/
|
|
16
|
+
export const validateUSZipCode = (zipCode: string): boolean => {
|
|
17
|
+
const regex = /^[0-9]{5}(?:-[0-9]{4})?$/;
|
|
18
|
+
return regex.test(zipCode);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Validates a Canadian postal code format (A1A 1A1)
|
|
23
|
+
*/
|
|
24
|
+
export const validateCanadaZipCode = (zipCode: string): boolean => {
|
|
25
|
+
const regex = /^[A-Za-z]\d[A-Za-z] \d[A-Za-z]\d$/;
|
|
26
|
+
return regex.test(zipCode);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Normalizes a short date string (M/D/YY or M/D/YYYY) to MM/DD/YYYY format
|
|
31
|
+
*/
|
|
32
|
+
export function normalizeShortDate(input: string): string {
|
|
33
|
+
const [month, day, year] = input.split('/');
|
|
34
|
+
|
|
35
|
+
if (!month || !day || !year) {
|
|
36
|
+
throw new Error('Invalid date format');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const paddedMonth = month.padStart(2, '0');
|
|
40
|
+
const paddedDay = day.padStart(2, '0');
|
|
41
|
+
const fullYear = year.length === 2 ? `20${year}` : year;
|
|
42
|
+
|
|
43
|
+
return `${paddedMonth}/${paddedDay}/${fullYear}`;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Converts a string into a URL-safe slug
|
|
48
|
+
*/
|
|
49
|
+
export function slugify(input: string, exclude: boolean = false): string {
|
|
50
|
+
if (exclude) {
|
|
51
|
+
const excludeWords = ['llc', 'inc', 'corp', 'co'];
|
|
52
|
+
const negativeWordsList = [
|
|
53
|
+
'www',
|
|
54
|
+
'api',
|
|
55
|
+
'admin',
|
|
56
|
+
'dashboard',
|
|
57
|
+
'auth',
|
|
58
|
+
'cdn',
|
|
59
|
+
'static',
|
|
60
|
+
'blog',
|
|
61
|
+
'support',
|
|
62
|
+
'status',
|
|
63
|
+
'mail',
|
|
64
|
+
'smtp',
|
|
65
|
+
'ftp',
|
|
66
|
+
'ssh',
|
|
67
|
+
'login',
|
|
68
|
+
'register',
|
|
69
|
+
'signup',
|
|
70
|
+
'account',
|
|
71
|
+
'accounts',
|
|
72
|
+
'user',
|
|
73
|
+
'users',
|
|
74
|
+
'profile',
|
|
75
|
+
'settings',
|
|
76
|
+
'help',
|
|
77
|
+
'docs',
|
|
78
|
+
'documentation',
|
|
79
|
+
'developer',
|
|
80
|
+
'developers',
|
|
81
|
+
'app',
|
|
82
|
+
'apps',
|
|
83
|
+
'test',
|
|
84
|
+
'demo',
|
|
85
|
+
'staging',
|
|
86
|
+
'dev',
|
|
87
|
+
'prod',
|
|
88
|
+
'production',
|
|
89
|
+
'beta',
|
|
90
|
+
'alpha',
|
|
91
|
+
'portal',
|
|
92
|
+
'portals',
|
|
93
|
+
'client',
|
|
94
|
+
'clients',
|
|
95
|
+
'investor',
|
|
96
|
+
'investors',
|
|
97
|
+
'issuer',
|
|
98
|
+
'issuers',
|
|
99
|
+
'compliance',
|
|
100
|
+
'offering',
|
|
101
|
+
'offerings',
|
|
102
|
+
'trade',
|
|
103
|
+
'trades',
|
|
104
|
+
];
|
|
105
|
+
|
|
106
|
+
let slug = input
|
|
107
|
+
.toLowerCase()
|
|
108
|
+
.replace(/[^\w\s-]/g, '')
|
|
109
|
+
.replace(/[\s_-]+/g, '-')
|
|
110
|
+
.replace(/^-+|-+$/g, '');
|
|
111
|
+
|
|
112
|
+
excludeWords.forEach((word) => {
|
|
113
|
+
slug = slug.replace(new RegExp(`-${word}$`, 'i'), '');
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
if (negativeWordsList.includes(slug)) {
|
|
117
|
+
return 'new-account';
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return slug;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return input
|
|
124
|
+
.toLowerCase()
|
|
125
|
+
.replace(/[^\w\s-]/g, '')
|
|
126
|
+
.replace(/[\s_-]+/g, '-')
|
|
127
|
+
.replace(/^-+|-+$/g, '');
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
type CurlOptions = {
|
|
131
|
+
query?: Record<string, string>;
|
|
132
|
+
headers?: Record<string, string>;
|
|
133
|
+
body?: Record<string, unknown>;
|
|
134
|
+
formData?: Record<string, string>;
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
export const authHeader: CurlOptions['headers'] = {
|
|
138
|
+
Authorization: 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9',
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
const generateCurlExample = (
|
|
142
|
+
method: string,
|
|
143
|
+
path: string,
|
|
144
|
+
options: CurlOptions,
|
|
145
|
+
) => {
|
|
146
|
+
const baseUrl = 'https://dalmore-client-portal-api-prod.onrender.com/api/v1';
|
|
147
|
+
let curl = `curl -X ${method.toUpperCase()} '${baseUrl}${path}`;
|
|
148
|
+
if (options.query) {
|
|
149
|
+
const queryString = new URLSearchParams(options.query).toString();
|
|
150
|
+
curl += `?${queryString}`;
|
|
151
|
+
}
|
|
152
|
+
curl += "'";
|
|
153
|
+
if (options.headers) {
|
|
154
|
+
Object.entries(options.headers).forEach(([key, value]) => {
|
|
155
|
+
curl += ` \\\n --header '${key}: ${value}'`;
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
if (options.body) {
|
|
159
|
+
curl += ` \\\n --header 'Content-Type: application/json'`;
|
|
160
|
+
curl += ` \\\n --data '${JSON.stringify(options.body)}'`;
|
|
161
|
+
}
|
|
162
|
+
if (options.formData) {
|
|
163
|
+
Object.entries(options.formData).forEach(([key, value]) => {
|
|
164
|
+
curl += ` \\\n --form '${key}=${value}'`;
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
return curl;
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
export const generateApiDescription = (
|
|
171
|
+
summary: string,
|
|
172
|
+
method: string,
|
|
173
|
+
path: string,
|
|
174
|
+
options: CurlOptions,
|
|
175
|
+
) => {
|
|
176
|
+
const curlExample = generateCurlExample(method, path, options);
|
|
177
|
+
return `${summary}
|
|
178
|
+
|
|
179
|
+
### Example curl request
|
|
180
|
+
|
|
181
|
+
\`\`\`bash
|
|
182
|
+
${curlExample}
|
|
183
|
+
\`\`\``;
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Normalizes a phone number to E.164 format
|
|
188
|
+
*/
|
|
189
|
+
export function normalizePhoneNumber(
|
|
190
|
+
phoneNumber: string,
|
|
191
|
+
countryCode: CountryCode,
|
|
192
|
+
): Result<PhoneNumber, ErrorResult> {
|
|
193
|
+
const parsedPhoneNumber = parsePhoneNumberFromString(
|
|
194
|
+
phoneNumber,
|
|
195
|
+
countryCode,
|
|
196
|
+
);
|
|
197
|
+
|
|
198
|
+
if (!parsedPhoneNumber || !parsedPhoneNumber.isValid()) {
|
|
199
|
+
return err({
|
|
200
|
+
status: HttpStatus.BAD_REQUEST,
|
|
201
|
+
message: 'Invalid phone number. Only numbers',
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
return ok(parsedPhoneNumber);
|
|
205
|
+
}
|