mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-13 16:14:07 -08:00
61b9909ac3
* 🐛 Fix bug when response doesn't include content type * ⚡ Improve autodetect response format * ⚡ Make content-type match more specific * ⚡ Improve list of content-types to download
97 lines
2.3 KiB
TypeScript
97 lines
2.3 KiB
TypeScript
import { INodeExecutionData, IOAuth2Options } from 'n8n-workflow';
|
|
|
|
export const replaceNullValues = (item: INodeExecutionData) => {
|
|
if (item.json === null) {
|
|
item.json = {};
|
|
}
|
|
return item;
|
|
};
|
|
|
|
export const getOAuth2AdditionalParameters = (nodeCredentialType: string) => {
|
|
const oAuth2Options: { [credentialType: string]: IOAuth2Options } = {
|
|
bitlyOAuth2Api: {
|
|
tokenType: 'Bearer',
|
|
},
|
|
boxOAuth2Api: {
|
|
includeCredentialsOnRefreshOnBody: true,
|
|
},
|
|
ciscoWebexOAuth2Api: {
|
|
tokenType: 'Bearer',
|
|
},
|
|
clickUpOAuth2Api: {
|
|
keepBearer: false,
|
|
tokenType: 'Bearer',
|
|
},
|
|
goToWebinarOAuth2Api: {
|
|
tokenExpiredStatusCode: 403,
|
|
},
|
|
hubspotDeveloperApi: {
|
|
tokenType: 'Bearer',
|
|
includeCredentialsOnRefreshOnBody: true,
|
|
},
|
|
hubspotOAuth2Api: {
|
|
tokenType: 'Bearer',
|
|
includeCredentialsOnRefreshOnBody: true,
|
|
},
|
|
lineNotifyOAuth2Api: {
|
|
tokenType: 'Bearer',
|
|
},
|
|
linkedInOAuth2Api: {
|
|
tokenType: 'Bearer',
|
|
},
|
|
mailchimpOAuth2Api: {
|
|
tokenType: 'Bearer',
|
|
},
|
|
mauticOAuth2Api: {
|
|
includeCredentialsOnRefreshOnBody: true,
|
|
},
|
|
microsoftDynamicsOAuth2Api: {
|
|
property: 'id_token',
|
|
},
|
|
philipsHueOAuth2Api: {
|
|
tokenType: 'Bearer',
|
|
},
|
|
raindropOAuth2Api: {
|
|
includeCredentialsOnRefreshOnBody: true,
|
|
},
|
|
shopifyOAuth2Api: {
|
|
tokenType: 'Bearer',
|
|
keyToIncludeInAccessTokenHeader: 'X-Shopify-Access-Token',
|
|
},
|
|
slackOAuth2Api: {
|
|
tokenType: 'Bearer',
|
|
property: 'authed_user.access_token',
|
|
},
|
|
stravaOAuth2Api: {
|
|
includeCredentialsOnRefreshOnBody: true,
|
|
},
|
|
};
|
|
return oAuth2Options[nodeCredentialType];
|
|
};
|
|
|
|
//https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
|
|
export const binaryContentTypes = [
|
|
'image/',
|
|
'audio/',
|
|
'video/',
|
|
'application/octet-stream',
|
|
'application/gzip',
|
|
'application/zip',
|
|
'application/vnd.rar',
|
|
'application/epub+zip',
|
|
'application/x-bzip',
|
|
'application/x-bzip2',
|
|
'application/x-cdf',
|
|
'application/vnd.amazon.ebook',
|
|
'application/msword',
|
|
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
'application/vnd.ms-fontobject',
|
|
'application/vnd.oasis.opendocument.presentation',
|
|
'application/pdf',
|
|
'application/x-tar',
|
|
'application/vnd.visio',
|
|
'application/vnd.ms-excel',
|
|
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
'application/x-7z-compressed',
|
|
];
|