mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
n8n-3867-progressively-apply-prettier-to-all (#3873)
* 🔨 formatting nodes with prettier
This commit is contained in:
@@ -1,25 +1,26 @@
|
||||
import {
|
||||
OptionsWithUri,
|
||||
} from 'request';
|
||||
import { OptionsWithUri } from 'request';
|
||||
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
IExecuteSingleFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions, IExecuteSingleFunctions, ILoadOptionsFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject, NodeApiError,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export async function gotifyApiRequest(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, path: string, body: any = {}, qs: IDataObject = {}, uri?: string | undefined, option = {}): Promise<any> { // tslint:disable-line:no-any
|
||||
import { IDataObject, NodeApiError } from 'n8n-workflow';
|
||||
|
||||
export async function gotifyApiRequest(
|
||||
this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
path: string,
|
||||
// tslint:disable-next-line:no-any
|
||||
body: any = {},
|
||||
qs: IDataObject = {},
|
||||
uri?: string | undefined,
|
||||
option = {},
|
||||
// tslint:disable-next-line:no-any
|
||||
): Promise<any> {
|
||||
const credentials = await this.getCredentials('gotifyApi');
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
method,
|
||||
headers: {
|
||||
'X-Gotify-Key': (method === 'POST') ? credentials.appApiToken : credentials.clientApiToken,
|
||||
'X-Gotify-Key': method === 'POST' ? credentials.appApiToken : credentials.clientApiToken,
|
||||
accept: 'application/json',
|
||||
},
|
||||
body,
|
||||
@@ -39,8 +40,16 @@ export async function gotifyApiRequest(this: IExecuteFunctions | IExecuteSingleF
|
||||
}
|
||||
}
|
||||
|
||||
export async function gotifyApiRequestAllItems(this: IExecuteFunctions | ILoadOptionsFunctions, propertyName: string, method: string, endpoint: string, body: any = {}, query: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||
|
||||
export async function gotifyApiRequestAllItems(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||
propertyName: string,
|
||||
method: string,
|
||||
endpoint: string,
|
||||
// tslint:disable-next-line:no-any
|
||||
body: any = {},
|
||||
query: IDataObject = {},
|
||||
// tslint:disable-next-line:no-any
|
||||
): Promise<any> {
|
||||
const returnData: IDataObject[] = [];
|
||||
|
||||
let responseData;
|
||||
@@ -52,9 +61,7 @@ export async function gotifyApiRequestAllItems(this: IExecuteFunctions | ILoadOp
|
||||
uri = responseData.paging.next;
|
||||
}
|
||||
returnData.push.apply(returnData, responseData[propertyName]);
|
||||
} while (
|
||||
responseData.paging.next
|
||||
);
|
||||
} while (responseData.paging.next);
|
||||
|
||||
return returnData;
|
||||
}
|
||||
|
||||
@@ -1,18 +1,8 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
INodeExecutionData,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
} from 'n8n-workflow';
|
||||
import { IDataObject, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
gotifyApiRequest,
|
||||
gotifyApiRequestAllItems,
|
||||
} from './GenericFunctions';
|
||||
import { gotifyApiRequest, gotifyApiRequestAllItems } from './GenericFunctions';
|
||||
|
||||
export class Gotify implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
@@ -56,9 +46,7 @@ export class Gotify implements INodeType {
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'message',
|
||||
],
|
||||
resource: ['message'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -87,12 +75,8 @@ export class Gotify implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'message',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['message'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -105,12 +89,8 @@ export class Gotify implements INodeType {
|
||||
placeholder: 'Add Field',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'message',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['message'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
@@ -138,12 +118,8 @@ export class Gotify implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'message',
|
||||
],
|
||||
operation: [
|
||||
'delete',
|
||||
],
|
||||
resource: ['message'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -154,12 +130,8 @@ export class Gotify implements INodeType {
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'message',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: ['message'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
@@ -176,15 +148,9 @@ export class Gotify implements INodeType {
|
||||
default: 20,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'message',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
resource: ['message'],
|
||||
operation: ['getAll'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -203,7 +169,6 @@ export class Gotify implements INodeType {
|
||||
try {
|
||||
if (resource === 'message') {
|
||||
if (operation === 'create') {
|
||||
|
||||
const message = this.getNodeParameter('message', i) as string;
|
||||
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||
@@ -214,21 +179,12 @@ export class Gotify implements INodeType {
|
||||
|
||||
Object.assign(body, additionalFields);
|
||||
|
||||
responseData = await gotifyApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
`/message`,
|
||||
body,
|
||||
);
|
||||
responseData = await gotifyApiRequest.call(this, 'POST', `/message`, body);
|
||||
}
|
||||
if (operation === 'delete') {
|
||||
const messageId = this.getNodeParameter('messageId', i) as string;
|
||||
|
||||
responseData = await gotifyApiRequest.call(
|
||||
this,
|
||||
'DELETE',
|
||||
`/message/${messageId}`,
|
||||
);
|
||||
responseData = await gotifyApiRequest.call(this, 'DELETE', `/message/${messageId}`);
|
||||
responseData = { success: true };
|
||||
}
|
||||
|
||||
@@ -244,16 +200,9 @@ export class Gotify implements INodeType {
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
|
||||
} else {
|
||||
qs.limit = this.getNodeParameter('limit', i) as number;
|
||||
responseData = await gotifyApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/message`,
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
responseData = await gotifyApiRequest.call(this, 'GET', `/message`, {}, qs);
|
||||
responseData = responseData.messages;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user