Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(MISP Node): Rest search operations (#9196)
- Loading branch information
1 parent
9b3ac16
commit b694e77
Showing
7 changed files
with
270 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
packages/nodes-base/nodes/Misp/descriptions/ObjectDescription.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import type { INodeProperties } from 'n8n-workflow'; | ||
import { updateDisplayOptions } from '../../../utils/utilities'; | ||
import { searchProperties } from './common.descriptions'; | ||
|
||
const searchDisplayOptions = { | ||
show: { | ||
resource: ['object'], | ||
operation: ['search'], | ||
}, | ||
}; | ||
|
||
const searchDescription = updateDisplayOptions(searchDisplayOptions, searchProperties); | ||
|
||
export const objectOperations: INodeProperties[] = [ | ||
{ | ||
displayName: 'Operation', | ||
name: 'operation', | ||
type: 'options', | ||
displayOptions: { | ||
show: { | ||
resource: ['object'], | ||
}, | ||
}, | ||
noDataExpression: true, | ||
options: [ | ||
{ | ||
name: 'Search', | ||
value: 'search', | ||
action: 'Get a filtered list of objects', | ||
}, | ||
], | ||
default: 'search', | ||
}, | ||
]; | ||
|
||
export const objectFields: INodeProperties[] = [ | ||
// ---------------------------------------- | ||
// event: search | ||
// ---------------------------------------- | ||
...searchDescription, | ||
]; |
102 changes: 102 additions & 0 deletions
102
packages/nodes-base/nodes/Misp/descriptions/common.descriptions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
import type { INodeProperties } from 'n8n-workflow'; | ||
|
||
export const searchProperties: INodeProperties[] = [ | ||
{ | ||
displayName: 'Use JSON to Specify Fields', | ||
name: 'useJson', | ||
type: 'boolean', | ||
default: false, | ||
description: 'Whether to use JSON to specify the fields for the search request', | ||
}, | ||
{ | ||
displayName: 'JSON', | ||
name: 'jsonOutput', | ||
type: 'json', | ||
description: | ||
'Get more info at {YOUR_BASE_URL_SPECIFIED_IN_CREDENTIALS}/api/openapi#operation/restSearchAttributes', | ||
typeOptions: { | ||
rows: 5, | ||
}, | ||
default: '{\n "value": "search value",\n "type": "text"\n}\n', | ||
validateType: 'object', | ||
displayOptions: { | ||
show: { | ||
useJson: [true], | ||
}, | ||
}, | ||
}, | ||
{ | ||
displayName: 'Value', | ||
name: 'value', | ||
type: 'string', | ||
required: true, | ||
placeholder: 'e.g. 127.0.0.1', | ||
default: '', | ||
displayOptions: { | ||
show: { | ||
useJson: [false], | ||
}, | ||
}, | ||
}, | ||
{ | ||
displayName: 'Additional Fields', | ||
name: 'additionalFields', | ||
type: 'collection', | ||
placeholder: 'Add Field', | ||
default: {}, | ||
displayOptions: { | ||
show: { | ||
useJson: [false], | ||
}, | ||
}, | ||
options: [ | ||
{ | ||
displayName: 'Category', | ||
name: 'category', | ||
type: 'string', | ||
placeholder: 'e.g. Internal reference', | ||
default: '', | ||
}, | ||
{ | ||
displayName: 'Deleted', | ||
name: 'deleted', | ||
type: 'boolean', | ||
default: false, | ||
}, | ||
{ | ||
displayName: 'Search All', | ||
name: 'searchall', | ||
type: 'string', | ||
description: | ||
'Search by matching any tag names, event descriptions, attribute values or attribute comments', | ||
default: '', | ||
displayOptions: { | ||
hide: { | ||
'/resource': ['attribute'], | ||
}, | ||
}, | ||
}, | ||
{ | ||
displayName: 'Tags', | ||
name: 'tags', | ||
type: 'string', | ||
placeholder: 'e.g. tag1,tag2', | ||
hint: 'Comma-separated list of tags', | ||
default: '', | ||
}, | ||
{ | ||
displayName: 'Type', | ||
name: 'type', | ||
type: 'string', | ||
placeholder: 'e.g. text', | ||
default: '', | ||
}, | ||
{ | ||
displayName: 'Published', | ||
name: 'published', | ||
type: 'boolean', | ||
default: false, | ||
}, | ||
], | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters