@classytic/payroll 1.0.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +168 -489
- package/dist/core/index.d.ts +480 -0
- package/dist/core/index.js +971 -0
- package/dist/core/index.js.map +1 -0
- package/dist/index-CTjHlCzz.d.ts +721 -0
- package/dist/index.d.ts +967 -0
- package/dist/index.js +4352 -0
- package/dist/index.js.map +1 -0
- package/dist/payroll.d.ts +233 -0
- package/dist/payroll.js +2103 -0
- package/dist/payroll.js.map +1 -0
- package/dist/plugin-D9mOr3_d.d.ts +333 -0
- package/dist/schemas/index.d.ts +2869 -0
- package/dist/schemas/index.js +440 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/services/index.d.ts +3 -0
- package/dist/services/index.js +1696 -0
- package/dist/services/index.js.map +1 -0
- package/dist/types-BSYyX2KJ.d.ts +671 -0
- package/dist/utils/index.d.ts +873 -0
- package/dist/utils/index.js +1046 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +54 -37
- package/dist/types/config.d.ts +0 -162
- package/dist/types/core/compensation.manager.d.ts +0 -54
- package/dist/types/core/employment.manager.d.ts +0 -49
- package/dist/types/core/payroll.manager.d.ts +0 -60
- package/dist/types/enums.d.ts +0 -117
- package/dist/types/factories/compensation.factory.d.ts +0 -196
- package/dist/types/factories/employee.factory.d.ts +0 -149
- package/dist/types/factories/payroll.factory.d.ts +0 -319
- package/dist/types/hrm.orchestrator.d.ts +0 -47
- package/dist/types/index.d.ts +0 -20
- package/dist/types/init.d.ts +0 -30
- package/dist/types/models/payroll-record.model.d.ts +0 -3
- package/dist/types/plugins/employee.plugin.d.ts +0 -2
- package/dist/types/schemas/employment.schema.d.ts +0 -959
- package/dist/types/services/compensation.service.d.ts +0 -94
- package/dist/types/services/employee.service.d.ts +0 -28
- package/dist/types/services/payroll.service.d.ts +0 -30
- package/dist/types/utils/calculation.utils.d.ts +0 -26
- package/dist/types/utils/date.utils.d.ts +0 -35
- package/dist/types/utils/logger.d.ts +0 -12
- package/dist/types/utils/query-builders.d.ts +0 -83
- package/dist/types/utils/validation.utils.d.ts +0 -33
- package/payroll.d.ts +0 -241
- package/src/config.js +0 -177
- package/src/core/compensation.manager.js +0 -242
- package/src/core/employment.manager.js +0 -224
- package/src/core/payroll.manager.js +0 -499
- package/src/enums.js +0 -141
- package/src/factories/compensation.factory.js +0 -198
- package/src/factories/employee.factory.js +0 -173
- package/src/factories/payroll.factory.js +0 -413
- package/src/hrm.orchestrator.js +0 -139
- package/src/index.js +0 -172
- package/src/init.js +0 -62
- package/src/models/payroll-record.model.js +0 -126
- package/src/plugins/employee.plugin.js +0 -164
- package/src/schemas/employment.schema.js +0 -126
- package/src/services/compensation.service.js +0 -231
- package/src/services/employee.service.js +0 -162
- package/src/services/payroll.service.js +0 -213
- package/src/utils/calculation.utils.js +0 -91
- package/src/utils/date.utils.js +0 -120
- package/src/utils/logger.js +0 -36
- package/src/utils/query-builders.js +0 -185
- package/src/utils/validation.utils.js +0 -122
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
export class CompensationService {
|
|
2
|
-
constructor(EmployeeModel: any);
|
|
3
|
-
EmployeeModel: any;
|
|
4
|
-
getEmployeeCompensation(employeeId: any): Promise<any>;
|
|
5
|
-
calculateBreakdown(employeeId: any): Promise<{
|
|
6
|
-
baseAmount: any;
|
|
7
|
-
allowances: any;
|
|
8
|
-
deductions: any;
|
|
9
|
-
grossAmount: any;
|
|
10
|
-
netAmount: number;
|
|
11
|
-
}>;
|
|
12
|
-
updateBaseAmount(employeeId: any, newAmount: any, effectiveFrom: any): Promise<{
|
|
13
|
-
baseAmount: any;
|
|
14
|
-
allowances: any;
|
|
15
|
-
deductions: any;
|
|
16
|
-
grossAmount: any;
|
|
17
|
-
netAmount: number;
|
|
18
|
-
}>;
|
|
19
|
-
applyIncrement(employeeId: any, { percentage, amount, effectiveFrom }: {
|
|
20
|
-
percentage: any;
|
|
21
|
-
amount: any;
|
|
22
|
-
effectiveFrom: any;
|
|
23
|
-
}): Promise<{
|
|
24
|
-
baseAmount: any;
|
|
25
|
-
allowances: any;
|
|
26
|
-
deductions: any;
|
|
27
|
-
grossAmount: any;
|
|
28
|
-
netAmount: number;
|
|
29
|
-
}>;
|
|
30
|
-
addAllowance(employeeId: any, allowance: any): Promise<{
|
|
31
|
-
baseAmount: any;
|
|
32
|
-
allowances: any;
|
|
33
|
-
deductions: any;
|
|
34
|
-
grossAmount: any;
|
|
35
|
-
netAmount: number;
|
|
36
|
-
}>;
|
|
37
|
-
removeAllowance(employeeId: any, allowanceType: any): Promise<{
|
|
38
|
-
baseAmount: any;
|
|
39
|
-
allowances: any;
|
|
40
|
-
deductions: any;
|
|
41
|
-
grossAmount: any;
|
|
42
|
-
netAmount: number;
|
|
43
|
-
}>;
|
|
44
|
-
addDeduction(employeeId: any, deduction: any): Promise<{
|
|
45
|
-
baseAmount: any;
|
|
46
|
-
allowances: any;
|
|
47
|
-
deductions: any;
|
|
48
|
-
grossAmount: any;
|
|
49
|
-
netAmount: number;
|
|
50
|
-
}>;
|
|
51
|
-
removeDeduction(employeeId: any, deductionType: any): Promise<{
|
|
52
|
-
baseAmount: any;
|
|
53
|
-
allowances: any;
|
|
54
|
-
deductions: any;
|
|
55
|
-
grossAmount: any;
|
|
56
|
-
netAmount: number;
|
|
57
|
-
}>;
|
|
58
|
-
setStandardCompensation(employeeId: any, baseAmount: any): Promise<{
|
|
59
|
-
baseAmount: any;
|
|
60
|
-
allowances: any;
|
|
61
|
-
deductions: any;
|
|
62
|
-
grossAmount: any;
|
|
63
|
-
netAmount: number;
|
|
64
|
-
}>;
|
|
65
|
-
compareCompensation(employeeId1: any, employeeId2: any): Promise<{
|
|
66
|
-
employee1: {
|
|
67
|
-
baseAmount: any;
|
|
68
|
-
allowances: any;
|
|
69
|
-
deductions: any;
|
|
70
|
-
grossAmount: any;
|
|
71
|
-
netAmount: number;
|
|
72
|
-
};
|
|
73
|
-
employee2: {
|
|
74
|
-
baseAmount: any;
|
|
75
|
-
allowances: any;
|
|
76
|
-
deductions: any;
|
|
77
|
-
grossAmount: any;
|
|
78
|
-
netAmount: number;
|
|
79
|
-
};
|
|
80
|
-
difference: {
|
|
81
|
-
base: number;
|
|
82
|
-
gross: number;
|
|
83
|
-
net: number;
|
|
84
|
-
};
|
|
85
|
-
ratio: {
|
|
86
|
-
base: number;
|
|
87
|
-
gross: number;
|
|
88
|
-
net: number;
|
|
89
|
-
};
|
|
90
|
-
}>;
|
|
91
|
-
getDepartmentCompensationStats(organizationId: any, department: any): Promise<any>;
|
|
92
|
-
getOrganizationCompensationStats(organizationId: any): Promise<any>;
|
|
93
|
-
}
|
|
94
|
-
export function createCompensationService(EmployeeModel: any): CompensationService;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export class EmployeeService {
|
|
2
|
-
constructor(EmployeeModel: any);
|
|
3
|
-
EmployeeModel: any;
|
|
4
|
-
findById(employeeId: any): Promise<any>;
|
|
5
|
-
findByUserId(userId: any, organizationId: any): Promise<any>;
|
|
6
|
-
findActive(organizationId: any, options?: {}): Promise<any>;
|
|
7
|
-
findEmployed(organizationId: any, options?: {}): Promise<any>;
|
|
8
|
-
findByDepartment(organizationId: any, department: any): Promise<any>;
|
|
9
|
-
findEligibleForPayroll(organizationId: any, month: any, year: any): Promise<any>;
|
|
10
|
-
create(data: any): Promise<any>;
|
|
11
|
-
updateStatus(employeeId: any, status: any, context?: {}): Promise<any>;
|
|
12
|
-
terminate(employeeId: any, reason: any, context?: {}): Promise<any>;
|
|
13
|
-
updateCompensation(employeeId: any, compensation: any): Promise<any>;
|
|
14
|
-
getEmployeeStats(organizationId: any): Promise<{
|
|
15
|
-
total: any;
|
|
16
|
-
active: any;
|
|
17
|
-
employed: any;
|
|
18
|
-
canReceiveSalary: any;
|
|
19
|
-
byStatus: any;
|
|
20
|
-
byDepartment: any;
|
|
21
|
-
}>;
|
|
22
|
-
groupByStatus(employees: any): any;
|
|
23
|
-
groupByDepartment(employees: any): any;
|
|
24
|
-
isActive(employee: any): boolean;
|
|
25
|
-
isEmployed(employee: any): boolean;
|
|
26
|
-
canReceiveSalary(employee: any): boolean;
|
|
27
|
-
}
|
|
28
|
-
export function createEmployeeService(EmployeeModel: any): EmployeeService;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export class PayrollService {
|
|
2
|
-
constructor(PayrollModel: any, EmployeeService: any);
|
|
3
|
-
PayrollModel: any;
|
|
4
|
-
EmployeeService: any;
|
|
5
|
-
findById(payrollId: any): Promise<any>;
|
|
6
|
-
findByEmployee(employeeId: any, organizationId: any, options?: {}): Promise<any>;
|
|
7
|
-
findForPeriod(organizationId: any, month: any, year: any): Promise<any>;
|
|
8
|
-
findPending(organizationId: any, month: any, year: any): Promise<any>;
|
|
9
|
-
create(data: any): Promise<any>;
|
|
10
|
-
generateForEmployee(employeeId: any, organizationId: any, month: any, year: any): Promise<any>;
|
|
11
|
-
generateBatch(organizationId: any, month: any, year: any): Promise<{
|
|
12
|
-
success: boolean;
|
|
13
|
-
generated: number;
|
|
14
|
-
message: string;
|
|
15
|
-
payrolls?: undefined;
|
|
16
|
-
} | {
|
|
17
|
-
success: boolean;
|
|
18
|
-
generated: any;
|
|
19
|
-
payrolls: any;
|
|
20
|
-
message?: undefined;
|
|
21
|
-
}>;
|
|
22
|
-
markAsPaid(payrollId: any, paymentDetails?: {}): Promise<any>;
|
|
23
|
-
markAsProcessed(payrollId: any): Promise<any>;
|
|
24
|
-
calculatePeriodSummary(organizationId: any, month: any, year: any): Promise<any>;
|
|
25
|
-
getEmployeePayrollHistory(employeeId: any, organizationId: any, limit?: number): Promise<any>;
|
|
26
|
-
findByEmployeeAndPeriod(employeeId: any, organizationId: any, month: any, year: any): Promise<any>;
|
|
27
|
-
groupByStatus(payrolls: any): any;
|
|
28
|
-
getOverviewStats(organizationId: any): Promise<any>;
|
|
29
|
-
}
|
|
30
|
-
export function createPayrollService(PayrollModel: any, EmployeeService: any): PayrollService;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export function sum(items: any, key: any): any;
|
|
2
|
-
export function sumBy(key: any): (items: any) => any;
|
|
3
|
-
export function sumAllowances(items: any): any;
|
|
4
|
-
export function sumDeductions(items: any): any;
|
|
5
|
-
export function calculateGross(base: any, allowances: any): any;
|
|
6
|
-
export function calculateNet(gross: any, deductions: any): number;
|
|
7
|
-
export function calculateTotalCompensation(base: any, allowances: any, deductions: any): {
|
|
8
|
-
gross: any;
|
|
9
|
-
net: number;
|
|
10
|
-
deductions: any;
|
|
11
|
-
};
|
|
12
|
-
export function applyTaxBracket(amount: any, brackets: any): number;
|
|
13
|
-
export function calculateTax(amount: any, brackets: any): {
|
|
14
|
-
gross: any;
|
|
15
|
-
tax: number;
|
|
16
|
-
net: number;
|
|
17
|
-
};
|
|
18
|
-
export function proRateAmount(amount: any, workedDays: any, totalDays: any): number;
|
|
19
|
-
export function calculatePercentage(value: any, total: any): number;
|
|
20
|
-
export function applyPercentage(amount: any, percentage: any): number;
|
|
21
|
-
export function composeDeductions(...deductionFns: any[]): (amount: any) => any;
|
|
22
|
-
export function composeSalaryPipeline(base: any, operations: any): any;
|
|
23
|
-
export function createAllowanceCalculator(allowances: any): (base: any) => any;
|
|
24
|
-
export function createDeductionCalculator(deductions: any): (gross: any) => any;
|
|
25
|
-
export function pipe(...fns: any[]): (value: any) => any;
|
|
26
|
-
export function compose(...fns: any[]): (value: any) => any;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
export function addDays(date: any, days: any): Date;
|
|
2
|
-
export function addMonths(date: any, months: any): Date;
|
|
3
|
-
export function addYears(date: any, years: any): Date;
|
|
4
|
-
export function startOfMonth(date: any): Date;
|
|
5
|
-
export function endOfMonth(date: any): Date;
|
|
6
|
-
export function startOfYear(date: any): Date;
|
|
7
|
-
export function endOfYear(date: any): Date;
|
|
8
|
-
export function isWeekday(date: any): boolean;
|
|
9
|
-
export function isWeekend(date: any): boolean;
|
|
10
|
-
export function getPayPeriod(month: any, year: any): {
|
|
11
|
-
month: any;
|
|
12
|
-
year: any;
|
|
13
|
-
startDate: Date;
|
|
14
|
-
endDate: Date;
|
|
15
|
-
};
|
|
16
|
-
export function getCurrentPeriod(date?: Date): {
|
|
17
|
-
year: number;
|
|
18
|
-
month: number;
|
|
19
|
-
};
|
|
20
|
-
export function calculateProbationEnd(hireDate: any, probationMonths: any): Date;
|
|
21
|
-
export function formatDateForDB(date: any): string;
|
|
22
|
-
export function parseDBDate(dateString: any): Date;
|
|
23
|
-
export function diffInDays(start: any, end: any): number;
|
|
24
|
-
export function diffInMonths(start: any, end: any): number;
|
|
25
|
-
export function daysBetween(start: any, end: any): number;
|
|
26
|
-
export function monthsBetween(start: any, end: any): number;
|
|
27
|
-
export function isDateInRange(date: any, start: any, end: any): boolean;
|
|
28
|
-
export function formatPeriod({ month, year }: {
|
|
29
|
-
month: any;
|
|
30
|
-
year: any;
|
|
31
|
-
}): string;
|
|
32
|
-
export function parsePeriod(periodString: any): {
|
|
33
|
-
month: any;
|
|
34
|
-
year: any;
|
|
35
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Set custom logger implementation
|
|
3
|
-
* @param {Object} customLogger - Logger instance with info, warn, error, debug methods
|
|
4
|
-
*/
|
|
5
|
-
export function setLogger(customLogger: any): void;
|
|
6
|
-
export namespace logger {
|
|
7
|
-
function info(...args: any[]): void;
|
|
8
|
-
function warn(...args: any[]): void;
|
|
9
|
-
function error(...args: any[]): void;
|
|
10
|
-
function debug(...args: any[]): void;
|
|
11
|
-
}
|
|
12
|
-
export default logger;
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
export function toObjectId(id: any): mongoose.Types.ObjectId;
|
|
2
|
-
export class QueryBuilder {
|
|
3
|
-
constructor(initialQuery?: {});
|
|
4
|
-
query: {};
|
|
5
|
-
where(field: any, value: any): this;
|
|
6
|
-
whereIn(field: any, values: any): this;
|
|
7
|
-
whereNotIn(field: any, values: any): this;
|
|
8
|
-
whereGte(field: any, value: any): this;
|
|
9
|
-
whereLte(field: any, value: any): this;
|
|
10
|
-
whereBetween(field: any, start: any, end: any): this;
|
|
11
|
-
whereExists(field: any): this;
|
|
12
|
-
whereNotExists(field: any): this;
|
|
13
|
-
build(): {};
|
|
14
|
-
}
|
|
15
|
-
export function createQueryBuilder(initialQuery: any): QueryBuilder;
|
|
16
|
-
export class EmployeeQueryBuilder extends QueryBuilder {
|
|
17
|
-
forOrganization(organizationId: any): this;
|
|
18
|
-
forUser(userId: any): this;
|
|
19
|
-
withStatus(...statuses: any[]): this;
|
|
20
|
-
active(): this;
|
|
21
|
-
employed(): this;
|
|
22
|
-
inDepartment(department: any): this;
|
|
23
|
-
inPosition(position: any): this;
|
|
24
|
-
withEmploymentType(type: any): this;
|
|
25
|
-
hiredAfter(date: any): this;
|
|
26
|
-
hiredBefore(date: any): this;
|
|
27
|
-
}
|
|
28
|
-
export class PayrollQueryBuilder extends QueryBuilder {
|
|
29
|
-
forOrganization(organizationId: any): this;
|
|
30
|
-
forEmployee(employeeId: any): this;
|
|
31
|
-
forPeriod(month: any, year: any): this;
|
|
32
|
-
withStatus(...statuses: any[]): this;
|
|
33
|
-
paid(): this;
|
|
34
|
-
pending(): this;
|
|
35
|
-
inDateRange(start: any, end: any): this;
|
|
36
|
-
}
|
|
37
|
-
export function employee(): EmployeeQueryBuilder;
|
|
38
|
-
export function payroll(): PayrollQueryBuilder;
|
|
39
|
-
export function buildEmployeeQuery({ organizationId, userId, statuses }: {
|
|
40
|
-
organizationId: any;
|
|
41
|
-
userId: any;
|
|
42
|
-
statuses: any;
|
|
43
|
-
}): {};
|
|
44
|
-
export function buildPayrollQuery({ employeeId, period, statuses }: {
|
|
45
|
-
employeeId: any;
|
|
46
|
-
period: any;
|
|
47
|
-
statuses: any;
|
|
48
|
-
}): {};
|
|
49
|
-
export function buildAggregationPipeline(...stages: any[]): any[];
|
|
50
|
-
export function matchStage(query: any): {
|
|
51
|
-
$match: any;
|
|
52
|
-
};
|
|
53
|
-
export function groupStage(groupBy: any, aggregations: any): {
|
|
54
|
-
$group: any;
|
|
55
|
-
};
|
|
56
|
-
export function sortStage(sortBy: any): {
|
|
57
|
-
$sort: any;
|
|
58
|
-
};
|
|
59
|
-
export function limitStage(limit: any): {
|
|
60
|
-
$limit: any;
|
|
61
|
-
};
|
|
62
|
-
export function projectStage(fields: any): {
|
|
63
|
-
$project: any;
|
|
64
|
-
};
|
|
65
|
-
export function lookupStage({ from, localField, foreignField, as }: {
|
|
66
|
-
from: any;
|
|
67
|
-
localField: any;
|
|
68
|
-
foreignField: any;
|
|
69
|
-
as: any;
|
|
70
|
-
}): {
|
|
71
|
-
$lookup: {
|
|
72
|
-
from: any;
|
|
73
|
-
localField: any;
|
|
74
|
-
foreignField: any;
|
|
75
|
-
as: any;
|
|
76
|
-
};
|
|
77
|
-
};
|
|
78
|
-
export function unwindStage(path: any, options?: {}): {
|
|
79
|
-
$unwind: {
|
|
80
|
-
path: any;
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
import mongoose from 'mongoose';
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
export function isActive(employee: any): boolean;
|
|
2
|
-
export function isOnLeave(employee: any): boolean;
|
|
3
|
-
export function isSuspended(employee: any): boolean;
|
|
4
|
-
export function isTerminated(employee: any): boolean;
|
|
5
|
-
export function isEmployed(employee: any): boolean;
|
|
6
|
-
export function canReceiveSalary(employee: any): boolean;
|
|
7
|
-
export function canUpdateEmployment(employee: any): boolean;
|
|
8
|
-
export function isInProbation(employee: any, now?: Date): boolean;
|
|
9
|
-
export function hasCompletedProbation(employee: any, now?: Date): boolean;
|
|
10
|
-
export function hasCompensation(employee: any): boolean;
|
|
11
|
-
export function isEligibleForBonus(employee: any, requiredMonths?: number): boolean;
|
|
12
|
-
export function isValidCompensation(compensation: any): any;
|
|
13
|
-
export function isValidBankDetails(bankDetails: any): any;
|
|
14
|
-
export function hasRequiredFields(obj: any, fields: any): any;
|
|
15
|
-
export function createValidator(validationFns: any): (data: any) => {
|
|
16
|
-
isValid: boolean;
|
|
17
|
-
errors: {
|
|
18
|
-
field: string;
|
|
19
|
-
message: any;
|
|
20
|
-
}[];
|
|
21
|
-
};
|
|
22
|
-
export function required(fieldName: any): (value: any) => string | true;
|
|
23
|
-
export function min(minValue: any, fieldName: any): (value: any) => string | true;
|
|
24
|
-
export function max(maxValue: any, fieldName: any): (value: any) => string | true;
|
|
25
|
-
export function inRange(minValue: any, maxValue: any, fieldName: any): (value: any) => string | true;
|
|
26
|
-
export function oneOf(allowedValues: any, fieldName: any): (value: any) => string | true;
|
|
27
|
-
export function compose(...validators: any[]): (value: any, data: any) => any;
|
|
28
|
-
export function isPositive(fieldName: any): (value: any) => string | true;
|
|
29
|
-
export function isValidStatus(value: any): boolean;
|
|
30
|
-
export function isValidEmploymentType(value: any): boolean;
|
|
31
|
-
export function minValue(minValue: any, fieldName: any): (value: any) => string | true;
|
|
32
|
-
export function maxValue(maxValue: any, fieldName: any): (value: any) => string | true;
|
|
33
|
-
export function isInRange(minValue: any, maxValue: any, fieldName: any): (value: any) => string | true;
|
package/payroll.d.ts
DELETED
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type declarations for @classytic/payroll
|
|
3
|
-
* This provides IntelliSense support for the HRM library
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
declare module '@classytic/payroll' {
|
|
7
|
-
import { Model, Document } from 'mongoose';
|
|
8
|
-
|
|
9
|
-
// Initialization
|
|
10
|
-
export function initializeHRM(config: {
|
|
11
|
-
EmployeeModel: Model<any>;
|
|
12
|
-
PayrollRecordModel: Model<any>;
|
|
13
|
-
TransactionModel: Model<any>;
|
|
14
|
-
AttendanceModel?: Model<any> | null;
|
|
15
|
-
logger?: any;
|
|
16
|
-
}): void;
|
|
17
|
-
|
|
18
|
-
export function isInitialized(): boolean;
|
|
19
|
-
export function setLogger(logger: any): void;
|
|
20
|
-
|
|
21
|
-
// Models
|
|
22
|
-
export const PayrollRecord: Model<any>;
|
|
23
|
-
|
|
24
|
-
// Orchestrator
|
|
25
|
-
export const hrm: any;
|
|
26
|
-
export const hrmOrchestrator: any;
|
|
27
|
-
|
|
28
|
-
// Enums
|
|
29
|
-
export const EMPLOYMENT_TYPE: Record<string, string>;
|
|
30
|
-
export const EMPLOYMENT_TYPE_VALUES: string[];
|
|
31
|
-
export const EMPLOYEE_STATUS: Record<string, string>;
|
|
32
|
-
export const EMPLOYEE_STATUS_VALUES: string[];
|
|
33
|
-
export const DEPARTMENT: Record<string, string>;
|
|
34
|
-
export const DEPARTMENT_VALUES: string[];
|
|
35
|
-
export const PAYMENT_FREQUENCY: Record<string, string>;
|
|
36
|
-
export const PAYMENT_FREQUENCY_VALUES: string[];
|
|
37
|
-
export const PAYMENT_METHOD: Record<string, string>;
|
|
38
|
-
export const PAYMENT_METHOD_VALUES: string[];
|
|
39
|
-
export const ALLOWANCE_TYPE: Record<string, string>;
|
|
40
|
-
export const ALLOWANCE_TYPE_VALUES: string[];
|
|
41
|
-
export const DEDUCTION_TYPE: Record<string, string>;
|
|
42
|
-
export const DEDUCTION_TYPE_VALUES: string[];
|
|
43
|
-
export const PAYROLL_STATUS: Record<string, string>;
|
|
44
|
-
export const PAYROLL_STATUS_VALUES: string[];
|
|
45
|
-
export const TERMINATION_REASON: Record<string, string>;
|
|
46
|
-
export const TERMINATION_REASON_VALUES: string[];
|
|
47
|
-
export const HRM_TRANSACTION_CATEGORIES: Record<string, string>;
|
|
48
|
-
export const HRM_CATEGORY_VALUES: string[];
|
|
49
|
-
export function isHRMManagedCategory(category: string): boolean;
|
|
50
|
-
|
|
51
|
-
// Config
|
|
52
|
-
export const HRM_CONFIG: any;
|
|
53
|
-
export const SALARY_BANDS: any;
|
|
54
|
-
export const TAX_BRACKETS: any;
|
|
55
|
-
export const ORG_ROLES: Record<string, string>;
|
|
56
|
-
export const ORG_ROLE_KEYS: string[];
|
|
57
|
-
export const ROLE_MAPPING: Record<string, any>;
|
|
58
|
-
export function calculateTax(income: number): number;
|
|
59
|
-
export function getSalaryBand(salary: number): any;
|
|
60
|
-
export function determineOrgRole(role: string): string;
|
|
61
|
-
|
|
62
|
-
// Schemas
|
|
63
|
-
export const employmentFields: Record<string, any>;
|
|
64
|
-
export const allowanceSchema: any;
|
|
65
|
-
export const deductionSchema: any;
|
|
66
|
-
export const compensationSchema: any;
|
|
67
|
-
export const workScheduleSchema: any;
|
|
68
|
-
export const bankDetailsSchema: any;
|
|
69
|
-
export const employmentHistorySchema: any;
|
|
70
|
-
export const payrollStatsSchema: any;
|
|
71
|
-
|
|
72
|
-
// Plugins
|
|
73
|
-
export function employeePlugin(schema: any, options?: any): void;
|
|
74
|
-
|
|
75
|
-
// Utilities
|
|
76
|
-
export function addDays(date: Date, days: number): Date;
|
|
77
|
-
export function addMonths(date: Date, months: number): Date;
|
|
78
|
-
export function diffInDays(date1: Date, date2: Date): number;
|
|
79
|
-
export function diffInMonths(date1: Date, date2: Date): number;
|
|
80
|
-
export function startOfMonth(date: Date): Date;
|
|
81
|
-
export function endOfMonth(date: Date): Date;
|
|
82
|
-
export function startOfYear(date: Date): Date;
|
|
83
|
-
export function endOfYear(date: Date): Date;
|
|
84
|
-
export function isWeekday(date: Date): boolean;
|
|
85
|
-
export function isWeekend(date: Date): boolean;
|
|
86
|
-
export function getPayPeriod(date: Date, frequency: string): any;
|
|
87
|
-
export function getCurrentPeriod(frequency: string): any;
|
|
88
|
-
export function calculateProbationEnd(startDate: Date, months: number): Date;
|
|
89
|
-
export function formatDateForDB(date: Date): string;
|
|
90
|
-
export function parseDBDate(dateString: string): Date;
|
|
91
|
-
|
|
92
|
-
// Calculation utilities
|
|
93
|
-
export function sum(...numbers: number[]): number;
|
|
94
|
-
export function sumBy<T>(array: T[], iteratee: (item: T) => number): number;
|
|
95
|
-
export function sumAllowances(allowances: any[]): number;
|
|
96
|
-
export function sumDeductions(deductions: any[]): number;
|
|
97
|
-
export function calculateGross(baseSalary: number, allowances: any[]): number;
|
|
98
|
-
export function calculateNet(gross: number, deductions: any[]): number;
|
|
99
|
-
export function applyPercentage(amount: number, percentage: number): number;
|
|
100
|
-
export function calculatePercentage(part: number, total: number): number;
|
|
101
|
-
export function createAllowanceCalculator(config: any): (salary: number) => number;
|
|
102
|
-
export function createDeductionCalculator(config: any): (salary: number) => number;
|
|
103
|
-
export function calculateTotalCompensation(compensation: any): number;
|
|
104
|
-
export function pipe(...fns: Function[]): Function;
|
|
105
|
-
export function compose(...fns: Function[]): Function;
|
|
106
|
-
|
|
107
|
-
// Validation utilities
|
|
108
|
-
export function isActive(employee: any): boolean;
|
|
109
|
-
export function isOnLeave(employee: any): boolean;
|
|
110
|
-
export function isSuspended(employee: any): boolean;
|
|
111
|
-
export function isTerminated(employee: any): boolean;
|
|
112
|
-
export function isEmployed(employee: any): boolean;
|
|
113
|
-
export function canReceiveSalary(employee: any): boolean;
|
|
114
|
-
export function hasCompensation(employee: any): boolean;
|
|
115
|
-
export function required(value: any): boolean;
|
|
116
|
-
export function minValue(min: number): (value: number) => boolean;
|
|
117
|
-
export function maxValue(max: number): (value: number) => boolean;
|
|
118
|
-
export function isInRange(min: number, max: number): (value: number) => boolean;
|
|
119
|
-
export function isPositive(value: number): boolean;
|
|
120
|
-
export function isValidStatus(status: string): boolean;
|
|
121
|
-
export function isValidEmploymentType(type: string): boolean;
|
|
122
|
-
export function composeValidators(...validators: Function[]): Function;
|
|
123
|
-
|
|
124
|
-
// Query Builders
|
|
125
|
-
export class QueryBuilder {
|
|
126
|
-
where(conditions: any): this;
|
|
127
|
-
select(fields: string | string[]): this;
|
|
128
|
-
populate(paths: string | any[]): this;
|
|
129
|
-
sort(sort: any): this;
|
|
130
|
-
limit(limit: number): this;
|
|
131
|
-
skip(skip: number): this;
|
|
132
|
-
lean(lean?: boolean): this;
|
|
133
|
-
exec(): Promise<any>;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
export class EmployeeQueryBuilder extends QueryBuilder {
|
|
137
|
-
byOrganization(organizationId: string): this;
|
|
138
|
-
byStatus(status: string): this;
|
|
139
|
-
byDepartment(department: string): this;
|
|
140
|
-
active(): this;
|
|
141
|
-
terminated(): this;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
export class PayrollQueryBuilder extends QueryBuilder {
|
|
145
|
-
byEmployee(employeeId: string): this;
|
|
146
|
-
byPeriod(year: number, month: number): this;
|
|
147
|
-
byStatus(status: string): this;
|
|
148
|
-
pending(): this;
|
|
149
|
-
processed(): this;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
export function employee(model: Model<any>): EmployeeQueryBuilder;
|
|
153
|
-
export function payroll(model: Model<any>): PayrollQueryBuilder;
|
|
154
|
-
export function toObjectId(id: string): any;
|
|
155
|
-
|
|
156
|
-
// Factories
|
|
157
|
-
export class EmployeeFactory {
|
|
158
|
-
static create(data: any): any;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
export class EmployeeBuilder {
|
|
162
|
-
setBasicInfo(info: any): this;
|
|
163
|
-
setEmployment(employment: any): this;
|
|
164
|
-
setCompensation(compensation: any): this;
|
|
165
|
-
build(): any;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
export function createEmployee(data: any): any;
|
|
169
|
-
|
|
170
|
-
export class PayrollFactory {
|
|
171
|
-
static create(data: any): any;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
export class PayrollBuilder {
|
|
175
|
-
setEmployee(employeeId: string): this;
|
|
176
|
-
setPeriod(year: number, month: number): this;
|
|
177
|
-
setEarnings(earnings: any): this;
|
|
178
|
-
setDeductions(deductions: any): this;
|
|
179
|
-
build(): any;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
export class BatchPayrollFactory {
|
|
183
|
-
static createBatch(employees: any[], period: any): any[];
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
export function createPayroll(data: any): any;
|
|
187
|
-
|
|
188
|
-
export class CompensationFactory {
|
|
189
|
-
static create(data: any): any;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
export class CompensationBuilder {
|
|
193
|
-
setBaseSalary(amount: number): this;
|
|
194
|
-
addAllowance(allowance: any): this;
|
|
195
|
-
addDeduction(deduction: any): this;
|
|
196
|
-
build(): any;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
export const CompensationPresets: {
|
|
200
|
-
junior: (baseSalary: number) => any;
|
|
201
|
-
mid: (baseSalary: number) => any;
|
|
202
|
-
senior: (baseSalary: number) => any;
|
|
203
|
-
manager: (baseSalary: number) => any;
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
export function createCompensation(data: any): any;
|
|
207
|
-
|
|
208
|
-
// Services
|
|
209
|
-
export class EmployeeService {
|
|
210
|
-
constructor(model: Model<any>);
|
|
211
|
-
findById(id: string): Promise<any>;
|
|
212
|
-
findByOrganization(organizationId: string): Promise<any[]>;
|
|
213
|
-
create(data: any): Promise<any>;
|
|
214
|
-
update(id: string, data: any): Promise<any>;
|
|
215
|
-
delete(id: string): Promise<void>;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
export function createEmployeeService(model: Model<any>): EmployeeService;
|
|
219
|
-
|
|
220
|
-
export class PayrollService {
|
|
221
|
-
constructor(payrollModel: Model<any>, employeeModel: Model<any>);
|
|
222
|
-
processPayroll(employeeId: string, period: any): Promise<any>;
|
|
223
|
-
findByPeriod(organizationId: string, year: number, month: number): Promise<any[]>;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
export function createPayrollService(
|
|
227
|
-
payrollModel: Model<any>,
|
|
228
|
-
employeeModel: Model<any>
|
|
229
|
-
): PayrollService;
|
|
230
|
-
|
|
231
|
-
export class CompensationService {
|
|
232
|
-
constructor(employeeModel: Model<any>);
|
|
233
|
-
updateCompensation(employeeId: string, compensation: any): Promise<any>;
|
|
234
|
-
getCompensationHistory(employeeId: string): Promise<any[]>;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
export function createCompensationService(model: Model<any>): CompensationService;
|
|
238
|
-
|
|
239
|
-
export default hrm;
|
|
240
|
-
}
|
|
241
|
-
|