feat(HighLevel Node): Api v2 support, new node version (#9554)

This commit is contained in:
Michael Kret
2024-06-03 12:09:05 +03:00
committed by GitHub
parent 0e10c84efd
commit 19e5c0397a
15 changed files with 2603 additions and 90 deletions

View File

@@ -149,3 +149,10 @@ export const TEST_WEBHOOK_TIMEOUT = 2 * TIME.MINUTE;
export const TEST_WEBHOOK_TIMEOUT_BUFFER = 30 * TIME.SECOND;
export const N8N_DOCS_URL = 'https://docs.n8n.io';
export const GENERIC_OAUTH2_CREDENTIALS_WITH_EDITABLE_SCOPE = [
'oAuth2Api',
'googleOAuth2Api',
'microsoftOAuth2Api',
'highLevelOAuth2Api',
];

View File

@@ -10,6 +10,7 @@ import { Get, RestController } from '@/decorators';
import { jsonStringify } from 'n8n-workflow';
import { OAuthRequest } from '@/requests';
import { AbstractOAuthController, type CsrfStateParam } from './abstractOAuth.controller';
import { GENERIC_OAUTH2_CREDENTIALS_WITH_EDITABLE_SCOPE as GENERIC_OAUTH2_CREDENTIALS_WITH_EDITABLE_SCOPE } from '../../constants';
@RestController('/oauth2-credential')
export class OAuth2CredentialController extends AbstractOAuthController {
@@ -25,16 +26,11 @@ export class OAuth2CredentialController extends AbstractOAuthController {
// At some point in the past we saved hidden scopes to credentials (but shouldn't)
// Delete scope before applying defaults to make sure new scopes are present on reconnect
// Generic Oauth2 API is an exception because it needs to save the scope
const genericOAuth2 = [
'oAuth2Api',
'googleOAuth2Api',
'microsoftOAuth2Api',
'highLevelOAuth2Api',
];
if (
decryptedDataOriginal?.scope &&
credential.type.includes('OAuth2') &&
!genericOAuth2.includes(credential.type)
!GENERIC_OAUTH2_CREDENTIALS_WITH_EDITABLE_SCOPE.includes(credential.type)
) {
delete decryptedDataOriginal.scope;
}