Add vendor publish to document system
Replace the old snapshot-based system for vendors with the publish document system, mirroring the prior processing activity / DPIA / TIA migration. Includes the GraphQL mutation, MCP tool, CLI command, n8n operation, frontend publish dialog, e2e tests, and a prosemirror register template covering vendor profile fields plus per-vendor sections for services, contacts, risk assessments, compliance reports, BAA and DPA agreements. The vendor register lives as a generated DocumentTypeRegister document on the organization, reused across publishes (the major version bumps on every republish). Approvers can be passed in to create a draft pending approval; otherwise the version is published immediately. The frontend Vendors page exposes a Publish button and a Document link button when the document exists, and pre-fills the previous default approvers. Remove snapshot mode entirely from vendors and their sub-entities: drop snapshotId/sourceId from GraphQL Vendor type and VendorFilter; remove SnapshotsTypeVendors from the snapshot registry and delete Vendors.Snapshot, VendorSnapshotter interface and all *.InsertVendorSnapshots methods on contacts, services, risk assessments, compliance reports, BAA and DPA. Drop the snapshot routes and banner from the frontend. The snapshot_id columns remain in the database but are now filtered out with snapshot_id IS NULL. Add Get/Upsert/Clear GeneratedDocumentID methods on Vendor backed by a new vendors_document_id column on generated_documents, matching the ProcessingActivity/Finding/Obligation pattern. Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -39,6 +39,7 @@ import * as updateBusinessAssociateAgreementOp from './updateBusinessAssociateAg
|
||||
import * as getDataPrivacyAgreementOp from './getDataPrivacyAgreement.operation';
|
||||
import * as deleteDataPrivacyAgreementOp from './deleteDataPrivacyAgreement.operation';
|
||||
import * as updateDataPrivacyAgreementOp from './updateDataPrivacyAgreement.operation';
|
||||
import * as publishOp from './publish.operation';
|
||||
|
||||
export const description: INodeProperties[] = [
|
||||
{
|
||||
@@ -178,6 +179,12 @@ export const description: INodeProperties[] = [
|
||||
description: 'Get a vendor service',
|
||||
action: 'Get a vendor service',
|
||||
},
|
||||
{
|
||||
name: 'Publish List',
|
||||
value: 'publish',
|
||||
description: 'Publish the vendor register as a document version',
|
||||
action: 'Publish the vendor register',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
@@ -237,6 +244,7 @@ export const description: INodeProperties[] = [
|
||||
...getDataPrivacyAgreementOp.description,
|
||||
...deleteDataPrivacyAgreementOp.description,
|
||||
...updateDataPrivacyAgreementOp.description,
|
||||
...publishOp.description,
|
||||
];
|
||||
|
||||
export {
|
||||
@@ -266,4 +274,5 @@ export {
|
||||
getDataPrivacyAgreementOp as getDataPrivacyAgreement,
|
||||
deleteDataPrivacyAgreementOp as deleteDataPrivacyAgreement,
|
||||
updateDataPrivacyAgreementOp as updateDataPrivacyAgreement,
|
||||
publishOp as publish,
|
||||
};
|
||||
|
||||
101
packages/n8n-node/nodes/Probo/actions/vendor/publish.operation.ts
vendored
Normal file
101
packages/n8n-node/nodes/Probo/actions/vendor/publish.operation.ts
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
// 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: 'Organization ID',
|
||||
name: 'organizationId',
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['vendor'],
|
||||
operation: ['publish'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'The ID of the organization whose vendor list to publish',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Approver IDs',
|
||||
name: 'approverIds',
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['vendor'],
|
||||
operation: ['publish'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'Comma-separated list of approver profile IDs',
|
||||
},
|
||||
];
|
||||
|
||||
export async function execute(
|
||||
this: IExecuteFunctions,
|
||||
itemIndex: number,
|
||||
): Promise<INodeExecutionData> {
|
||||
const organizationId = this.getNodeParameter('organizationId', itemIndex) as string;
|
||||
const approverIds = this.getNodeParameter('approverIds', itemIndex, '') as string;
|
||||
|
||||
const query = `
|
||||
mutation PublishVendorList($input: PublishVendorListInput!) {
|
||||
publishVendorList(input: $input) {
|
||||
documentEdge {
|
||||
node {
|
||||
id
|
||||
status
|
||||
currentPublishedMajor
|
||||
currentPublishedMinor
|
||||
createdAt
|
||||
updatedAt
|
||||
}
|
||||
}
|
||||
documentVersionEdge {
|
||||
node {
|
||||
id
|
||||
title
|
||||
major
|
||||
minor
|
||||
status
|
||||
classification
|
||||
documentType
|
||||
publishedAt
|
||||
createdAt
|
||||
updatedAt
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const input: Record<string, unknown> = { organizationId };
|
||||
|
||||
if (approverIds) {
|
||||
input.approverIds = approverIds
|
||||
.split(',')
|
||||
.map(id => id.trim())
|
||||
.filter(Boolean);
|
||||
}
|
||||
|
||||
const responseData = await proboApiRequest.call(this, query, { input });
|
||||
|
||||
return {
|
||||
json: responseData,
|
||||
pairedItem: { item: itemIndex },
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user