n8n-3867-progressively-apply-prettier-to-all (#3873)

* 🔨 formatting nodes with prettier
This commit is contained in:
Michael Kret
2022-08-17 18:50:24 +03:00
committed by GitHub
parent f2d326c7f0
commit 91d7e16c81
1072 changed files with 42357 additions and 59109 deletions

View File

@@ -1,6 +1,4 @@
import {
INodeProperties,
} from 'n8n-workflow';
import { INodeProperties } from 'n8n-workflow';
export const channelOperations: INodeProperties[] = [
{
@@ -10,9 +8,7 @@ export const channelOperations: INodeProperties[] = [
noDataExpression: true,
displayOptions: {
show: {
resource: [
'channel',
],
resource: ['channel'],
},
},
options: [
@@ -49,7 +45,7 @@ export const channelOperations: INodeProperties[] = [
{
name: 'History',
value: 'history',
description: 'Get a conversation\'s history of messages and events',
description: "Get a conversation's history of messages and events",
action: 'Get the history of a channel',
},
{
@@ -124,7 +120,6 @@ export const channelOperations: INodeProperties[] = [
];
export const channelFields: INodeProperties[] = [
/* -------------------------------------------------------------------------- */
/* channel:archive */
/* -------------------------------------------------------------------------- */
@@ -137,17 +132,14 @@ export const channelFields: INodeProperties[] = [
},
displayOptions: {
show: {
operation: [
'archive',
],
resource: [
'channel',
],
operation: ['archive'],
resource: ['channel'],
},
},
default: '',
required: true,
description: 'The name of the channel to archive. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'The name of the channel to archive. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
/* -------------------------------------------------------------------------- */
@@ -162,17 +154,14 @@ export const channelFields: INodeProperties[] = [
},
displayOptions: {
show: {
operation: [
'close',
],
resource: [
'channel',
],
operation: ['close'],
resource: ['channel'],
},
},
default: '',
required: true,
description: 'The name of the channel to close. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'The name of the channel to close. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
/* -------------------------------------------------------------------------- */
@@ -186,12 +175,8 @@ export const channelFields: INodeProperties[] = [
placeholder: 'Channel name',
displayOptions: {
show: {
operation: [
'create',
],
resource: [
'channel',
],
operation: ['create'],
resource: ['channel'],
},
},
required: true,
@@ -205,12 +190,8 @@ export const channelFields: INodeProperties[] = [
default: {},
displayOptions: {
show: {
resource: [
'channel',
],
operation: [
'create',
],
resource: ['channel'],
operation: ['create'],
},
},
options: [
@@ -237,16 +218,13 @@ export const channelFields: INodeProperties[] = [
default: '',
displayOptions: {
show: {
operation: [
'invite',
],
resource: [
'channel',
],
operation: ['invite'],
resource: ['channel'],
},
},
required: true,
description: 'The ID of the channel to invite user to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'The ID of the channel to invite user to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
{
displayName: 'User Names or IDs',
@@ -258,16 +236,13 @@ export const channelFields: INodeProperties[] = [
default: [],
displayOptions: {
show: {
operation: [
'invite',
],
resource: [
'channel',
],
operation: ['invite'],
resource: ['channel'],
},
},
required: true,
description: 'The ID of the user to invite into channel. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'The ID of the user to invite into channel. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
/* -------------------------------------------------------------------------- */
@@ -280,12 +255,8 @@ export const channelFields: INodeProperties[] = [
default: '',
displayOptions: {
show: {
operation: [
'get',
],
resource: [
'channel',
],
operation: ['get'],
resource: ['channel'],
},
},
required: true,
@@ -299,12 +270,8 @@ export const channelFields: INodeProperties[] = [
default: {},
displayOptions: {
show: {
resource: [
'channel',
],
operation: [
'get',
],
resource: ['channel'],
operation: ['get'],
},
},
options: [
@@ -331,33 +298,27 @@ export const channelFields: INodeProperties[] = [
placeholder: 'Channel name',
displayOptions: {
show: {
operation: [
'kick',
],
resource: [
'channel',
],
operation: ['kick'],
resource: ['channel'],
},
},
required: true,
description: 'The name of the channel to create. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'The name of the channel to create. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
{
displayName: 'User Name or ID',
name: 'userId',
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: 'getUsers',
},
displayOptions: {
show: {
operation: [
'kick',
],
resource: [
'channel',
],
operation: ['kick'],
resource: ['channel'],
},
},
default: '',
@@ -370,7 +331,8 @@ export const channelFields: INodeProperties[] = [
displayName: 'Channel Name or ID',
name: 'channelId',
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',
},
@@ -378,12 +340,8 @@ export const channelFields: INodeProperties[] = [
placeholder: 'Channel name',
displayOptions: {
show: {
operation: [
'join',
],
resource: [
'channel',
],
operation: ['join'],
resource: ['channel'],
},
},
required: true,
@@ -398,12 +356,8 @@ export const channelFields: INodeProperties[] = [
type: 'boolean',
displayOptions: {
show: {
resource: [
'channel',
],
operation: [
'getAll',
],
resource: ['channel'],
operation: ['getAll'],
},
},
default: false,
@@ -415,15 +369,9 @@ export const channelFields: INodeProperties[] = [
type: 'number',
displayOptions: {
show: {
resource: [
'channel',
],
operation: [
'getAll',
],
returnAll: [
false,
],
resource: ['channel'],
operation: ['getAll'],
returnAll: [false],
},
},
typeOptions: {
@@ -441,12 +389,8 @@ export const channelFields: INodeProperties[] = [
default: {},
displayOptions: {
show: {
resource: [
'channel',
],
operation: [
'getAll',
],
resource: ['channel'],
operation: ['getAll'],
},
},
options: [
@@ -501,16 +445,13 @@ export const channelFields: INodeProperties[] = [
placeholder: 'Channel name',
displayOptions: {
show: {
operation: [
'history',
],
resource: [
'channel',
],
operation: ['history'],
resource: ['channel'],
},
},
required: true,
description: 'The name of the channel to create. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'The name of the channel to create. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
{
displayName: 'Return All',
@@ -518,12 +459,8 @@ export const channelFields: INodeProperties[] = [
type: 'boolean',
displayOptions: {
show: {
resource: [
'channel',
],
operation: [
'history',
],
resource: ['channel'],
operation: ['history'],
},
},
default: false,
@@ -535,15 +472,9 @@ export const channelFields: INodeProperties[] = [
type: 'number',
displayOptions: {
show: {
resource: [
'channel',
],
operation: [
'history',
],
returnAll: [
false,
],
resource: ['channel'],
operation: ['history'],
returnAll: [false],
},
},
typeOptions: {
@@ -561,12 +492,8 @@ export const channelFields: INodeProperties[] = [
default: {},
displayOptions: {
show: {
resource: [
'channel',
],
operation: [
'history',
],
resource: ['channel'],
operation: ['history'],
},
},
options: [
@@ -575,7 +502,8 @@ export const channelFields: INodeProperties[] = [
name: 'inclusive',
type: 'boolean',
default: false,
description: 'Whether to include messages with latest or oldest timestamp in results only when either timestamp is specified',
description:
'Whether to include messages with latest or oldest timestamp in results only when either timestamp is specified',
},
{
displayName: 'Latest',
@@ -606,17 +534,14 @@ export const channelFields: INodeProperties[] = [
},
displayOptions: {
show: {
operation: [
'leave',
],
resource: [
'channel',
],
operation: ['leave'],
resource: ['channel'],
},
},
default: '',
required: true,
description: 'The name of the channel to leave. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'The name of the channel to leave. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
/* -------------------------------------------------------------------------- */
@@ -626,19 +551,16 @@ export const channelFields: INodeProperties[] = [
displayName: 'Channel Name or ID',
name: 'channelId',
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',
},
default: '',
displayOptions: {
show: {
operation: [
'member',
],
resource: [
'channel',
],
operation: ['member'],
resource: ['channel'],
},
},
required: true,
@@ -649,12 +571,8 @@ export const channelFields: INodeProperties[] = [
type: 'boolean',
displayOptions: {
show: {
resource: [
'channel',
],
operation: [
'member',
],
resource: ['channel'],
operation: ['member'],
},
},
default: false,
@@ -672,15 +590,9 @@ export const channelFields: INodeProperties[] = [
placeholder: 'Limit',
displayOptions: {
show: {
operation: [
'member',
],
resource: [
'channel',
],
returnAll: [
false,
],
operation: ['member'],
resource: ['channel'],
returnAll: [false],
},
},
},
@@ -691,15 +603,12 @@ export const channelFields: INodeProperties[] = [
default: false,
displayOptions: {
show: {
resource: [
'channel',
],
operation: [
'member',
],
resource: ['channel'],
operation: ['member'],
},
},
description: 'Whether to resolve the data automatically. By default the response only contain the ID to resource.',
description:
'Whether to resolve the data automatically. By default the response only contain the ID to resource.',
},
/* -------------------------------------------------------------------------- */
@@ -713,12 +622,8 @@ export const channelFields: INodeProperties[] = [
default: {},
displayOptions: {
show: {
resource: [
'channel',
],
operation: [
'open',
],
resource: ['channel'],
operation: ['open'],
},
},
options: [
@@ -727,7 +632,8 @@ export const channelFields: INodeProperties[] = [
name: 'channelId',
type: 'string',
default: '',
description: 'Resume a conversation by supplying an im or mpim\'s ID. Or provide the users field instead.',
description:
"Resume a conversation by supplying an im or mpim's ID. Or provide the users field instead.",
},
{
displayName: 'Return IM',
@@ -744,7 +650,8 @@ export const channelFields: INodeProperties[] = [
loadOptionsMethod: 'getUsers',
},
default: [],
description: 'If only one user is included, this creates a 1:1 DM. The ordering of the users is preserved whenever a multi-person direct message is returned. Supply a channel when not supplying users. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'If only one user is included, this creates a 1:1 DM. The ordering of the users is preserved whenever a multi-person direct message is returned. Supply a channel when not supplying users. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
],
},
@@ -761,17 +668,14 @@ export const channelFields: INodeProperties[] = [
},
displayOptions: {
show: {
operation: [
'rename',
],
resource: [
'channel',
],
operation: ['rename'],
resource: ['channel'],
},
},
default: '',
required: true,
description: 'The name of the channel to rename. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'The name of the channel to rename. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
{
displayName: 'Name',
@@ -779,12 +683,8 @@ export const channelFields: INodeProperties[] = [
type: 'string',
displayOptions: {
show: {
operation: [
'rename',
],
resource: [
'channel',
],
operation: ['rename'],
resource: ['channel'],
},
},
default: '',
@@ -806,16 +706,13 @@ export const channelFields: INodeProperties[] = [
placeholder: 'Channel name',
displayOptions: {
show: {
operation: [
'replies',
],
resource: [
'channel',
],
operation: ['replies'],
resource: ['channel'],
},
},
required: true,
description: 'The name of the channel to create. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'The name of the channel to create. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
{
displayName: 'TS',
@@ -824,16 +721,12 @@ export const channelFields: INodeProperties[] = [
default: '',
displayOptions: {
show: {
operation: [
'replies',
],
resource: [
'channel',
],
operation: ['replies'],
resource: ['channel'],
},
},
required: true,
description: 'Unique identifier of a thread\'s parent message',
description: "Unique identifier of a thread's parent message",
},
{
displayName: 'Return All',
@@ -841,12 +734,8 @@ export const channelFields: INodeProperties[] = [
type: 'boolean',
displayOptions: {
show: {
resource: [
'channel',
],
operation: [
'replies',
],
resource: ['channel'],
operation: ['replies'],
},
},
default: false,
@@ -858,15 +747,9 @@ export const channelFields: INodeProperties[] = [
type: 'number',
displayOptions: {
show: {
resource: [
'channel',
],
operation: [
'replies',
],
returnAll: [
false,
],
resource: ['channel'],
operation: ['replies'],
returnAll: [false],
},
},
typeOptions: {
@@ -884,12 +767,8 @@ export const channelFields: INodeProperties[] = [
default: {},
displayOptions: {
show: {
resource: [
'channel',
],
operation: [
'replies',
],
resource: ['channel'],
operation: ['replies'],
},
},
options: [
@@ -898,7 +777,8 @@ export const channelFields: INodeProperties[] = [
name: 'inclusive',
type: 'boolean',
default: false,
description: 'Whether to include messages with latest or oldest timestamp in results only when either timestamp is specified',
description:
'Whether to include messages with latest or oldest timestamp in results only when either timestamp is specified',
},
{
displayName: 'Latest',
@@ -929,17 +809,14 @@ export const channelFields: INodeProperties[] = [
},
displayOptions: {
show: {
operation: [
'setPurpose',
],
resource: [
'channel',
],
operation: ['setPurpose'],
resource: ['channel'],
},
},
default: '',
required: true,
description: 'Conversation to set the purpose of. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'Conversation to set the purpose of. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
{
displayName: 'Purpose',
@@ -947,12 +824,8 @@ export const channelFields: INodeProperties[] = [
type: 'string',
displayOptions: {
show: {
operation: [
'setPurpose',
],
resource: [
'channel',
],
operation: ['setPurpose'],
resource: ['channel'],
},
},
default: '',
@@ -972,17 +845,14 @@ export const channelFields: INodeProperties[] = [
},
displayOptions: {
show: {
operation: [
'setTopic',
],
resource: [
'channel',
],
operation: ['setTopic'],
resource: ['channel'],
},
},
default: '',
required: true,
description: 'Conversation to set the topic of. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'Conversation to set the topic of. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
{
displayName: 'Topic',
@@ -990,12 +860,8 @@ export const channelFields: INodeProperties[] = [
type: 'string',
displayOptions: {
show: {
operation: [
'setTopic',
],
resource: [
'channel',
],
operation: ['setTopic'],
resource: ['channel'],
},
},
default: '',
@@ -1015,16 +881,13 @@ export const channelFields: INodeProperties[] = [
},
displayOptions: {
show: {
operation: [
'unarchive',
],
resource: [
'channel',
],
operation: ['unarchive'],
resource: ['channel'],
},
},
default: '',
required: true,
description: 'The ID of the channel to unarchive. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'The ID of the channel to unarchive. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
];

View File

@@ -8,9 +8,7 @@ export const fileOperations: INodeProperties[] = [
noDataExpression: true,
displayOptions: {
show: {
resource: [
'file',
],
resource: ['file'],
},
},
options: [
@@ -38,7 +36,6 @@ export const fileOperations: INodeProperties[] = [
];
export const fileFields: INodeProperties[] = [
/* -------------------------------------------------------------------------- */
/* file:upload */
/* -------------------------------------------------------------------------- */
@@ -49,12 +46,8 @@ export const fileFields: INodeProperties[] = [
default: false,
displayOptions: {
show: {
operation: [
'upload',
],
resource: [
'file',
],
operation: ['upload'],
resource: ['file'],
},
},
description: 'Whether the data to upload should be taken from binary field',
@@ -66,17 +59,10 @@ export const fileFields: INodeProperties[] = [
default: '',
displayOptions: {
show: {
operation: [
'upload',
],
resource: [
'file',
],
binaryData: [
false,
],
operation: ['upload'],
resource: ['file'],
binaryData: [false],
},
},
placeholder: '',
description: 'The text content of the file to upload',
@@ -89,17 +75,10 @@ export const fileFields: INodeProperties[] = [
required: true,
displayOptions: {
show: {
operation: [
'upload',
],
resource: [
'file',
],
binaryData: [
true,
],
operation: ['upload'],
resource: ['file'],
binaryData: [true],
},
},
placeholder: '',
description: 'Name of the binary property which contains the data for the file to be uploaded',
@@ -110,12 +89,8 @@ export const fileFields: INodeProperties[] = [
type: 'collection',
displayOptions: {
show: {
operation: [
'upload',
],
resource: [
'file',
],
operation: ['upload'],
resource: ['file'],
},
},
default: {},
@@ -130,7 +105,8 @@ export const fileFields: INodeProperties[] = [
loadOptionsMethod: 'getChannels',
},
default: [],
description: 'The channels to send the file to. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'The channels to send the file to. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
{
displayName: 'File Name',
@@ -151,7 +127,8 @@ export const fileFields: INodeProperties[] = [
name: 'threadTs',
type: 'string',
default: '',
description: 'Provide another message\'s ts value to upload this file as a reply. Never use a reply\'s ts value; use its parent instead.',
description:
"Provide another message's ts value to upload this file as a reply. Never use a reply's ts value; use its parent instead.",
},
{
displayName: 'Title',
@@ -172,12 +149,8 @@ export const fileFields: INodeProperties[] = [
type: 'boolean',
displayOptions: {
show: {
resource: [
'file',
],
operation: [
'getAll',
],
resource: ['file'],
operation: ['getAll'],
},
},
default: false,
@@ -189,15 +162,9 @@ export const fileFields: INodeProperties[] = [
type: 'number',
displayOptions: {
show: {
resource: [
'file',
],
operation: [
'getAll',
],
returnAll: [
false,
],
resource: ['file'],
operation: ['getAll'],
returnAll: [false],
},
},
typeOptions: {
@@ -213,12 +180,8 @@ export const fileFields: INodeProperties[] = [
type: 'collection',
displayOptions: {
show: {
operation: [
'getAll',
],
resource: [
'file',
],
operation: ['getAll'],
resource: ['file'],
},
},
default: {},
@@ -232,14 +195,16 @@ export const fileFields: INodeProperties[] = [
typeOptions: {
loadOptionsMethod: 'getChannels',
},
description: 'Channel containing the file to be listed. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'Channel containing the file to be listed. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
{
displayName: 'Show Files Hidden By Limit',
name: 'showFilesHidden',
type: 'boolean',
default: false,
description: 'Whether to show truncated file info for files hidden due to being too old, and the team who owns the file being over the file limit',
description:
'Whether to show truncated file info for files hidden due to being too old, and the team who owns the file being over the file limit',
},
{
displayName: 'Timestamp From',
@@ -301,7 +266,8 @@ export const fileFields: INodeProperties[] = [
typeOptions: {
loadOptionsMethod: 'getUsers',
},
description: 'Filter files created by a single user. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'Filter files created by a single user. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
],
},
@@ -315,12 +281,8 @@ export const fileFields: INodeProperties[] = [
type: 'string',
displayOptions: {
show: {
resource: [
'file',
],
operation: [
'get',
],
resource: ['file'],
operation: ['get'],
},
},
default: '',

View File

@@ -1,12 +1,6 @@
import {
OptionsWithUri,
} from 'request';
import { OptionsWithUri } from 'request';
import {
IExecuteFunctions,
IExecuteSingleFunctions,
ILoadOptionsFunctions,
} from 'n8n-core';
import { IExecuteFunctions, IExecuteSingleFunctions, ILoadOptionsFunctions } from 'n8n-core';
import {
IDataObject,
@@ -18,7 +12,16 @@ import {
import _ from 'lodash';
export async function slackApiRequest(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, resource: string, body: object = {}, query: object = {}, headers: {} | undefined = undefined, option: {} = {}): Promise<any> { // tslint:disable-line:no-any
export async function slackApiRequest(
this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions,
method: string,
resource: string,
body: object = {},
query: object = {},
headers: {} | undefined = undefined,
option: {} = {},
// tslint:disable-next-line:no-any
): Promise<any> {
const authenticationMethod = this.getNodeParameter('authentication', 0, 'accessToken') as string;
let options: OptionsWithUri = {
method,
@@ -46,16 +49,27 @@ export async function slackApiRequest(this: IExecuteFunctions | IExecuteSingleFu
try {
let response: any; // tslint:disable-line:no-any
const credentialType = authenticationMethod === 'accessToken' ? 'slackApi' : 'slackOAuth2Api';
response = await this.helpers.requestWithAuthentication.call(this, credentialType, options, { oauth2: oAuth2Options });
response = await this.helpers.requestWithAuthentication.call(this, credentialType, options, {
oauth2: oAuth2Options,
});
if (response.ok === false) {
if (response.error === 'paid_teams_only') {
throw new NodeOperationError(this.getNode(), `Your current Slack plan does not include the resource '${this.getNodeParameter('resource', 0) as string}'`, {
description: `Hint: Upgrate to the Slack plan that includes the funcionality you want to use.`,
});
throw new NodeOperationError(
this.getNode(),
`Your current Slack plan does not include the resource '${
this.getNodeParameter('resource', 0) as string
}'`,
{
description: `Hint: Upgrate to the Slack plan that includes the funcionality you want to use.`,
},
);
}
throw new NodeOperationError(this.getNode(), 'Slack error response: ' + JSON.stringify(response));
throw new NodeOperationError(
this.getNode(),
'Slack error response: ' + JSON.stringify(response),
);
}
return response;
@@ -64,7 +78,16 @@ export async function slackApiRequest(this: IExecuteFunctions | IExecuteSingleFu
}
}
export async function slackApiRequestAllItems(this: IExecuteFunctions | ILoadOptionsFunctions, propertyName: string, method: string, endpoint: string, body: any = {}, query: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
export async function slackApiRequestAllItems(
this: IExecuteFunctions | ILoadOptionsFunctions,
propertyName: string,
method: string,
endpoint: string,
// tslint:disable-next-line:no-any
body: any = {},
query: IDataObject = {},
// tslint:disable-next-line:no-any
): Promise<any> {
const returnData: IDataObject[] = [];
let responseData;
query.page = 1;
@@ -88,14 +111,14 @@ export async function slackApiRequestAllItems(this: IExecuteFunctions | ILoadOpt
(responseData.paging !== undefined &&
responseData.paging.pages !== undefined &&
responseData.paging.page !== undefined &&
responseData.paging.page < responseData.paging.pages
)
responseData.paging.page < responseData.paging.pages)
);
return returnData;
}
export function validateJSON(json: string | undefined): any { // tslint:disable-line:no-any
// tslint:disable-next-line:no-any
export function validateJSON(json: string | undefined): any {
let result;
try {
result = JSON.parse(json!);

View File

@@ -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: [
@@ -52,7 +48,6 @@ export const messageOperations: INodeProperties[] = [
];
export const messageFields: INodeProperties[] = [
/* ----------------------------------------------------------------------- */
/* message:getPermalink
/* ----------------------------------------------------------------------- */
@@ -67,15 +62,12 @@ export const messageFields: INodeProperties[] = [
default: '',
displayOptions: {
show: {
resource: [
'message',
],
operation: [
'getPermalink',
],
resource: ['message'],
operation: ['getPermalink'],
},
},
description: 'Channel containing the message. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'Channel containing the message. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
{
displayName: 'Timestamp',
@@ -85,12 +77,8 @@ export const messageFields: INodeProperties[] = [
default: '',
displayOptions: {
show: {
resource: [
'message',
],
operation: [
'getPermalink',
],
resource: ['message'],
operation: ['getPermalink'],
},
},
description: 'Timestamp of the message to get permanent link',
@@ -107,13 +95,8 @@ export const messageFields: INodeProperties[] = [
placeholder: 'Channel name',
displayOptions: {
show: {
operation: [
'post',
'postEphemeral',
],
resource: [
'message',
],
operation: ['post', 'postEphemeral'],
resource: ['message'],
},
},
required: true,
@@ -127,12 +110,8 @@ export const messageFields: INodeProperties[] = [
placeholder: 'User ID',
displayOptions: {
show: {
operation: [
'postEphemeral',
],
resource: [
'message',
],
operation: ['postEphemeral'],
resource: ['message'],
},
},
required: true,
@@ -148,13 +127,8 @@ export const messageFields: INodeProperties[] = [
default: '',
displayOptions: {
show: {
operation: [
'post',
'postEphemeral',
],
resource: [
'message',
],
operation: ['post', 'postEphemeral'],
resource: ['message'],
},
},
description: 'The text to send',
@@ -166,13 +140,8 @@ export const messageFields: INodeProperties[] = [
default: false,
displayOptions: {
show: {
operation: [
'post',
'postEphemeral',
],
resource: [
'message',
],
operation: ['post', 'postEphemeral'],
resource: ['message'],
},
},
},
@@ -182,13 +151,8 @@ export const messageFields: INodeProperties[] = [
type: 'collection',
displayOptions: {
show: {
operation: [
'post',
'postEphemeral',
],
resource: [
'message',
],
operation: ['post', 'postEphemeral'],
resource: ['message'],
},
},
default: {},
@@ -221,7 +185,7 @@ export const messageFields: INodeProperties[] = [
name: 'thread_ts',
type: 'string',
default: '',
description: 'Provide another message\'s ts value to make this message a reply',
description: "Provide another message's ts value to make this message a reply",
},
{
displayName: 'Markdown',
@@ -235,7 +199,8 @@ export const messageFields: INodeProperties[] = [
name: 'reply_broadcast',
type: 'boolean',
default: false,
description: 'Whether the reply should be made visible to everyone in the channel or conversation. Use in conjunction with thread_ts.',
description:
'Whether the reply should be made visible to everyone in the channel or conversation. Use in conjunction with thread_ts.',
},
{
displayName: 'Unfurl Links',
@@ -257,13 +222,12 @@ export const messageFields: INodeProperties[] = [
type: 'string',
displayOptions: {
show: {
'/authentication': [
'accessToken',
],
'/authentication': ['accessToken'],
},
},
default: '',
description: 'The message will be sent from this username (i.e. as if this individual sent the message).',
description:
'The message will be sent from this username (i.e. as if this individual sent the message).',
},
],
},
@@ -277,13 +241,8 @@ export const messageFields: INodeProperties[] = [
},
displayOptions: {
show: {
operation: [
'post',
'postEphemeral',
],
resource: [
'message',
],
operation: ['post', 'postEphemeral'],
resource: ['message'],
},
},
default: {}, // TODO: Remove comment: has to make default array for the main property, check where that happens in UI
@@ -478,15 +437,12 @@ export const messageFields: INodeProperties[] = [
default: '',
displayOptions: {
show: {
resource: [
'message',
],
operation: [
'update',
],
resource: ['message'],
operation: ['update'],
},
},
description: 'Channel containing the message to be updated. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'Channel containing the message to be updated. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
{
displayName: 'Text',
@@ -495,15 +451,12 @@ export const messageFields: INodeProperties[] = [
default: '',
displayOptions: {
show: {
resource: [
'message',
],
operation: [
'update',
],
resource: ['message'],
operation: ['update'],
},
},
description: 'New text for the message, using the default formatting rules. It\'s not required when presenting attachments.',
description:
"New text for the message, using the default formatting rules. It's not required when presenting attachments.",
},
{
displayName: 'TS',
@@ -513,12 +466,8 @@ export const messageFields: INodeProperties[] = [
default: '',
displayOptions: {
show: {
resource: [
'message',
],
operation: [
'update',
],
resource: ['message'],
operation: ['update'],
},
},
description: 'Timestamp of the message to be updated',
@@ -530,12 +479,8 @@ export const messageFields: INodeProperties[] = [
default: false,
displayOptions: {
show: {
operation: [
'update',
],
resource: [
'message',
],
operation: ['update'],
resource: ['message'],
},
},
},
@@ -547,12 +492,8 @@ export const messageFields: INodeProperties[] = [
default: {},
displayOptions: {
show: {
resource: [
'message',
],
operation: [
'update',
],
resource: ['message'],
operation: ['update'],
},
},
options: [
@@ -596,15 +537,9 @@ export const messageFields: INodeProperties[] = [
},
displayOptions: {
show: {
resource: [
'message',
],
operation: [
'update',
],
jsonParameters: [
true,
],
resource: ['message'],
operation: ['update'],
jsonParameters: [true],
},
},
description: 'The attachments to add',
@@ -619,15 +554,9 @@ export const messageFields: INodeProperties[] = [
},
displayOptions: {
show: {
resource: [
'message',
],
operation: [
'update',
],
jsonParameters: [
true,
],
resource: ['message'],
operation: ['update'],
jsonParameters: [true],
},
},
description: 'The blocks to add',
@@ -642,15 +571,9 @@ export const messageFields: INodeProperties[] = [
},
displayOptions: {
show: {
operation: [
'post',
],
resource: [
'message',
],
jsonParameters: [
false,
],
operation: ['post'],
resource: ['message'],
jsonParameters: [false],
},
},
default: {},
@@ -683,13 +606,12 @@ export const messageFields: INodeProperties[] = [
type: 'string',
displayOptions: {
show: {
type: [
'actions',
],
type: ['actions'],
},
},
default: '',
description: 'A string acting as a unique identifier for a block. You can use this block_id when you receive an interaction payload to identify the source of the action. If not specified, a block_id will be generated. Maximum length for this field is 255 characters.',
description:
'A string acting as a unique identifier for a block. You can use this block_id when you receive an interaction payload to identify the source of the action. If not specified, a block_id will be generated. Maximum length for this field is 255 characters.',
},
{
displayName: 'Elements',
@@ -701,9 +623,7 @@ export const messageFields: INodeProperties[] = [
},
displayOptions: {
show: {
type: [
'actions',
],
type: ['actions'],
},
},
default: {},
@@ -731,9 +651,7 @@ export const messageFields: INodeProperties[] = [
type: 'string',
displayOptions: {
show: {
type: [
'button',
],
type: ['button'],
},
},
default: '',
@@ -745,13 +663,12 @@ export const messageFields: INodeProperties[] = [
type: 'boolean',
displayOptions: {
show: {
type: [
'button',
],
type: ['button'],
},
},
default: false,
description: 'Whether emojis in a text field should be escaped into the colon emoji format',
description:
'Whether emojis in a text field should be escaped into the colon emoji format',
},
{
displayName: 'Action ID',
@@ -759,13 +676,12 @@ export const messageFields: INodeProperties[] = [
type: 'string',
displayOptions: {
show: {
type: [
'button',
],
type: ['button'],
},
},
default: '',
description: 'An identifier for this action. You can use this when you receive an interaction payload to identify the source of the action. Should be unique among all other action_ids used elsewhere by your app.',
description:
'An identifier for this action. You can use this when you receive an interaction payload to identify the source of the action. Should be unique among all other action_ids used elsewhere by your app.',
},
{
displayName: 'URL',
@@ -773,13 +689,12 @@ export const messageFields: INodeProperties[] = [
type: 'string',
displayOptions: {
show: {
type: [
'button',
],
type: ['button'],
},
},
default: '',
description: 'A URL to load in the user\'s browser when the button is clicked. Maximum length for this field is 3000 characters. If you\'re using URL, you\'ll still receive an interaction payload and will need to send an acknowledgement response.',
description:
"A URL to load in the user's browser when the button is clicked. Maximum length for this field is 3000 characters. If you're using URL, you'll still receive an interaction payload and will need to send an acknowledgement response.",
},
{
displayName: 'Value',
@@ -787,9 +702,7 @@ export const messageFields: INodeProperties[] = [
type: 'string',
displayOptions: {
show: {
type: [
'button',
],
type: ['button'],
},
},
default: '',
@@ -801,9 +714,7 @@ export const messageFields: INodeProperties[] = [
type: 'options',
displayOptions: {
show: {
type: [
'button',
],
type: ['button'],
},
},
options: [
@@ -863,12 +774,13 @@ export const messageFields: INodeProperties[] = [
name: 'emoji',
type: 'boolean',
default: false,
description: 'Whether emojis in a text field should be escaped into the colon emoji format',
description:
'Whether emojis in a text field should be escaped into the colon emoji format',
},
],
},
],
description: 'Defines the dialog\'s title',
description: "Defines the dialog's title",
},
{
displayName: 'Text',
@@ -896,12 +808,14 @@ export const messageFields: INodeProperties[] = [
name: 'emoji',
type: 'boolean',
default: false,
description: 'Whether emojis in a text field should be escaped into the colon emoji format',
description:
'Whether emojis in a text field should be escaped into the colon emoji format',
},
],
},
],
description: 'Defines the explanatory text that appears in the confirm dialog',
description:
'Defines the explanatory text that appears in the confirm dialog',
},
{
displayName: 'Confirm',
@@ -922,14 +836,16 @@ export const messageFields: INodeProperties[] = [
name: 'text',
type: 'string',
default: '',
description: 'Defines the explanatory text that appears in the confirm dialog',
description:
'Defines the explanatory text that appears in the confirm dialog',
},
{
displayName: 'Emoji',
name: 'emoji',
type: 'boolean',
default: false,
description: 'Whether emojis in a text field should be escaped into the colon emoji format',
description:
'Whether emojis in a text field should be escaped into the colon emoji format',
},
],
},
@@ -955,14 +871,16 @@ export const messageFields: INodeProperties[] = [
name: 'text',
type: 'string',
default: '',
description: 'Defines the text of the button that cancels the action',
description:
'Defines the text of the button that cancels the action',
},
{
displayName: 'Emoji',
name: 'emoji',
type: 'boolean',
default: false,
description: 'Whether emojis in a text field should be escaped into the colon emoji format',
description:
'Whether emojis in a text field should be escaped into the colon emoji format',
},
],
},
@@ -993,7 +911,8 @@ export const messageFields: INodeProperties[] = [
],
},
],
description: 'Defines an optional confirmation dialog after the button is clicked',
description:
'Defines an optional confirmation dialog after the button is clicked',
},
],
},
@@ -1005,13 +924,12 @@ export const messageFields: INodeProperties[] = [
type: 'string',
displayOptions: {
show: {
type: [
'section',
],
type: ['section'],
},
},
default: '',
description: 'A string acting as a unique identifier for a block. You can use this block_id when you receive an interaction payload to identify the source of the action. If not specified, a block_id will be generated. Maximum length for this field is 255 characters.',
description:
'A string acting as a unique identifier for a block. You can use this block_id when you receive an interaction payload to identify the source of the action. If not specified, a block_id will be generated. Maximum length for this field is 255 characters.',
},
{
displayName: 'Text',
@@ -1023,9 +941,7 @@ export const messageFields: INodeProperties[] = [
},
displayOptions: {
show: {
type: [
'section',
],
type: ['section'],
},
},
default: {},
@@ -1056,35 +972,34 @@ export const messageFields: INodeProperties[] = [
name: 'text',
type: 'string',
default: '',
description: 'The text for the block. This field accepts any of the standard text formatting markup when type is mrkdwn.',
description:
'The text for the block. This field accepts any of the standard text formatting markup when type is mrkdwn.',
},
{
displayName: 'Emoji',
name: 'emoji',
displayOptions: {
show: {
type: [
'plainText',
],
type: ['plainText'],
},
},
type: 'boolean',
default: false,
description: 'Whether emojis in a text field should be escaped into the colon emoji format. This field is only usable when type is plain_text.',
description:
'Whether emojis in a text field should be escaped into the colon emoji format. This field is only usable when type is plain_text.',
},
{
displayName: 'Verbatim',
name: 'verbatim',
displayOptions: {
show: {
type: [
'mrkwdn',
],
type: ['mrkwdn'],
},
},
type: 'boolean',
default: false,
description: 'Whether to set to false (as is default) URLs will be auto-converted into links, conversation names will be link-ified, and certain mentions will be automatically parsed',
description:
'Whether to set to false (as is default) URLs will be auto-converted into links, conversation names will be link-ified, and certain mentions will be automatically parsed',
},
],
},
@@ -1101,9 +1016,7 @@ export const messageFields: INodeProperties[] = [
},
displayOptions: {
show: {
type: [
'section',
],
type: ['section'],
},
},
default: {},
@@ -1134,7 +1047,8 @@ export const messageFields: INodeProperties[] = [
name: 'text',
type: 'string',
default: '',
description: 'The text for the block. This field accepts any of the standard text formatting markup when type is mrkdwn.',
description:
'The text for the block. This field accepts any of the standard text formatting markup when type is mrkdwn.',
},
{
displayName: 'Emoji',
@@ -1142,33 +1056,32 @@ export const messageFields: INodeProperties[] = [
type: 'boolean',
displayOptions: {
show: {
type: [
'plainText',
],
type: ['plainText'],
},
},
default: false,
description: 'Whether emojis in a text field should be escaped into the colon emoji format. This field is only usable when type is plain_text.',
description:
'Whether emojis in a text field should be escaped into the colon emoji format. This field is only usable when type is plain_text.',
},
{
displayName: 'Verbatim',
name: 'verbatim',
displayOptions: {
show: {
type: [
'mrkwdn',
],
type: ['mrkwdn'],
},
},
type: 'boolean',
default: false,
// eslint-disable-next-line n8n-nodes-base/node-param-description-boolean-without-whether
description: 'When set to false (as is default) URLs will be auto-converted into links, conversation names will be link-ified, and certain mentions will be automatically parsed',
description:
'When set to false (as is default) URLs will be auto-converted into links, conversation names will be link-ified, and certain mentions will be automatically parsed',
},
],
},
],
description: 'An array of text objects. Any text objects included with fields will be rendered in a compact format that allows for 2 columns of side-by-side text. Maximum number of items is 10.',
description:
'An array of text objects. Any text objects included with fields will be rendered in a compact format that allows for 2 columns of side-by-side text. Maximum number of items is 10.',
},
{
displayName: 'Accessory',
@@ -1180,9 +1093,7 @@ export const messageFields: INodeProperties[] = [
},
displayOptions: {
show: {
type: [
'section',
],
type: ['section'],
},
},
default: {},
@@ -1209,9 +1120,7 @@ export const messageFields: INodeProperties[] = [
name: 'text',
displayOptions: {
show: {
type: [
'button',
],
type: ['button'],
},
},
type: 'string',
@@ -1223,51 +1132,46 @@ export const messageFields: INodeProperties[] = [
name: 'emoji',
displayOptions: {
show: {
type: [
'button',
],
type: ['button'],
},
},
type: 'boolean',
default: false,
description: 'Whether emojis in a text field should be escaped into the colon emoji format',
description:
'Whether emojis in a text field should be escaped into the colon emoji format',
},
{
displayName: 'Action ID',
name: 'actionId',
displayOptions: {
show: {
type: [
'button',
],
type: ['button'],
},
},
type: 'string',
default: '',
description: 'An identifier for this action. You can use this when you receive an interaction payload to identify the source of the action. Should be unique among all other action_ids used elsewhere by your app.',
description:
'An identifier for this action. You can use this when you receive an interaction payload to identify the source of the action. Should be unique among all other action_ids used elsewhere by your app.',
},
{
displayName: 'URL',
name: 'url',
displayOptions: {
show: {
type: [
'button',
],
type: ['button'],
},
},
type: 'string',
default: '',
description: 'A URL to load in the user\'s browser when the button is clicked. Maximum length for this field is 3000 characters. If you\'re using URL, you\'ll still receive an interaction payload and will need to send an acknowledgement response.',
description:
"A URL to load in the user's browser when the button is clicked. Maximum length for this field is 3000 characters. If you're using URL, you'll still receive an interaction payload and will need to send an acknowledgement response.",
},
{
displayName: 'Value',
name: 'value',
displayOptions: {
show: {
type: [
'button',
],
type: ['button'],
},
},
type: 'string',
@@ -1279,9 +1183,7 @@ export const messageFields: INodeProperties[] = [
name: 'style',
displayOptions: {
show: {
type: [
'button',
],
type: ['button'],
},
},
type: 'options',
@@ -1312,9 +1214,7 @@ export const messageFields: INodeProperties[] = [
},
displayOptions: {
show: {
type: [
'button',
],
type: ['button'],
},
},
default: {},
@@ -1349,12 +1249,14 @@ export const messageFields: INodeProperties[] = [
name: 'emoji',
type: 'boolean',
default: false,
description: 'Whether emojis in a text field should be escaped into the colon emoji format',
description:
'Whether emojis in a text field should be escaped into the colon emoji format',
},
],
},
],
description: 'Defines an optional confirmation dialog after the button is clicked',
description:
'Defines an optional confirmation dialog after the button is clicked',
},
{
displayName: 'Text',
@@ -1382,12 +1284,14 @@ export const messageFields: INodeProperties[] = [
name: 'emoji',
type: 'boolean',
default: false,
description: 'Whether emojis in a text field should be escaped into the colon emoji format',
description:
'Whether emojis in a text field should be escaped into the colon emoji format',
},
],
},
],
description: 'Defines the explanatory text that appears in the confirm dialog',
description:
'Defines the explanatory text that appears in the confirm dialog',
},
{
displayName: 'Confirm',
@@ -1408,19 +1312,22 @@ export const messageFields: INodeProperties[] = [
name: 'text',
type: 'string',
default: '',
description: 'Defines the explanatory text that appears in the confirm dialog',
description:
'Defines the explanatory text that appears in the confirm dialog',
},
{
displayName: 'Emoji',
name: 'emoji',
type: 'boolean',
default: false,
description: 'Whether emojis in a text field should be escaped into the colon emoji format',
description:
'Whether emojis in a text field should be escaped into the colon emoji format',
},
],
},
],
description: 'Defines the explanatory text that appears in the confirm dialog',
description:
'Defines the explanatory text that appears in the confirm dialog',
},
{
displayName: 'Deny',
@@ -1441,14 +1348,16 @@ export const messageFields: INodeProperties[] = [
name: 'text',
type: 'string',
default: '',
description: 'Define the text of the button that cancels the action',
description:
'Define the text of the button that cancels the action',
},
{
displayName: 'Emoji',
name: 'emoji',
type: 'boolean',
default: false,
description: 'Whether emojis in a text field should be escaped into the colon emoji format',
description:
'Whether emojis in a text field should be escaped into the colon emoji format',
},
],
},
@@ -1479,7 +1388,8 @@ export const messageFields: INodeProperties[] = [
],
},
],
description: 'Defines an optional confirmation dialog after the button is clicked',
description:
'Defines an optional confirmation dialog after the button is clicked',
},
],
},
@@ -1499,15 +1409,9 @@ export const messageFields: INodeProperties[] = [
},
displayOptions: {
show: {
resource: [
'message',
],
operation: [
'post',
],
jsonParameters: [
true,
],
resource: ['message'],
operation: ['post'],
jsonParameters: [true],
},
},
description: 'The attachments to add',
@@ -1522,15 +1426,9 @@ export const messageFields: INodeProperties[] = [
},
displayOptions: {
show: {
resource: [
'message',
],
operation: [
'post',
],
jsonParameters: [
true,
],
resource: ['message'],
operation: ['post'],
jsonParameters: [true],
},
},
description: 'The blocks to add',
@@ -1545,15 +1443,9 @@ export const messageFields: INodeProperties[] = [
},
displayOptions: {
show: {
jsonParameters: [
false,
],
operation: [
'update',
],
resource: [
'message',
],
jsonParameters: [false],
operation: ['update'],
resource: ['message'],
},
},
default: {}, // TODO: Remove comment: has to make default array for the main property, check where that happens in UI
@@ -1748,15 +1640,12 @@ export const messageFields: INodeProperties[] = [
default: '',
displayOptions: {
show: {
resource: [
'message',
],
operation: [
'delete',
],
resource: ['message'],
operation: ['delete'],
},
},
description: 'Channel containing the message to be deleted. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'Channel containing the message to be deleted. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
{
displayName: 'Timestamp',
@@ -1766,12 +1655,8 @@ export const messageFields: INodeProperties[] = [
default: '',
displayOptions: {
show: {
resource: [
'message',
],
operation: [
'delete',
],
resource: ['message'],
operation: ['delete'],
},
},
description: 'Timestamp of the message to be deleted',

View File

@@ -1,4 +1,3 @@
export interface IAttachment {
fields: {
item?: object[];

View File

@@ -8,9 +8,7 @@ export const reactionOperations: INodeProperties[] = [
noDataExpression: true,
displayOptions: {
show: {
resource: [
'reaction',
],
resource: ['reaction'],
},
},
options: [
@@ -49,17 +47,12 @@ export const reactionFields: INodeProperties[] = [
default: '',
displayOptions: {
show: {
resource: [
'reaction',
],
operation: [
'add',
'get',
'remove',
],
resource: ['reaction'],
operation: ['add', 'get', 'remove'],
},
},
description: 'Channel containing the message. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'Channel containing the message. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
{
displayName: 'Emoji',
@@ -69,13 +62,8 @@ export const reactionFields: INodeProperties[] = [
default: '',
displayOptions: {
show: {
resource: [
'reaction',
],
operation: [
'add',
'remove',
],
resource: ['reaction'],
operation: ['add', 'remove'],
},
},
description: 'Name of emoji',
@@ -89,14 +77,8 @@ export const reactionFields: INodeProperties[] = [
default: '',
displayOptions: {
show: {
resource: [
'reaction',
],
operation: [
'add',
'get',
'remove',
],
resource: ['reaction'],
operation: ['add', 'get', 'remove'],
},
},
description: 'Timestamp of the message',

View File

@@ -1,6 +1,4 @@
import {
IExecuteFunctions,
} from 'n8n-core';
import { IExecuteFunctions } from 'n8n-core';
import {
ICredentialsDecrypted,
@@ -16,55 +14,25 @@ import {
NodeOperationError,
} from 'n8n-workflow';
import {
channelFields,
channelOperations,
} from './ChannelDescription';
import { channelFields, channelOperations } from './ChannelDescription';
import {
messageFields,
messageOperations,
} from './MessageDescription';
import { messageFields, messageOperations } from './MessageDescription';
import {
starFields,
starOperations,
} from './StarDescription';
import { starFields, starOperations } from './StarDescription';
import {
fileFields,
fileOperations,
} from './FileDescription';
import { fileFields, fileOperations } from './FileDescription';
import {
reactionFields,
reactionOperations,
} from './ReactionDescription';
import { reactionFields, reactionOperations } from './ReactionDescription';
import {
userGroupFields,
userGroupOperations,
} from './UserGroupDescription';
import { userGroupFields, userGroupOperations } from './UserGroupDescription';
import {
userFields,
userOperations,
} from './UserDescription';
import { userFields, userOperations } from './UserDescription';
import {
userProfileFields,
userProfileOperations,
} from './UserProfileDescription';
import { userProfileFields, userProfileOperations } from './UserProfileDescription';
import {
slackApiRequest,
slackApiRequestAllItems,
validateJSON,
} from './GenericFunctions';
import { slackApiRequest, slackApiRequestAllItems, validateJSON } from './GenericFunctions';
import {
IAttachment,
} from './MessageInterface';
import { IAttachment } from './MessageInterface';
import moment from 'moment';
@@ -128,9 +96,7 @@ export class Slack implements INodeType {
required: true,
displayOptions: {
show: {
authentication: [
'accessToken',
],
authentication: ['accessToken'],
},
},
},
@@ -139,9 +105,7 @@ export class Slack implements INodeType {
required: true,
displayOptions: {
show: {
authentication: [
'oAuth2',
],
authentication: ['oAuth2'],
},
},
},
@@ -242,8 +206,12 @@ export class Slack implements INodeType {
}
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;
});
@@ -254,7 +222,14 @@ export class Slack implements INodeType {
async getChannels(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
const returnData: INodePropertyOptions[] = [];
const qs = { types: 'public_channel,private_channel', limit: 1000 };
const channels = await slackApiRequestAllItems.call(this, 'channels', 'GET', '/conversations.list', {}, qs);
const channels = await slackApiRequestAllItems.call(
this,
'channels',
'GET',
'/conversations.list',
{},
qs,
);
for (const channel of channels) {
const channelName = channel.name;
const channelId = channel.id;
@@ -265,8 +240,12 @@ export class Slack implements INodeType {
}
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;
});
@@ -276,7 +255,9 @@ export class Slack implements INodeType {
// select them easily
async getTeamFields(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
const returnData: INodePropertyOptions[] = [];
const { profile: { fields } } = await slackApiRequest.call(this, 'GET', '/team.profile.get');
const {
profile: { fields },
} = await slackApiRequest.call(this, 'GET', '/team.profile.get');
for (const field of fields) {
const fieldName = field.label;
const fieldId = field.id;
@@ -302,7 +283,9 @@ export class Slack implements INodeType {
for (let i = 0; i < length; i++) {
try {
responseData = { error: 'Resource ' + resource + ' / operation ' + operation + ' not found!' };
responseData = {
error: 'Resource ' + resource + ' / operation ' + operation + ' not found!',
};
qs = {};
if (resource === 'channel') {
//https://api.slack.com/methods/conversations.archive
@@ -311,7 +294,13 @@ export class Slack implements INodeType {
const body: IDataObject = {
channel,
};
responseData = await slackApiRequest.call(this, 'POST', '/conversations.archive', body, qs);
responseData = await slackApiRequest.call(
this,
'POST',
'/conversations.archive',
body,
qs,
);
}
//https://api.slack.com/methods/conversations.close
if (operation === 'close') {
@@ -319,7 +308,13 @@ export class Slack implements INodeType {
const body: IDataObject = {
channel,
};
responseData = await slackApiRequest.call(this, 'POST', '/conversations.close', body, qs);
responseData = await slackApiRequest.call(
this,
'POST',
'/conversations.close',
body,
qs,
);
}
//https://api.slack.com/methods/conversations.create
if (operation === 'create') {
@@ -331,7 +326,13 @@ export class Slack implements INodeType {
if (additionalFields.isPrivate) {
body.is_private = additionalFields.isPrivate as boolean;
}
responseData = await slackApiRequest.call(this, 'POST', '/conversations.create', body, qs);
responseData = await slackApiRequest.call(
this,
'POST',
'/conversations.create',
body,
qs,
);
responseData = responseData.channel;
}
//https://api.slack.com/methods/conversations.kick
@@ -342,7 +343,13 @@ export class Slack implements INodeType {
channel,
user: userId,
};
responseData = await slackApiRequest.call(this, 'POST', '/conversations.kick', body, qs);
responseData = await slackApiRequest.call(
this,
'POST',
'/conversations.kick',
body,
qs,
);
}
//https://api.slack.com/methods/conversations.join
if (operation === 'join') {
@@ -350,7 +357,13 @@ export class Slack implements INodeType {
const body: IDataObject = {
channel,
};
responseData = await slackApiRequest.call(this, 'POST', '/conversations.join', body, qs);
responseData = await slackApiRequest.call(
this,
'POST',
'/conversations.join',
body,
qs,
);
responseData = responseData.channel;
}
//https://api.slack.com/methods/conversations.info
@@ -371,7 +384,14 @@ export class Slack implements INodeType {
qs.exclude_archived = filters.excludeArchived as boolean;
}
if (returnAll === true) {
responseData = await slackApiRequestAllItems.call(this, 'channels', 'GET', '/conversations.list', {}, qs);
responseData = await slackApiRequestAllItems.call(
this,
'channels',
'GET',
'/conversations.list',
{},
qs,
);
} else {
qs.limit = this.getNodeParameter('limit', i) as number;
responseData = await slackApiRequest.call(this, 'GET', '/conversations.list', {}, qs);
@@ -394,10 +414,23 @@ export class Slack implements INodeType {
qs.oldest = new Date(filters.oldest as string).getTime() / 1000;
}
if (returnAll === true) {
responseData = await slackApiRequestAllItems.call(this, 'messages', 'GET', '/conversations.history', {}, qs);
responseData = await slackApiRequestAllItems.call(
this,
'messages',
'GET',
'/conversations.history',
{},
qs,
);
} else {
qs.limit = this.getNodeParameter('limit', i) as number;
responseData = await slackApiRequest.call(this, 'GET', '/conversations.history', {}, qs);
responseData = await slackApiRequest.call(
this,
'GET',
'/conversations.history',
{},
qs,
);
responseData = responseData.messages;
}
}
@@ -409,7 +442,13 @@ export class Slack implements INodeType {
channel,
users: userIds,
};
responseData = await slackApiRequest.call(this, 'POST', '/conversations.invite', body, qs);
responseData = await slackApiRequest.call(
this,
'POST',
'/conversations.invite',
body,
qs,
);
responseData = responseData.channel;
}
//https://api.slack.com/methods/conversations.leave
@@ -418,7 +457,13 @@ export class Slack implements INodeType {
const body: IDataObject = {
channel,
};
responseData = await slackApiRequest.call(this, 'POST', '/conversations.leave', body, qs);
responseData = await slackApiRequest.call(
this,
'POST',
'/conversations.leave',
body,
qs,
);
}
//https://api.slack.com/methods/conversations.members
if (operation === 'member') {
@@ -426,18 +471,37 @@ export class Slack implements INodeType {
const resolveData = this.getNodeParameter('resolveData', 0) as boolean;
qs.channel = this.getNodeParameter('channelId', i) as string;
if (returnAll) {
responseData = await slackApiRequestAllItems.call(this, 'members', 'GET', '/conversations.members', {}, qs);
responseData = await slackApiRequestAllItems.call(
this,
'members',
'GET',
'/conversations.members',
{},
qs,
);
responseData = responseData.map((member: string) => ({ member }));
} else {
qs.limit = this.getNodeParameter('limit', i) as number;
responseData = await slackApiRequest.call(this, 'GET', '/conversations.members', {}, qs);
responseData = await slackApiRequest.call(
this,
'GET',
'/conversations.members',
{},
qs,
);
responseData = responseData.members.map((member: string) => ({ member }));
}
if (resolveData) {
const data: IDataObject[] = [];
for (const { member } of responseData) {
const { user } = await slackApiRequest.call(this, 'GET', '/users.info', {}, { user: member });
const { user } = await slackApiRequest.call(
this,
'GET',
'/users.info',
{},
{ user: member },
);
data.push(user);
}
responseData = data;
@@ -456,7 +520,13 @@ export class Slack implements INodeType {
if (options.users) {
body.users = (options.users as string[]).join(',');
}
responseData = await slackApiRequest.call(this, 'POST', '/conversations.open', body, qs);
responseData = await slackApiRequest.call(
this,
'POST',
'/conversations.open',
body,
qs,
);
responseData = responseData.channel;
}
//https://api.slack.com/methods/conversations.rename
@@ -467,7 +537,13 @@ export class Slack implements INodeType {
channel,
name,
};
responseData = await slackApiRequest.call(this, 'POST', '/conversations.rename', body, qs);
responseData = await slackApiRequest.call(
this,
'POST',
'/conversations.rename',
body,
qs,
);
responseData = responseData.channel;
}
//https://api.slack.com/methods/conversations.replies
@@ -488,10 +564,23 @@ export class Slack implements INodeType {
qs.oldest = new Date(filters.oldest as string).getTime() / 1000;
}
if (returnAll === true) {
responseData = await slackApiRequestAllItems.call(this, 'messages', 'GET', '/conversations.replies', {}, qs);
responseData = await slackApiRequestAllItems.call(
this,
'messages',
'GET',
'/conversations.replies',
{},
qs,
);
} else {
qs.limit = this.getNodeParameter('limit', i) as number;
responseData = await slackApiRequest.call(this, 'GET', '/conversations.replies', {}, qs);
responseData = await slackApiRequest.call(
this,
'GET',
'/conversations.replies',
{},
qs,
);
responseData = responseData.messages;
}
}
@@ -503,7 +592,13 @@ export class Slack implements INodeType {
channel,
purpose,
};
responseData = await slackApiRequest.call(this, 'POST', '/conversations.setPurpose', body, qs);
responseData = await slackApiRequest.call(
this,
'POST',
'/conversations.setPurpose',
body,
qs,
);
responseData = responseData.channel;
}
//https://api.slack.com/methods/conversations.setTopic
@@ -514,7 +609,13 @@ export class Slack implements INodeType {
channel,
topic,
};
responseData = await slackApiRequest.call(this, 'POST', '/conversations.setTopic', body, qs);
responseData = await slackApiRequest.call(
this,
'POST',
'/conversations.setTopic',
body,
qs,
);
responseData = responseData.channel;
}
//https://api.slack.com/methods/conversations.unarchive
@@ -523,7 +624,13 @@ export class Slack implements INodeType {
const body: IDataObject = {
channel,
};
responseData = await slackApiRequest.call(this, 'POST', '/conversations.unarchive', body, qs);
responseData = await slackApiRequest.call(
this,
'POST',
'/conversations.unarchive',
body,
qs,
);
}
}
if (resource === 'message') {
@@ -551,8 +658,13 @@ export class Slack implements INodeType {
}
if (!jsonParameters) {
const attachments = this.getNodeParameter('attachments', i, []) as unknown as Attachment[];
const blocksUi = (this.getNodeParameter('blocksUi', i, []) as IDataObject).blocksValues as IDataObject[];
const attachments = this.getNodeParameter(
'attachments',
i,
[],
) as unknown as Attachment[];
const blocksUi = (this.getNodeParameter('blocksUi', i, []) as IDataObject)
.blocksValues as IDataObject[];
// The node does save the fields data differently than the API
// expects so fix the data befre we send the request
@@ -579,15 +691,20 @@ export class Slack implements INodeType {
block.block_id = blockUi.blockId as string;
block.type = blockUi.type as string;
if (block.type === 'actions') {
const elementsUi = (blockUi.elementsUi as IDataObject).elementsValues as IDataObject[];
const elementsUi = (blockUi.elementsUi as IDataObject)
.elementsValues as IDataObject[];
if (elementsUi) {
for (const elementUi of elementsUi) {
const element: Element = {};
if (elementUi.actionId === '') {
throw new NodeOperationError(this.getNode(), 'Action ID must be set', { itemIndex: i });
throw new NodeOperationError(this.getNode(), 'Action ID must be set', {
itemIndex: i,
});
}
if (elementUi.text === '') {
throw new NodeOperationError(this.getNode(), 'Text must be set', { itemIndex: i });
throw new NodeOperationError(this.getNode(), 'Text must be set', {
itemIndex: i,
});
}
element.action_id = elementUi.actionId as string;
element.type = elementUi.type as string;
@@ -605,12 +722,15 @@ export class Slack implements INodeType {
if (elementUi.style !== 'default') {
element.style = elementUi.style as string;
}
const confirmUi = (elementUi.confirmUi as IDataObject).confirmValue as IDataObject;
const confirmUi = (elementUi.confirmUi as IDataObject)
.confirmValue as IDataObject;
if (confirmUi) {
const confirm: Confirm = {};
const titleUi = (confirmUi.titleUi as IDataObject).titleValue as IDataObject;
const titleUi = (confirmUi.titleUi as IDataObject)
.titleValue as IDataObject;
const textUi = (confirmUi.textUi as IDataObject).textValue as IDataObject;
const confirmTextUi = (confirmUi.confirmTextUi as IDataObject).confirmValue as IDataObject;
const confirmTextUi = (confirmUi.confirmTextUi as IDataObject)
.confirmValue as IDataObject;
const denyUi = (confirmUi.denyUi as IDataObject).denyValue as IDataObject;
const style = confirmUi.style as string;
if (titleUi) {
@@ -664,9 +784,14 @@ export class Slack implements INodeType {
text.text = textUi.text as string;
block.text = text;
} else {
throw new NodeOperationError(this.getNode(), 'Property text must be defined', { itemIndex: i });
throw new NodeOperationError(
this.getNode(),
'Property text must be defined',
{ itemIndex: i },
);
}
const fieldsUi = (blockUi.fieldsUi as IDataObject).fieldsValues as IDataObject[];
const fieldsUi = (blockUi.fieldsUi as IDataObject)
.fieldsValues as IDataObject[];
if (fieldsUi) {
const fields: Text[] = [];
for (const fieldUi of fieldsUi) {
@@ -686,7 +811,8 @@ export class Slack implements INodeType {
block.fields = fields;
}
}
const accessoryUi = (blockUi.accessoryUi as IDataObject).accessoriesValues as IDataObject;
const accessoryUi = (blockUi.accessoryUi as IDataObject)
.accessoriesValues as IDataObject;
if (accessoryUi) {
const accessory: Element = {};
if (accessoryUi.type === 'button') {
@@ -705,12 +831,15 @@ export class Slack implements INodeType {
if (accessoryUi.style !== 'default') {
accessory.style = accessoryUi.style as string;
}
const confirmUi = (accessoryUi.confirmUi as IDataObject).confirmValue as IDataObject;
const confirmUi = (accessoryUi.confirmUi as IDataObject)
.confirmValue as IDataObject;
if (confirmUi) {
const confirm: Confirm = {};
const titleUi = (confirmUi.titleUi as IDataObject).titleValue as IDataObject;
const titleUi = (confirmUi.titleUi as IDataObject)
.titleValue as IDataObject;
const textUi = (confirmUi.textUi as IDataObject).textValue as IDataObject;
const confirmTextUi = (confirmUi.confirmTextUi as IDataObject).confirmValue as IDataObject;
const confirmTextUi = (confirmUi.confirmTextUi as IDataObject)
.confirmValue as IDataObject;
const denyUi = (confirmUi.denyUi as IDataObject).denyValue as IDataObject;
const style = confirmUi.style as string;
if (titleUi) {
@@ -754,15 +883,18 @@ export class Slack implements INodeType {
}
body.blocks = blocks;
}
} else {
const attachmentsJson = this.getNodeParameter('attachmentsJson', i, '') as string;
const blocksJson = this.getNodeParameter('blocksJson', i, []) as string;
if (attachmentsJson !== '' && validateJSON(attachmentsJson) === undefined) {
throw new NodeOperationError(this.getNode(), 'Attachments it is not a valid json', { itemIndex: i });
throw new NodeOperationError(this.getNode(), 'Attachments it is not a valid json', {
itemIndex: i,
});
}
if (blocksJson !== '' && validateJSON(blocksJson) === undefined) {
throw new NodeOperationError(this.getNode(), 'Blocks it is not a valid json', { itemIndex: i });
throw new NodeOperationError(this.getNode(), 'Blocks it is not a valid json', {
itemIndex: i,
});
}
if (attachmentsJson !== '') {
body.attachments = attachmentsJson;
@@ -782,7 +914,11 @@ export class Slack implements INodeType {
const channel = this.getNodeParameter('channelId', i) as string;
const text = this.getNodeParameter('text', i) as string;
const ts = this.getNodeParameter('ts', i) as string;
const attachments = this.getNodeParameter('attachments', i, []) as unknown as IAttachment[];
const attachments = this.getNodeParameter(
'attachments',
i,
[],
) as unknown as IAttachment[];
const body: IDataObject = {
channel,
text,
@@ -811,7 +947,9 @@ export class Slack implements INodeType {
const blocksJson = this.getNodeParameter('blocksJson', i, []) as string;
if (blocksJson !== '' && validateJSON(blocksJson) === undefined) {
throw new NodeOperationError(this.getNode(), 'Blocks it is not a valid json', { itemIndex: i });
throw new NodeOperationError(this.getNode(), 'Blocks it is not a valid json', {
itemIndex: i,
});
}
if (blocksJson !== '') {
body.blocks = blocksJson;
@@ -820,7 +958,9 @@ export class Slack implements INodeType {
const attachmentsJson = this.getNodeParameter('attachmentsJson', i, '') as string;
if (attachmentsJson !== '' && validateJSON(attachmentsJson) === undefined) {
throw new NodeOperationError(this.getNode(), 'Attachments it is not a valid json', { itemIndex: i });
throw new NodeOperationError(this.getNode(), 'Attachments it is not a valid json', {
itemIndex: i,
});
}
if (attachmentsJson !== '') {
@@ -926,7 +1066,14 @@ export class Slack implements INodeType {
if (operation === 'getAll') {
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
if (returnAll === true) {
responseData = await slackApiRequestAllItems.call(this, 'items', 'GET', '/stars.list', {}, qs);
responseData = await slackApiRequestAllItems.call(
this,
'items',
'GET',
'/stars.list',
{},
qs,
);
} else {
qs.limit = this.getNodeParameter('limit', i) as number;
responseData = await slackApiRequest.call(this, 'GET', '/stars.list', {}, qs);
@@ -957,12 +1104,21 @@ export class Slack implements INodeType {
}
if (binaryData) {
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i) as string;
if (items[i].binary === undefined
if (
items[i].binary === undefined ||
//@ts-ignore
|| items[i].binary[binaryPropertyName] === undefined) {
throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`, { itemIndex: i });
items[i].binary[binaryPropertyName] === undefined
) {
throw new NodeOperationError(
this.getNode(),
`No binary data property "${binaryPropertyName}" does not exists on item!`,
{ itemIndex: i },
);
}
const binaryDataBuffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
const binaryDataBuffer = await this.helpers.getBinaryDataBuffer(
i,
binaryPropertyName,
);
body.file = {
//@ts-ignore
value: binaryDataBuffer,
@@ -973,12 +1129,28 @@ export class Slack implements INodeType {
contentType: items[i].binary[binaryPropertyName].mimeType,
},
};
responseData = await slackApiRequest.call(this, 'POST', '/files.upload', {}, qs, { 'Content-Type': 'multipart/form-data' }, { formData: body });
responseData = await slackApiRequest.call(
this,
'POST',
'/files.upload',
{},
qs,
{ 'Content-Type': 'multipart/form-data' },
{ formData: body },
);
responseData = responseData.file;
} else {
const fileContent = this.getNodeParameter('fileContent', i) as string;
body.content = fileContent;
responseData = await slackApiRequest.call(this, 'POST', '/files.upload', body, qs, { 'Content-Type': 'application/x-www-form-urlencoded' }, { form: body });
responseData = await slackApiRequest.call(
this,
'POST',
'/files.upload',
body,
qs,
{ 'Content-Type': 'application/x-www-form-urlencoded' },
{ form: body },
);
responseData = responseData.file;
}
}
@@ -1005,7 +1177,14 @@ export class Slack implements INodeType {
qs.user = filters.userId as string;
}
if (returnAll === true) {
responseData = await slackApiRequestAllItems.call(this, 'files', 'GET', '/files.list', {}, qs);
responseData = await slackApiRequestAllItems.call(
this,
'files',
'GET',
'/files.list',
{},
qs,
);
} else {
qs.count = this.getNodeParameter('limit', i) as number;
responseData = await slackApiRequest.call(this, 'GET', '/files.list', {}, qs);
@@ -1078,7 +1257,13 @@ export class Slack implements INodeType {
Object.assign(body, additionalFields);
responseData = await slackApiRequest.call(this, 'POST', '/usergroups.disable', body, qs);
responseData = await slackApiRequest.call(
this,
'POST',
'/usergroups.disable',
body,
qs,
);
responseData = responseData.usergroup;
}
@@ -1134,13 +1319,13 @@ export class Slack implements INodeType {
if (body.status_expiration === undefined) {
body.status_expiration = 0;
} else {
body.status_expiration = moment.tz(body.status_expiration as string, timezone).unix();
}
if (body.customFieldUi) {
const customFields = (body.customFieldUi as IDataObject).customFieldValues as IDataObject[];
const customFields = (body.customFieldUi as IDataObject)
.customFieldValues as IDataObject[];
body.fields = {};
@@ -1153,7 +1338,13 @@ export class Slack implements INodeType {
}
}
responseData = await slackApiRequest.call(this, 'POST', '/users.profile.set', { profile: body }, qs);
responseData = await slackApiRequest.call(
this,
'POST',
'/users.profile.set',
{ profile: body },
qs,
);
responseData = responseData.profile;
}
@@ -1165,7 +1356,13 @@ export class Slack implements INodeType {
Object.assign(qs, additionalFields);
responseData = await slackApiRequest.call(this, 'POST', '/users.profile.get', undefined, qs);
responseData = await slackApiRequest.call(
this,
'POST',
'/users.profile.get',
undefined,
qs,
);
responseData = responseData.profile;
}

View File

@@ -8,9 +8,7 @@ export const starOperations: INodeProperties[] = [
noDataExpression: true,
displayOptions: {
show: {
resource: [
'star',
],
resource: ['star'],
},
},
options: [
@@ -38,7 +36,6 @@ export const starOperations: INodeProperties[] = [
];
export const starFields: INodeProperties[] = [
/* -------------------------------------------------------------------------- */
/* star:add */
/* -------------------------------------------------------------------------- */
@@ -48,12 +45,8 @@ export const starFields: INodeProperties[] = [
type: 'collection',
displayOptions: {
show: {
operation: [
'add',
],
resource: [
'star',
],
operation: ['add'],
resource: ['star'],
},
},
default: {},
@@ -68,7 +61,8 @@ export const starFields: INodeProperties[] = [
loadOptionsMethod: 'getChannels',
},
default: '',
description: 'Channel to add star to, or channel where the message to add star to was posted (used with timestamp). Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'Channel to add star to, or channel where the message to add star to was posted (used with timestamp). Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
{
displayName: 'File Comment',
@@ -103,12 +97,8 @@ export const starFields: INodeProperties[] = [
type: 'collection',
displayOptions: {
show: {
operation: [
'delete',
],
resource: [
'star',
],
operation: ['delete'],
resource: ['star'],
},
},
default: {},
@@ -123,7 +113,8 @@ export const starFields: INodeProperties[] = [
loadOptionsMethod: 'getChannels',
},
default: '',
description: 'Channel to add star to, or channel where the message to add star to was posted (used with timestamp). Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'Channel to add star to, or channel where the message to add star to was posted (used with timestamp). Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
{
displayName: 'File ID',
@@ -158,12 +149,8 @@ export const starFields: INodeProperties[] = [
type: 'boolean',
displayOptions: {
show: {
resource: [
'star',
],
operation: [
'getAll',
],
resource: ['star'],
operation: ['getAll'],
},
},
default: false,
@@ -175,15 +162,9 @@ export const starFields: INodeProperties[] = [
type: 'number',
displayOptions: {
show: {
resource: [
'star',
],
operation: [
'getAll',
],
returnAll: [
false,
],
resource: ['star'],
operation: ['getAll'],
returnAll: [false],
},
},
typeOptions: {

View File

@@ -1,6 +1,4 @@
import {
INodeProperties,
} from 'n8n-workflow';
import { INodeProperties } from 'n8n-workflow';
export const userOperations: INodeProperties[] = [
{
@@ -10,9 +8,7 @@ export const userOperations: INodeProperties[] = [
noDataExpression: true,
displayOptions: {
show: {
resource: [
'user',
],
resource: ['user'],
},
},
options: [
@@ -26,7 +22,7 @@ export const userOperations: INodeProperties[] = [
name: 'Get Presence',
value: 'getPresence',
description: 'Get online status of a user',
action: 'Get a user\'s presence status',
action: "Get a user's presence status",
},
],
default: 'info',
@@ -34,7 +30,6 @@ export const userOperations: INodeProperties[] = [
];
export const userFields: INodeProperties[] = [
/* -------------------------------------------------------------------------- */
/* user:info */
/* -------------------------------------------------------------------------- */
@@ -48,12 +43,8 @@ export const userFields: INodeProperties[] = [
default: '',
displayOptions: {
show: {
operation: [
'info',
],
resource: [
'user',
],
operation: ['info'],
resource: ['user'],
},
},
required: true,
@@ -73,12 +64,8 @@ export const userFields: INodeProperties[] = [
default: '',
displayOptions: {
show: {
operation: [
'getPresence',
],
resource: [
'user',
],
operation: ['getPresence'],
resource: ['user'],
},
},
required: true,

View File

@@ -1,6 +1,4 @@
import {
INodeProperties,
} from 'n8n-workflow';
import { INodeProperties } from 'n8n-workflow';
export const userGroupOperations: INodeProperties[] = [
{
@@ -10,9 +8,7 @@ export const userGroupOperations: INodeProperties[] = [
noDataExpression: true,
displayOptions: {
show: {
resource: [
'userGroup',
],
resource: ['userGroup'],
},
},
options: [
@@ -52,7 +48,6 @@ export const userGroupOperations: INodeProperties[] = [
];
export const userGroupFields: INodeProperties[] = [
/* -------------------------------------------------------------------------- */
/* userGroup:create */
/* -------------------------------------------------------------------------- */
@@ -63,12 +58,8 @@ export const userGroupFields: INodeProperties[] = [
default: '',
displayOptions: {
show: {
operation: [
'create',
],
resource: [
'userGroup',
],
operation: ['create'],
resource: ['userGroup'],
},
},
required: true,
@@ -82,12 +73,8 @@ export const userGroupFields: INodeProperties[] = [
default: {},
displayOptions: {
show: {
resource: [
'userGroup',
],
operation: [
'create',
],
resource: ['userGroup'],
operation: ['create'],
},
},
options: [
@@ -99,7 +86,8 @@ export const userGroupFields: INodeProperties[] = [
loadOptionsMethod: 'getChannels',
},
default: [],
description: 'A comma-separated string of encoded channel IDs for which the User Group uses as a default. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'A comma-separated string of encoded channel IDs for which the User Group uses as a default. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
{
displayName: 'Description',
@@ -134,12 +122,8 @@ export const userGroupFields: INodeProperties[] = [
default: '',
displayOptions: {
show: {
operation: [
'disable',
],
resource: [
'userGroup',
],
operation: ['disable'],
resource: ['userGroup'],
},
},
required: true,
@@ -153,12 +137,8 @@ export const userGroupFields: INodeProperties[] = [
default: {},
displayOptions: {
show: {
resource: [
'userGroup',
],
operation: [
'disable',
],
resource: ['userGroup'],
operation: ['disable'],
},
},
options: [
@@ -181,12 +161,8 @@ export const userGroupFields: INodeProperties[] = [
default: '',
displayOptions: {
show: {
operation: [
'enable',
],
resource: [
'userGroup',
],
operation: ['enable'],
resource: ['userGroup'],
},
},
required: true,
@@ -200,12 +176,8 @@ export const userGroupFields: INodeProperties[] = [
default: {},
displayOptions: {
show: {
resource: [
'userGroup',
],
operation: [
'enable',
],
resource: ['userGroup'],
operation: ['enable'],
},
},
options: [
@@ -227,12 +199,8 @@ export const userGroupFields: INodeProperties[] = [
type: 'boolean',
displayOptions: {
show: {
operation: [
'getAll',
],
resource: [
'userGroup',
],
operation: ['getAll'],
resource: ['userGroup'],
},
},
default: false,
@@ -244,15 +212,9 @@ export const userGroupFields: INodeProperties[] = [
type: 'number',
displayOptions: {
show: {
operation: [
'getAll',
],
resource: [
'userGroup',
],
returnAll: [
false,
],
operation: ['getAll'],
resource: ['userGroup'],
returnAll: [false],
},
},
typeOptions: {
@@ -270,12 +232,8 @@ export const userGroupFields: INodeProperties[] = [
default: {},
displayOptions: {
show: {
resource: [
'userGroup',
],
operation: [
'getAll',
],
resource: ['userGroup'],
operation: ['getAll'],
},
},
options: [
@@ -312,12 +270,8 @@ export const userGroupFields: INodeProperties[] = [
default: '',
displayOptions: {
show: {
operation: [
'update',
],
resource: [
'userGroup',
],
operation: ['update'],
resource: ['userGroup'],
},
},
required: true,
@@ -331,12 +285,8 @@ export const userGroupFields: INodeProperties[] = [
default: {},
displayOptions: {
show: {
resource: [
'userGroup',
],
operation: [
'update',
],
resource: ['userGroup'],
operation: ['update'],
},
},
options: [
@@ -348,7 +298,8 @@ export const userGroupFields: INodeProperties[] = [
loadOptionsMethod: 'getChannels',
},
default: [],
description: 'A comma-separated string of encoded channel IDs for which the User Group uses as a default. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'A comma-separated string of encoded channel IDs for which the User Group uses as a default. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
{
displayName: 'Description',

View File

@@ -1,6 +1,4 @@
import {
INodeProperties,
} from 'n8n-workflow';
import { INodeProperties } from 'n8n-workflow';
import { text } from 'express';
export const userProfileOperations: INodeProperties[] = [
@@ -11,22 +9,20 @@ export const userProfileOperations: INodeProperties[] = [
noDataExpression: true,
displayOptions: {
show: {
resource: [
'userProfile',
],
resource: ['userProfile'],
},
},
options: [
{
name: 'Get',
value: 'get',
description: 'Get your user\'s profile',
description: "Get your user's profile",
action: 'Get a user profile',
},
{
name: 'Update',
value: 'update',
description: 'Update user\'s profile',
description: "Update user's profile",
action: 'Update a user profile',
},
],
@@ -35,7 +31,6 @@ export const userProfileOperations: INodeProperties[] = [
];
export const userProfileFields: INodeProperties[] = [
/* -------------------------------------------------------------------------- */
/* userProfile:update */
/* -------------------------------------------------------------------------- */
@@ -47,12 +42,8 @@ export const userProfileFields: INodeProperties[] = [
default: {},
displayOptions: {
show: {
resource: [
'userProfile',
],
operation: [
'update',
],
resource: ['userProfile'],
operation: ['update'],
},
},
options: [
@@ -78,7 +69,8 @@ export const userProfileFields: INodeProperties[] = [
loadOptionsMethod: 'getTeamFields',
},
default: '',
description: 'ID of the field to set. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'ID of the field to set. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
{
displayName: 'Field Value',
@@ -122,14 +114,16 @@ export const userProfileFields: INodeProperties[] = [
name: 'status_emoji',
type: 'string',
default: '',
description: 'Is a string referencing an emoji enabled for the Slack team, such as :mountain_railway:',
description:
'Is a string referencing an emoji enabled for the Slack team, such as :mountain_railway:',
},
{
displayName: 'Status Expiration',
name: 'status_expiration',
type: 'dateTime',
default: '',
description: 'Is an integer specifying seconds since the epoch, more commonly known as "UNIX time". Providing 0 or omitting this field results in a custom status that will not expire.',
description:
'Is an integer specifying seconds since the epoch, more commonly known as "UNIX time". Providing 0 or omitting this field results in a custom status that will not expire.',
},
{
displayName: 'Status Text',
@@ -143,7 +137,8 @@ export const userProfileFields: INodeProperties[] = [
name: 'user',
type: 'string',
default: '',
description: 'ID of user to change. This argument may only be specified by team admins on paid teams.',
description:
'ID of user to change. This argument may only be specified by team admins on paid teams.',
},
],
},
@@ -159,12 +154,8 @@ export const userProfileFields: INodeProperties[] = [
default: {},
displayOptions: {
show: {
resource: [
'userProfile',
],
operation: [
'get',
],
resource: ['userProfile'],
operation: ['get'],
},
},
options: [