@dalmore/api-contracts 1.0.7 → 1.0.9
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 +10 -107
- 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 +153 -0
- package/src/contracts/clients/files-public/index.ts +152 -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
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Type-safe API contracts for Dalmore Client Portal, powered by [ts-rest](https://ts-rest.com/).
|
|
4
4
|
|
|
5
|
+
This package provides **full end-to-end type inference** by shipping TypeScript source files alongside compiled JavaScript.
|
|
6
|
+
|
|
5
7
|
## Installation
|
|
6
8
|
|
|
7
9
|
```bash
|
|
@@ -27,13 +29,27 @@ const client = initClient(clientsContract, {
|
|
|
27
29
|
},
|
|
28
30
|
});
|
|
29
31
|
|
|
30
|
-
// Fully typed API calls
|
|
32
|
+
// Fully typed API calls with complete autocomplete
|
|
31
33
|
const { status, body } = await client.accounts.getAccounts();
|
|
32
34
|
|
|
33
|
-
// Access nested endpoints
|
|
35
|
+
// Access nested endpoints with full type inference
|
|
34
36
|
const trade = await client.trades.getTrade({ params: { id: 'trade_123' } });
|
|
35
37
|
```
|
|
36
38
|
|
|
39
|
+
## TypeScript Configuration
|
|
40
|
+
|
|
41
|
+
For optimal type inference, ensure your `tsconfig.json` includes:
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"compilerOptions": {
|
|
46
|
+
"skipLibCheck": true, // Recommended for faster compilation
|
|
47
|
+
"moduleResolution": "node",
|
|
48
|
+
"esModuleInterop": true
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
37
53
|
## Available Endpoints
|
|
38
54
|
|
|
39
55
|
The `clientsContract` includes:
|
package/index.mjs
CHANGED
|
@@ -5,10 +5,6 @@ import { z } from 'zod';
|
|
|
5
5
|
import { HttpStatus } from '@nestjs/common';
|
|
6
6
|
import parsePhoneNumberFromString from 'libphonenumber-js';
|
|
7
7
|
import { ok, err } from 'neverthrow';
|
|
8
|
-
import 'bcrypt';
|
|
9
|
-
import 'crypto';
|
|
10
|
-
import 'currency-codes';
|
|
11
|
-
import 'typeorm';
|
|
12
8
|
|
|
13
9
|
// src/contracts/clients/index.ts
|
|
14
10
|
extendZodWithOpenApi(z);
|
|
@@ -985,10 +981,10 @@ var LogContextZod = z.object({
|
|
|
985
981
|
"internal-error": {
|
|
986
982
|
status: HttpStatus.INTERNAL_SERVER_ERROR}
|
|
987
983
|
});
|
|
988
|
-
var SortOrder = /* @__PURE__ */ ((
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
return
|
|
984
|
+
var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
|
|
985
|
+
SortOrder2["ASC"] = "ASC";
|
|
986
|
+
SortOrder2["DESC"] = "DESC";
|
|
987
|
+
return SortOrder2;
|
|
992
988
|
})(SortOrder || {});
|
|
993
989
|
var AMLProvider = /* @__PURE__ */ ((AMLProvider2) => {
|
|
994
990
|
AMLProvider2["COMPLY_ADVANTAGE"] = "ComplyAdvantage";
|
|
@@ -1939,9 +1935,9 @@ BLACK_LIST_COUNTRIES.map((c18) => c18.code);
|
|
|
1939
1935
|
var PhoneZodSchema = z.string().nullable().transform((phone) => {
|
|
1940
1936
|
if (phone === null || phone === "") return ok(null);
|
|
1941
1937
|
let result;
|
|
1942
|
-
for (const
|
|
1938
|
+
for (const code of CountryCodes) {
|
|
1943
1939
|
if (result && result.isOk()) break;
|
|
1944
|
-
result = normalizePhoneNumber(phone,
|
|
1940
|
+
result = normalizePhoneNumber(phone, code);
|
|
1945
1941
|
}
|
|
1946
1942
|
return result;
|
|
1947
1943
|
}).refine((result) => result.isOk(), { message: "phone is not valid" }).transform((result) => {
|
|
@@ -2215,7 +2211,7 @@ var isBase64 = (v) => {
|
|
|
2215
2211
|
}
|
|
2216
2212
|
try {
|
|
2217
2213
|
return btoa(atob(v)) === v;
|
|
2218
|
-
} catch (
|
|
2214
|
+
} catch (err2) {
|
|
2219
2215
|
return false;
|
|
2220
2216
|
}
|
|
2221
2217
|
};
|
|
@@ -9958,89 +9954,12 @@ var assetsContract = c4.router(
|
|
|
9958
9954
|
pathPrefix: "assets"
|
|
9959
9955
|
}
|
|
9960
9956
|
);
|
|
9961
|
-
var ComplyAdvantageStatus = /* @__PURE__ */ ((ComplyAdvantageStatus2) => {
|
|
9962
|
-
ComplyAdvantageStatus2["FALSE_POSITIVE"] = "false_positive";
|
|
9963
|
-
ComplyAdvantageStatus2["TRUE_POSITIVE"] = "true_positive";
|
|
9964
|
-
ComplyAdvantageStatus2["POTENTIAL_MATCH"] = "potential_match";
|
|
9965
|
-
ComplyAdvantageStatus2["NO_MATCH"] = "no_match";
|
|
9966
|
-
ComplyAdvantageStatus2["UNKNOWN"] = "unknown";
|
|
9967
|
-
ComplyAdvantageStatus2["TRUE_POSITIVE_APPROVE"] = "true_positive_approve";
|
|
9968
|
-
ComplyAdvantageStatus2["TRUE_POSITIVE_REJECT"] = "true_positive_reject";
|
|
9969
|
-
return ComplyAdvantageStatus2;
|
|
9970
|
-
})(ComplyAdvantageStatus || {});
|
|
9971
|
-
z.object({
|
|
9972
|
-
status: z.enum(["success", "failure"]),
|
|
9973
|
-
content: z.object({
|
|
9974
|
-
data: z.object({
|
|
9975
|
-
match_status: z.nativeEnum(ComplyAdvantageStatus)
|
|
9976
|
-
})
|
|
9977
|
-
}),
|
|
9978
|
-
message: z.string().optional()
|
|
9979
|
-
});
|
|
9980
|
-
|
|
9981
|
-
// src/common/helpers/index.ts
|
|
9982
|
-
var authHeader = {
|
|
9983
|
-
Authorization: "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"
|
|
9984
|
-
};
|
|
9985
|
-
var generateCurlExample = (method, path, options) => {
|
|
9986
|
-
const baseUrl = "https://dalmore-client-portal-api-prod.onrender.com/api/v1";
|
|
9987
|
-
let curl = `curl -X ${method.toUpperCase()} '${baseUrl}${path}`;
|
|
9988
|
-
if (options.query) {
|
|
9989
|
-
const queryString = new URLSearchParams(options.query).toString();
|
|
9990
|
-
curl += `?${queryString}`;
|
|
9991
|
-
}
|
|
9992
|
-
curl += "'";
|
|
9993
|
-
if (options.headers) {
|
|
9994
|
-
Object.entries(options.headers).forEach(([key, value]) => {
|
|
9995
|
-
curl += ` \\
|
|
9996
|
-
--header '${key}: ${value}'`;
|
|
9997
|
-
});
|
|
9998
|
-
}
|
|
9999
|
-
if (options.body) {
|
|
10000
|
-
curl += ` \\
|
|
10001
|
-
--header 'Content-Type: application/json'`;
|
|
10002
|
-
curl += ` \\
|
|
10003
|
-
--data '${JSON.stringify(options.body)}'`;
|
|
10004
|
-
}
|
|
10005
|
-
if (options.formData) {
|
|
10006
|
-
Object.entries(options.formData).forEach(([key, value]) => {
|
|
10007
|
-
curl += ` \\
|
|
10008
|
-
--form '${key}=${value}'`;
|
|
10009
|
-
});
|
|
10010
|
-
}
|
|
10011
|
-
return curl;
|
|
10012
|
-
};
|
|
10013
|
-
var generateApiDescription = (summary, method, path, options) => {
|
|
10014
|
-
const curlExample = generateCurlExample(method, path, options);
|
|
10015
|
-
return `${summary}
|
|
10016
|
-
|
|
10017
|
-
### Example curl request
|
|
10018
|
-
|
|
10019
|
-
\`\`\`bash
|
|
10020
|
-
${curlExample}
|
|
10021
|
-
\`\`\``;
|
|
10022
|
-
};
|
|
10023
|
-
|
|
10024
|
-
// src/contracts/clients/files/index.ts
|
|
10025
9957
|
var c5 = initContract();
|
|
10026
9958
|
var filesContract = c5.router(
|
|
10027
9959
|
{
|
|
10028
9960
|
postFile: {
|
|
10029
9961
|
summary: "Upload a file",
|
|
10030
|
-
description:
|
|
10031
|
-
"Upload a file to the system. CLIENT portal only supports uploads to INDIVIDUALS.",
|
|
10032
|
-
"POST",
|
|
10033
|
-
"/files",
|
|
10034
|
-
{
|
|
10035
|
-
query: {
|
|
10036
|
-
name: "test",
|
|
10037
|
-
category: "application",
|
|
10038
|
-
targetId: "individual_01j5tkg6k2fygr0x06fegt27aj"
|
|
10039
|
-
},
|
|
10040
|
-
headers: authHeader,
|
|
10041
|
-
formData: { file: '@"/Users/local/Desktop/test.csv"' }
|
|
10042
|
-
}
|
|
10043
|
-
),
|
|
9962
|
+
description: "Upload a file to the system. CLIENT portal only supports uploads to INDIVIDUALS.",
|
|
10044
9963
|
method: "POST",
|
|
10045
9964
|
path: "",
|
|
10046
9965
|
query: ClientPostFileQueryParams,
|
|
@@ -10656,20 +10575,7 @@ var filesPublicContract = c12.router(
|
|
|
10656
10575
|
{
|
|
10657
10576
|
postFilePublic: {
|
|
10658
10577
|
summary: "Upload a public file",
|
|
10659
|
-
description:
|
|
10660
|
-
"Upload a public file to the system.",
|
|
10661
|
-
"POST",
|
|
10662
|
-
"/files-public",
|
|
10663
|
-
{
|
|
10664
|
-
query: {
|
|
10665
|
-
name: "test",
|
|
10666
|
-
category: "application",
|
|
10667
|
-
targetId: "trade_01j5tkg6k2fygr0x06fegt27aj"
|
|
10668
|
-
},
|
|
10669
|
-
headers: authHeader,
|
|
10670
|
-
formData: { file: '@"/Users/local/Desktop/test.csv"' }
|
|
10671
|
-
}
|
|
10672
|
-
),
|
|
10578
|
+
description: "Upload a public file to the system.",
|
|
10673
10579
|
method: "POST",
|
|
10674
10580
|
path: "",
|
|
10675
10581
|
query: PostFileQueryParams,
|
|
@@ -10967,7 +10873,4 @@ var clientsContract = c17.router(
|
|
|
10967
10873
|
}
|
|
10968
10874
|
);
|
|
10969
10875
|
|
|
10970
|
-
|
|
10971
|
-
var clientsContract2 = clientsContract;
|
|
10972
|
-
|
|
10973
|
-
export { clientsContract2 as clientsContract };
|
|
10876
|
+
export { clientsContract };
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalmore/api-contracts",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "Type-safe API contracts for Dalmore Client Portal",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.mjs",
|
|
7
|
-
"types": "./
|
|
7
|
+
"types": "./src/contracts/clients/index.ts",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
-
"types": "./
|
|
10
|
+
"types": "./src/contracts/clients/index.ts",
|
|
11
11
|
"import": "./index.mjs",
|
|
12
12
|
"default": "./index.mjs"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
16
|
"index.mjs",
|
|
17
|
-
"
|
|
17
|
+
"src"
|
|
18
18
|
],
|
|
19
19
|
"keywords": [
|
|
20
20
|
"dalmore",
|
|
@@ -0,0 +1,98 @@
|
|
|
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 { PhoneZodSchema } from './phone.type';
|
|
6
|
+
import {
|
|
7
|
+
AccountContactType,
|
|
8
|
+
AccountZod,
|
|
9
|
+
IPaginationMeta,
|
|
10
|
+
} from './common.types';
|
|
11
|
+
import { IBaseEntity } from './entity.types';
|
|
12
|
+
import { PhoneNumberData } from './sms.types';
|
|
13
|
+
|
|
14
|
+
extendZodWithOpenApi(z);
|
|
15
|
+
|
|
16
|
+
export const accountContactIdSchema = z.string().refine(
|
|
17
|
+
(value) => {
|
|
18
|
+
try {
|
|
19
|
+
const tid = TypeID.fromString(value);
|
|
20
|
+
return tid.getType() === 'account_contact';
|
|
21
|
+
} catch {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
message:
|
|
27
|
+
'Invalid account contact ID format. Must be a valid TypeID with "account_contact" prefix.',
|
|
28
|
+
},
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
export const IAccountContact = IBaseEntity.extend({
|
|
32
|
+
id: accountContactIdSchema,
|
|
33
|
+
title: z.string().nullable().openapi({ example: 'Mr' }),
|
|
34
|
+
firstName: z.string().nullable().openapi({ example: 'John' }),
|
|
35
|
+
lastName: z.string().nullable().openapi({ example: 'Doe' }),
|
|
36
|
+
email: z
|
|
37
|
+
.string()
|
|
38
|
+
.email()
|
|
39
|
+
.nullable()
|
|
40
|
+
.openapi({ example: 'john.doe@example.com' }),
|
|
41
|
+
phone: PhoneNumberData.nullable().optional().openapi({ example: null }),
|
|
42
|
+
type: z
|
|
43
|
+
.nativeEnum(AccountContactType)
|
|
44
|
+
.openapi({ example: AccountContactType.GENERAL }),
|
|
45
|
+
accountId: accountIdSchema.openapi({
|
|
46
|
+
example: 'account_01je6ht4b8fbmttkzh2hs82xqp',
|
|
47
|
+
}),
|
|
48
|
+
account: AccountZod.optional().nullable(),
|
|
49
|
+
referenceLink: z.string().nullable().optional(),
|
|
50
|
+
});
|
|
51
|
+
export type IAccountContact = z.infer<typeof IAccountContact>;
|
|
52
|
+
|
|
53
|
+
export const PatchAccountContactZod = z.object({
|
|
54
|
+
title: z
|
|
55
|
+
.string()
|
|
56
|
+
.min(1)
|
|
57
|
+
.max(50)
|
|
58
|
+
.nullable()
|
|
59
|
+
.optional()
|
|
60
|
+
.openapi({ example: 'Mr' }),
|
|
61
|
+
firstName: z.string().min(1).max(150).openapi({ example: 'John' }),
|
|
62
|
+
lastName: z.string().min(1).max(150).openapi({ example: 'Doe' }),
|
|
63
|
+
email: z.string().email().openapi({ example: 'john.doe@example.com' }),
|
|
64
|
+
phone: PhoneZodSchema.nullable()
|
|
65
|
+
.optional()
|
|
66
|
+
.openapi({ example: '+12124567890' }),
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
export type PatchAccountContactZod = z.infer<typeof PatchAccountContactZod>;
|
|
70
|
+
|
|
71
|
+
export const CompliancePatchAccountContactZod = PatchAccountContactZod.extend({
|
|
72
|
+
accountId: accountIdSchema.openapi({
|
|
73
|
+
example: 'account_01je6ht4b8fbmttkzh2hs82xqp',
|
|
74
|
+
}),
|
|
75
|
+
referenceLink: z
|
|
76
|
+
.string()
|
|
77
|
+
.url()
|
|
78
|
+
.max(2048)
|
|
79
|
+
.nullable()
|
|
80
|
+
.optional()
|
|
81
|
+
.openapi({ example: 'https://www.google.com' }),
|
|
82
|
+
});
|
|
83
|
+
export type CompliancePatchAccountContactZod = z.infer<
|
|
84
|
+
typeof CompliancePatchAccountContactZod
|
|
85
|
+
>;
|
|
86
|
+
|
|
87
|
+
export const IPaginatedAccountContact = z.object({
|
|
88
|
+
items: z.array(IAccountContact),
|
|
89
|
+
meta: IPaginationMeta,
|
|
90
|
+
});
|
|
91
|
+
export type IPaginatedAccountContact = z.infer<typeof IPaginatedAccountContact>;
|
|
92
|
+
|
|
93
|
+
export const AccountContactDeleteResponse = z.object({
|
|
94
|
+
status: z.enum(['pass', 'fail']),
|
|
95
|
+
});
|
|
96
|
+
export type AccountContactDeleteResponse = z.infer<
|
|
97
|
+
typeof AccountContactDeleteResponse
|
|
98
|
+
>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { IAsset } from './asset.types';
|
|
3
|
+
import { IIssuer } from './issuer.types';
|
|
4
|
+
import { IOffering } from './offering.types';
|
|
5
|
+
import { IIssuerPaymentMethod } from './issuer-payment-method.types';
|
|
6
|
+
import { SiteZod } from './site.types';
|
|
7
|
+
import { IPage } from './page.types';
|
|
8
|
+
|
|
9
|
+
export const AccountDetailSummaryZod = z.object({
|
|
10
|
+
id: z.string(),
|
|
11
|
+
name: z.string(),
|
|
12
|
+
issuers: z.array(
|
|
13
|
+
IIssuer.extend({
|
|
14
|
+
offerings: z.lazy(() =>
|
|
15
|
+
z.array(
|
|
16
|
+
IOffering.extend({
|
|
17
|
+
assets: z.lazy(() => z.array(IAsset)),
|
|
18
|
+
}),
|
|
19
|
+
),
|
|
20
|
+
),
|
|
21
|
+
paymentMethods: z.lazy(() => z.array(IIssuerPaymentMethod)),
|
|
22
|
+
}),
|
|
23
|
+
),
|
|
24
|
+
sites: z.lazy(() => z.array(SiteZod)),
|
|
25
|
+
pages: z.lazy(() => z.array(IPage)),
|
|
26
|
+
});
|
|
27
|
+
export type AccountDetailSummaryZod = z.infer<typeof AccountDetailSummaryZod>;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { extendZodWithOpenApi } from '@anatine/zod-openapi';
|
|
2
|
+
import { TypeID } from 'typeid-js';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { IBaseEntity } from './entity.types';
|
|
5
|
+
import { accountIdSchema } from './account.types';
|
|
6
|
+
import { IPaginationMeta } from './common.types';
|
|
7
|
+
|
|
8
|
+
extendZodWithOpenApi(z);
|
|
9
|
+
|
|
10
|
+
export enum IntegrationType {
|
|
11
|
+
RAISI = 'RAISI',
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const accountIntegrationIdSchema = z.string().refine(
|
|
15
|
+
(value) => {
|
|
16
|
+
try {
|
|
17
|
+
const tid = TypeID.fromString(value);
|
|
18
|
+
return tid.getType() === 'account_integration';
|
|
19
|
+
} catch {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
message:
|
|
25
|
+
'Invalid account integration ID format. Must be a valid TypeID with "account_integration" prefix.',
|
|
26
|
+
},
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
export const AccountIntegrationZod = IBaseEntity.extend({
|
|
30
|
+
id: accountIntegrationIdSchema,
|
|
31
|
+
name: z.string(),
|
|
32
|
+
integration: z.nativeEnum(IntegrationType),
|
|
33
|
+
description: z.string().nullable(),
|
|
34
|
+
partnerId: z.string().nullable(),
|
|
35
|
+
url: z.string().nullable(),
|
|
36
|
+
webhook: z.string().nullable(),
|
|
37
|
+
active: z.boolean(),
|
|
38
|
+
metadata: z.record(z.string(), z.unknown()).nullable(),
|
|
39
|
+
accountId: z.lazy(() => accountIdSchema),
|
|
40
|
+
});
|
|
41
|
+
export type AccountIntegrationZod = z.infer<typeof AccountIntegrationZod>;
|
|
42
|
+
|
|
43
|
+
export const IPaginatedAccountIntegration = z.object({
|
|
44
|
+
items: z.array(AccountIntegrationZod),
|
|
45
|
+
meta: IPaginationMeta,
|
|
46
|
+
});
|
|
47
|
+
export type IPaginatedAccountIntegration = z.infer<
|
|
48
|
+
typeof IPaginatedAccountIntegration
|
|
49
|
+
>;
|
|
50
|
+
|
|
51
|
+
export const PostAccountIntegrationZod = z.object({
|
|
52
|
+
name: z.string().min(1).max(100).openapi({ example: 'Raisi' }),
|
|
53
|
+
integration: z
|
|
54
|
+
.nativeEnum(IntegrationType)
|
|
55
|
+
.openapi({ example: IntegrationType.RAISI }),
|
|
56
|
+
description: z
|
|
57
|
+
.string()
|
|
58
|
+
.min(1)
|
|
59
|
+
.max(1000)
|
|
60
|
+
.nullable()
|
|
61
|
+
.optional()
|
|
62
|
+
.openapi({ example: 'Raisi integration' }),
|
|
63
|
+
partnerId: z
|
|
64
|
+
.string()
|
|
65
|
+
.min(1)
|
|
66
|
+
.max(100)
|
|
67
|
+
.nullable()
|
|
68
|
+
.optional()
|
|
69
|
+
.openapi({ example: '1234567890' }),
|
|
70
|
+
url: z
|
|
71
|
+
.string()
|
|
72
|
+
.url()
|
|
73
|
+
.nullable()
|
|
74
|
+
.optional()
|
|
75
|
+
.openapi({ example: 'https://www.raisi.com' }),
|
|
76
|
+
webhook: z
|
|
77
|
+
.string()
|
|
78
|
+
.url()
|
|
79
|
+
.nullable()
|
|
80
|
+
.optional()
|
|
81
|
+
.openapi({ example: 'https://www.raisi.com/webhook' }),
|
|
82
|
+
active: z.boolean().default(true).openapi({ example: true }),
|
|
83
|
+
metadata: z
|
|
84
|
+
.record(z.string(), z.unknown())
|
|
85
|
+
.nullable()
|
|
86
|
+
.optional()
|
|
87
|
+
.openapi({ example: { key: 'value' } }),
|
|
88
|
+
});
|
|
89
|
+
export type PostAccountIntegrationZod = z.infer<
|
|
90
|
+
typeof PostAccountIntegrationZod
|
|
91
|
+
>;
|
|
92
|
+
|
|
93
|
+
export const PatchAccountIntegrationZod = z.object({
|
|
94
|
+
name: z
|
|
95
|
+
.string()
|
|
96
|
+
.min(1)
|
|
97
|
+
.max(100)
|
|
98
|
+
.nullable()
|
|
99
|
+
.optional()
|
|
100
|
+
.openapi({ example: 'Raisi' }),
|
|
101
|
+
integration: z
|
|
102
|
+
.nativeEnum(IntegrationType)
|
|
103
|
+
.optional()
|
|
104
|
+
.openapi({ example: IntegrationType.RAISI }),
|
|
105
|
+
description: z
|
|
106
|
+
.string()
|
|
107
|
+
.min(1)
|
|
108
|
+
.max(1000)
|
|
109
|
+
.nullable()
|
|
110
|
+
.optional()
|
|
111
|
+
.openapi({ example: 'Raisi integration' }),
|
|
112
|
+
partnerId: z.string().min(1).max(100).nullable().optional(),
|
|
113
|
+
url: z
|
|
114
|
+
.string()
|
|
115
|
+
.url()
|
|
116
|
+
.nullable()
|
|
117
|
+
.optional()
|
|
118
|
+
.openapi({ example: 'https://www.raisi.com' }),
|
|
119
|
+
webhook: z
|
|
120
|
+
.string()
|
|
121
|
+
.url()
|
|
122
|
+
.nullable()
|
|
123
|
+
.optional()
|
|
124
|
+
.openapi({ example: 'https://www.raisi.com/webhook' }),
|
|
125
|
+
active: z.boolean().nullable().optional(),
|
|
126
|
+
metadata: z
|
|
127
|
+
.record(z.string(), z.unknown())
|
|
128
|
+
.nullable()
|
|
129
|
+
.optional()
|
|
130
|
+
.openapi({ example: { key: 'value' } }),
|
|
131
|
+
});
|
|
132
|
+
export type PatchAccountIntegrationZod = z.infer<
|
|
133
|
+
typeof PatchAccountIntegrationZod
|
|
134
|
+
>;
|
|
135
|
+
|
|
136
|
+
export const AccountIntegrationFiltersZod = z.object({
|
|
137
|
+
search: z.string().max(50).optional(),
|
|
138
|
+
integration: z.nativeEnum(IntegrationType).optional(),
|
|
139
|
+
active: z.boolean().optional(),
|
|
140
|
+
});
|
|
141
|
+
export type AccountIntegrationFiltersZod = z.infer<
|
|
142
|
+
typeof AccountIntegrationFiltersZod
|
|
143
|
+
>;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { extendZodWithOpenApi } from '@anatine/zod-openapi';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { TypeID } from 'typeid-js';
|
|
4
|
+
import { IBaseEntity } from './entity.types';
|
|
5
|
+
import { PhoneNumberData } from './sms.types';
|
|
6
|
+
import { userIdSchema, UserZod } from './user.types';
|
|
7
|
+
import { IPaginationMeta } from './common.types';
|
|
8
|
+
import { PhoneZodSchema } from './phone.type';
|
|
9
|
+
|
|
10
|
+
extendZodWithOpenApi(z);
|
|
11
|
+
export const accountManagerIdSchema = z.string().refine(
|
|
12
|
+
(value) => {
|
|
13
|
+
try {
|
|
14
|
+
const tid = TypeID.fromString(value);
|
|
15
|
+
return tid.getType() === 'account_manager';
|
|
16
|
+
} catch {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
message: `Invalid account manager ID format. Must be a valid TypeID with "account_manager" prefix. Example: account_manager_01j5y5ghx5fg68d663j1fvy2x7`,
|
|
22
|
+
},
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
export const accountManagersInclude = z.enum(['accounts', 'user']);
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @description Query parameters for including related entities
|
|
29
|
+
* @xample in contract us as -> query: z.object({}).merge(AccountManagersIncludeQuery),
|
|
30
|
+
*/
|
|
31
|
+
export const AccountManagersIncludeQuery = z.object({
|
|
32
|
+
include: z
|
|
33
|
+
.string()
|
|
34
|
+
.optional()
|
|
35
|
+
.transform((str) => (str ? str.split(',') : []))
|
|
36
|
+
.refine(
|
|
37
|
+
(includes) =>
|
|
38
|
+
includes.every((include) =>
|
|
39
|
+
accountManagersInclude.options.includes(include as any),
|
|
40
|
+
),
|
|
41
|
+
{
|
|
42
|
+
message: `Invalid include option provided. Valid options are: ${accountManagersInclude.options.join(',')}`,
|
|
43
|
+
},
|
|
44
|
+
)
|
|
45
|
+
.openapi({
|
|
46
|
+
example: `${accountManagersInclude.options.join(',')}`,
|
|
47
|
+
}),
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
export const IAccountManagerZod = IBaseEntity.extend({
|
|
51
|
+
firstName: z.string().openapi({ example: 'John' }),
|
|
52
|
+
lastName: z.string().openapi({ example: 'Doe' }),
|
|
53
|
+
email: z.string().email().openapi({ example: 'john.doe@example.com' }),
|
|
54
|
+
phone: PhoneNumberData.nullable().openapi({ example: '+12124567890' }),
|
|
55
|
+
isDefault: z.boolean().openapi({ example: false }),
|
|
56
|
+
userId: z
|
|
57
|
+
.lazy(() => userIdSchema)
|
|
58
|
+
.nullable()
|
|
59
|
+
.openapi({ example: 'user_01je6ht4b8fbmttkzh2hs82xqp' }),
|
|
60
|
+
user: z
|
|
61
|
+
.lazy(() => UserZod)
|
|
62
|
+
.optional()
|
|
63
|
+
.nullable(),
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
export type IAccountManagerZod = z.infer<typeof IAccountManagerZod>;
|
|
67
|
+
|
|
68
|
+
export const PostAccountManagerZod = z.object({
|
|
69
|
+
firstName: z.string().min(1).max(255).openapi({ example: 'John' }),
|
|
70
|
+
lastName: z.string().min(1).max(255).openapi({ example: 'Doe' }),
|
|
71
|
+
email: z.string().email().openapi({ example: 'john.doe@example.com' }),
|
|
72
|
+
phone: PhoneZodSchema.nullable()
|
|
73
|
+
.optional()
|
|
74
|
+
.openapi({ example: '+12124567890' }),
|
|
75
|
+
isDefault: z.boolean().openapi({ example: false }),
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
export type PostAccountManagerZod = z.infer<typeof PostAccountManagerZod>;
|
|
79
|
+
|
|
80
|
+
export const PatchAccountManagerZod = z.object({
|
|
81
|
+
firstName: z.string().min(1).max(255).optional().openapi({ example: 'John' }),
|
|
82
|
+
lastName: z.string().min(1).max(255).optional().openapi({ example: 'Doe' }),
|
|
83
|
+
email: z
|
|
84
|
+
.string()
|
|
85
|
+
.email()
|
|
86
|
+
.optional()
|
|
87
|
+
.openapi({ example: 'john.doe@example.com' }),
|
|
88
|
+
phone: PhoneZodSchema.nullable()
|
|
89
|
+
.optional()
|
|
90
|
+
.openapi({ example: '+12124567890' }),
|
|
91
|
+
isDefault: z.boolean().optional().openapi({ example: false }),
|
|
92
|
+
});
|
|
93
|
+
export type PatchAccountManagerZod = z.infer<typeof PatchAccountManagerZod>;
|
|
94
|
+
|
|
95
|
+
export const IPaginatedAccountManager = z.object({
|
|
96
|
+
items: z.array(IAccountManagerZod),
|
|
97
|
+
meta: IPaginationMeta,
|
|
98
|
+
});
|
|
99
|
+
export type IPaginatedAccountManager = z.infer<typeof IPaginatedAccountManager>;
|
|
100
|
+
|
|
101
|
+
export const AccountManagerDeleteResponse = z.object({
|
|
102
|
+
status: z.boolean().openapi({ example: true }),
|
|
103
|
+
});
|
|
104
|
+
export type AccountManagerDeleteResponse = z.infer<
|
|
105
|
+
typeof AccountManagerDeleteResponse
|
|
106
|
+
>;
|
|
107
|
+
export const SetDefaultAccountManagerForAllAccountsResponse = z.object({
|
|
108
|
+
message: z
|
|
109
|
+
.string()
|
|
110
|
+
.openapi({ example: 'Default account manager set for all accounts' }),
|
|
111
|
+
});
|
|
112
|
+
export type SetDefaultAccountManagerForAllAccountsResponse = z.infer<
|
|
113
|
+
typeof SetDefaultAccountManagerForAllAccountsResponse
|
|
114
|
+
>;
|
|
115
|
+
|
|
116
|
+
export const AccountManagerDeleteQuery = z.object({
|
|
117
|
+
reassignTo: accountManagerIdSchema
|
|
118
|
+
.nullable()
|
|
119
|
+
.optional()
|
|
120
|
+
.openapi({ example: 'account_manager_01j5y5ghx5fg68d663j1fvy2x7' }),
|
|
121
|
+
});
|
|
122
|
+
export type AccountManagerDeleteQuery = z.infer<
|
|
123
|
+
typeof AccountManagerDeleteQuery
|
|
124
|
+
>;
|