first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled

This commit is contained in:
2026-03-17 16:22:57 +03:30
commit 3d5eaf9445
15349 changed files with 2847338 additions and 0 deletions
@@ -0,0 +1,75 @@
import { createEmployeeSharedDescription } from './shareDescription';
import type { EmployeeProperties } from '../../Interfaces';
export const employeeCreateDescription: EmployeeProperties = [
{
displayName: 'Synced with Trax Payroll',
name: 'synced',
type: 'boolean',
required: true,
displayOptions: {
show: {
operation: ['create'],
resource: ['employee'],
},
},
default: false,
description:
'Whether the employee to create was added to a pay schedule synced with Trax Payroll',
},
{
displayName: 'First Name',
name: 'firstName',
type: 'string',
required: true,
displayOptions: {
show: {
operation: ['create'],
resource: ['employee'],
},
},
default: '',
},
{
displayName: 'Last Name',
name: 'lastName',
type: 'string',
required: true,
displayOptions: {
show: {
operation: ['create'],
resource: ['employee'],
},
},
default: '',
},
...(createEmployeeSharedDescription(true) as EmployeeProperties),
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
operation: ['create'],
resource: ['employee'],
},
},
options: [
...createEmployeeSharedDescription(false),
{
displayName: 'Work Email',
name: 'workEmail',
type: 'string',
default: '',
},
{
displayName: 'Work Phone',
name: 'workPhone',
type: 'string',
default: '',
},
],
},
];
@@ -0,0 +1,104 @@
import { capitalCase } from 'change-case';
import moment from 'moment-timezone';
import type { IExecuteFunctions, IDataObject, INodeExecutionData } from 'n8n-workflow';
import { apiRequest } from '../../../transport';
export async function create(
this: IExecuteFunctions,
index: number,
): Promise<INodeExecutionData[]> {
const body: IDataObject = {};
const requestMethod = 'POST';
const endpoint = 'employees';
//body parameters
body.firstName = this.getNodeParameter('firstName', index) as string;
body.lastName = this.getNodeParameter('lastName', index) as string;
const additionalFields = this.getNodeParameter('additionalFields', index);
const synced = this.getNodeParameter('synced', index) as boolean;
if (synced) {
Object.assign(body, {
address: this.getNodeParameter('address.value', index, {}) as IDataObject,
});
Object.assign(body, {
payRate: this.getNodeParameter('payRate.value', index, {}) as IDataObject,
});
body.department = this.getNodeParameter('department', index) as string;
body.dateOfBirth = this.getNodeParameter('dateOfBirth', index);
body.division = this.getNodeParameter('division', index) as string;
body.employeeNumber = this.getNodeParameter('employeeNumber', index) as string;
body.exempt = this.getNodeParameter('exempt', index) as string;
body.gender = this.getNodeParameter('gender', index) as string;
body.hireDate = this.getNodeParameter('hireDate', index) as string;
body.location = this.getNodeParameter('location', index) as string;
body.maritalStatus = this.getNodeParameter('maritalStatus', index) as string;
body.mobilePhone = this.getNodeParameter('mobilePhone', index) as string;
body.paidPer = this.getNodeParameter('paidPer', index) as string;
body.payType = this.getNodeParameter('payType', index) as string;
body.preferredName = this.getNodeParameter('preferredName', index) as string;
body.ssn = this.getNodeParameter('ssn', index) as string;
} else {
Object.assign(body, {
address: this.getNodeParameter('additionalFields.address.value', index, {}) as IDataObject,
});
Object.assign(body, {
payRate: this.getNodeParameter('additionalFields.payRate.value', index, {}) as IDataObject,
});
delete additionalFields.address;
delete additionalFields.payRate;
}
Object.assign(body, additionalFields);
if (body.gender) {
body.gender = capitalCase(body.gender as string);
}
if (body.dateOfBirth) {
body.dateOfBirth = moment(body.dateOfBirth as string).format('YYYY-MM-DD');
}
if (body.exempt) {
body.exempt = capitalCase(body.exempt as string);
}
if (body.hireDate) {
body.hireDate = moment(body.hireDate as string).format('YYYY-MM-DD');
}
if (body.maritalStatus) {
body.maritalStatus = capitalCase(body.maritalStatus as string);
}
if (body.payType) {
body.payType = capitalCase(body.payType as string);
}
if (body.paidPer) {
body.paidPer = capitalCase(body.paidPer as string);
}
if (!Object.keys(body.payRate as IDataObject).length) {
delete body.payRate;
}
//response
const responseData = await apiRequest.call(
this,
requestMethod,
endpoint,
body,
{},
{ resolveWithFullResponse: true },
);
//obtain employeeID
const rawEmployeeId: number = responseData.headers.location.lastIndexOf('/');
const employeeId = responseData.headers.location.substring(rawEmployeeId + 1);
//return
return this.helpers.returnJsonArray({ id: employeeId });
}
@@ -0,0 +1,4 @@
import { employeeCreateDescription as description } from './description';
import { create as execute } from './execute';
export { description, execute };
@@ -0,0 +1,322 @@
import type { INodeProperties } from 'n8n-workflow';
export const createEmployeeSharedDescription = (sync = false): INodeProperties[] => {
let elements: INodeProperties[] = [
{
displayName: 'Address',
name: 'address',
placeholder: 'Address',
type: 'fixedCollection',
typeOptions: {
multipleValues: false,
},
default: {},
options: [
{
name: 'value',
displayName: 'Address',
values: [
{
displayName: 'Line 1',
name: 'address1',
type: 'string',
default: '',
},
{
displayName: 'Line 2',
name: 'address2',
type: 'string',
default: '',
},
{
displayName: 'City',
name: 'city',
type: 'string',
default: '',
},
{
displayName: 'State',
name: 'state',
type: 'string',
default: '',
placeholder: 'Florida',
description: 'The full name of the state/province',
},
{
displayName: 'Country',
name: 'country',
type: 'string',
default: '',
placeholder: 'United States',
description: 'The name of the country. Must exist in the BambooHr country list.',
},
],
},
],
},
{
displayName: 'Date of Birth',
name: 'dateOfBirth',
type: 'dateTime',
default: '',
},
{
displayName: 'Department Name or ID',
name: 'department',
type: 'options',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
typeOptions: {
loadOptionsMethod: 'getDepartments',
},
default: '',
},
{
displayName: 'Division Name or ID',
name: 'division',
type: 'options',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
typeOptions: {
loadOptionsMethod: 'getDivisions',
},
default: '',
},
{
displayName: 'Employee Number',
name: 'employeeNumber',
type: 'string',
default: '',
},
{
displayName: 'FLSA Overtime Status',
name: 'exempt',
type: 'options',
options: [
{
name: 'Exempt',
value: 'exempt',
},
{
name: 'Non-Exempt',
value: 'non-exempt',
},
],
default: '',
},
{
displayName: 'Gender',
name: 'gender',
type: 'options',
options: [
{
name: 'Female',
value: 'female',
},
{
name: 'Male',
value: 'male',
},
],
default: '',
},
{
displayName: 'Hire Date',
name: 'hireDate',
type: 'dateTime',
default: '',
},
{
displayName: 'Location Name or ID',
name: 'location',
type: 'options',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
typeOptions: {
loadOptionsMethod: 'getEmployeeLocations',
},
default: '',
},
{
displayName: 'Marital Status',
name: 'maritalStatus',
type: 'options',
options: [
{
name: 'Single',
value: 'single',
},
{
name: 'Married',
value: 'married',
},
{
name: 'Domestic Partnership',
value: 'domesticPartnership',
},
],
default: '',
},
{
displayName: 'Mobile Phone',
name: 'mobilePhone',
type: 'string',
default: '',
},
{
displayName: 'Pay Per',
name: 'paidPer',
type: 'options',
// eslint-disable-next-line n8n-nodes-base/node-param-options-type-unsorted-items
options: [
{
name: 'Hour',
value: 'hour',
},
{
name: 'Day',
value: 'day',
},
{
name: 'Week',
value: 'week',
},
{
name: 'Month',
value: 'month',
},
{
name: 'Quater',
value: 'quater',
},
{
name: 'Year',
value: 'year',
},
],
default: '',
},
{
displayName: 'Pay Rate',
name: 'payRate',
placeholder: 'Add Pay Rate',
type: 'fixedCollection',
typeOptions: {
multipleValues: false,
},
default: {},
options: [
{
name: 'value',
displayName: 'Pay Rate',
values: [
{
displayName: 'Value',
name: 'value',
type: 'string',
default: '',
placeholder: '20.00',
},
{
displayName: 'Currency',
name: 'currency',
type: 'string',
default: '',
placeholder: 'USD',
},
],
},
],
},
{
displayName: 'Pay Type',
name: 'payType',
type: 'options',
options: [
{
name: 'Commission',
value: 'commission',
},
{
name: 'Contract',
value: 'contract',
},
{
name: 'Daily',
value: 'daily',
},
{
name: 'Exception Hourly',
value: 'exceptionHourly',
},
{
name: 'Hourly',
value: 'hourly',
},
{
name: 'Monthly',
value: 'monthly',
},
{
name: 'Piece Rate',
value: 'pieceRate',
},
{
name: 'Pro Rata',
value: 'proRata',
},
{
name: 'Salary',
value: 'salary',
},
{
name: 'Weekly',
value: 'weekly',
},
],
default: '',
},
{
displayName: 'Preferred Name',
name: 'preferredName',
type: 'string',
default: '',
},
{
displayName: 'Social Security Number',
name: 'ssn',
type: 'string',
default: '',
placeholder: '123-45-6789',
description: 'A standard United States Social Security number, with dashes',
},
];
if (sync) {
elements = elements.map((element) => {
return Object.assign(element, {
displayOptions: {
show: {
resource: ['employee'],
operation: ['create'],
synced: [true],
},
},
required: true,
});
});
return elements;
} else {
elements = elements.map((element) => {
return Object.assign(element, {
displayOptions: {
show: {
'/synced': [false],
},
},
});
});
}
return elements;
};