mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +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,
|
||||
@@ -10,10 +8,7 @@ import {
|
||||
NodeOperationError,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
gitlabApiRequest,
|
||||
gitlabApiRequestAllItems,
|
||||
} from './GenericFunctions';
|
||||
import { gitlabApiRequest, gitlabApiRequestAllItems } from './GenericFunctions';
|
||||
|
||||
export class Gitlab implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
@@ -35,9 +30,7 @@ export class Gitlab implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
authentication: [
|
||||
'accessToken',
|
||||
],
|
||||
authentication: ['accessToken'],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -46,9 +39,7 @@ export class Gitlab implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
authentication: [
|
||||
'oAuth2',
|
||||
],
|
||||
authentication: ['oAuth2'],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -96,8 +87,6 @@ export class Gitlab implements INodeType {
|
||||
default: 'issue',
|
||||
},
|
||||
|
||||
|
||||
|
||||
// ----------------------------------
|
||||
// operations
|
||||
// ----------------------------------
|
||||
@@ -108,9 +97,7 @@ export class Gitlab implements INodeType {
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'issue',
|
||||
],
|
||||
resource: ['issue'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -155,9 +142,7 @@ export class Gitlab implements INodeType {
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'repository',
|
||||
],
|
||||
resource: ['repository'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -184,9 +169,7 @@ export class Gitlab implements INodeType {
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'user',
|
||||
],
|
||||
resource: ['user'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -194,7 +177,7 @@ export class Gitlab implements INodeType {
|
||||
name: 'Get Repositories',
|
||||
value: 'getRepositories',
|
||||
description: 'Returns the repositories of a user',
|
||||
action: 'Get a user\'s repositories',
|
||||
action: "Get a user's repositories",
|
||||
},
|
||||
],
|
||||
default: 'getRepositories',
|
||||
@@ -207,9 +190,7 @@ export class Gitlab implements INodeType {
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'release',
|
||||
],
|
||||
resource: ['release'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -247,8 +228,6 @@ export class Gitlab implements INodeType {
|
||||
default: 'create',
|
||||
},
|
||||
|
||||
|
||||
|
||||
// ----------------------------------
|
||||
// shared
|
||||
// ----------------------------------
|
||||
@@ -269,12 +248,8 @@ export class Gitlab implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
hide: {
|
||||
resource: [
|
||||
'user',
|
||||
],
|
||||
operation: [
|
||||
'getRepositories',
|
||||
],
|
||||
resource: ['user'],
|
||||
operation: ['getRepositories'],
|
||||
},
|
||||
},
|
||||
placeholder: 'n8n',
|
||||
@@ -296,12 +271,8 @@ export class Gitlab implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'issue',
|
||||
],
|
||||
operation: ['create'],
|
||||
resource: ['issue'],
|
||||
},
|
||||
},
|
||||
description: 'The title of the issue',
|
||||
@@ -316,12 +287,8 @@ export class Gitlab implements INodeType {
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'issue',
|
||||
],
|
||||
operation: ['create'],
|
||||
resource: ['issue'],
|
||||
},
|
||||
},
|
||||
description: 'The body of the issue',
|
||||
@@ -332,12 +299,8 @@ export class Gitlab implements INodeType {
|
||||
type: 'dateTime',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'issue',
|
||||
],
|
||||
operation: ['create'],
|
||||
resource: ['issue'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -353,15 +316,11 @@ export class Gitlab implements INodeType {
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'issue',
|
||||
],
|
||||
operation: ['create'],
|
||||
resource: ['issue'],
|
||||
},
|
||||
},
|
||||
default: { 'label': '' },
|
||||
default: { label: '' },
|
||||
options: [
|
||||
{
|
||||
displayName: 'Label',
|
||||
@@ -382,15 +341,11 @@ export class Gitlab implements INodeType {
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'issue',
|
||||
],
|
||||
operation: ['create'],
|
||||
resource: ['issue'],
|
||||
},
|
||||
},
|
||||
default: { 'assignee': '' },
|
||||
default: { assignee: '' },
|
||||
options: [
|
||||
{
|
||||
displayName: 'Assignee',
|
||||
@@ -402,7 +357,6 @@ export class Gitlab implements INodeType {
|
||||
],
|
||||
},
|
||||
|
||||
|
||||
// ----------------------------------
|
||||
// issue:createComment
|
||||
// ----------------------------------
|
||||
@@ -414,12 +368,8 @@ export class Gitlab implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'createComment',
|
||||
],
|
||||
resource: [
|
||||
'issue',
|
||||
],
|
||||
operation: ['createComment'],
|
||||
resource: ['issue'],
|
||||
},
|
||||
},
|
||||
description: 'The number of the issue on which to create the comment on',
|
||||
@@ -433,12 +383,8 @@ export class Gitlab implements INodeType {
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'createComment',
|
||||
],
|
||||
resource: [
|
||||
'issue',
|
||||
],
|
||||
operation: ['createComment'],
|
||||
resource: ['issue'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -456,12 +402,8 @@ export class Gitlab implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'edit',
|
||||
],
|
||||
resource: [
|
||||
'issue',
|
||||
],
|
||||
operation: ['edit'],
|
||||
resource: ['issue'],
|
||||
},
|
||||
},
|
||||
description: 'The number of the issue edit',
|
||||
@@ -475,12 +417,8 @@ export class Gitlab implements INodeType {
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'edit',
|
||||
],
|
||||
resource: [
|
||||
'issue',
|
||||
],
|
||||
operation: ['edit'],
|
||||
resource: ['issue'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
@@ -529,7 +467,7 @@ export class Gitlab implements INodeType {
|
||||
multipleValues: true,
|
||||
multipleValueButtonText: 'Add Label',
|
||||
},
|
||||
default: { 'label': '' },
|
||||
default: { label: '' },
|
||||
options: [
|
||||
{
|
||||
displayName: 'Label',
|
||||
@@ -548,7 +486,7 @@ export class Gitlab implements INodeType {
|
||||
multipleValues: true,
|
||||
multipleValueButtonText: 'Add Assignee',
|
||||
},
|
||||
default: { 'assignee': '' },
|
||||
default: { assignee: '' },
|
||||
options: [
|
||||
{
|
||||
displayName: 'Assignees',
|
||||
@@ -580,12 +518,8 @@ export class Gitlab implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'get',
|
||||
],
|
||||
resource: [
|
||||
'issue',
|
||||
],
|
||||
operation: ['get'],
|
||||
resource: ['issue'],
|
||||
},
|
||||
},
|
||||
description: 'The number of the issue get data of',
|
||||
@@ -602,12 +536,8 @@ export class Gitlab implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'lock',
|
||||
],
|
||||
resource: [
|
||||
'issue',
|
||||
],
|
||||
operation: ['lock'],
|
||||
resource: ['issue'],
|
||||
},
|
||||
},
|
||||
description: 'The number of the issue to lock',
|
||||
@@ -618,12 +548,8 @@ export class Gitlab implements INodeType {
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'lock',
|
||||
],
|
||||
resource: [
|
||||
'issue',
|
||||
],
|
||||
operation: ['lock'],
|
||||
resource: ['issue'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -652,8 +578,6 @@ export class Gitlab implements INodeType {
|
||||
description: 'The reason to lock the issue',
|
||||
},
|
||||
|
||||
|
||||
|
||||
// ----------------------------------
|
||||
// release
|
||||
// ----------------------------------
|
||||
@@ -669,12 +593,8 @@ export class Gitlab implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'release',
|
||||
],
|
||||
operation: ['create'],
|
||||
resource: ['release'],
|
||||
},
|
||||
},
|
||||
description: 'The tag of the release',
|
||||
@@ -688,12 +608,8 @@ export class Gitlab implements INodeType {
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'release',
|
||||
],
|
||||
operation: ['create'],
|
||||
resource: ['release'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
@@ -720,7 +636,8 @@ export class Gitlab implements INodeType {
|
||||
name: 'ref',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'If Tag doesn’t exist, the release will be created from Ref. It can be a commit SHA, another tag name, or a branch name.',
|
||||
description:
|
||||
'If Tag doesn’t exist, the release will be created from Ref. It can be a commit SHA, another tag name, or a branch name.',
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -736,13 +653,8 @@ export class Gitlab implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'delete',
|
||||
'get',
|
||||
],
|
||||
resource: [
|
||||
'release',
|
||||
],
|
||||
operation: ['delete', 'get'],
|
||||
resource: ['release'],
|
||||
},
|
||||
},
|
||||
description: 'The ID or URL-encoded path of the project',
|
||||
@@ -755,13 +667,8 @@ export class Gitlab implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'delete',
|
||||
'get',
|
||||
],
|
||||
resource: [
|
||||
'release',
|
||||
],
|
||||
operation: ['delete', 'get'],
|
||||
resource: ['release'],
|
||||
},
|
||||
},
|
||||
description: 'The Git tag the release is associated with',
|
||||
@@ -778,12 +685,8 @@ export class Gitlab implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'release',
|
||||
],
|
||||
operation: ['getAll'],
|
||||
resource: ['release'],
|
||||
},
|
||||
},
|
||||
description: 'The ID or URL-encoded path of the project',
|
||||
@@ -794,12 +697,8 @@ export class Gitlab implements INodeType {
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'release',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: ['release'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
@@ -811,15 +710,9 @@ export class Gitlab implements INodeType {
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'release',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
resource: ['release'],
|
||||
operation: ['getAll'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
@@ -838,12 +731,8 @@ export class Gitlab implements INodeType {
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'release',
|
||||
],
|
||||
operation: ['getAll'],
|
||||
resource: ['release'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
@@ -896,12 +785,8 @@ export class Gitlab implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: [
|
||||
'release',
|
||||
],
|
||||
operation: ['update'],
|
||||
resource: ['release'],
|
||||
},
|
||||
},
|
||||
description: 'The ID or URL-encoded path of the project',
|
||||
@@ -914,12 +799,8 @@ export class Gitlab implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: [
|
||||
'release',
|
||||
],
|
||||
operation: ['update'],
|
||||
resource: ['release'],
|
||||
},
|
||||
},
|
||||
description: 'The Git tag the release is associated with',
|
||||
@@ -933,12 +814,8 @@ export class Gitlab implements INodeType {
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: [
|
||||
'release',
|
||||
],
|
||||
operation: ['update'],
|
||||
resource: ['release'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
@@ -962,7 +839,8 @@ export class Gitlab implements INodeType {
|
||||
name: 'milestones',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The title of each milestone to associate with the release (provide a titles list spearated with comma)',
|
||||
description:
|
||||
'The title of each milestone to associate with the release (provide a titles list spearated with comma)',
|
||||
},
|
||||
{
|
||||
displayName: 'Released At',
|
||||
@@ -989,12 +867,8 @@ export class Gitlab implements INodeType {
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getIssues',
|
||||
],
|
||||
resource: [
|
||||
'repository',
|
||||
],
|
||||
operation: ['getIssues'],
|
||||
resource: ['repository'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
@@ -1018,7 +892,8 @@ export class Gitlab implements INodeType {
|
||||
name: 'labels',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Return only issues with the given labels. Multiple lables can be separated by comma.',
|
||||
description:
|
||||
'Return only issues with the given labels. Multiple lables can be separated by comma.',
|
||||
},
|
||||
{
|
||||
displayName: 'Updated After',
|
||||
@@ -1094,14 +969,11 @@ export class Gitlab implements INodeType {
|
||||
default: 'desc',
|
||||
description: 'The sort order',
|
||||
},
|
||||
|
||||
],
|
||||
},
|
||||
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
@@ -1223,7 +1095,9 @@ export class Gitlab implements INodeType {
|
||||
body.labels = (body.labels as IDataObject[]).map((data) => data['label']).join(',');
|
||||
}
|
||||
if (body.assignee_ids !== undefined) {
|
||||
body.assignee_ids = (body.assignee_ids as IDataObject[]).map((data) => data['assignee']);
|
||||
body.assignee_ids = (body.assignee_ids as IDataObject[]).map(
|
||||
(data) => data['assignee'],
|
||||
);
|
||||
}
|
||||
|
||||
endpoint = `${baseEndpoint}/issues/${issueNumber}`;
|
||||
@@ -1321,7 +1195,7 @@ export class Gitlab implements INodeType {
|
||||
const tagName = this.getNodeParameter('tag_name', i) as string;
|
||||
|
||||
body = this.getNodeParameter('additionalFields', i, {}) as IDataObject;
|
||||
if(body.milestones){
|
||||
if (body.milestones) {
|
||||
body.milestones = (body.milestones as string).split(',');
|
||||
}
|
||||
|
||||
@@ -1362,7 +1236,13 @@ export class Gitlab implements INodeType {
|
||||
}
|
||||
|
||||
if (returnAll === true) {
|
||||
responseData = await gitlabApiRequestAllItems.call(this, requestMethod, endpoint, body, qs);
|
||||
responseData = await gitlabApiRequestAllItems.call(
|
||||
this,
|
||||
requestMethod,
|
||||
endpoint,
|
||||
body,
|
||||
qs,
|
||||
);
|
||||
} else {
|
||||
responseData = await gitlabApiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||
}
|
||||
@@ -1374,7 +1254,10 @@ export class Gitlab implements INodeType {
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
if (overwriteDataOperations.includes(fullOperation) || overwriteDataOperationsArray.includes(fullOperation)) {
|
||||
if (
|
||||
overwriteDataOperations.includes(fullOperation) ||
|
||||
overwriteDataOperationsArray.includes(fullOperation)
|
||||
) {
|
||||
returnData.push({ error: error.message });
|
||||
} else {
|
||||
items[i].json = { error: error.message };
|
||||
@@ -1385,13 +1268,15 @@ export class Gitlab implements INodeType {
|
||||
}
|
||||
}
|
||||
|
||||
if (overwriteDataOperations.includes(fullOperation) || overwriteDataOperationsArray.includes(fullOperation)) {
|
||||
if (
|
||||
overwriteDataOperations.includes(fullOperation) ||
|
||||
overwriteDataOperationsArray.includes(fullOperation)
|
||||
) {
|
||||
// Return data gets replaced
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
} else {
|
||||
// For all other ones simply return the unchanged items
|
||||
return this.prepareOutputData(items);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user