mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
n8n-3867-progressively-apply-prettier-to-all (#3873)
* 🔨 formatting nodes with prettier
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
/* eslint-disable n8n-nodes-base/node-filename-against-convention */
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
@@ -19,25 +17,13 @@ import {
|
||||
quickbaseApiRequestAllItems,
|
||||
} from './GenericFunctions';
|
||||
|
||||
import {
|
||||
fieldFields,
|
||||
fieldOperations,
|
||||
} from './FieldDescription';
|
||||
import { fieldFields, fieldOperations } from './FieldDescription';
|
||||
|
||||
import {
|
||||
fileFields,
|
||||
fileOperations,
|
||||
} from './FileDescription';
|
||||
import { fileFields, fileOperations } from './FileDescription';
|
||||
|
||||
import {
|
||||
recordFields,
|
||||
recordOperations,
|
||||
} from './RecordDescription';
|
||||
import { recordFields, recordOperations } from './RecordDescription';
|
||||
|
||||
import {
|
||||
reportFields,
|
||||
reportOperations,
|
||||
} from './ReportDescription';
|
||||
import { reportFields, reportOperations } from './ReportDescription';
|
||||
|
||||
export class QuickBase implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
@@ -142,7 +128,6 @@ export class QuickBase implements INodeType {
|
||||
if (resource === 'field') {
|
||||
if (operation === 'getAll') {
|
||||
for (let i = 0; i < length; i++) {
|
||||
|
||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
|
||||
const tableId = this.getNodeParameter('tableId', i) as string;
|
||||
@@ -179,16 +164,18 @@ export class QuickBase implements INodeType {
|
||||
|
||||
const versionNumber = this.getNodeParameter('versionNumber', i) as string;
|
||||
|
||||
responseData = await quickbaseApiRequest.call(this, 'DELETE', `/files/${tableId}/${recordId}/${fieldId}/${versionNumber}`);
|
||||
responseData = await quickbaseApiRequest.call(
|
||||
this,
|
||||
'DELETE',
|
||||
`/files/${tableId}/${recordId}/${fieldId}/${versionNumber}`,
|
||||
);
|
||||
|
||||
returnData.push(responseData);
|
||||
}
|
||||
}
|
||||
|
||||
if (operation === 'download') {
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
|
||||
const tableId = this.getNodeParameter('tableId', i) as string;
|
||||
|
||||
const recordId = this.getNodeParameter('recordId', i) as string;
|
||||
@@ -213,14 +200,24 @@ export class QuickBase implements INodeType {
|
||||
|
||||
const dataPropertyNameDownload = this.getNodeParameter('binaryPropertyName', i) as string;
|
||||
|
||||
responseData = await quickbaseApiRequest.call(this, 'GET', `/files/${tableId}/${recordId}/${fieldId}/${versionNumber}`, {}, {}, { json: false, resolveWithFullResponse: true });
|
||||
responseData = await quickbaseApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/files/${tableId}/${recordId}/${fieldId}/${versionNumber}`,
|
||||
{},
|
||||
{},
|
||||
{ json: false, resolveWithFullResponse: true },
|
||||
);
|
||||
|
||||
//content-disposition': 'attachment; filename="dog-puppy-on-garden-royalty-free-image-1586966191.jpg"',
|
||||
const contentDisposition = responseData.headers['content-disposition'];
|
||||
|
||||
const data = Buffer.from(responseData.body as string, 'base64');
|
||||
|
||||
items[i].binary![dataPropertyNameDownload] = await this.helpers.prepareBinaryData(data as unknown as Buffer, contentDisposition.split('=')[1]);
|
||||
items[i].binary![dataPropertyNameDownload] = await this.helpers.prepareBinaryData(
|
||||
data as unknown as Buffer,
|
||||
contentDisposition.split('=')[1],
|
||||
);
|
||||
}
|
||||
|
||||
return this.prepareOutputData(items);
|
||||
@@ -242,7 +239,7 @@ export class QuickBase implements INodeType {
|
||||
|
||||
const columns = this.getNodeParameter('columns', i) as string;
|
||||
|
||||
const columnList = columns.split(',').map(column => column.trim());
|
||||
const columnList = columns.split(',').map((column) => column.trim());
|
||||
if (options.useFieldIDs === true) {
|
||||
for (const key of Object.keys(items[i].json)) {
|
||||
record[key] = { value: items[i].json[key] };
|
||||
@@ -313,7 +310,6 @@ export class QuickBase implements INodeType {
|
||||
|
||||
if (operation === 'getAll') {
|
||||
for (let i = 0; i < length; i++) {
|
||||
|
||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
|
||||
const tableId = this.getNodeParameter('tableId', i) as string;
|
||||
@@ -339,7 +335,13 @@ export class QuickBase implements INodeType {
|
||||
// }
|
||||
|
||||
if (returnAll) {
|
||||
responseData = await quickbaseApiRequestAllItems.call(this, 'POST', '/records/query', body, qs);
|
||||
responseData = await quickbaseApiRequestAllItems.call(
|
||||
this,
|
||||
'POST',
|
||||
'/records/query',
|
||||
body,
|
||||
qs,
|
||||
);
|
||||
} else {
|
||||
body.options = { top: this.getNodeParameter('limit', i) as number };
|
||||
|
||||
@@ -384,7 +386,7 @@ export class QuickBase implements INodeType {
|
||||
|
||||
const columns = this.getNodeParameter('columns', i) as string;
|
||||
|
||||
const columnList = columns.split(',').map(column => column.trim());
|
||||
const columnList = columns.split(',').map((column) => column.trim());
|
||||
|
||||
if (options.useFieldIDs === true) {
|
||||
for (const key of Object.keys(items[i].json)) {
|
||||
@@ -400,7 +402,11 @@ export class QuickBase implements INodeType {
|
||||
}
|
||||
|
||||
if (items[i].json[updateKey] === undefined) {
|
||||
throw new NodeOperationError(this.getNode(), `The update key ${updateKey} could not be found in the input`, { itemIndex: i });
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
`The update key ${updateKey} could not be found in the input`,
|
||||
{ itemIndex: i },
|
||||
);
|
||||
}
|
||||
|
||||
data.push(record);
|
||||
@@ -459,7 +465,7 @@ export class QuickBase implements INodeType {
|
||||
|
||||
const columns = this.getNodeParameter('columns', i) as string;
|
||||
|
||||
const columnList = columns.split(',').map(column => column.trim());
|
||||
const columnList = columns.split(',').map((column) => column.trim());
|
||||
|
||||
if (options.useFieldIDs === true) {
|
||||
for (const key of Object.keys(items[i].json)) {
|
||||
@@ -475,7 +481,11 @@ export class QuickBase implements INodeType {
|
||||
}
|
||||
|
||||
if (items[i].json[updateKey] === undefined) {
|
||||
throw new NodeOperationError(this.getNode(), `The update key ${updateKey} could not be found in the input`, { itemIndex: i });
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
`The update key ${updateKey} could not be found in the input`,
|
||||
{ itemIndex: i },
|
||||
);
|
||||
}
|
||||
|
||||
record[mergeFieldId] = { value: items[i].json[updateKey] };
|
||||
@@ -521,10 +531,8 @@ export class QuickBase implements INodeType {
|
||||
}
|
||||
|
||||
if (resource === 'report') {
|
||||
|
||||
if (operation === 'run') {
|
||||
for (let i = 0; i < length; i++) {
|
||||
|
||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
|
||||
const tableId = this.getNodeParameter('tableId', i) as string;
|
||||
@@ -534,11 +542,23 @@ export class QuickBase implements INodeType {
|
||||
qs.tableId = tableId;
|
||||
|
||||
if (returnAll) {
|
||||
responseData = await quickbaseApiRequestAllItems.call(this, 'POST', `/reports/${reportId}/run`, {}, qs);
|
||||
responseData = await quickbaseApiRequestAllItems.call(
|
||||
this,
|
||||
'POST',
|
||||
`/reports/${reportId}/run`,
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
} else {
|
||||
qs.top = this.getNodeParameter('limit', i) as number;
|
||||
|
||||
responseData = await quickbaseApiRequest.call(this, 'POST', `/reports/${reportId}/run`, {}, qs);
|
||||
responseData = await quickbaseApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
`/reports/${reportId}/run`,
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
|
||||
const { data: records, fields } = responseData;
|
||||
responseData = [];
|
||||
@@ -563,14 +583,19 @@ export class QuickBase implements INodeType {
|
||||
|
||||
if (operation === 'get') {
|
||||
for (let i = 0; i < length; i++) {
|
||||
|
||||
const reportId = this.getNodeParameter('reportId', i) as string;
|
||||
|
||||
const tableId = this.getNodeParameter('tableId', i) as string;
|
||||
|
||||
qs.tableId = tableId;
|
||||
|
||||
responseData = await quickbaseApiRequest.call(this, 'GET', `/reports/${reportId}`, {}, qs);
|
||||
responseData = await quickbaseApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/reports/${reportId}`,
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
|
||||
returnData.push(responseData);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user