From e7c4c36e568021389bde11da35a4bc7aa9b6c949 Mon Sep 17 00:00:00 2001 From: Bryan Frimin Date: Tue, 2 Dec 2025 10:40:07 +0100 Subject: [PATCH] Add framework operations Signed-off-by: Bryan Frimin --- packages/n8n-node/nodes/Probo/Probo.node.ts | 5 + .../actions/framework/create.operation.ts | 87 +++++++++++++++++ .../actions/framework/delete.operation.ts | 42 ++++++++ .../Probo/actions/framework/get.operation.ts | 52 ++++++++++ .../actions/framework/getAll.operation.ts | 97 +++++++++++++++++++ .../nodes/Probo/actions/framework/index.ts | 61 ++++++++++++ .../actions/framework/update.operation.ts | 80 +++++++++++++++ .../n8n-node/nodes/Probo/actions/index.ts | 2 + 8 files changed, 426 insertions(+) create mode 100644 packages/n8n-node/nodes/Probo/actions/framework/create.operation.ts create mode 100644 packages/n8n-node/nodes/Probo/actions/framework/delete.operation.ts create mode 100644 packages/n8n-node/nodes/Probo/actions/framework/get.operation.ts create mode 100644 packages/n8n-node/nodes/Probo/actions/framework/getAll.operation.ts create mode 100644 packages/n8n-node/nodes/Probo/actions/framework/index.ts create mode 100644 packages/n8n-node/nodes/Probo/actions/framework/update.operation.ts diff --git a/packages/n8n-node/nodes/Probo/Probo.node.ts b/packages/n8n-node/nodes/Probo/Probo.node.ts index 81a9bb6d2..341746808 100644 --- a/packages/n8n-node/nodes/Probo/Probo.node.ts +++ b/packages/n8n-node/nodes/Probo/Probo.node.ts @@ -67,6 +67,11 @@ export class Probo implements INodeType { value: 'execute', description: 'Execute a GraphQL query or mutation', }, + { + name: 'Framework', + value: 'framework', + description: 'Manage frameworks', + }, { name: 'Measure', value: 'measure', diff --git a/packages/n8n-node/nodes/Probo/actions/framework/create.operation.ts b/packages/n8n-node/nodes/Probo/actions/framework/create.operation.ts new file mode 100644 index 000000000..6583abfe1 --- /dev/null +++ b/packages/n8n-node/nodes/Probo/actions/framework/create.operation.ts @@ -0,0 +1,87 @@ +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: ['framework'], + operation: ['create'], + }, + }, + default: '', + description: 'The ID of the organization', + required: true, + }, + { + displayName: 'Name', + name: 'name', + type: 'string', + displayOptions: { + show: { + resource: ['framework'], + operation: ['create'], + }, + }, + default: '', + description: 'The name of the framework', + required: true, + }, + { + displayName: 'Description', + name: 'description', + type: 'string', + displayOptions: { + show: { + resource: ['framework'], + operation: ['create'], + }, + }, + default: '', + description: 'The description of the framework', + }, +]; + +export async function execute( + this: IExecuteFunctions, + itemIndex: number, +): Promise { + const organizationId = this.getNodeParameter('organizationId', itemIndex) as string; + const name = this.getNodeParameter('name', itemIndex) as string; + const description = this.getNodeParameter('description', itemIndex, '') as string; + + const query = ` + mutation CreateFramework($input: CreateFrameworkInput!) { + createFramework(input: $input) { + frameworkEdge { + node { + id + name + description + createdAt + updatedAt + } + } + } + } + `; + + const variables = { + input: { + organizationId, + name, + ...(description && { description }), + }, + }; + + const responseData = await proboApiRequest.call(this, query, variables); + + return { + json: responseData, + pairedItem: { item: itemIndex }, + }; +} + diff --git a/packages/n8n-node/nodes/Probo/actions/framework/delete.operation.ts b/packages/n8n-node/nodes/Probo/actions/framework/delete.operation.ts new file mode 100644 index 000000000..de7fc8846 --- /dev/null +++ b/packages/n8n-node/nodes/Probo/actions/framework/delete.operation.ts @@ -0,0 +1,42 @@ +import type { INodeProperties, IExecuteFunctions, INodeExecutionData } from 'n8n-workflow'; +import { proboApiRequest } from '../../GenericFunctions'; + +export const description: INodeProperties[] = [ + { + displayName: 'Framework ID', + name: 'frameworkId', + type: 'string', + displayOptions: { + show: { + resource: ['framework'], + operation: ['delete'], + }, + }, + default: '', + description: 'The ID of the framework to delete', + required: true, + }, +]; + +export async function execute( + this: IExecuteFunctions, + itemIndex: number, +): Promise { + const frameworkId = this.getNodeParameter('frameworkId', itemIndex) as string; + + const query = ` + mutation DeleteFramework($input: DeleteFrameworkInput!) { + deleteFramework(input: $input) { + deletedFrameworkId + } + } + `; + + const responseData = await proboApiRequest.call(this, query, { input: { frameworkId } }); + + return { + json: responseData, + pairedItem: { item: itemIndex }, + }; +} + diff --git a/packages/n8n-node/nodes/Probo/actions/framework/get.operation.ts b/packages/n8n-node/nodes/Probo/actions/framework/get.operation.ts new file mode 100644 index 000000000..ff3fc278d --- /dev/null +++ b/packages/n8n-node/nodes/Probo/actions/framework/get.operation.ts @@ -0,0 +1,52 @@ +import type { INodeProperties, IExecuteFunctions, INodeExecutionData } from 'n8n-workflow'; +import { proboApiRequest } from '../../GenericFunctions'; + +export const description: INodeProperties[] = [ + { + displayName: 'Framework ID', + name: 'frameworkId', + type: 'string', + displayOptions: { + show: { + resource: ['framework'], + operation: ['get'], + }, + }, + default: '', + description: 'The ID of the framework', + required: true, + }, +]; + +export async function execute( + this: IExecuteFunctions, + itemIndex: number, +): Promise { + const frameworkId = this.getNodeParameter('frameworkId', itemIndex) as string; + + const query = ` + query GetFramework($frameworkId: ID!) { + node(id: $frameworkId) { + ... on Framework { + id + name + description + createdAt + updatedAt + } + } + } + `; + + const variables = { + frameworkId, + }; + + const responseData = await proboApiRequest.call(this, query, variables); + + return { + json: responseData, + pairedItem: { item: itemIndex }, + }; +} + diff --git a/packages/n8n-node/nodes/Probo/actions/framework/getAll.operation.ts b/packages/n8n-node/nodes/Probo/actions/framework/getAll.operation.ts new file mode 100644 index 000000000..7cf743a4d --- /dev/null +++ b/packages/n8n-node/nodes/Probo/actions/framework/getAll.operation.ts @@ -0,0 +1,97 @@ +import type { INodeProperties, IExecuteFunctions, INodeExecutionData } from 'n8n-workflow'; +import { proboApiRequestAllItems } from '../../GenericFunctions'; + +export const description: INodeProperties[] = [ + { + displayName: 'Organization ID', + name: 'organizationId', + type: 'string', + displayOptions: { + show: { + resource: ['framework'], + operation: ['getAll'], + }, + }, + default: '', + description: 'The ID of the organization', + required: true, + }, + { + displayName: 'Return All', + name: 'returnAll', + type: 'boolean', + displayOptions: { + show: { + resource: ['framework'], + 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: ['framework'], + 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 { + 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 GetFrameworks($organizationId: ID!, $first: Int, $after: CursorKey) { + node(id: $organizationId) { + ... on Organization { + frameworks(first: $first, after: $after) { + edges { + node { + id + name + description + createdAt + updatedAt + } + } + pageInfo { + hasNextPage + endCursor + } + } + } + } + } + `; + + const frameworks = await proboApiRequestAllItems.call( + this, + query, + { organizationId }, + (response) => response?.data?.node?.frameworks, + returnAll, + limit, + ); + + return { + json: { frameworks }, + pairedItem: { item: itemIndex }, + }; +} + diff --git a/packages/n8n-node/nodes/Probo/actions/framework/index.ts b/packages/n8n-node/nodes/Probo/actions/framework/index.ts new file mode 100644 index 000000000..b22cfcd7b --- /dev/null +++ b/packages/n8n-node/nodes/Probo/actions/framework/index.ts @@ -0,0 +1,61 @@ +import type { INodeProperties } from 'n8n-workflow'; +import * as createOp from './create.operation'; +import * as updateOp from './update.operation'; +import * as deleteOp from './delete.operation'; +import * as getOp from './get.operation'; +import * as getAllOp from './getAll.operation'; + +export const description: INodeProperties[] = [ + { + displayName: 'Operation', + name: 'operation', + type: 'options', + noDataExpression: true, + displayOptions: { + show: { + resource: ['framework'], + }, + }, + options: [ + { + name: 'Create', + value: 'create', + description: 'Create a new framework', + action: 'Create a framework', + }, + { + name: 'Delete', + value: 'delete', + description: 'Delete a framework', + action: 'Delete a framework', + }, + { + name: 'Get', + value: 'get', + description: 'Get a framework', + action: 'Get a framework', + }, + { + name: 'Get All', + value: 'getAll', + description: 'Get all frameworks', + action: 'Get all frameworks', + }, + { + name: 'Update', + value: 'update', + description: 'Update an existing framework', + action: 'Update a framework', + }, + ], + default: 'create', + }, + ...createOp.description, + ...updateOp.description, + ...deleteOp.description, + ...getOp.description, + ...getAllOp.description, +]; + +export { createOp as create, updateOp as update, deleteOp as delete, getOp as get, getAllOp as getAll }; + diff --git a/packages/n8n-node/nodes/Probo/actions/framework/update.operation.ts b/packages/n8n-node/nodes/Probo/actions/framework/update.operation.ts new file mode 100644 index 000000000..b04eea5e7 --- /dev/null +++ b/packages/n8n-node/nodes/Probo/actions/framework/update.operation.ts @@ -0,0 +1,80 @@ +import type { INodeProperties, IExecuteFunctions, INodeExecutionData } from 'n8n-workflow'; +import { proboApiRequest } from '../../GenericFunctions'; + +export const description: INodeProperties[] = [ + { + displayName: 'Framework ID', + name: 'id', + type: 'string', + displayOptions: { + show: { + resource: ['framework'], + operation: ['update'], + }, + }, + default: '', + description: 'The ID of the framework to update', + required: true, + }, + { + displayName: 'Name', + name: 'name', + type: 'string', + displayOptions: { + show: { + resource: ['framework'], + operation: ['update'], + }, + }, + default: '', + description: 'The name of the framework', + }, + { + displayName: 'Description', + name: 'description', + type: 'string', + displayOptions: { + show: { + resource: ['framework'], + operation: ['update'], + }, + }, + default: '', + description: 'The description of the framework', + }, +]; + +export async function execute( + this: IExecuteFunctions, + itemIndex: number, +): Promise { + const id = this.getNodeParameter('id', itemIndex) as string; + const name = this.getNodeParameter('name', itemIndex, '') as string; + const description = this.getNodeParameter('description', itemIndex, '') as string; + + const query = ` + mutation UpdateFramework($input: UpdateFrameworkInput!) { + updateFramework(input: $input) { + framework { + id + name + description + createdAt + updatedAt + } + } + } + `; + + const input: Record = { id }; + if (name) input.name = name; + if (description) input.description = description; + + const responseData = await proboApiRequest.call(this, query, { input }); + + return { + json: responseData, + pairedItem: { item: itemIndex }, + }; +} + diff --git a/packages/n8n-node/nodes/Probo/actions/index.ts b/packages/n8n-node/nodes/Probo/actions/index.ts index 806785092..350d1b9dd 100644 --- a/packages/n8n-node/nodes/Probo/actions/index.ts +++ b/packages/n8n-node/nodes/Probo/actions/index.ts @@ -1,5 +1,6 @@ import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow'; import * as execute from './execute'; +import * as framework from './framework'; import * as measure from './measure'; export interface ResourceModule { @@ -14,6 +15,7 @@ export interface OperationModule { export const resources: Record = { execute: execute as ResourceModule, + framework: framework as ResourceModule, measure: measure as ResourceModule, };