refactor: Format nodes-base package (A-F) (#3800)

* 🔨 prettier formated nodes - A

* 🔨 prettier formated nodes - B

*  prettier formated nodes - C

*  prettier formated nodes - D

*  prettier formated nodes - E-F

* 🎨 Adjust nodes-base formatting command (#3805)

* Format additional files in nodes A-F (#3811)

*  fixes

* 🎨 Add Mindee to ignored dirs

Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
This commit is contained in:
Michael Kret
2022-08-01 23:47:55 +03:00
committed by GitHub
parent 2c17e6f3ca
commit 0ecbb4a19d
411 changed files with 12906 additions and 20148 deletions

View File

@@ -1,26 +1,12 @@
import {
IHookFunctions,
IWebhookFunctions,
} from 'n8n-core';
import { IHookFunctions, IWebhookFunctions } from 'n8n-core';
import {
IDataObject,
INodeType,
INodeTypeDescription,
IWebhookResponseData,
} from 'n8n-workflow';
import { IDataObject, INodeType, INodeTypeDescription, IWebhookResponseData } from 'n8n-workflow';
import {
figmaApiRequest,
} from './GenericFunctions';
import { figmaApiRequest } from './GenericFunctions';
import {
snakeCase,
} from 'change-case';
import { snakeCase } from 'change-case';
import {
randomBytes,
} from 'crypto';
import { randomBytes } from 'crypto';
export class FigmaTrigger implements INodeType {
description: INodeTypeDescription = {
@@ -58,7 +44,8 @@ export class FigmaTrigger implements INodeType {
type: 'string',
required: true,
default: '',
description: 'Trigger will monitor this Figma Team for changes. Team ID can be found in the URL of a Figma Team page when viewed in a web browser: figma.com/files/team/{TEAM-ID}/.',
description:
'Trigger will monitor this Figma Team for changes. Team ID can be found in the URL of a Figma Team page when viewed in a web browser: figma.com/files/team/{TEAM-ID}/.',
},
{
displayName: 'Trigger On',
@@ -73,17 +60,20 @@ export class FigmaTrigger implements INodeType {
{
name: 'File Deleted',
value: 'fileDelete',
description: 'Triggers whenever a file has been deleted. Does not trigger on all files within a folder, if the folder is deleted.',
description:
'Triggers whenever a file has been deleted. Does not trigger on all files within a folder, if the folder is deleted.',
},
{
name: 'File Updated',
value: 'fileUpdate',
description: 'Triggers whenever a file saves or is deleted. This occurs whenever a file is closed or within 30 seconds after changes have been made.',
description:
'Triggers whenever a file saves or is deleted. This occurs whenever a file is closed or within 30 seconds after changes have been made.',
},
{
name: 'File Version Updated',
value: 'fileVersionUpdate',
description: 'Triggers whenever a named version is created in the version history of a file',
description:
'Triggers whenever a named version is created in the version history of a file',
},
{
name: 'Library Publish',
@@ -107,12 +97,18 @@ export class FigmaTrigger implements INodeType {
const triggerOn = this.getNodeParameter('triggerOn') as string;
// Check all the webhooks which exist already if it is identical to the
// one that is supposed to get created.
const { webhooks } = await figmaApiRequest.call(this, 'GET', `/v2/teams/${teamId}/webhooks`);
const { webhooks } = await figmaApiRequest.call(
this,
'GET',
`/v2/teams/${teamId}/webhooks`,
);
for (const webhook of webhooks) {
if (webhook.endpoint === webhookUrl
&& webhook.team_id === teamId
&& webhook.event_type === snakeCase(triggerOn).toUpperCase()
&& webhook.status === 'ACTIVE') {
if (
webhook.endpoint === webhookUrl &&
webhook.team_id === teamId &&
webhook.event_type === snakeCase(triggerOn).toUpperCase() &&
webhook.status === 'ACTIVE'
) {
webhookData.webhookId = webhook.id as string;
return true;
}
@@ -147,7 +143,6 @@ export class FigmaTrigger implements INodeType {
async delete(this: IHookFunctions): Promise<boolean> {
const webhookData = this.getWorkflowStaticData('node');
if (webhookData.webhookId !== undefined) {
const endpoint = `/v2/webhooks/${webhookData.webhookId}`;
try {
await figmaApiRequest.call(this, 'DELETE', endpoint);
@@ -175,9 +170,7 @@ export class FigmaTrigger implements INodeType {
}
return {
workflowData: [
this.helpers.returnJsonArray(bodyData),
],
workflowData: [this.helpers.returnJsonArray(bodyData)],
};
}
}