From 2955820ac6f88a5b6ab16ace4fa2592e5b639268 Mon Sep 17 00:00:00 2001 From: Sacha Al Himdani Date: Fri, 3 Jul 2026 14:00:48 +0200 Subject: [PATCH] Drop n8n createDraftVersion, add body to update Remove the createDraftVersion document operation from the n8n node and instead expose the document body on the update operation. Updating the body edits the current draft version, or creates one from the latest published version when none exists, so a dedicated draft-creation operation is redundant. Also correct the content field help text across the document operations: the API expects a ProseMirror document JSON string, not markdown. Signed-off-by: Sacha Al Himdani --- .../actions/document/create.operation.ts | 2 +- .../document/createDraftVersion.operation.ts | 70 ------------------- .../nodes/Probo/actions/document/index.ts | 9 --- .../actions/document/update.operation.ts | 26 +++++++ .../document/updateVersion.operation.ts | 2 +- 5 files changed, 28 insertions(+), 81 deletions(-) delete mode 100644 packages/n8n-node/nodes/Probo/actions/document/createDraftVersion.operation.ts diff --git a/packages/n8n-node/nodes/Probo/actions/document/create.operation.ts b/packages/n8n-node/nodes/Probo/actions/document/create.operation.ts index ca35d3420..12a8510a2 100644 --- a/packages/n8n-node/nodes/Probo/actions/document/create.operation.ts +++ b/packages/n8n-node/nodes/Probo/actions/document/create.operation.ts @@ -103,7 +103,7 @@ export const description: INodeProperties[] = [ }, }, default: '', - description: 'The content of the document in markdown format', + description: 'The content of the document as a ProseMirror document JSON string', }, { displayName: 'Additional Fields', diff --git a/packages/n8n-node/nodes/Probo/actions/document/createDraftVersion.operation.ts b/packages/n8n-node/nodes/Probo/actions/document/createDraftVersion.operation.ts deleted file mode 100644 index 509fa85c0..000000000 --- a/packages/n8n-node/nodes/Probo/actions/document/createDraftVersion.operation.ts +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) 2025-2026 Probo Inc . -// -// 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: 'Document ID', - name: 'documentId', - type: 'string', - displayOptions: { - show: { - resource: ['document'], - operation: ['createDraftVersion'], - }, - }, - default: '', - description: 'The ID of the document', - required: true, - }, -]; - -export async function execute( - this: IExecuteFunctions, - itemIndex: number, -): Promise { - const documentId = this.getNodeParameter('documentId', itemIndex) as string; - - const query = ` - mutation CreateDraftDocumentVersion($input: CreateDraftDocumentVersionInput!) { - createDraftDocumentVersion(input: $input) { - documentVersionEdge { - node { - id - title - major - minor - status - content - changelog - classification - documentType - publishedAt - createdAt - updatedAt - } - } - } - } - `; - - const responseData = await proboApiRequest.call(this, query, { input: { documentID: documentId } }); - - return { - json: responseData, - pairedItem: { item: itemIndex }, - }; -} diff --git a/packages/n8n-node/nodes/Probo/actions/document/index.ts b/packages/n8n-node/nodes/Probo/actions/document/index.ts index eecf69ad0..f1bbb78ad 100644 --- a/packages/n8n-node/nodes/Probo/actions/document/index.ts +++ b/packages/n8n-node/nodes/Probo/actions/document/index.ts @@ -23,7 +23,6 @@ import * as unarchiveOp from './unarchive.operation'; import * as getVersionOp from './getVersion.operation'; import * as getLatestPublishedVersionIdOp from './getLatestPublishedVersionId.operation'; import * as getAllVersionsOp from './getAllVersions.operation'; -import * as createDraftVersionOp from './createDraftVersion.operation'; import * as updateVersionOp from './updateVersion.operation'; import * as deleteDraftVersionOp from './deleteDraftVersion.operation'; import * as publishOp from './publish.operation'; @@ -67,12 +66,6 @@ export const description: INodeProperties[] = [ description: 'Create a new document', action: 'Create a document', }, - { - name: 'Create Draft Version', - value: 'createDraftVersion', - description: 'Create a new draft version from the latest published version', - action: 'Create a draft document version', - }, { name: 'Delete', value: 'delete', @@ -200,7 +193,6 @@ export const description: INodeProperties[] = [ ...getVersionOp.description, ...getLatestPublishedVersionIdOp.description, ...getAllVersionsOp.description, - ...createDraftVersionOp.description, ...updateVersionOp.description, ...deleteDraftVersionOp.description, ...publishOp.description, @@ -226,7 +218,6 @@ export { getVersionOp as getVersion, getLatestPublishedVersionIdOp as getLatestPublishedVersionId, getAllVersionsOp as getAllVersions, - createDraftVersionOp as createDraftVersion, updateVersionOp as updateVersion, deleteDraftVersionOp as deleteDraftVersion, publishOp as publish, diff --git a/packages/n8n-node/nodes/Probo/actions/document/update.operation.ts b/packages/n8n-node/nodes/Probo/actions/document/update.operation.ts index cb82c73ea..c0f05b1ef 100644 --- a/packages/n8n-node/nodes/Probo/actions/document/update.operation.ts +++ b/packages/n8n-node/nodes/Probo/actions/document/update.operation.ts @@ -43,6 +43,16 @@ export const description: INodeProperties[] = [ }, }, options: [ + { + displayName: 'Content', + name: 'content', + type: 'string', + typeOptions: { + rows: 6, + }, + default: '', + description: 'The body of the document as a ProseMirror document JSON string. Updating it edits the current draft version, creating one from the latest published version if none exists.', + }, { displayName: 'Trust Center Visibility', name: 'trustCenterVisibility', @@ -72,6 +82,7 @@ export async function execute( ): Promise { const documentId = this.getNodeParameter('documentId', itemIndex) as string; const updateFields = this.getNodeParameter('updateFields', itemIndex, {}) as { + content?: string; trustCenterVisibility?: string; defaultApproverIds?: string; }; @@ -89,11 +100,26 @@ export async function execute( createdAt updatedAt } + documentVersion { + id + title + major + minor + status + content + changelog + classification + documentType + publishedAt + createdAt + updatedAt + } } } `; const input: Record = { id: documentId }; + if (updateFields.content !== undefined) input.content = updateFields.content; if (updateFields.trustCenterVisibility !== undefined) input.trustCenterVisibility = updateFields.trustCenterVisibility; if (updateFields.defaultApproverIds !== undefined && updateFields.defaultApproverIds !== '') { input.defaultApproverIds = updateFields.defaultApproverIds.split(',').map(id => id.trim()).filter(Boolean); diff --git a/packages/n8n-node/nodes/Probo/actions/document/updateVersion.operation.ts b/packages/n8n-node/nodes/Probo/actions/document/updateVersion.operation.ts index 46ce954cc..b52325a0c 100644 --- a/packages/n8n-node/nodes/Probo/actions/document/updateVersion.operation.ts +++ b/packages/n8n-node/nodes/Probo/actions/document/updateVersion.operation.ts @@ -58,7 +58,7 @@ export const description: INodeProperties[] = [ rows: 6, }, default: '', - description: 'The content of the document in markdown format', + description: 'The content of the document as a ProseMirror document JSON string', }, { displayName: 'Classification',