fix: lint

This commit is contained in:
kolaente 2023-10-24 19:25:41 +02:00
parent ef9d0c69a8
commit 5d6b96e7cd
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
7 changed files with 367 additions and 360 deletions

View File

@ -45,7 +45,7 @@ You need npm and NodeJS installed.
* Build the node with `npm run build`
* Check for lint errors with `npm run lint` and fix them with `npm run lintfix`
* To release a new version in the npm registry, run `npm publish`
* To test the node, build the node with `npm run build`, then while in the project directory run `export N8N_CUSTOM_EXTENSIONS=$PWD8N_CUSTOM_EXTENSIONS=$PWD` and start n8n with the `n8n` command. You should now be able to find the node when searching for it.
* To test the node, build the node with `npm run build`, then while in the project directory run `export N8N_CUSTOM_EXTENSIONS=$PWD` and start n8n with the `n8n` command. You should now be able to find the node when searching for it.
## Resources

View File

@ -13,6 +13,7 @@ export class VikunjaApi implements ICredentialType {
displayName: 'API Key',
name: 'apiKey',
type: 'string',
typeOptions: { password: true },
default: '',
},
{

View File

@ -3,14 +3,14 @@ import {
INodeListSearchResult,
INodeType,
INodeTypeDescription,
} from 'n8n-workflow'
} from 'n8n-workflow';
import {taskProperties} from './properties/Task'
import {projectProperties} from './properties/Project'
import {labelProperties} from './properties/Label'
import {searchAndMap} from './helper'
import {webhookProperties} from './properties/Webhook'
import {teamProperties} from './properties/Team'
import { taskProperties } from './properties/Task';
import { projectProperties } from './properties/Project';
import { labelProperties } from './properties/Label';
import { searchAndMap } from './helper';
import { webhookProperties } from './properties/Webhook';
import { teamProperties } from './properties/Team';
export class Vikunja implements INodeType {
description: INodeTypeDescription = {
@ -20,7 +20,7 @@ export class Vikunja implements INodeType {
group: ['transform'],
version: 1,
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
description: 'Get data from Vikunja\'s API',
description: "Get data from Vikunja's API",
defaults: {
name: 'Vikunja',
},
@ -47,25 +47,25 @@ export class Vikunja implements INodeType {
noDataExpression: true,
options: [
{
name: 'Task',
value: 'task',
name: 'Label',
value: 'label',
},
{
name: 'Project',
value: 'project',
},
{
name: 'Label',
value: 'label',
},
{
name: 'Webhook',
value: 'webhook',
name: 'Task',
value: 'task',
},
{
name: 'Team',
value: 'team',
},
{
name: 'Webhook',
value: 'webhook',
},
],
default: 'task',
},
@ -76,19 +76,19 @@ export class Vikunja implements INodeType {
...webhookProperties,
...teamProperties,
],
}
};
methods = {
listSearch: {
searchProjects(this: ILoadOptionsFunctions): Promise<INodeListSearchResult> {
return searchAndMap(this, '/projects')
return searchAndMap(this, '/projects');
},
async searchLabels(this: ILoadOptionsFunctions): Promise<INodeListSearchResult> {
return searchAndMap(this, '/labels')
return searchAndMap(this, '/labels');
},
async searchTeams(this: ILoadOptionsFunctions): Promise<INodeListSearchResult> {
return searchAndMap(this, '/teams', 'name')
return searchAndMap(this, '/teams', 'name');
},
},
}
}
};
}

View File

@ -1,4 +1,4 @@
import {INodeProperties} from 'n8n-workflow'
import { INodeProperties } from 'n8n-workflow';
export const projectProperties: INodeProperties[] = [
{
@ -13,126 +13,6 @@ export const projectProperties: INodeProperties[] = [
},
},
options: [
{
name: 'Create',
value: 'create',
description: 'Create a project',
action: 'Create a project',
routing: {
request: {
method: 'PUT',
url: '=/projects',
},
},
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a project',
action: 'Delete a project',
routing: {
request: {
method: 'DELETE',
url: '=/projects/{{$parameter.project}}',
},
},
},
{
name: 'Get',
value: 'get',
description: 'Get a project',
action: 'Get a project',
routing: {
request: {
method: 'GET',
url: '=/projects/{{$parameter.project}}',
},
},
},
{
name: 'Get Many',
value: 'getAll',
description: 'Get many projects',
action: 'Get many projects',
routing: {
request: {
method: 'GET',
url: '=/projects',
},
},
},
{
name: 'Update',
value: 'update',
description: 'Update a project',
action: 'Update a project',
routing: {
request: {
method: 'POST',
url: '=/projects/{{$parameter.project}}',
},
},
},
{
name: 'Duplicate',
value: 'duplicate',
description: 'Duplicate a project',
action: 'Duplicate a project',
routing: {
request: {
method: 'PUT',
url: '=/projects/{{$parameter.project}}/duplicate',
},
},
},
{
name: 'Get All Link Shares',
description: 'Fetch all linkShares on a project',
value: 'getAllLinkShares',
action: 'Get all link shares',
routing: {
request: {
method: 'GET',
url: '=/project/{{$parameter.project}}/shares',
},
},
},
{
name: 'Create a Link Share',
description: 'Create Link Share for a project',
value: 'createLinkShare',
action: 'Create a link share',
routing: {
request: {
method: 'PUT',
url: '=/projects/{{$parameter.project}}/shares',
},
},
},
{
name: 'Delete a Link Share',
description: 'Delete a link share from a project',
value: 'deleteLinkShare',
action: 'Delete a link share',
routing: {
request: {
method: 'DELETE',
url: '=/projects/{{$parameter.project}}/shares/{{$parameter.linkShareId}}',
},
},
},
{
name: 'Get All Teams',
description: 'Fetch all teams who have access to a project',
value: 'getAllTeams',
action: 'Get all teams',
routing: {
request: {
method: 'GET',
url: '=/projects/{{$parameter.project}}/teams',
},
},
},
{
name: 'Add a Team',
description: 'Add a team to a project',
@ -145,40 +25,6 @@ export const projectProperties: INodeProperties[] = [
},
},
},
{
name: 'Update a Team\'s Rights on a Project',
value: 'updateTeam',
action: 'Update a team s rights on a project a project',
routing: {
request: {
method: 'POST',
url: '=/projects/{{$parameter.project}}/teams/{{$parameter.teamId}}',
},
},
},
{
name: 'Remove a Team From a Project',
value: 'removeTeam',
action: 'Remove a team',
routing: {
request: {
method: 'DELETE',
url: '=/projects/{{$parameter.project}}/teams/{{$parameter.teamId}}',
},
},
},
{
name: 'Get All Users',
description: 'Fetch all users who have access to a project',
value: 'getAllUsers',
action: 'Get all users',
routing: {
request: {
method: 'GET',
url: '=/projects/{{$parameter.project}}/users',
},
},
},
{
name: 'Add a User',
description: 'Add a user to a project',
@ -192,24 +38,14 @@ export const projectProperties: INodeProperties[] = [
},
},
{
name: 'Update a User\'s Rights on a Project',
value: 'updateUser',
action: 'Update a user s rights on a project a project',
name: 'Create',
value: 'create',
description: 'Create a project',
action: 'Create a project',
routing: {
request: {
method: 'POST',
url: '=/projects/{{$parameter.project}}/users/{{$parameter.userId}}',
},
},
},
{
name: 'Remove a User From a Project',
value: 'removeUser',
action: 'Remove a user',
routing: {
request: {
method: 'DELETE',
url: '=/projects/{{$parameter.project}}/users/{{$parameter.userId}}',
method: 'PUT',
url: '=/projects',
},
},
},
@ -226,14 +62,26 @@ export const projectProperties: INodeProperties[] = [
},
},
{
name: 'Update a Kanban Bucket',
description: 'Update a kanban bucket in a project',
value: 'updateBucket',
action: 'Update a bucket',
name: 'Create a Link Share',
description: 'Create Link Share for a project',
value: 'createLinkShare',
action: 'Create a link share',
routing: {
request: {
method: 'POST',
url: '=/projects/{{$parameter.project}}/buckets/{{$parameter.bucketId}}',
method: 'PUT',
url: '=/projects/{{$parameter.project}}/shares',
},
},
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a project',
action: 'Delete a project',
routing: {
request: {
method: 'DELETE',
url: '=/projects/{{$parameter.project}}',
},
},
},
@ -249,6 +97,158 @@ export const projectProperties: INodeProperties[] = [
},
},
},
{
name: 'Delete a Link Share',
description: 'Delete a link share from a project',
value: 'deleteLinkShare',
action: 'Delete a link share',
routing: {
request: {
method: 'DELETE',
url: '=/projects/{{$parameter.project}}/shares/{{$parameter.linkShareId}}',
},
},
},
{
name: 'Duplicate',
value: 'duplicate',
description: 'Duplicate a project',
action: 'Duplicate a project',
routing: {
request: {
method: 'PUT',
url: '=/projects/{{$parameter.project}}/duplicate',
},
},
},
{
name: 'Get',
value: 'get',
description: 'Get a project',
action: 'Get a project',
routing: {
request: {
method: 'GET',
url: '=/projects/{{$parameter.project}}',
},
},
},
{
name: 'Get All Link Shares',
description: 'Fetch all linkShares on a project',
value: 'getAllLinkShares',
action: 'Get all link shares',
routing: {
request: {
method: 'GET',
url: '=/project/{{$parameter.project}}/shares',
},
},
},
{
name: 'Get All Teams',
description: 'Fetch all teams who have access to a project',
value: 'getAllTeams',
action: 'Get all teams',
routing: {
request: {
method: 'GET',
url: '=/projects/{{$parameter.project}}/teams',
},
},
},
{
name: 'Get All Users',
description: 'Fetch all users who have access to a project',
value: 'getAllUsers',
action: 'Get all users',
routing: {
request: {
method: 'GET',
url: '=/projects/{{$parameter.project}}/users',
},
},
},
{
name: 'Get Many',
value: 'getAll',
description: 'Get many projects',
action: 'Get many projects',
routing: {
request: {
method: 'GET',
url: '=/projects',
},
},
},
{
name: 'Remove a Team From a Project',
value: 'removeTeam',
action: 'Remove a team',
routing: {
request: {
method: 'DELETE',
url: '=/projects/{{$parameter.project}}/teams/{{$parameter.teamId}}',
},
},
},
{
name: 'Remove a User From a Project',
value: 'removeUser',
action: 'Remove a user',
routing: {
request: {
method: 'DELETE',
url: '=/projects/{{$parameter.project}}/users/{{$parameter.userId}}',
},
},
},
{
name: 'Update',
value: 'update',
description: 'Update a project',
action: 'Update a project',
routing: {
request: {
method: 'POST',
url: '=/projects/{{$parameter.project}}',
},
},
},
{
name: 'Update a Kanban Bucket',
description: 'Update a kanban bucket in a project',
value: 'updateBucket',
action: 'Update a bucket',
routing: {
request: {
method: 'POST',
url: '=/projects/{{$parameter.project}}/buckets/{{$parameter.bucketId}}',
},
},
},
{
name: "Update a Team's Rights on a Project",
value: 'updateTeam',
action: 'Update a team s rights on a project a project',
routing: {
request: {
method: 'POST',
url: '=/projects/{{$parameter.project}}/teams/{{$parameter.teamId}}',
},
},
},
{
name: "Update a User's Rights on a Project",
value: 'updateUser',
action: 'Update a user s rights on a project a project',
routing: {
request: {
method: 'POST',
url: '=/projects/{{$parameter.project}}/users/{{$parameter.userId}}',
},
},
},
],
default: 'create',
},
@ -256,7 +256,7 @@ export const projectProperties: INodeProperties[] = [
displayName: 'Project Title or ID',
name: 'project',
type: 'resourceLocator',
default: {mode: 'id', value: ''},
default: { mode: 'id', value: '' },
required: true,
modes: [
{
@ -307,7 +307,7 @@ export const projectProperties: INodeProperties[] = [
displayName: 'Parent Project Title or ID',
name: 'parentProject',
type: 'resourceLocator',
default: {mode: 'id', value: ''},
default: { mode: 'id', value: '' },
modes: [
{
displayName: 'From List',
@ -431,7 +431,8 @@ export const projectProperties: INodeProperties[] = [
name: 'defaultBucketId',
type: 'number',
default: 0,
description: 'The ID of the bucket where new tasks without a bucket are added to. By default, this is the leftmost bucket in a project.',
description:
'The ID of the bucket where new tasks without a bucket are added to. By default, this is the leftmost bucket in a project.',
routing: {
send: {
type: 'body',
@ -444,7 +445,8 @@ export const projectProperties: INodeProperties[] = [
name: 'doneBucketId',
type: 'number',
default: 0,
description: 'If tasks are moved to the done bucket, they are marked as done. If they are marked as done individually, they are moved into the done bucket.',
description:
'If tasks are moved to the done bucket, they are marked as done. If they are marked as done individually, they are moved into the done bucket.',
routing: {
send: {
type: 'body',
@ -484,7 +486,7 @@ export const projectProperties: INodeProperties[] = [
displayName: 'Team ID',
name: 'teamId',
type: 'resourceLocator',
default: {mode: 'id', value: ''},
default: { mode: 'id', value: '' },
modes: [
{
displayName: 'From List',
@ -587,7 +589,8 @@ export const projectProperties: INodeProperties[] = [
name: 'name',
type: 'string',
default: '',
description: 'The name of this link share. All actions someone takes while being authenticated with that link will appear with that name.',
description:
'The name of this link share. All actions someone takes while being authenticated with that link will appear with that name.',
routing: {
send: {
type: 'body',
@ -599,8 +602,10 @@ export const projectProperties: INodeProperties[] = [
displayName: 'Password',
name: 'password',
type: 'string',
typeOptions: { password: true },
default: '',
description: 'The password of this link share. You can only set it, not retrieve it after the link share has been created.',
description:
'The password of this link share. You can only set it, not retrieve it after the link share has been created.',
routing: {
send: {
type: 'body',
@ -629,7 +634,7 @@ export const projectProperties: INodeProperties[] = [
property: 'sharing_type',
},
},
}
},
],
},
{
@ -683,4 +688,4 @@ export const projectProperties: INodeProperties[] = [
},
default: 0,
},
]
];

View File

@ -1,4 +1,4 @@
import {INodeProperties} from 'n8n-workflow'
import { INodeProperties } from 'n8n-workflow';
export const taskProperties: INodeProperties[] = [
{
@ -13,6 +13,53 @@ export const taskProperties: INodeProperties[] = [
},
},
options: [
{
name: 'Add a Comment',
description: 'Add a comment to a task',
value: 'addComment',
action: 'Add a comment',
routing: {
request: {
method: 'PUT',
url: '=/tasks/{{$parameter.taskId}}/comments',
},
},
},
{
name: 'Add a Label',
description: 'Add a label to a task',
value: 'addLabel',
action: 'Add a label',
routing: {
request: {
method: 'PUT',
url: '=/tasks/{{$parameter.taskId}}/labels',
},
},
},
{
name: 'Add a Relation',
description: 'Add a relation to a task',
value: 'addRelation',
action: 'Add a relation',
routing: {
request: {
method: 'PUT',
url: '=/tasks/{{$parameter.taskId}}/relations',
},
},
},
{
name: 'Assign a User to a Task',
value: 'assignUser',
action: 'Assign a user',
routing: {
request: {
method: 'PUT',
url: '=/tasks/{{$parameter.taskId}}/assignees',
},
},
},
{
name: 'Create',
value: 'create',
@ -37,6 +84,18 @@ export const taskProperties: INodeProperties[] = [
},
},
},
{
name: 'Delete a Comment',
description: 'Delete an existing comment on a task',
value: 'deleteComment',
action: 'Delete a comment',
routing: {
request: {
method: 'DELETE',
url: '=/tasks/{{$parameter.taskId}}/comments/{{$parameter.commentId}}',
},
},
},
{
name: 'Get',
value: 'get',
@ -49,52 +108,6 @@ export const taskProperties: INodeProperties[] = [
},
},
},
{
name: 'Get Many',
value: 'getAll',
description: 'Get many tasks',
action: 'Get many tasks',
routing: {
request: {
method: 'GET',
url: '=/projects/{{$parameter.taskProject}}/tasks',
},
},
},
{
name: 'Update',
value: 'update',
description: 'Update a task',
action: 'Update a task',
routing: {
request: {
method: 'GET',
url: '=/tasks/{{$parameter.taskId}}',
},
},
},
{
name: 'Assign a User to a Task',
value: 'assignUser',
action: 'Assign a user',
routing: {
request: {
method: 'PUT',
url: '=/tasks/{{$parameter.taskId}}/assignees',
},
},
},
{
name: 'Remove an Assigned User From a Task',
value: 'unassignUser',
action: 'Unassign a user',
routing: {
request: {
method: 'DELETE',
url: '=/tasks/{{$parameter.taskId}}/assignees/{{$parameter.userId}}',
},
},
},
{
name: 'Get All Comments',
description: 'Fetch all comments on a task',
@ -107,42 +120,6 @@ export const taskProperties: INodeProperties[] = [
},
},
},
{
name: 'Add a Comment',
description: 'Add a comment to a task',
value: 'addComment',
action: 'Add a comment',
routing: {
request: {
method: 'PUT',
url: '=/tasks/{{$parameter.taskId}}/comments',
},
},
},
{
name: 'Update a Comment',
description: 'Update an existing comment on a task',
value: 'updateComment',
action: 'Update a comment',
routing: {
request: {
method: 'POST',
url: '=/tasks/{{$parameter.taskId}}/comments/{{$parameter.commentId}}',
},
},
},
{
name: 'Delete a Comment',
description: 'Delete an existing comment on a task',
value: 'deleteComment',
action: 'Delete a comment',
routing: {
request: {
method: 'DELETE',
url: '=/tasks/{{$parameter.taskId}}/comments/{{$parameter.commentId}}',
},
},
},
{
name: 'Get All Labels',
description: 'Fetch all labels on a task',
@ -156,14 +133,14 @@ export const taskProperties: INodeProperties[] = [
},
},
{
name: 'Add a Label',
description: 'Add a label to a task',
value: 'addLabel',
action: 'Add a label',
name: 'Get Many',
value: 'getAll',
description: 'Get many tasks',
action: 'Get many tasks',
routing: {
request: {
method: 'PUT',
url: '=/tasks/{{$parameter.taskId}}/labels',
method: 'GET',
url: '=/projects/{{$parameter.taskProject}}/tasks',
},
},
},
@ -178,18 +155,6 @@ export const taskProperties: INodeProperties[] = [
},
},
},
{
name: 'Add a Relation',
description: 'Add a relation to a task',
value: 'addRelation',
action: 'Add a relation',
routing: {
request: {
method: 'PUT',
url: '=/tasks/{{$parameter.taskId}}/relations',
},
},
},
{
name: 'Remove a Relation',
description: 'Remove an existing relation on a task',
@ -202,6 +167,41 @@ export const taskProperties: INodeProperties[] = [
},
},
},
{
name: 'Remove an Assigned User From a Task',
value: 'unassignUser',
action: 'Unassign a user',
routing: {
request: {
method: 'DELETE',
url: '=/tasks/{{$parameter.taskId}}/assignees/{{$parameter.userId}}',
},
},
},
{
name: 'Update',
value: 'update',
description: 'Update a task',
action: 'Update a task',
routing: {
request: {
method: 'GET',
url: '=/tasks/{{$parameter.taskId}}',
},
},
},
{
name: 'Update a Comment',
description: 'Update an existing comment on a task',
value: 'updateComment',
action: 'Update a comment',
routing: {
request: {
method: 'POST',
url: '=/tasks/{{$parameter.taskId}}/comments/{{$parameter.commentId}}',
},
},
},
],
default: 'create',
},
@ -237,7 +237,7 @@ export const taskProperties: INodeProperties[] = [
displayName: 'Project Title or ID',
name: 'taskProject',
type: 'resourceLocator',
default: {mode: 'id', value: ''},
default: { mode: 'id', value: '' },
required: true,
modes: [
{
@ -459,7 +459,8 @@ export const taskProperties: INodeProperties[] = [
},
],
default: 0,
description: 'How a repeating task will repeat itself. Will be triggered when a task is marked done.',
description:
'How a repeating task will repeat itself. Will be triggered when a task is marked done.',
routing: {
send: {
type: 'body',
@ -551,16 +552,20 @@ export const taskProperties: INodeProperties[] = [
type: 'options',
options: [
{
name: 'Sub Task',
value: 'subtask',
name: 'Blocked',
value: 'blocked',
},
{
name: 'Parent Task',
value: 'parenttask',
name: 'Blocking',
value: 'blocking',
},
{
name: 'Related Task',
value: 'related',
name: 'Coped To',
value: 'copiedto',
},
{
name: 'Copied From',
value: 'copiedfrom',
},
{
name: 'Duplicate Of',
@ -571,28 +576,24 @@ export const taskProperties: INodeProperties[] = [
value: 'duplicates',
},
{
name: 'Blocking',
value: 'blocking',
name: 'Follows',
value: 'follows',
},
{
name: 'Blocked',
value: 'blocked',
name: 'Parent Task',
value: 'parenttask',
},
{
name: 'Precedes',
value: 'precedes',
},
{
name: 'Follows',
value: 'follows',
name: 'Related Task',
value: 'related',
},
{
name: 'Copied From',
value: 'copiedfrom',
},
{
name: 'Coped To',
value: 'copiedto',
name: 'Sub Task',
value: 'subtask',
},
],
default: 'related',
@ -610,4 +611,4 @@ export const taskProperties: INodeProperties[] = [
},
},
},
]
];

View File

@ -1,4 +1,4 @@
import {INodeProperties} from 'n8n-workflow'
import { INodeProperties } from 'n8n-workflow';
export const teamProperties: INodeProperties[] = [
{
@ -13,6 +13,18 @@ export const teamProperties: INodeProperties[] = [
},
},
options: [
{
name: 'Add a User',
description: 'Add a user to a team',
value: 'addUser',
action: 'Add a user',
routing: {
request: {
method: 'PUT',
url: '=/teams/{{$parameter.team}}/members',
},
},
},
{
name: 'Create',
value: 'create',
@ -61,30 +73,6 @@ export const teamProperties: INodeProperties[] = [
},
},
},
{
name: 'Update',
value: 'update',
description: 'Update a team',
action: 'Update a team',
routing: {
request: {
method: 'POST',
url: '=/teams/{{$parameter.team}}',
},
},
},
{
name: 'Add a User',
description: 'Add a user to a team',
value: 'addUser',
action: 'Add a user',
routing: {
request: {
method: 'PUT',
url: '=/teams/{{$parameter.team}}/members',
},
},
},
{
name: 'Remove a User From a Team',
value: 'removeUser',
@ -97,7 +85,7 @@ export const teamProperties: INodeProperties[] = [
},
},
{
name: 'Toggle a User\'s Admin Status in a Team',
name: "Toggle a User's Admin Status in a Team",
value: 'updateUser',
action: 'Toggle admin status',
routing: {
@ -107,6 +95,18 @@ export const teamProperties: INodeProperties[] = [
},
},
},
{
name: 'Update',
value: 'update',
description: 'Update a team',
action: 'Update a team',
routing: {
request: {
method: 'POST',
url: '=/teams/{{$parameter.team}}',
},
},
},
],
default: 'create',
},
@ -114,7 +114,7 @@ export const teamProperties: INodeProperties[] = [
displayName: 'Team Name or ID',
name: 'team',
type: 'resourceLocator',
default: {mode: 'id', value: ''},
default: { mode: 'id', value: '' },
required: true,
modes: [
{
@ -248,4 +248,4 @@ export const teamProperties: INodeProperties[] = [
},
},
},
]
];

View File

@ -1,7 +1,7 @@
{
"name": "n8n-nodes-vikunja",
"version": "0.1.0",
"description": "",
"description": "This is an n8n community node which lets you use Vikunja in your n8n workflows.",
"keywords": [
"n8n-community-node-package"
],