mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
n8n-3867-progressively-apply-prettier-to-all (#3873)
* 🔨 formatting nodes with prettier
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
import { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const accountOperations: INodeProperties[] = [
|
||||
{
|
||||
@@ -10,17 +8,15 @@ export const accountOperations: INodeProperties[] = [
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'account',
|
||||
],
|
||||
resource: ['account'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Me',
|
||||
value: 'me',
|
||||
description: 'Get current user\'s account information',
|
||||
action: 'Get the current user\'s account information',
|
||||
description: "Get current user's account information",
|
||||
action: "Get the current user's account information",
|
||||
},
|
||||
],
|
||||
default: 'me',
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
import { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const eventOperations: INodeProperties[] = [
|
||||
{
|
||||
@@ -10,9 +8,7 @@ export const eventOperations: INodeProperties[] = [
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'event',
|
||||
],
|
||||
resource: ['event'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -27,9 +23,7 @@ export const eventOperations: INodeProperties[] = [
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
export const eventFields: INodeProperties[] = [
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* event:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
@@ -41,12 +35,8 @@ export const eventFields: INodeProperties[] = [
|
||||
placeholder: '!123abc:matrix.org',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'get',
|
||||
],
|
||||
resource: [
|
||||
'event',
|
||||
],
|
||||
operation: ['get'],
|
||||
resource: ['event'],
|
||||
},
|
||||
},
|
||||
required: true,
|
||||
@@ -60,12 +50,8 @@ export const eventFields: INodeProperties[] = [
|
||||
placeholder: '$1234abcd:matrix.org',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'get',
|
||||
],
|
||||
resource: [
|
||||
'event',
|
||||
],
|
||||
operation: ['get'],
|
||||
resource: ['event'],
|
||||
},
|
||||
},
|
||||
required: true,
|
||||
|
||||
@@ -1,19 +1,12 @@
|
||||
import {
|
||||
OptionsWithUri,
|
||||
} from 'request';
|
||||
import { OptionsWithUri } from 'request';
|
||||
|
||||
import { IDataObject, NodeApiError, NodeOperationError, } from 'n8n-workflow';
|
||||
import { IDataObject, NodeApiError, NodeOperationError } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
IExecuteSingleFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions, IExecuteSingleFunctions, ILoadOptionsFunctions } from 'n8n-core';
|
||||
|
||||
import _ from 'lodash';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
|
||||
|
||||
interface MessageResponse {
|
||||
chunk: Message[];
|
||||
}
|
||||
@@ -24,10 +17,18 @@ interface Message {
|
||||
sender: string;
|
||||
type: string;
|
||||
user_id: string;
|
||||
|
||||
}
|
||||
|
||||
export async function matrixApiRequest(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, resource: string, body: string | object = {}, query: object = {}, headers: {} | undefined = undefined, option: {} = {}): Promise<any> { // tslint:disable-line:no-any
|
||||
export async function matrixApiRequest(
|
||||
this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
resource: string,
|
||||
body: string | object = {},
|
||||
query: object = {},
|
||||
headers: {} | undefined = undefined,
|
||||
option: {} = {},
|
||||
// tslint:disable-next-line:no-any
|
||||
): Promise<any> {
|
||||
let options: OptionsWithUri = {
|
||||
method,
|
||||
headers: headers || {
|
||||
@@ -46,12 +47,14 @@ export async function matrixApiRequest(this: IExecuteFunctions | IExecuteSingleF
|
||||
delete options.qs;
|
||||
}
|
||||
try {
|
||||
|
||||
let response: any; // tslint:disable-line:no-any
|
||||
|
||||
const credentials = await this.getCredentials('matrixApi');
|
||||
//@ts-ignore
|
||||
options.uri = `${credentials.homeserverUrl}/_matrix/${option.overridePrefix || 'client'}/r0${resource}`;
|
||||
|
||||
options.uri = `${credentials.homeserverUrl}/_matrix/${
|
||||
//@ts-ignore
|
||||
option.overridePrefix || 'client'
|
||||
}/r0${resource}`;
|
||||
options.headers!.Authorization = `Bearer ${credentials.accessToken}`;
|
||||
//@ts-ignore
|
||||
response = await this.helpers.request(options);
|
||||
@@ -65,14 +68,19 @@ export async function matrixApiRequest(this: IExecuteFunctions | IExecuteSingleF
|
||||
}
|
||||
}
|
||||
|
||||
export async function handleMatrixCall(this: IExecuteFunctions, item: IDataObject, index: number, resource: string, operation: string): Promise<any> { // tslint:disable-line:no-any
|
||||
|
||||
export async function handleMatrixCall(
|
||||
this: IExecuteFunctions,
|
||||
item: IDataObject,
|
||||
index: number,
|
||||
resource: string,
|
||||
operation: string,
|
||||
// tslint:disable-next-line:no-any
|
||||
): Promise<any> {
|
||||
if (resource === 'account') {
|
||||
if (operation === 'me') {
|
||||
return await matrixApiRequest.call(this, 'GET', '/account/whoami');
|
||||
}
|
||||
}
|
||||
else if (resource === 'room') {
|
||||
} else if (resource === 'room') {
|
||||
if (operation === 'create') {
|
||||
const name = this.getNodeParameter('roomName', index) as string;
|
||||
const preset = this.getNodeParameter('preset', index) as string;
|
||||
@@ -125,7 +133,12 @@ export async function handleMatrixCall(this: IExecuteFunctions, item: IDataObjec
|
||||
body.body = fallbackText;
|
||||
}
|
||||
const messageId = uuid();
|
||||
return await matrixApiRequest.call(this, 'PUT', `/rooms/${roomId}/send/m.room.message/${messageId}`, body);
|
||||
return await matrixApiRequest.call(
|
||||
this,
|
||||
'PUT',
|
||||
`/rooms/${roomId}/send/m.room.message/${messageId}`,
|
||||
body,
|
||||
);
|
||||
} else if (operation === 'getAll') {
|
||||
const roomId = this.getNodeParameter('roomId', index) as string;
|
||||
const returnAll = this.getNodeParameter('returnAll', index) as boolean;
|
||||
@@ -145,7 +158,13 @@ export async function handleMatrixCall(this: IExecuteFunctions, item: IDataObjec
|
||||
qs.filter = otherOptions.filter;
|
||||
}
|
||||
|
||||
responseData = await matrixApiRequest.call(this, 'GET', `/rooms/${roomId}/messages`, {}, qs);
|
||||
responseData = await matrixApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/rooms/${roomId}/messages`,
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
returnData.push.apply(returnData, responseData.chunk);
|
||||
from = responseData.end;
|
||||
} while (responseData.chunk.length > 0);
|
||||
@@ -160,7 +179,13 @@ export async function handleMatrixCall(this: IExecuteFunctions, item: IDataObjec
|
||||
qs.filter = otherOptions.filter;
|
||||
}
|
||||
|
||||
const responseData = await matrixApiRequest.call(this, 'GET', `/rooms/${roomId}/messages`, {}, qs);
|
||||
const responseData = await matrixApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/rooms/${roomId}/messages`,
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
returnData.push.apply(returnData, responseData.chunk);
|
||||
}
|
||||
|
||||
@@ -183,10 +208,15 @@ export async function handleMatrixCall(this: IExecuteFunctions, item: IDataObjec
|
||||
const headers: IDataObject = {};
|
||||
let filename;
|
||||
|
||||
if (item.binary === undefined
|
||||
if (
|
||||
item.binary === undefined ||
|
||||
//@ts-ignore
|
||||
|| item.binary[binaryPropertyName] === undefined) {
|
||||
throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`);
|
||||
item.binary[binaryPropertyName] === undefined
|
||||
) {
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
`No binary data property "${binaryPropertyName}" does not exists on item!`,
|
||||
);
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
@@ -199,10 +229,18 @@ export async function handleMatrixCall(this: IExecuteFunctions, item: IDataObjec
|
||||
headers['Content-Type'] = item.binary[binaryPropertyName].mimeType;
|
||||
headers['accept'] = 'application/json,text/*;q=0.99';
|
||||
|
||||
const uploadRequestResult = await matrixApiRequest.call(this, 'POST', `/upload`, body, qs, headers, {
|
||||
overridePrefix: 'media',
|
||||
json: false,
|
||||
});
|
||||
const uploadRequestResult = await matrixApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
`/upload`,
|
||||
body,
|
||||
qs,
|
||||
headers,
|
||||
{
|
||||
overridePrefix: 'media',
|
||||
json: false,
|
||||
},
|
||||
);
|
||||
|
||||
body = {
|
||||
msgtype: `m.${mediaType}`,
|
||||
@@ -210,8 +248,12 @@ export async function handleMatrixCall(this: IExecuteFunctions, item: IDataObjec
|
||||
url: uploadRequestResult.content_uri,
|
||||
};
|
||||
const messageId = uuid();
|
||||
return await matrixApiRequest.call(this, 'PUT', `/rooms/${roomId}/send/m.room.message/${messageId}`, body);
|
||||
|
||||
return await matrixApiRequest.call(
|
||||
this,
|
||||
'PUT',
|
||||
`/rooms/${roomId}/send/m.room.message/${messageId}`,
|
||||
body,
|
||||
);
|
||||
}
|
||||
} else if (resource === 'roomMember') {
|
||||
if (operation === 'getAll') {
|
||||
@@ -221,11 +263,16 @@ export async function handleMatrixCall(this: IExecuteFunctions, item: IDataObjec
|
||||
membership: filters.membership ? filters.membership : '',
|
||||
not_membership: filters.notMembership ? filters.notMembership : '',
|
||||
};
|
||||
const roomMembersResponse = await matrixApiRequest.call(this, 'GET', `/rooms/${roomId}/members`, {}, qs);
|
||||
const roomMembersResponse = await matrixApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/rooms/${roomId}/members`,
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
return roomMembersResponse.chunk;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
throw new NodeOperationError(this.getNode(), 'Not implemented yet');
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
import { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const mediaOperations: INodeProperties[] = [
|
||||
{
|
||||
@@ -10,9 +8,7 @@ export const mediaOperations: INodeProperties[] = [
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'media',
|
||||
],
|
||||
resource: ['media'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -28,7 +24,6 @@ export const mediaOperations: INodeProperties[] = [
|
||||
];
|
||||
|
||||
export const mediaFields: INodeProperties[] = [
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* media:upload */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
@@ -42,15 +37,12 @@ export const mediaFields: INodeProperties[] = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'media',
|
||||
],
|
||||
operation: [
|
||||
'upload',
|
||||
],
|
||||
resource: ['media'],
|
||||
operation: ['upload'],
|
||||
},
|
||||
},
|
||||
description: 'Room ID to post. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'Room ID to post. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
@@ -61,12 +53,8 @@ export const mediaFields: INodeProperties[] = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'media',
|
||||
],
|
||||
operation: [
|
||||
'upload',
|
||||
],
|
||||
resource: ['media'],
|
||||
operation: ['upload'],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -77,12 +65,8 @@ export const mediaFields: INodeProperties[] = [
|
||||
default: 'image',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'media',
|
||||
],
|
||||
operation: [
|
||||
'upload',
|
||||
],
|
||||
resource: ['media'],
|
||||
operation: ['upload'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
import { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const messageOperations: INodeProperties[] = [
|
||||
{
|
||||
@@ -10,9 +8,7 @@ export const messageOperations: INodeProperties[] = [
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'message',
|
||||
],
|
||||
resource: ['message'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -34,7 +30,6 @@ export const messageOperations: INodeProperties[] = [
|
||||
];
|
||||
|
||||
export const messageFields: INodeProperties[] = [
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* message:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
@@ -49,16 +44,13 @@ export const messageFields: INodeProperties[] = [
|
||||
placeholder: '!123abc:matrix.org',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'message',
|
||||
],
|
||||
operation: ['create'],
|
||||
resource: ['message'],
|
||||
},
|
||||
},
|
||||
required: true,
|
||||
description: 'The channel to send the message to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The channel to send the message to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Text',
|
||||
@@ -71,12 +63,8 @@ export const messageFields: INodeProperties[] = [
|
||||
placeholder: 'Hello from n8n!',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'message',
|
||||
],
|
||||
operation: ['create'],
|
||||
resource: ['message'],
|
||||
},
|
||||
},
|
||||
description: 'The text to send',
|
||||
@@ -86,12 +74,8 @@ export const messageFields: INodeProperties[] = [
|
||||
name: 'messageType',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'message',
|
||||
],
|
||||
operation: ['create'],
|
||||
resource: ['message'],
|
||||
},
|
||||
},
|
||||
type: 'options',
|
||||
@@ -120,12 +104,8 @@ export const messageFields: INodeProperties[] = [
|
||||
name: 'messageFormat',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'message',
|
||||
],
|
||||
operation: ['create'],
|
||||
resource: ['message'],
|
||||
},
|
||||
},
|
||||
type: 'options',
|
||||
@@ -142,7 +122,7 @@ export const messageFields: INodeProperties[] = [
|
||||
},
|
||||
],
|
||||
default: 'plain',
|
||||
description: 'The format of the message\'s body',
|
||||
description: "The format of the message's body",
|
||||
},
|
||||
{
|
||||
displayName: 'Fallback Text',
|
||||
@@ -150,25 +130,19 @@ export const messageFields: INodeProperties[] = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'message',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
messageFormat: [
|
||||
'org.matrix.custom.html',
|
||||
],
|
||||
resource: ['message'],
|
||||
operation: ['create'],
|
||||
messageFormat: ['org.matrix.custom.html'],
|
||||
},
|
||||
},
|
||||
type: 'string',
|
||||
typeOptions: {
|
||||
alwaysOpenEditWindow: true,
|
||||
},
|
||||
description: 'A plain text message to display in case the HTML cannot be rendered by the Matrix client',
|
||||
description:
|
||||
'A plain text message to display in case the HTML cannot be rendered by the Matrix client',
|
||||
},
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* message:getAll */
|
||||
/* ----------------------------------------------------------------------- */
|
||||
@@ -182,15 +156,12 @@ export const messageFields: INodeProperties[] = [
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'message',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: ['message'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
description: 'The token to start returning events from. This token can be obtained from a prev_batch token returned for each room by the sync API. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The token to start returning events from. This token can be obtained from a prev_batch token returned for each room by the sync API. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
@@ -200,12 +171,8 @@ export const messageFields: INodeProperties[] = [
|
||||
default: false,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'message',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: ['message'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
description: 'Whether to return all results or only up to a given limit',
|
||||
@@ -217,15 +184,9 @@ export const messageFields: INodeProperties[] = [
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'message',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
resource: ['message'],
|
||||
operation: ['getAll'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
@@ -241,12 +202,8 @@ export const messageFields: INodeProperties[] = [
|
||||
type: 'collection',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'message',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: ['message'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
@@ -257,11 +214,10 @@ export const messageFields: INodeProperties[] = [
|
||||
name: 'filter',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'A JSON RoomEventFilter to filter returned events with. More information can be found on this <a href="https://matrix.org/docs/spec/client_server/r0.6.0">page</a>.',
|
||||
description:
|
||||
'A JSON RoomEventFilter to filter returned events with. More information can be found on this <a href="https://matrix.org/docs/spec/client_server/r0.6.0">page</a>.',
|
||||
placeholder: '{"contains_url":true,"types":["m.room.message", "m.sticker"]}',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
|
||||
];
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
import { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const roomOperations: INodeProperties[] = [
|
||||
{
|
||||
@@ -10,9 +8,7 @@ export const roomOperations: INodeProperties[] = [
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'room',
|
||||
],
|
||||
resource: ['room'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -51,7 +47,6 @@ export const roomOperations: INodeProperties[] = [
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
export const roomFields: INodeProperties[] = [
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* room:create */
|
||||
@@ -62,12 +57,8 @@ export const roomFields: INodeProperties[] = [
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'room',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['room'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -80,12 +71,8 @@ export const roomFields: INodeProperties[] = [
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'room',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['room'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -109,12 +96,8 @@ export const roomFields: INodeProperties[] = [
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'room',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['room'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -130,12 +113,8 @@ export const roomFields: INodeProperties[] = [
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'room',
|
||||
],
|
||||
operation: [
|
||||
'join',
|
||||
],
|
||||
resource: ['room'],
|
||||
operation: ['join'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -149,18 +128,15 @@ export const roomFields: INodeProperties[] = [
|
||||
displayName: 'Room Name or ID',
|
||||
name: 'roomId',
|
||||
type: 'options',
|
||||
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getChannels',
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'room',
|
||||
],
|
||||
operation: [
|
||||
'leave',
|
||||
],
|
||||
resource: ['room'],
|
||||
operation: ['leave'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -174,18 +150,15 @@ export const roomFields: INodeProperties[] = [
|
||||
displayName: 'Room Name or ID',
|
||||
name: 'roomId',
|
||||
type: 'options',
|
||||
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getChannels',
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'room',
|
||||
],
|
||||
operation: [
|
||||
'invite',
|
||||
],
|
||||
resource: ['room'],
|
||||
operation: ['invite'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -198,12 +171,8 @@ export const roomFields: INodeProperties[] = [
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'room',
|
||||
],
|
||||
operation: [
|
||||
'invite',
|
||||
],
|
||||
resource: ['room'],
|
||||
operation: ['invite'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -212,7 +181,6 @@ export const roomFields: INodeProperties[] = [
|
||||
required: true,
|
||||
},
|
||||
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* room:kick */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
@@ -220,18 +188,15 @@ export const roomFields: INodeProperties[] = [
|
||||
displayName: 'Room Name or ID',
|
||||
name: 'roomId',
|
||||
type: 'options',
|
||||
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getChannels',
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'room',
|
||||
],
|
||||
operation: [
|
||||
'kick',
|
||||
],
|
||||
resource: ['room'],
|
||||
operation: ['kick'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -243,12 +208,8 @@ export const roomFields: INodeProperties[] = [
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'room',
|
||||
],
|
||||
operation: [
|
||||
'kick',
|
||||
],
|
||||
resource: ['room'],
|
||||
operation: ['kick'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -262,12 +223,8 @@ export const roomFields: INodeProperties[] = [
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'room',
|
||||
],
|
||||
operation: [
|
||||
'kick',
|
||||
],
|
||||
resource: ['room'],
|
||||
operation: ['kick'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
import { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const roomMemberOperations: INodeProperties[] = [
|
||||
{
|
||||
@@ -10,9 +8,7 @@ export const roomMemberOperations: INodeProperties[] = [
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'roomMember',
|
||||
],
|
||||
resource: ['roomMember'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -27,7 +23,6 @@ export const roomMemberOperations: INodeProperties[] = [
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
export const roomMemberFields: INodeProperties[] = [
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* roomMember:getAll */
|
||||
@@ -36,18 +31,15 @@ export const roomMemberFields: INodeProperties[] = [
|
||||
displayName: 'Room Name or ID',
|
||||
name: 'roomId',
|
||||
type: 'options',
|
||||
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getChannels',
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'roomMember',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: ['roomMember'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -59,12 +51,8 @@ export const roomMemberFields: INodeProperties[] = [
|
||||
type: 'collection',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'roomMember',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: ['roomMember'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
@@ -76,7 +64,8 @@ export const roomMemberFields: INodeProperties[] = [
|
||||
name: 'notMembership',
|
||||
type: 'options',
|
||||
default: '',
|
||||
description: 'Excludes members whose membership is other than selected (uses OR filter with membership)',
|
||||
description:
|
||||
'Excludes members whose membership is other than selected (uses OR filter with membership)',
|
||||
options: [
|
||||
{
|
||||
name: 'Any',
|
||||
@@ -110,7 +99,8 @@ export const roomMemberFields: INodeProperties[] = [
|
||||
name: 'membership',
|
||||
type: 'options',
|
||||
default: '',
|
||||
description: 'Only fetch users with selected membership status (uses OR filter with exclude membership)',
|
||||
description:
|
||||
'Only fetch users with selected membership status (uses OR filter with exclude membership)',
|
||||
options: [
|
||||
{
|
||||
name: 'Any',
|
||||
@@ -141,6 +131,4 @@ export const roomMemberFields: INodeProperties[] = [
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user