mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
refactor: Format nodes-base package (A-F) (#3800)
* 🔨 prettier formated nodes - A * 🔨 prettier formated nodes - B * ⚡ prettier formated nodes - C * ⚡ prettier formated nodes - D * ⚡ prettier formated nodes - E-F * 🎨 Adjust nodes-base formatting command (#3805) * Format additional files in nodes A-F (#3811) * ⚡ fixes * 🎨 Add Mindee to ignored dirs Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
This commit is contained in:
@@ -1,19 +1,10 @@
|
||||
import {
|
||||
URL,
|
||||
} from 'url';
|
||||
import { URL } from 'url';
|
||||
|
||||
import {
|
||||
Request,
|
||||
sign,
|
||||
} from 'aws4';
|
||||
import { Request, sign } from 'aws4';
|
||||
|
||||
import {
|
||||
OptionsWithUri,
|
||||
} from 'request';
|
||||
import { OptionsWithUri } from 'request';
|
||||
|
||||
import {
|
||||
parseString,
|
||||
} from 'xml2js';
|
||||
import { parseString } from 'xml2js';
|
||||
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
@@ -22,11 +13,12 @@ import {
|
||||
IWebhookFunctions,
|
||||
} from 'n8n-core';
|
||||
|
||||
import {
|
||||
ICredentialDataDecryptedObject, NodeApiError, NodeOperationError,
|
||||
} from 'n8n-workflow';
|
||||
import { ICredentialDataDecryptedObject, NodeApiError, NodeOperationError } from 'n8n-workflow';
|
||||
|
||||
function getEndpointForService(service: string, credentials: ICredentialDataDecryptedObject): string {
|
||||
function getEndpointForService(
|
||||
service: string,
|
||||
credentials: ICredentialDataDecryptedObject,
|
||||
): string {
|
||||
let endpoint;
|
||||
if (service === 'lambda' && credentials.lambdaEndpoint) {
|
||||
endpoint = credentials.lambdaEndpoint;
|
||||
@@ -38,7 +30,15 @@ function getEndpointForService(service: string, credentials: ICredentialDataDecr
|
||||
return (endpoint as string).replace('{region}', credentials.region as string);
|
||||
}
|
||||
|
||||
export async function awsApiRequest(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, service: string, method: string, path: string, body?: string, headers?: object): Promise<any> { // tslint:disable-line:no-any
|
||||
export async function awsApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
||||
service: string,
|
||||
method: string,
|
||||
path: string,
|
||||
body?: string,
|
||||
headers?: object,
|
||||
// tslint:disable-next-line:no-any
|
||||
): Promise<any> {
|
||||
const credentials = await this.getCredentials('aws');
|
||||
|
||||
// Concatenate path and instantiate URL object so it parses correctly query strings
|
||||
@@ -49,7 +49,9 @@ export async function awsApiRequest(this: IHookFunctions | IExecuteFunctions | I
|
||||
const securityHeaders = {
|
||||
accessKeyId: `${credentials.accessKeyId}`.trim(),
|
||||
secretAccessKey: `${credentials.secretAccessKey}`.trim(),
|
||||
sessionToken: credentials.temporaryCredentials ? `${credentials.sessionToken}`.trim() : undefined,
|
||||
sessionToken: credentials.temporaryCredentials
|
||||
? `${credentials.sessionToken}`.trim()
|
||||
: undefined,
|
||||
};
|
||||
|
||||
sign(signOpts, securityHeaders);
|
||||
@@ -68,7 +70,15 @@ export async function awsApiRequest(this: IHookFunctions | IExecuteFunctions | I
|
||||
}
|
||||
}
|
||||
|
||||
export async function awsApiRequestREST(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, service: string, method: string, path: string, body?: string, headers?: object): Promise<any> { // tslint:disable-line:no-any
|
||||
export async function awsApiRequestREST(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
service: string,
|
||||
method: string,
|
||||
path: string,
|
||||
body?: string,
|
||||
headers?: object,
|
||||
// tslint:disable-next-line:no-any
|
||||
): Promise<any> {
|
||||
const response = await awsApiRequest.call(this, service, method, path, body, headers);
|
||||
try {
|
||||
return JSON.parse(response);
|
||||
@@ -77,7 +87,15 @@ export async function awsApiRequestREST(this: IHookFunctions | IExecuteFunctions
|
||||
}
|
||||
}
|
||||
|
||||
export async function awsApiRequestSOAP(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, service: string, method: string, path: string, body?: string, headers?: object): Promise<any> { // tslint:disable-line:no-any
|
||||
export async function awsApiRequestSOAP(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
||||
service: string,
|
||||
method: string,
|
||||
path: string,
|
||||
body?: string,
|
||||
headers?: object,
|
||||
// tslint:disable-next-line:no-any
|
||||
): Promise<any> {
|
||||
const response = await awsApiRequest.call(this, service, method, path, body, headers);
|
||||
try {
|
||||
return await new Promise((resolve, reject) => {
|
||||
|
||||
Reference in New Issue
Block a user