universal-parcel-scraper 0.993.3-main.5355 → 0.993.4-main.5358

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 CHANGED
@@ -163,7 +163,7 @@ the command line's `track --source ParcelsApp` does the same.
163
163
  <!-- GENERATED:stages -->
164
164
  <img src="docs/assets/stages.svg" alt="DHL: Die Sendung wurde in das Zustellfahrzeug geladen.; Mondial Relay: En cours de livraison; Correios Brazil: Objeto saiu para entrega ao destinatário; Correos Express: EN REPARTO; Yamato Transport: 配達中; La Poste / Colissimo: DISTOU. All are filed under out_for_delivery." width="760">
165
165
 
166
- The carrier folders record 19,158 such statuses, each filed under one stage.
166
+ The carrier folders record 19,161 such statuses, each filed under one stage.
167
167
  <!-- /GENERATED:stages -->
168
168
 
169
169
  Wording nobody recorded yet goes through a classifier that reads seven European languages.
@@ -9,7 +9,7 @@ import { firstOccurrence, usStateTimeZone } from '../../core/time/index.js';
9
9
  import { cleanScalar } from '../../core/transport/index.js';
10
10
  import { isRecord } from '../../core/types.js';
11
11
  import { postnlRecordZone } from '../spring-gds/adapter.js';
12
- import { epostGlobalFacilityScan, epostGlobalStage } from './status.js';
12
+ import { epostGlobalFacilityScan, epostGlobalOwnRow, epostGlobalStage } from './status.js';
13
13
  export const PROVIDER = 'ePost Global';
14
14
  // A delivered parcel's reply is up to a hundred kilobytes: its history twice,
15
15
  // as data and as rendered rows.
@@ -31,6 +31,9 @@ const SPLIT_STATES = new Set(['AK', 'FL', 'ID', 'IN', 'KS', 'KY', 'MI', 'ND', 'N
31
31
  // Partners whose names the catalog does not know. Spring's PostNL service is
32
32
  // tracked by spring-gds under the same number.
33
33
  const VENDORS = new Map([['SPRING POST NL', 'spring-gds']]);
34
+ // GLS's European network, whose tracking runs on Central European time wherever the depot is.
35
+ const GLS_EUROPE = /^GLS ?EU(?:ROPE)?$/i;
36
+ const GLS_ZONE = 'Europe/Berlin';
34
37
  const MAX_ROWS = 500;
35
38
  const MAX_EVENTS = 100;
36
39
  /** An ePost Global number; anything else is a number the tracker is not asked for. */
@@ -73,15 +76,15 @@ function facilityZone(description, place) {
73
76
  return state && !SPLIT_STATES.has(state) ? usStateTimeZone(state) : null;
74
77
  }
75
78
  /**
76
- * A scan's clock: an instant in the center's zone, or in PostNL's for one of
77
- * its own records, else the wall clock as stamped.
79
+ * A scan's clock: an instant in the center's zone, or in the partner's for a
80
+ * row on its clock (PostNL's own records, GLS's rows), else the wall clock as stamped.
78
81
  */
79
- function clockOf(stamp, zone, postnl) {
82
+ function clockOf(stamp, zone, partner) {
80
83
  const wall = WALL_CLOCK.exec(stamp)?.[1];
81
84
  if (!wall || !DateTime.fromISO(wall, { zone: 'utc' }).isValid) {
82
85
  throw new SchemaError(PROVIDER, 'ePost Global returned an invalid scan time');
83
86
  }
84
- const reading = zone ?? postnl;
87
+ const reading = zone ?? partner;
85
88
  if (!reading)
86
89
  return { local_time: wall };
87
90
  const time = firstOccurrence(DateTime.fromISO(wall, { zone: reading })).toISO({ suppressMilliseconds: true });
@@ -96,7 +99,7 @@ function clockOf(stamp, zone, postnl) {
96
99
  function postnlZone(code, place, origin) {
97
100
  return origin && place === origin && /^\d{1,8}$/.test(code) ? postnlRecordZone(code) : null;
98
101
  }
99
- function projectScan(row, origin) {
102
+ function projectScan(row, origin, partnerZone) {
100
103
  if (!isRecord(row))
101
104
  throw new SchemaError(PROVIDER, 'ePost Global returned an invalid scan');
102
105
  const description = text(row, 'Event');
@@ -107,7 +110,7 @@ function projectScan(row, origin) {
107
110
  const code = text(row, 'ECode', 32);
108
111
  const staged = epostGlobalStage(description, code);
109
112
  const event = {
110
- ...clockOf(stamp, facilityZone(description, place), postnlZone(code, place, origin)),
113
+ ...clockOf(stamp, facilityZone(description, place), postnlZone(code, place, origin) ?? (partnerZone && !epostGlobalOwnRow(description) ? partnerZone : null)),
111
114
  description,
112
115
  ...(place ? { location: place } : {}),
113
116
  ...(code ? { provider_code: code } : {}),
@@ -183,10 +186,12 @@ export function parseEpostGlobal(html, raw) {
183
186
  // The shipper's country, where ePost Global places the records Spring's PostNL service keeps without one.
184
187
  const shipper = text(details, 'OCt', 8).toUpperCase();
185
188
  const origin = VENDORS.get(text(details, 'Vendor', 80).toUpperCase()) === 'spring-gds' && /^[A-Z]{2}$/.test(shipper) ? shipper : null;
189
+ // GLS's rows, even one placed at its gateway in the United States, on GLS's clock.
190
+ const partnerZone = GLS_EUROPE.test(text(details, 'Vendor', 80)) ? GLS_ZONE : null;
186
191
  const seen = new Set();
187
192
  const events = [];
188
193
  for (const row of rows) {
189
- const scan = projectScan(row, origin);
194
+ const scan = projectScan(row, origin, partnerZone);
190
195
  if (!scan || seen.has(scan.key))
191
196
  continue;
192
197
  seen.add(scan.key);
@@ -2,6 +2,8 @@ import { type ClassifiedWording, type Stage } from '../../core/status/index.js';
2
2
  import { type CarrierStatusMap } from '../../core/status/statusMap.js';
3
3
  /** The stage the map gives a row relayed from OSM Worldwide by its code, else the wording, if it knows it. */
4
4
  export declare function epostGlobalScanStage(wording: string, code?: string): Stage | undefined;
5
+ /** A row ePost Global writes itself, not one it relays from the partner. */
6
+ export declare function epostGlobalOwnRow(wording: string): boolean;
5
7
  /** A scan at one of ePost Global's processing centers. */
6
8
  export declare function epostGlobalFacilityScan(wording: string): boolean;
7
9
  /**
@@ -34,6 +34,9 @@ const STAGES = new Map([
34
34
  const HANDED_OVER = /^in transit (?:to|via) \S.* tracking ?#:/;
35
35
  // A row relayed from OSM Worldwide, under its code.
36
36
  const OSM_CODE = /^OSM\d{2}$/;
37
+ // ePost Global's own rows: its data, label, processing centers and handover. Every other row is a partner's.
38
+ const OWN = new Set(['data received', 'shipment in transit to the epost global processing center', 'parcel received and processing',
39
+ 'parcel shipped', 'in transit']);
37
40
  // The rows ePost Global's processing centers scan, stamped on the center's clock.
38
41
  const FACILITY_SCANS = new Set(['parcel received and processing', 'parcel shipped']);
39
42
  /** The stage the map gives a row relayed from OSM Worldwide by its code, else the wording, if it knows it. */
@@ -44,6 +47,11 @@ export function epostGlobalScanStage(wording, code = '') {
44
47
  const normalized = normalizeStatusWording(wording);
45
48
  return HANDED_OVER.test(normalized) ? 'in_transit' : STAGES.get(normalized);
46
49
  }
50
+ /** A row ePost Global writes itself, not one it relays from the partner. */
51
+ export function epostGlobalOwnRow(wording) {
52
+ const normalized = normalizeStatusWording(wording);
53
+ return OWN.has(normalized) || HANDED_OVER.test(normalized);
54
+ }
47
55
  /** A scan at one of ePost Global's processing centers. */
48
56
  export function epostGlobalFacilityScan(wording) {
49
57
  return FACILITY_SCANS.has(normalizeStatusWording(wording));
@@ -120,6 +120,9 @@
120
120
  {"code": "DCF", "wording": "Item Customs clearance completed", "stage": "in_transit", "language": "en", "confirmedBy": "live", "firstSeen": "2026-11-06", "note": "Import customs released the parcel after the flight landed."},
121
121
  {"code": "OIT", "wording": "Arrived at Sort Facility", "stage": "in_transit", "language": "en", "confirmedBy": "live", "firstSeen": "2026-11-06", "note": "The destination's sorting facility after import clearance, before the local courier takes the parcel."},
122
122
  {"code": "OIT", "wording": "Arrived at FedEx location", "stage": "in_transit", "language": "en", "confirmedBy": "live", "firstSeen": "2026-11-06", "note": "FedEx's hub on the line it delivers, relayed under JS Express's catch-all code."},
123
- {"code": "OIT", "wording": "Left FedEx origin facility", "stage": "in_transit", "language": "en", "confirmedBy": "live", "firstSeen": "2026-11-06", "note": "FedEx's departure from its first facility, relayed under the same code."}
123
+ {"code": "OIT", "wording": "Left FedEx origin facility", "stage": "in_transit", "language": "en", "confirmedBy": "live", "firstSeen": "2026-11-06", "note": "FedEx's departure from its first facility, relayed under the same code."},
124
+ {"code": "OIT", "wording": "The instruction data for this shipment have been provided by the sender to DHL electronically", "stage": "registered", "language": "en", "confirmedBy": "live", "firstSeen": "2026-11-06", "note": "DHL's record of the sender's data on the line it delivers in Germany: no scan."},
125
+ {"code": "OIT", "wording": "The shipment is in transit to DHL", "stage": "in_transit", "language": "en", "confirmedBy": "live", "firstSeen": "2026-11-06", "note": "DHL's line for a parcel on its way to DHL's network from abroad."},
126
+ {"code": "OIT", "wording": "Die Sendung wurde im Briefzentrum bearbeitet.", "stage": "in_transit", "language": "de", "confirmedBy": "live", "firstSeen": "2026-11-06", "note": "DHL's mail centre in Germany sorting a small parcel, in German."}
124
127
  ]
125
128
  }
@@ -195,11 +195,11 @@
195
195
  "note": "Back at the delivery station after a run that did not deliver it."
196
196
  },
197
197
  {
198
- "wording": "Scheduled to <2026-11-02> .",
198
+ "wording": "Scheduled to <…> .",
199
199
  "language": "en",
200
200
  "unmapped": true,
201
201
  "confirmedBy": "live",
202
- "note": "The day booked for the next run after the parcel came back to the station, as iMile writes its \"Shipment is scheduled to\" line: moves nothing, so the failed attempt stands."
202
+ "note": "The day booked for the next run after the parcel came back to the station, as iMile writes its \"Shipment is scheduled to\" line: moves nothing, so the failed attempt stands. Its pattern covers any day."
203
203
  }
204
204
  ]
205
205
  }
@@ -2,7 +2,7 @@
2
2
  "openapi": "3.1.0",
3
3
  "info": {
4
4
  "title": "Universal Parcel Scraper",
5
- "version": "0.993.3-main.5355"
5
+ "version": "0.993.4-main.5358"
6
6
  },
7
7
  "paths": {
8
8
  "/health": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "universal-parcel-scraper",
3
- "version": "0.993.3-main.5355",
3
+ "version": "0.993.4-main.5358",
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",