@dalmore/api-contracts 0.0.0-dev.2dc8e92 → 0.0.0-dev.4bb6b7a

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 (206) hide show
  1. package/README.md +23 -19
  2. package/common/types/account-contact.types.ts +2 -1
  3. package/common/types/account-manager.types.ts +3 -7
  4. package/common/types/account-setting.types.ts +65 -0
  5. package/common/types/account.types.ts +1 -0
  6. package/common/types/activity.types.ts +1 -1
  7. package/common/types/api-key-logs.types.ts +1 -1
  8. package/common/types/asset.types.ts +14 -14
  9. package/common/types/auth.types.ts +7 -18
  10. package/common/types/bonus-tier.types.ts +33 -0
  11. package/common/types/cart.types.ts +4 -1
  12. package/common/types/common.types.ts +38 -6
  13. package/common/types/contact-us.types.ts +6 -2
  14. package/common/types/covered-person.types.ts +2 -1
  15. package/common/types/dashboard.types.ts +2 -9
  16. package/common/types/disbursements.types.ts +119 -3
  17. package/common/types/escrow-account.types.ts +3 -3
  18. package/common/types/file.types.ts +20 -4
  19. package/common/types/i-will-do-it-later.types.ts +68 -0
  20. package/common/types/index.ts +2 -0
  21. package/common/types/individuals.types.ts +5 -17
  22. package/common/types/investor-account.types.ts +2 -1
  23. package/common/types/invite.types.ts +27 -1
  24. package/common/types/issuer-offering.types.ts +113 -30
  25. package/common/types/issuer-payment-method.types.ts +41 -0
  26. package/common/types/issuer.types.ts +9 -0
  27. package/common/types/legal-entity.types.ts +3 -2
  28. package/common/types/mail-template.types.ts +34 -0
  29. package/common/types/note.types.ts +1 -1
  30. package/common/types/notification.types.ts +525 -29
  31. package/common/types/offering.types.ts +106 -20
  32. package/common/types/site-settings.types.ts +2 -1
  33. package/common/types/site.types.ts +2 -9
  34. package/common/types/{trade-line-item.type.ts → trade-line-item.types.ts} +2 -9
  35. package/common/types/trade.types.ts +118 -2
  36. package/common/types/transaction.types.ts +12 -1
  37. package/common/types/trusted-contact.types.ts +7 -7
  38. package/common/types/user.types.ts +17 -33
  39. package/common/types/webhook.types.ts +142 -0
  40. package/contracts/{investors → clients}/cart/index.ts +11 -6
  41. package/contracts/clients/index.ts +10 -0
  42. package/contracts/{investors → clients}/issuer-payment-methods/index.ts +5 -2
  43. package/contracts/{compliance → clients}/payment-methods/index.ts +40 -12
  44. package/contracts/{investors → clients}/trade-line-items/index.ts +19 -28
  45. package/contracts/clients/trades/index.ts +65 -1
  46. package/contracts/{investors → clients}/transactions/index.ts +3 -3
  47. package/index.ts +10 -0
  48. package/package.json +23 -32
  49. package/contracts/compliance/account-contacts/index.ts +0 -82
  50. package/contracts/compliance/account-managers/index.ts +0 -142
  51. package/contracts/compliance/accounts/index.ts +0 -187
  52. package/contracts/compliance/activities/index.ts +0 -55
  53. package/contracts/compliance/aic/index.ts +0 -60
  54. package/contracts/compliance/api-keys/index.ts +0 -91
  55. package/contracts/compliance/assets/index.ts +0 -122
  56. package/contracts/compliance/auth/index.ts +0 -134
  57. package/contracts/compliance/batch-jobs/index.ts +0 -62
  58. package/contracts/compliance/bonus-tiers/index.ts +0 -55
  59. package/contracts/compliance/checklist/index.ts +0 -87
  60. package/contracts/compliance/checklist-items/index.ts +0 -86
  61. package/contracts/compliance/covered-persons/index.ts +0 -97
  62. package/contracts/compliance/dashboard/index.ts +0 -111
  63. package/contracts/compliance/data-records/index.ts +0 -116
  64. package/contracts/compliance/data-rooms/index.ts +0 -113
  65. package/contracts/compliance/default-theme-configs/index.ts +0 -95
  66. package/contracts/compliance/disbursement/index.ts +0 -165
  67. package/contracts/compliance/disbursement-approval-users/index.ts +0 -84
  68. package/contracts/compliance/disbursement-transactions/index.ts +0 -37
  69. package/contracts/compliance/domain-filters/index.ts +0 -117
  70. package/contracts/compliance/email-themes/index.ts +0 -284
  71. package/contracts/compliance/escrow-accounts/index.ts +0 -85
  72. package/contracts/compliance/exchange-api-keys/index.ts +0 -129
  73. package/contracts/compliance/exchange-imports/index.ts +0 -137
  74. package/contracts/compliance/files/index.ts +0 -267
  75. package/contracts/compliance/files-public/index.ts +0 -188
  76. package/contracts/compliance/health/index.ts +0 -26
  77. package/contracts/compliance/index.ts +0 -147
  78. package/contracts/compliance/individuals/index.ts +0 -57
  79. package/contracts/compliance/investor-accounts/index.ts +0 -141
  80. package/contracts/compliance/invites/index.ts +0 -137
  81. package/contracts/compliance/issuer-bank-accounts/index.ts +0 -81
  82. package/contracts/compliance/issuer-payment-methods/index.ts +0 -81
  83. package/contracts/compliance/issuers/index.ts +0 -97
  84. package/contracts/compliance/job-items/index.ts +0 -58
  85. package/contracts/compliance/jobs/index.ts +0 -59
  86. package/contracts/compliance/kyb/index.ts +0 -54
  87. package/contracts/compliance/kyc/index.ts +0 -77
  88. package/contracts/compliance/legal-entities/index.ts +0 -57
  89. package/contracts/compliance/login-histories/index.ts +0 -37
  90. package/contracts/compliance/notes/index.ts +0 -69
  91. package/contracts/compliance/notion-databases/index.ts +0 -107
  92. package/contracts/compliance/notion-pages/index.ts +0 -105
  93. package/contracts/compliance/offering-reports/index.ts +0 -149
  94. package/contracts/compliance/offerings/index.ts +0 -233
  95. package/contracts/compliance/pages/index.ts +0 -178
  96. package/contracts/compliance/rejection-reasons/index.ts +0 -32
  97. package/contracts/compliance/review/index.ts +0 -169
  98. package/contracts/compliance/roles/index.ts +0 -34
  99. package/contracts/compliance/secondary-customers/index.ts +0 -77
  100. package/contracts/compliance/secondary-orders/index.ts +0 -60
  101. package/contracts/compliance/secondary-trades/index.ts +0 -100
  102. package/contracts/compliance/secure-requests/index.ts +0 -54
  103. package/contracts/compliance/signer/index.ts +0 -369
  104. package/contracts/compliance/site-links/index.ts +0 -128
  105. package/contracts/compliance/site-settings/index.ts +0 -669
  106. package/contracts/compliance/sites/index.ts +0 -56
  107. package/contracts/compliance/state-machine/index.ts +0 -94
  108. package/contracts/compliance/tasks/index.ts +0 -91
  109. package/contracts/compliance/third-parties/index.ts +0 -52
  110. package/contracts/compliance/trade-line-items/index.ts +0 -59
  111. package/contracts/compliance/trades/index.ts +0 -230
  112. package/contracts/compliance/transactions/index.ts +0 -161
  113. package/contracts/compliance/user-manuals/index.ts +0 -271
  114. package/contracts/compliance/user-settings/index.ts +0 -189
  115. package/contracts/compliance/users/index.ts +0 -200
  116. package/contracts/compliance/webhooks/index.ts +0 -41
  117. package/contracts/compliance-apikey/accounts/index.ts +0 -58
  118. package/contracts/compliance-apikey/index.ts +0 -14
  119. package/contracts/index.ts +0 -6
  120. package/contracts/investors/account-contacts/index.ts +0 -58
  121. package/contracts/investors/aic/index.ts +0 -59
  122. package/contracts/investors/assets/index.ts +0 -61
  123. package/contracts/investors/auth/index.ts +0 -116
  124. package/contracts/investors/bonus-tiers/index.ts +0 -37
  125. package/contracts/investors/contact-us/index.ts +0 -48
  126. package/contracts/investors/data-records/index.ts +0 -113
  127. package/contracts/investors/data-rooms/index.ts +0 -96
  128. package/contracts/investors/files/index.ts +0 -167
  129. package/contracts/investors/files-public/index.ts +0 -185
  130. package/contracts/investors/index.ts +0 -72
  131. package/contracts/investors/individuals/index.ts +0 -99
  132. package/contracts/investors/investor-accounts/index.ts +0 -110
  133. package/contracts/investors/issuers/index.ts +0 -30
  134. package/contracts/investors/legal-entities/index.ts +0 -93
  135. package/contracts/investors/notes/index.ts +0 -69
  136. package/contracts/investors/offerings/index.ts +0 -93
  137. package/contracts/investors/pages/index.ts +0 -88
  138. package/contracts/investors/payment-methods/index.ts +0 -149
  139. package/contracts/investors/portfolios/index.ts +0 -53
  140. package/contracts/investors/sites/index.ts +0 -96
  141. package/contracts/investors/tasks/index.ts +0 -111
  142. package/contracts/investors/trades/index.ts +0 -114
  143. package/contracts/investors/trusted-contacts/index.ts +0 -93
  144. package/contracts/investors/user-manuals/index.ts +0 -62
  145. package/contracts/investors/user-settings/index.ts +0 -170
  146. package/contracts/investors/users/index.ts +0 -45
  147. package/contracts/investors/webhooks/index.ts +0 -30
  148. package/contracts/issuers/account-contacts/index.ts +0 -76
  149. package/contracts/issuers/account-integrations/index.ts +0 -97
  150. package/contracts/issuers/accounts/index.ts +0 -97
  151. package/contracts/issuers/activities/index.ts +0 -54
  152. package/contracts/issuers/aic/index.ts +0 -39
  153. package/contracts/issuers/api-key-logs/index.ts +0 -53
  154. package/contracts/issuers/api-keys/index.ts +0 -93
  155. package/contracts/issuers/assets/index.ts +0 -122
  156. package/contracts/issuers/auth/index.ts +0 -152
  157. package/contracts/issuers/bonus-tiers/index.ts +0 -55
  158. package/contracts/issuers/contact-us/index.ts +0 -48
  159. package/contracts/issuers/covered-persons/index.ts +0 -136
  160. package/contracts/issuers/dashboard/index.ts +0 -72
  161. package/contracts/issuers/data-records/index.ts +0 -257
  162. package/contracts/issuers/data-rooms/index.ts +0 -134
  163. package/contracts/issuers/disbursement-approval-users/index.ts +0 -82
  164. package/contracts/issuers/disbursement-transactions/index.ts +0 -53
  165. package/contracts/issuers/disbursements/index.ts +0 -153
  166. package/contracts/issuers/email-themes/index.ts +0 -242
  167. package/contracts/issuers/escrow-accounts/index.ts +0 -81
  168. package/contracts/issuers/exchange-api-keys/index.ts +0 -144
  169. package/contracts/issuers/files/index.ts +0 -166
  170. package/contracts/issuers/files-public/index.ts +0 -166
  171. package/contracts/issuers/health/index.ts +0 -24
  172. package/contracts/issuers/index.ts +0 -112
  173. package/contracts/issuers/investor-accounts/index.ts +0 -148
  174. package/contracts/issuers/invites/index.ts +0 -129
  175. package/contracts/issuers/issuer/index.ts +0 -94
  176. package/contracts/issuers/issuer-bank-accounts/index.ts +0 -81
  177. package/contracts/issuers/issuer-payment-methods/index.ts +0 -136
  178. package/contracts/issuers/kyc/index.ts +0 -38
  179. package/contracts/issuers/login-histories/index.ts +0 -51
  180. package/contracts/issuers/notes/index.ts +0 -69
  181. package/contracts/issuers/offerings/index.ts +0 -206
  182. package/contracts/issuers/pages/index.ts +0 -138
  183. package/contracts/issuers/payment-methods/index.ts +0 -61
  184. package/contracts/issuers/portfolios/index.ts +0 -36
  185. package/contracts/issuers/rejection-reasons/index.ts +0 -32
  186. package/contracts/issuers/review/index.ts +0 -63
  187. package/contracts/issuers/secondary-customers/index.ts +0 -55
  188. package/contracts/issuers/secondary-orders/index.ts +0 -57
  189. package/contracts/issuers/secondary-trades/index.ts +0 -57
  190. package/contracts/issuers/secure-requests/index.ts +0 -34
  191. package/contracts/issuers/site-links/index.ts +0 -116
  192. package/contracts/issuers/site-settings/index.ts +0 -585
  193. package/contracts/issuers/sites/index.ts +0 -32
  194. package/contracts/issuers/tasks/index.ts +0 -111
  195. package/contracts/issuers/trades/index.ts +0 -132
  196. package/contracts/issuers/transactions/index.ts +0 -158
  197. package/contracts/issuers/user-manuals/index.ts +0 -62
  198. package/contracts/issuers/user-settings/index.ts +0 -170
  199. package/contracts/issuers/users/index.ts +0 -126
  200. package/contracts/secondaries/accounts/index.ts +0 -58
  201. package/contracts/secondaries/index.ts +0 -23
  202. package/contracts/secondaries/secondary-customers/index.ts +0 -55
  203. package/contracts/secondaries/secondary-issuers/index.ts +0 -94
  204. package/contracts/secondaries/secondary-orders/index.ts +0 -56
  205. package/contracts/secondaries/secondary-securities/index.ts +0 -95
  206. package/contracts/secondaries/secondary-trades/index.ts +0 -56
@@ -1,6 +1,148 @@
1
1
  import { z } from 'zod';
2
2
  import { PersonaStatus } from './common.types';
3
3
 
4
+ /**
5
+ * Hook0 Webhook Provider Types
6
+ *
7
+ * Types for interacting with Hook0's webhooks-as-a-service API.
8
+ * @see https://documentation.hook0.com/api - API Reference
9
+ */
10
+
11
+ /**
12
+ * Hook0 API error response format.
13
+ * @see https://documentation.hook0.com/api
14
+ */
15
+ export const Hook0ApiErrorSchema = z.object({
16
+ type: z.string(),
17
+ status: z.number(),
18
+ title: z.string(),
19
+ detail: z.string(),
20
+ validation: z.unknown().nullable(),
21
+ id: z.string(),
22
+ });
23
+ export type Hook0ApiError = z.infer<typeof Hook0ApiErrorSchema>;
24
+
25
+ /**
26
+ * Error returned from Hook0 provider operations.
27
+ * Wraps Hook0 API errors with additional context.
28
+ */
29
+ export const Hook0ProviderErrorSchema = z.object({
30
+ message: z.string(),
31
+ statusCode: z.number().optional(),
32
+ code: z.string().optional(),
33
+ apiError: Hook0ApiErrorSchema.optional(),
34
+ });
35
+ export type Hook0ProviderError = z.infer<typeof Hook0ProviderErrorSchema>;
36
+
37
+ /**
38
+ * Hook0 subscription target configuration.
39
+ * Defines where and how webhooks are delivered.
40
+ * @see https://documentation.hook0.com/reference/subscriptionscreate
41
+ */
42
+ export const Hook0SubscriptionTargetSchema = z.object({
43
+ type: z.literal('http'),
44
+ method: z.string(),
45
+ url: z.string().url(),
46
+ headers: z.record(z.string()).optional(),
47
+ });
48
+ export type Hook0SubscriptionTarget = z.infer<
49
+ typeof Hook0SubscriptionTargetSchema
50
+ >;
51
+
52
+ /**
53
+ * Hook0 subscription response from create/get operations.
54
+ * @see https://documentation.hook0.com/reference/subscriptionscreate
55
+ * @see https://documentation.hook0.com/reference/subscriptionsget
56
+ */
57
+ export const Hook0SubscriptionResponseSchema = z.object({
58
+ subscription_id: z.string().uuid(),
59
+ application_id: z.string().uuid(),
60
+ created_at: z.string().datetime().optional(),
61
+ dedicated_workers: z.array(z.string()).optional(),
62
+ description: z.string().optional(),
63
+ event_types: z.array(z.string()).optional(),
64
+ is_enabled: z.boolean().optional(),
65
+ label_key: z.string().optional(),
66
+ label_value: z.string().optional(),
67
+ labels: z.record(z.string()).optional(),
68
+ metadata: z.record(z.string()).optional(),
69
+ secret: z.string(),
70
+ target: Hook0SubscriptionTargetSchema.optional(),
71
+ });
72
+ export type Hook0SubscriptionResponse = z.infer<
73
+ typeof Hook0SubscriptionResponseSchema
74
+ >;
75
+
76
+ /**
77
+ * Simplified subscription result returned to callers.
78
+ */
79
+ export const WebhookSubscriptionSchema = z.object({
80
+ subscriptionId: z.string(),
81
+ secret: z.string(),
82
+ });
83
+ export type WebhookSubscription = z.infer<typeof WebhookSubscriptionSchema>;
84
+
85
+ /**
86
+ * Hook0 event type response from create operation.
87
+ * @see https://documentation.hook0.com/reference/eventtypescreate
88
+ */
89
+ export const Hook0EventTypeResponseSchema = z.object({
90
+ service_name: z.string(),
91
+ resource_type_name: z.string(),
92
+ verb_name: z.string(),
93
+ event_type_name: z.string(),
94
+ });
95
+ export type Hook0EventTypeResponse = z.infer<
96
+ typeof Hook0EventTypeResponseSchema
97
+ >;
98
+
99
+ /**
100
+ * Hook0 event type list item.
101
+ * @see https://documentation.hook0.com/reference/eventtypeslist
102
+ */
103
+ export const Hook0EventTypeSchema = z.object({
104
+ name: z.string(),
105
+ service: z.string().optional(),
106
+ resource_type: z.string().optional(),
107
+ verb: z.string().optional(),
108
+ });
109
+ export type Hook0EventType = z.infer<typeof Hook0EventTypeSchema>;
110
+
111
+ /**
112
+ * Hook0 event ingestion response.
113
+ * @see https://documentation.hook0.com/api/#tag/events-ingestion/POST/api/v1/event/
114
+ */
115
+ export const Hook0EventResponseSchema = z.object({
116
+ event_id: z.string().uuid().optional(),
117
+ received_at: z.string().datetime().optional(),
118
+ });
119
+ export type Hook0EventResponse = z.infer<typeof Hook0EventResponseSchema>;
120
+
121
+ /**
122
+ * Simplified event response returned to callers.
123
+ */
124
+ export const WebhookEventResponseSchema = z.object({
125
+ eventId: z.string(),
126
+ receivedAt: z.string(),
127
+ });
128
+ export type WebhookEventResponse = z.infer<typeof WebhookEventResponseSchema>;
129
+
130
+ /**
131
+ * Payload sent when ingesting events to Hook0.
132
+ * Contains activity data to be delivered to webhook subscribers.
133
+ */
134
+ export const WebhookEventPayloadSchema = z.object({
135
+ activityId: z.string(),
136
+ activityType: z.string(),
137
+ accountId: z.string(),
138
+ targetId: z.string().nullable(),
139
+ targetTable: z.string().nullable(),
140
+ message: z.string(),
141
+ metadata: z.record(z.unknown()),
142
+ occurredAt: z.string(),
143
+ });
144
+ export type WebhookEventPayload = z.infer<typeof WebhookEventPayloadSchema>;
145
+
4
146
  export const WebhookReceived = z.object({
5
147
  received: z.boolean(),
6
148
  });
@@ -1,36 +1,41 @@
1
1
  import { initContract } from '@ts-rest/core';
2
+ import { z } from 'zod';
2
3
  import {
3
4
  UnauthorizedError,
4
5
  ForbiddenError,
5
6
  NotFoundError,
6
- InternalError,
7
7
  BadRequestError,
8
+ InternalError,
8
9
  TradeZod,
10
+ userIdSchema,
9
11
  tradeIdSchema,
10
12
  } from '../../../common/types';
11
13
  import {
12
- PlaceTradeResponse,
13
- PlaceTradeBody,
14
14
  PatchCartBody,
15
+ ClientPlacetradeBody,
16
+ PlaceTradeResponse,
15
17
  } from '../../../common/types/cart.types';
16
- import { z } from 'zod';
17
18
 
18
19
  const c = initContract();
19
20
 
20
21
  export const cartContract = c.router(
21
22
  {
22
23
  getTradeCart: {
23
- summary: 'GET Cart (Trade.status = CART)',
24
+ summary: 'Get carts (Trade.status = CART)',
24
25
  method: 'GET',
25
26
  path: '',
26
27
  metadata: {
27
28
  auth: true,
28
29
  },
30
+ query: z.object({
31
+ userId: userIdSchema,
32
+ }),
29
33
  responses: {
30
34
  200: TradeZod,
31
35
  401: UnauthorizedError,
32
36
  403: ForbiddenError,
33
37
  404: NotFoundError,
38
+ 500: InternalError,
34
39
  },
35
40
  },
36
41
  postCheckout: {
@@ -40,7 +45,7 @@ export const cartContract = c.router(
40
45
  metadata: {
41
46
  auth: true,
42
47
  },
43
- body: PlaceTradeBody,
48
+ body: ClientPlacetradeBody,
44
49
  responses: {
45
50
  200: PlaceTradeResponse,
46
51
  400: BadRequestError,
@@ -3,6 +3,7 @@ import { accountsContract } from './accounts';
3
3
  import { apiKeysContract } from './api-keys';
4
4
  import { clientApiKeyLogsContract } from './api-key-logs';
5
5
  import { assetsContract } from './assets';
6
+ import { cartContract } from './cart';
6
7
  import { filesContract } from './files';
7
8
  import { individualsContract } from './individuals';
8
9
  import { investorAccountsContract } from './investor-accounts';
@@ -15,6 +16,10 @@ import { secureRequestContract } from './secure-requests';
15
16
  import { aicContract } from './aic';
16
17
  import { authContract } from './auth';
17
18
  import { sitesContract } from './sites';
19
+ import { paymentMethodsContract } from './payment-methods';
20
+ import { issuerPaymentMethodsContract } from './issuer-payment-methods';
21
+ import { tradeLineItemsContract } from './trade-line-items';
22
+ import { clientsTransactionsContract } from './transactions';
18
23
 
19
24
  const c = initContract();
20
25
 
@@ -27,16 +32,21 @@ export const clientsContract = c.router(
27
32
  apiKeys: apiKeysContract,
28
33
  apiKeyLogs: clientApiKeyLogsContract,
29
34
  assets: assetsContract,
35
+ cart: cartContract,
30
36
  files: filesContract,
31
37
  filesPublic: filesPublicContract,
32
38
  individuals: individualsContract,
33
39
  investorAccounts: investorAccountsContract,
40
+ issuerPaymentMethods: issuerPaymentMethodsContract,
34
41
  issuers: issuersContract,
35
42
  legalEntities: legalEntityContract,
36
43
  offerings: offeringsContract,
44
+ paymentMethods: paymentMethodsContract,
37
45
  secureRequests: secureRequestContract,
38
46
  sites: sitesContract,
47
+ tradeLineItems: tradeLineItemsContract,
39
48
  trades: tradesContract,
49
+ transactions: clientsTransactionsContract,
40
50
  },
41
51
  {
42
52
  pathPrefix: '/clients/api/v1/',
@@ -6,6 +6,7 @@ import {
6
6
  UnauthorizedError,
7
7
  GetIssuerPaymentMethodZod,
8
8
  IPaginatedIssuerPaymentMethod,
9
+ IssuerPaymentMethodsIncludeQuery,
9
10
  PaginationOptionsZod,
10
11
  } from '../../../common/types';
11
12
 
@@ -14,13 +15,15 @@ const c = initContract();
14
15
  export const issuerPaymentMethodsContract = c.router(
15
16
  {
16
17
  getIssuerPaymentMethods: {
17
- summary: 'get payment methods',
18
+ summary: 'Get issuer payment methods',
18
19
  method: 'GET',
19
20
  path: '',
20
21
  metadata: {
21
22
  auth: true,
22
23
  },
23
- query: PaginationOptionsZod.merge(GetIssuerPaymentMethodZod),
24
+ query: PaginationOptionsZod.merge(GetIssuerPaymentMethodZod).merge(
25
+ IssuerPaymentMethodsIncludeQuery,
26
+ ),
24
27
  responses: {
25
28
  200: IPaginatedIssuerPaymentMethod,
26
29
  401: UnauthorizedError,
@@ -1,16 +1,19 @@
1
1
  import { initContract } from '@ts-rest/core';
2
+ import { z } from 'zod';
2
3
  import {
3
- BadRequestError,
4
+ UnauthorizedError,
4
5
  ForbiddenError,
5
- InternalError,
6
6
  NotFoundError,
7
- UnauthorizedError,
7
+ userIdSchema,
8
+ BadRequestError,
9
+ InternalError,
8
10
  } from '../../../common/types';
9
11
  import {
10
- CompliancePostPaymentMethod,
11
- PaymentMethodFilterQuery,
12
- PaymentMethodResponse,
13
12
  PaymentMethodResponseArray,
13
+ PaymentMethodResponse,
14
+ PostPaymentMethod,
15
+ PostSetupIntentBody,
16
+ SetupIntentResponse,
14
17
  } from '../../../common/types/payment-methods.types';
15
18
 
16
19
  const c = initContract();
@@ -18,13 +21,15 @@ const c = initContract();
18
21
  export const paymentMethodsContract = c.router(
19
22
  {
20
23
  getPaymentMethods: {
21
- summary: 'get payment methods',
24
+ summary: 'Get payment methods for a user',
22
25
  method: 'GET',
23
- path: '/',
26
+ path: '',
24
27
  metadata: {
25
28
  auth: true,
26
29
  },
27
- query: PaymentMethodFilterQuery,
30
+ query: z.object({
31
+ userId: userIdSchema,
32
+ }),
28
33
  responses: {
29
34
  200: PaymentMethodResponseArray,
30
35
  401: UnauthorizedError,
@@ -34,13 +39,16 @@ export const paymentMethodsContract = c.router(
34
39
  },
35
40
  },
36
41
  createPaymentMethod: {
37
- summary: 'POST payment methods',
42
+ summary: 'Create payment method for a user',
38
43
  method: 'POST',
39
- path: '/',
44
+ path: '',
40
45
  metadata: {
41
46
  auth: true,
42
47
  },
43
- body: CompliancePostPaymentMethod,
48
+ query: z.object({
49
+ userId: userIdSchema,
50
+ }),
51
+ body: PostPaymentMethod,
44
52
  responses: {
45
53
  201: PaymentMethodResponse,
46
54
  400: BadRequestError,
@@ -50,6 +58,26 @@ export const paymentMethodsContract = c.router(
50
58
  500: InternalError,
51
59
  },
52
60
  },
61
+ createSetupIntent: {
62
+ summary: 'Create payment method setup intent for a user',
63
+ method: 'POST',
64
+ path: '/intent',
65
+ metadata: {
66
+ auth: true,
67
+ },
68
+ query: z.object({
69
+ userId: userIdSchema,
70
+ }),
71
+ body: PostSetupIntentBody,
72
+ responses: {
73
+ 201: SetupIntentResponse,
74
+ 400: BadRequestError,
75
+ 401: UnauthorizedError,
76
+ 403: ForbiddenError,
77
+ 404: NotFoundError,
78
+ 500: InternalError,
79
+ },
80
+ },
53
81
  },
54
82
  {
55
83
  pathPrefix: 'payment-methods',
@@ -1,42 +1,25 @@
1
1
  import { initContract } from '@ts-rest/core';
2
+ import { z } from 'zod';
2
3
  import {
3
4
  BadRequestError,
4
5
  ForbiddenError,
5
6
  InternalError,
6
7
  NotFoundError,
7
8
  UnauthorizedError,
9
+ userIdSchema,
8
10
  } from '../../../common/types';
9
11
  import {
10
- TradeLineItemParams,
11
12
  PostTradeLineItem,
13
+ TradeLineItemParams,
12
14
  TradeLineItemQuery,
13
15
  TradeLineItemResponse,
14
16
  TradeLineItemUpdate,
15
- TradeLineItemSignStatusUpdate,
16
- } from '../../../common/types/trade-line-item.type';
17
+ } from '../../../common/types/trade-line-item.types';
17
18
 
18
19
  const c = initContract();
19
20
 
20
21
  export const tradeLineItemsContract = c.router(
21
22
  {
22
- updateTradeLineItem: {
23
- summary: 'Update Trade Line Item - Can delete if you pass quantity = 0',
24
- method: 'PATCH',
25
- path: '/:id',
26
- metadata: {
27
- auth: true,
28
- },
29
- pathParams: TradeLineItemParams,
30
- body: TradeLineItemUpdate,
31
- responses: {
32
- 200: TradeLineItemResponse,
33
- 401: UnauthorizedError,
34
- 403: ForbiddenError,
35
- 404: NotFoundError,
36
- 500: InternalError,
37
- 400: BadRequestError,
38
- },
39
- },
40
23
  postTradeLineItem: {
41
24
  summary: 'Create Trade Line Item',
42
25
  method: 'POST',
@@ -45,7 +28,11 @@ export const tradeLineItemsContract = c.router(
45
28
  auth: true,
46
29
  },
47
30
  body: PostTradeLineItem,
48
- query: TradeLineItemQuery,
31
+ query: TradeLineItemQuery.merge(
32
+ z.object({
33
+ userId: userIdSchema,
34
+ }),
35
+ ),
49
36
  responses: {
50
37
  201: TradeLineItemResponse,
51
38
  401: UnauthorizedError,
@@ -54,18 +41,22 @@ export const tradeLineItemsContract = c.router(
54
41
  500: InternalError,
55
42
  },
56
43
  },
57
- updateLineItemSignatureStatus: {
58
- summary: 'Update Trade Signature Status',
44
+ updateTradeLineItem: {
45
+ summary: 'Update Trade Line Item - Can delete if you pass quantity = 0',
59
46
  method: 'PATCH',
60
- path: '/:id/sign',
61
- metadata: { auth: true },
62
- body: TradeLineItemSignStatusUpdate,
47
+ path: '/:id',
48
+ metadata: {
49
+ auth: true,
50
+ },
51
+ pathParams: TradeLineItemParams,
52
+ body: TradeLineItemUpdate,
63
53
  responses: {
64
54
  200: TradeLineItemResponse,
65
55
  401: UnauthorizedError,
66
56
  403: ForbiddenError,
67
- 400: BadRequestError,
57
+ 404: NotFoundError,
68
58
  500: InternalError,
59
+ 400: BadRequestError,
69
60
  },
70
61
  },
71
62
  },
@@ -16,13 +16,17 @@ import {
16
16
  tradeIdOrTidSchema,
17
17
  TradesIncludeQuery,
18
18
  TradeZod,
19
+ PostAttachSubdocBody,
20
+ PutAttachSubdocBody,
21
+ PatchSubdocSignatureBody,
22
+ AttachSubdocResponse,
19
23
  } from '../../../common/types/trade.types';
20
24
  import { z } from 'zod';
21
25
  import {
22
26
  PostTradeLineItem,
23
27
  TradeLineItemQuery,
24
28
  TradeLineItemResponse,
25
- } from '../../../common/types/trade-line-item.type';
29
+ } from '../../../common/types/trade-line-item.types';
26
30
 
27
31
  const c = initContract();
28
32
 
@@ -115,6 +119,66 @@ export const tradesContract = c.router(
115
119
  500: InternalError,
116
120
  },
117
121
  },
122
+ postAttachSubdoc: {
123
+ summary: 'Attach subdoc to trade',
124
+ method: 'POST',
125
+ path: '/:id/attach-subdoc',
126
+ pathParams: z.object({
127
+ id: tradeIdOrTidSchema,
128
+ }),
129
+ metadata: {
130
+ auth: true,
131
+ },
132
+ body: PostAttachSubdocBody,
133
+ responses: {
134
+ 200: AttachSubdocResponse,
135
+ 400: BadRequestError,
136
+ 401: UnauthorizedError,
137
+ 403: ForbiddenError,
138
+ 404: NotFoundError,
139
+ 500: InternalError,
140
+ },
141
+ },
142
+ putAttachSubdoc: {
143
+ summary: 'Update attached subdoc for trade',
144
+ method: 'PUT',
145
+ path: '/:id/attach-subdoc',
146
+ pathParams: z.object({
147
+ id: tradeIdOrTidSchema,
148
+ }),
149
+ metadata: {
150
+ auth: true,
151
+ },
152
+ body: PutAttachSubdocBody,
153
+ responses: {
154
+ 200: AttachSubdocResponse,
155
+ 400: BadRequestError,
156
+ 401: UnauthorizedError,
157
+ 403: ForbiddenError,
158
+ 404: NotFoundError,
159
+ 500: InternalError,
160
+ },
161
+ },
162
+ patchSubdocSign: {
163
+ summary: 'Update subdoc signature statuses for trade',
164
+ method: 'PATCH',
165
+ path: '/:id/sign',
166
+ pathParams: z.object({
167
+ id: tradeIdOrTidSchema,
168
+ }),
169
+ metadata: {
170
+ auth: true,
171
+ },
172
+ body: PatchSubdocSignatureBody,
173
+ responses: {
174
+ 200: AttachSubdocResponse,
175
+ 400: BadRequestError,
176
+ 401: UnauthorizedError,
177
+ 403: ForbiddenError,
178
+ 404: NotFoundError,
179
+ 500: InternalError,
180
+ },
181
+ },
118
182
  },
119
183
  {
120
184
  pathPrefix: 'trades',
@@ -6,13 +6,13 @@ import {
6
6
  UnauthorizedError,
7
7
  } from '../../../common/types';
8
8
  import {
9
- InvestorPostTransactionZod,
9
+ ClientPostTransactionZod,
10
10
  TransactionZod,
11
11
  } from '../../../common/types/transaction.types';
12
12
 
13
13
  const c = initContract();
14
14
 
15
- export const investorsTransactionsContract = c.router(
15
+ export const clientsTransactionsContract = c.router(
16
16
  {
17
17
  postTransaction: {
18
18
  summary: 'Create a transaction',
@@ -21,7 +21,7 @@ export const investorsTransactionsContract = c.router(
21
21
  metadata: {
22
22
  auth: true,
23
23
  },
24
- body: InvestorPostTransactionZod,
24
+ body: ClientPostTransactionZod,
25
25
  responses: {
26
26
  201: TransactionZod,
27
27
  400: BadRequestError,
package/index.ts ADDED
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @dalmore/api-contracts
3
+ * Main entry point - re-exports clients contract and types
4
+ */
5
+
6
+ // Re-export clients contract
7
+ export * from './contracts/clients/index.js';
8
+
9
+ // Re-export all common types
10
+ export * from './common/types/index.js';
package/package.json CHANGED
@@ -1,48 +1,42 @@
1
1
  {
2
2
  "name": "@dalmore/api-contracts",
3
- "version": "0.0.0-dev.2dc8e92",
3
+ "version": "0.0.0-dev.4bb6b7a",
4
4
  "description": "Type-safe API contracts for Dalmore Client Portal",
5
- "main": "./contracts/index.ts",
6
- "types": "./contracts/index.ts",
5
+ "type": "module",
6
+ "main": "./index.ts",
7
+ "types": "./index.ts",
7
8
  "exports": {
8
9
  ".": {
9
- "types": "./contracts/index.ts",
10
- "default": "./contracts/index.ts"
11
- },
12
- "./compliance": {
13
- "types": "./contracts/compliance/index.ts",
14
- "default": "./contracts/compliance/index.ts"
15
- },
16
- "./investors": {
17
- "types": "./contracts/investors/index.ts",
18
- "default": "./contracts/investors/index.ts"
19
- },
20
- "./issuers": {
21
- "types": "./contracts/issuers/index.ts",
22
- "default": "./contracts/issuers/index.ts"
10
+ "types": "./index.ts",
11
+ "import": "./index.ts",
12
+ "default": "./index.ts"
23
13
  },
24
14
  "./clients": {
25
15
  "types": "./contracts/clients/index.ts",
16
+ "import": "./contracts/clients/index.ts",
26
17
  "default": "./contracts/clients/index.ts"
27
18
  },
28
- "./secondaries": {
29
- "types": "./contracts/secondaries/index.ts",
30
- "default": "./contracts/secondaries/index.ts"
31
- },
32
- "./compliance-apikey": {
33
- "types": "./contracts/compliance-apikey/index.ts",
34
- "default": "./contracts/compliance-apikey/index.ts"
35
- },
36
19
  "./types": {
37
20
  "types": "./common/types/index.ts",
21
+ "import": "./common/types/index.ts",
38
22
  "default": "./common/types/index.ts"
39
- },
40
- "./types/*": {
41
- "types": "./common/types/*.ts",
42
- "default": "./common/types/*.ts"
23
+ }
24
+ },
25
+ "typesVersions": {
26
+ "*": {
27
+ ".": [
28
+ "./index.ts"
29
+ ],
30
+ "clients": [
31
+ "./contracts/clients/index.ts"
32
+ ],
33
+ "types": [
34
+ "./common/types/index.ts"
35
+ ]
43
36
  }
44
37
  },
45
38
  "files": [
39
+ "index.ts",
46
40
  "contracts",
47
41
  "common"
48
42
  ],
@@ -68,9 +62,6 @@
68
62
  "typeid-js": "^1.2.0",
69
63
  "zod": "^3.24.4"
70
64
  },
71
- "devDependencies": {
72
- "typescript": "^5.8.3"
73
- },
74
65
  "engines": {
75
66
  "node": ">=24.0.0 <25.0.0"
76
67
  }