universal-parcel-scraper 0.857.0-main.4576 → 0.857.2-main.4580

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.
@@ -242,11 +242,10 @@ function originClock(event, time, imported) {
242
242
  const wall = WALL_CLOCK.exec(time)?.[1];
243
243
  return (zone && wall ? isoTime(wall, zone)?.iso : null) ?? time;
244
244
  }
245
- /** A sender abroad's notice that its letter will shortly be handed over, on its system's clock ([clock.ts](clock.ts)). */
246
- function preAdviceClock(event, time, sender) {
245
+ /** A consolidator's notice that its letter will shortly be handed over, on its system's clock ([clock.ts](clock.ts)). */
246
+ function preAdviceClock(event, time) {
247
247
  const wall = WALL_CLOCK.exec(time)?.[1];
248
- // Before the letter arrives, the reply may name no sender yet.
249
- if (sender === 'CH' || !wall || text(event.eventCode, 100).split('.').at(-1) !== PRE_ADVICE)
248
+ if (!wall || text(event.eventCode, 100).split('.').at(-1) !== PRE_ADVICE)
250
249
  return time;
251
250
  return isoTime(wall, PRE_ADVICE_ZONE)?.iso ?? time;
252
251
  }
@@ -278,7 +277,6 @@ export function parseSwissPostShipment(item, rawEvents, translations = {}) {
278
277
  const destination = text(item.recipientCountry, 10).toUpperCase();
279
278
  const abroad = item.internationalExport === true && !item.internationalImport && /^[A-Z]{2}$/.test(destination)
280
279
  && destination !== 'CH' ? destination : null;
281
- const sender = text(item.senderCountry, 10).toUpperCase();
282
280
  const events = [];
283
281
  for (const rawEvent of rawEvents.slice(0, 100)) {
284
282
  if (!isRecord(rawEvent))
@@ -288,7 +286,7 @@ export function parseSwissPostShipment(item, rawEvents, translations = {}) {
288
286
  if (!time || !eventCode)
289
287
  continue;
290
288
  const event = {
291
- time: preAdviceClock(rawEvent, originClock(rawEvent, destinationClock(rawEvent, time, abroad), item.internationalImport === true), sender),
289
+ time: preAdviceClock(rawEvent, originClock(rawEvent, destinationClock(rawEvent, time, abroad), item.internationalImport === true)),
292
290
  location: eventLocation(rawEvent),
293
291
  description: eventDescription(rawEvent, translations, internationalType),
294
292
  provider_code: eventCode,
@@ -12,13 +12,13 @@
12
12
  export declare const DESTINATION_EVENTS: ReadonlySet<string>;
13
13
  /**
14
14
  * The sender's electronic notice that a letter will shortly be handed over (859). It comes from
15
- * a sender abroad, Chinese consolidators posting their letters in Switzerland through their
16
- * European hubs, and carries the sending system's Beijing wall clock under Swiss Post's offset:
17
- * Cainiao's notice on a letter from its Dutch hub read 18:12 +01:00 in a reply Swiss Post gave
18
- * at 13:58 its own time, hours before it, and on Beijing's clock it is 11:12. Until the letter
19
- * arrives, the reply may name no sender: only a sender in Switzerland keeps Swiss Post's clock.
20
- * Parcels give their notice another code (600), on Swiss Post's clock, half an hour after their
21
- * arrival scan.
15
+ * Chinese consolidators posting their letters in Switzerland through their European hubs, and
16
+ * carries the sending system's Beijing wall clock under Swiss Post's offset: Cainiao's notice on
17
+ * a letter from its Dutch hub read 18:12 +01:00 in a reply Swiss Post gave at 13:58 its own time,
18
+ * hours before it, and on Beijing's clock it is 11:12. The reply may name no sender, the hub's
19
+ * country or Switzerland: one naming Switzerland, with the hub's deposit at 10:56 +01:00, had
20
+ * the notice at 19:16 +01:00 when Swiss Post answered at 14:21. Senders in Switzerland give
21
+ * their notice another code (600), on Swiss Post's clock, as parcels do.
22
22
  */
23
23
  export declare const PRE_ADVICE = "859";
24
24
  export declare const PRE_ADVICE_ZONE = "Asia/Shanghai";
@@ -27,13 +27,13 @@ const DESTINATION_WORDING = new RegExp('^(?:arrival in destination country|custo
27
27
  const ORIGIN_OFFICES = [[/^LON [A-Z]\b/, 'Europe/London']];
28
28
  /**
29
29
  * The sender's electronic notice that a letter will shortly be handed over (859). It comes from
30
- * a sender abroad, Chinese consolidators posting their letters in Switzerland through their
31
- * European hubs, and carries the sending system's Beijing wall clock under Swiss Post's offset:
32
- * Cainiao's notice on a letter from its Dutch hub read 18:12 +01:00 in a reply Swiss Post gave
33
- * at 13:58 its own time, hours before it, and on Beijing's clock it is 11:12. Until the letter
34
- * arrives, the reply may name no sender: only a sender in Switzerland keeps Swiss Post's clock.
35
- * Parcels give their notice another code (600), on Swiss Post's clock, half an hour after their
36
- * arrival scan.
30
+ * Chinese consolidators posting their letters in Switzerland through their European hubs, and
31
+ * carries the sending system's Beijing wall clock under Swiss Post's offset: Cainiao's notice on
32
+ * a letter from its Dutch hub read 18:12 +01:00 in a reply Swiss Post gave at 13:58 its own time,
33
+ * hours before it, and on Beijing's clock it is 11:12. The reply may name no sender, the hub's
34
+ * country or Switzerland: one naming Switzerland, with the hub's deposit at 10:56 +01:00, had
35
+ * the notice at 19:16 +01:00 when Swiss Post answered at 14:21. Senders in Switzerland give
36
+ * their notice another code (600), on Swiss Post's clock, as parcels do.
37
37
  */
38
38
  export const PRE_ADVICE = '859';
39
39
  export const PRE_ADVICE_ZONE = 'Asia/Shanghai';
@@ -568,6 +568,9 @@ function providerWordingStage(description) {
568
568
  // A forwarder's warehouse scanning the parcel in or out, as aggregators relay SPT Express's rows.
569
569
  if (/^item (?:in|out)bound scanning[.!]?$/i.test(value))
570
570
  return 'in_transit';
571
+ // FedEx's scan status for a parcel it has taken in, with the details aggregators join to it, as FedEx's own map reads it.
572
+ if (/^in fedex possession(?:[.!]?$|\s*[-—–:]\s)/i.test(value))
573
+ return 'accepted';
571
574
  if (/^checked in at origin hub[.!]?$|^parcel received and processing[.!]?$/i.test(value))
572
575
  return 'accepted';
573
576
  if (/^parcel shipped[.!]?$|^(?:airline|flight) delay(?:ed)?[.!]?$/i.test(value))
@@ -2,7 +2,7 @@
2
2
  "openapi": "3.1.0",
3
3
  "info": {
4
4
  "title": "Universal Parcel Scraper",
5
- "version": "0.857.0-main.4576"
5
+ "version": "0.857.2-main.4580"
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.857.0-main.4576",
3
+ "version": "0.857.2-main.4580",
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",