@dalmore/api-contracts 1.0.3 → 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 -60
- package/index.d.mts +17 -0
- package/index.d.ts +17 -0
- package/index.mjs +1001 -18638
- package/package.json +7 -54
- package/clients/index.mjs +0 -10970
- package/compliance/index.mjs +0 -20016
- package/compliance-apikey/index.mjs +0 -9795
- package/helpers/index.mjs +0 -146
- package/investors/index.mjs +0 -12844
- package/issuers/index.mjs +0 -16168
- package/secondaries/index.mjs +0 -10282
- package/src/common/helpers/index.ts +0 -205
- 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.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 -150
- 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.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/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.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.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.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 -111
- package/src/common/types/registered-reps.types.ts +0 -25
- package/src/common/types/rejection-reasons.types.ts +0 -56
- 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.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 -931
- 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
- package/src/contracts/compliance/account-contacts/index.ts +0 -82
- package/src/contracts/compliance/account-managers/index.ts +0 -142
- package/src/contracts/compliance/accounts/index.ts +0 -187
- package/src/contracts/compliance/activities/index.ts +0 -55
- package/src/contracts/compliance/aic/index.ts +0 -60
- package/src/contracts/compliance/api-keys/index.ts +0 -91
- package/src/contracts/compliance/assets/index.ts +0 -122
- package/src/contracts/compliance/auth/index.ts +0 -134
- package/src/contracts/compliance/batch-jobs/index.ts +0 -62
- package/src/contracts/compliance/bonus-tiers/index.ts +0 -55
- package/src/contracts/compliance/checklist/index.ts +0 -87
- package/src/contracts/compliance/checklist-items/index.ts +0 -86
- package/src/contracts/compliance/covered-persons/index.ts +0 -97
- package/src/contracts/compliance/dashboard/index.ts +0 -111
- package/src/contracts/compliance/data-records/index.ts +0 -116
- package/src/contracts/compliance/data-rooms/index.ts +0 -113
- package/src/contracts/compliance/default-theme-configs/index.ts +0 -95
- package/src/contracts/compliance/disbursement/index.ts +0 -165
- package/src/contracts/compliance/disbursement-approval-users/index.ts +0 -84
- package/src/contracts/compliance/disbursement-transactions/index.ts +0 -37
- package/src/contracts/compliance/domain-filters/index.ts +0 -117
- package/src/contracts/compliance/email-themes/index.ts +0 -284
- package/src/contracts/compliance/escrow-accounts/index.ts +0 -85
- package/src/contracts/compliance/exchange-api-keys/index.ts +0 -129
- package/src/contracts/compliance/exchange-imports/index.ts +0 -137
- package/src/contracts/compliance/files/index.ts +0 -267
- package/src/contracts/compliance/files-public/index.ts +0 -188
- package/src/contracts/compliance/health/index.ts +0 -26
- package/src/contracts/compliance/index.ts +0 -147
- package/src/contracts/compliance/individuals/index.ts +0 -57
- package/src/contracts/compliance/investor-accounts/index.ts +0 -141
- package/src/contracts/compliance/invites/index.ts +0 -137
- package/src/contracts/compliance/issuer-bank-accounts/index.ts +0 -81
- package/src/contracts/compliance/issuer-payment-methods/index.ts +0 -81
- package/src/contracts/compliance/issuers/index.ts +0 -97
- package/src/contracts/compliance/job-items/index.ts +0 -58
- package/src/contracts/compliance/jobs/index.ts +0 -59
- package/src/contracts/compliance/kyb/index.ts +0 -54
- package/src/contracts/compliance/kyc/index.ts +0 -77
- package/src/contracts/compliance/legal-entities/index.ts +0 -57
- package/src/contracts/compliance/login-histories/index.ts +0 -37
- package/src/contracts/compliance/notes/index.ts +0 -69
- package/src/contracts/compliance/notion-databases/index.ts +0 -107
- package/src/contracts/compliance/notion-pages/index.ts +0 -105
- package/src/contracts/compliance/offering-reports/index.ts +0 -149
- package/src/contracts/compliance/offerings/index.ts +0 -233
- package/src/contracts/compliance/pages/index.ts +0 -178
- package/src/contracts/compliance/payment-methods/index.ts +0 -57
- package/src/contracts/compliance/rejection-reasons/index.ts +0 -32
- package/src/contracts/compliance/review/index.ts +0 -169
- package/src/contracts/compliance/roles/index.ts +0 -34
- package/src/contracts/compliance/secondary-customers/index.ts +0 -77
- package/src/contracts/compliance/secondary-orders/index.ts +0 -60
- package/src/contracts/compliance/secondary-trades/index.ts +0 -100
- package/src/contracts/compliance/secure-requests/index.ts +0 -54
- package/src/contracts/compliance/signer/index.ts +0 -369
- package/src/contracts/compliance/site-links/index.ts +0 -128
- package/src/contracts/compliance/site-settings/index.ts +0 -669
- package/src/contracts/compliance/sites/index.ts +0 -56
- package/src/contracts/compliance/state-machine/index.ts +0 -94
- package/src/contracts/compliance/tasks/index.ts +0 -91
- package/src/contracts/compliance/third-parties/index.ts +0 -52
- package/src/contracts/compliance/trade-line-items/index.ts +0 -59
- package/src/contracts/compliance/trades/index.ts +0 -230
- package/src/contracts/compliance/transactions/index.ts +0 -161
- package/src/contracts/compliance/user-manuals/index.ts +0 -271
- package/src/contracts/compliance/user-settings/index.ts +0 -189
- package/src/contracts/compliance/users/index.ts +0 -200
- package/src/contracts/compliance/webhooks/index.ts +0 -41
- package/src/contracts/compliance-apikey/accounts/index.ts +0 -58
- package/src/contracts/compliance-apikey/index.ts +0 -14
- package/src/contracts/index.ts +0 -6
- package/src/contracts/investors/account-contacts/index.ts +0 -58
- package/src/contracts/investors/aic/index.ts +0 -59
- package/src/contracts/investors/assets/index.ts +0 -61
- package/src/contracts/investors/auth/index.ts +0 -116
- package/src/contracts/investors/bonus-tiers/index.ts +0 -37
- package/src/contracts/investors/cart/index.ts +0 -75
- package/src/contracts/investors/contact-us/index.ts +0 -48
- package/src/contracts/investors/data-records/index.ts +0 -113
- package/src/contracts/investors/data-rooms/index.ts +0 -96
- package/src/contracts/investors/files/index.ts +0 -167
- package/src/contracts/investors/files-public/index.ts +0 -185
- package/src/contracts/investors/index.ts +0 -72
- package/src/contracts/investors/individuals/index.ts +0 -99
- package/src/contracts/investors/investor-accounts/index.ts +0 -110
- package/src/contracts/investors/issuer-payment-methods/index.ts +0 -36
- package/src/contracts/investors/issuers/index.ts +0 -30
- package/src/contracts/investors/legal-entities/index.ts +0 -93
- package/src/contracts/investors/notes/index.ts +0 -69
- package/src/contracts/investors/offerings/index.ts +0 -93
- package/src/contracts/investors/pages/index.ts +0 -88
- package/src/contracts/investors/payment-methods/index.ts +0 -149
- package/src/contracts/investors/portfolios/index.ts +0 -53
- package/src/contracts/investors/sites/index.ts +0 -96
- package/src/contracts/investors/tasks/index.ts +0 -111
- package/src/contracts/investors/trade-line-items/index.ts +0 -75
- package/src/contracts/investors/trades/index.ts +0 -114
- package/src/contracts/investors/transactions/index.ts +0 -37
- package/src/contracts/investors/trusted-contacts/index.ts +0 -93
- package/src/contracts/investors/user-manuals/index.ts +0 -62
- package/src/contracts/investors/user-settings/index.ts +0 -170
- package/src/contracts/investors/users/index.ts +0 -45
- package/src/contracts/investors/webhooks/index.ts +0 -30
- package/src/contracts/issuers/account-contacts/index.ts +0 -76
- package/src/contracts/issuers/account-integrations/index.ts +0 -97
- package/src/contracts/issuers/accounts/index.ts +0 -97
- package/src/contracts/issuers/activities/index.ts +0 -54
- package/src/contracts/issuers/aic/index.ts +0 -39
- package/src/contracts/issuers/api-key-logs/index.ts +0 -53
- package/src/contracts/issuers/api-keys/index.ts +0 -93
- package/src/contracts/issuers/assets/index.ts +0 -122
- package/src/contracts/issuers/auth/index.ts +0 -152
- package/src/contracts/issuers/bonus-tiers/index.ts +0 -55
- package/src/contracts/issuers/contact-us/index.ts +0 -48
- package/src/contracts/issuers/covered-persons/index.ts +0 -136
- package/src/contracts/issuers/dashboard/index.ts +0 -72
- package/src/contracts/issuers/data-records/index.ts +0 -257
- package/src/contracts/issuers/data-rooms/index.ts +0 -134
- package/src/contracts/issuers/disbursement-approval-users/index.ts +0 -82
- package/src/contracts/issuers/disbursement-transactions/index.ts +0 -53
- package/src/contracts/issuers/disbursements/index.ts +0 -153
- package/src/contracts/issuers/email-themes/index.ts +0 -242
- package/src/contracts/issuers/escrow-accounts/index.ts +0 -81
- package/src/contracts/issuers/exchange-api-keys/index.ts +0 -144
- package/src/contracts/issuers/files/index.ts +0 -166
- package/src/contracts/issuers/files-public/index.ts +0 -166
- package/src/contracts/issuers/health/index.ts +0 -24
- package/src/contracts/issuers/index.ts +0 -112
- package/src/contracts/issuers/investor-accounts/index.ts +0 -148
- package/src/contracts/issuers/invites/index.ts +0 -129
- package/src/contracts/issuers/issuer/index.ts +0 -94
- package/src/contracts/issuers/issuer-bank-accounts/index.ts +0 -81
- package/src/contracts/issuers/issuer-payment-methods/index.ts +0 -136
- package/src/contracts/issuers/kyc/index.ts +0 -38
- package/src/contracts/issuers/login-histories/index.ts +0 -51
- package/src/contracts/issuers/notes/index.ts +0 -69
- package/src/contracts/issuers/offerings/index.ts +0 -206
- package/src/contracts/issuers/pages/index.ts +0 -138
- package/src/contracts/issuers/payment-methods/index.ts +0 -61
- package/src/contracts/issuers/portfolios/index.ts +0 -36
- package/src/contracts/issuers/rejection-reasons/index.ts +0 -32
- package/src/contracts/issuers/review/index.ts +0 -63
- package/src/contracts/issuers/secondary-customers/index.ts +0 -55
- package/src/contracts/issuers/secondary-orders/index.ts +0 -57
- package/src/contracts/issuers/secondary-trades/index.ts +0 -57
- package/src/contracts/issuers/secure-requests/index.ts +0 -34
- package/src/contracts/issuers/site-links/index.ts +0 -116
- package/src/contracts/issuers/site-settings/index.ts +0 -585
- package/src/contracts/issuers/sites/index.ts +0 -32
- package/src/contracts/issuers/tasks/index.ts +0 -111
- package/src/contracts/issuers/trades/index.ts +0 -132
- package/src/contracts/issuers/transactions/index.ts +0 -158
- package/src/contracts/issuers/user-manuals/index.ts +0 -62
- package/src/contracts/issuers/user-settings/index.ts +0 -170
- package/src/contracts/issuers/users/index.ts +0 -126
- package/src/contracts/secondaries/accounts/index.ts +0 -58
- package/src/contracts/secondaries/index.ts +0 -23
- package/src/contracts/secondaries/secondary-customers/index.ts +0 -55
- package/src/contracts/secondaries/secondary-issuers/index.ts +0 -94
- package/src/contracts/secondaries/secondary-orders/index.ts +0 -56
- package/src/contracts/secondaries/secondary-securities/index.ts +0 -95
- package/src/contracts/secondaries/secondary-trades/index.ts +0 -56
- package/types/index.mjs +0 -10320
|
@@ -1,296 +0,0 @@
|
|
|
1
|
-
import { extendZodWithOpenApi } from '@anatine/zod-openapi';
|
|
2
|
-
import { TypeID } from 'typeid-js';
|
|
3
|
-
import { z } from 'zod';
|
|
4
|
-
import {
|
|
5
|
-
AccountZod,
|
|
6
|
-
dateSchema,
|
|
7
|
-
IPaginationMeta,
|
|
8
|
-
IssuerOnboardingSetupType,
|
|
9
|
-
ManagedByType,
|
|
10
|
-
Platform,
|
|
11
|
-
SortBy,
|
|
12
|
-
SortOrder,
|
|
13
|
-
AccountStatus,
|
|
14
|
-
} from './common.types';
|
|
15
|
-
import { notionPageIdSchema } from './notion-page.types';
|
|
16
|
-
|
|
17
|
-
extendZodWithOpenApi(z);
|
|
18
|
-
|
|
19
|
-
export const accountIdSchema = z.string().refine(
|
|
20
|
-
(value) => {
|
|
21
|
-
try {
|
|
22
|
-
const tid = TypeID.fromString(value);
|
|
23
|
-
return tid.getType() === 'account';
|
|
24
|
-
} catch {
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
message:
|
|
30
|
-
'Invalid account ID format. Must be a valid TypeID with "account" prefix.',
|
|
31
|
-
},
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
export const UpdateAccountZod = z.object({
|
|
35
|
-
name: z.string().min(1).max(100),
|
|
36
|
-
status: z.nativeEnum(AccountStatus).optional(),
|
|
37
|
-
platform: z
|
|
38
|
-
.nativeEnum(Platform)
|
|
39
|
-
.optional()
|
|
40
|
-
.openapi({ example: Platform.INTEGRATION }),
|
|
41
|
-
managedBy: z
|
|
42
|
-
.nativeEnum(ManagedByType)
|
|
43
|
-
.optional()
|
|
44
|
-
.openapi({ example: ManagedByType.DALMORE }),
|
|
45
|
-
approversCount: z.number().min(1).max(5).optional(),
|
|
46
|
-
});
|
|
47
|
-
export type UpdateAccountZod = z.infer<typeof UpdateAccountZod>;
|
|
48
|
-
|
|
49
|
-
export const CreateAccountZod = z.object({
|
|
50
|
-
name: z.string().min(1).max(100).openapi({ example: 'Name' }),
|
|
51
|
-
platform: z
|
|
52
|
-
.nativeEnum(Platform)
|
|
53
|
-
.optional()
|
|
54
|
-
.openapi({ example: Platform.INTEGRATION }),
|
|
55
|
-
managedBy: z
|
|
56
|
-
.nativeEnum(ManagedByType)
|
|
57
|
-
.optional()
|
|
58
|
-
.openapi({ example: ManagedByType.DALMORE }),
|
|
59
|
-
approversCount: z.number().min(1).max(5).optional().openapi({ example: 2 }),
|
|
60
|
-
hubspotCompany: z
|
|
61
|
-
.string()
|
|
62
|
-
.url()
|
|
63
|
-
.max(2048)
|
|
64
|
-
.nullable()
|
|
65
|
-
.optional()
|
|
66
|
-
.openapi({ example: 'https://www.google.com' }),
|
|
67
|
-
});
|
|
68
|
-
export type CreateAccountZod = z.infer<typeof CreateAccountZod>;
|
|
69
|
-
|
|
70
|
-
export const IPaginatedAccount = z.object({
|
|
71
|
-
items: z.array(AccountZod),
|
|
72
|
-
meta: IPaginationMeta,
|
|
73
|
-
});
|
|
74
|
-
export type IPaginatedAccount = z.infer<typeof IPaginatedAccount>;
|
|
75
|
-
|
|
76
|
-
export const AccountFiltersZod = z.object({
|
|
77
|
-
search: z.string().max(50).optional(),
|
|
78
|
-
status: z.nativeEnum(AccountStatus).optional(),
|
|
79
|
-
platform: z
|
|
80
|
-
.nativeEnum(Platform)
|
|
81
|
-
.optional()
|
|
82
|
-
.openapi({ example: Platform.INTEGRATION }),
|
|
83
|
-
managedBy: z
|
|
84
|
-
.nativeEnum(ManagedByType)
|
|
85
|
-
.optional()
|
|
86
|
-
.openapi({ example: ManagedByType.DALMORE }),
|
|
87
|
-
from: dateSchema.optional().openapi({ example: 'MM/DD/YYYY' }),
|
|
88
|
-
to: dateSchema.optional().openapi({ example: 'MM/DD/YYYY' }),
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
const accountsInclude = z.enum([
|
|
92
|
-
'accountManager',
|
|
93
|
-
'accountIntegrations',
|
|
94
|
-
'apiKeys',
|
|
95
|
-
'assets',
|
|
96
|
-
'dataRooms',
|
|
97
|
-
'individuals',
|
|
98
|
-
'investorAccounts',
|
|
99
|
-
'invites',
|
|
100
|
-
'issuers',
|
|
101
|
-
'legalEntities',
|
|
102
|
-
'offerings',
|
|
103
|
-
'sites',
|
|
104
|
-
'trades',
|
|
105
|
-
'users',
|
|
106
|
-
]);
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* @description Query parameters for including related entities
|
|
110
|
-
* @xample in contract us as -> query: z.object({}).merge(AccountsIncludeQuery),
|
|
111
|
-
*/
|
|
112
|
-
export const AccountsIncludeQuery = z.object({
|
|
113
|
-
include: z
|
|
114
|
-
.string()
|
|
115
|
-
.optional()
|
|
116
|
-
.transform((str) => (str ? str.split(',') : []))
|
|
117
|
-
.refine(
|
|
118
|
-
(includes) =>
|
|
119
|
-
includes.every((include) =>
|
|
120
|
-
accountsInclude.options.includes(include as any),
|
|
121
|
-
),
|
|
122
|
-
{
|
|
123
|
-
message: `Invalid include option provided. Valid options are: ${accountsInclude.options.join(',')}`,
|
|
124
|
-
},
|
|
125
|
-
)
|
|
126
|
-
.openapi({
|
|
127
|
-
example: `${accountsInclude.options.join(',')}`,
|
|
128
|
-
}),
|
|
129
|
-
});
|
|
130
|
-
export interface AccountsIncludeQuery
|
|
131
|
-
extends z.infer<typeof AccountsIncludeQuery> {}
|
|
132
|
-
|
|
133
|
-
export const PatchAccountZod = z.object({
|
|
134
|
-
name: z.string().min(1).max(100),
|
|
135
|
-
approversCount: z.number().min(1).max(5).optional(),
|
|
136
|
-
managedBy: z.nativeEnum(ManagedByType).optional(),
|
|
137
|
-
platform: z.nativeEnum(Platform).optional(),
|
|
138
|
-
integrationGuideId: notionPageIdSchema.nullable().optional(),
|
|
139
|
-
productPrimaries: z.boolean().optional(),
|
|
140
|
-
productSecondaries: z.boolean().optional(),
|
|
141
|
-
featureDisbursements: z.boolean().optional(),
|
|
142
|
-
});
|
|
143
|
-
export type PatchAccountZod = z.infer<typeof PatchAccountZod>;
|
|
144
|
-
|
|
145
|
-
export const CompliancePatchAccountZod = PatchAccountZod.extend({
|
|
146
|
-
hubspotCompany: z
|
|
147
|
-
.string()
|
|
148
|
-
.url()
|
|
149
|
-
.max(2048)
|
|
150
|
-
.nullable()
|
|
151
|
-
.optional()
|
|
152
|
-
.openapi({ example: 'https://www.google.com' }),
|
|
153
|
-
});
|
|
154
|
-
export type CompliancePatchAccountZod = z.infer<
|
|
155
|
-
typeof CompliancePatchAccountZod
|
|
156
|
-
>;
|
|
157
|
-
|
|
158
|
-
export const PostAccountResponse = z.object({
|
|
159
|
-
id: z.string(),
|
|
160
|
-
});
|
|
161
|
-
export type PostAccountResponse = z.infer<typeof PostAccountResponse>;
|
|
162
|
-
|
|
163
|
-
export const GetAccountIssuersZod = z.object({
|
|
164
|
-
name: z.string().optional(),
|
|
165
|
-
accountId: accountIdSchema.optional(),
|
|
166
|
-
});
|
|
167
|
-
export type GetAccountIssuersZod = z.infer<typeof GetAccountIssuersZod>;
|
|
168
|
-
|
|
169
|
-
export const UpdateAccountIssuersStatusZod = z.object({
|
|
170
|
-
status: z.nativeEnum(AccountStatus),
|
|
171
|
-
});
|
|
172
|
-
export type UpdateAccountIssuersStatusZod = z.infer<
|
|
173
|
-
typeof UpdateAccountIssuersStatusZod
|
|
174
|
-
>;
|
|
175
|
-
|
|
176
|
-
export const UpdateAccountStatusReponse = z.object({
|
|
177
|
-
id: accountIdSchema,
|
|
178
|
-
status: z.nativeEnum(AccountStatus),
|
|
179
|
-
});
|
|
180
|
-
export type UpdateAccountStatusReponse = z.infer<
|
|
181
|
-
typeof UpdateAccountStatusReponse
|
|
182
|
-
>;
|
|
183
|
-
|
|
184
|
-
export const AccountsSummaryFilterZod = z.object({
|
|
185
|
-
search: z.string().trim().max(50).optional(),
|
|
186
|
-
status: z.nativeEnum(AccountStatus).optional(),
|
|
187
|
-
from: dateSchema.optional().openapi({ example: 'MM/DD/YYYY' }),
|
|
188
|
-
to: dateSchema.optional().openapi({ example: 'MM/DD/YYYY' }),
|
|
189
|
-
accountManagerIds: z
|
|
190
|
-
.string()
|
|
191
|
-
.optional()
|
|
192
|
-
.transform((val) => {
|
|
193
|
-
if (!val || typeof val !== 'string') return undefined;
|
|
194
|
-
|
|
195
|
-
const ids = val
|
|
196
|
-
.split(',')
|
|
197
|
-
.map((id: string) => id.trim())
|
|
198
|
-
.filter((id: string) => id.length > 0);
|
|
199
|
-
|
|
200
|
-
// Remove duplicates using Set
|
|
201
|
-
const uniqueIds = [...new Set(ids)];
|
|
202
|
-
|
|
203
|
-
return uniqueIds.length > 0 ? uniqueIds : undefined;
|
|
204
|
-
})
|
|
205
|
-
.pipe(
|
|
206
|
-
z
|
|
207
|
-
.array(
|
|
208
|
-
z.string().refine(
|
|
209
|
-
(value) => {
|
|
210
|
-
try {
|
|
211
|
-
const tid = TypeID.fromString(value);
|
|
212
|
-
return tid.getType() === 'account_manager';
|
|
213
|
-
} catch {
|
|
214
|
-
return false;
|
|
215
|
-
}
|
|
216
|
-
},
|
|
217
|
-
{
|
|
218
|
-
message: `Invalid account manager ID format. Must be a valid TypeID with "account_manager" prefix. Example: account_manager_01j5y5ghx5fg68d663j1fvy2x7`,
|
|
219
|
-
},
|
|
220
|
-
),
|
|
221
|
-
)
|
|
222
|
-
.optional(),
|
|
223
|
-
),
|
|
224
|
-
});
|
|
225
|
-
export type AccountsSummaryFilterZod = z.infer<typeof AccountsSummaryFilterZod>;
|
|
226
|
-
|
|
227
|
-
export const AccountSortZod = z.object({
|
|
228
|
-
sort: z.enum([SortBy.NAME, SortBy.CREATED_AT, SortBy.UPDATED_AT]).optional(),
|
|
229
|
-
dir: z.nativeEnum(SortOrder).optional(),
|
|
230
|
-
});
|
|
231
|
-
export type AccountSortZod = z.infer<typeof AccountSortZod>;
|
|
232
|
-
|
|
233
|
-
export const AccountsSummaryZod = z.object({
|
|
234
|
-
accountId: accountIdSchema,
|
|
235
|
-
accountName: z.string(),
|
|
236
|
-
issuers: z.number().int(),
|
|
237
|
-
offerings: z.number().int(),
|
|
238
|
-
assets: z.number().int(),
|
|
239
|
-
users: z.number().int(),
|
|
240
|
-
trades: z.number().int(),
|
|
241
|
-
accountManagerName: z.string(),
|
|
242
|
-
createdOn: z.string(),
|
|
243
|
-
status: z.string(),
|
|
244
|
-
});
|
|
245
|
-
export type AccountsSummaryZod = z.infer<typeof AccountsSummaryZod>;
|
|
246
|
-
|
|
247
|
-
export const IPaginatedAccountsSummaryResponse = z.object({
|
|
248
|
-
items: z.array(AccountsSummaryZod),
|
|
249
|
-
meta: IPaginationMeta,
|
|
250
|
-
});
|
|
251
|
-
export type IPaginatedAccountsSummaryResponse = z.infer<
|
|
252
|
-
typeof IPaginatedAccountsSummaryResponse
|
|
253
|
-
>;
|
|
254
|
-
export const PatchIssuerOnboardingStep = z.object({
|
|
255
|
-
step: z.nativeEnum(IssuerOnboardingSetupType),
|
|
256
|
-
});
|
|
257
|
-
export type PatchIssuerOnboardingStep = z.infer<
|
|
258
|
-
typeof PatchIssuerOnboardingStep
|
|
259
|
-
>;
|
|
260
|
-
|
|
261
|
-
export const IssuerOnboardingStepZod = z.object({
|
|
262
|
-
offeringSetup: z.boolean().default(false),
|
|
263
|
-
investorPortalSetup: z.boolean().default(false),
|
|
264
|
-
paymentMethodSetup: z.boolean().default(false),
|
|
265
|
-
accountContactsSetup: z.boolean().default(false),
|
|
266
|
-
});
|
|
267
|
-
export type IssuerOnboardingStepZod = z.infer<typeof IssuerOnboardingStepZod>;
|
|
268
|
-
|
|
269
|
-
export const OnboardingAccountSummaryZod = z.object({
|
|
270
|
-
accountId: accountIdSchema,
|
|
271
|
-
accountName: z.string(),
|
|
272
|
-
siteId: z.string().nullable(),
|
|
273
|
-
offeringId: z.string().nullable(),
|
|
274
|
-
investorPortalSetup: z.boolean(),
|
|
275
|
-
offeringSetup: z.boolean(),
|
|
276
|
-
paymentMethodSetup: z.boolean(),
|
|
277
|
-
accountContactsSetup: z.boolean(),
|
|
278
|
-
});
|
|
279
|
-
export type OnboardingAccountSummaryZod = z.infer<
|
|
280
|
-
typeof OnboardingAccountSummaryZod
|
|
281
|
-
>;
|
|
282
|
-
|
|
283
|
-
export const IPaginatedOnboardingAccountSummaryResponse = z.object({
|
|
284
|
-
items: z.array(OnboardingAccountSummaryZod),
|
|
285
|
-
meta: IPaginationMeta,
|
|
286
|
-
});
|
|
287
|
-
export type IPaginatedOnboardingAccountSummaryResponse = z.infer<
|
|
288
|
-
typeof IPaginatedOnboardingAccountSummaryResponse
|
|
289
|
-
>;
|
|
290
|
-
|
|
291
|
-
export const OnboardingAccountSummaryFilterZod = z.object({
|
|
292
|
-
status: z.nativeEnum(AccountStatus).optional(),
|
|
293
|
-
});
|
|
294
|
-
export type OnboardingAccountSummaryFilterZod = z.infer<
|
|
295
|
-
typeof OnboardingAccountSummaryFilterZod
|
|
296
|
-
>;
|
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import {
|
|
3
|
-
BaseAction,
|
|
4
|
-
BaseStatus,
|
|
5
|
-
IPaginationMeta,
|
|
6
|
-
PortalType,
|
|
7
|
-
TargetTableConfig,
|
|
8
|
-
TargetTableEnum,
|
|
9
|
-
} from './common.types';
|
|
10
|
-
import { TypeID } from 'typeid-js';
|
|
11
|
-
import { IBaseEntity } from './entity.types';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* WARNING!!!
|
|
15
|
-
* ANY CHANGES TO:
|
|
16
|
-
* - ActivityTypeCategory
|
|
17
|
-
* - ActivityTypeResource
|
|
18
|
-
* - ActivityTypeAction
|
|
19
|
-
* Will require a migration to add the new combinations to the database. See activity-type.entity.ts
|
|
20
|
-
* Also, previous migrations will have to be updated to prevent the new combination from being seeded before the new migration introduces it.
|
|
21
|
-
* see: SeedActivityActionTable1733789494520
|
|
22
|
-
* This is required only for backwards compatibility when developing locally and e2e tests.
|
|
23
|
-
*/
|
|
24
|
-
export enum ActivityTypeCategory {
|
|
25
|
-
CLIENT = PortalType.CLIENT,
|
|
26
|
-
INVESTOR = PortalType.INVESTOR,
|
|
27
|
-
COMPLIANCE = PortalType.COMPLIANCE,
|
|
28
|
-
ISSUER = PortalType.ISSUER,
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export const CategoryMap: { [key: string]: ActivityTypeCategory } = {
|
|
32
|
-
compliance: ActivityTypeCategory.COMPLIANCE,
|
|
33
|
-
issuers: ActivityTypeCategory.ISSUER,
|
|
34
|
-
clients: ActivityTypeCategory.CLIENT,
|
|
35
|
-
investors: ActivityTypeCategory.INVESTOR,
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export enum ActivityTypeResource {
|
|
39
|
-
KYCS = 'KYCS',
|
|
40
|
-
KYBS = 'KYBS',
|
|
41
|
-
INDIVIDUALS = 'INDIVIDUALS',
|
|
42
|
-
LEGAL_ENTITIES = 'LEGAL_ENTITIES',
|
|
43
|
-
INVESTOR_ACCOUNTS = 'INVESTOR_ACCOUNTS',
|
|
44
|
-
TRADES = 'TRADES',
|
|
45
|
-
OFFERINGS = 'OFFERINGS',
|
|
46
|
-
ISSUERS = 'ISSUERS',
|
|
47
|
-
COVERED_PERSONS = 'COVERED_PERSONS',
|
|
48
|
-
PAYMENT_METHODS = 'PAYMENT_METHODS',
|
|
49
|
-
NOTES = 'NOTES',
|
|
50
|
-
USERS = 'USERS',
|
|
51
|
-
ACCOUNTS = 'ACCOUNTS',
|
|
52
|
-
FILES = 'FILES',
|
|
53
|
-
PAGES = 'PAGES',
|
|
54
|
-
AMLS = 'AMLS',
|
|
55
|
-
DISBURSEMENTS = 'DISBURSEMENTS',
|
|
56
|
-
DISBURSEMENT_REVIEWS = 'DISBURSEMENT_REVIEWS',
|
|
57
|
-
TRADE_LINE_ITEMS = 'TRADE_LINE_ITEMS',
|
|
58
|
-
TRANSACTIONS = 'TRANSACTIONS',
|
|
59
|
-
AICS = 'AICS',
|
|
60
|
-
SITES = 'SITES',
|
|
61
|
-
THEMES = 'THEMES',
|
|
62
|
-
THEME_SETTINGS = 'THEME_SETTINGS',
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export const ResourceMap: { [key: string]: ActivityTypeResource } = {
|
|
66
|
-
trades: ActivityTypeResource.TRADES,
|
|
67
|
-
'trade-line-items': ActivityTypeResource.TRADE_LINE_ITEMS,
|
|
68
|
-
transactions: ActivityTypeResource.TRANSACTIONS,
|
|
69
|
-
users: ActivityTypeResource.USERS,
|
|
70
|
-
offerings: ActivityTypeResource.OFFERINGS,
|
|
71
|
-
'investor-accounts': ActivityTypeResource.INVESTOR_ACCOUNTS,
|
|
72
|
-
individuals: ActivityTypeResource.INDIVIDUALS,
|
|
73
|
-
'payment-methods': ActivityTypeResource.PAYMENT_METHODS,
|
|
74
|
-
notes: ActivityTypeResource.NOTES,
|
|
75
|
-
issuers: ActivityTypeResource.ISSUERS,
|
|
76
|
-
'covered-persons': ActivityTypeResource.COVERED_PERSONS,
|
|
77
|
-
kyc: ActivityTypeResource.KYCS,
|
|
78
|
-
aml: ActivityTypeResource.AMLS,
|
|
79
|
-
aic: ActivityTypeResource.AICS,
|
|
80
|
-
kyb: ActivityTypeResource.KYBS,
|
|
81
|
-
'legal-entities': ActivityTypeResource.LEGAL_ENTITIES,
|
|
82
|
-
accounts: ActivityTypeResource.ACCOUNTS,
|
|
83
|
-
files: ActivityTypeResource.FILES,
|
|
84
|
-
'files-public': ActivityTypeResource.FILES,
|
|
85
|
-
pages: ActivityTypeResource.PAGES,
|
|
86
|
-
disbursements: ActivityTypeResource.DISBURSEMENTS,
|
|
87
|
-
'disbursement-reviews': ActivityTypeResource.DISBURSEMENT_REVIEWS,
|
|
88
|
-
sites: ActivityTypeResource.SITES,
|
|
89
|
-
themes: ActivityTypeResource.THEMES,
|
|
90
|
-
'theme-settings': ActivityTypeResource.THEME_SETTINGS,
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* WARNING!!!
|
|
95
|
-
* ANY CHANGES TO:
|
|
96
|
-
* - ActivityTypeAction
|
|
97
|
-
* Will require a migration to add the new combinations to the database. See activity-type.entity.ts
|
|
98
|
-
* Also, previous migrations will have to be updated to prevent the new combination from being seeded before the new migration introduces it.
|
|
99
|
-
* see:
|
|
100
|
-
* SeedActivityActionTable1733789494520
|
|
101
|
-
* SeedActivityResourceTableFiles1735884938590
|
|
102
|
-
* SeedAmlPagesInActivityTypes1740995815856
|
|
103
|
-
* SeedActivityResourceTypeDisbursement1742689286845
|
|
104
|
-
* SeedActivityResourceTradeLineItem1746449328700
|
|
105
|
-
* SeedActivityReset2faAction1746791323564
|
|
106
|
-
* SeedActivityResourceUserCombinations1747289941817
|
|
107
|
-
* AddedResubmitActivityType1747999619404
|
|
108
|
-
* AddedDeclinedAndSignedActivityAction1748011929459
|
|
109
|
-
* SeedActivityResourceTypeDisbursementReview1753945998383
|
|
110
|
-
* SeedActivityResourceTypeTransaction1754457409040
|
|
111
|
-
* AddedAicTargetTable1756265520122
|
|
112
|
-
* AddedReporcessActivityTypeAction1758023244400
|
|
113
|
-
* AddedActivityActionSave1761715000038
|
|
114
|
-
* AddedAcceptedActivityAction1762848949484
|
|
115
|
-
*/
|
|
116
|
-
export enum ActivityTypeAction {
|
|
117
|
-
CREATE = BaseAction.CREATE,
|
|
118
|
-
UPDATE = BaseAction.UPDATE,
|
|
119
|
-
DELETE = BaseAction.DELETE,
|
|
120
|
-
IMPORT = BaseAction.IMPORT,
|
|
121
|
-
APPROVED = BaseStatus.APPROVED,
|
|
122
|
-
REJECTED = BaseStatus.REJECTED,
|
|
123
|
-
SUBMITTED = BaseStatus.SUBMITTED,
|
|
124
|
-
DECLINED = BaseStatus.DECLINED,
|
|
125
|
-
SIGNED = BaseStatus.SIGNED,
|
|
126
|
-
COMPLETED = BaseStatus.COMPLETED,
|
|
127
|
-
RE_SIGN = BaseStatus.RE_SIGN,
|
|
128
|
-
RESUBMIT = BaseStatus.RESUBMIT,
|
|
129
|
-
RESET_2FA = BaseStatus.RESET_2FA,
|
|
130
|
-
LOGIN = BaseStatus.LOGIN,
|
|
131
|
-
RESET_PASSWORD = BaseStatus.RESET_PASSWORD,
|
|
132
|
-
TWO_FACTOR_LOGIN = BaseStatus.TWO_FACTOR_LOGIN,
|
|
133
|
-
FORGOT_PASSWORD = BaseStatus.FORGOT_PASSWORD,
|
|
134
|
-
RE_PROCESS = BaseStatus.RE_PROCESS,
|
|
135
|
-
SAVE = BaseStatus.SAVE,
|
|
136
|
-
ACCEPTED = BaseStatus.ACCEPTED,
|
|
137
|
-
JOIN = BaseStatus.JOIN,
|
|
138
|
-
RESTORE = BaseStatus.RESTORE,
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
export const MethodMap: { [key: string]: ActivityTypeAction } = {
|
|
142
|
-
POST: ActivityTypeAction.CREATE,
|
|
143
|
-
PUT: ActivityTypeAction.UPDATE,
|
|
144
|
-
PATCH: ActivityTypeAction.UPDATE,
|
|
145
|
-
DELETE: ActivityTypeAction.DELETE,
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
export const activityIdSchema = z.string().refine(
|
|
149
|
-
(value) => {
|
|
150
|
-
try {
|
|
151
|
-
const tid = TypeID.fromString(value);
|
|
152
|
-
return tid.getType() === 'activity';
|
|
153
|
-
} catch {
|
|
154
|
-
return false;
|
|
155
|
-
}
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
message:
|
|
159
|
-
'Invalid activity ID format. Must be a valid TypeID with "activity" prefix. Example: activity_01j5y5ghx8fvc83dmx3pznq7hv',
|
|
160
|
-
},
|
|
161
|
-
);
|
|
162
|
-
|
|
163
|
-
export const UserLoginForActivityZod = z.object({
|
|
164
|
-
id: z.string().openapi({
|
|
165
|
-
example: 'user_login_01jepymte1feb8a4j46gy6850k',
|
|
166
|
-
}),
|
|
167
|
-
firstName: z.string().openapi({
|
|
168
|
-
example: 'Daniel',
|
|
169
|
-
}),
|
|
170
|
-
lastName: z.string().openapi({
|
|
171
|
-
example: 'Ice',
|
|
172
|
-
}),
|
|
173
|
-
email: z.string().email().openapi({
|
|
174
|
-
example: 'dice@dalmoregroup.com',
|
|
175
|
-
}),
|
|
176
|
-
__entity: z.string().optional(),
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
const UserForActivityZod = z.object({
|
|
180
|
-
id: z.string(),
|
|
181
|
-
roleId: z.string().nullable(),
|
|
182
|
-
accountId: z.string().nullable(),
|
|
183
|
-
userLogin: UserLoginForActivityZod,
|
|
184
|
-
__entity: z.string().optional(),
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
const ActivityTypeZod = IBaseEntity.extend({
|
|
188
|
-
category: z.nativeEnum(ActivityTypeCategory),
|
|
189
|
-
resource: z.enum(TargetTableEnum),
|
|
190
|
-
action: z.nativeEnum(ActivityTypeAction),
|
|
191
|
-
__entity: z.string().optional(),
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
export const ActivityZod = IBaseEntity.extend({
|
|
195
|
-
id: activityIdSchema,
|
|
196
|
-
message: z.string(),
|
|
197
|
-
targetTable: z.enum(TargetTableEnum),
|
|
198
|
-
targetId: z.string(),
|
|
199
|
-
userId: z.string().nullable(),
|
|
200
|
-
activityTypeId: z.string(),
|
|
201
|
-
accountId: z.string().nullable(),
|
|
202
|
-
user: UserForActivityZod,
|
|
203
|
-
activityType: ActivityTypeZod,
|
|
204
|
-
targetObject: z.string().nullable().optional(),
|
|
205
|
-
__entity: z.string().optional(),
|
|
206
|
-
});
|
|
207
|
-
export type ActivityZod = z.infer<typeof ActivityZod>;
|
|
208
|
-
|
|
209
|
-
export const IPaginatedActivity = z.object({
|
|
210
|
-
items: z.array(ActivityZod),
|
|
211
|
-
meta: IPaginationMeta,
|
|
212
|
-
});
|
|
213
|
-
export type IPaginatedActivity = z.infer<typeof IPaginatedActivity>;
|
|
214
|
-
|
|
215
|
-
export const ActivitiesFilters = z.object({
|
|
216
|
-
targetTable: z.enum(TargetTableEnum).optional(),
|
|
217
|
-
targetId: z
|
|
218
|
-
.string()
|
|
219
|
-
.optional()
|
|
220
|
-
.openapi({
|
|
221
|
-
example: 'disbursement_01j6aqmtfyfwy9spjdcnh7yqk7',
|
|
222
|
-
})
|
|
223
|
-
.refine(
|
|
224
|
-
(value) => {
|
|
225
|
-
try {
|
|
226
|
-
if (!value) return true;
|
|
227
|
-
const tid = TypeID.fromString(value);
|
|
228
|
-
return Object.values(TargetTableConfig).some(
|
|
229
|
-
(config) => config.idPrefix === tid.getType(),
|
|
230
|
-
);
|
|
231
|
-
} catch {
|
|
232
|
-
return false;
|
|
233
|
-
}
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
message: `Invalid target ID format. Must match the corresponding table's ID prefix. Valid prefix: ${TargetTableEnum.toString().toLowerCase()}. Example: disbursement_01j6aqmtfyfwy9spjdcnh7yqk7`,
|
|
237
|
-
},
|
|
238
|
-
),
|
|
239
|
-
search: z.string().max(50).optional(),
|
|
240
|
-
targetIds: z
|
|
241
|
-
.string()
|
|
242
|
-
.optional()
|
|
243
|
-
.openapi({
|
|
244
|
-
example:
|
|
245
|
-
'disbursement_01j6aqmtfyfwy9spjdcnh7yqk7,disbursement_01j6aqmtfyfwy9spjdcnh7yqk8',
|
|
246
|
-
})
|
|
247
|
-
.transform((str) => {
|
|
248
|
-
if (!str) return [];
|
|
249
|
-
// Split by comma, trim whitespace, and remove duplicates using Set
|
|
250
|
-
const ids = str.split(',').map((id) => id.trim());
|
|
251
|
-
return Array.from(new Set(ids));
|
|
252
|
-
})
|
|
253
|
-
.refine(
|
|
254
|
-
(value) => {
|
|
255
|
-
if (!value || value.length === 0) return true;
|
|
256
|
-
|
|
257
|
-
// Validate each ID
|
|
258
|
-
return value.every((id) => {
|
|
259
|
-
try {
|
|
260
|
-
const tid = TypeID.fromString(id);
|
|
261
|
-
return Object.values(TargetTableConfig).some(
|
|
262
|
-
(config) => config.idPrefix === tid.getType(),
|
|
263
|
-
);
|
|
264
|
-
} catch {
|
|
265
|
-
return false;
|
|
266
|
-
}
|
|
267
|
-
});
|
|
268
|
-
},
|
|
269
|
-
{
|
|
270
|
-
message: `Invalid target IDs. All IDs must match the corresponding table's ID prefix. Valid prefix: ${TargetTableEnum.toString().toLowerCase()}. Example: disbursement_01j6aqmtfyfwy9spjdcnh7yqk7`,
|
|
271
|
-
},
|
|
272
|
-
),
|
|
273
|
-
});
|
|
274
|
-
export type ActivitiesFilters = z.infer<typeof ActivitiesFilters>;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { CountryStateSchema, RequiredCountryStateSchema } from './states.types';
|
|
3
|
-
import { CountryZipSchema, RequiredCountryZipSchema } from './zip.type';
|
|
4
|
-
|
|
5
|
-
export const AddressSchema = z
|
|
6
|
-
.object({
|
|
7
|
-
address: z
|
|
8
|
-
.string()
|
|
9
|
-
.min(2, 'address is less than 2 characters')
|
|
10
|
-
.nullable()
|
|
11
|
-
.optional(),
|
|
12
|
-
address2: z.string().nullable().optional(),
|
|
13
|
-
city: z
|
|
14
|
-
.string()
|
|
15
|
-
.min(2, 'city is less than 2 characters')
|
|
16
|
-
.max(30, 'city is more than 30 characters')
|
|
17
|
-
.nullable()
|
|
18
|
-
.optional(),
|
|
19
|
-
})
|
|
20
|
-
.and(CountryStateSchema)
|
|
21
|
-
.and(CountryZipSchema);
|
|
22
|
-
|
|
23
|
-
export type AddressType = z.infer<typeof AddressSchema>;
|
|
24
|
-
|
|
25
|
-
export const RequiredAddressSchema = z
|
|
26
|
-
.object({
|
|
27
|
-
address: z.string().min(2, 'Address must be at least 2 characters'),
|
|
28
|
-
address2: z
|
|
29
|
-
.string()
|
|
30
|
-
.max(100, 'Address2 cannot exceed 100 characters')
|
|
31
|
-
.nullable()
|
|
32
|
-
.optional(),
|
|
33
|
-
city: z
|
|
34
|
-
.string()
|
|
35
|
-
.min(2, 'City must be at least 2 characters')
|
|
36
|
-
.max(50, 'City cannot exceed 50 characters'),
|
|
37
|
-
})
|
|
38
|
-
.and(RequiredCountryStateSchema)
|
|
39
|
-
.and(RequiredCountryZipSchema);
|
|
40
|
-
|
|
41
|
-
export type RequiredAddressType = z.infer<typeof RequiredAddressSchema>;
|