universal-parcel-scraper 0.784.2-main.4207 → 0.784.3-main.4210
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.
|
@@ -9,7 +9,8 @@ export declare function isCttExpressAgency(location: string): boolean;
|
|
|
9
9
|
/**
|
|
10
10
|
* The clock a CTT scan's location itself names: the country of the office of
|
|
11
11
|
* exchange leading it, when that is Portugal or one of `countries` (the
|
|
12
|
-
* parcel's), Madrid's for Madrid
|
|
13
|
-
* Null when the location does not say.
|
|
12
|
+
* parcel's), Madrid's for Madrid or one of CTT Express's agencies, else
|
|
13
|
+
* Portugal's for one of CTT's own sites. Null when the location does not say.
|
|
14
|
+
* Providers' copies of CTT's scans keep CTT's digits, so they take the same clocks.
|
|
14
15
|
*/
|
|
15
16
|
export declare function cttSiteZone(location: string, countries: readonly (string | null)[]): string | null;
|
|
@@ -11,8 +11,8 @@ import { countryTimeZone, regionHasTown } from '../../core/time/index.js';
|
|
|
11
11
|
*/
|
|
12
12
|
/** A UPU office of exchange leading a location: "PTLISA - (OUTRO) LISBOA". */
|
|
13
13
|
const OFFICE = /^([A-Z]{2})[A-Z0-9]{4}(?=\s+-\s)/;
|
|
14
|
-
/** CTT's own sites: a sorting
|
|
15
|
-
const CTT_SITE = /\b(?:CTT|CDP|centro operacional|centro de distribui[cç][aã]o)\b/i;
|
|
14
|
+
/** CTT's own sites: a sorting centre, also written C.O., a delivery centre (CDP), a shop or a postal point. */
|
|
15
|
+
const CTT_SITE = /\b(?:CTT|CDP|centro operacional|centro de distribui[cç][aã]o)\b|\bC\.O\.(?!\S)/i;
|
|
16
16
|
/** A Portuguese postcode; 9500 to 9999 are the Azores. */
|
|
17
17
|
const POSTCODE = /(?<!\d)(\d{4})(?:-\d{3})?(?!\d)/;
|
|
18
18
|
/**
|
|
@@ -49,15 +49,16 @@ export function isCttExpressAgency(location) {
|
|
|
49
49
|
/**
|
|
50
50
|
* The clock a CTT scan's location itself names: the country of the office of
|
|
51
51
|
* exchange leading it, when that is Portugal or one of `countries` (the
|
|
52
|
-
* parcel's), Madrid's for Madrid
|
|
53
|
-
* Null when the location does not say.
|
|
52
|
+
* parcel's), Madrid's for Madrid or one of CTT Express's agencies, else
|
|
53
|
+
* Portugal's for one of CTT's own sites. Null when the location does not say.
|
|
54
|
+
* Providers' copies of CTT's scans keep CTT's digits, so they take the same clocks.
|
|
54
55
|
*/
|
|
55
56
|
export function cttSiteZone(location, countries) {
|
|
56
57
|
const office = OFFICE.exec(location)?.[1];
|
|
57
58
|
if (office === 'PT' || (office && countries.includes(office))) {
|
|
58
59
|
return office === 'PT' ? portugalZone(location) : countryTimeZone(office);
|
|
59
60
|
}
|
|
60
|
-
if (MADRID.test(location.trim()))
|
|
61
|
+
if (MADRID.test(location.trim()) || isCttExpressAgency(location))
|
|
61
62
|
return 'Europe/Madrid';
|
|
62
63
|
return CTT_SITE.test(location) ? portugalZone(location) : null;
|
|
63
64
|
}
|
|
@@ -540,10 +540,13 @@ const LOCAL_WALL_TIME = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?$/;
|
|
|
540
540
|
// A flight written before it leaves is still to come: no scan, as the lines' own trackers drop it.
|
|
541
541
|
// 17FEIA's estimated departure, and the flight DHLink, Intel-Valley and Mayi Yinfu book.
|
|
542
542
|
const flightToCome = (label) => FLIGHT_ESTIMATE.test(label) || DHLINK_FLIGHT.test(label) || intelValleyFlight(label) || MAYIYINFU_FLIGHT.test(label);
|
|
543
|
+
// A time or date in brackets with no words, as 17TRACK relays a Juxi Express row between the flight
|
|
544
|
+
// being arranged at the airport and the departure: it says nothing happened, so it is no scan.
|
|
545
|
+
const BARE_TIME = /^[((]\s*\d{1,2}\s*[::]\s*\d{1,2}\s*[))]$/;
|
|
543
546
|
function describe(description, stage) {
|
|
544
547
|
// A copy of SunYou's departure drops the last-mile number, as SunYou's own result does.
|
|
545
548
|
const label = sunYouWording(relayedNotice(text(description)).replace(CLEARANCE_STATUS, ''));
|
|
546
|
-
if (!label || isNotice(label) || flightToCome(label))
|
|
549
|
+
if (!label || isNotice(label) || flightToCome(label) || BARE_TIME.test(label))
|
|
547
550
|
return null;
|
|
548
551
|
const declared = typeof stage === 'string' && Object.hasOwn(STAGES, stage) ? STAGES[stage] : undefined;
|
|
549
552
|
// Established source semantics (e.g. handoff/negation) remain first. A real
|
package/dist/server/openapi.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "universal-parcel-scraper",
|
|
3
|
-
"version": "0.784.
|
|
3
|
+
"version": "0.784.3-main.4210",
|
|
4
4
|
"description": "Self-hosted parcel tracking: carrier detection, dedicated scrapers and optional universal providers.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|