Allow publishing generated documents as minor versions
Generated documents (asset list, risk register, SoA, ...) previously
only ever produced a new major version. Every regeneration of an
auto-built register consumed a major number, even when the change was
trivial. They now accept a minor flag and publish as
currentMajor.currentMinor+1 when set, bypassing the approval flow.
To carry the flag through cleanly, the document publish API was
refactored. The three split mutations (publishMajor, publishMinor,
requestDocumentVersionApproval) and the two bulk variants collapse
into a single publishDocument / bulkPublishDocuments, both taking the
new minor: Boolean! and a now-required changelog: String!. The same
shape flows through the CLI ("prb document publish --minor"), the MCP
tool, the n8n operations, and the Relay dialogs, where each
generated-doc dialog gains a "Publish as minor" button. Publishing
minor without an existing major is rejected with
ErrCannotPublishMinorWithoutMajor.
This is a deliberate breaking change for callers of the prior
mutations.
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -25,9 +25,7 @@ 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 publishMajorVersionOp from './publishMajorVersion.operation';
|
||||
import * as publishMinorVersionOp from './publishMinorVersion.operation';
|
||||
import * as requestApprovalOp from './requestApproval.operation';
|
||||
import * as publishOp from './publish.operation';
|
||||
import * as voidApprovalOp from './voidApproval.operation';
|
||||
import * as getSignatureOp from './getSignature.operation';
|
||||
import * as getAllSignaturesOp from './getAllSignatures.operation';
|
||||
@@ -148,22 +146,10 @@ export const description: INodeProperties[] = [
|
||||
action: 'Get a document version',
|
||||
},
|
||||
{
|
||||
name: 'Publish Major Version',
|
||||
value: 'publishMajorVersion',
|
||||
description: 'Publish a draft as a new major version',
|
||||
action: 'Publish a major document version',
|
||||
},
|
||||
{
|
||||
name: 'Publish Minor Version',
|
||||
value: 'publishMinorVersion',
|
||||
description: 'Publish a draft as a minor version',
|
||||
action: 'Publish a minor document version',
|
||||
},
|
||||
{
|
||||
name: 'Request Approval',
|
||||
value: 'requestApproval',
|
||||
description: 'Request approval for a document version',
|
||||
action: 'Request document version approval',
|
||||
name: 'Publish',
|
||||
value: 'publish',
|
||||
description: 'Publish a draft document, request approval, or publish as minor',
|
||||
action: 'Publish a document',
|
||||
},
|
||||
{
|
||||
name: 'Request Signature',
|
||||
@@ -216,9 +202,7 @@ export const description: INodeProperties[] = [
|
||||
...createDraftVersionOp.description,
|
||||
...updateVersionOp.description,
|
||||
...deleteDraftVersionOp.description,
|
||||
...publishMajorVersionOp.description,
|
||||
...publishMinorVersionOp.description,
|
||||
...requestApprovalOp.description,
|
||||
...publishOp.description,
|
||||
...voidApprovalOp.description,
|
||||
...getSignatureOp.description,
|
||||
...getAllSignaturesOp.description,
|
||||
@@ -244,9 +228,7 @@ export {
|
||||
createDraftVersionOp as createDraftVersion,
|
||||
updateVersionOp as updateVersion,
|
||||
deleteDraftVersionOp as deleteDraftVersion,
|
||||
publishMajorVersionOp as publishMajorVersion,
|
||||
publishMinorVersionOp as publishMinorVersion,
|
||||
requestApprovalOp as requestApproval,
|
||||
publishOp as publish,
|
||||
voidApprovalOp as voidApproval,
|
||||
getSignatureOp as getSignature,
|
||||
getAllSignaturesOp as getAllSignatures,
|
||||
|
||||
@@ -23,13 +23,40 @@ export const description: INodeProperties[] = [
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['document'],
|
||||
operation: ['publishMajorVersion'],
|
||||
operation: ['publish'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'The ID of the document',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Minor',
|
||||
name: 'minor',
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['document'],
|
||||
operation: ['publish'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
description: 'Whether to publish as a minor version. Approvers are ignored when set. The document must already have a published major version.',
|
||||
},
|
||||
{
|
||||
displayName: 'Approver IDs',
|
||||
name: 'approverIds',
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['document'],
|
||||
operation: ['publish'],
|
||||
minor: [false],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'Comma-separated list of approver profile IDs. When provided, an approval is requested instead of publishing immediately.',
|
||||
},
|
||||
{
|
||||
displayName: 'Changelog',
|
||||
name: 'changelog',
|
||||
@@ -40,11 +67,12 @@ export const description: INodeProperties[] = [
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['document'],
|
||||
operation: ['publishMajorVersion'],
|
||||
operation: ['publish'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'The changelog for this version',
|
||||
required: true,
|
||||
},
|
||||
];
|
||||
|
||||
@@ -53,11 +81,13 @@ export async function execute(
|
||||
itemIndex: number,
|
||||
): Promise<INodeExecutionData> {
|
||||
const documentId = this.getNodeParameter('documentId', itemIndex) as string;
|
||||
const changelog = this.getNodeParameter('changelog', itemIndex, '') as string;
|
||||
const minor = this.getNodeParameter('minor', itemIndex, false) as boolean;
|
||||
const approverIdsRaw = this.getNodeParameter('approverIds', itemIndex, '') as string;
|
||||
const changelog = this.getNodeParameter('changelog', itemIndex) as string;
|
||||
|
||||
const query = `
|
||||
mutation PublishMajorDocumentVersion($input: PublishMajorDocumentVersionInput!) {
|
||||
publishMajorDocumentVersion(input: $input) {
|
||||
mutation PublishDocument($input: PublishDocumentInput!) {
|
||||
publishDocument(input: $input) {
|
||||
document {
|
||||
id
|
||||
status
|
||||
@@ -81,12 +111,24 @@ export async function execute(
|
||||
createdAt
|
||||
updatedAt
|
||||
}
|
||||
approvalQuorum {
|
||||
id
|
||||
status
|
||||
createdAt
|
||||
updatedAt
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const input: Record<string, unknown> = { documentId };
|
||||
if (changelog) input.changelog = changelog;
|
||||
const input: Record<string, unknown> = { documentId, minor, changelog };
|
||||
if (!minor && approverIdsRaw) {
|
||||
const approverIds = approverIdsRaw
|
||||
.split(',')
|
||||
.map(id => id.trim())
|
||||
.filter(Boolean);
|
||||
if (approverIds.length > 0) input.approverIds = approverIds;
|
||||
}
|
||||
|
||||
const responseData = await proboApiRequest.call(this, query, { input });
|
||||
|
||||
@@ -1,97 +0,0 @@
|
||||
// Copyright (c) 2025-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: 'Document ID',
|
||||
name: 'documentId',
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['document'],
|
||||
operation: ['publishMinorVersion'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'The ID of the document',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Changelog',
|
||||
name: 'changelog',
|
||||
type: 'string',
|
||||
typeOptions: {
|
||||
rows: 4,
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['document'],
|
||||
operation: ['publishMinorVersion'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'The changelog for this version',
|
||||
},
|
||||
];
|
||||
|
||||
export async function execute(
|
||||
this: IExecuteFunctions,
|
||||
itemIndex: number,
|
||||
): Promise<INodeExecutionData> {
|
||||
const documentId = this.getNodeParameter('documentId', itemIndex) as string;
|
||||
const changelog = this.getNodeParameter('changelog', itemIndex, '') as string;
|
||||
|
||||
const query = `
|
||||
mutation PublishMinorDocumentVersion($input: PublishMinorDocumentVersionInput!) {
|
||||
publishMinorDocumentVersion(input: $input) {
|
||||
document {
|
||||
id
|
||||
status
|
||||
trustCenterVisibility
|
||||
currentPublishedMajor
|
||||
currentPublishedMinor
|
||||
createdAt
|
||||
updatedAt
|
||||
}
|
||||
documentVersion {
|
||||
id
|
||||
title
|
||||
major
|
||||
minor
|
||||
status
|
||||
content
|
||||
changelog
|
||||
classification
|
||||
documentType
|
||||
publishedAt
|
||||
createdAt
|
||||
updatedAt
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const input: Record<string, unknown> = { documentId };
|
||||
if (changelog) input.changelog = changelog;
|
||||
|
||||
const responseData = await proboApiRequest.call(this, query, { input });
|
||||
|
||||
return {
|
||||
json: responseData,
|
||||
pairedItem: { item: itemIndex },
|
||||
};
|
||||
}
|
||||
@@ -1,97 +0,0 @@
|
||||
// Copyright (c) 2025-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: 'Document ID',
|
||||
name: 'documentId',
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['document'],
|
||||
operation: ['requestApproval'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'The ID of the document',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Approver IDs',
|
||||
name: 'approverIds',
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['document'],
|
||||
operation: ['requestApproval'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'Comma-separated list of approver profile IDs',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Changelog',
|
||||
name: 'changelog',
|
||||
type: 'string',
|
||||
typeOptions: {
|
||||
rows: 4,
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['document'],
|
||||
operation: ['requestApproval'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'The changelog for this version',
|
||||
},
|
||||
];
|
||||
|
||||
export async function execute(
|
||||
this: IExecuteFunctions,
|
||||
itemIndex: number,
|
||||
): Promise<INodeExecutionData> {
|
||||
const documentId = this.getNodeParameter('documentId', itemIndex) as string;
|
||||
const approverIds = this.getNodeParameter('approverIds', itemIndex) as string;
|
||||
const changelog = this.getNodeParameter('changelog', itemIndex, '') as string;
|
||||
|
||||
const query = `
|
||||
mutation RequestDocumentVersionApproval($input: RequestDocumentVersionApprovalInput!) {
|
||||
requestDocumentVersionApproval(input: $input) {
|
||||
approvalQuorum {
|
||||
id
|
||||
createdAt
|
||||
updatedAt
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const input: Record<string, unknown> = {
|
||||
documentId,
|
||||
approverIds: approverIds.split(',').map(id => id.trim()).filter(Boolean),
|
||||
};
|
||||
if (changelog) input.changelog = changelog;
|
||||
|
||||
const responseData = await proboApiRequest.call(this, query, { input });
|
||||
|
||||
return {
|
||||
json: responseData,
|
||||
pairedItem: { item: itemIndex },
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user