@dalmore/api-contracts 1.0.3 → 1.0.6

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 (186) hide show
  1. package/README.md +34 -60
  2. package/index.mjs +1001 -18638
  3. package/package.json +5 -53
  4. package/src/common/types/address.spec.ts +203 -0
  5. package/src/common/types/batch-jobs.types.ts +1 -0
  6. package/src/common/types/common.types.spec.ts +336 -0
  7. package/src/common/types/files.types.spec.ts +154 -0
  8. package/src/common/types/issuer-payment-method.types.spec.ts +612 -0
  9. package/src/common/types/offering.types.spec.ts +91 -0
  10. package/src/common/types/phone.spec.ts +76 -0
  11. package/src/common/types/queue.types.ts +1 -0
  12. package/src/common/types/reminder-config.types.ts +40 -0
  13. package/src/common/types/site-link.types.spec.ts +134 -0
  14. package/src/common/types/trade.types.ts +2 -4
  15. package/clients/index.mjs +0 -10970
  16. package/compliance/index.mjs +0 -20016
  17. package/compliance-apikey/index.mjs +0 -9795
  18. package/helpers/index.mjs +0 -146
  19. package/investors/index.mjs +0 -12844
  20. package/issuers/index.mjs +0 -16168
  21. package/secondaries/index.mjs +0 -10282
  22. package/src/common/helpers/index.ts +0 -205
  23. package/src/contracts/compliance/account-contacts/index.ts +0 -82
  24. package/src/contracts/compliance/account-managers/index.ts +0 -142
  25. package/src/contracts/compliance/accounts/index.ts +0 -187
  26. package/src/contracts/compliance/activities/index.ts +0 -55
  27. package/src/contracts/compliance/aic/index.ts +0 -60
  28. package/src/contracts/compliance/api-keys/index.ts +0 -91
  29. package/src/contracts/compliance/assets/index.ts +0 -122
  30. package/src/contracts/compliance/auth/index.ts +0 -134
  31. package/src/contracts/compliance/batch-jobs/index.ts +0 -62
  32. package/src/contracts/compliance/bonus-tiers/index.ts +0 -55
  33. package/src/contracts/compliance/checklist/index.ts +0 -87
  34. package/src/contracts/compliance/checklist-items/index.ts +0 -86
  35. package/src/contracts/compliance/covered-persons/index.ts +0 -97
  36. package/src/contracts/compliance/dashboard/index.ts +0 -111
  37. package/src/contracts/compliance/data-records/index.ts +0 -116
  38. package/src/contracts/compliance/data-rooms/index.ts +0 -113
  39. package/src/contracts/compliance/default-theme-configs/index.ts +0 -95
  40. package/src/contracts/compliance/disbursement/index.ts +0 -165
  41. package/src/contracts/compliance/disbursement-approval-users/index.ts +0 -84
  42. package/src/contracts/compliance/disbursement-transactions/index.ts +0 -37
  43. package/src/contracts/compliance/domain-filters/index.ts +0 -117
  44. package/src/contracts/compliance/email-themes/index.ts +0 -284
  45. package/src/contracts/compliance/escrow-accounts/index.ts +0 -85
  46. package/src/contracts/compliance/exchange-api-keys/index.ts +0 -129
  47. package/src/contracts/compliance/exchange-imports/index.ts +0 -137
  48. package/src/contracts/compliance/files/index.ts +0 -267
  49. package/src/contracts/compliance/files-public/index.ts +0 -188
  50. package/src/contracts/compliance/health/index.ts +0 -26
  51. package/src/contracts/compliance/index.ts +0 -147
  52. package/src/contracts/compliance/individuals/index.ts +0 -57
  53. package/src/contracts/compliance/investor-accounts/index.ts +0 -141
  54. package/src/contracts/compliance/invites/index.ts +0 -137
  55. package/src/contracts/compliance/issuer-bank-accounts/index.ts +0 -81
  56. package/src/contracts/compliance/issuer-payment-methods/index.ts +0 -81
  57. package/src/contracts/compliance/issuers/index.ts +0 -97
  58. package/src/contracts/compliance/job-items/index.ts +0 -58
  59. package/src/contracts/compliance/jobs/index.ts +0 -59
  60. package/src/contracts/compliance/kyb/index.ts +0 -54
  61. package/src/contracts/compliance/kyc/index.ts +0 -77
  62. package/src/contracts/compliance/legal-entities/index.ts +0 -57
  63. package/src/contracts/compliance/login-histories/index.ts +0 -37
  64. package/src/contracts/compliance/notes/index.ts +0 -69
  65. package/src/contracts/compliance/notion-databases/index.ts +0 -107
  66. package/src/contracts/compliance/notion-pages/index.ts +0 -105
  67. package/src/contracts/compliance/offering-reports/index.ts +0 -149
  68. package/src/contracts/compliance/offerings/index.ts +0 -233
  69. package/src/contracts/compliance/pages/index.ts +0 -178
  70. package/src/contracts/compliance/payment-methods/index.ts +0 -57
  71. package/src/contracts/compliance/rejection-reasons/index.ts +0 -32
  72. package/src/contracts/compliance/review/index.ts +0 -169
  73. package/src/contracts/compliance/roles/index.ts +0 -34
  74. package/src/contracts/compliance/secondary-customers/index.ts +0 -77
  75. package/src/contracts/compliance/secondary-orders/index.ts +0 -60
  76. package/src/contracts/compliance/secondary-trades/index.ts +0 -100
  77. package/src/contracts/compliance/secure-requests/index.ts +0 -54
  78. package/src/contracts/compliance/signer/index.ts +0 -369
  79. package/src/contracts/compliance/site-links/index.ts +0 -128
  80. package/src/contracts/compliance/site-settings/index.ts +0 -669
  81. package/src/contracts/compliance/sites/index.ts +0 -56
  82. package/src/contracts/compliance/state-machine/index.ts +0 -94
  83. package/src/contracts/compliance/tasks/index.ts +0 -91
  84. package/src/contracts/compliance/third-parties/index.ts +0 -52
  85. package/src/contracts/compliance/trade-line-items/index.ts +0 -59
  86. package/src/contracts/compliance/trades/index.ts +0 -230
  87. package/src/contracts/compliance/transactions/index.ts +0 -161
  88. package/src/contracts/compliance/user-manuals/index.ts +0 -271
  89. package/src/contracts/compliance/user-settings/index.ts +0 -189
  90. package/src/contracts/compliance/users/index.ts +0 -200
  91. package/src/contracts/compliance/webhooks/index.ts +0 -41
  92. package/src/contracts/compliance-apikey/accounts/index.ts +0 -58
  93. package/src/contracts/compliance-apikey/index.ts +0 -14
  94. package/src/contracts/index.ts +0 -6
  95. package/src/contracts/investors/account-contacts/index.ts +0 -58
  96. package/src/contracts/investors/aic/index.ts +0 -59
  97. package/src/contracts/investors/assets/index.ts +0 -61
  98. package/src/contracts/investors/auth/index.ts +0 -116
  99. package/src/contracts/investors/bonus-tiers/index.ts +0 -37
  100. package/src/contracts/investors/cart/index.ts +0 -75
  101. package/src/contracts/investors/contact-us/index.ts +0 -48
  102. package/src/contracts/investors/data-records/index.ts +0 -113
  103. package/src/contracts/investors/data-rooms/index.ts +0 -96
  104. package/src/contracts/investors/files/index.ts +0 -167
  105. package/src/contracts/investors/files-public/index.ts +0 -185
  106. package/src/contracts/investors/index.ts +0 -72
  107. package/src/contracts/investors/individuals/index.ts +0 -99
  108. package/src/contracts/investors/investor-accounts/index.ts +0 -110
  109. package/src/contracts/investors/issuer-payment-methods/index.ts +0 -36
  110. package/src/contracts/investors/issuers/index.ts +0 -30
  111. package/src/contracts/investors/legal-entities/index.ts +0 -93
  112. package/src/contracts/investors/notes/index.ts +0 -69
  113. package/src/contracts/investors/offerings/index.ts +0 -93
  114. package/src/contracts/investors/pages/index.ts +0 -88
  115. package/src/contracts/investors/payment-methods/index.ts +0 -149
  116. package/src/contracts/investors/portfolios/index.ts +0 -53
  117. package/src/contracts/investors/sites/index.ts +0 -96
  118. package/src/contracts/investors/tasks/index.ts +0 -111
  119. package/src/contracts/investors/trade-line-items/index.ts +0 -75
  120. package/src/contracts/investors/trades/index.ts +0 -114
  121. package/src/contracts/investors/transactions/index.ts +0 -37
  122. package/src/contracts/investors/trusted-contacts/index.ts +0 -93
  123. package/src/contracts/investors/user-manuals/index.ts +0 -62
  124. package/src/contracts/investors/user-settings/index.ts +0 -170
  125. package/src/contracts/investors/users/index.ts +0 -45
  126. package/src/contracts/investors/webhooks/index.ts +0 -30
  127. package/src/contracts/issuers/account-contacts/index.ts +0 -76
  128. package/src/contracts/issuers/account-integrations/index.ts +0 -97
  129. package/src/contracts/issuers/accounts/index.ts +0 -97
  130. package/src/contracts/issuers/activities/index.ts +0 -54
  131. package/src/contracts/issuers/aic/index.ts +0 -39
  132. package/src/contracts/issuers/api-key-logs/index.ts +0 -53
  133. package/src/contracts/issuers/api-keys/index.ts +0 -93
  134. package/src/contracts/issuers/assets/index.ts +0 -122
  135. package/src/contracts/issuers/auth/index.ts +0 -152
  136. package/src/contracts/issuers/bonus-tiers/index.ts +0 -55
  137. package/src/contracts/issuers/contact-us/index.ts +0 -48
  138. package/src/contracts/issuers/covered-persons/index.ts +0 -136
  139. package/src/contracts/issuers/dashboard/index.ts +0 -72
  140. package/src/contracts/issuers/data-records/index.ts +0 -257
  141. package/src/contracts/issuers/data-rooms/index.ts +0 -134
  142. package/src/contracts/issuers/disbursement-approval-users/index.ts +0 -82
  143. package/src/contracts/issuers/disbursement-transactions/index.ts +0 -53
  144. package/src/contracts/issuers/disbursements/index.ts +0 -153
  145. package/src/contracts/issuers/email-themes/index.ts +0 -242
  146. package/src/contracts/issuers/escrow-accounts/index.ts +0 -81
  147. package/src/contracts/issuers/exchange-api-keys/index.ts +0 -144
  148. package/src/contracts/issuers/files/index.ts +0 -166
  149. package/src/contracts/issuers/files-public/index.ts +0 -166
  150. package/src/contracts/issuers/health/index.ts +0 -24
  151. package/src/contracts/issuers/index.ts +0 -112
  152. package/src/contracts/issuers/investor-accounts/index.ts +0 -148
  153. package/src/contracts/issuers/invites/index.ts +0 -129
  154. package/src/contracts/issuers/issuer/index.ts +0 -94
  155. package/src/contracts/issuers/issuer-bank-accounts/index.ts +0 -81
  156. package/src/contracts/issuers/issuer-payment-methods/index.ts +0 -136
  157. package/src/contracts/issuers/kyc/index.ts +0 -38
  158. package/src/contracts/issuers/login-histories/index.ts +0 -51
  159. package/src/contracts/issuers/notes/index.ts +0 -69
  160. package/src/contracts/issuers/offerings/index.ts +0 -206
  161. package/src/contracts/issuers/pages/index.ts +0 -138
  162. package/src/contracts/issuers/payment-methods/index.ts +0 -61
  163. package/src/contracts/issuers/portfolios/index.ts +0 -36
  164. package/src/contracts/issuers/rejection-reasons/index.ts +0 -32
  165. package/src/contracts/issuers/review/index.ts +0 -63
  166. package/src/contracts/issuers/secondary-customers/index.ts +0 -55
  167. package/src/contracts/issuers/secondary-orders/index.ts +0 -57
  168. package/src/contracts/issuers/secondary-trades/index.ts +0 -57
  169. package/src/contracts/issuers/secure-requests/index.ts +0 -34
  170. package/src/contracts/issuers/site-links/index.ts +0 -116
  171. package/src/contracts/issuers/site-settings/index.ts +0 -585
  172. package/src/contracts/issuers/sites/index.ts +0 -32
  173. package/src/contracts/issuers/tasks/index.ts +0 -111
  174. package/src/contracts/issuers/trades/index.ts +0 -132
  175. package/src/contracts/issuers/transactions/index.ts +0 -158
  176. package/src/contracts/issuers/user-manuals/index.ts +0 -62
  177. package/src/contracts/issuers/user-settings/index.ts +0 -170
  178. package/src/contracts/issuers/users/index.ts +0 -126
  179. package/src/contracts/secondaries/accounts/index.ts +0 -58
  180. package/src/contracts/secondaries/index.ts +0 -23
  181. package/src/contracts/secondaries/secondary-customers/index.ts +0 -55
  182. package/src/contracts/secondaries/secondary-issuers/index.ts +0 -94
  183. package/src/contracts/secondaries/secondary-orders/index.ts +0 -56
  184. package/src/contracts/secondaries/secondary-securities/index.ts +0 -95
  185. package/src/contracts/secondaries/secondary-trades/index.ts +0 -56
  186. package/types/index.mjs +0 -10320
@@ -1,271 +0,0 @@
1
- import { initContract } from '@ts-rest/core';
2
- import {
3
- BadRequestError,
4
- ForbiddenError,
5
- InternalError,
6
- NotFoundError,
7
- UnauthorizedError,
8
- } from '../../../common/types';
9
- import {
10
- GetUserManualCategoryZod,
11
- IPaginatedUserManualCategory,
12
- IUserManualCategory,
13
- IUserManualPage,
14
- userManualCategoriesIncludeQuery,
15
- userManualCategorySchema,
16
- userManualPageSchema,
17
- PostUserManualCategoryZod,
18
- PostUserManualPageZod,
19
- PatchUserManualCategoryZod,
20
- PatchUserManualPageZod,
21
- IUserManualPageUrl,
22
- PatchUserManualPageUrlZod,
23
- OrderUserManualCategoriesZod,
24
- UserManualOrderResponseZod,
25
- OrderUserManualPagesZod,
26
- userManualPageUrlSchema,
27
- PostUserManualPageUrlZod,
28
- UserManualsPaginationOptionsZod,
29
- } from '../../../common/types/user-manual.types';
30
- import { z } from 'zod';
31
-
32
- const c = initContract();
33
-
34
- export const userManualsContract = c.router(
35
- {
36
- getUserManualCategories: {
37
- summary: 'Get user manual Categories',
38
- method: 'GET',
39
- path: '/categories',
40
- metadata: {
41
- auth: true,
42
- },
43
- query: UserManualsPaginationOptionsZod.merge(
44
- userManualCategoriesIncludeQuery,
45
- ).merge(GetUserManualCategoryZod),
46
- responses: {
47
- 200: IPaginatedUserManualCategory,
48
- 400: BadRequestError,
49
- 401: UnauthorizedError,
50
- 403: ForbiddenError,
51
- },
52
- },
53
- getUserManualCategory: {
54
- summary: 'Get user manual category',
55
- method: 'GET',
56
- path: '/categories/:id',
57
- metadata: {
58
- auth: true,
59
- },
60
- pathParams: z.object({
61
- id: userManualCategorySchema,
62
- }),
63
- query: z.object({}).merge(userManualCategoriesIncludeQuery),
64
- responses: {
65
- 200: IUserManualCategory,
66
- 400: BadRequestError,
67
- 401: UnauthorizedError,
68
- 403: ForbiddenError,
69
- 404: NotFoundError,
70
- },
71
- },
72
- postUserManualCategory: {
73
- summary: '[ADMIN] Create user manual category',
74
- method: 'POST',
75
- path: '/categories',
76
- metadata: {
77
- auth: true,
78
- },
79
- body: PostUserManualCategoryZod,
80
- responses: {
81
- 201: IUserManualCategory,
82
- 400: BadRequestError,
83
- 401: UnauthorizedError,
84
- 403: ForbiddenError,
85
- 500: InternalError,
86
- },
87
- },
88
- patchUserManualCategory: {
89
- summary: '[ADMIN] Update user manual category',
90
- method: 'PATCH',
91
- path: '/categories/:id',
92
- metadata: {
93
- auth: true,
94
- },
95
- pathParams: z.object({
96
- id: userManualCategorySchema,
97
- }),
98
- body: PatchUserManualCategoryZod,
99
- responses: {
100
- 200: IUserManualCategory,
101
- 400: BadRequestError,
102
- 401: UnauthorizedError,
103
- 403: ForbiddenError,
104
- 404: NotFoundError,
105
- 500: InternalError,
106
- },
107
- },
108
- deleteUserManualCategory: {
109
- summary: '[ADMIN] Delete user manual category',
110
- method: 'DELETE',
111
- path: '/categories/:id',
112
- metadata: {
113
- auth: true,
114
- },
115
- pathParams: z.object({
116
- id: userManualCategorySchema,
117
- }),
118
- responses: {
119
- 200: UserManualOrderResponseZod,
120
- 400: BadRequestError,
121
- 401: UnauthorizedError,
122
- 403: ForbiddenError,
123
- 404: NotFoundError,
124
- },
125
- },
126
- patchUserManualCategoriesOrder: {
127
- summary: '[ADMIN] Update user manual categories order',
128
- method: 'PATCH',
129
- path: '/categories/order',
130
- metadata: {
131
- auth: true,
132
- },
133
- body: OrderUserManualCategoriesZod,
134
- responses: {
135
- 200: UserManualOrderResponseZod,
136
- 400: BadRequestError,
137
- 401: UnauthorizedError,
138
- 403: ForbiddenError,
139
- 500: InternalError,
140
- },
141
- },
142
- postUserManualPage: {
143
- summary: '[ADMIN] Create user manual page',
144
- method: 'POST',
145
- path: '/pages',
146
- metadata: {
147
- auth: true,
148
- },
149
- body: PostUserManualPageZod,
150
- responses: {
151
- 201: IUserManualPage,
152
- 400: BadRequestError,
153
- 401: UnauthorizedError,
154
- 403: ForbiddenError,
155
- 500: InternalError,
156
- },
157
- },
158
-
159
- deleteUserManualPage: {
160
- summary: '[ADMIN] Delete user manual page',
161
- method: 'DELETE',
162
- path: '/pages/:id',
163
- metadata: {
164
- auth: true,
165
- },
166
- pathParams: z.object({
167
- id: userManualPageSchema,
168
- }),
169
- responses: {
170
- 200: UserManualOrderResponseZod,
171
- 400: BadRequestError,
172
- 401: UnauthorizedError,
173
- 403: ForbiddenError,
174
- 404: NotFoundError,
175
- },
176
- },
177
- patchUserManualPagesOrder: {
178
- summary: '[ADMIN] Update user manual pages order',
179
- method: 'PATCH',
180
- path: '/pages/order',
181
- metadata: {
182
- auth: true,
183
- },
184
- body: OrderUserManualPagesZod,
185
- responses: {
186
- 200: UserManualOrderResponseZod,
187
- 400: BadRequestError,
188
- 401: UnauthorizedError,
189
- 403: ForbiddenError,
190
- 500: InternalError,
191
- },
192
- },
193
- patchUserManualPage: {
194
- summary: '[ADMIN] Update user manual page',
195
- method: 'PATCH',
196
- path: '/pages/:id',
197
- metadata: {
198
- auth: true,
199
- },
200
- pathParams: z.object({
201
- id: userManualPageSchema,
202
- }),
203
- body: PatchUserManualPageZod,
204
- responses: {
205
- 200: IUserManualPage,
206
- 400: BadRequestError,
207
- 401: UnauthorizedError,
208
- 403: ForbiddenError,
209
- 404: NotFoundError,
210
- 500: InternalError,
211
- },
212
- },
213
- patchUserManualPageUrl: {
214
- summary: '[ADMIN] Update user manual page url',
215
- method: 'PATCH',
216
- path: '/page-urls/:id',
217
- metadata: {
218
- auth: true,
219
- },
220
- pathParams: z.object({
221
- id: userManualPageUrlSchema,
222
- }),
223
- body: PatchUserManualPageUrlZod,
224
- responses: {
225
- 200: IUserManualPageUrl,
226
- 400: BadRequestError,
227
- 401: UnauthorizedError,
228
- 403: ForbiddenError,
229
- 404: NotFoundError,
230
- 500: InternalError,
231
- },
232
- },
233
- postUserManualPageUrl: {
234
- summary: '[ADMIN] Create user manual page url',
235
- method: 'POST',
236
- path: '/page-urls',
237
- metadata: {
238
- auth: true,
239
- },
240
- body: PostUserManualPageUrlZod,
241
- responses: {
242
- 201: IUserManualPageUrl,
243
- 400: BadRequestError,
244
- 401: UnauthorizedError,
245
- 403: ForbiddenError,
246
- 500: InternalError,
247
- },
248
- },
249
- deleteUserManualPageUrl: {
250
- summary: '[ADMIN] Delete user manual page url',
251
- method: 'DELETE',
252
- path: '/page-urls/:id',
253
- metadata: {
254
- auth: true,
255
- },
256
- pathParams: z.object({
257
- id: userManualPageUrlSchema,
258
- }),
259
- responses: {
260
- 200: UserManualOrderResponseZod,
261
- 400: BadRequestError,
262
- 401: UnauthorizedError,
263
- 403: ForbiddenError,
264
- 404: NotFoundError,
265
- },
266
- },
267
- },
268
- {
269
- pathPrefix: 'user-manuals',
270
- },
271
- );
@@ -1,189 +0,0 @@
1
- import { initContract } from '@ts-rest/core';
2
- import {
3
- BadRequestError,
4
- ForbiddenError,
5
- InternalError,
6
- NotFoundError,
7
- UnauthorizedError,
8
- UserZod,
9
- } from '../../../common/types';
10
- import {
11
- disableTwoFactorBody,
12
- sendEmailVerificationBody,
13
- sendEmailVerificationResponse,
14
- sendVerificationCodeBody,
15
- sendVerificationCodeResponse,
16
- setupPhoneNumberBody,
17
- setupPhoneNumberResponse,
18
- setupTwoFactorResponse,
19
- userSettingsZod,
20
- validPhoneNumberBody,
21
- validPhoneNumberResponse,
22
- verifyEmailBody,
23
- verifyEmailResponse,
24
- verifyPhoneNumberBody,
25
- verifyPhoneNumberResponse,
26
- verifyTwoFactorBody,
27
- verifyTwoFactorResponse,
28
- } from '../../../common/types/user-setting.types';
29
-
30
- const c = initContract();
31
-
32
- export const userSettingsContract = c.router(
33
- {
34
- getUserSettings: {
35
- summary: 'Get current user settings',
36
- method: 'GET',
37
- path: '',
38
- metadata: {
39
- auth: true,
40
- },
41
- responses: {
42
- 200: userSettingsZod,
43
- 401: UnauthorizedError,
44
- 404: NotFoundError,
45
- 500: InternalError,
46
- },
47
- },
48
- validPhoneNumber: {
49
- summary: 'Validate phone number',
50
- method: 'POST',
51
- path: '/valid-phone-number',
52
- metadata: {
53
- auth: true,
54
- },
55
- body: validPhoneNumberBody,
56
- responses: {
57
- 200: validPhoneNumberResponse,
58
- 400: BadRequestError,
59
- 401: UnauthorizedError,
60
- 404: NotFoundError,
61
- 500: InternalError,
62
- },
63
- },
64
- setupPhoneNumber: {
65
- summary: 'Setup phone number',
66
- method: 'POST',
67
- path: '/setup-phone-number',
68
- metadata: {
69
- auth: true,
70
- },
71
- body: setupPhoneNumberBody,
72
- responses: {
73
- 200: setupPhoneNumberResponse,
74
- 400: BadRequestError,
75
- 401: UnauthorizedError,
76
- 404: NotFoundError,
77
- 500: InternalError,
78
- },
79
- },
80
- verifyPhoneNumber: {
81
- summary: 'Verify phone number',
82
- method: 'POST',
83
- path: '/verify-phone-number',
84
- metadata: {
85
- auth: true,
86
- },
87
- body: verifyPhoneNumberBody,
88
- responses: {
89
- 200: verifyPhoneNumberResponse,
90
- 400: BadRequestError,
91
- 401: UnauthorizedError,
92
- 404: NotFoundError,
93
- 500: InternalError,
94
- },
95
- },
96
- sendVerificationCode: {
97
- summary: 'Send verification code',
98
- method: 'POST',
99
- path: '/send-verification-code',
100
- metadata: {
101
- auth: true,
102
- },
103
- body: sendVerificationCodeBody,
104
- responses: {
105
- 200: sendVerificationCodeResponse,
106
- 400: BadRequestError,
107
- 401: UnauthorizedError,
108
- 404: NotFoundError,
109
- 500: InternalError,
110
- },
111
- },
112
- setupTwoFactorAuthenticator: {
113
- summary: 'Setup 2FA',
114
- method: 'GET',
115
- path: '/setup-authenticator',
116
- metadata: {
117
- auth: true,
118
- },
119
- responses: {
120
- 201: setupTwoFactorResponse,
121
- 400: BadRequestError,
122
- 401: UnauthorizedError,
123
- 500: InternalError,
124
- },
125
- },
126
- verifyTwoFactorAuthenticator: {
127
- summary: 'Verify 2FA',
128
- method: 'POST',
129
- path: '/verify-authenticator',
130
- body: verifyTwoFactorBody,
131
- responses: {
132
- 201: verifyTwoFactorResponse,
133
- 400: BadRequestError,
134
- 401: UnauthorizedError,
135
- 500: InternalError,
136
- },
137
- },
138
- sendEmailVerification: {
139
- summary: 'Send email verification code',
140
- method: 'POST',
141
- path: '/send-email-verification',
142
- metadata: {
143
- auth: true,
144
- },
145
- body: sendEmailVerificationBody,
146
- responses: {
147
- 200: sendEmailVerificationResponse,
148
- 400: BadRequestError,
149
- 401: UnauthorizedError,
150
- 429: BadRequestError,
151
- 500: InternalError,
152
- },
153
- },
154
- verifyEmail: {
155
- summary: 'Verify email with code',
156
- method: 'POST',
157
- path: '/verify-email',
158
- metadata: {
159
- auth: true,
160
- },
161
- body: verifyEmailBody,
162
- responses: {
163
- 200: verifyEmailResponse,
164
- 400: BadRequestError,
165
- 401: UnauthorizedError,
166
- 500: InternalError,
167
- },
168
- },
169
- disableTwoFactor: {
170
- summary: '[ADMIN] Disable 2FA for user',
171
- method: 'POST',
172
- path: '/disable-2fa',
173
- metadata: {
174
- auth: true,
175
- },
176
- body: disableTwoFactorBody,
177
- responses: {
178
- 201: UserZod,
179
- 400: BadRequestError,
180
- 401: UnauthorizedError,
181
- 403: ForbiddenError,
182
- 500: InternalError,
183
- },
184
- },
185
- },
186
- {
187
- pathPrefix: 'user-settings',
188
- },
189
- );
@@ -1,200 +0,0 @@
1
- import { initContract } from '@ts-rest/core';
2
- import {
3
- ForbiddenError,
4
- GetMeResponse,
5
- InternalError,
6
- IPaginatedUser,
7
- NotFoundError,
8
- PaginationOptionsZod,
9
- UnauthorizedError,
10
- UserFiltersZod,
11
- UserMeUpdateZod,
12
- UsersIncludeQuery,
13
- UserUpdateZod,
14
- UserWithoutPasswordZod,
15
- UserZod,
16
- UsersSummaryFilterZod,
17
- IPaginatedUsersSummaryResponse,
18
- BadRequestError,
19
- userIdSchema,
20
- UserDeleteResponse,
21
- IssuersActiveStatusUpdateZod,
22
- UpdateLockedStatus,
23
- UpdateUserRoleZod,
24
- } from '../../../common/types';
25
- import { z } from 'zod';
26
-
27
- const c = initContract();
28
-
29
- export const usersContract = c.router(
30
- {
31
- me: {
32
- summary: 'Get current user',
33
- method: 'GET',
34
- path: '/me',
35
- metadata: {
36
- auth: true,
37
- },
38
- responses: {
39
- 200: GetMeResponse,
40
- 401: UnauthorizedError,
41
- 404: NotFoundError,
42
- 500: InternalError,
43
- },
44
- },
45
- updateMe: {
46
- summary: 'Update current user',
47
- method: 'PATCH',
48
- path: '/me',
49
- metadata: {
50
- auth: true,
51
- },
52
- body: UserMeUpdateZod,
53
- responses: {
54
- 201: UserWithoutPasswordZod,
55
- 401: UnauthorizedError,
56
- 404: NotFoundError,
57
- 500: InternalError,
58
- },
59
- },
60
- getUsersSummary: {
61
- summary: 'Get users summary with pagination',
62
- method: 'GET',
63
- path: '/summary',
64
- metadata: {
65
- auth: true,
66
- },
67
- query: PaginationOptionsZod.merge(UsersSummaryFilterZod),
68
- responses: {
69
- 200: IPaginatedUsersSummaryResponse,
70
- 404: NotFoundError,
71
- 401: UnauthorizedError,
72
- 403: ForbiddenError,
73
- 500: InternalError,
74
- },
75
- },
76
- getUsers: {
77
- summary: 'Get users',
78
- method: 'GET',
79
- path: '',
80
- metadata: {
81
- auth: true,
82
- },
83
- query:
84
- PaginationOptionsZod.merge(UserFiltersZod).merge(UsersIncludeQuery),
85
- responses: {
86
- 200: IPaginatedUser,
87
- 401: UnauthorizedError,
88
- 403: ForbiddenError,
89
- },
90
- },
91
- getUser: {
92
- summary: 'Get user by id',
93
- method: 'GET',
94
- path: '/:id',
95
- metadata: {
96
- auth: true,
97
- },
98
- query: z.object({}).merge(UsersIncludeQuery),
99
- pathParams: z.object({
100
- id: z.string(),
101
- }),
102
- responses: {
103
- 200: UserZod,
104
- 401: UnauthorizedError,
105
- 404: NotFoundError,
106
- },
107
- },
108
- updateUser: {
109
- summary: 'Update user by id',
110
- method: 'PATCH',
111
- path: '/admin/:id',
112
- metadata: {
113
- auth: true,
114
- },
115
- pathParams: z.object({
116
- id: z.string(),
117
- }),
118
- body: UserUpdateZod,
119
- responses: {
120
- 200: UserWithoutPasswordZod,
121
- 404: NotFoundError,
122
- 401: UnauthorizedError,
123
- 403: ForbiddenError,
124
- 500: InternalError,
125
- },
126
- },
127
- deleteUser: {
128
- summary: 'Delete user by id',
129
- method: 'DELETE',
130
- path: '/:id',
131
- metadata: {
132
- auth: true,
133
- },
134
- pathParams: z.object({
135
- id: userIdSchema,
136
- }),
137
- responses: {
138
- 200: UserDeleteResponse,
139
- 400: BadRequestError,
140
- 401: UnauthorizedError,
141
- 403: ForbiddenError,
142
- 404: NotFoundError,
143
- 500: InternalError,
144
- },
145
- },
146
- updateActiveStatus: {
147
- summary: '[Admin] Update user active status',
148
- method: 'PATCH',
149
- path: '/active/:id',
150
- metadata: {
151
- auth: true,
152
- },
153
- pathParams: z.object({ id: userIdSchema }),
154
- body: IssuersActiveStatusUpdateZod,
155
- responses: {
156
- 201: z.object({ message: z.string() }),
157
- 401: UnauthorizedError,
158
- 404: NotFoundError,
159
- 500: InternalError,
160
- },
161
- },
162
- updateRole: {
163
- summary:
164
- '[Admin] Update user role for compliance as well as other portals ',
165
- method: 'PATCH',
166
- path: '/role',
167
- metadata: {
168
- auth: true,
169
- },
170
- body: UpdateUserRoleZod,
171
- responses: {
172
- 201: UserWithoutPasswordZod,
173
- 400: BadRequestError,
174
- 401: UnauthorizedError,
175
- 403: ForbiddenError,
176
- 404: NotFoundError,
177
- 500: InternalError,
178
- },
179
- },
180
- updateLockedStatus: {
181
- summary: '[Admin] Update user locked status',
182
- method: 'PATCH',
183
- path: '/:id/locked',
184
- metadata: {
185
- auth: true,
186
- },
187
- pathParams: z.object({ id: userIdSchema }),
188
- body: UpdateLockedStatus,
189
- responses: {
190
- 201: z.object({ message: z.string() }),
191
- 401: UnauthorizedError,
192
- 404: NotFoundError,
193
- 500: InternalError,
194
- },
195
- },
196
- },
197
- {
198
- pathPrefix: 'users',
199
- },
200
- );
@@ -1,41 +0,0 @@
1
- import { initContract } from '@ts-rest/core';
2
- import { StripeWebhookEvent } from '../../../common/types/webhook.types';
3
- import { z } from 'zod';
4
-
5
- const c = initContract();
6
-
7
- export const webhooksContract = c.router(
8
- {
9
- postWebHookStripe: {
10
- summary: '[Stripe] webhook',
11
- method: 'POST',
12
- path: '/stripe',
13
- metadata: {
14
- auth: true,
15
- },
16
- body: StripeWebhookEvent, // TODO: remove schema validation instead do it in the service
17
- responses: {
18
- 200: z.object({
19
- received: z.boolean(),
20
- }),
21
- },
22
- },
23
- postWebHookPersona: {
24
- summary: '[Persona] webhook',
25
- method: 'POST',
26
- path: '/persona',
27
- metadata: {
28
- auth: true,
29
- },
30
- body: z.any(), // schema is validated in the service to prevent 400 response to sender
31
- responses: {
32
- 200: z.object({
33
- received: z.boolean(),
34
- }),
35
- },
36
- },
37
- },
38
- {
39
- pathPrefix: 'webhooks',
40
- },
41
- );