hvp-shared 13.7.0 → 13.8.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.
|
@@ -141,6 +141,22 @@ export declare const SCHEDULER_REGEX: RegExp;
|
|
|
141
141
|
* "AGENDADO POR SLR" → groups: SLR, undefined
|
|
142
142
|
*/
|
|
143
143
|
export declare const SCHEDULER_WITH_DATE_REGEX: RegExp;
|
|
144
|
+
/**
|
|
145
|
+
* Fallback pattern for when recepción writes just a date followed by a
|
|
146
|
+
* col_code, no `AGENDO/AG` prefix. Examples observed in production:
|
|
147
|
+
*
|
|
148
|
+
* "20.11.2025 MGC"
|
|
149
|
+
* "18.11.25 MGC"
|
|
150
|
+
* "04/05/2026 FJV"
|
|
151
|
+
*
|
|
152
|
+
* Group 1: date string. Group 2: col_code candidate (must be validated
|
|
153
|
+
* against `knownColCodes` by the caller).
|
|
154
|
+
*
|
|
155
|
+
* Used as a fallback when `SCHEDULER_REGEX` finds no AGENDO-prefixed
|
|
156
|
+
* annotation. Prevents false positives by requiring an immediately-adjacent
|
|
157
|
+
* date.
|
|
158
|
+
*/
|
|
159
|
+
export declare const SCHEDULER_DATE_FALLBACK_REGEX: RegExp;
|
|
144
160
|
/**
|
|
145
161
|
* Captures pet age expressions in Spanish from descriptions.
|
|
146
162
|
*
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* runs remain reproducible.
|
|
14
14
|
*/
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.HVP_EVENT_PROP_KEYS = exports.KNOWN_BREEDS = exports.PET_AGE_REGEX = exports.SCHEDULER_WITH_DATE_REGEX = exports.SCHEDULER_REGEX = exports.PHONE_REGEX = exports.QVET_ID_REGEX = exports.CANCELLED_TITLE_REGEX = exports.REMINDER_TITLE_REGEX = exports.PREFERRED_VET_REGEX = exports.EXCLUDED_TITLE_PREFIXES = exports.SERVICE_CODE_SYNONYMS = exports.CANONICAL_SERVICE_CODES = exports.EXCLUDED_COLOR_IDS = exports.CANCELLED_COLOR_ID = exports.COLOR_ID_TO_BRANCH = exports.BRANCH_COLOR_IDS = exports.STANDARD_V1 = exports.STANDARD_V3 = exports.STANDARD_V2 = void 0;
|
|
16
|
+
exports.HVP_EVENT_PROP_KEYS = exports.KNOWN_BREEDS = exports.PET_AGE_REGEX = exports.SCHEDULER_DATE_FALLBACK_REGEX = exports.SCHEDULER_WITH_DATE_REGEX = exports.SCHEDULER_REGEX = exports.PHONE_REGEX = exports.QVET_ID_REGEX = exports.CANCELLED_TITLE_REGEX = exports.REMINDER_TITLE_REGEX = exports.PREFERRED_VET_REGEX = exports.EXCLUDED_TITLE_PREFIXES = exports.SERVICE_CODE_SYNONYMS = exports.CANONICAL_SERVICE_CODES = exports.EXCLUDED_COLOR_IDS = exports.CANCELLED_COLOR_ID = exports.COLOR_ID_TO_BRANCH = exports.BRANCH_COLOR_IDS = exports.STANDARD_V1 = exports.STANDARD_V3 = exports.STANDARD_V2 = void 0;
|
|
17
17
|
// ─── Standard v1 ─────────────────────────────────────────────────────────────
|
|
18
18
|
/**
|
|
19
19
|
* Multi-factor appointment standard v2.
|
|
@@ -398,7 +398,7 @@ exports.PHONE_REGEX = /(?:\+?52\s?1?\s?)?(?:\d{3}[\s-]?\d{3}[\s-]?\d{4}|\d{10})/
|
|
|
398
398
|
* "AGENDADA POR SLR 02/12/25"
|
|
399
399
|
* "AGENDADO POR SLR 02/12/25"
|
|
400
400
|
*/
|
|
401
|
-
exports.SCHEDULER_REGEX = /\b(?:AG|
|
|
401
|
+
exports.SCHEDULER_REGEX = /\b(?:AG[.:]?|AGE[.:]|AGEND[OÓ][.:]?|AGENG[OÓ]|AGED[OÓ]|AGENDAD[OA](?:\s+POR)?)\s+([A-Z]{2,4})\b/i;
|
|
402
402
|
/**
|
|
403
403
|
* Captures the "agendado por" col_code AND the date annotation that often follows it.
|
|
404
404
|
*
|
|
@@ -407,7 +407,23 @@ exports.SCHEDULER_REGEX = /\b(?:AG|AGENDO|AGENDAD[OA]\s+POR)\s+([A-Z]{2,4})\b/i;
|
|
|
407
407
|
* "AGENDADA POR SLR 02/12/25" → groups: SLR, "02/12/25"
|
|
408
408
|
* "AGENDADO POR SLR" → groups: SLR, undefined
|
|
409
409
|
*/
|
|
410
|
-
exports.SCHEDULER_WITH_DATE_REGEX = /\b(?:AG|
|
|
410
|
+
exports.SCHEDULER_WITH_DATE_REGEX = /\b(?:AG[.:]?|AGE[.:]|AGEND[OÓ][.:]?|AGENG[OÓ]|AGED[OÓ]|AGENDAD[OA](?:\s+POR)?)\s+([A-Z]{2,4})(?:\s+(\d{1,2}[./\-]\d{1,2}(?:[./\-]\d{2,4})?|\d{1,2}\s+(?:ENE|FEB|MAR|ABR|MAY|JUN|JUL|AGO|SEP|OCT|NOV|DIC|ENERO|FEBRERO|MARZO|ABRIL|MAYO|JUNIO|JULIO|AGOSTO|SEPTIEMBRE|OCTUBRE|NOVIEMBRE|DICIEMBRE)))?\b/i;
|
|
411
|
+
/**
|
|
412
|
+
* Fallback pattern for when recepción writes just a date followed by a
|
|
413
|
+
* col_code, no `AGENDO/AG` prefix. Examples observed in production:
|
|
414
|
+
*
|
|
415
|
+
* "20.11.2025 MGC"
|
|
416
|
+
* "18.11.25 MGC"
|
|
417
|
+
* "04/05/2026 FJV"
|
|
418
|
+
*
|
|
419
|
+
* Group 1: date string. Group 2: col_code candidate (must be validated
|
|
420
|
+
* against `knownColCodes` by the caller).
|
|
421
|
+
*
|
|
422
|
+
* Used as a fallback when `SCHEDULER_REGEX` finds no AGENDO-prefixed
|
|
423
|
+
* annotation. Prevents false positives by requiring an immediately-adjacent
|
|
424
|
+
* date.
|
|
425
|
+
*/
|
|
426
|
+
exports.SCHEDULER_DATE_FALLBACK_REGEX = /\b(\d{1,2}[./\-]\d{1,2}(?:[./\-]\d{2,4})?)\s+([A-Z]{2,4})\b/i;
|
|
411
427
|
// ─── Pet age detection ───────────────────────────────────────────────────────
|
|
412
428
|
/**
|
|
413
429
|
* Captures pet age expressions in Spanish from descriptions.
|
|
@@ -123,12 +123,40 @@ describe("Description regexes", () => {
|
|
|
123
123
|
["AG YMP 14.05.26", "YMP"],
|
|
124
124
|
["AGENDADA POR SLR 02/12/25", "SLR"],
|
|
125
125
|
["AGENDADO POR SCP", "SCP"],
|
|
126
|
+
// Accented variants — Spanish past tense "agendó" with tilde
|
|
127
|
+
["AGENDÓ YMP", "YMP"],
|
|
128
|
+
["agendó ymp", "YMP"],
|
|
129
|
+
["Agendó SLR 16 mayo", "SLR"],
|
|
130
|
+
// 13.8.0 — punctuation variants observed in production
|
|
131
|
+
["AG. LCM 27.11.25", "LCM"],
|
|
132
|
+
["AG: YGZ 04.05.2026", "YGZ"],
|
|
133
|
+
["AGE: YGZ FECHA: 04.05.2026", "YGZ"],
|
|
134
|
+
["AGENDO. AAT", "AAT"],
|
|
135
|
+
// 13.8.0 — common typos
|
|
136
|
+
["AGENGO GLP 23.01.2026", "GLP"],
|
|
137
|
+
["AGEDO XZA", "XZA"],
|
|
138
|
+
// 13.8.0 — AGENDADO/AGENDADA without "POR"
|
|
139
|
+
["AGENDADO SLR", "SLR"],
|
|
140
|
+
["AGENDADA LCM", "LCM"],
|
|
126
141
|
];
|
|
127
142
|
for (const [text, expected] of cases) {
|
|
128
143
|
const match = text.match(google_calendar_constants_1.SCHEDULER_REGEX);
|
|
129
144
|
expect(match?.[1]?.toUpperCase()).toBe(expected);
|
|
130
145
|
}
|
|
131
146
|
});
|
|
147
|
+
it("SCHEDULER_DATE_FALLBACK_REGEX captures <date> <col_code> patterns without AGENDO prefix", () => {
|
|
148
|
+
const cases = [
|
|
149
|
+
["20.11.2025 MGC", "20.11.2025", "MGC"],
|
|
150
|
+
["18.11.25 MGC", "18.11.25", "MGC"],
|
|
151
|
+
["04/05/2026 FJV", "04/05/2026", "FJV"],
|
|
152
|
+
["27-11-25 RGL", "27-11-25", "RGL"],
|
|
153
|
+
];
|
|
154
|
+
for (const [text, dateExp, codeExp] of cases) {
|
|
155
|
+
const match = text.match(google_calendar_constants_1.SCHEDULER_DATE_FALLBACK_REGEX);
|
|
156
|
+
expect(match?.[1]).toBe(dateExp);
|
|
157
|
+
expect(match?.[2]?.toUpperCase()).toBe(codeExp);
|
|
158
|
+
}
|
|
159
|
+
});
|
|
132
160
|
it("SCHEDULER_WITH_DATE_REGEX captures both col_code and date annotation", () => {
|
|
133
161
|
const cases = [
|
|
134
162
|
["AGENDO XZA 16 MAYO", "XZA", "16 MAYO"],
|