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
|
|
246
|
-
function preAdviceClock(event, time
|
|
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
|
-
|
|
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)
|
|
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
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
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
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
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))
|
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.857.
|
|
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",
|