@dalmore/api-contracts 1.0.7 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/README.md +18 -2
  2. package/index.mjs +1 -4
  3. package/package.json +4 -4
  4. package/src/common/types/account-contact.types.ts +98 -0
  5. package/src/common/types/account-detail.types.ts +27 -0
  6. package/src/common/types/account-integration.types.ts +143 -0
  7. package/src/common/types/account-manager.types.ts +124 -0
  8. package/src/common/types/account.types.ts +296 -0
  9. package/src/common/types/activity.types.ts +274 -0
  10. package/src/common/types/address.spec.ts +203 -0
  11. package/src/common/types/address.types.ts +41 -0
  12. package/src/common/types/aic.types.ts +246 -0
  13. package/src/common/types/aml.types.ts +18 -0
  14. package/src/common/types/api-key-logs.types.ts +66 -0
  15. package/src/common/types/api-keys.types.ts +69 -0
  16. package/src/common/types/asset.types.ts +338 -0
  17. package/src/common/types/auth.types.ts +370 -0
  18. package/src/common/types/batch-jobs.types.ts +151 -0
  19. package/src/common/types/bonus-tier.types.ts +147 -0
  20. package/src/common/types/cart.types.ts +18 -0
  21. package/src/common/types/checklist-items.types.ts +70 -0
  22. package/src/common/types/checklist.types.ts +97 -0
  23. package/src/common/types/common.types.spec.ts +336 -0
  24. package/src/common/types/common.types.ts +1520 -0
  25. package/src/common/types/comply-advantage-api.types.ts +316 -0
  26. package/src/common/types/comply-advantage.types.ts +25 -0
  27. package/src/common/types/contact-us.types.ts +107 -0
  28. package/src/common/types/contract-helpers.ts +205 -0
  29. package/src/common/types/countries.types.ts +375 -0
  30. package/src/common/types/covered-person.types.ts +274 -0
  31. package/src/common/types/dashboard.types.ts +799 -0
  32. package/src/common/types/data-record.types.ts +325 -0
  33. package/src/common/types/data-room.types.ts +242 -0
  34. package/src/common/types/default-theme-config.types.ts +87 -0
  35. package/src/common/types/disbursement-adjustment.types.ts +32 -0
  36. package/src/common/types/disbursement-approval-user.types.ts +100 -0
  37. package/src/common/types/disbursement-review.types.ts +110 -0
  38. package/src/common/types/disbursement-transaction.types.ts +72 -0
  39. package/src/common/types/disbursements.types.ts +310 -0
  40. package/src/common/types/domain-filter.types.ts +55 -0
  41. package/src/common/types/email-theme.types.ts +442 -0
  42. package/src/common/types/entity.types.ts +15 -0
  43. package/src/common/types/error-responses.types.ts +135 -0
  44. package/src/common/types/escrow-account.types.ts +104 -0
  45. package/src/common/types/exchange-api-key.types.ts +121 -0
  46. package/src/common/types/exchange-import.types.ts +36 -0
  47. package/src/common/types/exchange-provider.types.ts +329 -0
  48. package/src/common/types/file.types.ts +461 -0
  49. package/src/common/types/files.types.spec.ts +154 -0
  50. package/src/common/types/health.types.ts +29 -0
  51. package/src/common/types/index.ts +48 -0
  52. package/src/common/types/individuals.types.ts +554 -0
  53. package/src/common/types/investor-account.types.ts +1239 -0
  54. package/src/common/types/investorAccountIdSchema.type.ts +0 -0
  55. package/src/common/types/investors-offering.types.ts +65 -0
  56. package/src/common/types/invite.types.ts +133 -0
  57. package/src/common/types/issuer-bank-account.types.ts +107 -0
  58. package/src/common/types/issuer-offering.types.ts +306 -0
  59. package/src/common/types/issuer-payment-method.types.spec.ts +612 -0
  60. package/src/common/types/issuer-payment-method.types.ts +341 -0
  61. package/src/common/types/issuer.types.ts +312 -0
  62. package/src/common/types/job-item.types.ts +119 -0
  63. package/src/common/types/jobs.types.ts +171 -0
  64. package/src/common/types/kyb.types.ts +53 -0
  65. package/src/common/types/kyc.types.ts +188 -0
  66. package/src/common/types/legal-entity.types.ts +185 -0
  67. package/src/common/types/login-history.types.ts +46 -0
  68. package/src/common/types/mail-template.types.ts +436 -0
  69. package/src/common/types/north-cap-integration.types.ts +190 -0
  70. package/src/common/types/note.types.ts +109 -0
  71. package/src/common/types/notification.types.ts +58 -0
  72. package/src/common/types/notion-api.types.ts +374 -0
  73. package/src/common/types/notion-database.types.ts +125 -0
  74. package/src/common/types/notion-page.types.ts +267 -0
  75. package/src/common/types/offering-reports.types.ts +153 -0
  76. package/src/common/types/offering-submission.types.ts +314 -0
  77. package/src/common/types/offering.types.spec.ts +91 -0
  78. package/src/common/types/offering.types.ts +590 -0
  79. package/src/common/types/page-revision.types.ts +86 -0
  80. package/src/common/types/page.types.ts +436 -0
  81. package/src/common/types/password.type.ts +15 -0
  82. package/src/common/types/payment-methods.types.ts +298 -0
  83. package/src/common/types/phone.spec.ts +76 -0
  84. package/src/common/types/phone.type.ts +27 -0
  85. package/src/common/types/portfolio.types.ts +50 -0
  86. package/src/common/types/privacy-policy-and-tos.types.ts +231 -0
  87. package/src/common/types/queue.types.ts +112 -0
  88. package/src/common/types/registered-reps.types.ts +25 -0
  89. package/src/common/types/rejection-reasons.types.ts +56 -0
  90. package/src/common/types/reminder-config.types.ts +40 -0
  91. package/src/common/types/review.types.ts +133 -0
  92. package/src/common/types/role.types.ts +26 -0
  93. package/src/common/types/secondary-customer.types.ts +66 -0
  94. package/src/common/types/secondary-issuer.types.ts +50 -0
  95. package/src/common/types/secondary-order.types.ts +58 -0
  96. package/src/common/types/secondary-security.types.ts +60 -0
  97. package/src/common/types/secondary-trade.entity.ts +16 -0
  98. package/src/common/types/secondary-trade.types.ts +95 -0
  99. package/src/common/types/secure-request.types.ts +68 -0
  100. package/src/common/types/signer.types.ts +651 -0
  101. package/src/common/types/site-link.types.spec.ts +134 -0
  102. package/src/common/types/site-link.types.ts +166 -0
  103. package/src/common/types/site-settings.types.ts +726 -0
  104. package/src/common/types/site.types.ts +270 -0
  105. package/src/common/types/sms.types.ts +30 -0
  106. package/src/common/types/state-machine.types.ts +177 -0
  107. package/src/common/types/states.types.ts +163 -0
  108. package/src/common/types/subdoc-preview.types.ts +35 -0
  109. package/src/common/types/task.types.ts +258 -0
  110. package/src/common/types/trade-adjustment.type.ts +33 -0
  111. package/src/common/types/trade-line-item.type.ts +132 -0
  112. package/src/common/types/trade.types.ts +912 -0
  113. package/src/common/types/transaction.types.ts +198 -0
  114. package/src/common/types/trusted-contact.types.ts +122 -0
  115. package/src/common/types/typography.types.ts +75 -0
  116. package/src/common/types/user-manual.types.ts +290 -0
  117. package/src/common/types/user-setting.types.ts +133 -0
  118. package/src/common/types/user.types.ts +320 -0
  119. package/src/common/types/webhook.types.ts +588 -0
  120. package/src/common/types/zip.type.ts +36 -0
  121. package/src/contracts/clients/accounts/index.ts +61 -0
  122. package/src/contracts/clients/aic/index.ts +59 -0
  123. package/src/contracts/clients/api-key-logs/index.ts +53 -0
  124. package/src/contracts/clients/api-keys/index.ts +73 -0
  125. package/src/contracts/clients/assets/index.ts +102 -0
  126. package/src/contracts/clients/auth/index.ts +50 -0
  127. package/src/contracts/clients/files/index.ts +166 -0
  128. package/src/contracts/clients/files-public/index.ts +166 -0
  129. package/src/contracts/clients/index.ts +44 -0
  130. package/src/contracts/clients/individuals/index.ts +93 -0
  131. package/src/contracts/clients/investor-accounts/index.ts +93 -0
  132. package/src/contracts/clients/issuers/index.ts +94 -0
  133. package/src/contracts/clients/legal-entities/index.ts +93 -0
  134. package/src/contracts/clients/offerings/index.ts +117 -0
  135. package/src/contracts/clients/secure-requests/index.ts +34 -0
  136. package/src/contracts/clients/sites/index.ts +56 -0
  137. package/src/contracts/clients/trades/index.ts +122 -0
  138. package/dist/contracts/clients/index.d.ts +0 -19
@@ -0,0 +1,66 @@
1
+ import { TypeID } from 'typeid-js';
2
+ import { z } from 'zod';
3
+ import {
4
+ ExchangeProvider,
5
+ IPaginationMeta,
6
+ PaginationOptionsZod,
7
+ } from './common.types';
8
+ import { IBaseEntity } from './entity.types';
9
+ import { accountIdSchema } from './account.types';
10
+ import { extendZodWithOpenApi } from '@anatine/zod-openapi';
11
+ import { RawAccountData } from './exchange-provider.types';
12
+
13
+ extendZodWithOpenApi(z);
14
+
15
+ export const secondaryCustomerIdSchema = z.string().refine(
16
+ (value) => {
17
+ try {
18
+ const id = TypeID.fromString(value);
19
+ return id.getType() === 'secondary_customer';
20
+ } catch {
21
+ return false;
22
+ }
23
+ },
24
+ {
25
+ message:
26
+ 'Invalid secondary customer ID format. Must be a valid TypeID with "secondary_customer" prefix.',
27
+ },
28
+ );
29
+
30
+ export const SecondaryCustomer = IBaseEntity.extend({
31
+ accountId: accountIdSchema,
32
+ tid: z.string(),
33
+ provider: z.nativeEnum(ExchangeProvider).default(ExchangeProvider.PPEX),
34
+ rawAccountData: z.custom<RawAccountData>().nullable(),
35
+ });
36
+ export type SecondaryCustomer = z.infer<typeof SecondaryCustomer>;
37
+
38
+ export const IPaginatedSecondaryCustomers = z.object({
39
+ items: z.array(SecondaryCustomer),
40
+ meta: IPaginationMeta,
41
+ });
42
+ export type IPaginatedSecondaryCustomers = z.infer<
43
+ typeof IPaginatedSecondaryCustomers
44
+ >;
45
+
46
+ export const SecondaryCustomerFiltersZod = z.object({
47
+ accountId: accountIdSchema.optional(),
48
+ search: z.string().max(50).optional(),
49
+ provider: z.nativeEnum(ExchangeProvider).optional(),
50
+ tid: z.string().max(50).optional(),
51
+ });
52
+
53
+ export const GetSecondaryCustomerFiltersZod = PaginationOptionsZod.merge(
54
+ SecondaryCustomerFiltersZod,
55
+ );
56
+ export type GetSecondaryCustomerFiltersZod = z.infer<
57
+ typeof GetSecondaryCustomerFiltersZod
58
+ >;
59
+
60
+ export const ExportSecondaryCustomersResponse = z.object({
61
+ message: z.string(),
62
+ });
63
+
64
+ export type ExportSecondaryCustomersResponse = z.infer<
65
+ typeof ExportSecondaryCustomersResponse
66
+ >;
@@ -0,0 +1,50 @@
1
+ import { TypeID } from 'typeid-js';
2
+ import { z } from 'zod';
3
+ import { extendZodWithOpenApi } from '@anatine/zod-openapi';
4
+ import { IBaseEntity } from './entity.types';
5
+ import { IPaginationMeta } from './common.types';
6
+ import { SecondarySecurityZod } from './secondary-security.types';
7
+ extendZodWithOpenApi(z);
8
+
9
+ export const secondaryIssuerIdSchema = z.string().refine(
10
+ (value) => {
11
+ try {
12
+ const tid = TypeID.fromString(value);
13
+ return tid.getType() === 'secondary_issuer';
14
+ } catch {
15
+ return false;
16
+ }
17
+ },
18
+ {
19
+ message:
20
+ 'Invalid secondary issuer id. Must be a valid id with "secondary_issuer" prefix.',
21
+ },
22
+ );
23
+
24
+ export const SecondaryIssuerZod = IBaseEntity.extend({
25
+ name: z.string(),
26
+ accountId: z.string().optional(),
27
+ securities: z.array(z.lazy(() => SecondarySecurityZod)),
28
+ ppexIssuerId: z.string().optional(),
29
+ });
30
+ export type SecondaryIssuerZod = z.infer<typeof SecondaryIssuerZod>;
31
+
32
+ export const IPaginatedSecondaryIssuers = z.object({
33
+ items: z.array(SecondaryIssuerZod),
34
+ meta: IPaginationMeta,
35
+ });
36
+ export type IPaginatedSecondaryIssuers = z.infer<
37
+ typeof IPaginatedSecondaryIssuers
38
+ >;
39
+
40
+ export const CreateSecondaryIssuer = z.object({
41
+ name: z.string().max(250),
42
+ ppexIssuerId: z.string().max(250),
43
+ });
44
+ export type CreateSecondaryIssuer = z.infer<typeof CreateSecondaryIssuer>;
45
+
46
+ export const UpdateSecondaryIssuer = z.object({
47
+ name: z.string().max(250).optional(),
48
+ ppexIssuerId: z.string().max(250).optional(),
49
+ });
50
+ export type UpdateSecondaryIssuer = z.infer<typeof UpdateSecondaryIssuer>;
@@ -0,0 +1,58 @@
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 {
6
+ DateField,
7
+ DateRangeFiltersZod,
8
+ ExchangeProvider,
9
+ IPaginationMeta,
10
+ } from './common.types';
11
+ import { IBaseEntity } from './entity.types';
12
+ import { RawOrderData } from './exchange-provider.types';
13
+
14
+ extendZodWithOpenApi(z);
15
+
16
+ export const secondaryOrderIdSchema = z.string().refine(
17
+ (value) => {
18
+ try {
19
+ const tid = TypeID.fromString(value);
20
+ return tid.getType() === 'secondary_order';
21
+ } catch {
22
+ return false;
23
+ }
24
+ },
25
+ {
26
+ message:
27
+ 'Invalid secondary order id. Must be a valid id with "secondary_order" prefix.',
28
+ },
29
+ );
30
+
31
+ export const SecondaryOrder = IBaseEntity.extend({
32
+ accountId: z.string(),
33
+ tid: z.string(),
34
+ provider: z.nativeEnum(ExchangeProvider),
35
+ rawOrderData: z.custom<RawOrderData>().nullable(),
36
+ });
37
+ export type SecondaryOrder = z.infer<typeof SecondaryOrder>;
38
+
39
+ export const IPaginatedSecondaryOrders = z.object({
40
+ items: z.array(SecondaryOrder),
41
+ meta: IPaginationMeta,
42
+ });
43
+ export type IPaginatedSecondaryOrders = z.infer<
44
+ typeof IPaginatedSecondaryOrders
45
+ >;
46
+
47
+ export const SecondaryOrderFiltersZod = z.object({
48
+ accountId: accountIdSchema.optional(),
49
+ search: z.string().max(50).optional(),
50
+ provider: z.nativeEnum(ExchangeProvider).optional(),
51
+ tid: z.string().max(50).optional(),
52
+ });
53
+
54
+ export const SecondaryOrderDateRangeFiltersZod = DateRangeFiltersZod.extend({
55
+ dateField: z
56
+ .enum([DateField.CREATED_AT, DateField.RAW_ORDER_CREATED_DATE])
57
+ .optional(),
58
+ });
@@ -0,0 +1,60 @@
1
+ import { TypeID } from 'typeid-js';
2
+ import { z } from 'zod';
3
+ import { extendZodWithOpenApi } from '@anatine/zod-openapi';
4
+ import { IBaseEntity } from './entity.types';
5
+ import { IPaginationMeta } from './common.types';
6
+ import { secondaryIssuerIdSchema } from './secondary-issuer.types';
7
+ import { accountIdSchema } from './account.types';
8
+
9
+ extendZodWithOpenApi(z);
10
+
11
+ export const secondarySecurityIdSchema = z.string().refine(
12
+ (value) => {
13
+ try {
14
+ const tid = TypeID.fromString(value);
15
+ return tid.getType() === 'secondary_security';
16
+ } catch {
17
+ return false;
18
+ }
19
+ },
20
+ {
21
+ message:
22
+ 'Invalid secondary security id. Must be a valid id with "secondary_security" prefix.',
23
+ },
24
+ );
25
+
26
+ export const SecondarySecurityZod = IBaseEntity.extend({
27
+ name: z.string(),
28
+ issuerId: z.lazy(() => secondaryIssuerIdSchema),
29
+ accountId: z.lazy(() => accountIdSchema),
30
+ ticker: z.string(),
31
+ ppexSecurityId: z.string(),
32
+ });
33
+
34
+ export type SecondarySecurityZod = z.infer<typeof SecondarySecurityZod>;
35
+
36
+ export const IPaginatedSecondarySecurities = z.object({
37
+ items: z.array(SecondarySecurityZod),
38
+ meta: IPaginationMeta,
39
+ });
40
+ export type IPaginatedSecondarySecurities = z.infer<
41
+ typeof IPaginatedSecondarySecurities
42
+ >;
43
+
44
+ export const CreateSecondarySecurity = z.object({
45
+ name: z.string().min(1).max(255),
46
+ issuerId: z.lazy(() => secondaryIssuerIdSchema),
47
+ accountId: z.lazy(() => accountIdSchema),
48
+ ticker: z.string().min(1).max(255),
49
+ ppexSecurityId: z.string().min(1).max(255),
50
+ });
51
+ export type CreateSecondarySecurity = z.infer<typeof CreateSecondarySecurity>;
52
+
53
+ export const UpdateSecondarySecurity = z.object({
54
+ name: z.string().min(1).max(255).optional(),
55
+ issuerId: z.lazy(() => secondaryIssuerIdSchema).optional(),
56
+ accountId: z.lazy(() => accountIdSchema).optional(),
57
+ ticker: z.string().min(1).max(255).optional(),
58
+ ppexSecurityId: z.string().min(1).max(255).optional(),
59
+ });
60
+ export type UpdateSecondarySecurity = z.infer<typeof UpdateSecondarySecurity>;
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ import { BaseStatus } from './common.types';
3
+
4
+ export enum PhoenixApprovalStatus {
5
+ APPROVED = BaseStatus.APPROVED,
6
+ PENDING = BaseStatus.PENDING,
7
+ }
8
+
9
+ export const PhoenixSecondaryTradePayloadZod = z.object({
10
+ investment_ids: z.string(),
11
+ approval_status: z.nativeEnum(PhoenixApprovalStatus),
12
+ });
13
+
14
+ export type PhoenixSecondaryTradePayload = z.infer<
15
+ typeof PhoenixSecondaryTradePayloadZod
16
+ >;
@@ -0,0 +1,95 @@
1
+ import { TypeID } from 'typeid-js';
2
+ import { z } from 'zod';
3
+ import { extendZodWithOpenApi } from '@anatine/zod-openapi';
4
+ import { IBaseEntity } from './entity.types';
5
+ import {
6
+ ComplianceReview,
7
+ DateField,
8
+ DateRangeFiltersZod,
9
+ ExchangeProvider,
10
+ } from './common.types';
11
+ import { RawTradeData } from './exchange-provider.types';
12
+ import { IPaginationMeta } from './common.types';
13
+ import { accountIdSchema } from './account.types';
14
+ extendZodWithOpenApi(z);
15
+
16
+ export const secondaryTradeIdSchema = z.string().refine(
17
+ (value) => {
18
+ try {
19
+ const tid = TypeID.fromString(value);
20
+ return tid.getType() === 'secondary_trade';
21
+ } catch {
22
+ return false;
23
+ }
24
+ },
25
+ {
26
+ message:
27
+ 'Invalid secondary trade id. Must be a valid id with "secondary_trade" prefix.',
28
+ },
29
+ );
30
+
31
+ export const SecondaryTradeZod = IBaseEntity.extend({
32
+ accountId: z.string(),
33
+ tid: z.string(),
34
+ provider: z.nativeEnum(ExchangeProvider),
35
+ complianceReview: z.nativeEnum(ComplianceReview),
36
+ complianceReviewNotes: z.string().nullable(),
37
+ complianceReviewerId: z.string().nullable(),
38
+ rawTradeData: z.custom<RawTradeData>().nullable(),
39
+ });
40
+
41
+ export type SecondaryTrade = z.infer<typeof SecondaryTradeZod>;
42
+
43
+ export const IPaginatedSecondaryTrades = z.object({
44
+ items: z.array(SecondaryTradeZod),
45
+ meta: IPaginationMeta,
46
+ });
47
+ export type IPaginatedSecondaryTrades = z.infer<
48
+ typeof IPaginatedSecondaryTrades
49
+ >;
50
+
51
+ export const SecondaryTradeFiltersZod = z.object({
52
+ accountId: accountIdSchema.optional(),
53
+ search: z.string().max(50).optional(),
54
+ provider: z.nativeEnum(ExchangeProvider).optional(),
55
+ tid: z.string().max(50).optional(),
56
+ complianceReview: z.nativeEnum(ComplianceReview).optional(),
57
+ });
58
+
59
+ export type SecondaryTradeFiltersZod = z.infer<typeof SecondaryTradeFiltersZod>;
60
+ export const ExportSecondaryTradesResponse = z.object({
61
+ message: z.string(),
62
+ });
63
+
64
+ export type ExportSecondaryTradesResponse = z.infer<
65
+ typeof ExportSecondaryTradesResponse
66
+ >;
67
+
68
+ export const SecondaryTradeDateRangeFiltersZod = DateRangeFiltersZod.extend({
69
+ dateField: z
70
+ .enum([DateField.CREATED_AT, DateField.RAW_TRADE_CREATED_DATE])
71
+ .optional(),
72
+ });
73
+
74
+ export const SecondaryTradeSummaryZod = z.object({
75
+ accountId: accountIdSchema,
76
+ accountName: z.string(),
77
+ totalNeedsReviewCount: z.number().int(),
78
+ totalReadyToApproveCount: z.number().int(),
79
+ });
80
+ export type SecondaryTradeSummaryZod = z.infer<typeof SecondaryTradeSummaryZod>;
81
+
82
+ export const IPaginatedSecondaryTradeSummaryResponse = z.object({
83
+ items: z.array(SecondaryTradeSummaryZod),
84
+ meta: IPaginationMeta,
85
+ });
86
+ export type IPaginatedSecondaryTradeSummaryResponse = z.infer<
87
+ typeof IPaginatedSecondaryTradeSummaryResponse
88
+ >;
89
+
90
+ export const CountResultZod = z.array(
91
+ z.object({
92
+ count: z.string(),
93
+ }),
94
+ );
95
+ export type CountResultZod = z.infer<typeof CountResultZod>;
@@ -0,0 +1,68 @@
1
+ import { z } from 'zod';
2
+ import { TypeID } from 'typeid-js';
3
+ import { extendZodWithOpenApi } from '@anatine/zod-openapi';
4
+ import { IBaseEntity } from './entity.types';
5
+ import { IPaginationMeta } from './common.types';
6
+ extendZodWithOpenApi(z);
7
+
8
+ export const secureRequestIdSchema = z.string().refine(
9
+ (value) => {
10
+ try {
11
+ const tid = TypeID.fromString(value);
12
+ return tid.getType() === 'secure_request';
13
+ } catch {
14
+ return false;
15
+ }
16
+ },
17
+ {
18
+ message:
19
+ 'Invalid Secure ID format. Must be a valid TypeID with "secure_request" prefix. Example: secure_request_01j5y5ghx8fvc83dmx3pznq7hv',
20
+ },
21
+ );
22
+
23
+ export enum SecureRequestTemplate {
24
+ DEFAULT = 'default',
25
+ NORTHCAP = 'northcap',
26
+ }
27
+
28
+ export const SecureRequestZod = IBaseEntity.extend({
29
+ payload: z.record(z.any()), // Accepts objects with any shape
30
+ ipAddress: z.string().nullable(),
31
+ template: z.string().nullable(),
32
+ });
33
+ export type SecureRequestZod = z.infer<typeof SecureRequestZod>;
34
+
35
+ export const IPaginatedSecureRequests = z.object({
36
+ items: z.array(SecureRequestZod),
37
+ meta: IPaginationMeta,
38
+ });
39
+ export type IPaginatedSecureRequests = z.infer<typeof IPaginatedSecureRequests>;
40
+
41
+ export const PostSecureRequestBody = z.object({
42
+ payload: z.record(z.any()).refine(
43
+ (payload) => {
44
+ const stringified = JSON.stringify(payload);
45
+ if (stringified.length > 1024 * 100) {
46
+ throw new Error('Payload exceeds maximum size of 100KB');
47
+ }
48
+ return stringified;
49
+ },
50
+ {
51
+ message:
52
+ 'Payload values must be strings with a maximum length of 100 characters',
53
+ },
54
+ ),
55
+ template: z
56
+ .nativeEnum(SecureRequestTemplate)
57
+ .nullable()
58
+ .openapi({ description: 'Template name' }),
59
+ });
60
+ export type PostSecureRequestBody = z.infer<typeof PostSecureRequestBody>;
61
+
62
+ export const PostSecureRequestResponse = SecureRequestZod.extend({
63
+ exchangeApiKeyId: z.string().optional(),
64
+ exchangeImportId: z.string().optional(),
65
+ });
66
+ export type PostSecureRequestResponse = z.infer<
67
+ typeof PostSecureRequestResponse
68
+ >;