@dalmore/api-contracts 1.0.8 → 1.0.10
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.
- package/README.md +48 -39
- package/common/helpers/index.ts +59 -0
- package/{src/common → common}/types/account-contact.types.ts +2 -1
- package/{src/common → common}/types/account-manager.types.ts +3 -7
- package/common/types/account-setting.types.ts +65 -0
- package/{src/common → common}/types/account.types.ts +1 -0
- package/{src/common → common}/types/activity.types.ts +1 -1
- package/{src/common → common}/types/api-key-logs.types.ts +1 -1
- package/{src/common → common}/types/asset.types.ts +14 -14
- package/{src/common → common}/types/auth.types.ts +7 -18
- package/{src/common → common}/types/bonus-tier.types.ts +33 -0
- package/{src/common → common}/types/cart.types.ts +4 -1
- package/{src/common → common}/types/common.types.ts +39 -7
- package/{src/common → common}/types/contact-us.types.ts +6 -2
- package/{src/common → common}/types/covered-person.types.ts +2 -1
- package/{src/common → common}/types/dashboard.types.ts +2 -9
- package/{src/common → common}/types/data-record.types.ts +1 -1
- package/{src/common → common}/types/disbursements.types.ts +119 -3
- package/{src/common → common}/types/escrow-account.types.ts +3 -3
- package/{src/common → common}/types/file.types.ts +20 -4
- package/common/types/i-will-do-it-later.types.ts +68 -0
- package/{src/common → common}/types/index.ts +2 -0
- package/{src/common → common}/types/individuals.types.ts +5 -17
- package/{src/common → common}/types/investor-account.types.ts +2 -1
- package/{src/common → common}/types/invite.types.ts +27 -1
- package/{src/common → common}/types/issuer-offering.types.ts +113 -30
- package/{src/common → common}/types/issuer-payment-method.types.ts +41 -0
- package/{src/common → common}/types/issuer.types.ts +9 -0
- package/{src/common → common}/types/legal-entity.types.ts +3 -2
- package/{src/common → common}/types/note.types.ts +1 -1
- package/common/types/notification.types.ts +544 -0
- package/{src/common → common}/types/offering.types.ts +106 -20
- package/{src/common → common}/types/page.types.ts +1 -1
- package/{src/common → common}/types/phone.type.ts +1 -1
- package/{src/common → common}/types/site-settings.types.ts +2 -1
- package/{src/common → common}/types/site.types.ts +2 -9
- package/{src/common/types/trade-line-item.type.ts → common/types/trade-line-item.types.ts} +2 -9
- package/{src/common → common}/types/trade.types.ts +137 -4
- package/{src/common → common}/types/transaction.types.ts +12 -1
- package/{src/common → common}/types/trusted-contact.types.ts +7 -7
- package/{src/common → common}/types/user.types.ts +17 -33
- package/{src/common → common}/types/zip.type.ts +1 -1
- package/contracts/clients/cart/index.ts +80 -0
- package/{src/contracts → contracts}/clients/index.ts +10 -0
- package/contracts/clients/issuer-payment-methods/index.ts +39 -0
- package/contracts/clients/payment-methods/index.ts +85 -0
- package/contracts/clients/trade-line-items/index.ts +66 -0
- package/{src/contracts → contracts}/clients/trades/index.ts +65 -1
- package/contracts/clients/transactions/index.ts +37 -0
- package/index.ts +10 -0
- package/package.json +32 -11
- package/index.mjs +0 -10970
- package/src/common/types/address.spec.ts +0 -203
- package/src/common/types/common.types.spec.ts +0 -336
- package/src/common/types/contract-helpers.ts +0 -205
- package/src/common/types/files.types.spec.ts +0 -154
- package/src/common/types/issuer-payment-method.types.spec.ts +0 -612
- package/src/common/types/notification.types.ts +0 -58
- package/src/common/types/offering.types.spec.ts +0 -91
- package/src/common/types/phone.spec.ts +0 -76
- package/src/common/types/site-link.types.spec.ts +0 -134
- /package/{src/common → common}/types/account-detail.types.ts +0 -0
- /package/{src/common → common}/types/account-integration.types.ts +0 -0
- /package/{src/common → common}/types/address.types.ts +0 -0
- /package/{src/common → common}/types/aic.types.ts +0 -0
- /package/{src/common → common}/types/aml.types.ts +0 -0
- /package/{src/common → common}/types/api-keys.types.ts +0 -0
- /package/{src/common → common}/types/batch-jobs.types.ts +0 -0
- /package/{src/common → common}/types/checklist-items.types.ts +0 -0
- /package/{src/common → common}/types/checklist.types.ts +0 -0
- /package/{src/common → common}/types/comply-advantage-api.types.ts +0 -0
- /package/{src/common → common}/types/comply-advantage.types.ts +0 -0
- /package/{src/common → common}/types/countries.types.ts +0 -0
- /package/{src/common → common}/types/data-room.types.ts +0 -0
- /package/{src/common → common}/types/default-theme-config.types.ts +0 -0
- /package/{src/common → common}/types/disbursement-adjustment.types.ts +0 -0
- /package/{src/common → common}/types/disbursement-approval-user.types.ts +0 -0
- /package/{src/common → common}/types/disbursement-review.types.ts +0 -0
- /package/{src/common → common}/types/disbursement-transaction.types.ts +0 -0
- /package/{src/common → common}/types/domain-filter.types.ts +0 -0
- /package/{src/common → common}/types/email-theme.types.ts +0 -0
- /package/{src/common → common}/types/entity.types.ts +0 -0
- /package/{src/common → common}/types/error-responses.types.ts +0 -0
- /package/{src/common → common}/types/exchange-api-key.types.ts +0 -0
- /package/{src/common → common}/types/exchange-import.types.ts +0 -0
- /package/{src/common → common}/types/exchange-provider.types.ts +0 -0
- /package/{src/common → common}/types/health.types.ts +0 -0
- /package/{src/common → common}/types/investorAccountIdSchema.type.ts +0 -0
- /package/{src/common → common}/types/investors-offering.types.ts +0 -0
- /package/{src/common → common}/types/issuer-bank-account.types.ts +0 -0
- /package/{src/common → common}/types/job-item.types.ts +0 -0
- /package/{src/common → common}/types/jobs.types.ts +0 -0
- /package/{src/common → common}/types/kyb.types.ts +0 -0
- /package/{src/common → common}/types/kyc.types.ts +0 -0
- /package/{src/common → common}/types/login-history.types.ts +0 -0
- /package/{src/common → common}/types/mail-template.types.ts +0 -0
- /package/{src/common → common}/types/north-cap-integration.types.ts +0 -0
- /package/{src/common → common}/types/notion-api.types.ts +0 -0
- /package/{src/common → common}/types/notion-database.types.ts +0 -0
- /package/{src/common → common}/types/notion-page.types.ts +0 -0
- /package/{src/common → common}/types/offering-reports.types.ts +0 -0
- /package/{src/common → common}/types/offering-submission.types.ts +0 -0
- /package/{src/common → common}/types/page-revision.types.ts +0 -0
- /package/{src/common → common}/types/password.type.ts +0 -0
- /package/{src/common → common}/types/payment-methods.types.ts +0 -0
- /package/{src/common → common}/types/portfolio.types.ts +0 -0
- /package/{src/common → common}/types/privacy-policy-and-tos.types.ts +0 -0
- /package/{src/common → common}/types/queue.types.ts +0 -0
- /package/{src/common → common}/types/registered-reps.types.ts +0 -0
- /package/{src/common → common}/types/rejection-reasons.types.ts +0 -0
- /package/{src/common → common}/types/reminder-config.types.ts +0 -0
- /package/{src/common → common}/types/review.types.ts +0 -0
- /package/{src/common → common}/types/role.types.ts +0 -0
- /package/{src/common → common}/types/secondary-customer.types.ts +0 -0
- /package/{src/common → common}/types/secondary-issuer.types.ts +0 -0
- /package/{src/common → common}/types/secondary-order.types.ts +0 -0
- /package/{src/common → common}/types/secondary-security.types.ts +0 -0
- /package/{src/common → common}/types/secondary-trade.entity.ts +0 -0
- /package/{src/common → common}/types/secondary-trade.types.ts +0 -0
- /package/{src/common → common}/types/secure-request.types.ts +0 -0
- /package/{src/common → common}/types/signer.types.ts +0 -0
- /package/{src/common → common}/types/site-link.types.ts +0 -0
- /package/{src/common → common}/types/sms.types.ts +0 -0
- /package/{src/common → common}/types/state-machine.types.ts +0 -0
- /package/{src/common → common}/types/states.types.ts +0 -0
- /package/{src/common → common}/types/subdoc-preview.types.ts +0 -0
- /package/{src/common → common}/types/task.types.ts +0 -0
- /package/{src/common → common}/types/trade-adjustment.type.ts +0 -0
- /package/{src/common → common}/types/typography.types.ts +0 -0
- /package/{src/common → common}/types/user-manual.types.ts +0 -0
- /package/{src/common → common}/types/user-setting.types.ts +0 -0
- /package/{src/common → common}/types/webhook.types.ts +0 -0
- /package/{src/contracts → contracts}/clients/accounts/index.ts +0 -0
- /package/{src/contracts → contracts}/clients/aic/index.ts +0 -0
- /package/{src/contracts → contracts}/clients/api-key-logs/index.ts +0 -0
- /package/{src/contracts → contracts}/clients/api-keys/index.ts +0 -0
- /package/{src/contracts → contracts}/clients/assets/index.ts +0 -0
- /package/{src/contracts → contracts}/clients/auth/index.ts +0 -0
- /package/{src/contracts → contracts}/clients/files/index.ts +0 -0
- /package/{src/contracts → contracts}/clients/files-public/index.ts +0 -0
- /package/{src/contracts → contracts}/clients/individuals/index.ts +0 -0
- /package/{src/contracts → contracts}/clients/investor-accounts/index.ts +0 -0
- /package/{src/contracts → contracts}/clients/issuers/index.ts +0 -0
- /package/{src/contracts → contracts}/clients/legal-entities/index.ts +0 -0
- /package/{src/contracts → contracts}/clients/offerings/index.ts +0 -0
- /package/{src/contracts → contracts}/clients/secure-requests/index.ts +0 -0
- /package/{src/contracts → contracts}/clients/sites/index.ts +0 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { initContract } from '@ts-rest/core';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import {
|
|
4
|
+
UnauthorizedError,
|
|
5
|
+
ForbiddenError,
|
|
6
|
+
NotFoundError,
|
|
7
|
+
BadRequestError,
|
|
8
|
+
InternalError,
|
|
9
|
+
TradeZod,
|
|
10
|
+
userIdSchema,
|
|
11
|
+
tradeIdSchema,
|
|
12
|
+
} from '../../../common/types';
|
|
13
|
+
import {
|
|
14
|
+
PatchCartBody,
|
|
15
|
+
ClientPlacetradeBody,
|
|
16
|
+
PlaceTradeResponse,
|
|
17
|
+
} from '../../../common/types/cart.types';
|
|
18
|
+
|
|
19
|
+
const c = initContract();
|
|
20
|
+
|
|
21
|
+
export const cartContract = c.router(
|
|
22
|
+
{
|
|
23
|
+
getTradeCart: {
|
|
24
|
+
summary: 'Get carts (Trade.status = CART)',
|
|
25
|
+
method: 'GET',
|
|
26
|
+
path: '',
|
|
27
|
+
metadata: {
|
|
28
|
+
auth: true,
|
|
29
|
+
},
|
|
30
|
+
query: z.object({
|
|
31
|
+
userId: userIdSchema,
|
|
32
|
+
}),
|
|
33
|
+
responses: {
|
|
34
|
+
200: TradeZod,
|
|
35
|
+
401: UnauthorizedError,
|
|
36
|
+
403: ForbiddenError,
|
|
37
|
+
404: NotFoundError,
|
|
38
|
+
500: InternalError,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
postCheckout: {
|
|
42
|
+
summary: 'Place a trade (checkout button)',
|
|
43
|
+
method: 'POST',
|
|
44
|
+
path: '/checkout',
|
|
45
|
+
metadata: {
|
|
46
|
+
auth: true,
|
|
47
|
+
},
|
|
48
|
+
body: ClientPlacetradeBody,
|
|
49
|
+
responses: {
|
|
50
|
+
200: PlaceTradeResponse,
|
|
51
|
+
400: BadRequestError,
|
|
52
|
+
401: UnauthorizedError,
|
|
53
|
+
403: ForbiddenError,
|
|
54
|
+
500: InternalError,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
patchCart: {
|
|
58
|
+
summary: 'Patch a cart',
|
|
59
|
+
method: 'PATCH',
|
|
60
|
+
path: '/:id',
|
|
61
|
+
metadata: {
|
|
62
|
+
auth: true,
|
|
63
|
+
},
|
|
64
|
+
pathParams: z.object({
|
|
65
|
+
id: tradeIdSchema,
|
|
66
|
+
}),
|
|
67
|
+
body: PatchCartBody,
|
|
68
|
+
responses: {
|
|
69
|
+
200: TradeZod,
|
|
70
|
+
400: BadRequestError,
|
|
71
|
+
401: UnauthorizedError,
|
|
72
|
+
403: ForbiddenError,
|
|
73
|
+
500: InternalError,
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
pathPrefix: 'carts',
|
|
79
|
+
},
|
|
80
|
+
);
|
|
@@ -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/',
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { initContract } from '@ts-rest/core';
|
|
2
|
+
import {
|
|
3
|
+
ForbiddenError,
|
|
4
|
+
InternalError,
|
|
5
|
+
NotFoundError,
|
|
6
|
+
UnauthorizedError,
|
|
7
|
+
GetIssuerPaymentMethodZod,
|
|
8
|
+
IPaginatedIssuerPaymentMethod,
|
|
9
|
+
IssuerPaymentMethodsIncludeQuery,
|
|
10
|
+
PaginationOptionsZod,
|
|
11
|
+
} from '../../../common/types';
|
|
12
|
+
|
|
13
|
+
const c = initContract();
|
|
14
|
+
|
|
15
|
+
export const issuerPaymentMethodsContract = c.router(
|
|
16
|
+
{
|
|
17
|
+
getIssuerPaymentMethods: {
|
|
18
|
+
summary: 'Get issuer payment methods',
|
|
19
|
+
method: 'GET',
|
|
20
|
+
path: '',
|
|
21
|
+
metadata: {
|
|
22
|
+
auth: true,
|
|
23
|
+
},
|
|
24
|
+
query: PaginationOptionsZod.merge(GetIssuerPaymentMethodZod).merge(
|
|
25
|
+
IssuerPaymentMethodsIncludeQuery,
|
|
26
|
+
),
|
|
27
|
+
responses: {
|
|
28
|
+
200: IPaginatedIssuerPaymentMethod,
|
|
29
|
+
401: UnauthorizedError,
|
|
30
|
+
403: ForbiddenError,
|
|
31
|
+
404: NotFoundError,
|
|
32
|
+
500: InternalError,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
pathPrefix: 'issuer-payment-methods',
|
|
38
|
+
},
|
|
39
|
+
);
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { initContract } from '@ts-rest/core';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import {
|
|
4
|
+
UnauthorizedError,
|
|
5
|
+
ForbiddenError,
|
|
6
|
+
NotFoundError,
|
|
7
|
+
userIdSchema,
|
|
8
|
+
BadRequestError,
|
|
9
|
+
InternalError,
|
|
10
|
+
} from '../../../common/types';
|
|
11
|
+
import {
|
|
12
|
+
PaymentMethodResponseArray,
|
|
13
|
+
PaymentMethodResponse,
|
|
14
|
+
PostPaymentMethod,
|
|
15
|
+
PostSetupIntentBody,
|
|
16
|
+
SetupIntentResponse,
|
|
17
|
+
} from '../../../common/types/payment-methods.types';
|
|
18
|
+
|
|
19
|
+
const c = initContract();
|
|
20
|
+
|
|
21
|
+
export const paymentMethodsContract = c.router(
|
|
22
|
+
{
|
|
23
|
+
getPaymentMethods: {
|
|
24
|
+
summary: 'Get payment methods for a user',
|
|
25
|
+
method: 'GET',
|
|
26
|
+
path: '',
|
|
27
|
+
metadata: {
|
|
28
|
+
auth: true,
|
|
29
|
+
},
|
|
30
|
+
query: z.object({
|
|
31
|
+
userId: userIdSchema,
|
|
32
|
+
}),
|
|
33
|
+
responses: {
|
|
34
|
+
200: PaymentMethodResponseArray,
|
|
35
|
+
401: UnauthorizedError,
|
|
36
|
+
403: ForbiddenError,
|
|
37
|
+
404: NotFoundError,
|
|
38
|
+
500: InternalError,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
createPaymentMethod: {
|
|
42
|
+
summary: 'Create payment method for a user',
|
|
43
|
+
method: 'POST',
|
|
44
|
+
path: '',
|
|
45
|
+
metadata: {
|
|
46
|
+
auth: true,
|
|
47
|
+
},
|
|
48
|
+
query: z.object({
|
|
49
|
+
userId: userIdSchema,
|
|
50
|
+
}),
|
|
51
|
+
body: PostPaymentMethod,
|
|
52
|
+
responses: {
|
|
53
|
+
201: PaymentMethodResponse,
|
|
54
|
+
400: BadRequestError,
|
|
55
|
+
401: UnauthorizedError,
|
|
56
|
+
403: ForbiddenError,
|
|
57
|
+
404: NotFoundError,
|
|
58
|
+
500: InternalError,
|
|
59
|
+
},
|
|
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
|
+
},
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
pathPrefix: 'payment-methods',
|
|
84
|
+
},
|
|
85
|
+
);
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { initContract } from '@ts-rest/core';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import {
|
|
4
|
+
BadRequestError,
|
|
5
|
+
ForbiddenError,
|
|
6
|
+
InternalError,
|
|
7
|
+
NotFoundError,
|
|
8
|
+
UnauthorizedError,
|
|
9
|
+
userIdSchema,
|
|
10
|
+
} from '../../../common/types';
|
|
11
|
+
import {
|
|
12
|
+
PostTradeLineItem,
|
|
13
|
+
TradeLineItemParams,
|
|
14
|
+
TradeLineItemQuery,
|
|
15
|
+
TradeLineItemResponse,
|
|
16
|
+
TradeLineItemUpdate,
|
|
17
|
+
} from '../../../common/types/trade-line-item.types';
|
|
18
|
+
|
|
19
|
+
const c = initContract();
|
|
20
|
+
|
|
21
|
+
export const tradeLineItemsContract = c.router(
|
|
22
|
+
{
|
|
23
|
+
postTradeLineItem: {
|
|
24
|
+
summary: 'Create Trade Line Item',
|
|
25
|
+
method: 'POST',
|
|
26
|
+
path: '/',
|
|
27
|
+
metadata: {
|
|
28
|
+
auth: true,
|
|
29
|
+
},
|
|
30
|
+
body: PostTradeLineItem,
|
|
31
|
+
query: TradeLineItemQuery.merge(
|
|
32
|
+
z.object({
|
|
33
|
+
userId: userIdSchema,
|
|
34
|
+
}),
|
|
35
|
+
),
|
|
36
|
+
responses: {
|
|
37
|
+
201: TradeLineItemResponse,
|
|
38
|
+
401: UnauthorizedError,
|
|
39
|
+
403: ForbiddenError,
|
|
40
|
+
400: BadRequestError,
|
|
41
|
+
500: InternalError,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
updateTradeLineItem: {
|
|
45
|
+
summary: 'Update Trade Line Item - Can delete if you pass quantity = 0',
|
|
46
|
+
method: 'PATCH',
|
|
47
|
+
path: '/:id',
|
|
48
|
+
metadata: {
|
|
49
|
+
auth: true,
|
|
50
|
+
},
|
|
51
|
+
pathParams: TradeLineItemParams,
|
|
52
|
+
body: TradeLineItemUpdate,
|
|
53
|
+
responses: {
|
|
54
|
+
200: TradeLineItemResponse,
|
|
55
|
+
401: UnauthorizedError,
|
|
56
|
+
403: ForbiddenError,
|
|
57
|
+
404: NotFoundError,
|
|
58
|
+
500: InternalError,
|
|
59
|
+
400: BadRequestError,
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
pathPrefix: 'trade-line-items',
|
|
65
|
+
},
|
|
66
|
+
);
|
|
@@ -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.
|
|
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',
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { initContract } from '@ts-rest/core';
|
|
2
|
+
import {
|
|
3
|
+
BadRequestError,
|
|
4
|
+
InternalError,
|
|
5
|
+
NotFoundError,
|
|
6
|
+
UnauthorizedError,
|
|
7
|
+
} from '../../../common/types';
|
|
8
|
+
import {
|
|
9
|
+
ClientPostTransactionZod,
|
|
10
|
+
TransactionZod,
|
|
11
|
+
} from '../../../common/types/transaction.types';
|
|
12
|
+
|
|
13
|
+
const c = initContract();
|
|
14
|
+
|
|
15
|
+
export const clientsTransactionsContract = c.router(
|
|
16
|
+
{
|
|
17
|
+
postTransaction: {
|
|
18
|
+
summary: 'Create a transaction',
|
|
19
|
+
method: 'POST',
|
|
20
|
+
path: '',
|
|
21
|
+
metadata: {
|
|
22
|
+
auth: true,
|
|
23
|
+
},
|
|
24
|
+
body: ClientPostTransactionZod,
|
|
25
|
+
responses: {
|
|
26
|
+
201: TransactionZod,
|
|
27
|
+
400: BadRequestError,
|
|
28
|
+
401: UnauthorizedError,
|
|
29
|
+
404: NotFoundError,
|
|
30
|
+
500: InternalError,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
pathPrefix: 'transactions',
|
|
36
|
+
},
|
|
37
|
+
);
|
package/index.ts
ADDED
package/package.json
CHANGED
|
@@ -1,20 +1,44 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalmore/api-contracts",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
4
4
|
"description": "Type-safe API contracts for Dalmore Client Portal",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "./index.
|
|
7
|
-
"types": "./
|
|
6
|
+
"main": "./index.ts",
|
|
7
|
+
"types": "./index.ts",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
-
"types": "./
|
|
11
|
-
"import": "./index.
|
|
12
|
-
"default": "./index.
|
|
10
|
+
"types": "./index.ts",
|
|
11
|
+
"import": "./index.ts",
|
|
12
|
+
"default": "./index.ts"
|
|
13
|
+
},
|
|
14
|
+
"./clients": {
|
|
15
|
+
"types": "./contracts/clients/index.ts",
|
|
16
|
+
"import": "./contracts/clients/index.ts",
|
|
17
|
+
"default": "./contracts/clients/index.ts"
|
|
18
|
+
},
|
|
19
|
+
"./types": {
|
|
20
|
+
"types": "./common/types/index.ts",
|
|
21
|
+
"import": "./common/types/index.ts",
|
|
22
|
+
"default": "./common/types/index.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
|
+
]
|
|
13
36
|
}
|
|
14
37
|
},
|
|
15
38
|
"files": [
|
|
16
|
-
"index.
|
|
17
|
-
"
|
|
39
|
+
"index.ts",
|
|
40
|
+
"contracts",
|
|
41
|
+
"common"
|
|
18
42
|
],
|
|
19
43
|
"keywords": [
|
|
20
44
|
"dalmore",
|
|
@@ -34,10 +58,7 @@
|
|
|
34
58
|
},
|
|
35
59
|
"peerDependencies": {
|
|
36
60
|
"@anatine/zod-openapi": "^1.14.2",
|
|
37
|
-
"@nestjs/common": "^11.0.0",
|
|
38
61
|
"@ts-rest/core": "^3.52.1",
|
|
39
|
-
"libphonenumber-js": "^1.12.0",
|
|
40
|
-
"neverthrow": "^8.0.0",
|
|
41
62
|
"typeid-js": "^1.2.0",
|
|
42
63
|
"zod": "^3.24.4"
|
|
43
64
|
},
|