formula-parser-payroll 2.1.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 +202 -0
- package/dist/database/database-connector.d.ts +60 -0
- package/dist/database/database-connector.d.ts.map +1 -0
- package/dist/database/database-connector.js +9 -0
- package/dist/database/database-connector.js.map +1 -0
- package/dist/database/helpers.d.ts +44 -0
- package/dist/database/helpers.d.ts.map +1 -0
- package/dist/database/helpers.js +120 -0
- package/dist/database/helpers.js.map +1 -0
- package/dist/database/index.d.ts +11 -0
- package/dist/database/index.d.ts.map +1 -0
- package/dist/database/index.js +29 -0
- package/dist/database/index.js.map +1 -0
- package/dist/database/payroll-formula.service.d.ts +118 -0
- package/dist/database/payroll-formula.service.d.ts.map +1 -0
- package/dist/database/payroll-formula.service.js +794 -0
- package/dist/database/payroll-formula.service.js.map +1 -0
- package/dist/database/types.d.ts +117 -0
- package/dist/database/types.d.ts.map +1 -0
- package/dist/database/types.js +9 -0
- package/dist/database/types.js.map +1 -0
- package/dist/formula-engine.d.ts +18 -0
- package/dist/formula-engine.d.ts.map +1 -0
- package/dist/formula-engine.js +356 -0
- package/dist/formula-engine.js.map +1 -0
- package/dist/formula-parser.d.ts +60 -0
- package/dist/formula-parser.d.ts.map +1 -0
- package/dist/formula-parser.js +366 -0
- package/dist/formula-parser.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -0
- package/dist/nestjs/database-connector.d.ts +60 -0
- package/dist/nestjs/database-connector.d.ts.map +1 -0
- package/dist/nestjs/database-connector.js +9 -0
- package/dist/nestjs/database-connector.js.map +1 -0
- package/dist/nestjs/helpers.d.ts +44 -0
- package/dist/nestjs/helpers.d.ts.map +1 -0
- package/dist/nestjs/helpers.js +120 -0
- package/dist/nestjs/helpers.js.map +1 -0
- package/dist/nestjs/index.d.ts +11 -0
- package/dist/nestjs/index.d.ts.map +1 -0
- package/dist/nestjs/index.js +29 -0
- package/dist/nestjs/index.js.map +1 -0
- package/dist/nestjs/payroll-formula.service.d.ts +91 -0
- package/dist/nestjs/payroll-formula.service.d.ts.map +1 -0
- package/dist/nestjs/payroll-formula.service.js +640 -0
- package/dist/nestjs/payroll-formula.service.js.map +1 -0
- package/dist/nestjs/types.d.ts +117 -0
- package/dist/nestjs/types.d.ts.map +1 -0
- package/dist/nestjs/types.js +9 -0
- package/dist/nestjs/types.js.map +1 -0
- package/dist/types.d.ts +168 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +9 -0
- package/dist/types.js.map +1 -0
- package/package.json +39 -0
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Payroll Formula Parser - Main Service
|
|
4
|
+
*
|
|
5
|
+
* This module contains the main formula parsing service that processes
|
|
6
|
+
* formulas with employee and organizational data.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.DEFAULT_RESERVED_WORDS = void 0;
|
|
10
|
+
exports.extractRequiredWords = extractRequiredWords;
|
|
11
|
+
exports.sortKeyByLengthDesc = sortKeyByLengthDesc;
|
|
12
|
+
exports.formatNameForFormula = formatNameForFormula;
|
|
13
|
+
exports.processPersonalData = processPersonalData;
|
|
14
|
+
exports.processOrganizationalData = processOrganizationalData;
|
|
15
|
+
exports.processCustomFields = processCustomFields;
|
|
16
|
+
exports.parsePayrollFormula = parsePayrollFormula;
|
|
17
|
+
const moment = require("moment");
|
|
18
|
+
const formula_engine_1 = require("./formula-engine");
|
|
19
|
+
/**
|
|
20
|
+
* Default reserved words for formula parsing
|
|
21
|
+
*/
|
|
22
|
+
exports.DEFAULT_RESERVED_WORDS = [
|
|
23
|
+
// Personal data
|
|
24
|
+
'AGE', 'BIRTHDATE', 'MARITALSTATUS', 'RELIGION', 'EMPGENDER', 'MALE', 'FEMALE', 'EMPNO',
|
|
25
|
+
// Dates
|
|
26
|
+
'EFFECTIVEDATE', 'ENDDATE', 'FULLJOINDATE', 'JOINDATE', 'PENSIONDATE', 'PERMANENTDATE', 'TERMINATEDATE',
|
|
27
|
+
// Job data
|
|
28
|
+
'JOBSTATUS', 'JOBSTATUSNAME',
|
|
29
|
+
// Organizational data
|
|
30
|
+
'COSTCENTER', 'COSTCENTERCODE', 'DEPTNAME', 'DEPTCODE', 'POSITIONNAME', 'POSITIONCODE',
|
|
31
|
+
'GRADE', 'GRDCODE', 'WORKLOCATION', 'WORKLOCATIONCODE', 'EMPLOYMENTSTATUS', 'CHILDDEPENDENTS',
|
|
32
|
+
// Custom fields
|
|
33
|
+
'CUSTOMFIELD1', 'CUSTOMFIELD2', 'CUSTOMFIELD3', 'CUSTOMFIELD4', 'CUSTOMFIELD5',
|
|
34
|
+
'CUSTOMFIELD6', 'CUSTOMFIELD7', 'CUSTOMFIELD8', 'CUSTOMFIELD9', 'CUSTOMFIELD10',
|
|
35
|
+
// Component codes (common patterns)
|
|
36
|
+
'SALARY',
|
|
37
|
+
];
|
|
38
|
+
/**
|
|
39
|
+
* Extract words that exist in the formula from a word list
|
|
40
|
+
*/
|
|
41
|
+
function extractRequiredWords(formula, wordList) {
|
|
42
|
+
const required = new Set();
|
|
43
|
+
if (!formula)
|
|
44
|
+
return required;
|
|
45
|
+
for (const word of wordList) {
|
|
46
|
+
if (formula.includes(word)) {
|
|
47
|
+
required.add(word);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return required;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Sort keys by length descending (for replacement order)
|
|
54
|
+
*/
|
|
55
|
+
function sortKeyByLengthDesc(keys) {
|
|
56
|
+
return [...keys].sort((a, b) => b.length - a.length);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Format name for formula with proper case handling
|
|
60
|
+
*/
|
|
61
|
+
function formatNameForFormula(name, formula) {
|
|
62
|
+
if (!name)
|
|
63
|
+
return '""';
|
|
64
|
+
const upperName = name.replace(/ /g, '').toUpperCase();
|
|
65
|
+
const normalName = name;
|
|
66
|
+
const hasUpperInFormula = formula.includes(`"${upperName}"`) ||
|
|
67
|
+
formula.includes(`'${upperName}'`);
|
|
68
|
+
if (hasUpperInFormula) {
|
|
69
|
+
return `"${upperName}"`;
|
|
70
|
+
}
|
|
71
|
+
return `"${normalName}"`;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Process personal data fields from employee data
|
|
75
|
+
*/
|
|
76
|
+
function processPersonalData(word, objectVal, empData) {
|
|
77
|
+
const personal = empData.personal || {};
|
|
78
|
+
const companyGroup = empData.companyGroup || {};
|
|
79
|
+
const jobStatus = empData.jobStatus || {};
|
|
80
|
+
switch (word) {
|
|
81
|
+
case 'AGE':
|
|
82
|
+
if (personal.birthdate) {
|
|
83
|
+
const birthYear = new Date(moment(personal.birthdate).format('YYYY')).getFullYear();
|
|
84
|
+
const currentYear = new Date().getFullYear();
|
|
85
|
+
objectVal[word] = String(currentYear - birthYear);
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
objectVal[word] = '0';
|
|
89
|
+
}
|
|
90
|
+
break;
|
|
91
|
+
case 'BIRTHDATE':
|
|
92
|
+
objectVal[word] = personal.birthdate
|
|
93
|
+
? `"${moment(personal.birthdate).format('YYYY-MM-DD')}"`
|
|
94
|
+
: '""';
|
|
95
|
+
break;
|
|
96
|
+
case 'MARITALSTATUS':
|
|
97
|
+
objectVal[word] = personal.maritalstatus
|
|
98
|
+
? String(personal.maritalstatus)
|
|
99
|
+
: '0';
|
|
100
|
+
break;
|
|
101
|
+
case 'RELIGION':
|
|
102
|
+
objectVal[word] = personal.religionCode
|
|
103
|
+
? `"${String(personal.religionCode)}"`
|
|
104
|
+
: '""';
|
|
105
|
+
break;
|
|
106
|
+
case 'EMPGENDER':
|
|
107
|
+
if (personal.gender === 'MALE' || personal.gender === 1) {
|
|
108
|
+
objectVal[word] = '"MALE"';
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
objectVal[word] = '"FEMALE"';
|
|
112
|
+
}
|
|
113
|
+
break;
|
|
114
|
+
case 'MALE':
|
|
115
|
+
case 'FEMALE':
|
|
116
|
+
objectVal[word] = word;
|
|
117
|
+
break;
|
|
118
|
+
case 'EMPNO':
|
|
119
|
+
objectVal[word] = `"${empData.empNo || ''}"`;
|
|
120
|
+
break;
|
|
121
|
+
case 'EFFECTIVEDATE':
|
|
122
|
+
objectVal[word] = empData.startDate
|
|
123
|
+
? moment(empData.startDate).format('"M/D/YYYY"')
|
|
124
|
+
: '""';
|
|
125
|
+
break;
|
|
126
|
+
case 'ENDDATE':
|
|
127
|
+
objectVal[word] = empData.endDate
|
|
128
|
+
? moment(empData.endDate).format('"M/D/YYYY"')
|
|
129
|
+
: '""';
|
|
130
|
+
break;
|
|
131
|
+
case 'FULLJOINDATE':
|
|
132
|
+
objectVal[word] = companyGroup.fulljoinDate
|
|
133
|
+
? moment(companyGroup.fulljoinDate).format('"M/D/YYYY"')
|
|
134
|
+
: '""';
|
|
135
|
+
break;
|
|
136
|
+
case 'JOINDATE':
|
|
137
|
+
objectVal[word] = companyGroup.joinDate
|
|
138
|
+
? moment(companyGroup.joinDate).format('"M/D/YYYY"')
|
|
139
|
+
: '""';
|
|
140
|
+
break;
|
|
141
|
+
case 'PENSIONDATE':
|
|
142
|
+
objectVal[word] = companyGroup.pensionDate
|
|
143
|
+
? moment(companyGroup.pensionDate).format('"M/D/YYYY"')
|
|
144
|
+
: '""';
|
|
145
|
+
break;
|
|
146
|
+
case 'PERMANENTDATE':
|
|
147
|
+
objectVal[word] = companyGroup.permanentDate
|
|
148
|
+
? moment(companyGroup.permanentDate).format('"M/D/YYYY"')
|
|
149
|
+
: '""';
|
|
150
|
+
break;
|
|
151
|
+
case 'TERMINATEDATE':
|
|
152
|
+
objectVal[word] = companyGroup.terminateDate
|
|
153
|
+
? moment(companyGroup.terminateDate).format('"M/D/YYYY"')
|
|
154
|
+
: '""';
|
|
155
|
+
break;
|
|
156
|
+
case 'JOBSTATUS':
|
|
157
|
+
objectVal[word] = empData.jobStatusCode || '""';
|
|
158
|
+
break;
|
|
159
|
+
case 'JOBSTATUSNAME':
|
|
160
|
+
objectVal[word] = jobStatus.jobstatusnameEn
|
|
161
|
+
? `"${jobStatus.jobstatusnameEn}"`
|
|
162
|
+
: '""';
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Process organizational data fields
|
|
168
|
+
*/
|
|
169
|
+
function processOrganizationalData(word, objectVal, orgData, formula) {
|
|
170
|
+
const position = orgData.position || {};
|
|
171
|
+
const costCenter = orgData.costCenter || {};
|
|
172
|
+
const grade = orgData.grade || {};
|
|
173
|
+
const workLocation = orgData.workLocation || {};
|
|
174
|
+
switch (word) {
|
|
175
|
+
case 'COSTCENTER':
|
|
176
|
+
objectVal[word] = costCenter.costcenterNameEn
|
|
177
|
+
? formatNameForFormula(costCenter.costcenterNameEn, formula)
|
|
178
|
+
: '""';
|
|
179
|
+
break;
|
|
180
|
+
case 'COSTCENTERCODE':
|
|
181
|
+
objectVal[word] = costCenter.costcenterCode
|
|
182
|
+
? formatNameForFormula(costCenter.costcenterCode, formula)
|
|
183
|
+
: '""';
|
|
184
|
+
break;
|
|
185
|
+
case 'DEPTNAME':
|
|
186
|
+
objectVal[word] = position.dept?.posNameEn
|
|
187
|
+
? formatNameForFormula(position.dept.posNameEn, formula)
|
|
188
|
+
: '""';
|
|
189
|
+
break;
|
|
190
|
+
case 'DEPTCODE':
|
|
191
|
+
objectVal[word] = position.dept?.posCode
|
|
192
|
+
? formatNameForFormula(position.dept.posCode, formula)
|
|
193
|
+
: '""';
|
|
194
|
+
break;
|
|
195
|
+
case 'POSITIONNAME':
|
|
196
|
+
objectVal[word] = position.posNameEn
|
|
197
|
+
? formatNameForFormula(position.posNameEn, formula)
|
|
198
|
+
: '""';
|
|
199
|
+
break;
|
|
200
|
+
case 'POSITIONCODE':
|
|
201
|
+
objectVal[word] = position.posCode
|
|
202
|
+
? formatNameForFormula(position.posCode, formula)
|
|
203
|
+
: '""';
|
|
204
|
+
break;
|
|
205
|
+
case 'GRADE':
|
|
206
|
+
objectVal[word] = grade.gradeName
|
|
207
|
+
? formatNameForFormula(grade.gradeName, formula)
|
|
208
|
+
: '""';
|
|
209
|
+
break;
|
|
210
|
+
case 'GRDCODE':
|
|
211
|
+
objectVal[word] = grade.gradeCode
|
|
212
|
+
? `"${grade.gradeCode}"`
|
|
213
|
+
: '""';
|
|
214
|
+
break;
|
|
215
|
+
case 'WORKLOCATION':
|
|
216
|
+
objectVal[word] = workLocation.worklocationName
|
|
217
|
+
? `"${workLocation.worklocationName}"`
|
|
218
|
+
: '""';
|
|
219
|
+
break;
|
|
220
|
+
case 'WORKLOCATIONCODE':
|
|
221
|
+
objectVal[word] = workLocation.worklocationCode
|
|
222
|
+
? formatNameForFormula(workLocation.worklocationCode, formula)
|
|
223
|
+
: '""';
|
|
224
|
+
break;
|
|
225
|
+
case 'EMPLOYMENTSTATUS':
|
|
226
|
+
objectVal[word] = orgData.employmentStatus
|
|
227
|
+
? `"${orgData.employmentStatus.replace(/ /g, '').toUpperCase()}"`
|
|
228
|
+
: '""';
|
|
229
|
+
break;
|
|
230
|
+
case 'CHILDDEPENDENTS':
|
|
231
|
+
objectVal[word] = `"${orgData.childDependents || 0}"`;
|
|
232
|
+
break;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Process custom field data
|
|
237
|
+
*/
|
|
238
|
+
function processCustomFields(word, objectVal, orgData) {
|
|
239
|
+
if (!word.includes('CUSTOMFIELD') || !orgData.customField) {
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
const fieldMapping = {
|
|
243
|
+
'CUSTOMFIELD1': 'customfield1',
|
|
244
|
+
'CUSTOMFIELD2': 'customfield2',
|
|
245
|
+
'CUSTOMFIELD3': 'customfield3',
|
|
246
|
+
'CUSTOMFIELD4': 'customfield4',
|
|
247
|
+
'CUSTOMFIELD5': 'customfield5',
|
|
248
|
+
'CUSTOMFIELD6': 'customfield6',
|
|
249
|
+
'CUSTOMFIELD7': 'customfield7',
|
|
250
|
+
'CUSTOMFIELD8': 'customfield8',
|
|
251
|
+
'CUSTOMFIELD9': 'customfield9',
|
|
252
|
+
'CUSTOMFIELD10': 'customfield10',
|
|
253
|
+
};
|
|
254
|
+
const fieldKey = fieldMapping[word];
|
|
255
|
+
if (fieldKey && orgData.customField) {
|
|
256
|
+
const value = orgData.customField[fieldKey];
|
|
257
|
+
objectVal[word] = value ? `"${value}"` : '""';
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Main formula parsing function
|
|
262
|
+
*
|
|
263
|
+
* @param input - The input containing formula, employee data, and component values
|
|
264
|
+
* @returns The result of formula parsing
|
|
265
|
+
*
|
|
266
|
+
* @example
|
|
267
|
+
* ```typescript
|
|
268
|
+
* const result = parsePayrollFormula({
|
|
269
|
+
* formula: 'SALARY * 0.1 + AL_001',
|
|
270
|
+
* employeeData: {
|
|
271
|
+
* empId: 'EMP001',
|
|
272
|
+
* empNo: '12345',
|
|
273
|
+
* personal: { gender: 'MALE' }
|
|
274
|
+
* },
|
|
275
|
+
* componentValues: {
|
|
276
|
+
* 'SALARY': 5000000,
|
|
277
|
+
* 'AL_001': 500000
|
|
278
|
+
* }
|
|
279
|
+
* });
|
|
280
|
+
* console.log(result.result); // 1000000
|
|
281
|
+
* ```
|
|
282
|
+
*/
|
|
283
|
+
function parsePayrollFormula(input) {
|
|
284
|
+
try {
|
|
285
|
+
const { formula: rawFormula, employeeData, organizationalData = {}, componentValues = {}, reservedWords = exports.DEFAULT_RESERVED_WORDS, } = input;
|
|
286
|
+
// Normalize formula - replace " with '
|
|
287
|
+
let formula = rawFormula.replace(/"/g, "'");
|
|
288
|
+
// Initialize object values with component values
|
|
289
|
+
const objectVal = {};
|
|
290
|
+
// Add all component values
|
|
291
|
+
for (const [code, value] of Object.entries(componentValues)) {
|
|
292
|
+
objectVal[code] = String(value);
|
|
293
|
+
}
|
|
294
|
+
// Get all words from formula and reserved words list
|
|
295
|
+
const allWords = [...reservedWords, ...Object.keys(componentValues)];
|
|
296
|
+
const requiredWords = extractRequiredWords(formula, allWords);
|
|
297
|
+
// Process each required word
|
|
298
|
+
for (const word of requiredWords) {
|
|
299
|
+
// Process personal data
|
|
300
|
+
processPersonalData(word, objectVal, employeeData);
|
|
301
|
+
// Process organizational data
|
|
302
|
+
processOrganizationalData(word, objectVal, organizationalData, formula);
|
|
303
|
+
// Process custom fields
|
|
304
|
+
processCustomFields(word, objectVal, organizationalData);
|
|
305
|
+
}
|
|
306
|
+
// Handle quoted strings replacement
|
|
307
|
+
const regexKutip = /"(.*?)"/g;
|
|
308
|
+
let match;
|
|
309
|
+
const objectX = {};
|
|
310
|
+
let arr = 0;
|
|
311
|
+
const replacements = {};
|
|
312
|
+
while ((match = regexKutip.exec(formula))) {
|
|
313
|
+
replacements[`${match[1]}`] = 'PART' + arr;
|
|
314
|
+
objectX['PART' + arr] = `${match[1]}`;
|
|
315
|
+
arr++;
|
|
316
|
+
}
|
|
317
|
+
const hasReplacements = Object.values(replacements).some(value => value !== undefined && value !== '');
|
|
318
|
+
if (hasReplacements) {
|
|
319
|
+
const regex = new RegExp(Object.keys(replacements).join('|'), 'g');
|
|
320
|
+
formula = formula.replace(regex, m => replacements[m]);
|
|
321
|
+
}
|
|
322
|
+
// Extract formula tokens
|
|
323
|
+
const formula2 = formula.match(/[a-zA-Z0-9_]+|[+\-*/]/g) || [];
|
|
324
|
+
let keys = Object.keys(objectVal);
|
|
325
|
+
keys = sortKeyByLengthDesc(keys);
|
|
326
|
+
// Build replacement map
|
|
327
|
+
const replacementMap = new Map();
|
|
328
|
+
for (const wordnya of formula2) {
|
|
329
|
+
if (keys.includes(wordnya) && wordnya !== 'LENGTHOFSERVICE' && !replacementMap.has(wordnya)) {
|
|
330
|
+
replacementMap.set(wordnya, objectVal[wordnya].toString());
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
// Single-pass replacement
|
|
334
|
+
if (replacementMap.size > 0) {
|
|
335
|
+
const pattern = Array.from(replacementMap.keys())
|
|
336
|
+
.map(word => `\\b${word.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}\\b`)
|
|
337
|
+
.join('|');
|
|
338
|
+
const regex = new RegExp(pattern, 'g');
|
|
339
|
+
formula = formula.replace(regex, m => replacementMap.get(m) || m);
|
|
340
|
+
}
|
|
341
|
+
// Restore quoted strings
|
|
342
|
+
const keys2 = Object.keys(objectX);
|
|
343
|
+
if (keys2.length > 0) {
|
|
344
|
+
keys2.forEach(key => {
|
|
345
|
+
formula = formula.replace(new RegExp(key, 'g'), `${objectX[key]}`);
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
// Parse and evaluate the formula
|
|
349
|
+
const result = (0, formula_engine_1.parseFormula)(formula);
|
|
350
|
+
return {
|
|
351
|
+
result,
|
|
352
|
+
message: 'success',
|
|
353
|
+
success: true,
|
|
354
|
+
processedFormula: formula,
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
catch (error) {
|
|
358
|
+
const err = error;
|
|
359
|
+
return {
|
|
360
|
+
result: 0,
|
|
361
|
+
message: err.message || 'Unknown error occurred',
|
|
362
|
+
success: false,
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
//# sourceMappingURL=formula-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formula-parser.js","sourceRoot":"","sources":["../src/formula-parser.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAuCH,oDAYC;AAKD,kDAEC;AAKD,oDAcC;AAKD,kDA2GC;AAKD,8DAkFC;AAKD,kDA2BC;AAyBD,kDA4GC;AAvbD,iCAAkC;AAClC,qDAAgD;AAQhD;;GAEG;AACU,QAAA,sBAAsB,GAAa;IAC9C,gBAAgB;IAChB,KAAK,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,IAAI,wBAAwB;YAChD,OAAO,EAAE,KAAK;SACf,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* payroll-formula-parser
|
|
3
|
+
*
|
|
4
|
+
* A lightweight payroll formula parser for GreatDay HR.
|
|
5
|
+
* Parse and evaluate payroll formulas with employee data variables.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
export * from './types';
|
|
10
|
+
export { parseFormula, getParser } from './formula-engine';
|
|
11
|
+
export { parsePayrollFormula, extractRequiredWords, sortKeyByLengthDesc, formatNameForFormula, processPersonalData, processOrganizationalData, processCustomFields, DEFAULT_RESERVED_WORDS, } from './formula-parser';
|
|
12
|
+
export * from './database';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,cAAc,SAAS,CAAC;AAGxB,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAG3D,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,yBAAyB,EACzB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,kBAAkB,CAAC;AAG1B,cAAc,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* payroll-formula-parser
|
|
4
|
+
*
|
|
5
|
+
* A lightweight payroll formula parser for GreatDay HR.
|
|
6
|
+
* Parse and evaluate payroll formulas with employee data variables.
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
10
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
13
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
14
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
15
|
+
}
|
|
16
|
+
Object.defineProperty(o, k2, desc);
|
|
17
|
+
}) : (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
o[k2] = m[k];
|
|
20
|
+
}));
|
|
21
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
22
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.DEFAULT_RESERVED_WORDS = exports.processCustomFields = exports.processOrganizationalData = exports.processPersonalData = exports.formatNameForFormula = exports.sortKeyByLengthDesc = exports.extractRequiredWords = exports.parsePayrollFormula = exports.getParser = exports.parseFormula = void 0;
|
|
26
|
+
// Export types
|
|
27
|
+
__exportStar(require("./types"), exports);
|
|
28
|
+
// Export formula engine
|
|
29
|
+
var formula_engine_1 = require("./formula-engine");
|
|
30
|
+
Object.defineProperty(exports, "parseFormula", { enumerable: true, get: function () { return formula_engine_1.parseFormula; } });
|
|
31
|
+
Object.defineProperty(exports, "getParser", { enumerable: true, get: function () { return formula_engine_1.getParser; } });
|
|
32
|
+
// Export formula parser
|
|
33
|
+
var formula_parser_1 = require("./formula-parser");
|
|
34
|
+
Object.defineProperty(exports, "parsePayrollFormula", { enumerable: true, get: function () { return formula_parser_1.parsePayrollFormula; } });
|
|
35
|
+
Object.defineProperty(exports, "extractRequiredWords", { enumerable: true, get: function () { return formula_parser_1.extractRequiredWords; } });
|
|
36
|
+
Object.defineProperty(exports, "sortKeyByLengthDesc", { enumerable: true, get: function () { return formula_parser_1.sortKeyByLengthDesc; } });
|
|
37
|
+
Object.defineProperty(exports, "formatNameForFormula", { enumerable: true, get: function () { return formula_parser_1.formatNameForFormula; } });
|
|
38
|
+
Object.defineProperty(exports, "processPersonalData", { enumerable: true, get: function () { return formula_parser_1.processPersonalData; } });
|
|
39
|
+
Object.defineProperty(exports, "processOrganizationalData", { enumerable: true, get: function () { return formula_parser_1.processOrganizationalData; } });
|
|
40
|
+
Object.defineProperty(exports, "processCustomFields", { enumerable: true, get: function () { return formula_parser_1.processCustomFields; } });
|
|
41
|
+
Object.defineProperty(exports, "DEFAULT_RESERVED_WORDS", { enumerable: true, get: function () { return formula_parser_1.DEFAULT_RESERVED_WORDS; } });
|
|
42
|
+
// Export database-integrated module (works with any framework)
|
|
43
|
+
__exportStar(require("./database"), exports);
|
|
44
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;;;;;;;;;;;AAEH,eAAe;AACf,0CAAwB;AAExB,wBAAwB;AACxB,mDAA2D;AAAlD,8GAAA,YAAY,OAAA;AAAE,2GAAA,SAAS,OAAA;AAEhC,wBAAwB;AACxB,mDAS0B;AARxB,qHAAA,mBAAmB,OAAA;AACnB,sHAAA,oBAAoB,OAAA;AACpB,qHAAA,mBAAmB,OAAA;AACnB,sHAAA,oBAAoB,OAAA;AACpB,qHAAA,mBAAmB,OAAA;AACnB,2HAAA,yBAAyB,OAAA;AACzB,qHAAA,mBAAmB,OAAA;AACnB,wHAAA,sBAAsB,OAAA;AAGxB,+DAA+D;AAC/D,6CAA2B"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Database Connector Interface
|
|
3
|
+
*
|
|
4
|
+
* Generic database connector that can work with any database client
|
|
5
|
+
* (MySQL2, TypeORM, Knex, Sequelize, etc.)
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Generic database connection interface
|
|
9
|
+
* Any database client that implements this interface can be used
|
|
10
|
+
*/
|
|
11
|
+
export interface IDatabaseConnection {
|
|
12
|
+
/**
|
|
13
|
+
* Execute a raw SQL query with optional parameters
|
|
14
|
+
* @param sql SQL query string with placeholders (?)
|
|
15
|
+
* @param params Query parameters
|
|
16
|
+
* @returns Promise with query results
|
|
17
|
+
*/
|
|
18
|
+
query<T = any>(sql: string, params?: any[]): Promise<T[]>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Configuration for database connections
|
|
22
|
+
*/
|
|
23
|
+
export interface DatabaseConfig {
|
|
24
|
+
/** Main database connection (for employee/organization data) */
|
|
25
|
+
mainConnection: IDatabaseConnection;
|
|
26
|
+
/** Finance database connection (for payroll/component data) */
|
|
27
|
+
financeConnection: IDatabaseConnection;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Company and user context for queries
|
|
31
|
+
*/
|
|
32
|
+
export interface CompanyContext {
|
|
33
|
+
/** Company ID */
|
|
34
|
+
companyId: string | number;
|
|
35
|
+
/** Company Code */
|
|
36
|
+
companyCode: string;
|
|
37
|
+
/** Tax Country Code (ID, TH, MY, PH) */
|
|
38
|
+
taxCountry: 'ID' | 'TH' | 'MY' | 'PH';
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Encryption configuration for decrypting component values
|
|
42
|
+
*/
|
|
43
|
+
export interface EncryptionConfig {
|
|
44
|
+
/** P Number for decryption function */
|
|
45
|
+
pNumber: string;
|
|
46
|
+
/** L Number for decryption function */
|
|
47
|
+
lNumber: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Complete context for formula parsing with database
|
|
51
|
+
*/
|
|
52
|
+
export interface FormulaContext {
|
|
53
|
+
/** Database connections */
|
|
54
|
+
database: DatabaseConfig;
|
|
55
|
+
/** Company and user context */
|
|
56
|
+
company: CompanyContext;
|
|
57
|
+
/** Encryption config (optional - needed only if components are encrypted) */
|
|
58
|
+
encryption?: EncryptionConfig;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=database-connector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database-connector.d.ts","sourceRoot":"","sources":["../../src/nestjs/database-connector.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;;OAKG;IACH,KAAK,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;CAC3D;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,gEAAgE;IAChE,cAAc,EAAE,mBAAmB,CAAC;IAEpC,+DAA+D;IAC/D,iBAAiB,EAAE,mBAAmB,CAAC;CACxC;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,iBAAiB;IACjB,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IAE3B,mBAAmB;IACnB,WAAW,EAAE,MAAM,CAAC;IAEpB,wCAAwC;IACxC,UAAU,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;CACvC;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,uCAAuC;IACvC,OAAO,EAAE,MAAM,CAAC;IAEhB,uCAAuC;IACvC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,2BAA2B;IAC3B,QAAQ,EAAE,cAAc,CAAC;IAEzB,+BAA+B;IAC/B,OAAO,EAAE,cAAc,CAAC;IAExB,6EAA6E;IAC7E,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC/B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Database Connector Interface
|
|
4
|
+
*
|
|
5
|
+
* Generic database connector that can work with any database client
|
|
6
|
+
* (MySQL2, TypeORM, Knex, Sequelize, etc.)
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
//# sourceMappingURL=database-connector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database-connector.js","sourceRoot":"","sources":["../../src/nestjs/database-connector.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NestJS Module Helpers for Payroll Formula Parser
|
|
3
|
+
*
|
|
4
|
+
* Helper functions for database operations and data processing.
|
|
5
|
+
*/
|
|
6
|
+
import { AuthContext, FormulaContext } from './types';
|
|
7
|
+
/**
|
|
8
|
+
* Get currency code based on tax country
|
|
9
|
+
*/
|
|
10
|
+
export declare function getCurrencyCode(taxCountry: string): string;
|
|
11
|
+
/**
|
|
12
|
+
* Decrypt a value using database function
|
|
13
|
+
*/
|
|
14
|
+
export declare function decryptValue(value: string, auth: AuthContext, empId: string): Promise<number>;
|
|
15
|
+
/**
|
|
16
|
+
* Check if position-related data is needed
|
|
17
|
+
*/
|
|
18
|
+
export declare function needsPositionData(words: Set<string>): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Check if cost center data is needed
|
|
21
|
+
*/
|
|
22
|
+
export declare function needsCostCenterData(words: Set<string>): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Check if grade data is needed
|
|
25
|
+
*/
|
|
26
|
+
export declare function needsGradeData(words: Set<string>): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Check if work location data is needed
|
|
29
|
+
*/
|
|
30
|
+
export declare function needsWorkLocationData(words: Set<string>): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Check if custom field data is needed
|
|
33
|
+
*/
|
|
34
|
+
export declare function needsCustomFieldData(words: Set<string>): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Format name for formula with proper case handling
|
|
37
|
+
*/
|
|
38
|
+
export declare function formatNameForFormula(name: string, formula: string): string;
|
|
39
|
+
/**
|
|
40
|
+
* Convert legacy AuthContext to new FormulaContext
|
|
41
|
+
* This helps with backward compatibility
|
|
42
|
+
*/
|
|
43
|
+
export declare function convertAuthToFormulaContext(auth: AuthContext): FormulaContext;
|
|
44
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/nestjs/helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAoB,cAAc,EAAE,MAAM,SAAS,CAAC;AAExE;;GAEG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAO1D;AAED;;GAEG;AACH,wBAAsB,YAAY,CAChC,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,MAAM,CAAC,CAejB;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,OAAO,CAK7D;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,OAAO,CAE/D;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,OAAO,CAE1D;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,OAAO,CAEjE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,OAAO,CAKhE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAc1E;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,WAAW,GAAG,cAAc,CAgB7E"}
|