@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.

Potentially problematic release.


This version of @classytic/payroll might be problematic. Click here for more details.

Files changed (68) hide show
  1. package/README.md +168 -489
  2. package/dist/core/index.d.ts +480 -0
  3. package/dist/core/index.js +971 -0
  4. package/dist/core/index.js.map +1 -0
  5. package/dist/index-CTjHlCzz.d.ts +721 -0
  6. package/dist/index.d.ts +967 -0
  7. package/dist/index.js +4352 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/payroll.d.ts +233 -0
  10. package/dist/payroll.js +2103 -0
  11. package/dist/payroll.js.map +1 -0
  12. package/dist/plugin-D9mOr3_d.d.ts +333 -0
  13. package/dist/schemas/index.d.ts +2869 -0
  14. package/dist/schemas/index.js +440 -0
  15. package/dist/schemas/index.js.map +1 -0
  16. package/dist/services/index.d.ts +3 -0
  17. package/dist/services/index.js +1696 -0
  18. package/dist/services/index.js.map +1 -0
  19. package/dist/types-BSYyX2KJ.d.ts +671 -0
  20. package/dist/utils/index.d.ts +873 -0
  21. package/dist/utils/index.js +1046 -0
  22. package/dist/utils/index.js.map +1 -0
  23. package/package.json +54 -37
  24. package/dist/types/config.d.ts +0 -162
  25. package/dist/types/core/compensation.manager.d.ts +0 -54
  26. package/dist/types/core/employment.manager.d.ts +0 -49
  27. package/dist/types/core/payroll.manager.d.ts +0 -60
  28. package/dist/types/enums.d.ts +0 -117
  29. package/dist/types/factories/compensation.factory.d.ts +0 -196
  30. package/dist/types/factories/employee.factory.d.ts +0 -149
  31. package/dist/types/factories/payroll.factory.d.ts +0 -319
  32. package/dist/types/hrm.orchestrator.d.ts +0 -47
  33. package/dist/types/index.d.ts +0 -20
  34. package/dist/types/init.d.ts +0 -30
  35. package/dist/types/models/payroll-record.model.d.ts +0 -3
  36. package/dist/types/plugins/employee.plugin.d.ts +0 -2
  37. package/dist/types/schemas/employment.schema.d.ts +0 -959
  38. package/dist/types/services/compensation.service.d.ts +0 -94
  39. package/dist/types/services/employee.service.d.ts +0 -28
  40. package/dist/types/services/payroll.service.d.ts +0 -30
  41. package/dist/types/utils/calculation.utils.d.ts +0 -26
  42. package/dist/types/utils/date.utils.d.ts +0 -35
  43. package/dist/types/utils/logger.d.ts +0 -12
  44. package/dist/types/utils/query-builders.d.ts +0 -83
  45. package/dist/types/utils/validation.utils.d.ts +0 -33
  46. package/payroll.d.ts +0 -241
  47. package/src/config.js +0 -177
  48. package/src/core/compensation.manager.js +0 -242
  49. package/src/core/employment.manager.js +0 -224
  50. package/src/core/payroll.manager.js +0 -499
  51. package/src/enums.js +0 -141
  52. package/src/factories/compensation.factory.js +0 -198
  53. package/src/factories/employee.factory.js +0 -173
  54. package/src/factories/payroll.factory.js +0 -413
  55. package/src/hrm.orchestrator.js +0 -139
  56. package/src/index.js +0 -172
  57. package/src/init.js +0 -62
  58. package/src/models/payroll-record.model.js +0 -126
  59. package/src/plugins/employee.plugin.js +0 -164
  60. package/src/schemas/employment.schema.js +0 -126
  61. package/src/services/compensation.service.js +0 -231
  62. package/src/services/employee.service.js +0 -162
  63. package/src/services/payroll.service.js +0 -213
  64. package/src/utils/calculation.utils.js +0 -91
  65. package/src/utils/date.utils.js +0 -120
  66. package/src/utils/logger.js +0 -36
  67. package/src/utils/query-builders.js +0 -185
  68. package/src/utils/validation.utils.js +0 -122
@@ -1,413 +0,0 @@
1
- /**
2
- * Payroll Factory - Beautiful Salary Calculation & Record Creation
3
- * Clean, testable, immutable payroll object creation
4
- *
5
- * Compatible with Mongoose v8 and v9
6
- */
7
-
8
- import {
9
- calculateGross,
10
- calculateNet,
11
- createAllowanceCalculator,
12
- createDeductionCalculator,
13
- } from '../utils/calculation.utils.js';
14
-
15
- import { getPayPeriod } from '../utils/date.utils.js';
16
-
17
- /**
18
- * @typedef {Object} AllowanceInput
19
- * @property {string} type - Type of allowance
20
- * @property {string} [name] - Display name for the allowance
21
- * @property {number} value - Allowance value (amount or percentage)
22
- * @property {boolean} [isPercentage=false] - Whether value is a percentage
23
- */
24
-
25
- /**
26
- * @typedef {Object} DeductionInput
27
- * @property {string} type - Type of deduction
28
- * @property {string} [name] - Display name for the deduction
29
- * @property {number} value - Deduction value (amount or percentage)
30
- * @property {boolean} [isPercentage=false] - Whether value is a percentage
31
- */
32
-
33
- /**
34
- * @typedef {Object} PeriodInput
35
- * @property {number} [month] - Month (1-12)
36
- * @property {number} [year] - Year
37
- */
38
-
39
- /**
40
- * @typedef {Object} PayrollMetadata
41
- * @property {string} [currency='BDT'] - Currency code
42
- * @property {string} [paymentMethod] - Payment method
43
- * @property {string} [notes] - Additional notes
44
- */
45
-
46
- /**
47
- * @typedef {Object} PayrollRecord
48
- * @property {string} employeeId - Employee identifier
49
- * @property {string} organizationId - Organization identifier
50
- * @property {Object} period - Pay period information
51
- * @property {Object} breakdown - Salary breakdown
52
- * @property {number} breakdown.baseAmount - Base salary amount
53
- * @property {Array} breakdown.allowances - Calculated allowances
54
- * @property {Array} breakdown.deductions - Calculated deductions
55
- * @property {number} breakdown.grossSalary - Gross salary
56
- * @property {number} breakdown.netSalary - Net salary after deductions
57
- * @property {string} status - Payroll status ('pending', 'processed', 'paid')
58
- * @property {Date|null} processedAt - When payroll was processed
59
- * @property {Date|null} paidAt - When payment was made
60
- * @property {PayrollMetadata} metadata - Additional metadata
61
- */
62
-
63
- export class PayrollFactory {
64
- /**
65
- * Create a new payroll record
66
- *
67
- * @param {Object} params - Payroll parameters
68
- * @param {string} params.employeeId - Employee ID
69
- * @param {string} params.organizationId - Organization ID
70
- * @param {number} params.baseAmount - Base salary amount
71
- * @param {AllowanceInput[]} [params.allowances=[]] - Allowances array
72
- * @param {DeductionInput[]} [params.deductions=[]] - Deductions array
73
- * @param {PeriodInput} [params.period={}] - Pay period
74
- * @param {PayrollMetadata} [params.metadata={}] - Additional metadata
75
- * @returns {PayrollRecord} Payroll record object
76
- */
77
- static create({
78
- employeeId,
79
- organizationId,
80
- baseAmount,
81
- allowances = [],
82
- deductions = [],
83
- period = {},
84
- metadata = {},
85
- }) {
86
- const calculatedAllowances = this.calculateAllowances(baseAmount, allowances);
87
- const calculatedDeductions = this.calculateDeductions(baseAmount, deductions);
88
-
89
- const gross = calculateGross(baseAmount, calculatedAllowances);
90
- const net = calculateNet(gross, calculatedDeductions);
91
-
92
- return {
93
- employeeId,
94
- organizationId,
95
- period: this.createPeriod(period),
96
- breakdown: {
97
- baseAmount,
98
- allowances: calculatedAllowances,
99
- deductions: calculatedDeductions,
100
- grossSalary: gross,
101
- netSalary: net,
102
- },
103
- status: 'pending',
104
- processedAt: null,
105
- paidAt: null,
106
- metadata: {
107
- currency: metadata.currency || 'BDT',
108
- paymentMethod: metadata.paymentMethod,
109
- notes: metadata.notes,
110
- },
111
- };
112
- }
113
-
114
- /**
115
- * Create a pay period object
116
- *
117
- * @param {PeriodInput} [params={}] - Period parameters
118
- * @param {number} [params.month] - Month (defaults to current month)
119
- * @param {number} [params.year] - Year (defaults to current year)
120
- * @returns {Object} Pay period object with startDate, endDate, etc.
121
- */
122
- static createPeriod({ month, year } = {}) {
123
- const now = new Date();
124
- return getPayPeriod(
125
- month || now.getMonth() + 1,
126
- year || now.getFullYear()
127
- );
128
- }
129
-
130
- /**
131
- * Calculate allowances from base amount and allowance inputs
132
- *
133
- * @param {number} baseAmount - Base salary amount
134
- * @param {AllowanceInput[]} allowances - Array of allowances
135
- * @returns {Array} Calculated allowances with amounts
136
- */
137
- static calculateAllowances(baseAmount, allowances) {
138
- return allowances.map((allowance) => {
139
- const amount = allowance.isPercentage
140
- ? (baseAmount * allowance.value) / 100
141
- : allowance.value;
142
-
143
- return {
144
- type: allowance.type,
145
- name: allowance.name || allowance.type,
146
- amount,
147
- isPercentage: allowance.isPercentage || false,
148
- value: allowance.value,
149
- };
150
- });
151
- }
152
-
153
- /**
154
- * Calculate deductions from base amount and deduction inputs
155
- *
156
- * @param {number} baseAmount - Base salary amount
157
- * @param {DeductionInput[]} deductions - Array of deductions
158
- * @returns {Array} Calculated deductions with amounts
159
- */
160
- static calculateDeductions(baseAmount, deductions) {
161
- return deductions.map((deduction) => {
162
- const amount = deduction.isPercentage
163
- ? (baseAmount * deduction.value) / 100
164
- : deduction.value;
165
-
166
- return {
167
- type: deduction.type,
168
- name: deduction.name || deduction.type,
169
- amount,
170
- isPercentage: deduction.isPercentage || false,
171
- value: deduction.value,
172
- };
173
- });
174
- }
175
-
176
- /**
177
- * Create a bonus object
178
- *
179
- * @param {Object} params - Bonus parameters
180
- * @param {string} params.type - Bonus type
181
- * @param {number} params.amount - Bonus amount
182
- * @param {string} params.reason - Reason for bonus
183
- * @param {string} params.approvedBy - User who approved the bonus
184
- * @returns {Object} Bonus object
185
- */
186
- static createBonus({ type, amount, reason, approvedBy }) {
187
- return {
188
- type,
189
- amount,
190
- reason,
191
- approvedBy,
192
- approvedAt: new Date(),
193
- };
194
- }
195
-
196
- /**
197
- * Create a deduction object
198
- *
199
- * @param {Object} params - Deduction parameters
200
- * @param {string} params.type - Deduction type
201
- * @param {number} params.amount - Deduction amount
202
- * @param {string} params.reason - Reason for deduction
203
- * @param {string} params.appliedBy - User who applied the deduction
204
- * @returns {Object} Deduction object
205
- */
206
- static createDeduction({ type, amount, reason, appliedBy }) {
207
- return {
208
- type,
209
- amount,
210
- reason,
211
- appliedBy,
212
- appliedAt: new Date(),
213
- };
214
- }
215
-
216
- /**
217
- * Mark a payroll record as paid (immutable - returns new object)
218
- *
219
- * @param {PayrollRecord} payroll - Payroll record to mark as paid
220
- * @param {Object} [params={}] - Payment details
221
- * @param {Date} [params.paidAt] - Payment date (defaults to now)
222
- * @param {string} [params.transactionId] - Transaction ID
223
- * @param {string} [params.paymentMethod] - Payment method
224
- * @returns {PayrollRecord} New payroll record marked as paid
225
- */
226
- static markAsPaid(payroll, { paidAt = new Date(), transactionId, paymentMethod } = {}) {
227
- return {
228
- ...payroll,
229
- status: 'paid',
230
- paidAt,
231
- processedAt: payroll.processedAt || paidAt,
232
- metadata: {
233
- ...payroll.metadata,
234
- transactionId,
235
- paymentMethod: paymentMethod || payroll.metadata.paymentMethod,
236
- },
237
- };
238
- }
239
-
240
- /**
241
- * Mark a payroll record as processed (immutable - returns new object)
242
- *
243
- * @param {PayrollRecord} payroll - Payroll record to mark as processed
244
- * @param {Object} [params={}] - Processing details
245
- * @param {Date} [params.processedAt] - Processing date (defaults to now)
246
- * @returns {PayrollRecord} New payroll record marked as processed
247
- */
248
- static markAsProcessed(payroll, { processedAt = new Date() } = {}) {
249
- return {
250
- ...payroll,
251
- status: 'processed',
252
- processedAt,
253
- };
254
- }
255
- }
256
-
257
- /**
258
- * PayrollBuilder - Fluent builder pattern for creating payroll records
259
- *
260
- * @example
261
- * const payroll = createPayroll()
262
- * .forEmployee('emp-123')
263
- * .inOrganization('org-456')
264
- * .withBaseAmount(50000)
265
- * .addAllowance('housing', 10000)
266
- * .addDeduction('tax', 15, true)
267
- * .build();
268
- */
269
- export class PayrollBuilder {
270
- constructor() {
271
- this.data = {
272
- allowances: [],
273
- deductions: [],
274
- period: {},
275
- metadata: {},
276
- };
277
- }
278
-
279
- forEmployee(employeeId) {
280
- this.data.employeeId = employeeId;
281
- return this;
282
- }
283
-
284
- inOrganization(organizationId) {
285
- this.data.organizationId = organizationId;
286
- return this;
287
- }
288
-
289
- withBaseAmount(amount) {
290
- this.data.baseAmount = amount;
291
- return this;
292
- }
293
-
294
- forPeriod(month, year) {
295
- this.data.period = { month, year };
296
- return this;
297
- }
298
-
299
- addAllowance(type, value, isPercentage = false, name = null) {
300
- this.data.allowances.push({ type, value, isPercentage, name });
301
- return this;
302
- }
303
-
304
- addDeduction(type, value, isPercentage = false, name = null) {
305
- this.data.deductions.push({ type, value, isPercentage, name });
306
- return this;
307
- }
308
-
309
- addBonus(amount, reason, approvedBy) {
310
- this.data.allowances.push({
311
- type: 'bonus',
312
- value: amount,
313
- isPercentage: false,
314
- name: reason,
315
- });
316
- return this;
317
- }
318
-
319
- withCurrency(currency) {
320
- this.data.metadata.currency = currency;
321
- return this;
322
- }
323
-
324
- withPaymentMethod(method) {
325
- this.data.metadata.paymentMethod = method;
326
- return this;
327
- }
328
-
329
- withNotes(notes) {
330
- this.data.metadata.notes = notes;
331
- return this;
332
- }
333
-
334
- build() {
335
- return PayrollFactory.create(this.data);
336
- }
337
- }
338
-
339
- /**
340
- * Create a new PayrollBuilder instance
341
- *
342
- * @returns {PayrollBuilder} New builder instance
343
- */
344
- export const createPayroll = () => new PayrollBuilder();
345
-
346
- /**
347
- * BatchPayrollFactory - Process payroll for multiple employees at once
348
- *
349
- * @example
350
- * const payrolls = BatchPayrollFactory.createBatch(employees, {
351
- * month: 1,
352
- * year: 2025,
353
- * organizationId: 'org-123'
354
- * });
355
- */
356
- export class BatchPayrollFactory {
357
- /**
358
- * Create payroll records for multiple employees
359
- *
360
- * @param {Array} employees - Array of employee objects
361
- * @param {Object} params - Batch parameters
362
- * @param {number} params.month - Month for payroll
363
- * @param {number} params.year - Year for payroll
364
- * @param {string} params.organizationId - Organization ID
365
- * @returns {PayrollRecord[]} Array of payroll records
366
- */
367
- static createBatch(employees, { month, year, organizationId }) {
368
- return employees.map((employee) =>
369
- PayrollFactory.create({
370
- employeeId: employee._id || employee.userId,
371
- organizationId: organizationId || employee.organizationId,
372
- baseAmount: employee.compensation.baseAmount,
373
- allowances: employee.compensation.allowances || [],
374
- deductions: employee.compensation.deductions || [],
375
- period: { month, year },
376
- })
377
- );
378
- }
379
-
380
- /**
381
- * Calculate total payroll amounts across multiple records
382
- *
383
- * @param {PayrollRecord[]} payrolls - Array of payroll records
384
- * @returns {Object} Totals summary
385
- * @returns {number} return.count - Total number of payrolls
386
- * @returns {number} return.totalGross - Sum of gross salaries
387
- * @returns {number} return.totalNet - Sum of net salaries
388
- * @returns {number} return.totalAllowances - Sum of all allowances
389
- * @returns {number} return.totalDeductions - Sum of all deductions
390
- */
391
- static calculateTotalPayroll(payrolls) {
392
- return payrolls.reduce(
393
- (totals, payroll) => ({
394
- count: totals.count + 1,
395
- totalGross: totals.totalGross + payroll.breakdown.grossSalary,
396
- totalNet: totals.totalNet + payroll.breakdown.netSalary,
397
- totalAllowances:
398
- totals.totalAllowances +
399
- payroll.breakdown.allowances.reduce((sum, a) => sum + a.amount, 0),
400
- totalDeductions:
401
- totals.totalDeductions +
402
- payroll.breakdown.deductions.reduce((sum, d) => sum + d.amount, 0),
403
- }),
404
- {
405
- count: 0,
406
- totalGross: 0,
407
- totalNet: 0,
408
- totalAllowances: 0,
409
- totalDeductions: 0,
410
- }
411
- );
412
- }
413
- }
@@ -1,139 +0,0 @@
1
- import * as EmploymentManager from './core/employment.manager.js';
2
- import * as CompensationManager from './core/compensation.manager.js';
3
- import * as PayrollManager from './core/payroll.manager.js';
4
- import logger from './utils/logger.js';
5
-
6
- class HRMOrchestrator {
7
- constructor() {
8
- this._models = null;
9
- this._initialized = false;
10
- }
11
-
12
- configure({ EmployeeModel, PayrollRecordModel, TransactionModel, AttendanceModel = null }) {
13
- if (!EmployeeModel || !PayrollRecordModel || !TransactionModel) {
14
- throw new Error('EmployeeModel, PayrollRecordModel, and TransactionModel are required');
15
- }
16
-
17
- this._models = { EmployeeModel, PayrollRecordModel, TransactionModel, AttendanceModel };
18
- this._initialized = true;
19
-
20
- logger.info('HRM Orchestrator configured', {
21
- hasEmployeeModel: !!EmployeeModel,
22
- hasPayrollRecordModel: !!PayrollRecordModel,
23
- hasTransactionModel: !!TransactionModel,
24
- hasAttendanceModel: !!AttendanceModel,
25
- });
26
- }
27
-
28
- _ensureInitialized() {
29
- if (!this._initialized) {
30
- throw new Error(
31
- 'HRM Orchestrator not initialized. ' +
32
- 'Call initializeHRM({ EmployeeModel, PayrollRecordModel, TransactionModel }) in bootstrap.'
33
- );
34
- }
35
- }
36
-
37
- isInitialized() {
38
- return this._initialized;
39
- }
40
-
41
- async hire(params) {
42
- this._ensureInitialized();
43
- return await EmploymentManager.hireEmployee({ ...this._models, ...params });
44
- }
45
-
46
- async updateEmployment(params) {
47
- this._ensureInitialized();
48
- return await EmploymentManager.updateEmployment({ ...this._models, ...params });
49
- }
50
-
51
- async terminate(params) {
52
- this._ensureInitialized();
53
- return await EmploymentManager.terminateEmployee({ ...this._models, ...params });
54
- }
55
-
56
- async reHire(params) {
57
- this._ensureInitialized();
58
- return await EmploymentManager.reHireEmployee({ ...this._models, ...params });
59
- }
60
-
61
- async listEmployees(params) {
62
- this._ensureInitialized();
63
- return await EmploymentManager.getEmployeeList({ ...this._models, ...params });
64
- }
65
-
66
- async getEmployee(params) {
67
- this._ensureInitialized();
68
- return await EmploymentManager.getEmployeeById({ ...this._models, ...params });
69
- }
70
-
71
- async updateSalary(params) {
72
- this._ensureInitialized();
73
- return await CompensationManager.updateSalary({ ...this._models, ...params });
74
- }
75
-
76
- async addAllowance(params) {
77
- this._ensureInitialized();
78
- return await CompensationManager.addAllowance({ ...this._models, ...params });
79
- }
80
-
81
- async removeAllowance(params) {
82
- this._ensureInitialized();
83
- return await CompensationManager.removeAllowance({ ...this._models, ...params });
84
- }
85
-
86
- async addDeduction(params) {
87
- this._ensureInitialized();
88
- return await CompensationManager.addDeduction({ ...this._models, ...params });
89
- }
90
-
91
- async removeDeduction(params) {
92
- this._ensureInitialized();
93
- return await CompensationManager.removeDeduction({ ...this._models, ...params });
94
- }
95
-
96
- async updateBankDetails(params) {
97
- this._ensureInitialized();
98
- return await CompensationManager.updateBankDetails({ ...this._models, ...params });
99
- }
100
-
101
- async processSalary(params) {
102
- this._ensureInitialized();
103
- return await PayrollManager.processSalary({ ...this._models, ...params });
104
- }
105
-
106
- async processBulkPayroll(params) {
107
- this._ensureInitialized();
108
- return await PayrollManager.processBulkPayroll({ ...this._models, ...params });
109
- }
110
-
111
- async payrollHistory(params) {
112
- this._ensureInitialized();
113
- return await PayrollManager.getPayrollHistory({ ...this._models, ...params });
114
- }
115
-
116
- async payrollSummary(params) {
117
- this._ensureInitialized();
118
- return await PayrollManager.getPayrollSummary({ ...this._models, ...params });
119
- }
120
-
121
- async exportPayroll(params) {
122
- this._ensureInitialized();
123
- return await PayrollManager.exportPayrollData({ ...this._models, ...params });
124
- }
125
-
126
- getEmployeeModel() {
127
- this._ensureInitialized();
128
- return this._models.EmployeeModel;
129
- }
130
-
131
- getPayrollRecordModel() {
132
- this._ensureInitialized();
133
- return this._models.PayrollRecordModel;
134
- }
135
- }
136
-
137
- export const hrmOrchestrator = new HRMOrchestrator();
138
- export const hrm = hrmOrchestrator;
139
- export default hrm;
package/src/index.js DELETED
@@ -1,172 +0,0 @@
1
- export { initializeHRM, isInitialized } from './init.js';
2
-
3
- // Logger configuration (for custom logger injection)
4
- export { setLogger } from './utils/logger.js';
5
-
6
- export {
7
- EMPLOYMENT_TYPE,
8
- EMPLOYMENT_TYPE_VALUES,
9
- EMPLOYEE_STATUS,
10
- EMPLOYEE_STATUS_VALUES,
11
- DEPARTMENT,
12
- DEPARTMENT_VALUES,
13
- PAYMENT_FREQUENCY,
14
- PAYMENT_FREQUENCY_VALUES,
15
- PAYMENT_METHOD,
16
- PAYMENT_METHOD_VALUES,
17
- ALLOWANCE_TYPE,
18
- ALLOWANCE_TYPE_VALUES,
19
- DEDUCTION_TYPE,
20
- DEDUCTION_TYPE_VALUES,
21
- PAYROLL_STATUS,
22
- PAYROLL_STATUS_VALUES,
23
- TERMINATION_REASON,
24
- TERMINATION_REASON_VALUES,
25
- HRM_TRANSACTION_CATEGORIES,
26
- HRM_CATEGORY_VALUES,
27
- isHRMManagedCategory,
28
- } from './enums.js';
29
-
30
- export {
31
- HRM_CONFIG,
32
- SALARY_BANDS,
33
- TAX_BRACKETS,
34
- ORG_ROLES,
35
- ORG_ROLE_KEYS,
36
- ROLE_MAPPING,
37
- calculateTax,
38
- getSalaryBand,
39
- determineOrgRole,
40
- } from './config.js';
41
-
42
- export {
43
- employmentFields,
44
- allowanceSchema,
45
- deductionSchema,
46
- compensationSchema,
47
- workScheduleSchema,
48
- bankDetailsSchema,
49
- employmentHistorySchema,
50
- payrollStatsSchema,
51
- } from './schemas/employment.schema.js';
52
-
53
- export { employeePlugin } from './plugins/employee.plugin.js';
54
-
55
- export { default as PayrollRecord } from './models/payroll-record.model.js';
56
-
57
- export { hrm, hrmOrchestrator } from './hrm.orchestrator.js';
58
-
59
- import { hrm as hrmDefault } from './hrm.orchestrator.js';
60
- export default hrmDefault;
61
-
62
- // ============================================
63
- // Pure Utilities - Testable, Reusable Functions
64
- // ============================================
65
-
66
- export {
67
- addDays,
68
- addMonths,
69
- diffInDays,
70
- diffInMonths,
71
- startOfMonth,
72
- endOfMonth,
73
- startOfYear,
74
- endOfYear,
75
- isWeekday,
76
- isWeekend,
77
- getPayPeriod,
78
- getCurrentPeriod,
79
- calculateProbationEnd,
80
- formatDateForDB,
81
- parseDBDate,
82
- } from './utils/date.utils.js';
83
-
84
- export {
85
- sum,
86
- sumBy,
87
- sumAllowances,
88
- sumDeductions,
89
- calculateGross,
90
- calculateNet,
91
- applyPercentage,
92
- calculatePercentage,
93
- createAllowanceCalculator,
94
- createDeductionCalculator,
95
- calculateTotalCompensation,
96
- pipe,
97
- compose,
98
- } from './utils/calculation.utils.js';
99
-
100
- export {
101
- isActive,
102
- isOnLeave,
103
- isSuspended,
104
- isTerminated,
105
- isEmployed,
106
- canReceiveSalary,
107
- hasCompensation,
108
- required,
109
- minValue,
110
- maxValue,
111
- isInRange,
112
- isPositive,
113
- isValidStatus,
114
- isValidEmploymentType,
115
- compose as composeValidators,
116
- } from './utils/validation.utils.js';
117
-
118
- // ============================================
119
- // Query Builders - Fluent API for MongoDB
120
- // ============================================
121
-
122
- export {
123
- QueryBuilder,
124
- EmployeeQueryBuilder,
125
- PayrollQueryBuilder,
126
- employee,
127
- payroll,
128
- toObjectId,
129
- } from './utils/query-builders.js';
130
-
131
- // ============================================
132
- // Factory Methods - Clean Object Creation
133
- // ============================================
134
-
135
- export {
136
- EmployeeFactory,
137
- EmployeeBuilder,
138
- createEmployee,
139
- } from './factories/employee.factory.js';
140
-
141
- export {
142
- PayrollFactory,
143
- PayrollBuilder,
144
- BatchPayrollFactory,
145
- createPayroll,
146
- } from './factories/payroll.factory.js';
147
-
148
- export {
149
- CompensationFactory,
150
- CompensationBuilder,
151
- CompensationPresets,
152
- createCompensation,
153
- } from './factories/compensation.factory.js';
154
-
155
- // ============================================
156
- // Service Layer - Clean Abstractions with DI
157
- // ============================================
158
-
159
- export {
160
- EmployeeService,
161
- createEmployeeService,
162
- } from './services/employee.service.js';
163
-
164
- export {
165
- PayrollService,
166
- createPayrollService,
167
- } from './services/payroll.service.js';
168
-
169
- export {
170
- CompensationService,
171
- createCompensationService,
172
- } from './services/compensation.service.js';