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,
|
||||
@@ -11,20 +9,11 @@ import {
|
||||
INodeTypeDescription,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
netlifyApiRequest,
|
||||
netlifyRequestAllItems,
|
||||
} from './GenericFunctions';
|
||||
import { netlifyApiRequest, netlifyRequestAllItems } from './GenericFunctions';
|
||||
|
||||
import {
|
||||
deployFields,
|
||||
deployOperations
|
||||
} from './DeployDescription';
|
||||
import { deployFields, deployOperations } from './DeployDescription';
|
||||
|
||||
import {
|
||||
siteFields,
|
||||
siteOperations
|
||||
} from './SiteDescription';
|
||||
import { siteFields, siteOperations } from './SiteDescription';
|
||||
|
||||
export class Netlify implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
@@ -76,11 +65,7 @@ export class Netlify implements INodeType {
|
||||
loadOptions: {
|
||||
async getSites(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
const sites = await netlifyApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
'/sites',
|
||||
);
|
||||
const sites = await netlifyApiRequest.call(this, 'GET', '/sites');
|
||||
for (const site of sites) {
|
||||
returnData.push({
|
||||
name: site.name,
|
||||
@@ -105,10 +90,15 @@ export class Netlify implements INodeType {
|
||||
for (let i = 0; i < length; i++) {
|
||||
try {
|
||||
if (resource === 'deploy') {
|
||||
|
||||
if (operation === 'cancel') {
|
||||
const deployId = this.getNodeParameter('deployId', i);
|
||||
responseData = await netlifyApiRequest.call(this, 'POST', `/deploys/${deployId}/cancel`, body, qs);
|
||||
responseData = await netlifyApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
`/deploys/${deployId}/cancel`,
|
||||
body,
|
||||
qs,
|
||||
);
|
||||
}
|
||||
|
||||
if (operation === 'create') {
|
||||
@@ -122,28 +112,49 @@ export class Netlify implements INodeType {
|
||||
delete body.title;
|
||||
}
|
||||
|
||||
responseData = await netlifyApiRequest.call(this, 'POST', `/sites/${siteId}/deploys`, body, qs);
|
||||
responseData = await netlifyApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
`/sites/${siteId}/deploys`,
|
||||
body,
|
||||
qs,
|
||||
);
|
||||
}
|
||||
|
||||
if (operation === 'get') {
|
||||
const siteId = this.getNodeParameter('siteId', i);
|
||||
const deployId = this.getNodeParameter('deployId', i);
|
||||
responseData = await netlifyApiRequest.call(this, 'GET', `/sites/${siteId}/deploys/${deployId}`, body, qs);
|
||||
responseData = await netlifyApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/sites/${siteId}/deploys/${deployId}`,
|
||||
body,
|
||||
qs,
|
||||
);
|
||||
}
|
||||
|
||||
if (operation === 'getAll') {
|
||||
const siteId = this.getNodeParameter('siteId', i);
|
||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
if (returnAll === true) {
|
||||
responseData = await netlifyRequestAllItems.call(this, 'GET', `/sites/${siteId}/deploys`);
|
||||
responseData = await netlifyRequestAllItems.call(
|
||||
this,
|
||||
'GET',
|
||||
`/sites/${siteId}/deploys`,
|
||||
);
|
||||
} else {
|
||||
const limit = this.getNodeParameter('limit', i) as number;
|
||||
responseData = await netlifyApiRequest.call(this, 'GET', `/sites/${siteId}/deploys`, {}, { per_page: limit });
|
||||
responseData = await netlifyApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/sites/${siteId}/deploys`,
|
||||
{},
|
||||
{ per_page: limit },
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (resource === 'site') {
|
||||
|
||||
if (operation === 'delete') {
|
||||
const siteId = this.getNodeParameter('siteId', i);
|
||||
responseData = await netlifyApiRequest.call(this, 'DELETE', `/sites/${siteId}`);
|
||||
@@ -157,10 +168,22 @@ export class Netlify implements INodeType {
|
||||
if (operation === 'getAll') {
|
||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
if (returnAll === true) {
|
||||
responseData = await netlifyRequestAllItems.call(this, 'GET', `/sites`, {}, { filter: 'all' });
|
||||
responseData = await netlifyRequestAllItems.call(
|
||||
this,
|
||||
'GET',
|
||||
`/sites`,
|
||||
{},
|
||||
{ filter: 'all' },
|
||||
);
|
||||
} else {
|
||||
const limit = this.getNodeParameter('limit', i) as number;
|
||||
responseData = await netlifyApiRequest.call(this, 'GET', `/sites`, {}, { filter: 'all', per_page: limit });
|
||||
responseData = await netlifyApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/sites`,
|
||||
{},
|
||||
{ filter: 'all', per_page: limit },
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -180,4 +203,4 @@ export class Netlify implements INodeType {
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user