SOA as document: replace export with publish workflow

Statements of Applicability are no longer exported as one-off PDFs.
Instead, each SOA owns a persistent document that accumulates versions
over time, following the same publish/approve lifecycle as authored
documents.

Publishing without approvers publishes immediately; publishing with
approvers creates a draft pending approval via the existing quorum
system. SOAs can also store default approvers that are pre-populated in
the publish dialog.

The SOA is removed from the snapshot system — applicability statements
are now queried directly (snapshot_id IS NULL) rather than through
snapshot copies.

A standalone migration script (cmd/migrate-soa-snapshots-to-documents)
converts existing SOA snapshots into documents with proper ProseMirror
content, preserving version history and approval decisions.

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
Sacha Al Himdani
2026-04-10 13:38:42 +02:00
parent 53edc5ba26
commit c635492f75
74 changed files with 3509 additions and 1595 deletions

View File

@@ -131,6 +131,11 @@ export class Probo implements INodeType {
value: 'risk',
description: 'Manage risks',
},
{
name: 'Statement of Applicability',
value: 'statementOfApplicability',
description: 'Manage statements of applicability',
},
{
name: 'User',
value: 'user',

View File

@@ -74,11 +74,17 @@ export const description: INodeProperties[] = [
},
options: [
{
displayName: 'Query',
name: 'query',
type: 'string',
default: '',
description: 'Search query to filter documents',
displayName: 'Classifications',
name: 'classifications',
type: 'multiOptions',
default: [],
description: 'Filter by document classification',
options: [
{ name: 'Confidential', value: 'CONFIDENTIAL' },
{ name: 'Internal', value: 'INTERNAL' },
{ name: 'Public', value: 'PUBLIC' },
{ name: 'Secret', value: 'SECRET' },
],
},
{
displayName: 'Document Types',
@@ -95,21 +101,16 @@ export const description: INodeProperties[] = [
{ name: 'Record', value: 'RECORD' },
{ name: 'Register', value: 'REGISTER' },
{ name: 'Report', value: 'REPORT' },
{ name: 'Statement of Applicability', value: 'STATEMENT_OF_APPLICABILITY' },
{ name: 'Template', value: 'TEMPLATE' },
],
},
{
displayName: 'Classifications',
name: 'classifications',
type: 'multiOptions',
default: [],
description: 'Filter by document classification',
options: [
{ name: 'Confidential', value: 'CONFIDENTIAL' },
{ name: 'Internal', value: 'INTERNAL' },
{ name: 'Public', value: 'PUBLIC' },
{ name: 'Secret', value: 'SECRET' },
],
displayName: 'Query',
name: 'query',
type: 'string',
default: '',
description: 'Search query to filter documents',
},
{
displayName: 'Status',
@@ -122,6 +123,17 @@ export const description: INodeProperties[] = [
{ name: 'Archived', value: 'ARCHIVED' },
],
},
{
displayName: 'Write Modes',
name: 'writeModes',
type: 'multiOptions',
default: [],
description: 'Filter by write mode',
options: [
{ name: 'Authored', value: 'AUTHORED' },
{ name: 'Generated', value: 'GENERATED' },
],
},
],
},
];
@@ -137,6 +149,7 @@ export async function execute(
const filter: IDataObject = {};
if (filters.query) filter.query = filters.query;
if ((filters.writeModes as string[])?.length) filter.writeModes = filters.writeModes;
if ((filters.documentTypes as string[])?.length) filter.documentTypes = filters.documentTypes;
if ((filters.classifications as string[])?.length) filter.classifications = filters.classifications;
filter.status = (filters.status as string[])?.length ? filters.status : ['ACTIVE'];

View File

@@ -25,6 +25,7 @@ import * as meeting from './meeting';
import * as organization from './organization';
import * as user from './user';
import * as risk from './risk';
import * as statementOfApplicability from './statementOfApplicability';
import * as vendor from './vendor';
export interface ResourceModule {
@@ -50,6 +51,7 @@ export const resources: Record<string, ResourceModule> = {
organization: organization as ResourceModule,
user: user as ResourceModule,
risk: risk as ResourceModule,
statementOfApplicability: statementOfApplicability as ResourceModule,
vendor: vendor as ResourceModule,
};

View File

@@ -0,0 +1,114 @@
// 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: ['statementOfApplicability'],
operation: ['create'],
},
},
default: '',
description: 'The ID of the organization',
required: true,
},
{
displayName: 'Name',
name: 'name',
type: 'string',
displayOptions: {
show: {
resource: ['statementOfApplicability'],
operation: ['create'],
},
},
default: '',
description: 'The name of the statement of applicability',
required: true,
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['statementOfApplicability'],
operation: ['create'],
},
},
options: [
{
displayName: 'Default Approver IDs',
name: 'defaultApproverIds',
type: 'string',
default: '',
description: 'Comma-separated list of default approver profile IDs',
},
],
},
];
export async function execute(
this: IExecuteFunctions,
itemIndex: number,
): Promise<INodeExecutionData> {
const organizationId = this.getNodeParameter('organizationId', itemIndex) as string;
const name = this.getNodeParameter('name', itemIndex) as string;
const additionalFields = this.getNodeParameter('additionalFields', itemIndex, {}) as {
defaultApproverIds?: string;
};
const query = `
mutation CreateStatementOfApplicability($input: CreateStatementOfApplicabilityInput!) {
createStatementOfApplicability(input: $input) {
statementOfApplicabilityEdge {
node {
id
name
createdAt
updatedAt
}
}
}
}
`;
const input: Record<string, unknown> = {
organizationId,
name,
};
if (additionalFields.defaultApproverIds) {
input.defaultApproverIds = additionalFields.defaultApproverIds
.split(',')
.map(id => id.trim())
.filter(Boolean);
}
const responseData = await proboApiRequest.call(this, query, { input });
return {
json: responseData,
pairedItem: { item: itemIndex },
};
}

View File

@@ -0,0 +1,57 @@
// 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: 'Statement of Applicability ID',
name: 'statementOfApplicabilityId',
type: 'string',
displayOptions: {
show: {
resource: ['statementOfApplicability'],
operation: ['delete'],
},
},
default: '',
description: 'The ID of the statement of applicability to delete',
required: true,
},
];
export async function execute(
this: IExecuteFunctions,
itemIndex: number,
): Promise<INodeExecutionData> {
const statementOfApplicabilityId = this.getNodeParameter('statementOfApplicabilityId', itemIndex) as string;
const query = `
mutation DeleteStatementOfApplicability($input: DeleteStatementOfApplicabilityInput!) {
deleteStatementOfApplicability(input: $input) {
deletedStatementOfApplicabilityId
}
}
`;
const responseData = await proboApiRequest.call(this, query, {
input: { statementOfApplicabilityId },
});
return {
json: responseData,
pairedItem: { item: itemIndex },
};
}

View File

@@ -0,0 +1,62 @@
// 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: 'Statement of Applicability ID',
name: 'statementOfApplicabilityId',
type: 'string',
displayOptions: {
show: {
resource: ['statementOfApplicability'],
operation: ['get'],
},
},
default: '',
description: 'The ID of the statement of applicability',
required: true,
},
];
export async function execute(
this: IExecuteFunctions,
itemIndex: number,
): Promise<INodeExecutionData> {
const statementOfApplicabilityId = this.getNodeParameter('statementOfApplicabilityId', itemIndex) as string;
const query = `
query GetStatementOfApplicability($id: ID!) {
node(id: $id) {
... on StatementOfApplicability {
id
name
createdAt
updatedAt
}
}
}
`;
const responseData = await proboApiRequest.call(this, query, {
id: statementOfApplicabilityId,
});
return {
json: responseData,
pairedItem: { item: itemIndex },
};
}

View File

@@ -0,0 +1,113 @@
// 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, IDataObject } from 'n8n-workflow';
import { proboApiRequestAllItems } from '../../GenericFunctions';
export const description: INodeProperties[] = [
{
displayName: 'Organization ID',
name: 'organizationId',
type: 'string',
displayOptions: {
show: {
resource: ['statementOfApplicability'],
operation: ['getAll'],
},
},
default: '',
description: 'The ID of the organization',
required: true,
},
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
displayOptions: {
show: {
resource: ['statementOfApplicability'],
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: ['statementOfApplicability'],
operation: ['getAll'],
returnAll: [false],
},
},
typeOptions: {
minValue: 1,
},
default: 50,
description: 'Max number of results to return',
},
];
export async function execute(
this: IExecuteFunctions,
itemIndex: number,
): Promise<INodeExecutionData> {
const organizationId = this.getNodeParameter('organizationId', itemIndex) as string;
const returnAll = this.getNodeParameter('returnAll', itemIndex) as boolean;
const limit = this.getNodeParameter('limit', itemIndex, 50) as number;
const query = `
query GetStatementsOfApplicability($organizationId: ID!, $first: Int, $after: CursorKey) {
node(id: $organizationId) {
... on Organization {
statementsOfApplicability(first: $first, after: $after) {
edges {
node {
id
name
createdAt
updatedAt
}
}
pageInfo {
hasNextPage
endCursor
}
}
}
}
}
`;
const statementsOfApplicability = await proboApiRequestAllItems.call(
this,
query,
{ organizationId },
(response) => {
const data = response?.data as IDataObject | undefined;
const node = data?.node as IDataObject | undefined;
return node?.statementsOfApplicability as IDataObject | undefined;
},
returnAll,
limit,
);
return {
json: { statementsOfApplicability },
pairedItem: { item: itemIndex },
};
}

View File

@@ -0,0 +1,89 @@
// 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 } from 'n8n-workflow';
import * as createOp from './create.operation';
import * as getOp from './get.operation';
import * as getAllOp from './getAll.operation';
import * as updateOp from './update.operation';
import * as deleteOp from './delete.operation';
import * as publishOp from './publish.operation';
export const description: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: ['statementOfApplicability'],
},
},
options: [
{
name: 'Create',
value: 'create',
description: 'Create a new statement of applicability',
action: 'Create a statement of applicability',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a statement of applicability',
action: 'Delete a statement of applicability',
},
{
name: 'Get',
value: 'get',
description: 'Get a statement of applicability',
action: 'Get a statement of applicability',
},
{
name: 'Get Many',
value: 'getAll',
description: 'Get many statements of applicability',
action: 'Get many statements of applicability',
},
{
name: 'Publish',
value: 'publish',
description: 'Publish a statement of applicability as a document version',
action: 'Publish a statement of applicability',
},
{
name: 'Update',
value: 'update',
description: 'Update an existing statement of applicability',
action: 'Update a statement of applicability',
},
],
default: 'create',
},
...createOp.description,
...getOp.description,
...getAllOp.description,
...updateOp.description,
...deleteOp.description,
...publishOp.description,
];
export {
createOp as create,
getOp as get,
getAllOp as getAll,
updateOp as update,
deleteOp as delete,
publishOp as publish,
};

View 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: 'Statement of Applicability ID',
name: 'statementOfApplicabilityId',
type: 'string',
displayOptions: {
show: {
resource: ['statementOfApplicability'],
operation: ['publish'],
},
},
default: '',
description: 'The ID of the statement of applicability to publish',
required: true,
},
{
displayName: 'Approver IDs',
name: 'approverIds',
type: 'string',
displayOptions: {
show: {
resource: ['statementOfApplicability'],
operation: ['publish'],
},
},
default: '',
description: 'Comma-separated list of approver profile IDs',
},
];
export async function execute(
this: IExecuteFunctions,
itemIndex: number,
): Promise<INodeExecutionData> {
const statementOfApplicabilityId = this.getNodeParameter('statementOfApplicabilityId', itemIndex) as string;
const approverIds = this.getNodeParameter('approverIds', itemIndex, '') as string;
const query = `
mutation PublishStatementOfApplicability($input: PublishStatementOfApplicabilityInput!) {
publishStatementOfApplicability(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> = { statementOfApplicabilityId };
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 },
};
}

View 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: 'Statement of Applicability ID',
name: 'id',
type: 'string',
displayOptions: {
show: {
resource: ['statementOfApplicability'],
operation: ['update'],
},
},
default: '',
description: 'The ID of the statement of applicability to update',
required: true,
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['statementOfApplicability'],
operation: ['update'],
},
},
options: [
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
description: 'The name of the statement of applicability',
},
{
displayName: 'Default Approver IDs',
name: 'defaultApproverIds',
type: 'string',
default: '',
description: 'Comma-separated list of default approver profile IDs',
},
],
},
];
export async function execute(
this: IExecuteFunctions,
itemIndex: number,
): Promise<INodeExecutionData> {
const id = this.getNodeParameter('id', itemIndex) as string;
const updateFields = this.getNodeParameter('updateFields', itemIndex, {}) as {
name?: string;
defaultApproverIds?: string;
};
const query = `
mutation UpdateStatementOfApplicability($input: UpdateStatementOfApplicabilityInput!) {
updateStatementOfApplicability(input: $input) {
statementOfApplicability {
id
name
createdAt
updatedAt
}
}
}
`;
const input: Record<string, unknown> = { id };
if (updateFields.name) input.name = updateFields.name;
if (updateFields.defaultApproverIds) {
input.defaultApproverIds = updateFields.defaultApproverIds
.split(',')
.map(id => id.trim())
.filter(Boolean);
}
const responseData = await proboApiRequest.call(this, query, { input });
return {
json: responseData,
pairedItem: { item: itemIndex },
};
}