From 26f1af397b2b25e3394fc2dae91a5c281bf33d66 Mon Sep 17 00:00:00 2001 From: Bram Kn Date: Fri, 23 Aug 2024 19:19:05 +0200 Subject: [PATCH] feat: Add new credentials for the HTTP Request node (#9833) Co-authored-by: Jonathan Bennetts Co-authored-by: Shireen Missi <94372015+ShireenMissi@users.noreply.github.com> --- .../credentials/DatadogApi.credentials.ts | 73 ++++ .../credentials/DfirIrisApi.credentials.ts | 67 +++ .../credentials/DynatraceApi.credentials.ts | 37 ++ .../ElasticSecurityApi.credentials.ts | 85 +++- .../credentials/FilescanApi.credentials.ts | 50 +++ .../credentials/MalcoreApi.credentials.ts | 51 +++ .../nodes-base/credentials/icons/Datadog.svg | 1 + .../nodes-base/credentials/icons/DfirIris.svg | 403 ++++++++++++++++++ .../credentials/icons/Dynatrace.svg | 18 + .../nodes-base/credentials/icons/Elastic.svg | 2 + .../nodes-base/credentials/icons/Filescan.svg | 33 ++ .../nodes-base/credentials/icons/Malcore.png | Bin 0 -> 13238 bytes .../ElasticSecurity/ElasticSecurity.node.ts | 56 +-- .../ElasticSecurity/GenericFunctions.ts | 16 +- .../nodes/Elastic/ElasticSecurity/types.ts | 5 +- packages/nodes-base/package.json | 5 + 16 files changed, 827 insertions(+), 75 deletions(-) create mode 100644 packages/nodes-base/credentials/DatadogApi.credentials.ts create mode 100644 packages/nodes-base/credentials/DfirIrisApi.credentials.ts create mode 100644 packages/nodes-base/credentials/DynatraceApi.credentials.ts create mode 100644 packages/nodes-base/credentials/FilescanApi.credentials.ts create mode 100644 packages/nodes-base/credentials/MalcoreApi.credentials.ts create mode 100644 packages/nodes-base/credentials/icons/Datadog.svg create mode 100644 packages/nodes-base/credentials/icons/DfirIris.svg create mode 100644 packages/nodes-base/credentials/icons/Dynatrace.svg create mode 100644 packages/nodes-base/credentials/icons/Elastic.svg create mode 100644 packages/nodes-base/credentials/icons/Filescan.svg create mode 100644 packages/nodes-base/credentials/icons/Malcore.png diff --git a/packages/nodes-base/credentials/DatadogApi.credentials.ts b/packages/nodes-base/credentials/DatadogApi.credentials.ts new file mode 100644 index 0000000000000..2c962a92a00a2 --- /dev/null +++ b/packages/nodes-base/credentials/DatadogApi.credentials.ts @@ -0,0 +1,73 @@ +import type { + ICredentialDataDecryptedObject, + ICredentialTestRequest, + ICredentialType, + IHttpRequestOptions, + INodeProperties, +} from 'n8n-workflow'; + +export class DatadogApi implements ICredentialType { + name = 'datadogApi'; + + displayName = 'Datadog API'; + + documentationUrl = 'datadog'; + + icon = { light: 'file:icons/Datadog.svg', dark: 'file:icons/Datadog.svg' } as const; + + httpRequestNode = { + name: 'Datadog', + docsUrl: 'https://docs.datadoghq.com/api/latest/', + apiBaseUrlPlaceholder: 'https://api.datadoghq.com/api/v1/metrics', + }; + + properties: INodeProperties[] = [ + { + displayName: 'URL', + name: 'url', + required: true, + type: 'string', + default: 'https://api.datadoghq.com', + }, + { + displayName: 'API Key', + name: 'apiKey', + required: true, + type: 'string', + typeOptions: { password: true }, + default: '', + }, + { + displayName: 'APP Key', + name: 'appKey', + required: false, + type: 'string', + default: '', + typeOptions: { password: true }, + description: 'For some endpoints, you also need an Application key.', + }, + ]; + + async authenticate( + credentials: ICredentialDataDecryptedObject, + requestOptions: IHttpRequestOptions, + ): Promise { + requestOptions.headers = { + 'DD-API-KEY': credentials.apiKey, + 'DD-APPLICATION-KEY': credentials.appKey, + }; + if (!requestOptions.headers['DD-APPLICATION-KEY']) { + delete requestOptions.headers['DD-APPLICATION-KEY']; + } + + return requestOptions; + } + + test: ICredentialTestRequest = { + request: { + baseURL: '={{$credentials.url}}', + url: '/api/v1/validate', + method: 'GET', + }, + }; +} diff --git a/packages/nodes-base/credentials/DfirIrisApi.credentials.ts b/packages/nodes-base/credentials/DfirIrisApi.credentials.ts new file mode 100644 index 0000000000000..cf631fba06e37 --- /dev/null +++ b/packages/nodes-base/credentials/DfirIrisApi.credentials.ts @@ -0,0 +1,67 @@ +import type { + IAuthenticateGeneric, + ICredentialTestRequest, + ICredentialType, + INodeProperties, +} from 'n8n-workflow'; + +export class DfirIrisApi implements ICredentialType { + name = 'dfirIrisApi'; + + displayName = 'DFIR-IRIS API'; + + documentationUrl = 'dfiriris'; + + icon = { light: 'file:icons/DfirIris.svg', dark: 'file:icons/DfirIris.svg' } as const; + + httpRequestNode = { + name: 'DFIR-IRIS', + docsUrl: 'https://docs.dfir-iris.org/operations/api/', + apiBaseUrlPlaceholder: 'http:///manage/cases/list', + }; + + properties: INodeProperties[] = [ + { + displayName: 'Base URL', + name: 'baseUrl', + type: 'string', + default: '', + placeholder: 'e.g. https://localhost', + description: + 'The API endpoints are reachable on the same Address and port as the web interface.', + required: true, + }, + { + displayName: 'API Key', + name: 'apiKey', + required: true, + type: 'string', + typeOptions: { password: true }, + default: '', + }, + { + displayName: 'Ignore SSL Issues', + name: 'skipSslCertificateValidation', + type: 'boolean', + default: false, + }, + ]; + + authenticate: IAuthenticateGeneric = { + type: 'generic', + properties: { + headers: { + Authorization: '=Bearer {{$credentials.apiKey}}', + }, + }, + }; + + test: ICredentialTestRequest = { + request: { + baseURL: '={{$credentials.baseUrl}}', + url: '/api/ping', + method: 'GET', + skipSslCertificateValidation: '={{$credentials.skipSslCertificateValidation}}', + }, + }; +} diff --git a/packages/nodes-base/credentials/DynatraceApi.credentials.ts b/packages/nodes-base/credentials/DynatraceApi.credentials.ts new file mode 100644 index 0000000000000..9934bd1b9614f --- /dev/null +++ b/packages/nodes-base/credentials/DynatraceApi.credentials.ts @@ -0,0 +1,37 @@ +import type { IAuthenticateGeneric, ICredentialType, INodeProperties } from 'n8n-workflow'; + +export class DynatraceApi implements ICredentialType { + name = 'dynatraceApi'; + + displayName = 'DynatraceAPI'; + + documentationUrl = 'dynatrace'; + + icon = { light: 'file:icons/Dynatrace.svg', dark: 'file:icons/Dynatrace.svg' } as const; + + httpRequestNode = { + name: 'Dynatrace', + docsUrl: 'https://docs.dynatrace.com/docs/dynatrace-api', + apiBaseUrlPlaceholder: 'https://{your-environment-id}.live.dynatrace.com/api/v2/events', + }; + + properties: INodeProperties[] = [ + { + displayName: 'API Key', + name: 'apiKey', + required: true, + type: 'string', + typeOptions: { password: true }, + default: '', + }, + ]; + + authenticate: IAuthenticateGeneric = { + type: 'generic', + properties: { + headers: { + Authorization: '=Api-Token {{$credentials.apiKey}}', + }, + }, + }; +} diff --git a/packages/nodes-base/credentials/ElasticSecurityApi.credentials.ts b/packages/nodes-base/credentials/ElasticSecurityApi.credentials.ts index 11759991fe321..6571428f97c20 100644 --- a/packages/nodes-base/credentials/ElasticSecurityApi.credentials.ts +++ b/packages/nodes-base/credentials/ElasticSecurityApi.credentials.ts @@ -1,4 +1,10 @@ -import type { ICredentialType, INodeProperties } from 'n8n-workflow'; +import type { + ICredentialDataDecryptedObject, + ICredentialTestRequest, + ICredentialType, + IHttpRequestOptions, + INodeProperties, +} from 'n8n-workflow'; export class ElasticSecurityApi implements ICredentialType { name = 'elasticSecurityApi'; @@ -8,12 +14,42 @@ export class ElasticSecurityApi implements ICredentialType { documentationUrl = 'elasticSecurity'; properties: INodeProperties[] = [ + { + displayName: 'Base URL', + name: 'baseUrl', + type: 'string', + default: '', + placeholder: 'e.g. https://mydeployment.kb.us-central1.gcp.cloud.es.io:9243', + description: "Referred to as Kibana 'endpoint' in the Elastic deployment dashboard", + required: true, + }, + { + displayName: 'Type', + name: 'type', + type: 'options', + options: [ + { + name: 'API Key', + value: 'apiKey', + }, + { + name: 'Basic Auth', + value: 'basicAuth', + }, + ], + default: 'basicAuth', + }, { displayName: 'Username', name: 'username', type: 'string', default: '', required: true, + displayOptions: { + show: { + type: ['basicAuth'], + }, + }, }, { displayName: 'Password', @@ -24,15 +60,52 @@ export class ElasticSecurityApi implements ICredentialType { }, default: '', required: true, + displayOptions: { + show: { + type: ['basicAuth'], + }, + }, }, { - displayName: 'Base URL', - name: 'baseUrl', + displayName: 'API Key', + name: 'apiKey', + required: true, type: 'string', + typeOptions: { password: true }, default: '', - placeholder: 'e.g. https://mydeployment.kb.us-central1.gcp.cloud.es.io:9243', - description: "Referred to as Kibana 'endpoint' in the Elastic deployment dashboard", - required: true, + displayOptions: { + show: { + type: ['apiKey'], + }, + }, }, ]; + + async authenticate( + credentials: ICredentialDataDecryptedObject, + requestOptions: IHttpRequestOptions, + ): Promise { + if (credentials.type === 'apiKey') { + requestOptions.headers = { + Authorization: `ApiKey ${credentials.apiKey}`, + }; + } else { + requestOptions.auth = { + username: credentials.username as string, + password: credentials.password as string, + }; + requestOptions.headers = { + 'kbn-xsrf': true, + }; + } + return requestOptions; + } + + test: ICredentialTestRequest = { + request: { + baseURL: '={{$credentials.baseUrl}}', + url: '/api/endpoint/metadata', + method: 'GET', + }, + }; } diff --git a/packages/nodes-base/credentials/FilescanApi.credentials.ts b/packages/nodes-base/credentials/FilescanApi.credentials.ts new file mode 100644 index 0000000000000..ebc4562b0f5bd --- /dev/null +++ b/packages/nodes-base/credentials/FilescanApi.credentials.ts @@ -0,0 +1,50 @@ +import type { + IAuthenticateGeneric, + ICredentialTestRequest, + ICredentialType, + INodeProperties, +} from 'n8n-workflow'; + +export class FilescanApi implements ICredentialType { + name = 'filescanApi'; + + displayName = 'Filescan API'; + + documentationUrl = 'filescan'; + + icon = { light: 'file:icons/Filescan.svg', dark: 'file:icons/Filescan.svg' } as const; + + httpRequestNode = { + name: 'Filescan', + docsUrl: 'https://www.filescan.io/api/docs', + apiBaseUrlPlaceholder: 'https://www.filescan.io/api/system/do-healthcheck', + }; + + properties: INodeProperties[] = [ + { + displayName: 'API Key', + name: 'apiKey', + required: true, + type: 'string', + typeOptions: { password: true }, + default: '', + }, + ]; + + authenticate: IAuthenticateGeneric = { + type: 'generic', + properties: { + headers: { + 'X-Api-Key': '={{$credentials.apiKey}}', + }, + }, + }; + + test: ICredentialTestRequest = { + request: { + baseURL: 'https://www.filescan.io/api', + url: '/system/do-healthcheck', + method: 'GET', + }, + }; +} diff --git a/packages/nodes-base/credentials/MalcoreApi.credentials.ts b/packages/nodes-base/credentials/MalcoreApi.credentials.ts new file mode 100644 index 0000000000000..fc299f35ea49a --- /dev/null +++ b/packages/nodes-base/credentials/MalcoreApi.credentials.ts @@ -0,0 +1,51 @@ +import type { + IAuthenticateGeneric, + ICredentialTestRequest, + ICredentialType, + INodeProperties, +} from 'n8n-workflow'; + +export class MalcoreApi implements ICredentialType { + name = 'malcoreApi'; + + displayName = 'MalcoreAPI'; + + documentationUrl = 'malcore'; + + icon = { light: 'file:icons/Malcore.png', dark: 'file:icons/Malcore.png' } as const; + + httpRequestNode = { + name: 'Malcore', + docsUrl: 'https://malcore.readme.io/reference/upload', + apiBaseUrlPlaceholder: 'https://api.malcore.io/api/urlcheck', + }; + + properties: INodeProperties[] = [ + { + displayName: 'API Key', + name: 'apiKey', + required: true, + type: 'string', + typeOptions: { password: true }, + default: '', + }, + ]; + + authenticate: IAuthenticateGeneric = { + type: 'generic', + properties: { + headers: { + apiKey: '={{$credentials.apiKey}}', + }, + }, + }; + + test: ICredentialTestRequest = { + request: { + baseURL: 'https://api.malcore.io/api', + url: '/urlcheck', + method: 'POST', + body: { url: 'google.com' }, + }, + }; +} diff --git a/packages/nodes-base/credentials/icons/Datadog.svg b/packages/nodes-base/credentials/icons/Datadog.svg new file mode 100644 index 0000000000000..49e6f8473f8b9 --- /dev/null +++ b/packages/nodes-base/credentials/icons/Datadog.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/nodes-base/credentials/icons/DfirIris.svg b/packages/nodes-base/credentials/icons/DfirIris.svg new file mode 100644 index 0000000000000..83c41d6544a13 --- /dev/null +++ b/packages/nodes-base/credentials/icons/DfirIris.svg @@ -0,0 +1,403 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/nodes-base/credentials/icons/Dynatrace.svg b/packages/nodes-base/credentials/icons/Dynatrace.svg new file mode 100644 index 0000000000000..863f93c12323a --- /dev/null +++ b/packages/nodes-base/credentials/icons/Dynatrace.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/nodes-base/credentials/icons/Elastic.svg b/packages/nodes-base/credentials/icons/Elastic.svg new file mode 100644 index 0000000000000..d240ad568c88f --- /dev/null +++ b/packages/nodes-base/credentials/icons/Elastic.svg @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/packages/nodes-base/credentials/icons/Filescan.svg b/packages/nodes-base/credentials/icons/Filescan.svg new file mode 100644 index 0000000000000..16f2bdba0a7ee --- /dev/null +++ b/packages/nodes-base/credentials/icons/Filescan.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/nodes-base/credentials/icons/Malcore.png b/packages/nodes-base/credentials/icons/Malcore.png new file mode 100644 index 0000000000000000000000000000000000000000..b7f3ef35cad7ff4890bc8071583daad40bd0d7c1 GIT binary patch literal 13238 zcmeIZ=U0=>7d0#(T?oDR-a80LlisU@5Nd>gp-2}Hl$HP@NRLRBUJ^9)B2t3%rj&?) z^dbT2A_#gv;rILv@B8Wbkd>9JS=Y>&IcJ|e=j`i+wWSda6$jO=TeoOTjP-4A-6E2@ z`B0D%{)v3{Dva<&6k=~re{aHlb?CB6z)$`1)2mg30R;X8n zYy=b=-vAG8hUeNz^79ihP;kmdu^~0j8@+M!8|>*x?wpDdy@Pyk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5v-eG;F_xohjO2T)sI$zFT%f|Mi zHwkjz8iFT~+gqQk!j&r|H1(hQRrG(Hm$`vxCe9JZWUp_g> z$eIT2Kp(W+M++%I+!QM57;O?yXp5@pyu>_~-sp!i;G*bTy;9N>V<%^)W>boL;K6p| zo$hM$B~m00Vv+={$%qLN%W){Qp|A9#*_D$fKGXr!&{|wI@_LbC3?F>{EY}27oz=i> zckRfB)|eGB1I!AvJxRoHv=a*d>z#vEBv-{||Kf@G-y-Kq6QPl+;=qk>Y&D|o-AZuQ zZ~rM(xOXONw1ZrcWOrW^Sw+HIgdTkSuB)h(`fx67kLlZ8I|1pvLnX|e2o16Mf@`w} znCjU{g+bhkya>g3F^^?K4DC<~rd&8R)mN(0b%CRC^eZRdxUnJ~(x23U^7?IRBGM29 zRT^AbyLpSESC^2NF0TV`bH$DFt-|f!l%6E26Tc#8I;Mz>dg*KK5Z<21WtRx35nR0) j$o2mQ{{Of=*D=Gk6p2Hy)-%G3IJZm;EcM^%y2t+?m}tcf literal 0 HcmV?d00001 diff --git a/packages/nodes-base/nodes/Elastic/ElasticSecurity/ElasticSecurity.node.ts b/packages/nodes-base/nodes/Elastic/ElasticSecurity/ElasticSecurity.node.ts index 5d53ce9647da7..36df215476567 100644 --- a/packages/nodes-base/nodes/Elastic/ElasticSecurity/ElasticSecurity.node.ts +++ b/packages/nodes-base/nodes/Elastic/ElasticSecurity/ElasticSecurity.node.ts @@ -1,15 +1,11 @@ import type { IExecuteFunctions, - ICredentialsDecrypted, - ICredentialTestFunctions, IDataObject, ILoadOptionsFunctions, - INodeCredentialTestResult, INodeExecutionData, INodePropertyOptions, INodeType, INodeTypeDescription, - IRequestOptions, } from 'n8n-workflow'; import { NodeOperationError } from 'n8n-workflow'; @@ -19,7 +15,6 @@ import { getVersion, handleListing, throwOnEmptyUpdate, - tolerateTrailingSlash, } from './GenericFunctions'; import { @@ -33,12 +28,7 @@ import { connectorOperations, } from './descriptions'; -import type { - Connector, - ConnectorCreatePayload, - ConnectorType, - ElasticSecurityApiCredentials, -} from './types'; +import type { Connector, ConnectorCreatePayload, ConnectorType } from './types'; export class ElasticSecurity implements INodeType { description: INodeTypeDescription = { @@ -58,7 +48,6 @@ export class ElasticSecurity implements INodeType { { name: 'elasticSecurityApi', required: true, - testedBy: 'elasticSecurityApiTest', }, ], properties: [ @@ -115,49 +104,6 @@ export class ElasticSecurity implements INodeType { return connectors.map(({ name, id }) => ({ name, value: id })); }, }, - credentialTest: { - async elasticSecurityApiTest( - this: ICredentialTestFunctions, - credential: ICredentialsDecrypted, - ): Promise { - const { - username, - password, - baseUrl: rawBaseUrl, - } = credential.data as ElasticSecurityApiCredentials; - - const baseUrl = tolerateTrailingSlash(rawBaseUrl); - - const token = Buffer.from(`${username}:${password}`).toString('base64'); - - const endpoint = '/cases/status'; - - const options: IRequestOptions = { - headers: { - Authorization: `Basic ${token}`, - 'kbn-xsrf': true, - }, - method: 'GET', - body: {}, - qs: {}, - uri: `${baseUrl}/api${endpoint}`, - json: true, - }; - - try { - await this.helpers.request(options); - return { - status: 'OK', - message: 'Authentication successful', - }; - } catch (error) { - return { - status: 'Error', - message: error.message, - }; - } - }, - }, }; async execute(this: IExecuteFunctions): Promise { diff --git a/packages/nodes-base/nodes/Elastic/ElasticSecurity/GenericFunctions.ts b/packages/nodes-base/nodes/Elastic/ElasticSecurity/GenericFunctions.ts index 696170cff1af3..7a055eb1e16f4 100644 --- a/packages/nodes-base/nodes/Elastic/ElasticSecurity/GenericFunctions.ts +++ b/packages/nodes-base/nodes/Elastic/ElasticSecurity/GenericFunctions.ts @@ -21,21 +21,13 @@ export async function elasticSecurityApiRequest( body: IDataObject = {}, qs: IDataObject = {}, ) { - const { - username, - password, - baseUrl: rawBaseUrl, - } = (await this.getCredentials('elasticSecurityApi')) as ElasticSecurityApiCredentials; + const { baseUrl: rawBaseUrl } = (await this.getCredentials( + 'elasticSecurityApi', + )) as ElasticSecurityApiCredentials; const baseUrl = tolerateTrailingSlash(rawBaseUrl); - const token = Buffer.from(`${username}:${password}`).toString('base64'); - const options: IRequestOptions = { - headers: { - Authorization: `Basic ${token}`, - 'kbn-xsrf': true, - }, method, body, qs, @@ -52,7 +44,7 @@ export async function elasticSecurityApiRequest( } try { - return await this.helpers.request(options); + return await this.helpers.requestWithAuthentication.call(this, 'elasticSecurityApi', options); } catch (error) { if (error?.error?.error === 'Not Acceptable' && error?.error?.message) { error.error.error = `${error.error.error}: ${error.error.message}`; diff --git a/packages/nodes-base/nodes/Elastic/ElasticSecurity/types.ts b/packages/nodes-base/nodes/Elastic/ElasticSecurity/types.ts index 268762ec621c7..dd426714e7f33 100644 --- a/packages/nodes-base/nodes/Elastic/ElasticSecurity/types.ts +++ b/packages/nodes-base/nodes/Elastic/ElasticSecurity/types.ts @@ -1,6 +1,7 @@ export type ElasticSecurityApiCredentials = { - username: string; - password: string; + username?: string; + password?: string; + apiKey?: string; baseUrl: string; }; diff --git a/packages/nodes-base/package.json b/packages/nodes-base/package.json index db05bf38c14ef..4239424b67a08 100644 --- a/packages/nodes-base/package.json +++ b/packages/nodes-base/package.json @@ -75,8 +75,10 @@ "dist/credentials/CrowdStrikeOAuth2Api.credentials.js", "dist/credentials/CrowdDevApi.credentials.js", "dist/credentials/CustomerIoApi.credentials.js", + "dist/credentials/DatadogApi.credentials.js", "dist/credentials/DeepLApi.credentials.js", "dist/credentials/DemioApi.credentials.js", + "dist/credentials/DfirIrisApi.credentials.js", "dist/credentials/DhlApi.credentials.js", "dist/credentials/DiscordBotApi.credentials.js", "dist/credentials/DiscordOAuth2Api.credentials.js", @@ -88,6 +90,7 @@ "dist/credentials/DropboxApi.credentials.js", "dist/credentials/DropboxOAuth2Api.credentials.js", "dist/credentials/DropcontactApi.credentials.js", + "dist/credentials/DynatraceApi.credentials.js", "dist/credentials/EgoiApi.credentials.js", "dist/credentials/ElasticsearchApi.credentials.js", "dist/credentials/ElasticSecurityApi.credentials.js", @@ -101,6 +104,7 @@ "dist/credentials/FacebookLeadAdsOAuth2Api.credentials.js", "dist/credentials/FigmaApi.credentials.js", "dist/credentials/FileMaker.credentials.js", + "dist/credentials/FilescanApi.credentials.js", "dist/credentials/FlowApi.credentials.js", "dist/credentials/FormIoApi.credentials.js", "dist/credentials/FormstackApi.credentials.js", @@ -198,6 +202,7 @@ "dist/credentials/MailgunApi.credentials.js", "dist/credentials/MailjetEmailApi.credentials.js", "dist/credentials/MailjetSmsApi.credentials.js", + "dist/credentials/MalcoreApi.credentials.js", "dist/credentials/MandrillApi.credentials.js", "dist/credentials/MarketstackApi.credentials.js", "dist/credentials/MatrixApi.credentials.js",