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:
Michael Kret
2022-08-01 23:47:55 +03:00
committed by GitHub
parent 2c17e6f3ca
commit 0ecbb4a19d
411 changed files with 12906 additions and 20148 deletions

View File

@@ -1,23 +1,10 @@
import {
IExecuteFunctions,
} from 'n8n-core';
import { IExecuteFunctions } from 'n8n-core';
import {
OptionsWithUri,
} from 'request';
import { OptionsWithUri } from 'request';
import {
IDataObject,
ILoadOptionsFunctions,
NodeApiError,
NodeOperationError,
} from 'n8n-workflow';
import { IDataObject, ILoadOptionsFunctions, NodeApiError, NodeOperationError } from 'n8n-workflow';
import {
Accumulator,
BaserowCredentials,
LoadedResource,
} from './types';
import { Accumulator, BaserowCredentials, LoadedResource } from './types';
/**
* Make a request to Baserow API.
@@ -30,7 +17,7 @@ export async function baserowApiRequest(
qs: IDataObject = {},
jwtToken: string,
) {
const credentials = await this.getCredentials('baserowApi') as BaserowCredentials;
const credentials = (await this.getCredentials('baserowApi')) as BaserowCredentials;
const options: OptionsWithUri = {
headers: {
@@ -110,7 +97,7 @@ export async function getJwtToken(
};
try {
const { token } = await this.helpers.request!(options) as { token: string };
const { token } = (await this.helpers.request!(options)) as { token: string };
return token;
} catch (error) {
throw new NodeApiError(this.getNode(), error);
@@ -123,7 +110,14 @@ export async function getFieldNamesAndIds(
jwtToken: string,
) {
const endpoint = `/api/database/fields/table/${tableId}/`;
const response = await baserowApiRequest.call(this, 'GET', endpoint, {}, {}, jwtToken) as LoadedResource[];
const response = (await baserowApiRequest.call(
this,
'GET',
endpoint,
{},
{},
jwtToken,
)) as LoadedResource[];
return {
names: response.map((field) => field.name),
@@ -183,7 +177,7 @@ export class TableFieldMapper {
});
}
namesToIds(obj: Record<string, unknown>) {
namesToIds(obj: Record<string, unknown>) {
Object.entries(obj).forEach(([key, value]) => {
if (this.nameToIdMapping[key] !== undefined) {
delete obj[key];