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,6 +1,4 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
@@ -11,39 +9,19 @@ import {
|
||||
INodeTypeDescription,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
handleMatrixCall,
|
||||
matrixApiRequest,
|
||||
} from './GenericFunctions';
|
||||
import { handleMatrixCall, matrixApiRequest } from './GenericFunctions';
|
||||
|
||||
import {
|
||||
accountOperations
|
||||
} from './AccountDescription';
|
||||
import { accountOperations } from './AccountDescription';
|
||||
|
||||
import {
|
||||
eventFields,
|
||||
eventOperations,
|
||||
} from './EventDescription';
|
||||
import { eventFields, eventOperations } from './EventDescription';
|
||||
|
||||
import {
|
||||
mediaFields,
|
||||
mediaOperations,
|
||||
} from './MediaDescription';
|
||||
import { mediaFields, mediaOperations } from './MediaDescription';
|
||||
|
||||
import {
|
||||
messageFields,
|
||||
messageOperations,
|
||||
} from './MessageDescription';
|
||||
import { messageFields, messageOperations } from './MessageDescription';
|
||||
|
||||
import {
|
||||
roomFields,
|
||||
roomOperations,
|
||||
} from './RoomDescription';
|
||||
import { roomFields, roomOperations } from './RoomDescription';
|
||||
|
||||
import {
|
||||
roomMemberFields,
|
||||
roomMemberOperations,
|
||||
} from './RoomMemberDescription';
|
||||
import { roomMemberFields, roomMemberOperations } from './RoomMemberDescription';
|
||||
|
||||
export class Matrix implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
@@ -67,7 +45,6 @@ export class Matrix implements INodeType {
|
||||
},
|
||||
],
|
||||
properties: [
|
||||
|
||||
{
|
||||
displayName: 'Resource',
|
||||
name: 'resource',
|
||||
@@ -115,7 +92,6 @@ export class Matrix implements INodeType {
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
methods = {
|
||||
loadOptions: {
|
||||
async getChannels(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
@@ -123,25 +99,35 @@ export class Matrix implements INodeType {
|
||||
|
||||
const joinedRoomsResponse = await matrixApiRequest.call(this, 'GET', '/joined_rooms');
|
||||
|
||||
await Promise.all(joinedRoomsResponse.joined_rooms.map(async (roomId: string) => {
|
||||
try {
|
||||
const roomNameResponse = await matrixApiRequest.call(this, 'GET', `/rooms/${roomId}/state/m.room.name`);
|
||||
returnData.push({
|
||||
name: roomNameResponse.name,
|
||||
value: roomId,
|
||||
});
|
||||
} catch (error) {
|
||||
// TODO: Check, there is probably another way to get the name of this private-chats
|
||||
returnData.push({
|
||||
name: `Unknown: ${roomId}`,
|
||||
value: roomId,
|
||||
});
|
||||
}
|
||||
}));
|
||||
await Promise.all(
|
||||
joinedRoomsResponse.joined_rooms.map(async (roomId: string) => {
|
||||
try {
|
||||
const roomNameResponse = await matrixApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/rooms/${roomId}/state/m.room.name`,
|
||||
);
|
||||
returnData.push({
|
||||
name: roomNameResponse.name,
|
||||
value: roomId,
|
||||
});
|
||||
} catch (error) {
|
||||
// TODO: Check, there is probably another way to get the name of this private-chats
|
||||
returnData.push({
|
||||
name: `Unknown: ${roomId}`,
|
||||
value: roomId,
|
||||
});
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
||||
returnData.sort((a, b) => {
|
||||
if (a.name < b.name) { return -1; }
|
||||
if (a.name > b.name) { return 1; }
|
||||
if (a.name < b.name) {
|
||||
return -1;
|
||||
}
|
||||
if (a.name > b.name) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
|
||||
@@ -150,9 +136,7 @@ export class Matrix implements INodeType {
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
|
||||
const items = this.getInputData() as IDataObject[];
|
||||
const returnData: IDataObject[] = [];
|
||||
const resource = this.getNodeParameter('resource', 0) as string;
|
||||
|
||||
Reference in New Issue
Block a user