Skip to content

Commit c0cd941

Browse files
authored
fix: lint errors and prepare package for release (#78)
1 parent ce4cf9f commit c0cd941

4 files changed

Lines changed: 3411 additions & 2965 deletions

File tree

nodes/hostingerApi/HostingerApi.node.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"node": "n8n-nodes-base.HostingerApi",
2+
"node": "n8n-nodes-hostinger-api.HostingerApi",
33
"nodeVersion": "1.0",
44
"codexVersion": "1.0",
55
"categories": [
6-
"API"
6+
"Development"
77
],
88
"resources": {
99
"credentialDocumentation": [
@@ -17,4 +17,4 @@
1717
}
1818
]
1919
}
20-
}
20+
}

nodes/hostingerApi/HostingerApi.node.ts

Lines changed: 73 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,36 @@ import {
66
INodeExecutionData,
77
INodeType,
88
INodeTypeDescription,
9+
INodePropertyOptions,
910
NodeConnectionTypes,
1011
NodeOperationError,
1112
} from 'n8n-workflow';
1213

14+
// Kept out of the node description so that product names such as DNS and VPS are
15+
// not singularized into DN and VP by the resource naming lint rule.
16+
const resourceOptions: INodePropertyOptions[] = [
17+
{ name: 'Billing', value: 'billing' },
18+
{ name: 'DNS', value: 'dns' },
19+
{ name: 'Domain', value: 'domain' },
20+
{ name: 'Domain Forwarding', value: 'domainForwarding' },
21+
{ name: 'Domain WHOIS', value: 'whois' },
22+
{ name: 'Reach', value: 'reach' },
23+
{ name: 'Reach Contact Fields', value: 'reachContactFields' },
24+
{ name: 'Reach Segments', value: 'reachSegments' },
25+
{ name: 'Reach Tags', value: 'reachTags' },
26+
{ name: 'VPS', value: 'vps' },
27+
{ name: 'VPS Actions', value: 'vpsActions' },
28+
{ name: 'VPS Backups', value: 'vpsBackups' },
29+
{ name: 'VPS Data Centers', value: 'vpsDataCenters' },
30+
{ name: 'VPS Docker Manager', value: 'vpsDocker' },
31+
{ name: 'VPS Firewall', value: 'vpsFirewall' },
32+
{ name: 'VPS Malware Scanner', value: 'vpsMonarx' },
33+
{ name: 'VPS Post Install Scripts', value: 'vpsScripts' },
34+
{ name: 'VPS PTR', value: 'vpsPTR' },
35+
{ name: 'VPS Public Keys', value: 'vpsPublicKeys' },
36+
{ name: 'VPS Snapshots', value: 'vpsSnapshots' },
37+
{ name: 'VPS Templates', value: 'vpsTemplates' },
38+
];
1339

1440
export class HostingerApi implements INodeType {
1541
description: INodeTypeDescription = {
@@ -38,30 +64,7 @@ export class HostingerApi implements INodeType {
3864
name: 'resource',
3965
type: 'options',
4066
noDataExpression: true,
41-
options: [
42-
{ name: 'Billing', value: 'billing', },
43-
// eslint-disable-next-line n8n-nodes-base/node-param-resource-with-plural-option
44-
{ name: 'DNS', value: 'dns', },
45-
{ name: 'Domain', value: 'domain', },
46-
{ name: 'Domain Forwarding', value: 'domainForwarding', },
47-
{ name: 'Domain WHOIS', value: 'whois', },
48-
{ name: 'Reach', value: 'reach', },
49-
{ name: 'Reach Contact Fields', value: 'reachContactFields', },
50-
{ name: 'Reach Segments', value: 'reachSegments', },
51-
{ name: 'Reach Tags', value: 'reachTags', },
52-
{ name: 'VPS', value: 'vps', },
53-
{ name: 'VPS Actions', value: 'vpsActions', },
54-
{ name: 'VPS Backups', value: 'vpsBackups', },
55-
{ name: 'VPS Data Centers', value: 'vpsDataCenters', },
56-
{ name: 'VPS Docker Manager', value: 'vpsDocker', },
57-
{ name: 'VPS Firewall', value: 'vpsFirewall', },
58-
{ name: 'VPS Malware Scanner', value: 'vpsMonarx', },
59-
{ name: 'VPS Post Install Scripts', value: 'vpsScripts', },
60-
{ name: 'VPS PTR', value: 'vpsPTR', },
61-
{ name: 'VPS Public Keys', value: 'vpsPublicKeys', },
62-
{ name: 'VPS Snapshots', value: 'vpsSnapshots', },
63-
{ name: 'VPS Templates', value: 'vpsTemplates', },
64-
],
67+
options: resourceOptions,
6568
default: 'vps',
6669
},
6770
{
@@ -86,26 +89,16 @@ export class HostingerApi implements INodeType {
8689
type: 'options',
8790
noDataExpression: true,
8891
options: [
89-
// eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
90-
{ name: 'Create Project', value: 'createProject', action: 'Create Docker project' },
91-
// eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
92-
{ name: 'Delete Project', value: 'deleteProject', action: 'Delete Docker project' },
93-
// eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
94-
{ name: 'Get Project Logs', value: 'getLogs', action: 'Get Docker project logs' },
95-
// eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
96-
{ name: 'List Containers', value: 'listContainers', action: 'List Docker containers' },
97-
// eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
98-
{ name: 'List Contents', value: 'listContents', action: 'List Docker containers content' },
99-
// eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
100-
{ name: 'List Projects', value: 'listProjects', action: 'List Docker projects' },
101-
// eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
102-
{ name: 'Restart Project', value: 'restartProject', action: 'Restart Docker project' },
103-
// eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
104-
{ name: 'Start Project', value: 'startProject', action: 'Start Docker project' },
105-
// eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
106-
{ name: 'Stop Project', value: 'stopProject', action: 'Stop Docker project' },
107-
// eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
108-
{ name: 'Update Project', value: 'updateProject', action: 'Update Docker project' },
92+
{ name: 'Create Project', value: 'createProject', action: 'Create docker project' },
93+
{ name: 'Delete Project', value: 'deleteProject', action: 'Delete docker project' },
94+
{ name: 'Get Project Logs', value: 'getLogs', action: 'Get docker project logs' },
95+
{ name: 'List Containers', value: 'listContainers', action: 'List docker containers' },
96+
{ name: 'List Contents', value: 'listContents', action: 'List docker containers content' },
97+
{ name: 'List Projects', value: 'listProjects', action: 'List docker projects' },
98+
{ name: 'Restart Project', value: 'restartProject', action: 'Restart docker project' },
99+
{ name: 'Start Project', value: 'startProject', action: 'Start docker project' },
100+
{ name: 'Stop Project', value: 'stopProject', action: 'Stop docker project' },
101+
{ name: 'Update Project', value: 'updateProject', action: 'Update docker project' },
109102
],
110103
default: 'listProjects',
111104
displayOptions: {
@@ -412,32 +405,19 @@ export class HostingerApi implements INodeType {
412405
type: 'options',
413406
noDataExpression: true,
414407
options: [
415-
// eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
416-
{ name: 'Create Contact', value: 'createContact', action: 'Create Reach contact', description: 'Deprecated: use Create Profile Contact to target an explicit profile' },
417-
// eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
418-
{ name: 'Create Contacts in Bulk', value: 'createProfileContactsBulk', action: 'Create Reach profile contacts in bulk' },
419-
// eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
420-
{ name: 'Create Profile Contact', value: 'createProfileContact', action: 'Create Reach profile contact' },
421-
// eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
422-
{ name: 'Delete Contact', value: 'deleteContact', action: 'Delete Reach contact', description: 'Deprecated: use Delete Profile Contact to target an explicit profile' },
423-
// eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
424-
{ name: 'Delete Profile Contact', value: 'deleteProfileContact', action: 'Delete Reach profile contact' },
425-
// eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
426-
{ name: 'Get Profile Contact', value: 'getProfileContact', action: 'Get Reach profile contact' },
427-
// eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
428-
{ name: 'Get Segment', value: 'getSegment', action: 'Get Reach segment', description: 'Deprecated: use Reach Segments to target an explicit profile' },
429-
// eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
430-
{ name: 'Get Segment Contacts', value: 'getSegmentContacts', action: 'Get Reach segment contacts', description: 'Deprecated: use Reach Segments to target an explicit profile' },
431-
// eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
432-
{ name: 'List Contacts', value: 'listContacts', action: 'List Reach contacts', description: 'Deprecated: use List Profile Contacts to target an explicit profile' },
433-
// eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
434-
{ name: 'List Profile Contacts', value: 'listProfileContacts', action: 'List Reach profile contacts' },
435-
// eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
436-
{ name: 'List Profiles', value: 'listProfiles', action: 'List Reach profiles' },
437-
// eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
438-
{ name: 'List Segments', value: 'listSegments', action: 'List Reach segments', description: 'Deprecated: use Reach Segments to target an explicit profile' },
439-
// eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
440-
{ name: 'Update Profile Contact', value: 'updateProfileContact', action: 'Update Reach profile contact' },
408+
{ name: 'Create Contact', value: 'createContact', action: 'Create reach contact', description: 'Deprecated: use Create Profile Contact to target an explicit profile' },
409+
{ name: 'Create Contacts in Bulk', value: 'createProfileContactsBulk', action: 'Create reach profile contacts in bulk' },
410+
{ name: 'Create Profile Contact', value: 'createProfileContact', action: 'Create reach profile contact' },
411+
{ name: 'Delete Contact', value: 'deleteContact', action: 'Delete reach contact', description: 'Deprecated: use Delete Profile Contact to target an explicit profile' },
412+
{ name: 'Delete Profile Contact', value: 'deleteProfileContact', action: 'Delete reach profile contact' },
413+
{ name: 'Get Profile Contact', value: 'getProfileContact', action: 'Get reach profile contact' },
414+
{ name: 'Get Segment', value: 'getSegment', action: 'Get reach segment', description: 'Deprecated: use Reach Segments to target an explicit profile' },
415+
{ name: 'Get Segment Contacts', value: 'getSegmentContacts', action: 'Get reach segment contacts', description: 'Deprecated: use Reach Segments to target an explicit profile' },
416+
{ name: 'List Contacts', value: 'listContacts', action: 'List reach contacts', description: 'Deprecated: use List Profile Contacts to target an explicit profile' },
417+
{ name: 'List Profile Contacts', value: 'listProfileContacts', action: 'List reach profile contacts' },
418+
{ name: 'List Profiles', value: 'listProfiles', action: 'List reach profiles' },
419+
{ name: 'List Segments', value: 'listSegments', action: 'List reach segments', description: 'Deprecated: use Reach Segments to target an explicit profile' },
420+
{ name: 'Update Profile Contact', value: 'updateProfileContact', action: 'Update reach profile contact' },
441421
],
442422
default: 'listProfileContacts',
443423
displayOptions: {
@@ -452,14 +432,10 @@ export class HostingerApi implements INodeType {
452432
type: 'options',
453433
noDataExpression: true,
454434
options: [
455-
// eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
456-
{ name: 'Create Contact Field', value: 'createContactField', action: 'Create Reach contact field' },
457-
// eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
458-
{ name: 'Delete Contact Field', value: 'deleteContactField', action: 'Delete Reach contact field' },
459-
// eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
460-
{ name: 'List Contact Fields', value: 'listContactFields', action: 'List Reach contact fields' },
461-
// eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
462-
{ name: 'Update Contact Field', value: 'updateContactField', action: 'Update Reach contact field' },
435+
{ name: 'Create Contact Field', value: 'createContactField', action: 'Create reach contact field' },
436+
{ name: 'Delete Contact Field', value: 'deleteContactField', action: 'Delete reach contact field' },
437+
{ name: 'List Contact Fields', value: 'listContactFields', action: 'List reach contact fields' },
438+
{ name: 'Update Contact Field', value: 'updateContactField', action: 'Update reach contact field' },
463439
],
464440
default: 'listContactFields',
465441
displayOptions: {
@@ -474,20 +450,13 @@ export class HostingerApi implements INodeType {
474450
type: 'options',
475451
noDataExpression: true,
476452
options: [
477-
// eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
478-
{ name: 'Count Profile Segment Contacts', value: 'countProfileSegmentContacts', action: 'Count Reach profile segment contacts' },
479-
// eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
480-
{ name: 'Create Profile Segment', value: 'createProfileSegment', action: 'Create Reach profile segment' },
481-
// eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
482-
{ name: 'Delete Profile Segment', value: 'deleteProfileSegment', action: 'Delete Reach profile segment' },
483-
// eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
484-
{ name: 'Get Profile Segment', value: 'getProfileSegment', action: 'Get Reach profile segment' },
485-
// eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
486-
{ name: 'List Profile Segment Contacts', value: 'listProfileSegmentContacts', action: 'List Reach profile segment contacts' },
487-
// eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
488-
{ name: 'List Profile Segments', value: 'listProfileSegments', action: 'List Reach profile segments' },
489-
// eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
490-
{ name: 'Update Profile Segment', value: 'updateProfileSegment', action: 'Update Reach profile segment' },
453+
{ name: 'Count Profile Segment Contacts', value: 'countProfileSegmentContacts', action: 'Count reach profile segment contacts' },
454+
{ name: 'Create Profile Segment', value: 'createProfileSegment', action: 'Create reach profile segment' },
455+
{ name: 'Delete Profile Segment', value: 'deleteProfileSegment', action: 'Delete reach profile segment' },
456+
{ name: 'Get Profile Segment', value: 'getProfileSegment', action: 'Get reach profile segment' },
457+
{ name: 'List Profile Segment Contacts', value: 'listProfileSegmentContacts', action: 'List reach profile segment contacts' },
458+
{ name: 'List Profile Segments', value: 'listProfileSegments', action: 'List reach profile segments' },
459+
{ name: 'Update Profile Segment', value: 'updateProfileSegment', action: 'Update reach profile segment' },
491460
],
492461
default: 'listProfileSegments',
493462
displayOptions: {
@@ -502,22 +471,14 @@ export class HostingerApi implements INodeType {
502471
type: 'options',
503472
noDataExpression: true,
504473
options: [
505-
// eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
506-
{ name: 'Assign Tag to Contact', value: 'assignTagToContact', action: 'Assign Reach tag to contact' },
507-
// eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
508-
{ name: 'Assign Tag to Contacts', value: 'assignTagToContacts', action: 'Assign Reach tag to multiple contacts' },
509-
// eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
510-
{ name: 'Create Tags', value: 'createTags', action: 'Create Reach tags' },
511-
// eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
512-
{ name: 'Delete Tag', value: 'deleteTag', action: 'Delete Reach tag' },
513-
// eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
514-
{ name: 'List Tags', value: 'listTags', action: 'List Reach tags' },
515-
// eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
516-
{ name: 'Remove Tag From Contact', value: 'removeTagFromContact', action: 'Remove Reach tag from contact' },
517-
// eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
518-
{ name: 'Remove Tag From Contacts', value: 'removeTagFromContacts', action: 'Remove Reach tag from multiple contacts' },
519-
// eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
520-
{ name: 'Update Tag', value: 'updateTag', action: 'Update Reach tag' },
474+
{ name: 'Assign Tag to Contact', value: 'assignTagToContact', action: 'Assign reach tag to contact' },
475+
{ name: 'Assign Tag to Contacts', value: 'assignTagToContacts', action: 'Assign reach tag to multiple contacts' },
476+
{ name: 'Create Tags', value: 'createTags', action: 'Create reach tags' },
477+
{ name: 'Delete Tag', value: 'deleteTag', action: 'Delete reach tag' },
478+
{ name: 'List Tags', value: 'listTags', action: 'List reach tags' },
479+
{ name: 'Remove Tag From Contact', value: 'removeTagFromContact', action: 'Remove reach tag from contact' },
480+
{ name: 'Remove Tag From Contacts', value: 'removeTagFromContacts', action: 'Remove reach tag from multiple contacts' },
481+
{ name: 'Update Tag', value: 'updateTag', action: 'Update reach tag' },
521482
],
522483
default: 'listTags',
523484
displayOptions: {
@@ -1984,14 +1945,16 @@ export class HostingerApi implements INodeType {
19841945
}
19851946
} else {
19861947
// For other actions, use the request body field
1987-
requestBody = JSON.parse(this.getNodeParameter('requestBody', i) as string);
1948+
requestBody = parseJsonParam('requestBody', 'Request Body');
19881949
}
19891950
} catch (error) {
19901951
// Invalid JSON supplied by the user must fail the item rather than send a
19911952
// partial body. Everything else reaching this point is an operation with no
19921953
// Request Body parameter to read, which correctly leaves the body unset.
19931954
if (error instanceof NodeOperationError) {
1994-
if (!continueOnFail) throw error;
1955+
if (!continueOnFail) {
1956+
throw new NodeOperationError(this.getNode(), error, { itemIndex: i });
1957+
}
19951958

19961959
returnData.push({
19971960
json: { error: error.message },

0 commit comments

Comments
 (0)