hvp-shared 6.43.0 → 6.44.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/dist/contracts/collaborator/requests.d.ts +2 -0
- package/dist/contracts/collaborator/responses.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/utils/qvet-staff.helpers.d.ts +20 -0
- package/dist/utils/qvet-staff.helpers.js +32 -0
- package/dist/utils/qvet-staff.helpers.test.d.ts +1 -0
- package/dist/utils/qvet-staff.helpers.test.js +90 -0
- package/package.json +1 -1
|
@@ -44,6 +44,7 @@ export interface CreateCollaboratorRequest {
|
|
|
44
44
|
dailySalary?: number;
|
|
45
45
|
accessCode?: string;
|
|
46
46
|
password?: string;
|
|
47
|
+
qvetAliases?: string[];
|
|
47
48
|
}
|
|
48
49
|
/**
|
|
49
50
|
* Update Collaborator Request
|
|
@@ -88,6 +89,7 @@ export interface UpdateCollaboratorRequest {
|
|
|
88
89
|
dailySalary?: number;
|
|
89
90
|
accessCode?: string;
|
|
90
91
|
password?: string;
|
|
92
|
+
qvetAliases?: string[];
|
|
91
93
|
}
|
|
92
94
|
/**
|
|
93
95
|
* Register Collaborator Request
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -27,3 +27,4 @@ var debug_logger_1 = require("./utils/debug-logger");
|
|
|
27
27
|
Object.defineProperty(exports, "debugLog", { enumerable: true, get: function () { return debug_logger_1.debugLog; } });
|
|
28
28
|
__exportStar(require("./utils/sync-field.helpers"), exports);
|
|
29
29
|
__exportStar(require("./utils/qvet-catalog.helpers"), exports);
|
|
30
|
+
__exportStar(require("./utils/qvet-staff.helpers"), exports);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QVET Staff Helpers
|
|
3
|
+
*
|
|
4
|
+
* Utility functions for normalizing QVET staff names for alias matching.
|
|
5
|
+
*
|
|
6
|
+
* QVET exports strip accents inconsistently (e.g., AVENDAÑO → AVENDANO or AVENDAO).
|
|
7
|
+
* This normalizer strips all diacritics so lookups work regardless of source encoding.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Normalize a QVET staff name for alias matching.
|
|
11
|
+
*
|
|
12
|
+
* - Uppercase
|
|
13
|
+
* - Strip diacritics (NFD decompose + remove combining marks): ñ→N, é→E, etc.
|
|
14
|
+
* - Collapse multiple whitespace to single space
|
|
15
|
+
* - Trim leading/trailing whitespace
|
|
16
|
+
*
|
|
17
|
+
* @param name - Raw name from QVET export or user input
|
|
18
|
+
* @returns Normalized name, or empty string for null/undefined/empty
|
|
19
|
+
*/
|
|
20
|
+
export declare function normalizeQvetName(name: string | null | undefined): string;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* QVET Staff Helpers
|
|
4
|
+
*
|
|
5
|
+
* Utility functions for normalizing QVET staff names for alias matching.
|
|
6
|
+
*
|
|
7
|
+
* QVET exports strip accents inconsistently (e.g., AVENDAÑO → AVENDANO or AVENDAO).
|
|
8
|
+
* This normalizer strips all diacritics so lookups work regardless of source encoding.
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.normalizeQvetName = normalizeQvetName;
|
|
12
|
+
/**
|
|
13
|
+
* Normalize a QVET staff name for alias matching.
|
|
14
|
+
*
|
|
15
|
+
* - Uppercase
|
|
16
|
+
* - Strip diacritics (NFD decompose + remove combining marks): ñ→N, é→E, etc.
|
|
17
|
+
* - Collapse multiple whitespace to single space
|
|
18
|
+
* - Trim leading/trailing whitespace
|
|
19
|
+
*
|
|
20
|
+
* @param name - Raw name from QVET export or user input
|
|
21
|
+
* @returns Normalized name, or empty string for null/undefined/empty
|
|
22
|
+
*/
|
|
23
|
+
function normalizeQvetName(name) {
|
|
24
|
+
if (!name)
|
|
25
|
+
return '';
|
|
26
|
+
return name
|
|
27
|
+
.normalize('NFD')
|
|
28
|
+
.replace(/[\u0300-\u036f]/g, '')
|
|
29
|
+
.toUpperCase()
|
|
30
|
+
.replace(/\s+/g, ' ')
|
|
31
|
+
.trim();
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const qvet_staff_helpers_1 = require("./qvet-staff.helpers");
|
|
4
|
+
describe('normalizeQvetName', () => {
|
|
5
|
+
describe('diacritic stripping', () => {
|
|
6
|
+
it('should strip ñ → N', () => {
|
|
7
|
+
expect((0, qvet_staff_helpers_1.normalizeQvetName)('AVENDAÑO')).toBe('AVENDANO');
|
|
8
|
+
});
|
|
9
|
+
it('should strip accented vowels', () => {
|
|
10
|
+
expect((0, qvet_staff_helpers_1.normalizeQvetName)('FÉLIX VELÁZQUEZ')).toBe('FELIX VELAZQUEZ');
|
|
11
|
+
});
|
|
12
|
+
it('should strip ü', () => {
|
|
13
|
+
expect((0, qvet_staff_helpers_1.normalizeQvetName)('GÜERO')).toBe('GUERO');
|
|
14
|
+
});
|
|
15
|
+
it('should handle mixed accented and non-accented chars', () => {
|
|
16
|
+
expect((0, qvet_staff_helpers_1.normalizeQvetName)('María de Lourdes Avendaño Talarico'))
|
|
17
|
+
.toBe('MARIA DE LOURDES AVENDANO TALARICO');
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
describe('uppercase', () => {
|
|
21
|
+
it('should convert lowercase to uppercase', () => {
|
|
22
|
+
expect((0, qvet_staff_helpers_1.normalizeQvetName)('felix velazquez')).toBe('FELIX VELAZQUEZ');
|
|
23
|
+
});
|
|
24
|
+
it('should convert mixed case to uppercase', () => {
|
|
25
|
+
expect((0, qvet_staff_helpers_1.normalizeQvetName)('Sara Delgado Inurreta')).toBe('SARA DELGADO INURRETA');
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
describe('whitespace handling', () => {
|
|
29
|
+
it('should collapse double spaces', () => {
|
|
30
|
+
expect((0, qvet_staff_helpers_1.normalizeQvetName)('RAFAEL A GARCIA')).toBe('RAFAEL A GARCIA');
|
|
31
|
+
});
|
|
32
|
+
it('should collapse multiple spaces', () => {
|
|
33
|
+
expect((0, qvet_staff_helpers_1.normalizeQvetName)('RAFAEL A. GARCIA LOPEZ')).toBe('RAFAEL A. GARCIA LOPEZ');
|
|
34
|
+
});
|
|
35
|
+
it('should trim leading whitespace', () => {
|
|
36
|
+
expect((0, qvet_staff_helpers_1.normalizeQvetName)(' FELIX')).toBe('FELIX');
|
|
37
|
+
});
|
|
38
|
+
it('should trim trailing whitespace', () => {
|
|
39
|
+
expect((0, qvet_staff_helpers_1.normalizeQvetName)('FELIX ')).toBe('FELIX');
|
|
40
|
+
});
|
|
41
|
+
it('should handle tabs and newlines', () => {
|
|
42
|
+
expect((0, qvet_staff_helpers_1.normalizeQvetName)('FELIX\tVELAZQUEZ\n')).toBe('FELIX VELAZQUEZ');
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
describe('null/empty handling', () => {
|
|
46
|
+
it('should return empty string for null', () => {
|
|
47
|
+
expect((0, qvet_staff_helpers_1.normalizeQvetName)(null)).toBe('');
|
|
48
|
+
});
|
|
49
|
+
it('should return empty string for undefined', () => {
|
|
50
|
+
expect((0, qvet_staff_helpers_1.normalizeQvetName)(undefined)).toBe('');
|
|
51
|
+
});
|
|
52
|
+
it('should return empty string for empty string', () => {
|
|
53
|
+
expect((0, qvet_staff_helpers_1.normalizeQvetName)('')).toBe('');
|
|
54
|
+
});
|
|
55
|
+
it('should return empty string for whitespace-only string', () => {
|
|
56
|
+
expect((0, qvet_staff_helpers_1.normalizeQvetName)(' ')).toBe('');
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
describe('NFC pre-composed input', () => {
|
|
60
|
+
it('should handle NFC-composed ñ', () => {
|
|
61
|
+
// NFC: ñ as single codepoint U+00F1
|
|
62
|
+
const nfc = 'PI\u00F1A';
|
|
63
|
+
expect((0, qvet_staff_helpers_1.normalizeQvetName)(nfc)).toBe('PINA');
|
|
64
|
+
});
|
|
65
|
+
it('should handle NFD-decomposed ñ', () => {
|
|
66
|
+
// NFD: n + combining tilde U+0303
|
|
67
|
+
const nfd = 'PIN\u0303A';
|
|
68
|
+
expect((0, qvet_staff_helpers_1.normalizeQvetName)(nfd)).toBe('PINA');
|
|
69
|
+
});
|
|
70
|
+
it('should produce same result for NFC and NFD input', () => {
|
|
71
|
+
const nfc = 'COLMENARES PI\u00F1A';
|
|
72
|
+
const nfd = 'COLMENARES PIN\u0303A';
|
|
73
|
+
expect((0, qvet_staff_helpers_1.normalizeQvetName)(nfc)).toBe((0, qvet_staff_helpers_1.normalizeQvetName)(nfd));
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
describe('real-world QVET names', () => {
|
|
77
|
+
it('should normalize QVET-stripped names', () => {
|
|
78
|
+
// QVET already stripped some diacritics but left others
|
|
79
|
+
expect((0, qvet_staff_helpers_1.normalizeQvetName)('KARLA NUEZ BARRERA')).toBe('KARLA NUEZ BARRERA');
|
|
80
|
+
});
|
|
81
|
+
it('should normalize names with original accents', () => {
|
|
82
|
+
expect((0, qvet_staff_helpers_1.normalizeQvetName)('Karla Sofía Núñez Barrera')).toBe('KARLA SOFIA NUNEZ BARRERA');
|
|
83
|
+
});
|
|
84
|
+
it('should handle Leonardo Méndez case (partial stripping)', () => {
|
|
85
|
+
// QVET exported as "Leonardo Guillermo Mndez Porres" (stripped é completely)
|
|
86
|
+
expect((0, qvet_staff_helpers_1.normalizeQvetName)('Leonardo Guillermo Mndez Porres'))
|
|
87
|
+
.toBe('LEONARDO GUILLERMO MNDEZ PORRES');
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
});
|