Add SecurityScorecard node (#1371)

* Add SecurityScorecard node

* Move portfolio:edit fields to the main view.

The API request uses PUT so it will replace undefined fields if they are not set.

* Style improvements

*  Improvements to #1247

*  Improvements

*  Minor improvements on SecurityScorecard Node

Co-authored-by: Mika Luhta <12100880+mluhta@users.noreply.github.com>
Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
This commit is contained in:
Ricardo Espinoza
2021-01-28 12:31:37 -05:00
committed by GitHub
parent 8764171989
commit d0b896da38
11 changed files with 2024 additions and 0 deletions

View File

@@ -0,0 +1,253 @@
import {
INodeProperties,
} from 'n8n-workflow';
export const companyOperations = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
required: true,
displayOptions: {
show: {
resource: [
'company',
],
},
},
options: [
{
name: 'Get Factor Scores',
value: 'getFactor',
description: 'Get company factor scores and issue counts',
},
{
name: 'Get Historical Factor Scores',
value: 'getFactorHistorical',
description: 'Get company\'s historical factor scores',
},
{
name: 'Get Historical Scores',
value: 'getHistoricalScore',
description: 'Get company\'s historical scores',
},
{
name: 'Get Information and Scorecard',
value: 'getScorecard',
description: 'Get company information and summary of their scorecard',
},
{
name: 'Get Score Plan',
value: 'getScorePlan',
description: 'Get company\'s score improvement plan',
},
],
default: 'getFactor',
},
] as INodeProperties[];
export const companyFields = [
{
displayName: 'Scorecard Identifier',
name: 'scorecardIdentifier',
description: 'Primary identifier of a company or scorecard, i.e. domain',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
resource: [
'company',
],
operation: [
'getScorecard',
'getFactor',
'getFactorHistorical',
'getHistoricalScore',
'getScorePlan',
],
},
},
},
{
displayName: 'Score',
name: 'score',
description: 'Score target',
type: 'number',
displayOptions: {
show: {
resource: [
'company',
],
operation: [
'getScorePlan',
],
},
},
required: true,
default: 0,
},
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
displayOptions: {
show: {
resource: [
'company',
],
operation: [
'getFactor',
'getFactorHistorical',
'getHistoricalScore',
'getScorePlan',
],
},
},
default: false,
description: 'If all results should be returned or only up to a given limit.',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
displayOptions: {
show: {
resource: [
'company',
],
operation: [
'getFactor',
'getFactorHistorical',
'getHistoricalScore',
'getScorePlan',
],
returnAll: [
false,
],
},
},
typeOptions: {
minValue: 1,
maxValue: 100,
},
default: 100,
description: 'Number of results to return.',
},
{
displayName: 'Simple',
name: 'simple',
type: 'boolean',
displayOptions: {
show: {
resource: [
'company',
],
operation: [
'getFactorHistorical',
'getHistoricalScore',
],
},
},
default: true,
description: 'Simplify the response.',
},
// company:getFactor
{
displayName: 'Filters',
name: 'filters',
displayOptions: {
show: {
resource: [
'company',
],
operation: [
'getFactor',
],
},
},
type: 'collection',
placeholder: 'Add Filter',
default: {},
options: [
{
displayName: 'Severity',
name: 'severity',
type: 'string',
default: '',
placeholder: '',
},
{
displayName: 'Severity In',
description: 'Filter issues by comma separated severity list',
name: 'severity_in',
type: 'string',
default: '',
placeholder: '',
},
],
},
// company:getFactorHistorical
// company:getHistoricalScore
{
displayName: 'Options',
name: 'options',
displayOptions: {
show: {
resource: [
'company',
],
operation: [
'getFactorHistorical',
'getHistoricalScore',
],
},
},
type: 'collection',
placeholder: 'Add Option',
default: {},
options: [
{
displayName: 'Date From',
description: 'History start date',
name: 'date_from',
type: 'dateTime',
default: '',
required: false,
},
{
displayName: 'Date To',
description: 'History end date',
name: 'date_to',
type: 'dateTime',
default: '',
required: false,
},
{
displayName: 'Timing',
description: 'Date granularity',
name: 'timing',
type: 'options',
options: [
{
name: 'Daily',
value: 'daily',
},
{
name: 'Weekly',
value: 'weekly',
},
{
name: 'Monthly',
value: 'monthly',
},
],
default: 'daily',
required: false,
},
],
},
] as INodeProperties[];