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:
@@ -7,12 +7,10 @@ import {
|
||||
INodePropertyOptions,
|
||||
IWebhookFunctions,
|
||||
JsonObject,
|
||||
NodeApiError
|
||||
NodeApiError,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
OptionsWithUri,
|
||||
} from 'request';
|
||||
import { OptionsWithUri } from 'request';
|
||||
|
||||
import moment from 'moment-timezone';
|
||||
|
||||
@@ -20,10 +18,13 @@ export async function onfleetApiRequest(
|
||||
this: IWebhookFunctions | IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
resource: string,
|
||||
body: any = {}, // tslint:disable-line:no-any
|
||||
qs?: any, // tslint:disable-line:no-any
|
||||
uri?: string): Promise<any> { // tslint:disable-line:no-any
|
||||
|
||||
// tslint:disable-next-line:no-any
|
||||
body: any = {},
|
||||
// tslint:disable-next-line:no-any
|
||||
qs?: any,
|
||||
uri?: string,
|
||||
// tslint:disable-next-line:no-any
|
||||
): Promise<any> {
|
||||
const credentials = await this.getCredentials('onfleetApi');
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
@@ -57,8 +58,8 @@ export async function onfleetApiRequestAllItems(
|
||||
// tslint:disable-next-line: no-any
|
||||
body: any = {},
|
||||
query: IDataObject = {},
|
||||
): Promise<any> { // tslint:disable-line:no-any
|
||||
|
||||
// tslint:disable-next-line:no-any
|
||||
): Promise<any> {
|
||||
const returnData: IDataObject[] = [];
|
||||
|
||||
let responseData;
|
||||
@@ -67,17 +68,18 @@ export async function onfleetApiRequestAllItems(
|
||||
responseData = await onfleetApiRequest.call(this, method, endpoint, body, query);
|
||||
query.lastId = responseData['lastId'];
|
||||
returnData.push.apply(returnData, responseData[propertyName]);
|
||||
} while (
|
||||
responseData['lastId'] !== undefined
|
||||
);
|
||||
} while (responseData['lastId'] !== undefined);
|
||||
|
||||
return returnData;
|
||||
}
|
||||
export const resourceLoaders = {
|
||||
async getTeams(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
try {
|
||||
const teams = await onfleetApiRequest.call(this, 'GET', 'teams') as IDataObject[];
|
||||
return teams.map(({ name = '', id: value = '' }) => ({ name, value })) as INodePropertyOptions[];
|
||||
const teams = (await onfleetApiRequest.call(this, 'GET', 'teams')) as IDataObject[];
|
||||
return teams.map(({ name = '', id: value = '' }) => ({
|
||||
name,
|
||||
value,
|
||||
})) as INodePropertyOptions[];
|
||||
} catch (error) {
|
||||
return [];
|
||||
}
|
||||
@@ -85,8 +87,11 @@ export const resourceLoaders = {
|
||||
|
||||
async getWorkers(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
try {
|
||||
const workers = await onfleetApiRequest.call(this, 'GET', 'workers') as IDataObject[];
|
||||
return workers.map(({ name = '', id: value = '' }) => ({ name, value })) as INodePropertyOptions[];
|
||||
const workers = (await onfleetApiRequest.call(this, 'GET', 'workers')) as IDataObject[];
|
||||
return workers.map(({ name = '', id: value = '' }) => ({
|
||||
name,
|
||||
value,
|
||||
})) as INodePropertyOptions[];
|
||||
} catch (error) {
|
||||
return [];
|
||||
}
|
||||
@@ -94,8 +99,11 @@ export const resourceLoaders = {
|
||||
|
||||
async getAdmins(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
try {
|
||||
const admins = await onfleetApiRequest.call(this, 'GET', 'admins') as IDataObject[];
|
||||
return admins.map(({ name = '', id: value = '' }) => ({ name, value })) as INodePropertyOptions[];
|
||||
const admins = (await onfleetApiRequest.call(this, 'GET', 'admins')) as IDataObject[];
|
||||
return admins.map(({ name = '', id: value = '' }) => ({
|
||||
name,
|
||||
value,
|
||||
})) as INodePropertyOptions[];
|
||||
} catch (error) {
|
||||
return [];
|
||||
}
|
||||
@@ -103,8 +111,11 @@ export const resourceLoaders = {
|
||||
|
||||
async getHubs(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
try {
|
||||
const hubs = await onfleetApiRequest.call(this, 'GET', 'hubs') as IDataObject[];
|
||||
return hubs.map(({ name = '', id: value = '' }) => ({ name, value })) as INodePropertyOptions[];
|
||||
const hubs = (await onfleetApiRequest.call(this, 'GET', 'hubs')) as IDataObject[];
|
||||
return hubs.map(({ name = '', id: value = '' }) => ({
|
||||
name,
|
||||
value,
|
||||
})) as INodePropertyOptions[];
|
||||
} catch (error) {
|
||||
return [];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user