@dalmore/api-contracts 1.0.2 → 1.0.5
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 +34 -55
- package/index.d.mts +17 -0
- package/index.d.ts +17 -0
- package/index.mjs +10970 -0
- package/package.json +10 -46
- package/common/helpers/index.ts +0 -205
- package/common/types/account-contact.types.ts +0 -98
- package/common/types/account-detail.types.ts +0 -27
- package/common/types/account-integration.types.ts +0 -143
- package/common/types/account-manager.types.ts +0 -124
- package/common/types/account.types.ts +0 -296
- package/common/types/activity.types.ts +0 -274
- package/common/types/address.types.ts +0 -41
- package/common/types/aic.types.ts +0 -246
- package/common/types/aml.types.ts +0 -18
- package/common/types/api-key-logs.types.ts +0 -66
- package/common/types/api-keys.types.ts +0 -69
- package/common/types/asset.types.ts +0 -338
- package/common/types/auth.types.ts +0 -370
- package/common/types/batch-jobs.types.ts +0 -150
- package/common/types/bonus-tier.types.ts +0 -147
- package/common/types/cart.types.ts +0 -18
- package/common/types/checklist-items.types.ts +0 -70
- package/common/types/checklist.types.ts +0 -97
- package/common/types/common.types.ts +0 -1520
- package/common/types/comply-advantage-api.types.ts +0 -316
- package/common/types/comply-advantage.types.ts +0 -25
- package/common/types/contact-us.types.ts +0 -107
- package/common/types/contract-helpers.ts +0 -205
- package/common/types/countries.types.ts +0 -375
- package/common/types/covered-person.types.ts +0 -274
- package/common/types/dashboard.types.ts +0 -799
- package/common/types/data-record.types.ts +0 -325
- package/common/types/data-room.types.ts +0 -242
- package/common/types/default-theme-config.types.ts +0 -87
- package/common/types/disbursement-adjustment.types.ts +0 -32
- package/common/types/disbursement-approval-user.types.ts +0 -100
- package/common/types/disbursement-review.types.ts +0 -110
- package/common/types/disbursement-transaction.types.ts +0 -72
- package/common/types/disbursements.types.ts +0 -310
- package/common/types/domain-filter.types.ts +0 -55
- package/common/types/email-theme.types.ts +0 -442
- package/common/types/entity.types.ts +0 -15
- package/common/types/error-responses.types.ts +0 -135
- package/common/types/escrow-account.types.ts +0 -104
- package/common/types/exchange-api-key.types.ts +0 -121
- package/common/types/exchange-import.types.ts +0 -36
- package/common/types/exchange-provider.types.ts +0 -329
- package/common/types/file.types.ts +0 -461
- package/common/types/health.types.ts +0 -29
- package/common/types/index.ts +0 -48
- package/common/types/individuals.types.ts +0 -554
- package/common/types/investor-account.types.ts +0 -1239
- package/common/types/investorAccountIdSchema.type.ts +0 -0
- package/common/types/investors-offering.types.ts +0 -65
- package/common/types/invite.types.ts +0 -133
- package/common/types/issuer-bank-account.types.ts +0 -107
- package/common/types/issuer-offering.types.ts +0 -306
- package/common/types/issuer-payment-method.types.ts +0 -341
- package/common/types/issuer.types.ts +0 -312
- package/common/types/job-item.types.ts +0 -119
- package/common/types/jobs.types.ts +0 -171
- package/common/types/kyb.types.ts +0 -53
- package/common/types/kyc.types.ts +0 -188
- package/common/types/legal-entity.types.ts +0 -185
- package/common/types/login-history.types.ts +0 -46
- package/common/types/mail-template.types.ts +0 -436
- package/common/types/north-cap-integration.types.ts +0 -190
- package/common/types/note.types.ts +0 -109
- package/common/types/notification.types.ts +0 -58
- package/common/types/notion-api.types.ts +0 -374
- package/common/types/notion-database.types.ts +0 -125
- package/common/types/notion-page.types.ts +0 -267
- package/common/types/offering-reports.types.ts +0 -153
- package/common/types/offering-submission.types.ts +0 -314
- package/common/types/offering.types.ts +0 -590
- package/common/types/page-revision.types.ts +0 -86
- package/common/types/page.types.ts +0 -436
- package/common/types/password.type.ts +0 -15
- package/common/types/payment-methods.types.ts +0 -298
- package/common/types/phone.type.ts +0 -27
- package/common/types/portfolio.types.ts +0 -50
- package/common/types/privacy-policy-and-tos.types.ts +0 -231
- package/common/types/queue.types.ts +0 -111
- package/common/types/registered-reps.types.ts +0 -25
- package/common/types/rejection-reasons.types.ts +0 -56
- package/common/types/review.types.ts +0 -133
- package/common/types/role.types.ts +0 -26
- package/common/types/secondary-customer.types.ts +0 -66
- package/common/types/secondary-issuer.types.ts +0 -50
- package/common/types/secondary-order.types.ts +0 -58
- package/common/types/secondary-security.types.ts +0 -60
- package/common/types/secondary-trade.entity.ts +0 -16
- package/common/types/secondary-trade.types.ts +0 -95
- package/common/types/secure-request.types.ts +0 -68
- package/common/types/signer.types.ts +0 -651
- package/common/types/site-link.types.ts +0 -166
- package/common/types/site-settings.types.ts +0 -726
- package/common/types/site.types.ts +0 -270
- package/common/types/sms.types.ts +0 -30
- package/common/types/state-machine.types.ts +0 -177
- package/common/types/states.types.ts +0 -163
- package/common/types/subdoc-preview.types.ts +0 -35
- package/common/types/task.types.ts +0 -258
- package/common/types/trade-adjustment.type.ts +0 -33
- package/common/types/trade-line-item.type.ts +0 -132
- package/common/types/trade.types.ts +0 -931
- package/common/types/transaction.types.ts +0 -198
- package/common/types/trusted-contact.types.ts +0 -122
- package/common/types/typography.types.ts +0 -75
- package/common/types/user-manual.types.ts +0 -290
- package/common/types/user-setting.types.ts +0 -133
- package/common/types/user.types.ts +0 -320
- package/common/types/webhook.types.ts +0 -588
- package/common/types/zip.type.ts +0 -36
- package/contracts/clients/accounts/index.ts +0 -61
- package/contracts/clients/aic/index.ts +0 -59
- package/contracts/clients/api-key-logs/index.ts +0 -53
- package/contracts/clients/api-keys/index.ts +0 -73
- package/contracts/clients/assets/index.ts +0 -102
- package/contracts/clients/auth/index.ts +0 -50
- package/contracts/clients/files/index.ts +0 -166
- package/contracts/clients/files-public/index.ts +0 -166
- package/contracts/clients/index.ts +0 -44
- package/contracts/clients/individuals/index.ts +0 -93
- package/contracts/clients/investor-accounts/index.ts +0 -93
- package/contracts/clients/issuers/index.ts +0 -94
- package/contracts/clients/legal-entities/index.ts +0 -93
- package/contracts/clients/offerings/index.ts +0 -117
- package/contracts/clients/secure-requests/index.ts +0 -34
- package/contracts/clients/sites/index.ts +0 -56
- package/contracts/clients/trades/index.ts +0 -122
- package/contracts/compliance/account-contacts/index.ts +0 -82
- package/contracts/compliance/account-managers/index.ts +0 -142
- package/contracts/compliance/accounts/index.ts +0 -187
- package/contracts/compliance/activities/index.ts +0 -55
- package/contracts/compliance/aic/index.ts +0 -60
- package/contracts/compliance/api-keys/index.ts +0 -91
- package/contracts/compliance/assets/index.ts +0 -122
- package/contracts/compliance/auth/index.ts +0 -134
- package/contracts/compliance/batch-jobs/index.ts +0 -62
- package/contracts/compliance/bonus-tiers/index.ts +0 -55
- package/contracts/compliance/checklist/index.ts +0 -87
- package/contracts/compliance/checklist-items/index.ts +0 -86
- package/contracts/compliance/covered-persons/index.ts +0 -97
- package/contracts/compliance/dashboard/index.ts +0 -111
- package/contracts/compliance/data-records/index.ts +0 -116
- package/contracts/compliance/data-rooms/index.ts +0 -113
- package/contracts/compliance/default-theme-configs/index.ts +0 -95
- package/contracts/compliance/disbursement/index.ts +0 -165
- package/contracts/compliance/disbursement-approval-users/index.ts +0 -84
- package/contracts/compliance/disbursement-transactions/index.ts +0 -37
- package/contracts/compliance/domain-filters/index.ts +0 -117
- package/contracts/compliance/email-themes/index.ts +0 -284
- package/contracts/compliance/escrow-accounts/index.ts +0 -85
- package/contracts/compliance/exchange-api-keys/index.ts +0 -129
- package/contracts/compliance/exchange-imports/index.ts +0 -137
- package/contracts/compliance/files/index.ts +0 -267
- package/contracts/compliance/files-public/index.ts +0 -188
- package/contracts/compliance/health/index.ts +0 -26
- package/contracts/compliance/index.ts +0 -147
- package/contracts/compliance/individuals/index.ts +0 -57
- package/contracts/compliance/investor-accounts/index.ts +0 -141
- package/contracts/compliance/invites/index.ts +0 -137
- package/contracts/compliance/issuer-bank-accounts/index.ts +0 -81
- package/contracts/compliance/issuer-payment-methods/index.ts +0 -81
- package/contracts/compliance/issuers/index.ts +0 -97
- package/contracts/compliance/job-items/index.ts +0 -58
- package/contracts/compliance/jobs/index.ts +0 -59
- package/contracts/compliance/kyb/index.ts +0 -54
- package/contracts/compliance/kyc/index.ts +0 -77
- package/contracts/compliance/legal-entities/index.ts +0 -57
- package/contracts/compliance/login-histories/index.ts +0 -37
- package/contracts/compliance/notes/index.ts +0 -69
- package/contracts/compliance/notion-databases/index.ts +0 -107
- package/contracts/compliance/notion-pages/index.ts +0 -105
- package/contracts/compliance/offering-reports/index.ts +0 -149
- package/contracts/compliance/offerings/index.ts +0 -233
- package/contracts/compliance/pages/index.ts +0 -178
- package/contracts/compliance/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 -200
- package/contracts/compliance/webhooks/index.ts +0 -41
- package/contracts/compliance-apikey/accounts/index.ts +0 -58
- package/contracts/compliance-apikey/index.ts +0 -14
- package/contracts/index.ts +0 -6
- package/contracts/investors/account-contacts/index.ts +0 -58
- package/contracts/investors/aic/index.ts +0 -59
- package/contracts/investors/assets/index.ts +0 -61
- package/contracts/investors/auth/index.ts +0 -116
- package/contracts/investors/bonus-tiers/index.ts +0 -37
- package/contracts/investors/cart/index.ts +0 -75
- package/contracts/investors/contact-us/index.ts +0 -48
- package/contracts/investors/data-records/index.ts +0 -113
- package/contracts/investors/data-rooms/index.ts +0 -96
- package/contracts/investors/files/index.ts +0 -167
- package/contracts/investors/files-public/index.ts +0 -185
- package/contracts/investors/index.ts +0 -72
- package/contracts/investors/individuals/index.ts +0 -99
- package/contracts/investors/investor-accounts/index.ts +0 -110
- package/contracts/investors/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 -55
- package/contracts/issuers/contact-us/index.ts +0 -48
- package/contracts/issuers/covered-persons/index.ts +0 -136
- package/contracts/issuers/dashboard/index.ts +0 -72
- package/contracts/issuers/data-records/index.ts +0 -257
- package/contracts/issuers/data-rooms/index.ts +0 -134
- package/contracts/issuers/disbursement-approval-users/index.ts +0 -82
- package/contracts/issuers/disbursement-transactions/index.ts +0 -53
- package/contracts/issuers/disbursements/index.ts +0 -153
- package/contracts/issuers/email-themes/index.ts +0 -242
- package/contracts/issuers/escrow-accounts/index.ts +0 -81
- package/contracts/issuers/exchange-api-keys/index.ts +0 -144
- package/contracts/issuers/files/index.ts +0 -166
- package/contracts/issuers/files-public/index.ts +0 -166
- package/contracts/issuers/health/index.ts +0 -24
- package/contracts/issuers/index.ts +0 -112
- package/contracts/issuers/investor-accounts/index.ts +0 -148
- package/contracts/issuers/invites/index.ts +0 -129
- package/contracts/issuers/issuer/index.ts +0 -94
- package/contracts/issuers/issuer-bank-accounts/index.ts +0 -81
- package/contracts/issuers/issuer-payment-methods/index.ts +0 -136
- package/contracts/issuers/kyc/index.ts +0 -38
- package/contracts/issuers/login-histories/index.ts +0 -51
- package/contracts/issuers/notes/index.ts +0 -69
- package/contracts/issuers/offerings/index.ts +0 -206
- package/contracts/issuers/pages/index.ts +0 -138
- package/contracts/issuers/payment-methods/index.ts +0 -61
- package/contracts/issuers/portfolios/index.ts +0 -36
- package/contracts/issuers/rejection-reasons/index.ts +0 -32
- package/contracts/issuers/review/index.ts +0 -63
- package/contracts/issuers/secondary-customers/index.ts +0 -55
- package/contracts/issuers/secondary-orders/index.ts +0 -57
- package/contracts/issuers/secondary-trades/index.ts +0 -57
- package/contracts/issuers/secure-requests/index.ts +0 -34
- package/contracts/issuers/site-links/index.ts +0 -116
- package/contracts/issuers/site-settings/index.ts +0 -585
- package/contracts/issuers/sites/index.ts +0 -32
- package/contracts/issuers/tasks/index.ts +0 -111
- package/contracts/issuers/trades/index.ts +0 -132
- package/contracts/issuers/transactions/index.ts +0 -158
- package/contracts/issuers/user-manuals/index.ts +0 -62
- package/contracts/issuers/user-settings/index.ts +0 -170
- package/contracts/issuers/users/index.ts +0 -126
- package/contracts/secondaries/accounts/index.ts +0 -58
- package/contracts/secondaries/index.ts +0 -23
- package/contracts/secondaries/secondary-customers/index.ts +0 -55
- package/contracts/secondaries/secondary-issuers/index.ts +0 -94
- package/contracts/secondaries/secondary-orders/index.ts +0 -56
- package/contracts/secondaries/secondary-securities/index.ts +0 -95
- package/contracts/secondaries/secondary-trades/index.ts +0 -56
|
@@ -1,316 +0,0 @@
|
|
|
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>;
|
|
@@ -1,25 +0,0 @@
|
|
|
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
|
-
>;
|
|
@@ -1,107 +0,0 @@
|
|
|
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>;
|
|
@@ -1,205 +0,0 @@
|
|
|
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
|
-
}
|