Skip to content

Commit f8735d9

Browse files
authored
feat(contractor-onboarding): handle UK and Saudi Arabia edge cases (#705)
* add field for uk * add comment * feat(contractor-onboarding) - save and retreive ir35 * jsfModify utils * add tests * remove logs * feat(form) - implement additional required fileds * feat(uk) - sds file upload * feat(contractor-onboarding) - better handling of errors in basic information * fix pricing plan * fix errors * add file upload api * fix type errors * fix tests * fix tests * fix tests * fix tests * remove test * feat(contractor-onboarding) - fix update files * feat(zendesk) - add zendesk article * upgrade size limit * chore(kit) - update version * feat(saudi) - fix nationality submission * remove todo comment * feat(contractor-onboarding) - upload files with sub_type * feat(files-api): add useEmploymentFiles hook for retrieving employment-associated files * feat(contractor-onboarding) - fix uploads * fix contractor onboarding * fix try catch * fix jsdoc * fix proxy * fix loading * fix tests
1 parent f11de66 commit f8735d9

12 files changed

Lines changed: 1345 additions & 140 deletions

File tree

.sizelimit.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"limits": {
33
"total": 500000,
4-
"totalGzip": 180000,
4+
"totalGzip": 185000,
55
"css": 100000,
66
"cssGzip": 25000,
77
"maxChunkSize": 50000,

example/api/proxy.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,31 @@ const { buildGatewayURL } = require('./utils.js');
1414
* @returns {Promise<object>} - Axios response
1515
*/
1616
async function createProxyRequest(path, method = 'GET', options = {}) {
17-
const { body, params, headers = {}, requiresAuth = true } = options;
17+
const { body, params, headers = {}, requiresAuth = true, stream } = options;
1818

1919
const gatewayUrl = buildGatewayURL();
2020
const targetUrl = `${gatewayUrl}${path}`;
2121

2222
const requestConfig = {
2323
method,
2424
url: targetUrl,
25-
data: body,
25+
data: stream || body,
2626
params,
2727
headers: {
2828
'Content-Type': 'application/json',
2929
...headers,
3030
host: new URL(gatewayUrl).host,
3131
},
32+
maxBodyLength: 100 * 1024 * 1024, // 100MB
33+
maxContentLength: 100 * 1024 * 1024, // 100MB
34+
timeout: 60000, // 60 seconds for file uploads
3235
};
3336

37+
// Remove Content-Type for streaming (let axios handle it)
38+
if (stream) {
39+
delete requestConfig.headers['Content-Type'];
40+
}
41+
3442
// Add authentication if required
3543
if (requiresAuth) {
3644
const { accessToken } = await fetchAccessToken();
@@ -47,9 +55,14 @@ async function createProxyRequest(path, method = 'GET', options = {}) {
4755
*/
4856
function createProxyMiddleware(requiresAuth = true) {
4957
return async (req, res) => {
58+
const isMultipart = req.headers['content-type']?.includes(
59+
'multipart/form-data',
60+
);
61+
5062
try {
5163
const response = await createProxyRequest(req.originalUrl, req.method, {
52-
body: req.method !== 'GET' ? req.body : undefined,
64+
body: !isMultipart && req.method !== 'GET' ? req.body : undefined,
65+
stream: isMultipart ? req : undefined, // Stream raw request for multipart
5366
params: req.query,
5467
headers: req.headers,
5568
requiresAuth,

src/client/sdk.gen.ts

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ import type {
110110
GetIndexEmploymentCompanyStructureNodeErrors,
111111
GetIndexEmploymentCompanyStructureNodeResponses,
112112
GetIndexEmploymentContractData,
113+
GetIndexEmploymentContractDocumentData,
114+
GetIndexEmploymentContractDocumentErrors,
115+
GetIndexEmploymentContractDocumentResponses,
113116
GetIndexEmploymentContractErrors,
114117
GetIndexEmploymentContractResponses,
115118
GetIndexEmploymentCustomFieldData,
@@ -120,6 +123,9 @@ import type {
120123
GetIndexEmploymentCustomFieldValueResponses,
121124
GetIndexEmploymentData,
122125
GetIndexEmploymentErrors,
126+
GetIndexEmploymentFileData,
127+
GetIndexEmploymentFileErrors,
128+
GetIndexEmploymentFileResponses,
123129
GetIndexEmploymentJobData,
124130
GetIndexEmploymentJobErrors,
125131
GetIndexEmploymentJobResponses,
@@ -1530,6 +1536,29 @@ export const getShowContractDocument = <ThrowOnError extends boolean = false>(
15301536
...options,
15311537
});
15321538

1539+
/**
1540+
* List contract documents for an employment
1541+
*
1542+
* Lists contract documents for a specific employment with pagination, filtering by status, and sorted by updated_at descending (latest first). Only contractor employment types are supported.
1543+
*/
1544+
export const getIndexEmploymentContractDocument = <
1545+
ThrowOnError extends boolean = false,
1546+
>(
1547+
options: Options<GetIndexEmploymentContractDocumentData, ThrowOnError>,
1548+
) =>
1549+
(options.client ?? client).get<
1550+
GetIndexEmploymentContractDocumentResponses,
1551+
GetIndexEmploymentContractDocumentErrors,
1552+
ThrowOnError
1553+
>({
1554+
security: [
1555+
{ scheme: 'bearer', type: 'http' },
1556+
{ scheme: 'bearer', type: 'http' },
1557+
],
1558+
url: '/v1/employments/{employment_id}/contract-documents',
1559+
...options,
1560+
});
1561+
15331562
/**
15341563
* List expenses
15351564
*
@@ -3763,6 +3792,30 @@ export const postCreateApproval = <ThrowOnError extends boolean = false>(
37633792
},
37643793
});
37653794

3795+
/**
3796+
* List employment files
3797+
*
3798+
* Lists files associated with a specific employment.
3799+
*
3800+
* Supports filtering by file type and sub_type.
3801+
*
3802+
*/
3803+
export const getIndexEmploymentFile = <ThrowOnError extends boolean = false>(
3804+
options: Options<GetIndexEmploymentFileData, ThrowOnError>,
3805+
) =>
3806+
(options.client ?? client).get<
3807+
GetIndexEmploymentFileResponses,
3808+
GetIndexEmploymentFileErrors,
3809+
ThrowOnError
3810+
>({
3811+
security: [
3812+
{ scheme: 'bearer', type: 'http' },
3813+
{ scheme: 'bearer', type: 'http' },
3814+
],
3815+
url: '/v1/employments/{employment_id}/files',
3816+
...options,
3817+
});
3818+
37663819
/**
37673820
* Lists custom fields definitions
37683821
*

0 commit comments

Comments
 (0)