Add async third-party vetting
Queue vetting on third_parties with PENDING, PROCESSING, COMPLETED, and FAILED states. Expose enqueue and status through GraphQL, MCP, CLI, and n8n, validate vet requests, tune the worker via config, and poll the detail page while vetting runs. Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -43,6 +43,7 @@ import * as linkThirdPartyOp from './linkThirdParty.operation';
|
||||
import * as unlinkThirdPartyOp from './unlinkThirdParty.operation';
|
||||
import * as listChildThirdPartiesOp from './listChildThirdParties.operation';
|
||||
import * as publishOp from './publish.operation';
|
||||
import * as vetOp from './vet.operation';
|
||||
|
||||
export const description: INodeProperties[] = [
|
||||
{
|
||||
@@ -236,6 +237,12 @@ export const description: INodeProperties[] = [
|
||||
description: 'Update an existing third party service',
|
||||
action: 'Update a third party service',
|
||||
},
|
||||
{
|
||||
name: 'Vet',
|
||||
value: 'vet',
|
||||
description: 'Start AI-powered vetting of a third party from its website',
|
||||
action: 'Vet a third party',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
},
|
||||
@@ -269,6 +276,7 @@ export const description: INodeProperties[] = [
|
||||
...unlinkThirdPartyOp.description,
|
||||
...listChildThirdPartiesOp.description,
|
||||
...publishOp.description,
|
||||
...vetOp.description,
|
||||
];
|
||||
|
||||
export {
|
||||
@@ -302,4 +310,5 @@ export {
|
||||
unlinkThirdPartyOp as unlinkThirdParty,
|
||||
listChildThirdPartiesOp as listChildThirdParties,
|
||||
publishOp as publish,
|
||||
vetOp as vet,
|
||||
};
|
||||
|
||||
102
packages/n8n-node/nodes/Probo/actions/thirdParty/vet.operation.ts
vendored
Normal file
102
packages/n8n-node/nodes/Probo/actions/thirdParty/vet.operation.ts
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
// Copyright (c) 2026 Probo Inc <hello@getprobo.com>.
|
||||
//
|
||||
// Permission to use, copy, modify, and/or distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
// PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
import type { INodeProperties, IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
|
||||
import { proboApiRequest } from '../../GenericFunctions';
|
||||
|
||||
export const description: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'ThirdParty ID',
|
||||
name: 'thirdPartyId',
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['thirdParty'],
|
||||
operation: ['vet'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'The ID of the third party to vet',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Website URL',
|
||||
name: 'websiteUrl',
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['thirdParty'],
|
||||
operation: ['vet'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'The website URL to crawl for vetting',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Procedure',
|
||||
name: 'procedure',
|
||||
type: 'string',
|
||||
typeOptions: {
|
||||
rows: 4,
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['thirdParty'],
|
||||
operation: ['vet'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'Optional custom vetting procedure instructions',
|
||||
},
|
||||
];
|
||||
|
||||
export async function execute(
|
||||
this: IExecuteFunctions,
|
||||
itemIndex: number,
|
||||
): Promise<INodeExecutionData> {
|
||||
const thirdPartyId = this.getNodeParameter('thirdPartyId', itemIndex) as string;
|
||||
const websiteUrl = this.getNodeParameter('websiteUrl', itemIndex) as string;
|
||||
const procedure = this.getNodeParameter('procedure', itemIndex, '') as string;
|
||||
|
||||
const query = `
|
||||
mutation VetThirdParty($input: VetThirdPartyInput!) {
|
||||
vetThirdParty(input: $input) {
|
||||
thirdParty {
|
||||
id
|
||||
name
|
||||
websiteUrl
|
||||
vettingStatus
|
||||
updatedAt
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const input: Record<string, unknown> = {
|
||||
id: thirdPartyId,
|
||||
websiteUrl,
|
||||
};
|
||||
|
||||
if (procedure) {
|
||||
input.procedure = procedure;
|
||||
}
|
||||
|
||||
const responseData = await proboApiRequest.call(this, query, { input });
|
||||
|
||||
return {
|
||||
json: responseData,
|
||||
pairedItem: { item: itemIndex },
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user