-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into refactor.shopify
- Loading branch information
Showing
28 changed files
with
1,215 additions
and
697 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const { proxyRequest, prepareProxyRequest } = require('../../../adapters/network'); | ||
const { processAxiosResponse } = require('../../../adapters/utils/networkUtils'); | ||
|
||
const { RetryableError } = require('../../util/errorTypes'); | ||
|
||
const errorResponseHandler = (destinationResponse, dest) => { | ||
const { status } = destinationResponse; | ||
if (status === 408) { | ||
throw new RetryableError( | ||
`[Intercom Response Handler] Request failed for destination ${dest} with status: ${status}`, | ||
500, | ||
destinationResponse, | ||
); | ||
} | ||
}; | ||
|
||
const destResponseHandler = (destinationResponse, dest) => { | ||
errorResponseHandler(destinationResponse, dest); | ||
return { | ||
destinationResponse: destinationResponse.response, | ||
message: 'Request Processed Successfully', | ||
status: destinationResponse.status, | ||
}; | ||
}; | ||
|
||
class networkHandler { | ||
constructor() { | ||
this.responseHandler = destResponseHandler; | ||
this.proxy = proxyRequest; | ||
this.prepareProxy = prepareProxyRequest; | ||
this.processAxiosResponse = processAxiosResponse; | ||
} | ||
} | ||
|
||
module.exports = { | ||
networkHandler, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
const ABORTABLE_CODES = ['601', '603', '605', '609', '610']; | ||
const RETRYABLE_CODES = ['713', '602', '604', '611']; | ||
const THROTTLED_CODES = ['502', '606', '607', '608', '615']; | ||
|
||
const MARKETO_FILE_SIZE = 10485760; | ||
const MARKETO_FILE_PATH = `${__dirname}/uploadFile/marketo_bulkupload.csv`; | ||
|
||
const FETCH_ACCESS_TOKEN = 'marketo_bulk_upload_access_token_fetching'; | ||
|
||
const POLL_ACTIVITY = 'marketo_bulk_upload_polling'; | ||
const POLL_STATUS_ERR_MSG = 'Could not poll status'; | ||
|
||
const UPLOAD_FILE = 'marketo_bulk_upload_upload_file'; | ||
const FILE_UPLOAD_ERR_MSG = 'Could not upload file'; | ||
|
||
const JOB_STATUS_ACTIVITY = 'marketo_bulk_upload_get_job_status'; | ||
const FETCH_FAILURE_JOB_STATUS_ERR_MSG = 'Could not fetch failure job status'; | ||
const FETCH_WARNING_JOB_STATUS_ERR_MSG = 'Could not fetch warning job status'; | ||
const ACCESS_TOKEN_FETCH_ERR_MSG = 'Error during fetching access token'; | ||
|
||
module.exports = { | ||
ABORTABLE_CODES, | ||
RETRYABLE_CODES, | ||
THROTTLED_CODES, | ||
MARKETO_FILE_SIZE, | ||
POLL_ACTIVITY, | ||
UPLOAD_FILE, | ||
JOB_STATUS_ACTIVITY, | ||
MARKETO_FILE_PATH, | ||
FETCH_ACCESS_TOKEN, | ||
POLL_STATUS_ERR_MSG, | ||
FILE_UPLOAD_ERR_MSG, | ||
FETCH_FAILURE_JOB_STATUS_ERR_MSG, | ||
FETCH_WARNING_JOB_STATUS_ERR_MSG, | ||
ACCESS_TOKEN_FETCH_ERR_MSG, | ||
}; |
Oops, something went wrong.