Skip to content

Commit

Permalink
feat(TheHive Node): Overhaul (#6457)
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-radency authored Sep 4, 2023
1 parent f286bd3 commit 73e782e
Show file tree
Hide file tree
Showing 85 changed files with 8,291 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,14 @@ const resourceMapperMode = computed<string | undefined>(() => {
return resourceMapperTypeOptions.value?.mode;
});
const resourceMapperValuesLabel = computed<string | undefined>(() => {
return resourceMapperTypeOptions.value?.valuesLabel;
});
const valuesLabel = computed<string>(() => {
if (resourceMapperValuesLabel.value) {
return resourceMapperValuesLabel.value;
}
if (resourceMapperMode.value && resourceMapperMode.value === 'update') {
return locale.baseText('resourceMapper.valuesToUpdate.label');
}
Expand Down
9 changes: 5 additions & 4 deletions packages/nodes-base/credentials/TheHiveApi.credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,15 @@ export class TheHiveApi implements ICredentialType {
description: 'The version of api to be used',
options: [
{
name: 'Version 1',
name: 'TheHive 4+ (api v1)',
value: 'v1',
description: 'API version supported by TheHive 4',
description:
'API version with TheHive 4 support, also works with TheHive 5 but not all features are supported',
},
{
name: 'Version 0',
name: 'TheHive 3 (api v0)',
value: '',
description: 'API version supported by TheHive 3',
description: 'API version with TheHive 3 support',
},
],
},
Expand Down
57 changes: 57 additions & 0 deletions packages/nodes-base/credentials/TheHiveProjectApi.credentials.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import type {
IAuthenticateGeneric,
ICredentialTestRequest,
ICredentialType,
INodeProperties,
} from 'n8n-workflow';

export class TheHiveProjectApi implements ICredentialType {
name = 'theHiveProjectApi';

displayName = 'The Hive 5 API';

documentationUrl = 'theHive';

properties: INodeProperties[] = [
{
displayName: 'API Key',
name: 'ApiKey',
type: 'string',
default: '',
typeOptions: {
password: true,
},
},
{
displayName: 'URL',
name: 'url',
default: '',
type: 'string',
description: 'The URL of TheHive instance',
placeholder: 'https://localhost:9000',
},
{
displayName: 'Ignore SSL Issues',
name: 'allowUnauthorizedCerts',
type: 'boolean',
description: 'Whether to connect even if SSL certificate validation is not possible',
default: false,
},
];

authenticate: IAuthenticateGeneric = {
type: 'generic',
properties: {
headers: {
Authorization: '=Bearer {{$credentials?.ApiKey}}',
},
},
};

test: ICredentialTestRequest = {
request: {
baseURL: '={{$credentials?.url}}',
url: '/api/case',
},
};
}
19 changes: 19 additions & 0 deletions packages/nodes-base/nodes/TheHiveProject/TheHiveProject.node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"node": "n8n-nodes-base.theHiveProject",
"nodeVersion": "1.0",
"codexVersion": "1.0",
"categories": ["Development"],
"alias": ["Security", "Monitoring", "Incident", "Response", "Alert"],
"resources": {
"credentialDocumentation": [
{
"url": "https://docs.n8n.io/credentials/theHive"
}
],
"primaryDocumentation": [
{
"url": "https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.thehive/"
}
]
}
}
15 changes: 15 additions & 0 deletions packages/nodes-base/nodes/TheHiveProject/TheHiveProject.node.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { IExecuteFunctions, INodeType, INodeTypeDescription } from 'n8n-workflow';

import { description } from './actions/node.description';
import { router } from './actions/router';
import { loadOptions, listSearch, resourceMapping } from './methods';

export class TheHiveProject implements INodeType {
description: INodeTypeDescription = description;

methods = { loadOptions, listSearch, resourceMapping };

async execute(this: IExecuteFunctions) {
return router.call(this);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"node": "n8n-nodes-base.theHiveProjectTrigger",
"nodeVersion": "1.0",
"codexVersion": "1.0",
"categories": ["Development"],
"resources": {
"primaryDocumentation": [
{
"url": "https://docs.n8n.io/integrations/builtin/trigger-nodes/n8n-nodes-base.thehivetrigger/"
}
]
}
}
Loading

0 comments on commit 73e782e

Please sign in to comment.