@dalmore/api-contracts 0.0.0-dev.0fb0042 → 0.0.0-dev.15e31bc

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 (43) hide show
  1. package/common/types/account-contact.types.ts +2 -1
  2. package/common/types/account-manager.types.ts +3 -7
  3. package/common/types/account-setting.types.ts +65 -0
  4. package/common/types/account.types.ts +1 -0
  5. package/common/types/auth.types.ts +7 -18
  6. package/common/types/bonus-tier.types.ts +33 -0
  7. package/common/types/common.types.ts +32 -6
  8. package/common/types/contact-us.types.ts +6 -2
  9. package/common/types/covered-person.types.ts +2 -1
  10. package/common/types/dashboard.types.ts +2 -9
  11. package/common/types/escrow-account.types.ts +3 -3
  12. package/common/types/individuals.types.ts +3 -2
  13. package/common/types/investor-account.types.ts +2 -1
  14. package/common/types/invite.types.ts +27 -1
  15. package/common/types/issuer-offering.types.ts +11 -17
  16. package/common/types/legal-entity.types.ts +3 -2
  17. package/common/types/notification.types.ts +515 -29
  18. package/common/types/offering.types.ts +2 -9
  19. package/common/types/site-settings.types.ts +2 -1
  20. package/common/types/site.types.ts +2 -9
  21. package/common/types/{trade-line-item.type.ts → trade-line-item.types.ts} +2 -9
  22. package/common/types/trade.types.ts +48 -2
  23. package/common/types/trusted-contact.types.ts +7 -7
  24. package/common/types/user.types.ts +11 -32
  25. package/contracts/clients/trade-line-items/index.ts +1 -1
  26. package/contracts/clients/trades/index.ts +1 -1
  27. package/contracts/compliance/account-settings/index.ts +59 -0
  28. package/contracts/compliance/auth/index.ts +4 -3
  29. package/contracts/compliance/bonus-tiers/index.ts +21 -2
  30. package/contracts/compliance/index.ts +4 -0
  31. package/contracts/compliance/invites/index.ts +4 -12
  32. package/contracts/compliance/notification-channels/index.ts +251 -0
  33. package/contracts/compliance/trade-line-items/index.ts +1 -1
  34. package/contracts/compliance/trades/index.ts +19 -0
  35. package/contracts/investors/bonus-tiers/index.ts +18 -0
  36. package/contracts/investors/trade-line-items/index.ts +1 -1
  37. package/contracts/issuers/account-settings/index.ts +36 -0
  38. package/contracts/issuers/auth/index.ts +4 -3
  39. package/contracts/issuers/bonus-tiers/index.ts +18 -0
  40. package/contracts/issuers/disbursements/index.ts +17 -17
  41. package/contracts/issuers/index.ts +4 -0
  42. package/contracts/issuers/notification-channels/index.ts +251 -0
  43. package/package.json +1 -1
@@ -0,0 +1,251 @@
1
+ import { initContract } from '@ts-rest/core';
2
+ import { z } from 'zod';
3
+ import {
4
+ CreateChannelInputSchema,
5
+ CreateTriggerInputSchema,
6
+ IAvailableTriggersResponse,
7
+ INotificationChannelTriggerZod,
8
+ INotificationChannelZod,
9
+ INotificationRecordZod,
10
+ IPaginatedNotificationChannel,
11
+ IPaginatedNotificationRecord,
12
+ NotificationChannelFilters,
13
+ NotificationChannelsIncludeQuery,
14
+ notificationChannelIdSchema,
15
+ notificationChannelTriggerIdSchema,
16
+ NotificationRecordFilters,
17
+ NotificationRecordsIncludeQuery,
18
+ notificationRecordIdSchema,
19
+ UpdateChannelInputSchema,
20
+ } from '../../../common/types/notification.types';
21
+ import {
22
+ BadRequestError,
23
+ InternalError,
24
+ NotFoundError,
25
+ PaginationOptionsZod,
26
+ UnauthorizedError,
27
+ } from '../../../common/types';
28
+
29
+ const c = initContract();
30
+
31
+ export const notificationChannelsContract = c.router(
32
+ {
33
+ getChannels: {
34
+ summary: 'Get notification channels',
35
+ method: 'GET',
36
+ path: '',
37
+ metadata: {
38
+ auth: true,
39
+ },
40
+ query: PaginationOptionsZod.merge(NotificationChannelFilters).merge(
41
+ NotificationChannelsIncludeQuery,
42
+ ),
43
+ responses: {
44
+ 200: IPaginatedNotificationChannel,
45
+ 401: UnauthorizedError,
46
+ 500: InternalError,
47
+ },
48
+ },
49
+ getChannel: {
50
+ summary: 'Get notification channel by id',
51
+ method: 'GET',
52
+ path: '/:id',
53
+ metadata: {
54
+ auth: true,
55
+ },
56
+ pathParams: z.object({
57
+ id: notificationChannelIdSchema,
58
+ }),
59
+ query: z.object({}).merge(NotificationChannelsIncludeQuery),
60
+ responses: {
61
+ 200: INotificationChannelZod,
62
+ 401: UnauthorizedError,
63
+ 404: NotFoundError,
64
+ 500: InternalError,
65
+ },
66
+ },
67
+ createChannel: {
68
+ summary: 'Create notification channel',
69
+ method: 'POST',
70
+ path: '',
71
+ metadata: {
72
+ auth: true,
73
+ },
74
+ body: CreateChannelInputSchema,
75
+ responses: {
76
+ 201: INotificationChannelZod,
77
+ 400: BadRequestError,
78
+ 401: UnauthorizedError,
79
+ 500: InternalError,
80
+ },
81
+ },
82
+ updateChannel: {
83
+ summary: 'Update notification channel',
84
+ method: 'PATCH',
85
+ path: '/:id',
86
+ metadata: {
87
+ auth: true,
88
+ },
89
+ pathParams: z.object({
90
+ id: notificationChannelIdSchema,
91
+ }),
92
+ body: UpdateChannelInputSchema,
93
+ responses: {
94
+ 200: INotificationChannelZod,
95
+ 400: BadRequestError,
96
+ 401: UnauthorizedError,
97
+ 404: NotFoundError,
98
+ 500: InternalError,
99
+ },
100
+ },
101
+ deleteChannel: {
102
+ summary: 'Delete notification channel',
103
+ method: 'DELETE',
104
+ path: '/:id',
105
+ metadata: {
106
+ auth: true,
107
+ },
108
+ pathParams: z.object({
109
+ id: notificationChannelIdSchema,
110
+ }),
111
+ body: z.object({}),
112
+ responses: {
113
+ 200: z.object({ success: z.boolean() }),
114
+ 401: UnauthorizedError,
115
+ 404: NotFoundError,
116
+ 500: InternalError,
117
+ },
118
+ },
119
+ createTrigger: {
120
+ summary: 'Create notification channel trigger',
121
+ method: 'POST',
122
+ path: '/:id/triggers',
123
+ metadata: {
124
+ auth: true,
125
+ },
126
+ pathParams: z.object({
127
+ id: notificationChannelIdSchema,
128
+ }),
129
+ body: CreateTriggerInputSchema.omit({ notificationChannelId: true }),
130
+ responses: {
131
+ 201: INotificationChannelTriggerZod,
132
+ 400: BadRequestError,
133
+ 401: UnauthorizedError,
134
+ 404: NotFoundError,
135
+ 500: InternalError,
136
+ },
137
+ },
138
+ getAvailableTriggers: {
139
+ summary: 'Get all available triggers for a channel',
140
+ method: 'GET',
141
+ path: '/:id/triggers/available',
142
+ metadata: {
143
+ auth: true,
144
+ },
145
+ pathParams: z.object({
146
+ id: notificationChannelIdSchema,
147
+ }),
148
+ responses: {
149
+ 200: IAvailableTriggersResponse,
150
+ 401: UnauthorizedError,
151
+ 404: NotFoundError,
152
+ 500: InternalError,
153
+ },
154
+ },
155
+ updateTrigger: {
156
+ summary: 'Update notification channel trigger',
157
+ method: 'PATCH',
158
+ path: '/:id/triggers/:triggerId',
159
+ metadata: {
160
+ auth: true,
161
+ },
162
+ pathParams: z.object({
163
+ id: notificationChannelIdSchema,
164
+ triggerId: notificationChannelTriggerIdSchema,
165
+ }),
166
+ body: z.object({ enabled: z.boolean() }),
167
+ responses: {
168
+ 200: INotificationChannelTriggerZod,
169
+ 400: BadRequestError,
170
+ 401: UnauthorizedError,
171
+ 404: NotFoundError,
172
+ 500: InternalError,
173
+ },
174
+ },
175
+ deleteTrigger: {
176
+ summary: 'Delete notification channel trigger',
177
+ method: 'DELETE',
178
+ path: '/:id/triggers/:triggerId',
179
+ metadata: {
180
+ auth: true,
181
+ },
182
+ pathParams: z.object({
183
+ id: notificationChannelIdSchema,
184
+ triggerId: notificationChannelTriggerIdSchema,
185
+ }),
186
+ body: z.object({}),
187
+ responses: {
188
+ 200: z.object({ success: z.boolean() }),
189
+ 401: UnauthorizedError,
190
+ 404: NotFoundError,
191
+ 500: InternalError,
192
+ },
193
+ },
194
+ getRecords: {
195
+ summary: 'Get notification records',
196
+ method: 'GET',
197
+ path: '/records',
198
+ metadata: {
199
+ auth: true,
200
+ },
201
+ query: PaginationOptionsZod.merge(NotificationRecordFilters).merge(
202
+ NotificationRecordsIncludeQuery,
203
+ ),
204
+ responses: {
205
+ 200: IPaginatedNotificationRecord,
206
+ 401: UnauthorizedError,
207
+ 500: InternalError,
208
+ },
209
+ },
210
+ getRecord: {
211
+ summary: 'Get notification record by id',
212
+ method: 'GET',
213
+ path: '/records/:recordId',
214
+ metadata: {
215
+ auth: true,
216
+ },
217
+ pathParams: z.object({
218
+ recordId: notificationRecordIdSchema,
219
+ }),
220
+ query: z.object({}).merge(NotificationRecordsIncludeQuery),
221
+ responses: {
222
+ 200: INotificationRecordZod,
223
+ 401: UnauthorizedError,
224
+ 404: NotFoundError,
225
+ 500: InternalError,
226
+ },
227
+ },
228
+ retryRecord: {
229
+ summary: 'Retry failed notification record',
230
+ method: 'POST',
231
+ path: '/records/:recordId/retry',
232
+ metadata: {
233
+ auth: true,
234
+ },
235
+ pathParams: z.object({
236
+ recordId: notificationRecordIdSchema,
237
+ }),
238
+ body: z.object({}),
239
+ responses: {
240
+ 200: INotificationRecordZod,
241
+ 400: BadRequestError,
242
+ 401: UnauthorizedError,
243
+ 404: NotFoundError,
244
+ 500: InternalError,
245
+ },
246
+ },
247
+ },
248
+ {
249
+ pathPrefix: 'notification-channels',
250
+ },
251
+ );
@@ -13,7 +13,7 @@ import {
13
13
  ReviewTradeLineItemStatus,
14
14
  TradeLineItemFiltersQuery,
15
15
  TradeLineItemResponse,
16
- } from '../../../common/types/trade-line-item.type';
16
+ } from '../../../common/types/trade-line-item.types';
17
17
 
18
18
  import { z } from 'zod';
19
19
  const c = initContract();
@@ -23,6 +23,7 @@ import {
23
23
  ExportTradesQuery,
24
24
  CancelTradeResponse,
25
25
  ComplianceCancelTradeZod,
26
+ GetTradeSnapshotEventsResponse,
26
27
  } from '../../../common/types';
27
28
  import { z } from 'zod';
28
29
 
@@ -48,6 +49,24 @@ export const tradesContract = c.router(
48
49
  500: InternalError,
49
50
  },
50
51
  },
52
+ getTradeSnapshotEvents: {
53
+ summary: 'Get trade snapshot events',
54
+ method: 'GET',
55
+ path: '/:id/snapshot-events',
56
+ metadata: {
57
+ auth: true,
58
+ },
59
+ pathParams: z.object({
60
+ id: tradeIdSchema,
61
+ }),
62
+ responses: {
63
+ 200: GetTradeSnapshotEventsResponse,
64
+ 401: UnauthorizedError,
65
+ 404: NotFoundError,
66
+ 403: ForbiddenError,
67
+ 500: InternalError,
68
+ },
69
+ },
51
70
  getTrade: {
52
71
  summary: 'Get trade by id',
53
72
  method: 'GET',
@@ -8,6 +8,8 @@ import {
8
8
  import {
9
9
  EstimateBonusTierCalculationResponseZod,
10
10
  EstimateBonusTierCalculationZod,
11
+ PurchaseCalculationResponseZod,
12
+ PurchaseCalculationZod,
11
13
  } from '../../../common/types/bonus-tier.types';
12
14
 
13
15
  const c = initContract();
@@ -30,6 +32,22 @@ export const bonusTiersContract = c.router(
30
32
  500: InternalError,
31
33
  },
32
34
  },
35
+ purchaseCalculation: {
36
+ summary: 'Calculate the bonus shares that would be awarded for a trade',
37
+ method: 'POST',
38
+ path: '/purchase-calculation',
39
+ metadata: {
40
+ auth: true,
41
+ },
42
+ body: PurchaseCalculationZod,
43
+ responses: {
44
+ 200: PurchaseCalculationResponseZod,
45
+ 400: BadRequestError,
46
+ 401: UnauthorizedError,
47
+ 403: ForbiddenError,
48
+ 500: InternalError,
49
+ },
50
+ },
33
51
  },
34
52
  {
35
53
  pathPrefix: 'bonus-tiers',
@@ -13,7 +13,7 @@ import {
13
13
  TradeLineItemResponse,
14
14
  TradeLineItemUpdate,
15
15
  TradeLineItemSignStatusUpdate,
16
- } from '../../../common/types/trade-line-item.type';
16
+ } from '../../../common/types/trade-line-item.types';
17
17
 
18
18
  const c = initContract();
19
19
 
@@ -0,0 +1,36 @@
1
+ import { initContract } from '@ts-rest/core';
2
+ import { z } from 'zod';
3
+ import {
4
+ AccountSettingsIncludeQuery,
5
+ IAccountSettingZod,
6
+ } from '../../../common/types/account-setting.types';
7
+ import {
8
+ InternalError,
9
+ NotFoundError,
10
+ UnauthorizedError,
11
+ } from '../../../common/types';
12
+
13
+ const c = initContract();
14
+
15
+ export const issuerAccountSettingsContract = c.router(
16
+ {
17
+ getAccountSettings: {
18
+ summary: 'Get account settings for current account',
19
+ method: 'GET',
20
+ path: '',
21
+ metadata: {
22
+ auth: true,
23
+ },
24
+ query: z.object({}).merge(AccountSettingsIncludeQuery),
25
+ responses: {
26
+ 200: IAccountSettingZod,
27
+ 401: UnauthorizedError,
28
+ 404: NotFoundError,
29
+ 500: InternalError,
30
+ },
31
+ },
32
+ },
33
+ {
34
+ pathPrefix: 'account-settings',
35
+ },
36
+ );
@@ -13,6 +13,7 @@ import {
13
13
  SelectAccountIssuersResponse,
14
14
  SwitchAccountIssuersBody,
15
15
  UnauthorizedError,
16
+ EmailSchema,
16
17
  } from '../../../common/types';
17
18
  import { z } from 'zod';
18
19
 
@@ -78,7 +79,7 @@ export const authContract = c.router(
78
79
  method: 'POST',
79
80
  path: 'forgot-password',
80
81
  body: z.object({
81
- email: z.string().email(),
82
+ email: EmailSchema,
82
83
  }),
83
84
  responses: {
84
85
  200: z.string(),
@@ -92,7 +93,7 @@ export const authContract = c.router(
92
93
  method: 'POST',
93
94
  path: 'reset-password/verify',
94
95
  body: z.object({
95
- email: z.string().email(),
96
+ email: EmailSchema,
96
97
  code: z.string(),
97
98
  }),
98
99
  responses: {
@@ -108,7 +109,7 @@ export const authContract = c.router(
108
109
  method: 'POST',
109
110
  path: 'reset-password',
110
111
  body: z.object({
111
- email: z.string().email(),
112
+ email: EmailSchema,
112
113
  code: z.string(),
113
114
  password: z.string().min(6),
114
115
  }),
@@ -10,6 +10,8 @@ import {
10
10
  EstimateBonusTierCalculationZod,
11
11
  IBonusTierList,
12
12
  PostBonusTierZod,
13
+ PurchaseCalculationResponseZod,
14
+ PurchaseCalculationZod,
13
15
  } from '../../../common/types/bonus-tier.types';
14
16
 
15
17
  const c = initContract();
@@ -32,6 +34,22 @@ export const bonusTiersContract = c.router(
32
34
  500: InternalError,
33
35
  },
34
36
  },
37
+ purchaseCalculation: {
38
+ summary: 'Calculate the bonus shares that would be awarded for a trade',
39
+ method: 'POST',
40
+ path: '/purchase-calculation',
41
+ metadata: {
42
+ auth: true,
43
+ },
44
+ body: PurchaseCalculationZod,
45
+ responses: {
46
+ 200: PurchaseCalculationResponseZod,
47
+ 400: BadRequestError,
48
+ 401: UnauthorizedError,
49
+ 403: ForbiddenError,
50
+ 500: InternalError,
51
+ },
52
+ },
35
53
  postBonusTier: {
36
54
  summary: 'Create a new bonus tier',
37
55
  method: 'POST',
@@ -117,23 +117,6 @@ export const disbursementsContract = c.router(
117
117
  },
118
118
  },
119
119
 
120
- getDisbursement: {
121
- summary: 'Get disbursement by id',
122
- method: 'GET',
123
- path: '/:id',
124
- metadata: {
125
- auth: true,
126
- },
127
- query: z.object({}).merge(DisbursementsIncludeQuery),
128
- pathParams: z.object({ id: disbursementIdSchema }),
129
- responses: {
130
- 200: DisbursementZod,
131
- 401: UnauthorizedError,
132
- 403: ForbiddenError,
133
- 404: NotFoundError,
134
- 500: InternalError,
135
- },
136
- },
137
120
  reviewDisbursements: {
138
121
  summary: 'Review Disbursements',
139
122
  method: 'POST',
@@ -182,6 +165,23 @@ export const disbursementsContract = c.router(
182
165
  500: InternalError,
183
166
  },
184
167
  },
168
+ getDisbursement: {
169
+ summary: 'Get disbursement by id',
170
+ method: 'GET',
171
+ path: '/:id',
172
+ metadata: {
173
+ auth: true,
174
+ },
175
+ query: z.object({}).merge(DisbursementsIncludeQuery),
176
+ pathParams: z.object({ id: disbursementIdSchema }),
177
+ responses: {
178
+ 200: DisbursementZod,
179
+ 401: UnauthorizedError,
180
+ 403: ForbiddenError,
181
+ 404: NotFoundError,
182
+ 500: InternalError,
183
+ },
184
+ },
185
185
  },
186
186
  {
187
187
  pathPrefix: 'disbursements',
@@ -2,7 +2,9 @@ import { initContract } from '@ts-rest/core';
2
2
  import { accountsContract } from './accounts';
3
3
  import { accountContactsContract } from './account-contacts';
4
4
  import { accountIntegrationsContract } from './account-integrations';
5
+ import { issuerAccountSettingsContract } from './account-settings';
5
6
  import { assetsContract } from './assets';
7
+ import { issuerNotificationChannelsContract } from './notification-channels';
6
8
  import { healthContract } from './health';
7
9
  import { issuerContract } from './issuer';
8
10
  import { authContract } from './auth';
@@ -57,6 +59,7 @@ export const issuersContract = c.router(
57
59
  accounts: accountsContract,
58
60
  accountContacts: accountContactsContract,
59
61
  accountIntegrations: accountIntegrationsContract,
62
+ accountSettings: issuerAccountSettingsContract,
60
63
  activities: activitiesContract,
61
64
  aic: aicContract,
62
65
  assets: assetsContract,
@@ -86,6 +89,7 @@ export const issuersContract = c.router(
86
89
  kycs: kycsContract,
87
90
  loginHistories: loginHistoriesContract,
88
91
  notes: issuerNotesContract,
92
+ notificationChannels: issuerNotificationChannelsContract,
89
93
  offerings: issuersOfferingsContract,
90
94
  pages: pagesContract,
91
95
  paymentMethods: paymentMethodsContract,