Remove people from n8n

Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
Émile Ré
2026-02-09 11:06:16 +04:00
parent 24bcabe620
commit f24c5e7590
7 changed files with 0 additions and 609 deletions

View File

@@ -8,7 +8,6 @@ import * as measure from './measure';
import * as member from './member';
import * as meeting from './meeting';
import * as organization from './organization';
import * as people from './people';
import * as risk from './risk';
import * as vendor from './vendor';
@@ -32,7 +31,6 @@ export const resources: Record<string, ResourceModule> = {
member: member as ResourceModule,
meeting: meeting as ResourceModule,
organization: organization as ResourceModule,
people: people as ResourceModule,
risk: risk as ResourceModule,
vendor: vendor as ResourceModule,
};

View File

@@ -1,175 +0,0 @@
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: ['people'],
operation: ['create'],
},
},
default: '',
description: 'The ID of the organization',
required: true,
},
{
displayName: 'Full Name',
name: 'fullName',
type: 'string',
displayOptions: {
show: {
resource: ['people'],
operation: ['create'],
},
},
default: '',
description: 'The full name of the person',
required: true,
},
{
displayName: 'Primary Email Address',
name: 'primaryEmailAddress',
type: 'string',
displayOptions: {
show: {
resource: ['people'],
operation: ['create'],
},
},
default: '',
description: 'The primary email address of the person',
required: true,
},
{
displayName: 'Kind',
name: 'kind',
type: 'options',
displayOptions: {
show: {
resource: ['people'],
operation: ['create'],
},
},
options: [
{
name: 'Employee',
value: 'EMPLOYEE',
},
{
name: 'Contractor',
value: 'CONTRACTOR',
},
{
name: 'Service Account',
value: 'SERVICE_ACCOUNT',
},
],
default: 'EMPLOYEE',
description: 'The kind of person',
required: true,
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['people'],
operation: ['create'],
},
},
options: [
{
displayName: 'Additional Email Addresses',
name: 'additionalEmailAddresses',
type: 'string',
default: '',
description: 'Comma-separated list of additional email addresses',
},
{
displayName: 'Position',
name: 'position',
type: 'string',
default: '',
description: 'The position of the person',
},
{
displayName: 'Contract Start Date',
name: 'contractStartDate',
type: 'dateTime',
default: '',
},
{
displayName: 'Contract End Date',
name: 'contractEndDate',
type: 'dateTime',
default: '',
},
],
},
];
export async function execute(
this: IExecuteFunctions,
itemIndex: number,
): Promise<INodeExecutionData> {
const organizationId = this.getNodeParameter('organizationId', itemIndex) as string;
const fullName = this.getNodeParameter('fullName', itemIndex) as string;
const primaryEmailAddress = this.getNodeParameter('primaryEmailAddress', itemIndex) as string;
const kind = this.getNodeParameter('kind', itemIndex) as string;
const additionalFields = this.getNodeParameter('additionalFields', itemIndex, {}) as {
additionalEmailAddresses?: string;
position?: string;
contractStartDate?: string;
contractEndDate?: string;
};
const query = `
mutation CreatePeople($input: CreatePeopleInput!) {
createPeople(input: $input) {
peopleEdge {
node {
id
fullName
primaryEmailAddress
additionalEmailAddresses
kind
position
contractStartDate
contractEndDate
createdAt
updatedAt
}
}
}
}
`;
const input: Record<string, unknown> = {
organizationId,
fullName,
primaryEmailAddress,
kind,
};
if (additionalFields.additionalEmailAddresses) {
input.additionalEmailAddresses = additionalFields.additionalEmailAddresses.split(',').map((e) => e.trim()).filter(Boolean);
} else {
input.additionalEmailAddresses = [];
}
if (additionalFields.position) input.position = additionalFields.position;
if (additionalFields.contractStartDate) input.contractStartDate = new Date(additionalFields.contractStartDate).toISOString();
if (additionalFields.contractEndDate) input.contractEndDate = new Date(additionalFields.contractEndDate).toISOString();
const responseData = await proboApiRequest.call(this, query, { input });
return {
json: responseData,
pairedItem: { item: itemIndex },
};
}

View File

@@ -1,41 +0,0 @@
import type { INodeProperties, IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
import { proboApiRequest } from '../../GenericFunctions';
export const description: INodeProperties[] = [
{
displayName: 'People ID',
name: 'peopleId',
type: 'string',
displayOptions: {
show: {
resource: ['people'],
operation: ['delete'],
},
},
default: '',
description: 'The ID of the person to delete',
required: true,
},
];
export async function execute(
this: IExecuteFunctions,
itemIndex: number,
): Promise<INodeExecutionData> {
const peopleId = this.getNodeParameter('peopleId', itemIndex) as string;
const query = `
mutation DeletePeople($input: DeletePeopleInput!) {
deletePeople(input: $input) {
deletedPeopleId
}
}
`;
const responseData = await proboApiRequest.call(this, query, { input: { peopleId } });
return {
json: responseData,
pairedItem: { item: itemIndex },
};
}

View File

@@ -1,56 +0,0 @@
import type { INodeProperties, IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
import { proboApiRequest } from '../../GenericFunctions';
export const description: INodeProperties[] = [
{
displayName: 'People ID',
name: 'peopleId',
type: 'string',
displayOptions: {
show: {
resource: ['people'],
operation: ['get'],
},
},
default: '',
description: 'The ID of the person',
required: true,
},
];
export async function execute(
this: IExecuteFunctions,
itemIndex: number,
): Promise<INodeExecutionData> {
const peopleId = this.getNodeParameter('peopleId', itemIndex) as string;
const query = `
query GetPeople($peopleId: ID!) {
node(id: $peopleId) {
... on People {
id
fullName
primaryEmailAddress
additionalEmailAddresses
kind
position
contractStartDate
contractEndDate
createdAt
updatedAt
}
}
}
`;
const variables = {
peopleId,
};
const responseData = await proboApiRequest.call(this, query, variables);
return {
json: responseData,
pairedItem: { item: itemIndex },
};
}

View File

@@ -1,105 +0,0 @@
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: ['people'],
operation: ['getAll'],
},
},
default: '',
description: 'The ID of the organization',
required: true,
},
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
displayOptions: {
show: {
resource: ['people'],
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: ['people'],
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 GetPeoples($organizationId: ID!, $first: Int, $after: CursorKey) {
node(id: $organizationId) {
... on Organization {
peoples(first: $first, after: $after) {
edges {
node {
id
fullName
primaryEmailAddress
additionalEmailAddresses
kind
position
contractStartDate
contractEndDate
createdAt
updatedAt
}
}
pageInfo {
hasNextPage
endCursor
}
}
}
}
}
`;
const peoples = await proboApiRequestAllItems.call(
this,
query,
{ organizationId },
(response) => {
const data = response?.data as IDataObject | undefined;
const node = data?.node as IDataObject | undefined;
return node?.peoples as IDataObject | undefined;
},
returnAll,
limit,
);
return {
json: { peoples },
pairedItem: { item: itemIndex },
};
}

View File

@@ -1,60 +0,0 @@
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: ['people'],
},
},
options: [
{
name: 'Create',
value: 'create',
description: 'Create a new person',
action: 'Create a person',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a person',
action: 'Delete a person',
},
{
name: 'Get',
value: 'get',
description: 'Get a person',
action: 'Get a person',
},
{
name: 'Get Many',
value: 'getAll',
description: 'Get many people',
action: 'Get many people',
},
{
name: 'Update',
value: 'update',
description: 'Update an existing person',
action: 'Update a person',
},
],
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 };

View File

@@ -1,170 +0,0 @@
import type { INodeProperties, IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
import { proboApiRequest } from '../../GenericFunctions';
export const description: INodeProperties[] = [
{
displayName: 'People ID',
name: 'peopleId',
type: 'string',
displayOptions: {
show: {
resource: ['people'],
operation: ['update'],
},
},
default: '',
description: 'The ID of the person to update',
required: true,
},
{
displayName: 'Full Name',
name: 'fullName',
type: 'string',
displayOptions: {
show: {
resource: ['people'],
operation: ['update'],
},
},
default: '',
description: 'The full name of the person',
},
{
displayName: 'Primary Email Address',
name: 'primaryEmailAddress',
type: 'string',
displayOptions: {
show: {
resource: ['people'],
operation: ['update'],
},
},
default: '',
description: 'The primary email address of the person',
},
{
displayName: 'Kind',
name: 'kind',
type: 'options',
displayOptions: {
show: {
resource: ['people'],
operation: ['update'],
},
},
options: [
{
name: 'Employee',
value: 'EMPLOYEE',
},
{
name: 'Contractor',
value: 'CONTRACTOR',
},
{
name: 'Service Account',
value: 'SERVICE_ACCOUNT',
},
],
default: 'EMPLOYEE',
description: 'The kind of person',
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['people'],
operation: ['update'],
},
},
options: [
{
displayName: 'Additional Email Addresses',
name: 'additionalEmailAddresses',
type: 'string',
default: '',
description: 'Comma-separated list of additional email addresses',
},
{
displayName: 'Position',
name: 'position',
type: 'string',
default: '',
description: 'The position of the person',
},
{
displayName: 'Contract Start Date',
name: 'contractStartDate',
type: 'dateTime',
default: '',
},
{
displayName: 'Contract End Date',
name: 'contractEndDate',
type: 'dateTime',
default: '',
},
],
},
];
export async function execute(
this: IExecuteFunctions,
itemIndex: number,
): Promise<INodeExecutionData> {
const peopleId = this.getNodeParameter('peopleId', itemIndex) as string;
const fullName = this.getNodeParameter('fullName', itemIndex, '') as string;
const primaryEmailAddress = this.getNodeParameter('primaryEmailAddress', itemIndex, '') as string;
const kind = this.getNodeParameter('kind', itemIndex, '') as string;
const additionalFields = this.getNodeParameter('additionalFields', itemIndex, {}) as {
additionalEmailAddresses?: string;
position?: string;
contractStartDate?: string;
contractEndDate?: string;
};
const query = `
mutation UpdatePeople($input: UpdatePeopleInput!) {
updatePeople(input: $input) {
people {
id
fullName
primaryEmailAddress
additionalEmailAddresses
kind
position
contractStartDate
contractEndDate
createdAt
updatedAt
}
}
}
`;
const input: Record<string, unknown> = { id: peopleId };
if (fullName) input.fullName = fullName;
if (primaryEmailAddress) input.primaryEmailAddress = primaryEmailAddress;
if (kind) input.kind = kind;
if (additionalFields.additionalEmailAddresses !== undefined) {
if (additionalFields.additionalEmailAddresses === '') {
input.additionalEmailAddresses = [];
} else {
input.additionalEmailAddresses = additionalFields.additionalEmailAddresses.split(',').map((e) => e.trim()).filter(Boolean);
}
}
if (additionalFields.position !== undefined) input.position = additionalFields.position === '' ? null : additionalFields.position;
if (additionalFields.contractStartDate !== undefined) input.contractStartDate = additionalFields.contractStartDate === '' ? null : new Date(additionalFields.contractStartDate).toISOString();
if (additionalFields.contractEndDate !== undefined) input.contractEndDate = additionalFields.contractEndDate === '' ? null : new Date(additionalFields.contractEndDate).toISOString();
const responseData = await proboApiRequest.call(this, query, { input });
return {
json: responseData,
pairedItem: { item: itemIndex },
};
}