first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
import type {
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
IDataObject,
|
||||
JsonObject,
|
||||
IHttpRequestMethods,
|
||||
IRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
export async function scorecardApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
|
||||
body: any = {},
|
||||
query: IDataObject = {},
|
||||
uri?: string,
|
||||
option: IDataObject = {},
|
||||
): Promise<any> {
|
||||
const credentials = await this.getCredentials('securityScorecardApi');
|
||||
|
||||
const headerWithAuthentication = { Authorization: `Token ${credentials.apiKey}` };
|
||||
|
||||
let options: IRequestOptions = {
|
||||
headers: headerWithAuthentication,
|
||||
method,
|
||||
qs: query,
|
||||
uri: uri || `https://api.securityscorecard.io/${resource}`,
|
||||
body,
|
||||
json: true,
|
||||
};
|
||||
|
||||
if (Object.keys(option).length !== 0) {
|
||||
options = Object.assign({}, options, option);
|
||||
}
|
||||
|
||||
if (Object.keys(body as IDataObject).length === 0) {
|
||||
delete options.body;
|
||||
}
|
||||
|
||||
if (Object.keys(query).length === 0) {
|
||||
delete options.qs;
|
||||
}
|
||||
try {
|
||||
return await this.helpers.request(options);
|
||||
} catch (error) {
|
||||
throw new NodeApiError(this.getNode(), error as JsonObject);
|
||||
}
|
||||
}
|
||||
|
||||
export function simplify(data: IDataObject[]) {
|
||||
const results = [];
|
||||
for (const record of data) {
|
||||
const newRecord: IDataObject = { date: record.date };
|
||||
for (const factor of record.factors as IDataObject[]) {
|
||||
newRecord[factor.name as string] = factor.score;
|
||||
}
|
||||
results.push(newRecord);
|
||||
}
|
||||
return results;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"node": "n8n-nodes-base.securityScorecard",
|
||||
"nodeVersion": "1.0",
|
||||
"codexVersion": "1.0",
|
||||
"categories": ["Analytics"],
|
||||
"resources": {
|
||||
"credentialDocumentation": [
|
||||
{
|
||||
"url": "https://docs.n8n.io/integrations/builtin/credentials/securityscorecard/"
|
||||
}
|
||||
],
|
||||
"primaryDocumentation": [
|
||||
{
|
||||
"url": "https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.securityscorecard/"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,522 @@
|
||||
import moment from 'moment-timezone';
|
||||
import type {
|
||||
IExecuteFunctions,
|
||||
IDataObject,
|
||||
INodeExecutionData,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeConnectionTypes } from 'n8n-workflow';
|
||||
|
||||
import { companyFields, companyOperations } from './descriptions/CompanyDescription';
|
||||
import { industryFields, industryOperations } from './descriptions/IndustryDescription';
|
||||
import { inviteFields, inviteOperations } from './descriptions/InviteDescription';
|
||||
import {
|
||||
portfolioCompanyFields,
|
||||
portfolioCompanyOperations,
|
||||
} from './descriptions/PortfolioCompanyDescription';
|
||||
import { portfolioFields, portfolioOperations } from './descriptions/PortfolioDescription';
|
||||
import { reportFields, reportOperations } from './descriptions/ReportDescription';
|
||||
import { scorecardApiRequest, simplify } from './GenericFunctions';
|
||||
|
||||
export class SecurityScorecard implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
displayName: 'SecurityScorecard',
|
||||
name: 'securityScorecard',
|
||||
icon: 'file:securityScorecard.svg',
|
||||
group: ['transform'],
|
||||
subtitle: '={{$parameter["operation"]}} : {{$parameter["resource"]}}',
|
||||
version: 1,
|
||||
description: 'Consume SecurityScorecard API',
|
||||
defaults: {
|
||||
name: 'SecurityScorecard',
|
||||
},
|
||||
usableAsTool: true,
|
||||
inputs: [NodeConnectionTypes.Main],
|
||||
outputs: [NodeConnectionTypes.Main],
|
||||
credentials: [
|
||||
{
|
||||
name: 'securityScorecardApi',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
properties: [
|
||||
{
|
||||
displayName: 'Resource',
|
||||
name: 'resource',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
required: true,
|
||||
options: [
|
||||
{
|
||||
name: 'Company',
|
||||
value: 'company',
|
||||
},
|
||||
{
|
||||
name: 'Industry',
|
||||
value: 'industry',
|
||||
},
|
||||
{
|
||||
name: 'Invite',
|
||||
value: 'invite',
|
||||
},
|
||||
{
|
||||
name: 'Portfolio',
|
||||
value: 'portfolio',
|
||||
},
|
||||
{
|
||||
name: 'Portfolio Company',
|
||||
value: 'portfolioCompany',
|
||||
},
|
||||
{
|
||||
name: 'Report',
|
||||
value: 'report',
|
||||
},
|
||||
],
|
||||
default: 'company',
|
||||
},
|
||||
// Company
|
||||
...companyOperations,
|
||||
...companyFields,
|
||||
// Industry
|
||||
...industryOperations,
|
||||
...industryFields,
|
||||
// Invite
|
||||
...inviteOperations,
|
||||
...inviteFields,
|
||||
// Portfolio
|
||||
...portfolioOperations,
|
||||
...portfolioFields,
|
||||
// Portfolio Company
|
||||
...portfolioCompanyOperations,
|
||||
...portfolioCompanyFields,
|
||||
// Report
|
||||
...reportOperations,
|
||||
...reportFields,
|
||||
],
|
||||
};
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
let responseData;
|
||||
const length = items.length;
|
||||
|
||||
const resource = this.getNodeParameter('resource', 0);
|
||||
const operation = this.getNodeParameter('operation', 0);
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
if (resource === 'portfolio') {
|
||||
if (operation === 'create') {
|
||||
const name = this.getNodeParameter('name', i) as string;
|
||||
const description = this.getNodeParameter('description', i) as string;
|
||||
const privacy = this.getNodeParameter('privacy', i) as string;
|
||||
|
||||
const body: IDataObject = {
|
||||
name,
|
||||
description,
|
||||
privacy,
|
||||
};
|
||||
|
||||
responseData = await scorecardApiRequest.call(this, 'POST', 'portfolios', body);
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
|
||||
if (operation === 'delete') {
|
||||
const portfolioId = this.getNodeParameter('portfolioId', i) as string;
|
||||
responseData = await scorecardApiRequest.call(
|
||||
this,
|
||||
'DELETE',
|
||||
`portfolios/${portfolioId}`,
|
||||
);
|
||||
returnData.push({ success: true });
|
||||
}
|
||||
|
||||
if (operation === 'update') {
|
||||
const portfolioId = this.getNodeParameter('portfolioId', i) as string;
|
||||
const name = this.getNodeParameter('name', i) as string;
|
||||
const description = this.getNodeParameter('description', i) as string;
|
||||
const privacy = this.getNodeParameter('privacy', i) as string;
|
||||
|
||||
const body: IDataObject = {
|
||||
name,
|
||||
description,
|
||||
privacy,
|
||||
};
|
||||
|
||||
responseData = await scorecardApiRequest.call(
|
||||
this,
|
||||
'PUT',
|
||||
`portfolios/${portfolioId}`,
|
||||
body,
|
||||
);
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
|
||||
if (operation === 'getAll') {
|
||||
const returnAll = this.getNodeParameter('returnAll', 0);
|
||||
responseData = await scorecardApiRequest.call(this, 'GET', 'portfolios');
|
||||
responseData = responseData.entries;
|
||||
|
||||
if (!returnAll) {
|
||||
const limit = this.getNodeParameter('limit', 0);
|
||||
responseData = responseData.splice(0, limit);
|
||||
}
|
||||
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
}
|
||||
}
|
||||
|
||||
if (resource === 'portfolioCompany') {
|
||||
if (operation === 'add') {
|
||||
const portfolioId = this.getNodeParameter('portfolioId', i) as string;
|
||||
const domain = this.getNodeParameter('domain', i);
|
||||
responseData = await scorecardApiRequest.call(
|
||||
this,
|
||||
'PUT',
|
||||
`portfolios/${portfolioId}/companies/${domain}`,
|
||||
);
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
|
||||
if (operation === 'remove') {
|
||||
const portfolioId = this.getNodeParameter('portfolioId', i) as string;
|
||||
const domain = this.getNodeParameter('domain', i);
|
||||
responseData = await scorecardApiRequest.call(
|
||||
this,
|
||||
'DELETE',
|
||||
`portfolios/${portfolioId}/companies/${domain}`,
|
||||
);
|
||||
returnData.push({ success: true });
|
||||
}
|
||||
|
||||
if (operation === 'getAll') {
|
||||
const returnAll = this.getNodeParameter('returnAll', 0);
|
||||
const portfolioId = this.getNodeParameter('portfolioId', i) as string;
|
||||
const filterParams = this.getNodeParameter('filters', i);
|
||||
responseData = await scorecardApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`portfolios/${portfolioId}/companies`,
|
||||
{},
|
||||
filterParams,
|
||||
);
|
||||
|
||||
responseData = responseData.entries;
|
||||
|
||||
if (!returnAll) {
|
||||
const limit = this.getNodeParameter('limit', 0);
|
||||
responseData = responseData.splice(0, limit);
|
||||
}
|
||||
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
}
|
||||
}
|
||||
|
||||
if (resource === 'report') {
|
||||
if (operation === 'download') {
|
||||
const reportUrl = this.getNodeParameter('url', i) as string;
|
||||
|
||||
const response = await scorecardApiRequest.call(this, 'GET', '', {}, {}, reportUrl, {
|
||||
encoding: null,
|
||||
resolveWithFullResponse: true,
|
||||
});
|
||||
|
||||
let mimeType: string | undefined;
|
||||
if (response.headers['content-type']) {
|
||||
mimeType = response.headers['content-type'];
|
||||
}
|
||||
|
||||
const newItem: INodeExecutionData = {
|
||||
json: items[i].json,
|
||||
binary: {},
|
||||
};
|
||||
|
||||
if (items[i].binary !== undefined && newItem.binary) {
|
||||
// Create a shallow copy of the binary data so that the old
|
||||
// data references which do not get changed still stay behind
|
||||
// but the incoming data does not get changed.
|
||||
Object.assign(newItem.binary, items[i].binary);
|
||||
}
|
||||
|
||||
items[i] = newItem;
|
||||
|
||||
const dataPropertyNameDownload = this.getNodeParameter('binaryPropertyName', i);
|
||||
|
||||
const fileName = reportUrl.split('/').pop();
|
||||
|
||||
const data = Buffer.from(response.body as string, 'utf8');
|
||||
items[i].binary![dataPropertyNameDownload] = await this.helpers.prepareBinaryData(
|
||||
data as unknown as Buffer,
|
||||
fileName,
|
||||
mimeType,
|
||||
);
|
||||
}
|
||||
|
||||
if (operation === 'generate') {
|
||||
const reportType = this.getNodeParameter('report', i) as string;
|
||||
let body: IDataObject = {};
|
||||
|
||||
if (reportType !== 'portfolio') {
|
||||
body.scorecard_identifier = this.getNodeParameter('scorecardIdentifier', i);
|
||||
} else {
|
||||
body.portfolio_id = this.getNodeParameter('portfolioId', i);
|
||||
}
|
||||
if (reportType === 'events-json') {
|
||||
body.date = this.getNodeParameter('date', i);
|
||||
}
|
||||
if (['issues', 'portfolio'].indexOf(reportType) > -1) {
|
||||
body.format = this.getNodeParameter('options.format', i) || 'pdf';
|
||||
}
|
||||
if (['detailed', 'summary'].indexOf(reportType) > -1) {
|
||||
body.branding = this.getNodeParameter('branding', i);
|
||||
}
|
||||
// json reports want the params differently
|
||||
if (['events-json', 'full-scorecard-json'].indexOf(reportType) > -1) {
|
||||
body = { params: body };
|
||||
}
|
||||
if (reportType === 'scorecard-footprint') {
|
||||
const options = this.getNodeParameter('options', i);
|
||||
Object.assign(body, options);
|
||||
}
|
||||
|
||||
responseData = await scorecardApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
`reports/${reportType}`,
|
||||
body,
|
||||
);
|
||||
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
|
||||
if (operation === 'getAll') {
|
||||
const returnAll = this.getNodeParameter('returnAll', 0);
|
||||
responseData = await scorecardApiRequest.call(this, 'GET', 'reports/recent');
|
||||
responseData = responseData.entries;
|
||||
|
||||
if (!returnAll) {
|
||||
const limit = this.getNodeParameter('limit', i);
|
||||
responseData = responseData.splice(0, limit);
|
||||
}
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
}
|
||||
}
|
||||
|
||||
if (resource === 'invite') {
|
||||
if (operation === 'create') {
|
||||
const body: IDataObject = {
|
||||
email: this.getNodeParameter('email', i),
|
||||
first_name: this.getNodeParameter('firstName', i),
|
||||
last_name: this.getNodeParameter('lastName', i),
|
||||
message: this.getNodeParameter('message', i),
|
||||
};
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i);
|
||||
Object.assign(body, additionalFields);
|
||||
|
||||
responseData = await scorecardApiRequest.call(this, 'POST', 'invitations', body);
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
}
|
||||
|
||||
if (resource === 'industry') {
|
||||
if (operation === 'getScore') {
|
||||
const industry = this.getNodeParameter('industry', i);
|
||||
responseData = await scorecardApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`industries/${industry}/score`,
|
||||
);
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
|
||||
if (operation === 'getFactor') {
|
||||
const simple = this.getNodeParameter('simple', 0) as boolean;
|
||||
const returnAll = this.getNodeParameter('returnAll', 0);
|
||||
const industry = this.getNodeParameter('industry', i);
|
||||
responseData = await scorecardApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`industries/${industry}/history/factors`,
|
||||
);
|
||||
responseData = responseData.entries;
|
||||
|
||||
if (!returnAll) {
|
||||
const limit = this.getNodeParameter('limit', i);
|
||||
responseData = responseData.splice(0, limit);
|
||||
}
|
||||
|
||||
if (simple) {
|
||||
responseData = simplify(responseData as IDataObject[]);
|
||||
}
|
||||
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
}
|
||||
|
||||
if (operation === 'getFactorHistorical') {
|
||||
const simple = this.getNodeParameter('simple', 0) as boolean;
|
||||
const returnAll = this.getNodeParameter('returnAll', i);
|
||||
const industry = this.getNodeParameter('industry', i);
|
||||
const options = this.getNodeParameter('options', i);
|
||||
// Convert to YYYY-MM-DD
|
||||
if (options.from) {
|
||||
options.from = moment(options.from as Date).format('YYYY-MM-DD');
|
||||
}
|
||||
|
||||
if (options.to) {
|
||||
options.to = moment(options.to as Date).format('YYYY-MM-DD');
|
||||
}
|
||||
responseData = await scorecardApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`industries/${industry}/history/factors`,
|
||||
{},
|
||||
options,
|
||||
);
|
||||
responseData = responseData.entries;
|
||||
|
||||
if (!returnAll) {
|
||||
const limit = this.getNodeParameter('limit', i);
|
||||
responseData = responseData.splice(0, limit);
|
||||
}
|
||||
|
||||
if (simple) {
|
||||
responseData = simplify(responseData as IDataObject[]);
|
||||
}
|
||||
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
}
|
||||
}
|
||||
|
||||
if (resource === 'company') {
|
||||
if (operation === 'getScorecard') {
|
||||
const scorecardIdentifier = this.getNodeParameter('scorecardIdentifier', i) as string;
|
||||
responseData = await scorecardApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`companies/${scorecardIdentifier}`,
|
||||
);
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
|
||||
if (operation === 'getFactor') {
|
||||
const returnAll = this.getNodeParameter('returnAll', i);
|
||||
const scorecardIdentifier = this.getNodeParameter('scorecardIdentifier', i);
|
||||
const filterParams = this.getNodeParameter('filters', i);
|
||||
responseData = await scorecardApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`companies/${scorecardIdentifier}/factors`,
|
||||
{},
|
||||
filterParams,
|
||||
);
|
||||
|
||||
responseData = responseData.entries;
|
||||
|
||||
if (!returnAll) {
|
||||
const limit = this.getNodeParameter('limit', i);
|
||||
responseData = responseData.splice(0, limit);
|
||||
}
|
||||
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
}
|
||||
|
||||
if (operation === 'getFactorHistorical') {
|
||||
const simple = this.getNodeParameter('simple', 0) as boolean;
|
||||
const returnAll = this.getNodeParameter('returnAll', i);
|
||||
const scorecardIdentifier = this.getNodeParameter('scorecardIdentifier', i) as string;
|
||||
const options = this.getNodeParameter('options', i);
|
||||
// Convert to YYYY-MM-DD
|
||||
if (options.date_from) {
|
||||
options.date_from = moment(options.date_from as Date).format('YYYY-MM-DD');
|
||||
}
|
||||
|
||||
if (options.date_to) {
|
||||
options.date_to = moment(options.date_to as Date).format('YYYY-MM-DD');
|
||||
}
|
||||
responseData = await scorecardApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`companies/${scorecardIdentifier}/history/factors/score`,
|
||||
{},
|
||||
options,
|
||||
);
|
||||
|
||||
responseData = responseData.entries;
|
||||
|
||||
if (!returnAll) {
|
||||
const limit = this.getNodeParameter('limit', i);
|
||||
responseData = responseData.splice(0, limit);
|
||||
}
|
||||
|
||||
if (simple) {
|
||||
responseData = simplify(responseData as IDataObject[]);
|
||||
}
|
||||
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
}
|
||||
|
||||
if (operation === 'getHistoricalScore') {
|
||||
const simple = this.getNodeParameter('simple', 0) as boolean;
|
||||
const returnAll = this.getNodeParameter('returnAll', i);
|
||||
const scorecardIdentifier = this.getNodeParameter('scorecardIdentifier', i);
|
||||
const options = this.getNodeParameter('options', i);
|
||||
|
||||
// for some reason the params are different between these two APis :/
|
||||
if (options.date_from) {
|
||||
options.from = moment(options.date_from as Date).format('YYYY-MM-DD');
|
||||
delete options.date_from;
|
||||
}
|
||||
if (options.date_to) {
|
||||
options.to = moment(options.date_to as Date).format('YYYY-MM-DD');
|
||||
delete options.date_to;
|
||||
}
|
||||
responseData = await scorecardApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`companies/${scorecardIdentifier}/history/factors/score`,
|
||||
{},
|
||||
options,
|
||||
);
|
||||
responseData = responseData.entries;
|
||||
|
||||
if (!returnAll) {
|
||||
const limit = this.getNodeParameter('limit', i);
|
||||
responseData = responseData.splice(0, limit);
|
||||
}
|
||||
|
||||
if (simple) {
|
||||
responseData = simplify(responseData as IDataObject[]);
|
||||
}
|
||||
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
}
|
||||
|
||||
if (operation === 'getScorePlan') {
|
||||
const returnAll = this.getNodeParameter('returnAll', i);
|
||||
const scorecardIdentifier = this.getNodeParameter('scorecardIdentifier', i) as string;
|
||||
const targetScore = this.getNodeParameter('score', i);
|
||||
responseData = await scorecardApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`companies/${scorecardIdentifier}/score-plans/by-target/${targetScore}`,
|
||||
);
|
||||
|
||||
responseData = responseData.entries;
|
||||
|
||||
if (!returnAll) {
|
||||
const limit = this.getNodeParameter('limit', i);
|
||||
responseData = responseData.splice(0, limit);
|
||||
}
|
||||
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Handle file download output data differently
|
||||
if (resource === 'report' && operation === 'download') {
|
||||
return [items];
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,215 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const companyOperations: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['company'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Get Factor Scores',
|
||||
value: 'getFactor',
|
||||
description: 'Get company factor scores and issue counts',
|
||||
action: 'Get a company factor scores and issue counts',
|
||||
},
|
||||
{
|
||||
name: 'Get Historical Factor Scores',
|
||||
value: 'getFactorHistorical',
|
||||
description: "Get company's historical factor scores",
|
||||
action: "Get a company's historical factor scores",
|
||||
},
|
||||
{
|
||||
name: 'Get Historical Scores',
|
||||
value: 'getHistoricalScore',
|
||||
description: "Get company's historical scores",
|
||||
action: "Get a company's historical scores",
|
||||
},
|
||||
{
|
||||
name: 'Get Information and Scorecard',
|
||||
value: 'getScorecard',
|
||||
description: 'Get company information and summary of their scorecard',
|
||||
action: 'Get company information and a summary of their scorecard',
|
||||
},
|
||||
{
|
||||
name: 'Get Score Plan',
|
||||
value: 'getScorePlan',
|
||||
description: "Get company's score improvement plan",
|
||||
action: "Get a company's score improvement plan",
|
||||
},
|
||||
],
|
||||
default: 'getFactor',
|
||||
},
|
||||
];
|
||||
|
||||
export const companyFields: INodeProperties[] = [
|
||||
{
|
||||
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: 'Whether to return all results 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: 'Max number of results to return',
|
||||
},
|
||||
{
|
||||
displayName: 'Simplify',
|
||||
name: 'simple',
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['company'],
|
||||
operation: ['getFactorHistorical', 'getHistoricalScore'],
|
||||
},
|
||||
},
|
||||
default: true,
|
||||
description: 'Whether to return a simplified version of the response instead of the raw data',
|
||||
},
|
||||
|
||||
// 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: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Date To',
|
||||
description: 'History end date',
|
||||
name: 'date_to',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Timing',
|
||||
description: 'Date granularity',
|
||||
name: 'timing',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Daily',
|
||||
value: 'daily',
|
||||
},
|
||||
{
|
||||
name: 'Weekly',
|
||||
value: 'weekly',
|
||||
},
|
||||
{
|
||||
name: 'Monthly',
|
||||
value: 'monthly',
|
||||
},
|
||||
],
|
||||
default: 'daily',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,145 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const industryOperations: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['industry'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Get Factor Scores',
|
||||
value: 'getFactor',
|
||||
action: 'Get factor scores for an industry',
|
||||
},
|
||||
{
|
||||
name: 'Get Historical Factor Scores',
|
||||
value: 'getFactorHistorical',
|
||||
action: 'Get historical factor scores for an industry',
|
||||
},
|
||||
{
|
||||
name: 'Get Score',
|
||||
value: 'getScore',
|
||||
action: 'Get the score for an industry',
|
||||
},
|
||||
],
|
||||
default: 'getFactor',
|
||||
},
|
||||
];
|
||||
|
||||
export const industryFields: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Industry',
|
||||
name: 'industry',
|
||||
type: 'options',
|
||||
default: 'food',
|
||||
options: [
|
||||
{
|
||||
name: 'Food',
|
||||
value: 'food',
|
||||
},
|
||||
{
|
||||
name: 'Healthcare',
|
||||
value: 'healthcare',
|
||||
},
|
||||
{
|
||||
name: 'Manofacturing',
|
||||
value: 'manofacturing',
|
||||
},
|
||||
{
|
||||
name: 'Retail',
|
||||
value: 'retail',
|
||||
},
|
||||
{
|
||||
name: 'Technology',
|
||||
value: 'technology',
|
||||
},
|
||||
],
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['industry'],
|
||||
operation: ['getScore', 'getFactor', 'getFactorHistorical'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['industry'],
|
||||
operation: ['getFactor', 'getFactorHistorical'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
description: 'Whether to return all results or only up to a given limit',
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['industry'],
|
||||
operation: ['getFactor', 'getFactorHistorical'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
maxValue: 100,
|
||||
},
|
||||
default: 100,
|
||||
description: 'Max number of results to return',
|
||||
},
|
||||
{
|
||||
displayName: 'Simplify',
|
||||
name: 'simple',
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['industry'],
|
||||
operation: ['getFactor', 'getFactorHistorical'],
|
||||
},
|
||||
},
|
||||
default: true,
|
||||
description: 'Whether to return a simplified version of the response instead of the raw data',
|
||||
},
|
||||
{
|
||||
displayName: 'Options',
|
||||
name: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['industry'],
|
||||
operation: ['getFactorHistorical'],
|
||||
},
|
||||
},
|
||||
type: 'collection',
|
||||
placeholder: 'Add option',
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Date From',
|
||||
description: 'History start date',
|
||||
name: 'from',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Date To',
|
||||
description: 'History end date',
|
||||
name: 'to',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,158 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const inviteOperations: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['invite'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create an invite for a company/user',
|
||||
action: 'Create an invite',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
},
|
||||
];
|
||||
|
||||
export const inviteFields: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Email',
|
||||
name: 'email',
|
||||
type: 'string',
|
||||
placeholder: 'name@email.com',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['invite'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'First Name',
|
||||
name: 'firstName',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['invite'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Last Name',
|
||||
name: 'lastName',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['invite'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Message',
|
||||
name: 'message',
|
||||
description: 'Message for the invitee',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['invite'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['invite'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Days to Resolve Issue',
|
||||
description: 'Minimum days to resolve a scorecard issue',
|
||||
name: 'days_to_resolve_issue',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
},
|
||||
{
|
||||
displayName: 'Domain',
|
||||
description: 'Invitee company domain',
|
||||
name: 'domain',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Grade to Maintain',
|
||||
description: "Request the invitee's organisation to maintain a minimum grade",
|
||||
name: 'grade_to_maintain',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Is Organisation Point of Contact',
|
||||
// eslint-disable-next-line n8n-nodes-base/node-param-description-boolean-without-whether
|
||||
description: "Is the invitee organisation's point of contact",
|
||||
name: 'is_organization_point_of_contact',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
},
|
||||
{
|
||||
displayName: 'Issue Description',
|
||||
name: 'issue_desc',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Issue Title',
|
||||
name: 'issue_title',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Issue Type',
|
||||
name: 'issue_type',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Send Me a Copy',
|
||||
name: 'sendme_copy',
|
||||
description: 'Whether to send a copy of the invite to the requesting user',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
},
|
||||
{
|
||||
displayName: 'Target URL',
|
||||
name: 'target_url',
|
||||
type: 'string',
|
||||
description: 'Optional URL to take the invitee to when arriving to the platform',
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
+161
@@ -0,0 +1,161 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const portfolioCompanyOperations: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['portfolioCompany'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Add',
|
||||
value: 'add',
|
||||
description: 'Add a company to portfolio',
|
||||
action: 'Add a portfolio company',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
description: 'Get many companies in a portfolio',
|
||||
action: 'Get many portfolio companies',
|
||||
},
|
||||
{
|
||||
name: 'Remove',
|
||||
value: 'remove',
|
||||
description: 'Remove a company from portfolio',
|
||||
action: 'Remove a portfolio company',
|
||||
},
|
||||
],
|
||||
default: 'add',
|
||||
},
|
||||
];
|
||||
|
||||
export const portfolioCompanyFields: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Portfolio ID',
|
||||
name: 'portfolioId',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['portfolioCompany'],
|
||||
operation: ['getAll', 'add', 'remove'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['portfolioCompany'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
description: 'Whether to return all results or only up to a given limit',
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['portfolioCompany'],
|
||||
operation: ['getAll'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
maxValue: 100,
|
||||
},
|
||||
default: 100,
|
||||
description: 'Max number of results to return',
|
||||
},
|
||||
{
|
||||
displayName: 'Filters',
|
||||
name: 'filters',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['portfolioCompany'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
type: 'collection',
|
||||
placeholder: 'Add Filter',
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Grade',
|
||||
name: 'grade',
|
||||
type: 'string',
|
||||
placeholder: '',
|
||||
default: '',
|
||||
description: 'Company score grade filter',
|
||||
},
|
||||
{
|
||||
displayName: 'Industry',
|
||||
name: 'industry',
|
||||
type: 'string',
|
||||
placeholder: '',
|
||||
default: '',
|
||||
description: 'Industry filter',
|
||||
},
|
||||
{
|
||||
displayName: 'Issue Type',
|
||||
name: 'issueType',
|
||||
type: 'string',
|
||||
placeholder: '',
|
||||
description: 'Issue type filter',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Status',
|
||||
name: 'status',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Active',
|
||||
value: 'active',
|
||||
},
|
||||
{
|
||||
name: 'Inactive',
|
||||
value: 'inactive',
|
||||
},
|
||||
],
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Vulnerability',
|
||||
name: 'vulnerability',
|
||||
type: 'string',
|
||||
placeholder: '',
|
||||
description: 'CVE vulnerability filter',
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'Domain',
|
||||
name: 'domain',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['portfolioCompany'],
|
||||
operation: ['add', 'remove'],
|
||||
},
|
||||
},
|
||||
description: "Company's domain name",
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,145 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const portfolioOperations: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['portfolio'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create a portfolio',
|
||||
action: 'Create a portfolio',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Delete a portfolio',
|
||||
action: 'Delete a portfolio',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
description: 'Get many portfolios',
|
||||
action: 'Get many portfolios',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
description: 'Update a portfolio',
|
||||
action: 'Update a portfolio',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
},
|
||||
];
|
||||
|
||||
export const portfolioFields: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['portfolio'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
description: 'Whether to return all results or only up to a given limit',
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['portfolio'],
|
||||
operation: ['getAll'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
maxValue: 100,
|
||||
},
|
||||
default: 100,
|
||||
description: 'Max number of results to return',
|
||||
},
|
||||
{
|
||||
displayName: 'Portfolio ID',
|
||||
name: 'portfolioId',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['portfolio'],
|
||||
operation: ['update', 'delete'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Portfolio Name',
|
||||
name: 'name',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['portfolio'],
|
||||
operation: ['create', 'update'],
|
||||
},
|
||||
},
|
||||
description: 'Name of the portfolio',
|
||||
},
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'description',
|
||||
type: 'string',
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['portfolio'],
|
||||
operation: ['create', 'update'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Privacy',
|
||||
name: 'privacy',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['portfolio'],
|
||||
operation: ['create', 'update'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Private',
|
||||
value: 'private',
|
||||
description: 'Only visible to you',
|
||||
},
|
||||
{
|
||||
name: 'Shared',
|
||||
value: 'shared',
|
||||
description: 'Visible to everyone in your company',
|
||||
},
|
||||
{
|
||||
name: 'Team',
|
||||
value: 'team',
|
||||
description: 'Visible to the people on your team',
|
||||
},
|
||||
],
|
||||
default: 'shared',
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,315 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const reportOperations: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['report'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Download',
|
||||
value: 'download',
|
||||
description: 'Download a generated report',
|
||||
action: 'Download a report',
|
||||
},
|
||||
{
|
||||
name: 'Generate',
|
||||
value: 'generate',
|
||||
description: 'Generate a report',
|
||||
action: 'Generate a report',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
description: 'Get list of recently generated report',
|
||||
action: 'Get many reports',
|
||||
},
|
||||
],
|
||||
default: 'getAll',
|
||||
},
|
||||
];
|
||||
|
||||
export const reportFields: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['report'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
description: 'Whether to return all results or only up to a given limit',
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['report'],
|
||||
operation: ['getAll'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
maxValue: 100,
|
||||
},
|
||||
default: 100,
|
||||
description: 'Max number of results to return',
|
||||
},
|
||||
{
|
||||
displayName: 'Report',
|
||||
name: 'report',
|
||||
type: 'options',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['report'],
|
||||
operation: ['generate'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Company Detailed',
|
||||
value: 'detailed',
|
||||
},
|
||||
{
|
||||
name: 'Company Events',
|
||||
value: 'events-json',
|
||||
},
|
||||
{
|
||||
name: 'Company Issues',
|
||||
value: 'issues',
|
||||
},
|
||||
{
|
||||
name: 'Company Partnership',
|
||||
value: 'partnership',
|
||||
},
|
||||
{
|
||||
name: 'Company Summary',
|
||||
value: 'summary',
|
||||
},
|
||||
{
|
||||
name: 'Full Scorecard',
|
||||
value: 'full-scorecard-json',
|
||||
},
|
||||
{
|
||||
name: 'Portfolio',
|
||||
value: 'portfolio',
|
||||
},
|
||||
{
|
||||
name: 'Scorecard Footprint',
|
||||
value: 'scorecard-footprint',
|
||||
},
|
||||
],
|
||||
default: 'detailed',
|
||||
},
|
||||
{
|
||||
displayName: 'Scorecard Identifier',
|
||||
name: 'scorecardIdentifier',
|
||||
description: 'Primary identifier of a company or scorecard, i.e. domain.',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['report'],
|
||||
operation: ['generate'],
|
||||
report: [
|
||||
'detailed',
|
||||
'events-json',
|
||||
'full-scorecard-json',
|
||||
'issues',
|
||||
'partnership',
|
||||
'scorecard-footprint',
|
||||
'summary',
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Portfolio ID',
|
||||
name: 'portfolioId',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['report'],
|
||||
operation: ['generate'],
|
||||
report: ['portfolio'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Branding',
|
||||
name: 'branding',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['report'],
|
||||
operation: ['generate'],
|
||||
report: ['detailed', 'summary'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'SecurityScorecard',
|
||||
value: 'securityscorecard',
|
||||
},
|
||||
{
|
||||
name: 'Company and SecurityScorecard',
|
||||
value: 'company_and_securityscorecard',
|
||||
},
|
||||
{
|
||||
name: 'Company',
|
||||
value: 'company',
|
||||
},
|
||||
],
|
||||
default: 'securityscorecard',
|
||||
},
|
||||
{
|
||||
displayName: 'Date',
|
||||
name: 'date',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['report'],
|
||||
operation: ['generate'],
|
||||
report: ['events-json'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Options',
|
||||
name: 'options',
|
||||
type: 'collection',
|
||||
default: {},
|
||||
placeholder: 'Add Field',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['report'],
|
||||
operation: ['generate'],
|
||||
report: ['issues', 'portfolio'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Format',
|
||||
name: 'format',
|
||||
type: 'options',
|
||||
default: 'pdf',
|
||||
options: [
|
||||
{
|
||||
name: 'CSV',
|
||||
value: 'csv',
|
||||
},
|
||||
{
|
||||
name: 'PDF',
|
||||
value: 'pdf',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'Options',
|
||||
name: 'options',
|
||||
type: 'collection',
|
||||
default: {},
|
||||
placeholder: 'Add Field',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['report'],
|
||||
operation: ['generate'],
|
||||
report: ['scorecard-footprint'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Countries',
|
||||
name: 'countries',
|
||||
type: 'string',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
},
|
||||
default: [],
|
||||
},
|
||||
{
|
||||
displayName: 'Format',
|
||||
name: 'format',
|
||||
type: 'options',
|
||||
default: 'pdf',
|
||||
options: [
|
||||
{
|
||||
name: 'CSV',
|
||||
value: 'csv',
|
||||
},
|
||||
{
|
||||
name: 'PDF',
|
||||
value: 'pdf',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'IPs',
|
||||
name: 'ips',
|
||||
type: 'string',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
},
|
||||
default: [],
|
||||
},
|
||||
{
|
||||
displayName: 'Subdomains',
|
||||
name: 'subdomains',
|
||||
type: 'string',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
},
|
||||
default: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'Report URL',
|
||||
name: 'url',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
description: 'URL to a generated report',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['report'],
|
||||
operation: ['download'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Put Output File in Field',
|
||||
name: 'binaryPropertyName',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: 'data',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['report'],
|
||||
operation: ['download'],
|
||||
},
|
||||
},
|
||||
hint: 'The name of the output binary field to put the file in',
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="195" height="195"><path fill="none" d="M-1-1h197v197H-1z"/><g fill="none" class="mark"><path fill="#4e878c" stroke="#619E73" d="M140.6 126.918v36l31.3-18.1-.1-36.1-31.2-18zm-74.8 43.1 31.2 18 31.2-18v-35.9zm106-75.7v-35.9l-31.2-18-31.1 17.9zm-106-10.7v36l31.2 18 31.2-17.9v-36.1l-31.2-18zm-43.7 25.2v36l31.2 18 31.2-18zm31.2-68.4-31.2 18v36l31.2 18zm43.7 10.8 31.2-18-31.2-18-31.2 18v36z" class="st0"/></g></svg>
|
||||
|
After Width: | Height: | Size: 459 B |
Reference in New Issue
Block a user