mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
n8n-3867-progressively-apply-prettier-to-all (#3873)
* 🔨 formatting nodes with prettier
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
@@ -11,70 +9,33 @@ import {
|
||||
INodeTypeDescription,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
invoiceNinjaApiRequest,
|
||||
invoiceNinjaApiRequestAllItems,
|
||||
} from './GenericFunctions';
|
||||
import { invoiceNinjaApiRequest, invoiceNinjaApiRequestAllItems } from './GenericFunctions';
|
||||
|
||||
import {
|
||||
clientFields,
|
||||
clientOperations,
|
||||
} from './ClientDescription';
|
||||
import { clientFields, clientOperations } from './ClientDescription';
|
||||
|
||||
import {
|
||||
invoiceFields,
|
||||
invoiceOperations,
|
||||
} from './InvoiceDescription';
|
||||
import { invoiceFields, invoiceOperations } from './InvoiceDescription';
|
||||
|
||||
import {
|
||||
IClient,
|
||||
IContact,
|
||||
} from './ClientInterface';
|
||||
import { IClient, IContact } from './ClientInterface';
|
||||
|
||||
import {
|
||||
countryCodes,
|
||||
} from './ISOCountryCodes';
|
||||
import { countryCodes } from './ISOCountryCodes';
|
||||
|
||||
import {
|
||||
IInvoice,
|
||||
IItem,
|
||||
} from './invoiceInterface';
|
||||
import { IInvoice, IItem } from './invoiceInterface';
|
||||
|
||||
import {
|
||||
taskFields,
|
||||
taskOperations,
|
||||
} from './TaskDescription';
|
||||
import { taskFields, taskOperations } from './TaskDescription';
|
||||
|
||||
import {
|
||||
ITask,
|
||||
} from './TaskInterface';
|
||||
import { ITask } from './TaskInterface';
|
||||
|
||||
import {
|
||||
paymentFields,
|
||||
paymentOperations,
|
||||
} from './PaymentDescription';
|
||||
import { paymentFields, paymentOperations } from './PaymentDescription';
|
||||
|
||||
import {
|
||||
IPayment,
|
||||
} from './PaymentInterface';
|
||||
import { IPayment } from './PaymentInterface';
|
||||
|
||||
import {
|
||||
expenseFields,
|
||||
expenseOperations,
|
||||
} from './ExpenseDescription';
|
||||
import { expenseFields, expenseOperations } from './ExpenseDescription';
|
||||
|
||||
import {
|
||||
IExpense,
|
||||
} from './ExpenseInterface';
|
||||
import { IExpense } from './ExpenseInterface';
|
||||
|
||||
import {
|
||||
quoteFields,
|
||||
quoteOperations,
|
||||
} from './QuoteDescription';
|
||||
import { quoteFields, quoteOperations } from './QuoteDescription';
|
||||
|
||||
import {
|
||||
IQuote,
|
||||
} from './QuoteInterface';
|
||||
import { IQuote } from './QuoteInterface';
|
||||
|
||||
export class InvoiceNinja implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
@@ -166,7 +127,12 @@ export class InvoiceNinja implements INodeType {
|
||||
// select them easily
|
||||
async getProjects(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
const projects = await invoiceNinjaApiRequestAllItems.call(this, 'data', 'GET', '/projects');
|
||||
const projects = await invoiceNinjaApiRequestAllItems.call(
|
||||
this,
|
||||
'data',
|
||||
'GET',
|
||||
'/projects',
|
||||
);
|
||||
for (const project of projects) {
|
||||
const projectName = project.name;
|
||||
const projectId = project.id;
|
||||
@@ -181,7 +147,12 @@ export class InvoiceNinja implements INodeType {
|
||||
// select them easily
|
||||
async getInvoices(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
const invoices = await invoiceNinjaApiRequestAllItems.call(this, 'data', 'GET', '/invoices');
|
||||
const invoices = await invoiceNinjaApiRequestAllItems.call(
|
||||
this,
|
||||
'data',
|
||||
'GET',
|
||||
'/invoices',
|
||||
);
|
||||
for (const invoice of invoices) {
|
||||
const invoiceName = invoice.invoice_number;
|
||||
const invoiceId = invoice.id;
|
||||
@@ -225,7 +196,12 @@ export class InvoiceNinja implements INodeType {
|
||||
// select them easily
|
||||
async getExpenseCategories(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
const categories = await invoiceNinjaApiRequestAllItems.call(this, 'data', 'GET', '/expense_categories');
|
||||
const categories = await invoiceNinjaApiRequestAllItems.call(
|
||||
this,
|
||||
'data',
|
||||
'GET',
|
||||
'/expense_categories',
|
||||
);
|
||||
for (const category of categories) {
|
||||
const categoryName = category.name;
|
||||
const categoryId = category.id;
|
||||
@@ -278,7 +254,8 @@ export class InvoiceNinja implements INodeType {
|
||||
if (additionalFields.website) {
|
||||
body.website = additionalFields.website as string;
|
||||
}
|
||||
const contactsValues = (this.getNodeParameter('contactsUi', i) as IDataObject).contacstValues as IDataObject[];
|
||||
const contactsValues = (this.getNodeParameter('contactsUi', i) as IDataObject)
|
||||
.contacstValues as IDataObject[];
|
||||
if (contactsValues) {
|
||||
const contacts: IContact[] = [];
|
||||
for (const contactValue of contactsValues) {
|
||||
@@ -292,7 +269,9 @@ export class InvoiceNinja implements INodeType {
|
||||
}
|
||||
body.contacts = contacts;
|
||||
}
|
||||
const shippingAddressValue = (this.getNodeParameter('shippingAddressUi', i) as IDataObject).shippingAddressValue as IDataObject;
|
||||
const shippingAddressValue = (
|
||||
this.getNodeParameter('shippingAddressUi', i) as IDataObject
|
||||
).shippingAddressValue as IDataObject;
|
||||
if (shippingAddressValue) {
|
||||
body.shipping_address1 = shippingAddressValue.streetAddress as string;
|
||||
body.shipping_address2 = shippingAddressValue.aptSuite as string;
|
||||
@@ -301,7 +280,9 @@ export class InvoiceNinja implements INodeType {
|
||||
body.shipping_postal_code = shippingAddressValue.postalCode as string;
|
||||
body.shipping_country_id = parseInt(shippingAddressValue.countryCode as string, 10);
|
||||
}
|
||||
const billingAddressValue = (this.getNodeParameter('billingAddressUi', i) as IDataObject).billingAddressValue as IDataObject;
|
||||
const billingAddressValue = (
|
||||
this.getNodeParameter('billingAddressUi', i) as IDataObject
|
||||
).billingAddressValue as IDataObject;
|
||||
if (billingAddressValue) {
|
||||
body.address1 = billingAddressValue.streetAddress as string;
|
||||
body.address2 = billingAddressValue.aptSuite as string;
|
||||
@@ -319,7 +300,13 @@ export class InvoiceNinja implements INodeType {
|
||||
if (options.include) {
|
||||
qs.include = options.include as string;
|
||||
}
|
||||
responseData = await invoiceNinjaApiRequest.call(this, 'GET', `/clients/${clientId}`, {}, qs);
|
||||
responseData = await invoiceNinjaApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/clients/${clientId}`,
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
responseData = responseData.data;
|
||||
}
|
||||
if (operation === 'getAll') {
|
||||
@@ -329,7 +316,14 @@ export class InvoiceNinja implements INodeType {
|
||||
qs.include = options.include as string;
|
||||
}
|
||||
if (returnAll === true) {
|
||||
responseData = await invoiceNinjaApiRequestAllItems.call(this, 'data', 'GET', '/clients', {}, qs);
|
||||
responseData = await invoiceNinjaApiRequestAllItems.call(
|
||||
this,
|
||||
'data',
|
||||
'GET',
|
||||
'/clients',
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
} else {
|
||||
qs.per_page = this.getNodeParameter('limit', 0) as number;
|
||||
responseData = await invoiceNinjaApiRequest.call(this, 'GET', '/clients', {}, qs);
|
||||
@@ -338,7 +332,11 @@ export class InvoiceNinja implements INodeType {
|
||||
}
|
||||
if (operation === 'delete') {
|
||||
const clientId = this.getNodeParameter('clientId', i) as string;
|
||||
responseData = await invoiceNinjaApiRequest.call(this, 'DELETE', `/clients/${clientId}`);
|
||||
responseData = await invoiceNinjaApiRequest.call(
|
||||
this,
|
||||
'DELETE',
|
||||
`/clients/${clientId}`,
|
||||
);
|
||||
responseData = responseData.data;
|
||||
}
|
||||
}
|
||||
@@ -412,7 +410,8 @@ export class InvoiceNinja implements INodeType {
|
||||
if (additionalFields.emailInvoice) {
|
||||
body.email_invoice = additionalFields.emailInvoice as boolean;
|
||||
}
|
||||
const invoceItemsValues = (this.getNodeParameter('invoiceItemsUi', i) as IDataObject).invoiceItemsValues as IDataObject[];
|
||||
const invoceItemsValues = (this.getNodeParameter('invoiceItemsUi', i) as IDataObject)
|
||||
.invoiceItemsValues as IDataObject[];
|
||||
if (invoceItemsValues) {
|
||||
const items: IItem[] = [];
|
||||
for (const itemValue of invoceItemsValues) {
|
||||
@@ -435,7 +434,9 @@ export class InvoiceNinja implements INodeType {
|
||||
}
|
||||
if (operation === 'email') {
|
||||
const invoiceId = this.getNodeParameter('invoiceId', i) as string;
|
||||
responseData = await invoiceNinjaApiRequest.call(this, 'POST', '/email_invoice', { id: invoiceId });
|
||||
responseData = await invoiceNinjaApiRequest.call(this, 'POST', '/email_invoice', {
|
||||
id: invoiceId,
|
||||
});
|
||||
}
|
||||
if (operation === 'get') {
|
||||
const invoiceId = this.getNodeParameter('invoiceId', i) as string;
|
||||
@@ -443,7 +444,13 @@ export class InvoiceNinja implements INodeType {
|
||||
if (options.include) {
|
||||
qs.include = options.include as string;
|
||||
}
|
||||
responseData = await invoiceNinjaApiRequest.call(this, 'GET', `/invoices/${invoiceId}`, {}, qs);
|
||||
responseData = await invoiceNinjaApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/invoices/${invoiceId}`,
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
responseData = responseData.data;
|
||||
}
|
||||
if (operation === 'getAll') {
|
||||
@@ -456,7 +463,14 @@ export class InvoiceNinja implements INodeType {
|
||||
qs.invoice_number = options.invoiceNumber as string;
|
||||
}
|
||||
if (returnAll === true) {
|
||||
responseData = await invoiceNinjaApiRequestAllItems.call(this, 'data', 'GET', '/invoices', {}, qs);
|
||||
responseData = await invoiceNinjaApiRequestAllItems.call(
|
||||
this,
|
||||
'data',
|
||||
'GET',
|
||||
'/invoices',
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
} else {
|
||||
qs.per_page = this.getNodeParameter('limit', 0) as number;
|
||||
responseData = await invoiceNinjaApiRequest.call(this, 'GET', '/invoices', {}, qs);
|
||||
@@ -465,7 +479,11 @@ export class InvoiceNinja implements INodeType {
|
||||
}
|
||||
if (operation === 'delete') {
|
||||
const invoiceId = this.getNodeParameter('invoiceId', i) as string;
|
||||
responseData = await invoiceNinjaApiRequest.call(this, 'DELETE', `/invoices/${invoiceId}`);
|
||||
responseData = await invoiceNinjaApiRequest.call(
|
||||
this,
|
||||
'DELETE',
|
||||
`/invoices/${invoiceId}`,
|
||||
);
|
||||
responseData = responseData.data;
|
||||
}
|
||||
}
|
||||
@@ -488,19 +506,21 @@ export class InvoiceNinja implements INodeType {
|
||||
if (additionalFields.description) {
|
||||
body.description = additionalFields.description as string;
|
||||
}
|
||||
const timeLogsValues = (this.getNodeParameter('timeLogsUi', i) as IDataObject).timeLogsValues as IDataObject[];
|
||||
const timeLogsValues = (this.getNodeParameter('timeLogsUi', i) as IDataObject)
|
||||
.timeLogsValues as IDataObject[];
|
||||
if (timeLogsValues) {
|
||||
const logs: number[][] = [];
|
||||
for (const logValue of timeLogsValues) {
|
||||
let from = 0, to;
|
||||
let from = 0,
|
||||
to;
|
||||
if (logValue.startDate) {
|
||||
from = new Date(logValue.startDate as string).getTime() / 1000 as number;
|
||||
from = (new Date(logValue.startDate as string).getTime() / 1000) as number;
|
||||
}
|
||||
if (logValue.endDate) {
|
||||
to = new Date(logValue.endDate as string).getTime() / 1000 as number;
|
||||
to = (new Date(logValue.endDate as string).getTime() / 1000) as number;
|
||||
}
|
||||
if (logValue.duration) {
|
||||
to = from + (logValue.duration as number * 3600);
|
||||
to = from + (logValue.duration as number) * 3600;
|
||||
}
|
||||
logs.push([from as number, to as number]);
|
||||
}
|
||||
@@ -515,7 +535,13 @@ export class InvoiceNinja implements INodeType {
|
||||
if (options.include) {
|
||||
qs.include = options.include as string;
|
||||
}
|
||||
responseData = await invoiceNinjaApiRequest.call(this, 'GET', `/tasks/${taskId}`, {}, qs);
|
||||
responseData = await invoiceNinjaApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/tasks/${taskId}`,
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
responseData = responseData.data;
|
||||
}
|
||||
if (operation === 'getAll') {
|
||||
@@ -525,7 +551,14 @@ export class InvoiceNinja implements INodeType {
|
||||
qs.include = options.include as string;
|
||||
}
|
||||
if (returnAll === true) {
|
||||
responseData = await invoiceNinjaApiRequestAllItems.call(this, 'data', 'GET', '/tasks', {}, qs);
|
||||
responseData = await invoiceNinjaApiRequestAllItems.call(
|
||||
this,
|
||||
'data',
|
||||
'GET',
|
||||
'/tasks',
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
} else {
|
||||
qs.per_page = this.getNodeParameter('limit', 0) as number;
|
||||
responseData = await invoiceNinjaApiRequest.call(this, 'GET', '/tasks', {}, qs);
|
||||
@@ -565,7 +598,13 @@ export class InvoiceNinja implements INodeType {
|
||||
if (options.include) {
|
||||
qs.include = options.include as string;
|
||||
}
|
||||
responseData = await invoiceNinjaApiRequest.call(this, 'GET', `/payments/${paymentId}`, {}, qs);
|
||||
responseData = await invoiceNinjaApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/payments/${paymentId}`,
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
responseData = responseData.data;
|
||||
}
|
||||
if (operation === 'getAll') {
|
||||
@@ -575,7 +614,14 @@ export class InvoiceNinja implements INodeType {
|
||||
qs.include = options.include as string;
|
||||
}
|
||||
if (returnAll === true) {
|
||||
responseData = await invoiceNinjaApiRequestAllItems.call(this, 'data', 'GET', '/payments', {}, qs);
|
||||
responseData = await invoiceNinjaApiRequestAllItems.call(
|
||||
this,
|
||||
'data',
|
||||
'GET',
|
||||
'/payments',
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
} else {
|
||||
qs.per_page = this.getNodeParameter('limit', 0) as number;
|
||||
responseData = await invoiceNinjaApiRequest.call(this, 'GET', '/payments', {}, qs);
|
||||
@@ -584,7 +630,11 @@ export class InvoiceNinja implements INodeType {
|
||||
}
|
||||
if (operation === 'delete') {
|
||||
const paymentId = this.getNodeParameter('paymentId', i) as string;
|
||||
responseData = await invoiceNinjaApiRequest.call(this, 'DELETE', `/payments/${paymentId}`);
|
||||
responseData = await invoiceNinjaApiRequest.call(
|
||||
this,
|
||||
'DELETE',
|
||||
`/payments/${paymentId}`,
|
||||
);
|
||||
responseData = responseData.data;
|
||||
}
|
||||
}
|
||||
@@ -648,13 +698,26 @@ export class InvoiceNinja implements INodeType {
|
||||
}
|
||||
if (operation === 'get') {
|
||||
const expenseId = this.getNodeParameter('expenseId', i) as string;
|
||||
responseData = await invoiceNinjaApiRequest.call(this, 'GET', `/expenses/${expenseId}`, {}, qs);
|
||||
responseData = await invoiceNinjaApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/expenses/${expenseId}`,
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
responseData = responseData.data;
|
||||
}
|
||||
if (operation === 'getAll') {
|
||||
const returnAll = this.getNodeParameter('returnAll', 0) as boolean;
|
||||
if (returnAll === true) {
|
||||
responseData = await invoiceNinjaApiRequestAllItems.call(this, 'data', 'GET', '/expenses', {}, qs);
|
||||
responseData = await invoiceNinjaApiRequestAllItems.call(
|
||||
this,
|
||||
'data',
|
||||
'GET',
|
||||
'/expenses',
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
} else {
|
||||
qs.per_page = this.getNodeParameter('limit', 0) as number;
|
||||
responseData = await invoiceNinjaApiRequest.call(this, 'GET', '/expenses', {}, qs);
|
||||
@@ -663,7 +726,11 @@ export class InvoiceNinja implements INodeType {
|
||||
}
|
||||
if (operation === 'delete') {
|
||||
const expenseId = this.getNodeParameter('expenseId', i) as string;
|
||||
responseData = await invoiceNinjaApiRequest.call(this, 'DELETE', `/expenses/${expenseId}`);
|
||||
responseData = await invoiceNinjaApiRequest.call(
|
||||
this,
|
||||
'DELETE',
|
||||
`/expenses/${expenseId}`,
|
||||
);
|
||||
responseData = responseData.data;
|
||||
}
|
||||
}
|
||||
@@ -739,7 +806,8 @@ export class InvoiceNinja implements INodeType {
|
||||
if (additionalFields.emailQuote) {
|
||||
body.email_invoice = additionalFields.emailQuote as boolean;
|
||||
}
|
||||
const invoceItemsValues = (this.getNodeParameter('invoiceItemsUi', i) as IDataObject).invoiceItemsValues as IDataObject[];
|
||||
const invoceItemsValues = (this.getNodeParameter('invoiceItemsUi', i) as IDataObject)
|
||||
.invoiceItemsValues as IDataObject[];
|
||||
if (invoceItemsValues) {
|
||||
const items: IItem[] = [];
|
||||
for (const itemValue of invoceItemsValues) {
|
||||
@@ -762,7 +830,9 @@ export class InvoiceNinja implements INodeType {
|
||||
}
|
||||
if (operation === 'email') {
|
||||
const quoteId = this.getNodeParameter('quoteId', i) as string;
|
||||
responseData = await invoiceNinjaApiRequest.call(this, 'POST', '/email_invoice', { id: quoteId });
|
||||
responseData = await invoiceNinjaApiRequest.call(this, 'POST', '/email_invoice', {
|
||||
id: quoteId,
|
||||
});
|
||||
}
|
||||
if (operation === 'get') {
|
||||
const quoteId = this.getNodeParameter('quoteId', i) as string;
|
||||
@@ -770,7 +840,13 @@ export class InvoiceNinja implements INodeType {
|
||||
if (options.include) {
|
||||
qs.include = options.include as string;
|
||||
}
|
||||
responseData = await invoiceNinjaApiRequest.call(this, 'GET', `/invoices/${quoteId}`, {}, qs);
|
||||
responseData = await invoiceNinjaApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/invoices/${quoteId}`,
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
responseData = responseData.data;
|
||||
}
|
||||
if (operation === 'getAll') {
|
||||
@@ -783,7 +859,14 @@ export class InvoiceNinja implements INodeType {
|
||||
qs.invoice_number = options.invoiceNumber as string;
|
||||
}
|
||||
if (returnAll === true) {
|
||||
responseData = await invoiceNinjaApiRequestAllItems.call(this, 'data', 'GET', '/quotes', {}, qs);
|
||||
responseData = await invoiceNinjaApiRequestAllItems.call(
|
||||
this,
|
||||
'data',
|
||||
'GET',
|
||||
'/quotes',
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
} else {
|
||||
qs.per_page = this.getNodeParameter('limit', 0) as number;
|
||||
responseData = await invoiceNinjaApiRequest.call(this, 'GET', '/quotes', {}, qs);
|
||||
@@ -792,7 +875,11 @@ export class InvoiceNinja implements INodeType {
|
||||
}
|
||||
if (operation === 'delete') {
|
||||
const quoteId = this.getNodeParameter('quoteId', i) as string;
|
||||
responseData = await invoiceNinjaApiRequest.call(this, 'DELETE', `/invoices/${quoteId}`);
|
||||
responseData = await invoiceNinjaApiRequest.call(
|
||||
this,
|
||||
'DELETE',
|
||||
`/invoices/${quoteId}`,
|
||||
);
|
||||
responseData = responseData.data;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user