mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +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,
|
||||
@@ -12,20 +10,11 @@ import {
|
||||
NodeOperationError,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
googleApiRequest,
|
||||
googleApiRequestAllItems,
|
||||
} from './GenericFunctions';
|
||||
import { googleApiRequest, googleApiRequestAllItems } from './GenericFunctions';
|
||||
|
||||
import {
|
||||
userFields,
|
||||
userOperations,
|
||||
} from './UserDescription';
|
||||
import { userFields, userOperations } from './UserDescription';
|
||||
|
||||
import {
|
||||
groupFields,
|
||||
groupOperations,
|
||||
} from './GroupDescripion';
|
||||
import { groupFields, groupOperations } from './GroupDescripion';
|
||||
|
||||
export class GSuiteAdmin implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
@@ -77,9 +66,7 @@ export class GSuiteAdmin implements INodeType {
|
||||
loadOptions: {
|
||||
// Get all the domains to display them to user so that he can
|
||||
// select them easily
|
||||
async getDomains(
|
||||
this: ILoadOptionsFunctions,
|
||||
): Promise<INodePropertyOptions[]> {
|
||||
async getDomains(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
const domains = await googleApiRequestAllItems.call(
|
||||
this,
|
||||
@@ -99,9 +86,7 @@ export class GSuiteAdmin implements INodeType {
|
||||
},
|
||||
// Get all the schemas to display them to user so that he can
|
||||
// select them easily
|
||||
async getSchemas(
|
||||
this: ILoadOptionsFunctions,
|
||||
): Promise<INodePropertyOptions[]> {
|
||||
async getSchemas(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
const schemas = await googleApiRequestAllItems.call(
|
||||
this,
|
||||
@@ -144,12 +129,7 @@ export class GSuiteAdmin implements INodeType {
|
||||
|
||||
Object.assign(body, additionalFields);
|
||||
|
||||
responseData = await googleApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
`/directory/v1/groups`,
|
||||
body,
|
||||
);
|
||||
responseData = await googleApiRequest.call(this, 'POST', `/directory/v1/groups`, body);
|
||||
}
|
||||
|
||||
//https://developers.google.com/admin-sdk/directory/v1/reference/groups/delete
|
||||
@@ -199,17 +179,10 @@ export class GSuiteAdmin implements INodeType {
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
|
||||
} else {
|
||||
qs.maxResults = this.getNodeParameter('limit', i) as number;
|
||||
|
||||
responseData = await googleApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/directory/v1/groups`,
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
responseData = await googleApiRequest.call(this, 'GET', `/directory/v1/groups`, {}, qs);
|
||||
|
||||
responseData = responseData.groups;
|
||||
}
|
||||
@@ -278,13 +251,7 @@ export class GSuiteAdmin implements INodeType {
|
||||
delete body.emailUi;
|
||||
}
|
||||
|
||||
responseData = await googleApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
`/directory/v1/users`,
|
||||
body,
|
||||
qs,
|
||||
);
|
||||
responseData = await googleApiRequest.call(this, 'POST', `/directory/v1/users`, body, qs);
|
||||
|
||||
if (makeAdmin) {
|
||||
await googleApiRequest.call(
|
||||
@@ -329,7 +296,11 @@ export class GSuiteAdmin implements INodeType {
|
||||
}
|
||||
|
||||
if (qs.projection === 'custom' && qs.customFieldMask === undefined) {
|
||||
throw new NodeOperationError(this.getNode(), 'When projection is set to custom, the custom schemas field must be defined', { itemIndex: i });
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
'When projection is set to custom, the custom schemas field must be defined',
|
||||
{ itemIndex: i },
|
||||
);
|
||||
}
|
||||
|
||||
responseData = await googleApiRequest.call(
|
||||
@@ -362,7 +333,11 @@ export class GSuiteAdmin implements INodeType {
|
||||
}
|
||||
|
||||
if (qs.projection === 'custom' && qs.customFieldMask === undefined) {
|
||||
throw new NodeOperationError(this.getNode(), 'When projection is set to custom, the custom schemas field must be defined', { itemIndex: i });
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
'When projection is set to custom, the custom schemas field must be defined',
|
||||
{ itemIndex: i },
|
||||
);
|
||||
}
|
||||
|
||||
if (returnAll) {
|
||||
@@ -374,17 +349,10 @@ export class GSuiteAdmin implements INodeType {
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
|
||||
} else {
|
||||
qs.maxResults = this.getNodeParameter('limit', i) as number;
|
||||
|
||||
responseData = await googleApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/directory/v1/users`,
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
responseData = await googleApiRequest.call(this, 'GET', `/directory/v1/users`, {}, qs);
|
||||
|
||||
responseData = responseData.users;
|
||||
}
|
||||
@@ -396,7 +364,11 @@ export class GSuiteAdmin implements INodeType {
|
||||
|
||||
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
|
||||
|
||||
const body: { name: { givenName?: string, familyName?: string }, emails?: IDataObject[], phones?: IDataObject[] } = { name: {} };
|
||||
const body: {
|
||||
name: { givenName?: string; familyName?: string };
|
||||
emails?: IDataObject[];
|
||||
phones?: IDataObject[];
|
||||
} = { name: {} };
|
||||
|
||||
Object.assign(body, updateFields);
|
||||
|
||||
@@ -451,7 +423,6 @@ export class GSuiteAdmin implements INodeType {
|
||||
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
|
||||
} else if (responseData !== undefined) {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user