@dalmore/api-contracts 1.0.6 → 1.0.7
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/dist/contracts/clients/index.d.ts +19 -0
- package/index.mjs +4 -1
- package/package.json +4 -4
- package/src/common/types/account-contact.types.ts +0 -98
- package/src/common/types/account-detail.types.ts +0 -27
- package/src/common/types/account-integration.types.ts +0 -143
- package/src/common/types/account-manager.types.ts +0 -124
- package/src/common/types/account.types.ts +0 -296
- package/src/common/types/activity.types.ts +0 -274
- package/src/common/types/address.spec.ts +0 -203
- package/src/common/types/address.types.ts +0 -41
- package/src/common/types/aic.types.ts +0 -246
- package/src/common/types/aml.types.ts +0 -18
- package/src/common/types/api-key-logs.types.ts +0 -66
- package/src/common/types/api-keys.types.ts +0 -69
- package/src/common/types/asset.types.ts +0 -338
- package/src/common/types/auth.types.ts +0 -370
- package/src/common/types/batch-jobs.types.ts +0 -151
- package/src/common/types/bonus-tier.types.ts +0 -147
- package/src/common/types/cart.types.ts +0 -18
- package/src/common/types/checklist-items.types.ts +0 -70
- package/src/common/types/checklist.types.ts +0 -97
- package/src/common/types/common.types.spec.ts +0 -336
- package/src/common/types/common.types.ts +0 -1520
- package/src/common/types/comply-advantage-api.types.ts +0 -316
- package/src/common/types/comply-advantage.types.ts +0 -25
- package/src/common/types/contact-us.types.ts +0 -107
- package/src/common/types/contract-helpers.ts +0 -205
- package/src/common/types/countries.types.ts +0 -375
- package/src/common/types/covered-person.types.ts +0 -274
- package/src/common/types/dashboard.types.ts +0 -799
- package/src/common/types/data-record.types.ts +0 -325
- package/src/common/types/data-room.types.ts +0 -242
- package/src/common/types/default-theme-config.types.ts +0 -87
- package/src/common/types/disbursement-adjustment.types.ts +0 -32
- package/src/common/types/disbursement-approval-user.types.ts +0 -100
- package/src/common/types/disbursement-review.types.ts +0 -110
- package/src/common/types/disbursement-transaction.types.ts +0 -72
- package/src/common/types/disbursements.types.ts +0 -310
- package/src/common/types/domain-filter.types.ts +0 -55
- package/src/common/types/email-theme.types.ts +0 -442
- package/src/common/types/entity.types.ts +0 -15
- package/src/common/types/error-responses.types.ts +0 -135
- package/src/common/types/escrow-account.types.ts +0 -104
- package/src/common/types/exchange-api-key.types.ts +0 -121
- package/src/common/types/exchange-import.types.ts +0 -36
- package/src/common/types/exchange-provider.types.ts +0 -329
- package/src/common/types/file.types.ts +0 -461
- package/src/common/types/files.types.spec.ts +0 -154
- package/src/common/types/health.types.ts +0 -29
- package/src/common/types/index.ts +0 -48
- package/src/common/types/individuals.types.ts +0 -554
- package/src/common/types/investor-account.types.ts +0 -1239
- package/src/common/types/investorAccountIdSchema.type.ts +0 -0
- package/src/common/types/investors-offering.types.ts +0 -65
- package/src/common/types/invite.types.ts +0 -133
- package/src/common/types/issuer-bank-account.types.ts +0 -107
- package/src/common/types/issuer-offering.types.ts +0 -306
- package/src/common/types/issuer-payment-method.types.spec.ts +0 -612
- package/src/common/types/issuer-payment-method.types.ts +0 -341
- package/src/common/types/issuer.types.ts +0 -312
- package/src/common/types/job-item.types.ts +0 -119
- package/src/common/types/jobs.types.ts +0 -171
- package/src/common/types/kyb.types.ts +0 -53
- package/src/common/types/kyc.types.ts +0 -188
- package/src/common/types/legal-entity.types.ts +0 -185
- package/src/common/types/login-history.types.ts +0 -46
- package/src/common/types/mail-template.types.ts +0 -436
- package/src/common/types/north-cap-integration.types.ts +0 -190
- package/src/common/types/note.types.ts +0 -109
- package/src/common/types/notification.types.ts +0 -58
- package/src/common/types/notion-api.types.ts +0 -374
- package/src/common/types/notion-database.types.ts +0 -125
- package/src/common/types/notion-page.types.ts +0 -267
- package/src/common/types/offering-reports.types.ts +0 -153
- package/src/common/types/offering-submission.types.ts +0 -314
- package/src/common/types/offering.types.spec.ts +0 -91
- package/src/common/types/offering.types.ts +0 -590
- package/src/common/types/page-revision.types.ts +0 -86
- package/src/common/types/page.types.ts +0 -436
- package/src/common/types/password.type.ts +0 -15
- package/src/common/types/payment-methods.types.ts +0 -298
- package/src/common/types/phone.spec.ts +0 -76
- package/src/common/types/phone.type.ts +0 -27
- package/src/common/types/portfolio.types.ts +0 -50
- package/src/common/types/privacy-policy-and-tos.types.ts +0 -231
- package/src/common/types/queue.types.ts +0 -112
- package/src/common/types/registered-reps.types.ts +0 -25
- package/src/common/types/rejection-reasons.types.ts +0 -56
- package/src/common/types/reminder-config.types.ts +0 -40
- package/src/common/types/review.types.ts +0 -133
- package/src/common/types/role.types.ts +0 -26
- package/src/common/types/secondary-customer.types.ts +0 -66
- package/src/common/types/secondary-issuer.types.ts +0 -50
- package/src/common/types/secondary-order.types.ts +0 -58
- package/src/common/types/secondary-security.types.ts +0 -60
- package/src/common/types/secondary-trade.entity.ts +0 -16
- package/src/common/types/secondary-trade.types.ts +0 -95
- package/src/common/types/secure-request.types.ts +0 -68
- package/src/common/types/signer.types.ts +0 -651
- package/src/common/types/site-link.types.spec.ts +0 -134
- package/src/common/types/site-link.types.ts +0 -166
- package/src/common/types/site-settings.types.ts +0 -726
- package/src/common/types/site.types.ts +0 -270
- package/src/common/types/sms.types.ts +0 -30
- package/src/common/types/state-machine.types.ts +0 -177
- package/src/common/types/states.types.ts +0 -163
- package/src/common/types/subdoc-preview.types.ts +0 -35
- package/src/common/types/task.types.ts +0 -258
- package/src/common/types/trade-adjustment.type.ts +0 -33
- package/src/common/types/trade-line-item.type.ts +0 -132
- package/src/common/types/trade.types.ts +0 -929
- package/src/common/types/transaction.types.ts +0 -198
- package/src/common/types/trusted-contact.types.ts +0 -122
- package/src/common/types/typography.types.ts +0 -75
- package/src/common/types/user-manual.types.ts +0 -290
- package/src/common/types/user-setting.types.ts +0 -133
- package/src/common/types/user.types.ts +0 -320
- package/src/common/types/webhook.types.ts +0 -588
- package/src/common/types/zip.type.ts +0 -36
- package/src/contracts/clients/accounts/index.ts +0 -61
- package/src/contracts/clients/aic/index.ts +0 -59
- package/src/contracts/clients/api-key-logs/index.ts +0 -53
- package/src/contracts/clients/api-keys/index.ts +0 -73
- package/src/contracts/clients/assets/index.ts +0 -102
- package/src/contracts/clients/auth/index.ts +0 -50
- package/src/contracts/clients/files/index.ts +0 -166
- package/src/contracts/clients/files-public/index.ts +0 -166
- package/src/contracts/clients/index.ts +0 -44
- package/src/contracts/clients/individuals/index.ts +0 -93
- package/src/contracts/clients/investor-accounts/index.ts +0 -93
- package/src/contracts/clients/issuers/index.ts +0 -94
- package/src/contracts/clients/legal-entities/index.ts +0 -93
- package/src/contracts/clients/offerings/index.ts +0 -117
- package/src/contracts/clients/secure-requests/index.ts +0 -34
- package/src/contracts/clients/sites/index.ts +0 -56
- package/src/contracts/clients/trades/index.ts +0 -122
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AppRouter } from '@ts-rest/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Type-safe API contract for Dalmore Client Portal
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { clientsContract } from '@dalmore/api-contracts';
|
|
9
|
+
* import { initClient } from '@ts-rest/core';
|
|
10
|
+
*
|
|
11
|
+
* const client = initClient(clientsContract, {
|
|
12
|
+
* baseUrl: 'https://api.example.com',
|
|
13
|
+
* baseHeaders: { 'x-api-key': 'your-key' },
|
|
14
|
+
* });
|
|
15
|
+
*
|
|
16
|
+
* const accounts = await client.accounts.getAccounts();
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare const clientsContract: AppRouter;
|
package/index.mjs
CHANGED
|
@@ -10967,4 +10967,7 @@ var clientsContract = c17.router(
|
|
|
10967
10967
|
}
|
|
10968
10968
|
);
|
|
10969
10969
|
|
|
10970
|
-
|
|
10970
|
+
// src/contracts/clients/package-entry.ts
|
|
10971
|
+
var clientsContract2 = clientsContract;
|
|
10972
|
+
|
|
10973
|
+
export { clientsContract2 as 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.7",
|
|
4
4
|
"description": "Type-safe API contracts for Dalmore Client Portal",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.mjs",
|
|
7
|
-
"types": "./
|
|
7
|
+
"types": "./dist/contracts/clients/index.d.ts",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
-
"types": "./
|
|
10
|
+
"types": "./dist/contracts/clients/index.d.ts",
|
|
11
11
|
"import": "./index.mjs",
|
|
12
12
|
"default": "./index.mjs"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
16
|
"index.mjs",
|
|
17
|
-
"
|
|
17
|
+
"dist"
|
|
18
18
|
],
|
|
19
19
|
"keywords": [
|
|
20
20
|
"dalmore",
|
|
@@ -1,98 +0,0 @@
|
|
|
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
|
-
>;
|
|
@@ -1,27 +0,0 @@
|
|
|
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>;
|
|
@@ -1,143 +0,0 @@
|
|
|
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
|
-
>;
|
|
@@ -1,124 +0,0 @@
|
|
|
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
|
-
>;
|