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,13 +1,6 @@
|
||||
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 {
|
||||
msGraphSecurityApiRequest,
|
||||
@@ -72,23 +65,21 @@ export class MicrosoftGraphSecurity implements INodeType {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
|
||||
const resource = this.getNodeParameter('resource', 0) as 'secureScore'| 'secureScoreControlProfile';
|
||||
const resource = this.getNodeParameter('resource', 0) as
|
||||
| 'secureScore'
|
||||
| 'secureScoreControlProfile';
|
||||
const operation = this.getNodeParameter('operation', 0) as 'get' | 'getAll' | 'update';
|
||||
|
||||
let responseData;
|
||||
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
|
||||
try {
|
||||
|
||||
if (resource === 'secureScore') {
|
||||
|
||||
// **********************************************************************
|
||||
// secureScore
|
||||
// **********************************************************************
|
||||
|
||||
if (operation === 'get') {
|
||||
|
||||
// ----------------------------------------
|
||||
// secureScore: get
|
||||
// ----------------------------------------
|
||||
@@ -97,11 +88,13 @@ export class MicrosoftGraphSecurity implements INodeType {
|
||||
|
||||
const secureScoreId = this.getNodeParameter('secureScoreId', i);
|
||||
|
||||
responseData = await msGraphSecurityApiRequest.call(this, 'GET', `/secureScores/${secureScoreId}`);
|
||||
responseData = await msGraphSecurityApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/secureScores/${secureScoreId}`,
|
||||
);
|
||||
delete responseData['@odata.context'];
|
||||
|
||||
} else if (operation === 'getAll') {
|
||||
|
||||
// ----------------------------------------
|
||||
// secureScore: getAll
|
||||
// ----------------------------------------
|
||||
@@ -110,10 +103,7 @@ export class MicrosoftGraphSecurity implements INodeType {
|
||||
|
||||
const qs: IDataObject = {};
|
||||
|
||||
const {
|
||||
filter,
|
||||
includeControlScores,
|
||||
} = this.getNodeParameter('filters', i) as {
|
||||
const { filter, includeControlScores } = this.getNodeParameter('filters', i) as {
|
||||
filter?: string;
|
||||
includeControlScores?: boolean;
|
||||
};
|
||||
@@ -129,38 +119,35 @@ export class MicrosoftGraphSecurity implements INodeType {
|
||||
qs.$top = this.getNodeParameter('limit', 0);
|
||||
}
|
||||
|
||||
responseData = await msGraphSecurityApiRequest
|
||||
responseData = (await msGraphSecurityApiRequest
|
||||
.call(this, 'GET', '/secureScores', {}, qs)
|
||||
.then(response => response.value) as Array<{ controlScores: object[] }>;
|
||||
.then((response) => response.value)) as Array<{ controlScores: object[] }>;
|
||||
|
||||
if (!includeControlScores) {
|
||||
responseData = responseData.map(({ controlScores, ...rest }) => rest);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else if (resource === 'secureScoreControlProfile') {
|
||||
|
||||
// **********************************************************************
|
||||
// secureScoreControlProfile
|
||||
// **********************************************************************
|
||||
|
||||
if (operation === 'get') {
|
||||
|
||||
// ----------------------------------------
|
||||
// secureScoreControlProfile: get
|
||||
// ----------------------------------------
|
||||
|
||||
// https://docs.microsoft.com/en-us/graph/api/securescorecontrolprofile-get
|
||||
|
||||
const secureScoreControlProfileId = this.getNodeParameter('secureScoreControlProfileId', i);
|
||||
const secureScoreControlProfileId = this.getNodeParameter(
|
||||
'secureScoreControlProfileId',
|
||||
i,
|
||||
);
|
||||
const endpoint = `/secureScoreControlProfiles/${secureScoreControlProfileId}`;
|
||||
|
||||
responseData = await msGraphSecurityApiRequest.call(this, 'GET', endpoint);
|
||||
delete responseData['@odata.context'];
|
||||
|
||||
} else if (operation === 'getAll') {
|
||||
|
||||
// ----------------------------------------
|
||||
// secureScoreControlProfile: getAll
|
||||
// ----------------------------------------
|
||||
@@ -184,10 +171,8 @@ export class MicrosoftGraphSecurity implements INodeType {
|
||||
|
||||
responseData = await msGraphSecurityApiRequest
|
||||
.call(this, 'GET', '/secureScoreControlProfiles', {}, qs)
|
||||
.then(response => response.value);
|
||||
|
||||
.then((response) => response.value);
|
||||
} else if (operation === 'update') {
|
||||
|
||||
// ----------------------------------------
|
||||
// secureScoreControlProfile: update
|
||||
// ----------------------------------------
|
||||
@@ -215,13 +200,17 @@ export class MicrosoftGraphSecurity implements INodeType {
|
||||
const endpoint = `/secureScoreControlProfiles/${id}`;
|
||||
const headers = { Prefer: 'return=representation' };
|
||||
|
||||
responseData = await msGraphSecurityApiRequest.call(this, 'PATCH', endpoint, body, {}, headers);
|
||||
responseData = await msGraphSecurityApiRequest.call(
|
||||
this,
|
||||
'PATCH',
|
||||
endpoint,
|
||||
body,
|
||||
{},
|
||||
headers,
|
||||
);
|
||||
delete responseData['@odata.context'];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
@@ -233,7 +222,6 @@ export class MicrosoftGraphSecurity implements INodeType {
|
||||
Array.isArray(responseData)
|
||||
? returnData.push(...responseData)
|
||||
: returnData.push(responseData);
|
||||
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
|
||||
Reference in New Issue
Block a user