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,4 @@
|
||||
import {
|
||||
IHookFunctions,
|
||||
IWebhookFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IHookFunctions, IWebhookFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
@@ -12,20 +9,19 @@ import {
|
||||
NodeOperationError,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
gitlabApiRequest,
|
||||
} from './GenericFunctions';
|
||||
import { gitlabApiRequest } from './GenericFunctions';
|
||||
|
||||
const GITLAB_EVENTS = [
|
||||
{
|
||||
name: 'Comment',
|
||||
value: 'note',
|
||||
description: 'Triggered when a new comment is made on commits, merge requests, issues, and code snippets',
|
||||
description:
|
||||
'Triggered when a new comment is made on commits, merge requests, issues, and code snippets',
|
||||
},
|
||||
{
|
||||
name: 'Confidential Issues',
|
||||
value: 'confidential_issues',
|
||||
description: 'Triggered on confidential issues\' events',
|
||||
description: "Triggered on confidential issues' events",
|
||||
},
|
||||
{
|
||||
name: 'Confidential Comments',
|
||||
@@ -40,7 +36,8 @@ const GITLAB_EVENTS = [
|
||||
{
|
||||
name: 'Issue',
|
||||
value: 'issues',
|
||||
description: 'Triggered when a new issue is created or an existing issue was updated/closed/reopened',
|
||||
description:
|
||||
'Triggered when a new issue is created or an existing issue was updated/closed/reopened',
|
||||
},
|
||||
{
|
||||
name: 'Job',
|
||||
@@ -50,7 +47,8 @@ const GITLAB_EVENTS = [
|
||||
{
|
||||
name: 'Merge Request',
|
||||
value: 'merge_requests',
|
||||
description: 'Triggered when a new merge request is created, an existing merge request was updated/merged/closed or a commit is added in the source branch',
|
||||
description:
|
||||
'Triggered when a new merge request is created, an existing merge request was updated/merged/closed or a commit is added in the source branch',
|
||||
},
|
||||
{
|
||||
name: 'Pipeline',
|
||||
@@ -86,7 +84,8 @@ export class GitlabTrigger implements INodeType {
|
||||
icon: 'file:gitlab.svg',
|
||||
group: ['trigger'],
|
||||
version: 1,
|
||||
subtitle: '={{$parameter["owner"] + "/" + $parameter["repository"] + ": " + $parameter["events"].join(", ")}}',
|
||||
subtitle:
|
||||
'={{$parameter["owner"] + "/" + $parameter["repository"] + ": " + $parameter["events"].join(", ")}}',
|
||||
description: 'Starts the workflow when GitLab events occur',
|
||||
defaults: {
|
||||
name: 'Gitlab Trigger',
|
||||
@@ -99,9 +98,7 @@ export class GitlabTrigger implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
authentication: [
|
||||
'accessToken',
|
||||
],
|
||||
authentication: ['accessToken'],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -110,9 +107,7 @@ export class GitlabTrigger implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
authentication: [
|
||||
'oAuth2',
|
||||
],
|
||||
authentication: ['oAuth2'],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -194,7 +189,7 @@ export class GitlabTrigger implements INodeType {
|
||||
const owner = this.getNodeParameter('owner') as string;
|
||||
const repository = this.getNodeParameter('repository') as string;
|
||||
|
||||
const path = (`${owner}/${repository}`).replace(/\//g, '%2F');
|
||||
const path = `${owner}/${repository}`.replace(/\//g, '%2F');
|
||||
|
||||
const endpoint = `/projects/${path}/hooks/${webhookData.webhookId}`;
|
||||
|
||||
@@ -228,7 +223,7 @@ export class GitlabTrigger implements INodeType {
|
||||
|
||||
let eventsArray = this.getNodeParameter('events', []) as string[];
|
||||
if (eventsArray.includes('*')) {
|
||||
eventsArray = GITLAB_EVENTS.map(e => e.value);
|
||||
eventsArray = GITLAB_EVENTS.map((e) => e.value);
|
||||
}
|
||||
|
||||
const events: { [key: string]: boolean } = {};
|
||||
@@ -242,7 +237,7 @@ export class GitlabTrigger implements INodeType {
|
||||
events['push_events'] = false;
|
||||
}
|
||||
|
||||
const path = (`${owner}/${repository}`).replace(/\//g, '%2F');
|
||||
const path = `${owner}/${repository}`.replace(/\//g, '%2F');
|
||||
|
||||
const endpoint = `/projects/${path}/hooks`;
|
||||
|
||||
@@ -261,7 +256,9 @@ export class GitlabTrigger implements INodeType {
|
||||
|
||||
if (responseData.id === undefined) {
|
||||
// Required data is missing so was not successful
|
||||
throw new NodeApiError(this.getNode(), responseData, { message: 'GitLab webhook creation response did not contain the expected data.' });
|
||||
throw new NodeApiError(this.getNode(), responseData, {
|
||||
message: 'GitLab webhook creation response did not contain the expected data.',
|
||||
});
|
||||
}
|
||||
|
||||
const webhookData = this.getWorkflowStaticData('node');
|
||||
@@ -277,7 +274,7 @@ export class GitlabTrigger implements INodeType {
|
||||
const owner = this.getNodeParameter('owner') as string;
|
||||
const repository = this.getNodeParameter('repository') as string;
|
||||
|
||||
const path = (`${owner}/${repository}`).replace(/\//g, '%2F');
|
||||
const path = `${owner}/${repository}`.replace(/\//g, '%2F');
|
||||
|
||||
const endpoint = `/projects/${path}/hooks/${webhookData.webhookId}`;
|
||||
const body = {};
|
||||
@@ -299,25 +296,19 @@ export class GitlabTrigger implements INodeType {
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
|
||||
async webhook(this: IWebhookFunctions): Promise<IWebhookResponseData> {
|
||||
const bodyData = this.getBodyData();
|
||||
|
||||
const returnData: IDataObject[] = [];
|
||||
|
||||
returnData.push(
|
||||
{
|
||||
body: bodyData,
|
||||
headers: this.getHeaderData(),
|
||||
query: this.getQueryData(),
|
||||
},
|
||||
);
|
||||
returnData.push({
|
||||
body: bodyData,
|
||||
headers: this.getHeaderData(),
|
||||
query: this.getQueryData(),
|
||||
});
|
||||
|
||||
return {
|
||||
workflowData: [
|
||||
this.helpers.returnJsonArray(returnData),
|
||||
],
|
||||
workflowData: [this.helpers.returnJsonArray(returnData)],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user