@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,129 +0,0 @@
1
- import { initContract } from '@ts-rest/core';
2
- import {
3
- InternalError,
4
- NotFoundError,
5
- UnauthorizedError,
6
- BadRequestError,
7
- ForbiddenError,
8
- PaginationOptionsZod,
9
- } from '../../../common/types';
10
- import {
11
- ExchangeApiKey,
12
- PaginatedExchangeApiKeys,
13
- AdminPostExchangeApiKey,
14
- exchangeApiKeyIdSchema,
15
- UpdateExchangeApiKey,
16
- ExchangeApiKeysIncludeQuery,
17
- ExchangeApiKeysFilter,
18
- } from '../../../common/types/exchange-api-key.types';
19
- import { z } from 'zod';
20
-
21
- const c = initContract();
22
-
23
- export const exchangeApiKeysContract = c.router(
24
- {
25
- postExchangeApiKey: {
26
- summary: '[ADMIN] Create an exchange api key',
27
- method: 'POST',
28
- path: '/',
29
- metadata: {
30
- auth: true,
31
- },
32
- body: AdminPostExchangeApiKey,
33
- responses: {
34
- 201: ExchangeApiKey,
35
- 400: BadRequestError,
36
- 401: UnauthorizedError,
37
- 404: NotFoundError,
38
- 403: ForbiddenError,
39
- 500: InternalError,
40
- },
41
- },
42
- updateExchangeApiKey: {
43
- summary: '[ADMIN] Update an exchange api key',
44
- method: 'PUT',
45
- path: '/:id',
46
- metadata: {
47
- auth: true,
48
- },
49
- body: UpdateExchangeApiKey,
50
- responses: {
51
- 200: ExchangeApiKey,
52
- 400: BadRequestError,
53
- 401: UnauthorizedError,
54
- 404: NotFoundError,
55
- 403: ForbiddenError,
56
- 500: InternalError,
57
- },
58
- },
59
- getExchangeApiKeys: {
60
- summary: '[ADMIN] Get exchange api keys',
61
- method: 'GET',
62
- path: '/',
63
- metadata: {
64
- auth: true,
65
- },
66
- query: PaginationOptionsZod.merge(ExchangeApiKeysFilter).merge(
67
- ExchangeApiKeysIncludeQuery,
68
- ),
69
- responses: {
70
- 200: PaginatedExchangeApiKeys,
71
- 401: UnauthorizedError,
72
- 403: ForbiddenError,
73
- 404: NotFoundError,
74
- 500: InternalError,
75
- },
76
- },
77
- getExchangeApiKey: {
78
- summary: '[ADMIN] Get exchange api key',
79
- method: 'GET',
80
- path: '/:id',
81
- metadata: {
82
- auth: true,
83
- },
84
- pathParams: z.object({ id: exchangeApiKeyIdSchema }),
85
- responses: {
86
- 200: ExchangeApiKey,
87
- 401: UnauthorizedError,
88
- 403: ForbiddenError,
89
- 404: NotFoundError,
90
- 500: InternalError,
91
- },
92
- },
93
- deactivateExchangeApiKey: {
94
- summary: '[ADMIN] Deactivate an exchange api key',
95
- method: 'GET',
96
- path: '/:id/deactivate',
97
- metadata: {
98
- auth: true,
99
- },
100
- pathParams: z.object({ id: exchangeApiKeyIdSchema }),
101
- responses: {
102
- 200: ExchangeApiKey,
103
- 401: UnauthorizedError,
104
- 403: ForbiddenError,
105
- 404: NotFoundError,
106
- 500: InternalError,
107
- },
108
- },
109
- deleteExchangeApiKey: {
110
- summary: '[ADMIN] Delete an exchange api key',
111
- method: 'DELETE',
112
- path: '/:id',
113
- metadata: {
114
- auth: true,
115
- },
116
- pathParams: z.object({ id: exchangeApiKeyIdSchema }),
117
- responses: {
118
- 200: ExchangeApiKey,
119
- 401: UnauthorizedError,
120
- 403: ForbiddenError,
121
- 404: NotFoundError,
122
- 500: InternalError,
123
- },
124
- },
125
- },
126
- {
127
- pathPrefix: 'exchange-api-keys',
128
- },
129
- );
@@ -1,137 +0,0 @@
1
- import { initContract } from '@ts-rest/core';
2
- import {
3
- InternalError,
4
- NotFoundError,
5
- UnauthorizedError,
6
- BadRequestError,
7
- ForbiddenError,
8
- PaginationOptionsZod,
9
- } from '../../../common/types';
10
- import {} from '../../../common/types/escrow-account.types';
11
- import {
12
- PostAdminExchangeImport,
13
- ExchangeImport,
14
- UpdateExchangeImport,
15
- exchangeImportIdSchema,
16
- PaginatedExchangeImports,
17
- TriggerExchangeImport,
18
- } from '../../../common/types/exchange-provider.types';
19
- import { z } from 'zod';
20
- import {
21
- ExchangeImportsFilter,
22
- ExchangeImportsIncludeQuery,
23
- } from '../../../common/types/exchange-import.types';
24
-
25
- const c = initContract();
26
-
27
- export const exchangeImportsContract = c.router(
28
- {
29
- postExchangeImport: {
30
- summary: '[ADMIN] Create an exchange import',
31
- method: 'POST',
32
- path: '/',
33
- metadata: {
34
- auth: true,
35
- },
36
- body: PostAdminExchangeImport,
37
- responses: {
38
- 201: ExchangeImport,
39
- 400: BadRequestError,
40
- 401: UnauthorizedError,
41
- 403: ForbiddenError,
42
- 404: NotFoundError,
43
- 500: InternalError,
44
- },
45
- },
46
- updateExchangeImport: {
47
- summary: '[ADMIN] Update an exchange import',
48
- method: 'PUT',
49
- path: '/:id',
50
- metadata: {
51
- auth: true,
52
- },
53
- pathParams: z.object({ id: exchangeImportIdSchema }),
54
- body: UpdateExchangeImport,
55
- responses: {
56
- 200: ExchangeImport,
57
- 400: BadRequestError,
58
- 401: UnauthorizedError,
59
- 403: ForbiddenError,
60
- 404: NotFoundError,
61
- 500: InternalError,
62
- },
63
- },
64
- getExchangeImports: {
65
- summary: '[ADMIN] Get exchange imports',
66
- method: 'GET',
67
- path: '/',
68
- metadata: {
69
- auth: true,
70
- },
71
- query: PaginationOptionsZod.merge(ExchangeImportsFilter).merge(
72
- ExchangeImportsIncludeQuery,
73
- ),
74
- responses: {
75
- 200: PaginatedExchangeImports,
76
- 401: UnauthorizedError,
77
- 403: ForbiddenError,
78
- 404: NotFoundError,
79
- 500: InternalError,
80
- },
81
- },
82
- getExchangeImport: {
83
- summary: '[ADMIN] Get an exchange import',
84
- method: 'GET',
85
- path: '/:id',
86
- metadata: {
87
- auth: true,
88
- },
89
- pathParams: z.object({ id: exchangeImportIdSchema }),
90
- responses: {
91
- 200: ExchangeImport,
92
- 401: UnauthorizedError,
93
- 403: ForbiddenError,
94
- 404: NotFoundError,
95
- 500: InternalError,
96
- },
97
- },
98
- deleteExchangeImport: {
99
- summary: '[ADMIN] Delete an exchange import',
100
- method: 'DELETE',
101
- path: '/:id',
102
- metadata: {
103
- auth: true,
104
- },
105
- pathParams: z.object({ id: exchangeImportIdSchema }),
106
- responses: {
107
- 200: ExchangeImport,
108
- 400: BadRequestError,
109
- 401: UnauthorizedError,
110
- 403: ForbiddenError,
111
- 404: NotFoundError,
112
- 500: InternalError,
113
- },
114
- },
115
- triggerExchangeImport: {
116
- summary: '[ADMIN] Trigger an exchange import',
117
- method: 'POST',
118
- path: '/:id/trigger',
119
- metadata: {
120
- auth: true,
121
- },
122
- body: TriggerExchangeImport,
123
- pathParams: z.object({ id: exchangeImportIdSchema }),
124
- responses: {
125
- 200: ExchangeImport,
126
- 400: BadRequestError,
127
- 401: UnauthorizedError,
128
- 403: ForbiddenError,
129
- 404: NotFoundError,
130
- 500: InternalError,
131
- },
132
- },
133
- },
134
- {
135
- pathPrefix: 'exchange-imports',
136
- },
137
- );
@@ -1,267 +0,0 @@
1
- import { initContract } from '@ts-rest/core';
2
- import {
3
- accountIdSchema,
4
- BadGateWayError,
5
- BadRequestError,
6
- ComplianceFilesIncludeQuery,
7
- fileIdSchema,
8
- FilePipeLineReviewSchemaZod,
9
- FileZod,
10
- ForbiddenError,
11
- InternalError,
12
- IPaginatedFile,
13
- LinkFileZod,
14
- NotFoundError,
15
- PaginationOptionsZod,
16
- PatchFile,
17
- PatchFileMetadata,
18
- PostFileQueryParams,
19
- ReprocessAllFilesZod,
20
- UnauthorizedError,
21
- UnprocessableError,
22
- } from '../../../common/types';
23
- import { z } from 'zod';
24
- import { authHeader, generateApiDescription } from '../../../common/helpers';
25
-
26
- const c = initContract();
27
-
28
- export const filesContract = c.router(
29
- {
30
- postFile: {
31
- summary: 'Upload a file',
32
- description: generateApiDescription(
33
- 'Upload a file to the system.',
34
- 'POST',
35
- '/files',
36
- {
37
- query: {
38
- name: 'test',
39
- category: 'application',
40
- targetId: 'trade_01j5tkg6k2fygr0x06fegt27aj',
41
- accountId: 'account_01j5tkg6k2fygr0x06fegt27aj',
42
- },
43
- headers: authHeader,
44
- formData: { file: '@"/Users/local/Desktop/test.csv"' },
45
- },
46
- ),
47
- method: 'POST',
48
- path: '',
49
- query: PostFileQueryParams.merge(
50
- z.object({ accountId: accountIdSchema }),
51
- ),
52
- contentType: 'multipart/form-data',
53
- body: c.type<{ file: File }>(),
54
- metadata: {
55
- auth: true,
56
- },
57
- responses: {
58
- 201: FileZod,
59
- 400: BadRequestError,
60
- 401: UnauthorizedError,
61
- 422: UnprocessableError,
62
- 500: InternalError,
63
- 502: BadGateWayError,
64
- },
65
- },
66
- linkFile: {
67
- summary: 'Links a file to a new resource',
68
- method: 'POST',
69
- path: '/:id/link',
70
- pathParams: z.object({
71
- id: fileIdSchema,
72
- }),
73
- body: LinkFileZod,
74
- metadata: {
75
- auth: true,
76
- },
77
- responses: {
78
- 201: FileZod,
79
- 400: BadRequestError,
80
- 401: UnauthorizedError,
81
- 422: UnprocessableError,
82
- 500: InternalError,
83
- 502: BadGateWayError,
84
- },
85
- },
86
- unlinkFile: {
87
- summary: 'Unlinks a file to the parent resource',
88
- method: 'POST',
89
- path: '/:id/unlink',
90
- pathParams: z.object({
91
- id: fileIdSchema,
92
- }),
93
- body: z.object({}),
94
- metadata: {
95
- auth: true,
96
- },
97
- responses: {
98
- 202: FileZod,
99
- 400: BadRequestError,
100
- 401: UnauthorizedError,
101
- 422: UnprocessableError,
102
- 500: InternalError,
103
- 502: BadGateWayError,
104
- },
105
- },
106
- getFiles: {
107
- summary: 'Get files',
108
- method: 'GET',
109
- path: '',
110
- metadata: {
111
- auth: true,
112
- },
113
- query: PaginationOptionsZod.merge(ComplianceFilesIncludeQuery),
114
- responses: {
115
- 200: IPaginatedFile,
116
- 401: UnauthorizedError,
117
- },
118
- },
119
- getFile: {
120
- summary: 'Get file by id',
121
- method: 'GET',
122
- path: '/:id',
123
- metadata: {
124
- auth: true,
125
- },
126
- pathParams: z.object({
127
- id: fileIdSchema,
128
- }),
129
- responses: {
130
- 200: FileZod,
131
- 401: UnauthorizedError,
132
- 404: NotFoundError,
133
- },
134
- },
135
- patchFile: {
136
- summary: 'Update file by id',
137
- method: 'PATCH',
138
- path: '/:id',
139
- metadata: {
140
- auth: true,
141
- },
142
- pathParams: z.object({
143
- id: fileIdSchema,
144
- }),
145
- body: PatchFile,
146
- responses: {
147
- 201: FileZod,
148
- 400: BadRequestError,
149
- 401: UnauthorizedError,
150
- 404: NotFoundError,
151
- 500: InternalError,
152
- },
153
- },
154
- patchFileMetadata: {
155
- summary: 'Patch file metadata',
156
- method: 'PATCH',
157
- path: '/:id/metadata',
158
- metadata: {
159
- auth: true,
160
- },
161
- pathParams: z.object({
162
- id: fileIdSchema,
163
- }),
164
- body: PatchFileMetadata,
165
- responses: {
166
- 201: z.object({ success: z.boolean() }),
167
- 400: BadRequestError,
168
- 401: UnauthorizedError,
169
- 403: ForbiddenError,
170
- 404: NotFoundError,
171
- 500: InternalError,
172
- },
173
- },
174
- previewFile: {
175
- summary: 'Preview (stream) a file by id',
176
- method: 'GET',
177
- path: '/preview/:id',
178
- metadata: {
179
- auth: true,
180
- },
181
- pathParams: z.object({
182
- id: fileIdSchema,
183
- }),
184
- responses: {
185
- 200: z.unknown(),
186
- 401: UnauthorizedError,
187
- 404: NotFoundError,
188
- },
189
- },
190
- processFile: {
191
- summary: 'Process a file',
192
- method: 'POST',
193
- path: '/:id/process',
194
- metadata: {
195
- auth: true,
196
- },
197
- pathParams: z.object({
198
- id: fileIdSchema,
199
- }),
200
- body: z.object({}),
201
- responses: {
202
- 201: z.object({ success: z.boolean() }),
203
- 400: BadRequestError,
204
- 401: UnauthorizedError,
205
- 404: NotFoundError,
206
- 500: InternalError,
207
- },
208
- },
209
- reprocessFile: {
210
- summary: 'Reprocess a file',
211
- method: 'POST',
212
- path: '/:id/reprocess',
213
- metadata: {
214
- auth: true,
215
- },
216
- pathParams: z.object({
217
- id: fileIdSchema,
218
- }),
219
- body: z.object({}),
220
- responses: {
221
- 200: z.object({ success: z.boolean() }),
222
- 400: BadRequestError,
223
- 401: UnauthorizedError,
224
- 404: NotFoundError,
225
- 500: InternalError,
226
- },
227
- },
228
- reprocessAllFiles: {
229
- summary: 'Reprocess all files',
230
- method: 'POST',
231
- path: '/reprocess/all',
232
- metadata: {
233
- auth: true,
234
- },
235
- body: z.object({}),
236
- responses: {
237
- 201: ReprocessAllFilesZod,
238
- 400: BadRequestError,
239
- 401: UnauthorizedError,
240
- 404: NotFoundError,
241
- 500: InternalError,
242
- },
243
- },
244
- filePipeLineReview: {
245
- summary: 'File pipe line review',
246
- method: 'POST',
247
- path: '/:id/pipeline-review',
248
- metadata: {
249
- auth: true,
250
- },
251
- pathParams: z.object({
252
- id: fileIdSchema,
253
- }),
254
- body: FilePipeLineReviewSchemaZod,
255
- responses: {
256
- 200: z.object({ success: z.boolean() }),
257
- 400: BadRequestError,
258
- 401: UnauthorizedError,
259
- 404: NotFoundError,
260
- 500: InternalError,
261
- },
262
- },
263
- },
264
- {
265
- pathPrefix: 'files',
266
- },
267
- );
@@ -1,188 +0,0 @@
1
- import { initContract } from '@ts-rest/core';
2
- import {
3
- accountIdSchema,
4
- BadGateWayError,
5
- BadRequestError,
6
- fileIdSchema,
7
- FilesIncludeQuery,
8
- FileZod,
9
- ForbiddenError,
10
- InternalError,
11
- IPaginatedFile,
12
- LinkFileZod,
13
- NotFoundError,
14
- PaginationOptionsZod,
15
- PatchFile,
16
- PostFileQueryParams,
17
- reviewFiles,
18
- UnauthorizedError,
19
- UnprocessableError,
20
- } from '../../../common/types';
21
- import { z } from 'zod';
22
- import { authHeader, generateApiDescription } from '../../../common/helpers';
23
-
24
- const c = initContract();
25
-
26
- export const filesPublicContract = c.router(
27
- {
28
- postFilePublic: {
29
- summary: 'Upload a public file',
30
- description: generateApiDescription(
31
- 'Upload a public file to the system.',
32
- 'POST',
33
- '/files-public',
34
- {
35
- query: {
36
- name: 'test',
37
- category: 'application',
38
- targetId: 'trade_01j5tkg6k2fygr0x06fegt27aj',
39
- accountId: 'account_01j5tkg6k2fygr0x06fegt27aj',
40
- },
41
- headers: authHeader,
42
- formData: { file: '@"/Users/local/Desktop/test.csv"' },
43
- },
44
- ),
45
- method: 'POST',
46
- path: '',
47
- query: PostFileQueryParams.merge(
48
- z.object({ accountId: accountIdSchema }),
49
- ),
50
- contentType: 'multipart/form-data',
51
- body: c.type<{ file: File }>(),
52
- metadata: {
53
- auth: true,
54
- },
55
- responses: {
56
- 201: FileZod,
57
- 400: BadRequestError,
58
- 401: UnauthorizedError,
59
- 422: UnprocessableError,
60
- 500: InternalError,
61
- 502: BadGateWayError,
62
- },
63
- },
64
- linkFilePublic: {
65
- summary: 'Links a public file to a new resource',
66
- method: 'POST',
67
- path: '/:id/link',
68
- pathParams: z.object({
69
- id: fileIdSchema,
70
- }),
71
- body: LinkFileZod,
72
- metadata: {
73
- auth: true,
74
- },
75
- responses: {
76
- 201: FileZod,
77
- 400: BadRequestError,
78
- 401: UnauthorizedError,
79
- 422: UnprocessableError,
80
- 500: InternalError,
81
- 502: BadGateWayError,
82
- },
83
- },
84
- unlinkFilePublic: {
85
- summary: 'Unlinks a public file to the parent resource',
86
- method: 'POST',
87
- path: '/:id/unlink',
88
- pathParams: z.object({
89
- id: fileIdSchema,
90
- }),
91
- body: z.object({}),
92
- metadata: {
93
- auth: true,
94
- },
95
- responses: {
96
- 202: FileZod,
97
- 400: BadRequestError,
98
- 401: UnauthorizedError,
99
- 422: UnprocessableError,
100
- 500: InternalError,
101
- 502: BadGateWayError,
102
- },
103
- },
104
- getFilesPublic: {
105
- summary: 'Get public files',
106
- method: 'GET',
107
- path: '',
108
- metadata: {
109
- auth: true,
110
- },
111
- query: PaginationOptionsZod.merge(FilesIncludeQuery),
112
- responses: {
113
- 200: IPaginatedFile,
114
- 401: UnauthorizedError,
115
- },
116
- },
117
- getFilePublic: {
118
- summary: 'Get public file by id',
119
- method: 'GET',
120
- path: '/:id',
121
- metadata: {
122
- auth: true,
123
- },
124
- pathParams: z.object({
125
- id: fileIdSchema,
126
- }),
127
- responses: {
128
- 200: FileZod,
129
- 401: UnauthorizedError,
130
- 404: NotFoundError,
131
- },
132
- },
133
- patchFilePublic: {
134
- summary: 'Update public file by id',
135
- method: 'PATCH',
136
- path: '/:id',
137
- metadata: {
138
- auth: true,
139
- },
140
- pathParams: z.object({
141
- id: fileIdSchema,
142
- }),
143
- body: PatchFile,
144
- responses: {
145
- 201: FileZod,
146
- 400: BadRequestError,
147
- 401: UnauthorizedError,
148
- 404: NotFoundError,
149
- 500: InternalError,
150
- },
151
- },
152
- previewFilePublic: {
153
- summary: 'Preview (stream) a public file by id',
154
- method: 'GET',
155
- path: '/preview/:id',
156
- metadata: {
157
- auth: true,
158
- },
159
- pathParams: z.object({
160
- id: fileIdSchema,
161
- }),
162
- responses: {
163
- 200: z.unknown(),
164
- 401: UnauthorizedError,
165
- 404: NotFoundError,
166
- },
167
- },
168
- reviewPublicFiles: {
169
- summary: 'Review public files',
170
- method: 'POST',
171
- path: '/review',
172
- metadata: {
173
- auth: true,
174
- },
175
- body: reviewFiles,
176
- responses: {
177
- 201: z.object({ success: z.boolean() }),
178
- 401: UnauthorizedError,
179
- 403: ForbiddenError,
180
- 404: NotFoundError,
181
- 500: InternalError,
182
- },
183
- },
184
- },
185
- {
186
- pathPrefix: 'files-public',
187
- },
188
- );