universal-parcel-scraper 0.569.2-main.2644 → 0.569.4-main.2659
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 +1 -1
- package/dist/carriers/aliexpress/status.js +5 -0
- package/dist/carriers/aliexpress/statuses.json +27 -0
- package/dist/carriers/an-post/parser.js +27 -3
- package/dist/carriers/byhd/statuses.json +3 -1
- package/dist/carriers/canada-post/parser.js +4 -4
- package/dist/carriers/canada-post/status.d.ts +10 -0
- package/dist/carriers/canada-post/status.js +28 -2
- package/dist/carriers/correos-spain/status.js +3 -0
- package/dist/carriers/correos-spain/statuses.json +2 -0
- package/dist/carriers/dhl-express/status.js +9 -2
- package/dist/carriers/dhl-express/statuses.json +27 -0
- package/dist/carriers/four-px/adapter.js +7 -6
- package/dist/carriers/hermes-de/status.d.ts +3 -0
- package/dist/carriers/hermes-de/status.js +8 -0
- package/dist/carriers/imile/status.js +1 -0
- package/dist/carriers/imile/statuses.json +1 -0
- package/dist/carriers/js-express/statuses.json +2 -0
- package/dist/carriers/sf-express/status.d.ts +7 -0
- package/dist/carriers/sf-express/status.js +9 -0
- package/dist/carriers/speedpak/parser.js +1 -3
- package/dist/carriers/speedpak/status.d.ts +13 -0
- package/dist/carriers/speedpak/status.js +31 -1
- package/dist/carriers/speedpak/statuses.json +8 -0
- package/dist/carriers/swiss-post/status.js +2 -0
- package/dist/carriers/swiss-post/statuses.json +9 -0
- package/dist/carriers/tipsa/status.d.ts +6 -0
- package/dist/carriers/tipsa/status.js +8 -0
- package/dist/carriers/yanwen/status.d.ts +3 -0
- package/dist/carriers/yanwen/status.js +15 -6
- package/dist/carriers/yto/parser.js +2 -2
- package/dist/carriers/yto/status.d.ts +9 -0
- package/dist/carriers/yto/status.js +20 -1
- package/dist/carriers/yto/statuses.json +9 -0
- package/dist/carriers/yunexpress/adapter.js +1 -5
- package/dist/carriers/yunexpress/status.d.ts +4 -1
- package/dist/carriers/yunexpress/status.js +25 -3
- package/dist/carriers/yunexpress/statuses.json +32 -0
- package/dist/core/catalog/statusMaps.js +13 -6
- package/dist/providers/shared/result.js +14 -1
- package/dist/server/openapi.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -155,7 +155,7 @@ createTracker({ providers: ['ParcelsApp', 'Ship24', '17TRACK', 'Postal Ninja', '
|
|
|
155
155
|
<!-- GENERATED:stages -->
|
|
156
156
|
<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">
|
|
157
157
|
|
|
158
|
-
The carrier folders record 16,
|
|
158
|
+
The carrier folders record 16,174 such statuses, each filed under one stage.
|
|
159
159
|
<!-- /GENERATED:stages -->
|
|
160
160
|
|
|
161
161
|
Wording nobody recorded yet goes through a classifier that reads seven European languages.
|
|
@@ -22,6 +22,11 @@ export const CAINIAO_ACTION_STATUS = new Map([
|
|
|
22
22
|
['GWMS_PACKAGE', 'pending'],
|
|
23
23
|
['PRE_READY_TO_SHIP', 'pending'],
|
|
24
24
|
['CONSIGN', 'pending'],
|
|
25
|
+
// Cainiao Express's steps for a partner's parcel before Cainiao Express has
|
|
26
|
+
// it: the shipment's data, then its way from the partner's facility.
|
|
27
|
+
['LABEL_CREATED', 'pending'],
|
|
28
|
+
['PARTNER_OUTBOUND_FR', 'in_transit'],
|
|
29
|
+
['IN_TRANSIT_FR', 'in_transit'],
|
|
25
30
|
['CW_INBOUND', 'in_transit'],
|
|
26
31
|
['CW_OUTBOUND', 'in_transit'],
|
|
27
32
|
['CW_COMMON_PROCESSING1', 'in_transit'],
|
|
@@ -665,6 +665,33 @@
|
|
|
665
665
|
"confirmedBy": "live",
|
|
666
666
|
"firstSeen": "2026-10-14",
|
|
667
667
|
"note": "No stage: the order's delivery details changed, which moves no parcel."
|
|
668
|
+
},
|
|
669
|
+
{
|
|
670
|
+
"code": "LABEL_CREATED",
|
|
671
|
+
"wording": "Shipment data information received",
|
|
672
|
+
"language": "en",
|
|
673
|
+
"stage": "registered",
|
|
674
|
+
"confirmedBy": "live",
|
|
675
|
+
"firstSeen": "2026-10-20",
|
|
676
|
+
"note": "Cainiao Express holds the shipment's data from a partner; the parcel has not reached it yet."
|
|
677
|
+
},
|
|
678
|
+
{
|
|
679
|
+
"code": "PARTNER_OUTBOUND_FR",
|
|
680
|
+
"wording": "Shipment has left Cainiao Express's partner facility",
|
|
681
|
+
"language": "en",
|
|
682
|
+
"stage": "in_transit",
|
|
683
|
+
"confirmedBy": "live",
|
|
684
|
+
"firstSeen": "2026-10-20",
|
|
685
|
+
"note": "The partner's parcel leaves the partner's facility for Cainiao Express in France; the partner accepted it before."
|
|
686
|
+
},
|
|
687
|
+
{
|
|
688
|
+
"code": "IN_TRANSIT_FR",
|
|
689
|
+
"wording": "Shipment is in transit to Cainiao Express",
|
|
690
|
+
"language": "en",
|
|
691
|
+
"stage": "in_transit",
|
|
692
|
+
"confirmedBy": "live",
|
|
693
|
+
"firstSeen": "2026-10-20",
|
|
694
|
+
"note": "The partner's parcel on its way to Cainiao Express in France."
|
|
668
695
|
}
|
|
669
696
|
]
|
|
670
697
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isValidS10TrackingNumber, normalizeTrackingNumber } from '../../core/detection/index.js';
|
|
2
2
|
import { IndeterminateError, InvalidInputError, NotFoundError, SchemaError } from '../../core/errors/index.js';
|
|
3
3
|
import { languageStageStatus } from '../../core/status/index.js';
|
|
4
|
-
import { calendarDay } from '../../core/time/index.js';
|
|
4
|
+
import { calendarDay, isoTime } from '../../core/time/index.js';
|
|
5
5
|
import { clean } from '../../core/transport/index.js';
|
|
6
6
|
import { isRecord } from '../../core/types.js';
|
|
7
7
|
import { ATTEMPT_DELIVERED, ATTEMPT_MADE, anPostPostOffice, anPostScanStage, anPostSummaryStage } from './status.js';
|
|
@@ -9,6 +9,12 @@ export const AN_POST = 'An Post';
|
|
|
9
9
|
const MAX_ITEMS = 50;
|
|
10
10
|
const MAX_SCANS = 500;
|
|
11
11
|
const CLOCK = /^(\d{4})-(\d{2})-(\d{2})T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d$/;
|
|
12
|
+
const ZONE = 'Europe/Dublin';
|
|
13
|
+
/**
|
|
14
|
+
* An outbound item's codes as it leaves Ireland (5) and as the destination's
|
|
15
|
+
* delivery partner relays its scans (40, 49, 67, 68), in whole minutes.
|
|
16
|
+
*/
|
|
17
|
+
const ABROAD = new Set([5, 40, 49, 67, 68]);
|
|
12
18
|
/** An Post's own items: the catalog's S10 rule with an IE suffix and a valid check digit. */
|
|
13
19
|
export function normalizeAnPostNumber(raw) {
|
|
14
20
|
const number = normalizeTrackingNumber(raw);
|
|
@@ -27,6 +33,11 @@ function wallClock(value) {
|
|
|
27
33
|
invalid('An Post returned an invalid scan clock');
|
|
28
34
|
return match[0];
|
|
29
35
|
}
|
|
36
|
+
/** An Post's own wall clock on Irish time, unless the clocks skip it. */
|
|
37
|
+
function irishTime(local) {
|
|
38
|
+
const placed = isoTime(local, ZONE);
|
|
39
|
+
return placed?.iso.startsWith(local) ? placed.iso : undefined;
|
|
40
|
+
}
|
|
30
41
|
function text(value, max) {
|
|
31
42
|
if (value == null)
|
|
32
43
|
return '';
|
|
@@ -142,14 +153,27 @@ export function parseAnPostEvents(payload, summary) {
|
|
|
142
153
|
if (seen.has(key))
|
|
143
154
|
continue;
|
|
144
155
|
seen.add(key);
|
|
145
|
-
scans.push({ event, activity, stage, text: description, local, ...(office ? { office } : {}) });
|
|
156
|
+
scans.push({ event, code, activity, stage, text: description, local, ...(office ? { office } : {}) });
|
|
146
157
|
}
|
|
158
|
+
// The scans until an outbound item's dispatch abroad, or before the partner's
|
|
159
|
+
// first relayed scan, are An Post's own, on Irish time. Later ones may keep
|
|
160
|
+
// the destination's clock, so they keep their wall clocks.
|
|
161
|
+
let abroad = -1;
|
|
162
|
+
scans.forEach(({ code }, index) => { if (ABROAD.has(code))
|
|
163
|
+
abroad = index; });
|
|
164
|
+
scans.forEach((scan, index) => {
|
|
165
|
+
const time = abroad < 0 || index > abroad || (index === abroad && scan.code === 5) ? irishTime(scan.local) : undefined;
|
|
166
|
+
if (time)
|
|
167
|
+
scan.event = { time, ...scan.event };
|
|
168
|
+
});
|
|
147
169
|
// Provider order is kept: relayed partner scans may keep another country's
|
|
148
170
|
// clock, so the wall clocks do not reorder them.
|
|
149
171
|
const current = currentState(scans, summary);
|
|
150
172
|
const pickup = pickupPoint(scans, current);
|
|
173
|
+
// A summary ahead of the history is no listed scan, so it keeps its wall clock.
|
|
174
|
+
const time = scans.includes(current) ? current.event.time : undefined;
|
|
151
175
|
return { status: current.stage ? languageStageStatus(current.stage.stage) : 'unknown',
|
|
152
176
|
...(current.stage ? { current_stage: current.stage.stage, current_stage_source: current.stage.source } : {}),
|
|
153
|
-
last_status_text: current.text, last_update: null, last_update_local: current.local,
|
|
177
|
+
last_status_text: current.text, last_update: time ?? null, last_update_local: current.local,
|
|
154
178
|
...(pickup ? { pickup_point: pickup } : {}), expected_delivery: null, events: scans.slice(0, 100).map(({ event }) => event) };
|
|
155
179
|
}
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
"carrier": "byhd",
|
|
3
3
|
"entries": [
|
|
4
4
|
{"wording": "The electronic cargo information has been received", "language": "en", "stage": "registered", "confirmedBy": "live", "note": "The platform's own row for an order without scans, in English on BYHD's tracker."},
|
|
5
|
-
{"wording": "货物电子信息已经收到", "language": "zh", "stage": "registered", "confirmedBy": "prior-art", "note": "The same row as the platform's other tenants write it."}
|
|
5
|
+
{"wording": "货物电子信息已经收到", "language": "zh", "stage": "registered", "confirmedBy": "prior-art", "note": "The same row as the platform's other tenants write it."},
|
|
6
|
+
{"code": "ARRIVAL", "wording": "到达收货点", "language": "zh", "stage": "accepted", "confirmedBy": "live", "note": "Arrived at BYHD's receiving point, which takes the parcel in, as GZYL's \"Arrive at the cross border receiving point\" on the same platform. The kind code groups other arrivals."},
|
|
7
|
+
{"code": "SHIPMENT", "wording": "Goods leaving the operation center", "language": "en", "stage": "in_transit", "confirmedBy": "live", "note": "The parcel leaves BYHD's operation center, as GZYL's \"Goods leave the operation center\". The kind code groups other departures."}
|
|
6
8
|
]
|
|
7
9
|
}
|
|
@@ -4,7 +4,7 @@ import { IndeterminateError, InvalidInputError, SchemaError } from '../../core/e
|
|
|
4
4
|
import { canadaProvinceTimeZone, countryTimeZone, explicitOffsetTime, isoTime } from '../../core/time/index.js';
|
|
5
5
|
import { clean } from '../../core/transport/index.js';
|
|
6
6
|
import { isRecord } from '../../core/types.js';
|
|
7
|
-
import { canadaPostPackageStage, canadaPostScanStage, canadaPostStage, isKnownCanadaPostScan, statusForStage } from './status.js';
|
|
7
|
+
import { canadaPostPackageStage, canadaPostScanStage, canadaPostStage, isKnownCanadaPostScan, RETURNED_TO_SENDER, SIGNATURE_CODE, statusForStage } from './status.js';
|
|
8
8
|
export function normalizeCanadaPostNumber(raw) {
|
|
9
9
|
const value = raw.toUpperCase().replace(/[\s.-]/g, '');
|
|
10
10
|
// Mail arriving from abroad keeps the sending post's S10 number on Canada Post's tracker.
|
|
@@ -185,7 +185,7 @@ export function parseCanadaPostTrackingResponse(payload, trackingNumber) {
|
|
|
185
185
|
const country = isRecord(raw.locationAddr) ? textField(raw.locationAddr, 'countryCd', 8).toUpperCase() : '';
|
|
186
186
|
const location = isRecord(raw.locationAddr)
|
|
187
187
|
? [textField(raw.locationAddr, 'city', 160), region].filter(Boolean).join(', ') : '';
|
|
188
|
-
const stage = type === 'Signature' || code ===
|
|
188
|
+
const stage = type === 'Signature' || code === SIGNATURE_CODE ? null : canadaPostScanStage(code, description) ?? canadaPostStage(description);
|
|
189
189
|
const relayed = relayedClock(code, country, region);
|
|
190
190
|
const clock = eventClock(raw.datetime, relayed);
|
|
191
191
|
const event = { ...clock, description: stage === 'delivered' ? 'Delivered' : description,
|
|
@@ -206,7 +206,7 @@ export function parseCanadaPostTrackingResponse(payload, trackingNumber) {
|
|
|
206
206
|
row.event.provider_leg = 'return';
|
|
207
207
|
if (row.event.stage === 'delivered') {
|
|
208
208
|
row.event.stage = 'returned';
|
|
209
|
-
row.event.description =
|
|
209
|
+
row.event.description = RETURNED_TO_SENDER;
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
212
|
}
|
|
@@ -266,7 +266,7 @@ export function parseCanadaPostTrackingResponse(payload, trackingNumber) {
|
|
|
266
266
|
const service = clean(payload.productNmEn, 80);
|
|
267
267
|
return { status: current ? statusForStage(current) : 'unknown', ...(current ? { current_stage: current } : {}),
|
|
268
268
|
last_status_text: snapshot === 'return' ? 'Return to sender' : current === 'delivered' ? 'Delivered'
|
|
269
|
-
: current === 'returned' ?
|
|
269
|
+
: current === 'returned' ? RETURNED_TO_SENDER : latest.event.description,
|
|
270
270
|
last_update: snapshot ? null : latest.event.time ?? null,
|
|
271
271
|
...(!snapshot && latest.event.local_time ? { last_update_local: latest.event.local_time } : {}),
|
|
272
272
|
expected_delivery: window?.expected_delivery ?? expected,
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
import type { CarrierStatus } from '../../core/result/index.js';
|
|
2
2
|
import { type Stage } from '../../core/status/index.js';
|
|
3
|
+
import { type CarrierStatusMap } from '../../core/status/statusMap.js';
|
|
3
4
|
/** The official client's package enum and English translations. */
|
|
4
5
|
export declare const CANADA_POST_STATUS_STAGE: Readonly<Record<string, Stage>>;
|
|
5
6
|
export declare function canadaPostPackageStage(code: string): Stage | null;
|
|
6
7
|
export declare function canadaPostScanStage(code: string, description?: string): Stage | null;
|
|
8
|
+
/** The signature captured at delivery, a proof beside the delivery scan. */
|
|
9
|
+
export declare const SIGNATURE_CODE = "20";
|
|
10
|
+
/** The wording of a delivery on the way back: the return reached the sender. */
|
|
11
|
+
export declare const RETURNED_TO_SENDER = "Returned to sender";
|
|
7
12
|
/** A code whose meaning is known, whether or not it carries a stage. */
|
|
8
13
|
export declare function isKnownCanadaPostScan(code: string): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* What the map says about one scan by its code, else its wording, as the
|
|
16
|
+
* parser stages it. Every scan carries its code.
|
|
17
|
+
*/
|
|
18
|
+
export declare const statusMap: CarrierStatusMap;
|
|
9
19
|
export declare function canadaPostStage(text: string): Stage | null;
|
|
10
20
|
export declare function statusForStage(stage: Stage): CarrierStatus;
|
|
11
21
|
export declare function canadaPostStatus(code: string, text: string): CarrierStatus;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { trackingLanguageStage } from '../../core/status/index.js';
|
|
2
|
+
import { normalizeStatusWording } from '../../core/status/statusMap.js';
|
|
2
3
|
/** The official client's package enum and English translations. */
|
|
3
4
|
export const CANADA_POST_STATUS_STAGE = {
|
|
4
5
|
HalfAccepted: 'registered', FullAccepted: 'accepted', InTransit: 'in_transit',
|
|
@@ -37,12 +38,37 @@ export function canadaPostScanStage(code, description = '') {
|
|
|
37
38
|
return 'ready_for_pickup';
|
|
38
39
|
return Object.hasOwn(SCAN_STAGE, code) ? SCAN_STAGE[code] : null;
|
|
39
40
|
}
|
|
40
|
-
/** Notices that move nothing
|
|
41
|
-
const NOTICES = new
|
|
41
|
+
/** Notices that move nothing, and why. */
|
|
42
|
+
const NOTICES = new Map([
|
|
43
|
+
['1200', 'A revised delivery date: the new date is the estimate, and the parcel does not move.'],
|
|
44
|
+
['1220', "The recipient's delivery preference: it moves nothing."],
|
|
45
|
+
['1225', "The recipient's delivery preference: it moves nothing."],
|
|
46
|
+
['2001', 'A delivery photo is available: it moves nothing, and the photo is not read.'],
|
|
47
|
+
]);
|
|
48
|
+
/** The signature captured at delivery, a proof beside the delivery scan. */
|
|
49
|
+
export const SIGNATURE_CODE = '20';
|
|
50
|
+
/** The wording of a delivery on the way back: the return reached the sender. */
|
|
51
|
+
export const RETURNED_TO_SENDER = 'Returned to sender';
|
|
42
52
|
/** A code whose meaning is known, whether or not it carries a stage. */
|
|
43
53
|
export function isKnownCanadaPostScan(code) {
|
|
44
54
|
return canadaPostScanStage(code) !== null || NOTICES.has(code);
|
|
45
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* What the map says about one scan by its code, else its wording, as the
|
|
58
|
+
* parser stages it. Every scan carries its code.
|
|
59
|
+
*/
|
|
60
|
+
export const statusMap = {
|
|
61
|
+
stage: (code, wording) => {
|
|
62
|
+
if (!code || code === SIGNATURE_CODE)
|
|
63
|
+
return undefined;
|
|
64
|
+
const stage = canadaPostScanStage(code, wording) ?? canadaPostStage(wording) ?? undefined;
|
|
65
|
+
return stage === 'delivered' && wording === normalizeStatusWording(RETURNED_TO_SENDER) ? 'returned' : stage;
|
|
66
|
+
},
|
|
67
|
+
gaps: [
|
|
68
|
+
{ code: SIGNATURE_CODE, note: 'The signature captured at delivery: a proof beside the delivery scan, not a scan of its own.' },
|
|
69
|
+
...[...NOTICES].map(([code, note]) => ({ code, note })),
|
|
70
|
+
],
|
|
71
|
+
};
|
|
46
72
|
export function canadaPostStage(text) {
|
|
47
73
|
const value = text.toLowerCase();
|
|
48
74
|
if (/\b(?:will|may|might|would)\b.*\breturn(?:ed)?\b/.test(value))
|
|
@@ -56,6 +56,9 @@ const EVENT_STATUS = {
|
|
|
56
56
|
// Observed live on public certified letters in the number corpus.
|
|
57
57
|
'E000001V': { status: 'in_transit', stage: 'customs' },
|
|
58
58
|
'E040990V': { status: 'in_transit', stage: 'customs' },
|
|
59
|
+
// In the origin country's customs; then the processing completed, which puts the parcel back in transit.
|
|
60
|
+
'B170000V': { status: 'in_transit', stage: 'customs' },
|
|
61
|
+
'E510000V': { status: 'in_transit', stage: 'in_transit' },
|
|
59
62
|
// Handed back to the sender, or on the way back: never a delivery to the recipient.
|
|
60
63
|
'I020000V': { status: 'exception', stage: 'returned' },
|
|
61
64
|
'I01H230V': { status: 'exception', stage: 'returned' },
|
|
@@ -49,6 +49,8 @@
|
|
|
49
49
|
{ "code": "HI10002V", "wording": "Envío recogido", "language": "es", "stage": "accepted", "confirmedBy": "live", "firstSeen": "2026-10-17", "note": "Collected from the address of a pickup request. The English reply gives no summary for it." },
|
|
50
50
|
{ "code": "E000001V", "wording": "Inicio de tramitación aduanera", "language": "es", "stage": "customs", "confirmedBy": "live", "firstSeen": "2026-10-05", "note": "Arrived at Correos' facilities; customs processing starts." },
|
|
51
51
|
{ "code": "E040990V", "wording": "Pendiente de tramitación aduanera", "language": "es", "stage": "customs", "confirmedBy": "live", "firstSeen": "2026-10-05", "note": "" },
|
|
52
|
+
{ "code": "E510000V", "wording": "Finalizada tramitación aduanera", "language": "es", "stage": "in_transit", "confirmedBy": "live", "firstSeen": "2026-10-20", "note": "Customs processing completed; the parcel goes on in transit." },
|
|
53
|
+
{ "code": "B170000V", "wording": "En aduana de origen", "language": "es", "stage": "customs", "confirmedBy": "live", "firstSeen": "2026-10-20", "note": "In the origin country's customs." },
|
|
52
54
|
{ "code": "I020000V", "wording": "Entregado al remitente", "language": "es", "stage": "returned", "confirmedBy": "live", "firstSeen": "2026-10-05", "note": "Handed back to the sender, not to the recipient. Reported as status 'exception', like the other return codes." },
|
|
53
55
|
{ "code": "I01H230V", "wording": "Returned to the sender in the Post Office", "language": "en", "stage": "returned", "confirmedBy": "live", "firstSeen": "2026-10-05", "note": "Handed back to the sender at an office." },
|
|
54
56
|
{ "code": "O130000V", "wording": "En proceso de devolución", "language": "es", "stage": "returned", "confirmedBy": "live", "firstSeen": "2026-10-05", "note": "The delivery unit holds it for return at the sender's request." },
|
|
@@ -19,9 +19,14 @@ const EXACT = new Map([
|
|
|
19
19
|
['shipment is out with courier for delivery', 'out_for_delivery'],
|
|
20
20
|
['shipment is on hold', 'exception'],
|
|
21
21
|
['delivered', 'delivered'],
|
|
22
|
+
// Sent back: the shipper, not the consignee, has the parcel.
|
|
23
|
+
['returned to shipper', 'returned'],
|
|
22
24
|
]);
|
|
23
25
|
const PREFIXES = [
|
|
24
26
|
['delivery attempted', 'failed_attempt'],
|
|
27
|
+
['delivery attempt could not be completed', 'failed_attempt'],
|
|
28
|
+
// Held at a DHL facility for the consignee to collect.
|
|
29
|
+
['awaiting collection by ', 'ready_for_pickup'],
|
|
25
30
|
// A missort: DHL forwards the parcel to the right facility, late.
|
|
26
31
|
['shipment arrived at incorrect facility', 'exception'],
|
|
27
32
|
// A completed clearance puts the parcel back in transit; one still running stays in customs.
|
|
@@ -38,11 +43,13 @@ const PREFIXES = [
|
|
|
38
43
|
* DHL's event codes on the unified feed, each seen with the wording above: SA
|
|
39
44
|
* the shipment's acceptance, IC its processing for clearance, CD a clearance
|
|
40
45
|
* step without its outcome, PY the payment of fees during clearance, MS a
|
|
41
|
-
* missort
|
|
42
|
-
*
|
|
46
|
+
* missort, CC the wait for the consignee's collection, ND a delivery attempt
|
|
47
|
+
* that could not be completed, RT the return to the shipper. They stage a scan
|
|
48
|
+
* whose wording the map does not know, as in another language.
|
|
43
49
|
*/
|
|
44
50
|
const CODES = new Map([
|
|
45
51
|
['SA', 'accepted'], ['IC', 'customs'], ['CD', 'customs'], ['PY', 'customs'], ['MS', 'exception'],
|
|
52
|
+
['CC', 'ready_for_pickup'], ['ND', 'failed_attempt'], ['RT', 'returned'],
|
|
46
53
|
]);
|
|
47
54
|
/** The checkpoint's stage from DHL's own wording, if the wording is one of DHL's checkpoints. */
|
|
48
55
|
export function dhlExpressCheckpointStage(description) {
|
|
@@ -147,6 +147,33 @@
|
|
|
147
147
|
"stage": "exception",
|
|
148
148
|
"confirmedBy": "live",
|
|
149
149
|
"note": "A missort: the parcel goes on to the right facility, late. The unified feed codes it MS; the web feed sends the wording alone."
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"code": "CC",
|
|
153
|
+
"wording": "Awaiting collection by the consignee",
|
|
154
|
+
"language": "en",
|
|
155
|
+
"stage": "ready_for_pickup",
|
|
156
|
+
"confirmedBy": "live",
|
|
157
|
+
"firstSeen": "2026-10-20",
|
|
158
|
+
"note": "Held at a DHL facility for the consignee to collect; matched on its start. The unified feed codes it CC, which stages it in any wording."
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"code": "ND",
|
|
162
|
+
"wording": "Delivery attempt could not be completed",
|
|
163
|
+
"language": "en",
|
|
164
|
+
"stage": "failed_attempt",
|
|
165
|
+
"confirmedBy": "live",
|
|
166
|
+
"firstSeen": "2026-10-20",
|
|
167
|
+
"note": "Matched on its start. The unified feed codes it ND, which stages it in any wording."
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"code": "RT",
|
|
171
|
+
"wording": "Returned to shipper",
|
|
172
|
+
"language": "en",
|
|
173
|
+
"stage": "returned",
|
|
174
|
+
"confirmedBy": "live",
|
|
175
|
+
"firstSeen": "2026-10-20",
|
|
176
|
+
"note": "The unified feed codes it RT, which stages it in any wording."
|
|
150
177
|
}
|
|
151
178
|
]
|
|
152
179
|
}
|
|
@@ -50,17 +50,18 @@ function partnerOf(card) {
|
|
|
50
50
|
const QUALIFIER = /(?<=[a-z.])_[a-z]{2,8}$/i;
|
|
51
51
|
/**
|
|
52
52
|
* A partner's pickup-shop record relayed as a scan's wording: the shop's
|
|
53
|
-
* fields, then `_` and their names (`store_type;pudo_id;pudo_name;…`)
|
|
54
|
-
* no scan; the shop's name and town are the pickup point
|
|
53
|
+
* fields, then `_` and their names (`store_type;pudo_id;pudo_name;…`), in any
|
|
54
|
+
* case. It is no scan; the shop's name and town are the pickup point, and
|
|
55
|
+
* without a name there is none.
|
|
55
56
|
*/
|
|
56
57
|
function shopRecord(description) {
|
|
57
|
-
const [values, names] = description.split(/_(?=store_type;)/);
|
|
58
|
-
if (!names ||
|
|
58
|
+
const [values, names] = description.split(/_(?=store_type;)/i);
|
|
59
|
+
if (!names || !/(?:^|;)pudo_[a-z]+(?:;|$)/i.test(names))
|
|
59
60
|
return undefined;
|
|
60
61
|
const fields = values.split(';');
|
|
61
62
|
const field = (name) => clean(fields[names.toLowerCase().split(';').indexOf(name)], 120);
|
|
62
|
-
const
|
|
63
|
-
return
|
|
63
|
+
const shop = field('pudo_name');
|
|
64
|
+
return shop ? { point: [shop, field('city')].filter(Boolean).join(', ') } : {};
|
|
64
65
|
}
|
|
65
66
|
export function parse(payload, trackingNumber) {
|
|
66
67
|
const number = normalizeFourPxNumber(trackingNumber);
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* records the wording for review.
|
|
13
13
|
*/
|
|
14
14
|
import type { CarrierStatus } from '../../core/result/index.js';
|
|
15
|
+
import type { CarrierStatusMap } from '../../core/status/statusMap.js';
|
|
15
16
|
import type { Stage } from '../../generated/catalog.js';
|
|
16
17
|
export interface Milestone {
|
|
17
18
|
stage: Stage;
|
|
@@ -34,3 +35,5 @@ export declare const IN_PARCELBOX = "DELIVERED_PARCELBOX";
|
|
|
34
35
|
export declare const COLLECTED_AT_PARCELSHOP: Set<string>;
|
|
35
36
|
/** The milestone for a `parcelStatus`, or undefined when the code is not mapped. */
|
|
36
37
|
export declare function hermesGermanyMilestone(parcelStatus: string): Milestone | undefined;
|
|
38
|
+
/** What the map says about one row by its `parcelStatus`, the provider code every row carries. */
|
|
39
|
+
export declare const statusMap: CarrierStatusMap;
|
|
@@ -76,3 +76,11 @@ export const COLLECTED_AT_PARCELSHOP = new Set(['PARCELSHOP_COLLECTED_BY_CUSTOME
|
|
|
76
76
|
export function hermesGermanyMilestone(parcelStatus) {
|
|
77
77
|
return Object.hasOwn(STATUSES, parcelStatus) ? STATUSES[parcelStatus] : undefined;
|
|
78
78
|
}
|
|
79
|
+
/** What the map says about one row by its `parcelStatus`, the provider code every row carries. */
|
|
80
|
+
export const statusMap = {
|
|
81
|
+
stage: (code) => (code ? hermesGermanyMilestone(code)?.stage : undefined),
|
|
82
|
+
gaps: [...IGNORED_BOOKING_STATUS].map((code) => ({
|
|
83
|
+
code,
|
|
84
|
+
note: "The recipient's delivery preference, not a movement: the adapter drops the row so it cannot move the parcel backwards.",
|
|
85
|
+
})),
|
|
86
|
+
};
|
|
@@ -47,6 +47,7 @@ const PHRASES = new Map([
|
|
|
47
47
|
['your order has assigned delivery drvier', 'in_transit'],
|
|
48
48
|
['dispatch task assigned to da', 'in_transit'],
|
|
49
49
|
['our delivery associate is out for delivery', 'out_for_delivery'],
|
|
50
|
+
['shipment out for delivery', 'out_for_delivery'],
|
|
50
51
|
['delivery attempt finished,return to local logistics company warehouse', 'failed_attempt'],
|
|
51
52
|
// Drivers' reasons, each followed by the attempt's end and the return to the centre.
|
|
52
53
|
['switch off', 'failed_attempt'],
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
{"code": "1003", "wording": "Parcel is currently being processed.", "stage": "in_transit", "language": "en", "confirmedBy": "live", "note": "At the last-mile station."},
|
|
30
30
|
{"code": "1003", "wording": "Your order has assigned delivery drvier.", "stage": "in_transit", "language": "en", "confirmedBy": "live", "note": "The driver is named before the parcel leaves the station; the misspelling is iMile's."},
|
|
31
31
|
{"code": "1003", "wording": "Our delivery associate is out for delivery.", "stage": "out_for_delivery", "language": "en", "confirmedBy": "live", "note": "Some countries add the driver's phone, which the adapter drops."},
|
|
32
|
+
{"code": "1003", "wording": "【Sample DS】Shipment out for delivery.", "stage": "out_for_delivery", "language": "en", "confirmedBy": "live", "note": "The delivery run as a station in the United States words it, after the station's name."},
|
|
32
33
|
{"code": "1003", "wording": "Shipment is scheduled to [2026-08-01].", "language": "en", "confirmedBy": "live", "unmapped": true, "note": "A delivery day booked; moves nothing."},
|
|
33
34
|
{"code": "1003", "wording": "The driver failed to deliver due to shop(building) closure, we will try to deliver again.", "stage": "failed_attempt", "language": "en", "confirmedBy": "live"},
|
|
34
35
|
{"code": "1003", "wording": "Customer Wants to Change Location", "stage": "failed_attempt", "language": "en", "confirmedBy": "live", "note": "A driver's reason, followed by the attempt's end."},
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
{"wording": "Item Flight landing", "stage": "in_transit", "language": "en", "confirmedBy": "live"},
|
|
21
21
|
{"wording": "NOA-Notification of arrival from GHA", "stage": "in_transit", "language": "en", "confirmedBy": "live", "note": "The destination airport's ground handling agent reports the shipment arrived."},
|
|
22
22
|
{"wording": "The goods have been picked up abroad", "stage": "in_transit", "language": "en", "confirmedBy": "live", "note": "The destination agent took the shipment from the airport; JS Express accepted the parcel long before."},
|
|
23
|
+
{"wording": "Inbound to customs temporary warehouse", "stage": "customs", "language": "en", "confirmedBy": "live", "note": "The shipment entered a customs warehouse to wait for its clearance."},
|
|
23
24
|
{"wording": "Released From Import Customs", "stage": "in_transit", "language": "en", "confirmedBy": "live"},
|
|
24
25
|
{"wording": "Prepared for last mile handover", "stage": "in_transit", "language": "en", "confirmedBy": "source", "note": "Relayed by ParcelsApp after the import release at the destination airport, before the destination courier has the parcel."},
|
|
25
26
|
{"wording": "The cargo tally in the supervised warehouse is in progress.", "stage": "in_transit", "language": "en", "confirmedBy": "source", "note": "Relayed by ParcelsApp after the import release: the bonded warehouse counting the shipment's pieces, no new customs step."},
|
|
@@ -30,6 +31,7 @@
|
|
|
30
31
|
{"wording": "SHIPPING INFORMATION RECEIVED", "unmapped": true, "language": "en", "confirmedBy": "live", "note": "A partner's record of the parcel's data, written while the parcel was already flying; it moves nothing."},
|
|
31
32
|
{"wording": "SHIPMENT CREATED", "unmapped": true, "language": "en", "confirmedBy": "live", "note": "A partner's record of the parcel's data, written after JS Express had the order; it moves nothing."},
|
|
32
33
|
{"wording": "Package information is created in the system", "unmapped": true, "language": "en", "confirmedBy": "live", "note": "The destination courier's record of the parcel's data, written days before it has the parcel; it moves nothing."},
|
|
34
|
+
{"wording": "Your package is being prepared by the sender and will be handed over to us soon", "unmapped": true, "language": "en", "confirmedBy": "live", "note": "A courier's record of the parcel's data, in its own voice, before JS Express hands the parcel over; it moves nothing."},
|
|
33
35
|
{"wording": "Package will be delivered before 9:00pm", "unmapped": true, "language": "en", "confirmedBy": "live", "note": "The destination courier's delivery forecast for the day, with its place moved into the location; no scan."}
|
|
34
36
|
]
|
|
35
37
|
}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import type { ClassifiedStatus } from '../../core/status/index.js';
|
|
2
|
+
import type { CarrierStatusMap } from '../../core/status/statusMap.js';
|
|
2
3
|
/** Codes 8000 and 70 are ambiguous without their reason, and 99 without its remark; do not default them to signed. */
|
|
3
4
|
export declare function sfExpressEventStatus(code: string, reason: string, remark?: string): ClassifiedStatus | undefined;
|
|
5
|
+
/**
|
|
6
|
+
* What the map says about one scan by its operation code, and code 99 by its
|
|
7
|
+
* remark, which is the scan's wording. Codes 8000 and 70 are read by a reason
|
|
8
|
+
* the provider code does not carry, so the code alone gives them no stage.
|
|
9
|
+
*/
|
|
10
|
+
export declare const statusMap: CarrierStatusMap;
|
|
4
11
|
export declare function sfExpressSummaryStatus(state: string, signed: boolean): ClassifiedStatus | undefined;
|
|
@@ -46,6 +46,15 @@ export function sfExpressEventStatus(code, reason, remark = '') {
|
|
|
46
46
|
return NOTICES.find(([wording]) => wording.test(remark.trim()))?.[1];
|
|
47
47
|
return CODES.get(code);
|
|
48
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* What the map says about one scan by its operation code, and code 99 by its
|
|
51
|
+
* remark, which is the scan's wording. Codes 8000 and 70 are read by a reason
|
|
52
|
+
* the provider code does not carry, so the code alone gives them no stage.
|
|
53
|
+
*/
|
|
54
|
+
export const statusMap = {
|
|
55
|
+
stage: (code, wording) => (code ? sfExpressEventStatus(code, '', wording)?.stage : undefined),
|
|
56
|
+
gaps: [],
|
|
57
|
+
};
|
|
49
58
|
export function sfExpressSummaryStatus(state, signed) {
|
|
50
59
|
const explicit = SUMMARY.get(state);
|
|
51
60
|
return explicit ?? (signed ? DELIVERED : undefined);
|
|
@@ -4,11 +4,9 @@ import { IndeterminateError, InvalidInputError, NotFoundError, SchemaError } fro
|
|
|
4
4
|
import { countryCode, epochMillisTime } from '../../core/time/index.js';
|
|
5
5
|
import { clean } from '../../core/transport/index.js';
|
|
6
6
|
import { isRecord } from '../../core/types.js';
|
|
7
|
-
import { speedpakScanStatus } from './status.js';
|
|
7
|
+
import { HANDOFF, speedpakScanStatus } from './status.js';
|
|
8
8
|
import { withoutRoutingPrefix } from './wording.js';
|
|
9
9
|
const PROVIDER = 'SpeedPAK';
|
|
10
|
-
// Written in English or Chinese, with a full- or half-width colon.
|
|
11
|
-
const HANDOFF = /^(?:LM Carrier|尾程供应商)\s*[::]\s*\[([^\]]+)\]\s*,\s*(?:LM tracking No[..]?|尾程跟踪号)\s*[::]\s*\[([A-Z0-9]{4,40})\]$/;
|
|
12
10
|
export function normalizeSpeedpakNumber(raw) {
|
|
13
11
|
const number = normalizeTrackingNumber(raw);
|
|
14
12
|
if (!/^E[ES][A-Z0-9]{26}$/.test(number))
|
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
import type { ClassifiedStatus } from '../../core/status/index.js';
|
|
2
|
+
import { type CarrierStatusMap } from '../../core/status/statusMap.js';
|
|
3
|
+
/**
|
|
4
|
+
* The line naming the last-mile carrier and its reference, in English or
|
|
5
|
+
* Chinese, with a full- or half-width colon. SpeedPAK files it under
|
|
6
|
+
* 同步尾程供应商, the hand-over to that carrier, so it is a movement.
|
|
7
|
+
*/
|
|
8
|
+
export declare const HANDOFF: RegExp;
|
|
2
9
|
export declare function speedpakStatus(wording: string): ClassifiedStatus | null;
|
|
3
10
|
/** The English wording's status, else the Chinese label's. */
|
|
4
11
|
export declare function speedpakScanStatus(wording: string, label: string): ClassifiedStatus | null;
|
|
12
|
+
/**
|
|
13
|
+
* What the map says about one scan by its English wording, the only key a scan
|
|
14
|
+
* keeps: it has no code, and SpeedPAK's Chinese label, which stages the scans
|
|
15
|
+
* whose English wording is a last-mile carrier's, is not stored with it.
|
|
16
|
+
*/
|
|
17
|
+
export declare const statusMap: CarrierStatusMap;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { normalizeStatusWording } from '../../core/status/statusMap.js';
|
|
1
2
|
const MAP = {
|
|
2
3
|
'Shipment Data Received': { status: 'pending', stage: 'registered' },
|
|
3
4
|
'Package Received': { status: 'in_transit', stage: 'accepted' },
|
|
@@ -46,12 +47,41 @@ const LABELS = {
|
|
|
46
47
|
开始派送: { status: 'out_for_delivery', stage: 'out_for_delivery' },
|
|
47
48
|
派送完成: { status: 'delivered', stage: 'delivered' },
|
|
48
49
|
};
|
|
50
|
+
const DELIVERED = /^Delivered(?:$|\. \()/;
|
|
51
|
+
/**
|
|
52
|
+
* The line naming the last-mile carrier and its reference, in English or
|
|
53
|
+
* Chinese, with a full- or half-width colon. SpeedPAK files it under
|
|
54
|
+
* 同步尾程供应商, the hand-over to that carrier, so it is a movement.
|
|
55
|
+
*/
|
|
56
|
+
export const HANDOFF = /^(?:LM Carrier|尾程供应商)\s*[::]\s*\[([^\]]+)\]\s*,\s*(?:LM tracking No[..]?|尾程跟踪号)\s*[::]\s*\[([A-Z0-9]{4,40})\]$/;
|
|
49
57
|
export function speedpakStatus(wording) {
|
|
50
|
-
if (
|
|
58
|
+
if (DELIVERED.test(wording))
|
|
51
59
|
return { status: 'delivered', stage: 'delivered' };
|
|
60
|
+
if (HANDOFF.test(wording))
|
|
61
|
+
return MOVING;
|
|
52
62
|
return Object.hasOwn(MAP, wording) ? MAP[wording] : null;
|
|
53
63
|
}
|
|
54
64
|
/** The English wording's status, else the Chinese label's. */
|
|
55
65
|
export function speedpakScanStatus(wording, label) {
|
|
56
66
|
return speedpakStatus(wording) ?? (Object.hasOwn(LABELS, label) ? LABELS[label] : null);
|
|
57
67
|
}
|
|
68
|
+
const STAGE_BY_WORDING = new Map(Object.entries(MAP).map(([wording, { stage }]) => [normalizeStatusWording(wording), stage]));
|
|
69
|
+
const DELIVERED_WORDING = new RegExp(DELIVERED.source, 'i');
|
|
70
|
+
const HANDOFF_WORDING = new RegExp(HANDOFF.source, 'i');
|
|
71
|
+
/**
|
|
72
|
+
* What the map says about one scan by its English wording, the only key a scan
|
|
73
|
+
* keeps: it has no code, and SpeedPAK's Chinese label, which stages the scans
|
|
74
|
+
* whose English wording is a last-mile carrier's, is not stored with it.
|
|
75
|
+
*/
|
|
76
|
+
export const statusMap = {
|
|
77
|
+
stage: (code, wording) => {
|
|
78
|
+
if (code)
|
|
79
|
+
return undefined;
|
|
80
|
+
if (DELIVERED_WORDING.test(wording))
|
|
81
|
+
return 'delivered';
|
|
82
|
+
if (HANDOFF_WORDING.test(wording))
|
|
83
|
+
return MOVING.stage;
|
|
84
|
+
return STAGE_BY_WORDING.get(wording);
|
|
85
|
+
},
|
|
86
|
+
gaps: [],
|
|
87
|
+
};
|
|
@@ -73,6 +73,14 @@
|
|
|
73
73
|
"stage": "delivered",
|
|
74
74
|
"confirmedBy": "live"
|
|
75
75
|
},
|
|
76
|
+
{
|
|
77
|
+
"wording": "LM Carrier: [<carrier>] , LM tracking No.: [<reference>]",
|
|
78
|
+
"language": "en",
|
|
79
|
+
"stage": "in_transit",
|
|
80
|
+
"confirmedBy": "live",
|
|
81
|
+
"firstSeen": "2026-10-20",
|
|
82
|
+
"note": "The line naming the last-mile carrier and its reference, also written in Chinese. SpeedPAK files it under its label 同步尾程供应商, the hand-over to that carrier."
|
|
83
|
+
},
|
|
76
84
|
{
|
|
77
85
|
"wording": "订单接受",
|
|
78
86
|
"language": "zh",
|
|
@@ -70,6 +70,8 @@ export const EVENT_STAGE_BY_CODE = {
|
|
|
70
70
|
'1204': 'in_transit',
|
|
71
71
|
'1213': 'in_transit',
|
|
72
72
|
'1218': 'in_transit',
|
|
73
|
+
// Handed to the recipient at a post office counter.
|
|
74
|
+
'2000': 'delivered',
|
|
73
75
|
// A pickup notice like 910: the item waits at a post office for collection.
|
|
74
76
|
'2100': 'ready_for_pickup',
|
|
75
77
|
'2101': 'ready_for_pickup',
|
|
@@ -449,6 +449,15 @@
|
|
|
449
449
|
"confirmedBy": "live",
|
|
450
450
|
"firstSeen": "2026-09-10"
|
|
451
451
|
},
|
|
452
|
+
{
|
|
453
|
+
"code": "2000",
|
|
454
|
+
"wording": "Delivered over counter",
|
|
455
|
+
"language": "en",
|
|
456
|
+
"stage": "delivered",
|
|
457
|
+
"confirmedBy": "live",
|
|
458
|
+
"firstSeen": "2026-10-20",
|
|
459
|
+
"note": "Handed to the recipient at a post office counter."
|
|
460
|
+
},
|
|
452
461
|
{
|
|
453
462
|
"code": "2100",
|
|
454
463
|
"wording": "Registered for collection",
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import { type ClassifiedStatus } from '../../core/status/index.js';
|
|
2
|
+
import type { CarrierStatusMap } from '../../core/status/statusMap.js';
|
|
2
3
|
/** A label's stage: TIPSA's own vocabulary first, then the shared Spanish and Portuguese wording rules. */
|
|
3
4
|
export declare function tipsaStatus(label: string): ClassifiedStatus | undefined;
|
|
5
|
+
/**
|
|
6
|
+
* What the map says about one history label, the only key a scan has: TIPSA's
|
|
7
|
+
* own labels, else the shared wording rules the adapter reads them with.
|
|
8
|
+
*/
|
|
9
|
+
export declare const statusMap: CarrierStatusMap;
|
|
@@ -23,3 +23,11 @@ export function tipsaStatus(label) {
|
|
|
23
23
|
const worded = trackingLanguageStage(label);
|
|
24
24
|
return worded ? { status: languageStageStatus(worded), stage: worded } : undefined;
|
|
25
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* What the map says about one history label, the only key a scan has: TIPSA's
|
|
28
|
+
* own labels, else the shared wording rules the adapter reads them with.
|
|
29
|
+
*/
|
|
30
|
+
export const statusMap = {
|
|
31
|
+
stage: (code, wording) => (code ? undefined : tipsaStatus(wording)?.stage),
|
|
32
|
+
gaps: [],
|
|
33
|
+
};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { CarrierStatus } from '../../core/result/index.js';
|
|
2
2
|
import type { ClassifiedStatus, Stage } from '../../core/status/index.js';
|
|
3
|
+
import { type CarrierStatusMap } from '../../core/status/statusMap.js';
|
|
3
4
|
export declare function yanwenStatus(description: string, code?: string): ClassifiedStatus | undefined;
|
|
5
|
+
/** What the map says about one scan by its milestone icon, the only code it keeps, else its wording. */
|
|
6
|
+
export declare const statusMap: CarrierStatusMap;
|
|
4
7
|
/** The parcel's status from the category on its identity field, for scans the map does not know. */
|
|
5
8
|
export declare function yanwenCategory(category: unknown): {
|
|
6
9
|
status: CarrierStatus;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { normalizeStatusWording } from '../../core/status/statusMap.js';
|
|
1
2
|
const WORDING = new Map([
|
|
2
3
|
['Delivered.', { status: 'delivered', stage: 'delivered' }],
|
|
3
4
|
['Shipment out for delivery.', { status: 'out_for_delivery', stage: 'out_for_delivery' }],
|
|
@@ -50,15 +51,23 @@ const CATEGORY = new Map([
|
|
|
50
51
|
['包裹异常', { status: 'exception', stage: 'exception' }],
|
|
51
52
|
['包裹退回', { status: 'exception', stage: 'returned' }],
|
|
52
53
|
]);
|
|
54
|
+
// The timeline marks the delivery scan with its LM40 milestone icon, whatever
|
|
55
|
+
// wording the last-mile carrier used for it.
|
|
56
|
+
const DELIVERY_ICON = 'LM40';
|
|
57
|
+
// Partner wording can prefix its facility in full-width brackets. Removing
|
|
58
|
+
// that observed prefix makes the remaining exact wording reusable.
|
|
59
|
+
const withoutFacility = (description) => description.replace(/^【[^】]*】\s*/, '').trim();
|
|
53
60
|
export function yanwenStatus(description, code) {
|
|
54
|
-
|
|
55
|
-
// wording the last-mile carrier used for it.
|
|
56
|
-
if (code === 'LM40')
|
|
61
|
+
if (code === DELIVERY_ICON)
|
|
57
62
|
return { status: 'delivered', stage: 'delivered' };
|
|
58
|
-
|
|
59
|
-
// that observed prefix makes the remaining exact wording reusable.
|
|
60
|
-
return WORDING.get(description.replace(/^【[^】]*】\s*/, '').trim());
|
|
63
|
+
return WORDING.get(withoutFacility(description));
|
|
61
64
|
}
|
|
65
|
+
const STAGE_BY_WORDING = new Map([...WORDING].map(([wording, { stage }]) => [normalizeStatusWording(wording), stage]));
|
|
66
|
+
/** What the map says about one scan by its milestone icon, the only code it keeps, else its wording. */
|
|
67
|
+
export const statusMap = {
|
|
68
|
+
stage: (code, wording) => (code === DELIVERY_ICON ? 'delivered' : STAGE_BY_WORDING.get(withoutFacility(wording))),
|
|
69
|
+
gaps: [],
|
|
70
|
+
};
|
|
62
71
|
/** The parcel's status from the category on its identity field, for scans the map does not know. */
|
|
63
72
|
export function yanwenCategory(category) {
|
|
64
73
|
return typeof category === 'string' ? CATEGORY.get(category) : undefined;
|
|
@@ -4,7 +4,7 @@ import { IndeterminateError, InvalidInputError, SchemaError } from '../../core/e
|
|
|
4
4
|
import { zonedTime } from '../../core/time/index.js';
|
|
5
5
|
import { clean } from '../../core/transport/index.js';
|
|
6
6
|
import { isRecord } from '../../core/types.js';
|
|
7
|
-
import { ytoScan, ytoStatus } from './status.js';
|
|
7
|
+
import { YTO_RETURNED, ytoScan, ytoStatus } from './status.js';
|
|
8
8
|
const PROVIDER = 'YTO Express';
|
|
9
9
|
// The domestic client's /ec/apollo/checkWaybillNo rules. Keep them local so a
|
|
10
10
|
// lookup does not require a separate configuration request.
|
|
@@ -56,7 +56,7 @@ export function parseYto(payload, trackingNumber) {
|
|
|
56
56
|
const mapped = ytoStatus(code, ext.signType);
|
|
57
57
|
const stage = returning && mapped?.stage === 'delivered' ? 'returned' : mapped?.stage;
|
|
58
58
|
const wording = ytoScan(label)?.wording ?? label;
|
|
59
|
-
const description = returning && mapped?.stage === 'delivered' ?
|
|
59
|
+
const description = returning && mapped?.stage === 'delivered' ? YTO_RETURNED
|
|
60
60
|
: returning && mapped?.stage === 'out_for_delivery' ? 'Out for delivery back to the sender'
|
|
61
61
|
: returning && mapped?.stage === 'ready_for_pickup' ? 'In a parcel locker or station on its way back' : wording;
|
|
62
62
|
const clock = clean(raw.opTime, 64);
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import type { ClassifiedStatus, Stage } from '../../core/status/index.js';
|
|
2
|
+
import { type CarrierStatusMap } from '../../core/status/statusMap.js';
|
|
2
3
|
/** Exact operation codes from the domestic website; unfamiliar codes stay unmapped. */
|
|
3
4
|
export declare function ytoStatus(code: string, signType?: unknown): ClassifiedStatus | undefined;
|
|
5
|
+
/** The wording of a signature on the way back: the sender took the parcel. */
|
|
6
|
+
export declare const YTO_RETURNED = "Returned to the sender";
|
|
7
|
+
/**
|
|
8
|
+
* What the map says about one scan by its operation code, where a signature
|
|
9
|
+
* worded as the trip back is the return. Code 751 is read by a sign type the
|
|
10
|
+
* code does not carry, so the code alone gives it no stage.
|
|
11
|
+
*/
|
|
12
|
+
export declare const statusMap: CarrierStatusMap;
|
|
4
13
|
export interface YtoScan {
|
|
5
14
|
stage: Stage;
|
|
6
15
|
wording: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { normalizeStatusWording } from '../../core/status/statusMap.js';
|
|
1
2
|
const STATUS = new Map([
|
|
2
3
|
['123', { status: 'in_transit', stage: 'in_transit' }],
|
|
3
4
|
['756', { status: 'in_transit', stage: 'in_transit' }],
|
|
@@ -13,14 +14,32 @@ const STATUS = new Map([
|
|
|
13
14
|
['746', { status: 'out_for_delivery', stage: 'out_for_delivery' }],
|
|
14
15
|
['745', { status: 'delivered', stage: 'delivered' }],
|
|
15
16
|
['835', { status: 'exception', stage: 'exception' }],
|
|
17
|
+
// A security check in the network, seen for a winter sports event: the parcel moves on.
|
|
18
|
+
['996', { status: 'in_transit', stage: 'in_transit' }],
|
|
16
19
|
]);
|
|
20
|
+
/** The locker or station code, read with its sign type. */
|
|
21
|
+
const STATION = '751';
|
|
17
22
|
/** Exact operation codes from the domestic website; unfamiliar codes stay unmapped. */
|
|
18
23
|
export function ytoStatus(code, signType) {
|
|
19
|
-
if (code ===
|
|
24
|
+
if (code === STATION)
|
|
20
25
|
return signType === '1'
|
|
21
26
|
? { status: 'in_transit', stage: 'in_transit' } : { status: 'in_transit', stage: 'ready_for_pickup' };
|
|
22
27
|
return STATUS.get(code);
|
|
23
28
|
}
|
|
29
|
+
/** The wording of a signature on the way back: the sender took the parcel. */
|
|
30
|
+
export const YTO_RETURNED = 'Returned to the sender';
|
|
31
|
+
/**
|
|
32
|
+
* What the map says about one scan by its operation code, where a signature
|
|
33
|
+
* worded as the trip back is the return. Code 751 is read by a sign type the
|
|
34
|
+
* code does not carry, so the code alone gives it no stage.
|
|
35
|
+
*/
|
|
36
|
+
export const statusMap = {
|
|
37
|
+
stage: (code, wording) => {
|
|
38
|
+
const stage = code && code !== STATION ? ytoStatus(code)?.stage : undefined;
|
|
39
|
+
return stage === 'delivered' && wording === normalizeStatusWording(YTO_RETURNED) ? 'returned' : stage;
|
|
40
|
+
},
|
|
41
|
+
gaps: [],
|
|
42
|
+
};
|
|
24
43
|
const SCANS = [
|
|
25
44
|
['揽收扫描', 'Pickup scan', 'accepted', 'Picked up'],
|
|
26
45
|
['装件入车扫描', 'Load scan into vehicle', 'in_transit', 'Loaded for transport'],
|
|
@@ -154,6 +154,15 @@
|
|
|
154
154
|
"firstSeen": "2026-09-27",
|
|
155
155
|
"note": "ParcelsApp's translation of PDA正常签收扫描; stored as \"Delivered\"."
|
|
156
156
|
},
|
|
157
|
+
{
|
|
158
|
+
"wording": "冬运会安检",
|
|
159
|
+
"code": "996",
|
|
160
|
+
"language": "zh",
|
|
161
|
+
"stage": "in_transit",
|
|
162
|
+
"confirmedBy": "live",
|
|
163
|
+
"firstSeen": "2026-10-20",
|
|
164
|
+
"note": "A security check of the parcel in the network for a winter sports event; the parcel moves on."
|
|
165
|
+
},
|
|
157
166
|
{
|
|
158
167
|
"wording": "已取件",
|
|
159
168
|
"code": "311",
|
|
@@ -8,13 +8,9 @@ import { NOOP_RECORDER } from '../../core/telemetry/index.js';
|
|
|
8
8
|
import { clean } from '../../core/transport/index.js';
|
|
9
9
|
import { withLocalBrowser } from '../../core/transport/localBrowser.js';
|
|
10
10
|
import { isRecord } from '../../core/types.js';
|
|
11
|
-
import { isYunExpressNotice, yunExpressCodeStatus, yunExpressStatus } from './status.js';
|
|
11
|
+
import { isYunExpressNotice, withoutMarkup, yunExpressCodeStatus, yunExpressStatus } from './status.js';
|
|
12
12
|
const API = 'https://services.yuntrack.com/Track/Query';
|
|
13
13
|
const MAX_BYTES = 1_000_000;
|
|
14
|
-
// A partner's line can carry its tracking page's markup, such as a link holding the parcel's
|
|
15
|
-
// number around "CARD LEFT". The scan keeps the link's text, never the tag or its address.
|
|
16
|
-
const MARKUP = /<\/?(?:a|b|i|u|em|strong|span|font|br|p|div)\b[^<>]{0,1000}>/gi;
|
|
17
|
-
const withoutMarkup = (text) => text.replace(MARKUP, ' ');
|
|
18
14
|
export function normalizeYunExpressNumber(raw) {
|
|
19
15
|
const number = raw.toUpperCase().replace(/[\s.-]/g, '');
|
|
20
16
|
if (!/^YT\d{16}$/.test(number))
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { CarrierStatus } from '../../core/result/index.js';
|
|
2
2
|
import type { ClassifiedStatus } from '../../core/status/index.js';
|
|
3
3
|
import { type CarrierStatusMap } from '../../core/status/statusMap.js';
|
|
4
|
+
/** A partner's line without its tracking page's markup. */
|
|
5
|
+
export declare function withoutMarkup(text: string): string;
|
|
4
6
|
/** Whether the wording is a relayed notice the map gives no stage on purpose. */
|
|
5
7
|
export declare function isYunExpressNotice(description: string): boolean;
|
|
6
8
|
export declare function yunExpressStatus(description: string, code?: unknown): ClassifiedStatus | undefined;
|
|
@@ -8,6 +10,7 @@ export declare function yunExpressStatus(description: string, code?: unknown): C
|
|
|
8
10
|
export declare function yunExpressCodeStatus(code: unknown): CarrierStatus | undefined;
|
|
9
11
|
/**
|
|
10
12
|
* What the map says about one scan. Scans carry no code: the delivered code
|
|
11
|
-
* comes only with the latest event and is never a scan's own.
|
|
13
|
+
* comes only with the latest event and is never a scan's own. Wording stored
|
|
14
|
+
* with a partner's markup reads as the adapter now writes it, without.
|
|
12
15
|
*/
|
|
13
16
|
export declare const statusMap: CarrierStatusMap;
|
|
@@ -27,6 +27,7 @@ const ENTRIES = [
|
|
|
27
27
|
['The driver is out for delivery', { status: 'out_for_delivery', stage: 'out_for_delivery' }],
|
|
28
28
|
['Departure from the international sorting center', { status: 'in_transit', stage: 'in_transit' }],
|
|
29
29
|
['Shipment in transit to DHL', { status: 'in_transit', stage: 'in_transit' }],
|
|
30
|
+
['Shipment is in transit to carrier', { status: 'in_transit', stage: 'in_transit' }],
|
|
30
31
|
['Preparing for delivery', { status: 'in_transit', stage: 'in_transit' }],
|
|
31
32
|
// Last-mile wording the feed relays without codes. DPD files its data
|
|
32
33
|
// record before the parcel leaves China and its proof of delivery after the
|
|
@@ -56,7 +57,26 @@ const ENTRIES = [
|
|
|
56
57
|
// A courier partner's acceptance follows the scans of the network that
|
|
57
58
|
// brought the parcel to it: a hand-over, not the parcel's acceptance.
|
|
58
59
|
['Package accepted at courier partner', { status: 'in_transit', stage: 'in_transit' }],
|
|
60
|
+
// GLS keeps the parcel at its depot after the parcel box it was due in was full.
|
|
61
|
+
['The parcel is being stored in the GLS parcel center. It could not be delivered as the parcel box was occupied.', { status: 'exception', stage: 'failed_attempt' }],
|
|
59
62
|
];
|
|
63
|
+
const FAILED_ATTEMPT = { status: 'exception', stage: 'failed_attempt' };
|
|
64
|
+
/**
|
|
65
|
+
* Partner lines that carry a place or a reason after fixed words, by their
|
|
66
|
+
* `normalizeStatusWording` form: GOFO's missed delivery with its type, and an
|
|
67
|
+
* Australian courier's transfer to a depot after it left a card.
|
|
68
|
+
*/
|
|
69
|
+
const PATTERNS = [
|
|
70
|
+
[/^delivery failed, type: ?recipient absent or delivery location inaccessible\b/, FAILED_ATTEMPT],
|
|
71
|
+
[/^\d+ items? (?:has|have) been transferred to \S.* card left$/, FAILED_ATTEMPT],
|
|
72
|
+
];
|
|
73
|
+
// A partner's line can carry its tracking page's markup, such as a link holding the parcel's
|
|
74
|
+
// number around "CARD LEFT". The scan keeps the link's text, never the tag or its address.
|
|
75
|
+
const MARKUP = /<\/?(?:a|b|i|u|em|strong|span|font|br|p|div)\b[^<>]{0,1000}>/gi;
|
|
76
|
+
/** A partner's line without its tracking page's markup. */
|
|
77
|
+
export function withoutMarkup(text) {
|
|
78
|
+
return text.replace(MARKUP, ' ');
|
|
79
|
+
}
|
|
60
80
|
// A relayed notice about the parcel rather than a scan of it names no stage,
|
|
61
81
|
// so the parcel keeps the one it had: here a reminder to collect it that
|
|
62
82
|
// failed to send.
|
|
@@ -75,7 +95,8 @@ export function yunExpressStatus(description, code) {
|
|
|
75
95
|
// containing variable delivery notes. It is never inherited by older scans.
|
|
76
96
|
if (code === 50)
|
|
77
97
|
return { status: 'delivered', stage: 'delivered' };
|
|
78
|
-
|
|
98
|
+
const wording = normalizeStatusWording(description);
|
|
99
|
+
return WORDING.get(wording) ?? PATTERNS.find(([pattern]) => pattern.test(wording))?.[1];
|
|
79
100
|
}
|
|
80
101
|
/** The status the latest event's own code states, for wording the map does not know. */
|
|
81
102
|
export function yunExpressCodeStatus(code) {
|
|
@@ -83,9 +104,10 @@ export function yunExpressCodeStatus(code) {
|
|
|
83
104
|
}
|
|
84
105
|
/**
|
|
85
106
|
* What the map says about one scan. Scans carry no code: the delivered code
|
|
86
|
-
* comes only with the latest event and is never a scan's own.
|
|
107
|
+
* comes only with the latest event and is never a scan's own. Wording stored
|
|
108
|
+
* with a partner's markup reads as the adapter now writes it, without.
|
|
87
109
|
*/
|
|
88
110
|
export const statusMap = {
|
|
89
|
-
stage: (_code, wording) => yunExpressStatus(wording)?.stage,
|
|
111
|
+
stage: (_code, wording) => yunExpressStatus(withoutMarkup(wording))?.stage,
|
|
90
112
|
gaps: [{ wording: NOTICE, note: 'A reminder that failed to send, not a movement: the parcel keeps the stage it had.' }],
|
|
91
113
|
};
|
|
@@ -195,6 +195,14 @@
|
|
|
195
195
|
"confirmedBy": "live",
|
|
196
196
|
"firstSeen": "2026-10-08"
|
|
197
197
|
},
|
|
198
|
+
{
|
|
199
|
+
"wording": "Shipment is in transit to carrier",
|
|
200
|
+
"stage": "in_transit",
|
|
201
|
+
"language": "en",
|
|
202
|
+
"confirmedBy": "live",
|
|
203
|
+
"firstSeen": "2026-10-20",
|
|
204
|
+
"note": "On the way to the last-mile carrier, as in the line that names DHL."
|
|
205
|
+
},
|
|
198
206
|
{
|
|
199
207
|
"wording": "Sender goods issue",
|
|
200
208
|
"stage": "registered",
|
|
@@ -386,6 +394,30 @@
|
|
|
386
394
|
"firstSeen": "2026-10-08",
|
|
387
395
|
"note": "Relayed after the parcel left the facilities of the network that brought it to the courier partner: a hand-over, not the parcel's acceptance."
|
|
388
396
|
},
|
|
397
|
+
{
|
|
398
|
+
"wording": "Delivery failed, type: Recipient absent or delivery location inaccessible.",
|
|
399
|
+
"stage": "failed_attempt",
|
|
400
|
+
"language": "en",
|
|
401
|
+
"confirmedBy": "live",
|
|
402
|
+
"firstSeen": "2026-10-20",
|
|
403
|
+
"note": "Relayed from GOFO, which goes on to promise another attempt; matched on its start."
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
"wording": "The parcel is being stored in the GLS parcel center. It could not be delivered as the parcel box was occupied.",
|
|
407
|
+
"stage": "failed_attempt",
|
|
408
|
+
"language": "en",
|
|
409
|
+
"confirmedBy": "live",
|
|
410
|
+
"firstSeen": "2026-10-20",
|
|
411
|
+
"note": "Relayed from GLS: the parcel box it was due in was full, so the depot keeps it."
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
"wording": "1 item has been transferred to <depot> (<town>) CARD LEFT",
|
|
415
|
+
"stage": "failed_attempt",
|
|
416
|
+
"language": "en",
|
|
417
|
+
"confirmedBy": "live",
|
|
418
|
+
"firstSeen": "2026-10-20",
|
|
419
|
+
"note": "Relayed from an Australian courier after a missed delivery: the card left names the depot that now holds the parcel. Matched on its fixed words; the courier's page wraps CARD LEFT in a link the adapter drops."
|
|
420
|
+
},
|
|
389
421
|
{
|
|
390
422
|
"code": "10",
|
|
391
423
|
"confirmedBy": "bundle",
|
|
@@ -72,6 +72,7 @@ import { statusMap as bussgods } from '../../carriers/bussgods/status.js';
|
|
|
72
72
|
import { statusMap as byhd } from '../../carriers/byhd/status.js';
|
|
73
73
|
import { statusMap as c3x } from '../../carriers/c3x/status.js';
|
|
74
74
|
import { statusMap as cacesa } from '../../carriers/cacesa/status.js';
|
|
75
|
+
import { statusMap as canadaPost } from '../../carriers/canada-post/status.js';
|
|
75
76
|
import { statusMap as cargus } from '../../carriers/cargus/status.js';
|
|
76
77
|
import { statusMap as castores } from '../../carriers/castores/status.js';
|
|
77
78
|
import { statusMap as cblLogistica } from '../../carriers/cbl-logistica/status.js';
|
|
@@ -229,6 +230,7 @@ import { statusMap as hctLogistics } from '../../carriers/hct-logistics/status.j
|
|
|
229
230
|
import { statusMap as helthjem } from '../../carriers/helthjem/status.js';
|
|
230
231
|
import { statusMap as hepsijet } from '../../carriers/hepsijet/status.js';
|
|
231
232
|
import { statusMap as hermesAt } from '../../carriers/hermes-at/status.js';
|
|
233
|
+
import { statusMap as hermesDe } from '../../carriers/hermes-de/status.js';
|
|
232
234
|
import { statusMap as hispapost } from '../../carriers/hispapost/status.js';
|
|
233
235
|
import { statusMap as homexpress } from '../../carriers/homexpress/status.js';
|
|
234
236
|
import { statusMap as houngAhLoun } from '../../carriers/houng-ah-loun/status.js';
|
|
@@ -420,6 +422,7 @@ import { statusMap as sendex } from '../../carriers/sendex/status.js';
|
|
|
420
422
|
import { statusMap as sending } from '../../carriers/sending/status.js';
|
|
421
423
|
import { statusMap as serpost } from '../../carriers/serpost/status.js';
|
|
422
424
|
import { statusMap as servientrega } from '../../carriers/servientrega/status.js';
|
|
425
|
+
import { statusMap as sfExpress } from '../../carriers/sf-express/status.js';
|
|
423
426
|
import { statusMap as sfc } from '../../carriers/sfc/status.js';
|
|
424
427
|
import { statusMap as shadowfax } from '../../carriers/shadowfax/status.js';
|
|
425
428
|
import { statusMap as shipa } from '../../carriers/shipa/status.js';
|
|
@@ -443,6 +446,7 @@ import { statusMap as spExpress } from '../../carriers/sp-express/status.js';
|
|
|
443
446
|
import { statusMap as speedAndSafe } from '../../carriers/speed-and-safe/status.js';
|
|
444
447
|
import { statusMap as speedaf } from '../../carriers/speedaf/status.js';
|
|
445
448
|
import { statusMap as speedex } from '../../carriers/speedex/status.js';
|
|
449
|
+
import { statusMap as speedpak } from '../../carriers/speedpak/status.js';
|
|
446
450
|
import { statusMap as speedx } from '../../carriers/speedx/status.js';
|
|
447
451
|
import { statusMap as speedy } from '../../carriers/speedy/status.js';
|
|
448
452
|
import { statusMap as spxBr } from '../../carriers/spx-br/status.js';
|
|
@@ -477,6 +481,7 @@ import { statusMap as tforceFreight } from '../../carriers/tforce-freight/status
|
|
|
477
481
|
import { statusMap as thailandPost } from '../../carriers/thailand-post/status.js';
|
|
478
482
|
import { statusMap as thhy } from '../../carriers/thhy/status.js';
|
|
479
483
|
import { statusMap as tiki } from '../../carriers/tiki/status.js';
|
|
484
|
+
import { statusMap as tipsa } from '../../carriers/tipsa/status.js';
|
|
480
485
|
import { statusMap as tirupatiCourier } from '../../carriers/tirupati-courier/status.js';
|
|
481
486
|
import { statusMap as tmmExpress } from '../../carriers/tmm-express/status.js';
|
|
482
487
|
import { statusMap as tnt } from '../../carriers/tnt/status.js';
|
|
@@ -518,8 +523,10 @@ import { statusMap as xdeLogistics } from '../../carriers/xde-logistics/status.j
|
|
|
518
523
|
import { statusMap as xdp } from '../../carriers/xdp/status.js';
|
|
519
524
|
import { statusMap as xlcourier } from '../../carriers/xlcourier/status.js';
|
|
520
525
|
import { statusMap as xpoLtl } from '../../carriers/xpo-ltl/status.js';
|
|
526
|
+
import { statusMap as yanwen } from '../../carriers/yanwen/status.js';
|
|
521
527
|
import { statusMap as ycsLogistics } from '../../carriers/ycs-logistics/status.js';
|
|
522
528
|
import { statusMap as zto } from '../../carriers/zto/status.js';
|
|
529
|
+
import { statusMap as yto } from '../../carriers/yto/status.js';
|
|
523
530
|
import { statusMap as yunexpress } from '../../carriers/yunexpress/status.js';
|
|
524
531
|
import { statusMap as yilongLogistics } from '../../carriers/yilong-logistics/status.js';
|
|
525
532
|
import { statusMap as yurticiKargo } from '../../carriers/yurtici-kargo/status.js';
|
|
@@ -540,7 +547,7 @@ export const STATUS_MAPS = {
|
|
|
540
547
|
'aramex-nz': aramexNz, 'aras-kargo': arasKargo, 'arrow-xl': arrowXl, 'atlantic-courier': atlanticCourier, 'austrian-post': austrianPost, averitt, aymakan, 'bangladesh-post': bangladeshPost,
|
|
541
548
|
'barid-al-maghrib': baridAlMaghrib, belpost, 'best-overnite-express': bestOverniteExpress, 'better-trucks': betterTrucks, 'bex-express': bexExpress, 'bjs-home-delivery': bjsHomeDelivery, 'blue-express': blueExpress, blueex, bombino,
|
|
542
549
|
bookurier, 'border-express': borderExpress, bosta, 'box-now': boxNow, 'bringer-parcel': bringerParcel, 'bulgarian-posts': bulgarianPosts, 'burd-delivery': burdDelivery, bussgods,
|
|
543
|
-
byhd, c3x, cacesa, cargus, castores, 'cbl-logistica': cblLogistica, ccfs, cdek, cdl, celeritas,
|
|
550
|
+
byhd, c3x, cacesa, 'canada-post': canadaPost, cargus, castores, 'cbl-logistica': cblLogistica, ccfs, cdek, cdl, celeritas,
|
|
544
551
|
'central-transport': centralTransport, 'ceska-posta': ceskaPosta, 'ceva-logistics': cevaLogistics, chazki, chilexpress, 'china-post': chinaPost,
|
|
545
552
|
'chit-chats': chitChats, chronodiali, chronopost, chukou1, 'chunghwa-post': chunghwaPost, chunil, 'city-express-rs': cityExpressRs, 'citylink-express': citylinkExpress, citymail,
|
|
546
553
|
'cj-logistics': cjLogistics, 'cj-packet': cjPacket, 'closer-logistics': closerLogistics, 'connect-couriers': connectCouriers, coordinadora,
|
|
@@ -564,7 +571,7 @@ export const STATUS_MAPS = {
|
|
|
564
571
|
'gebrueder-weiss': gebruederWeiss, geis, 'geniki-taxydromiki': geniki, 'geodis-pl': geodisPl, 'gls-es': glsEs, 'gls-it': glsIt,
|
|
565
572
|
globalpost, 'gms-worldwide': gmsWorldwide, 'go-express': goExpress, go4, gobolt, gofo, 'gofo-fr': gofoFr, 'gofo-it': gofoIt, 'gofo-nl': gofoNl, 'gogo-xpress': gogoXpress,
|
|
566
573
|
'grand-slam-express': grandSlamExpress, 'gs-postbox': gsPostbox, 'gsi-express': gsiExpress, 'gta-airskip': gtaAirskip, 'gtl-goto': gtlGoto, guatex, gzyl,
|
|
567
|
-
hanjin, 'happy-post': happyPost, haypost, 'hct-logistics': hctLogistics, helthjem, hepsijet, 'hermes-at': hermesAt, hispapost, homexpress,
|
|
574
|
+
hanjin, 'happy-post': happyPost, haypost, 'hct-logistics': hctLogistics, helthjem, hepsijet, 'hermes-at': hermesAt, 'hermes-de': hermesDe, hispapost, homexpress,
|
|
568
575
|
'houng-ah-loun': houngAhLoun, hovership, 'hr-parcel': hrParcel, 'hrvatska-posta': hrvatskaPosta, huahan, 'hunter-express': hunterExpress, hywl,
|
|
569
576
|
'icc-worldwide': iccWorldwide, 'ics-courier': icsCourier, 'ids-logistik': idsLogistik, 'ilyang-logis': ilyangLogis, imile,
|
|
570
577
|
'indah-logistik': indahLogistik, instabox, 'integral-pack': integralPack, 'internet-express': internetExpress, interrapidisimo,
|
|
@@ -596,22 +603,22 @@ export const STATUS_MAPS = {
|
|
|
596
603
|
'quicksilver-sa': quicksilverSa, quiqup, qwintry, raben, 'ram-hand-to-hand': ramHandToHand, redpack, redur, redx, relaytech,
|
|
597
604
|
rivigo, 'rl-carriers': rlCarriers, roadrunner, 'royal-express-mm': royalExpressMm, 'royal-mail': royalMail,
|
|
598
605
|
'rpx-indonesia': rpxIndonesia, sagawa, 'sagawa-global': sagawaGlobal, saia, sailpost, sameday, 'sapx-express': sapxExpress,
|
|
599
|
-
'sat-ukraine': satUkraine, 'saudi-post': saudiPost, seino, seko, sendex, sending, serpost, servientrega, sfc, shadowfax, shipa, shipblu, shipentegra, shiprocket,
|
|
606
|
+
'sat-ukraine': satUkraine, 'saudi-post': saudiPost, seino, seko, sendex, sending, serpost, servientrega, 'sf-express': sfExpress, sfc, shadowfax, shipa, shipblu, shipentegra, shiprocket,
|
|
600
607
|
'shree-anjani': shreeAnjani, 'shree-maruti': shreeMaruti, 'skroutz-last-mile': skroutzLastMile,
|
|
601
608
|
skyking, 'skynet-sa': skynetSa, 'skynet-worldwide': skynetWorldwide, skypostal, slgtrax,
|
|
602
609
|
'slovak-parcel-service': slovakParcelService,
|
|
603
610
|
'slovenska-posta': slovenskaPosta, 'smsa-express': smsaExpress, 'south-african-post-office': southAfricanPost,
|
|
604
|
-
'southeastern-freight-lines': southeasternFreightLines, 'sp-express': spExpress, 'speed-and-safe': speedAndSafe, speedaf, speedex, speedx, speedy, 'spx-br': spxBr, 'spx-id': spxId, 'spx-my': spxMy,
|
|
611
|
+
'southeastern-freight-lines': southeasternFreightLines, 'sp-express': spExpress, 'speed-and-safe': speedAndSafe, speedaf, speedex, speedpak, speedx, speedy, 'spx-br': spxBr, 'spx-id': spxId, 'spx-my': spxMy,
|
|
605
612
|
'spx-th': spxTh, 'spx-tw': spxTw, 'spx-vn': spxVn, 'st-courier': stCourier, 'stallion-express': stallionExpress, 'starex-az': starexAz, starken, sto, straightship, 'sundarban-courier': sundarbanCourier, swiftx, 'swiss-post': swissPost,
|
|
606
613
|
't-cat': tCat, 't-group': tGroup, 'tanzania-posts': tanzaniaPosts, taxydema, 'tci-express': tciExpress, 'tcs-pakistan': tcsPakistan, tdn, tealca,
|
|
607
614
|
'team-express-ae': teamExpressAe, 'team-global-express': teamGlobalExpress, 'team-worldwide': teamWorldwide, teleship, 'tfm-express': tfmExpress, 'tforce-freight': tforceFreight,
|
|
608
|
-
'thailand-post': thailandPost, thhy, tiki, 'tirupati-courier': tirupatiCourier, 'tmm-express': tmmExpress, tnt, 'tnt-it': tntIt, 'today-kr': todayKr, toptrans, torrestir, 'total-express': totalExpress,
|
|
615
|
+
'thailand-post': thailandPost, thhy, tiki, tipsa, 'tirupati-courier': tirupatiCourier, 'tmm-express': tmmExpress, tnt, 'tnt-it': tntIt, 'today-kr': todayKr, toptrans, torrestir, 'total-express': totalExpress,
|
|
609
616
|
trackon, 'tracx-logis': tracxLogis, transaher, transcorp, transmission, tsjy, 'tst-cf-express': tstCfExpress, tufesa, 'tws-express': twsExpress,
|
|
610
617
|
'ubi-smart-parcel': ubiSmartParcel,
|
|
611
618
|
'united-delivery-service': unitedDeliveryService, upaya, ups, urbano, urvaam,
|
|
612
619
|
'uzbekistan-post': uzbekistanPost, valmo, 'vasp-expresso': vaspExpresso, veloces, venipak, 'via-cargo': viaCargo, 'viettel-post': viettelPost,
|
|
613
620
|
vimenpaq, 'vinted-go': vintedGo, vozovoz, 'vrl-logistics': vrlLogistics, wanbexpress, whistl, winit, 'xde-logistics': xdeLogistics, xdp, xlcourier, 'xpo-ltl': xpoLtl,
|
|
614
|
-
'ycs-logistics': ycsLogistics, 'yilong-logistics': yilongLogistics, yunexpress, zto,
|
|
621
|
+
yanwen, 'ycs-logistics': ycsLogistics, 'yilong-logistics': yilongLogistics, yto, yunexpress, zto,
|
|
615
622
|
'yurtici-kargo': yurticiKargo, zajil, zeleris, 'zr-express': zrExpress,
|
|
616
623
|
};
|
|
617
624
|
/** The carrier the app files the universal providers' scans under. */
|
|
@@ -30,7 +30,7 @@ export function text(value) {
|
|
|
30
30
|
// Universal sites mix carrier events with UI notices and data updates. Notices must not
|
|
31
31
|
// manufacture a shipment timestamp or make an electronic announcement look like movement.
|
|
32
32
|
export function isNotice(description) {
|
|
33
|
-
return /enter .*?(?:postal|post|zip|phone)|select (?:a |the )?(?:carrier|destination country)|no information about your (?:package|parcel|shipment)|tracking (?:is |temporarily )?unavailable|tracking number (?:not found|is incorrect|must (?:only )?(?:contain|consist|be)\b)|check that (?:the |your )?tracking number is correct|no tracking (?:information|data)|delivery preference|captcha|verify (?:you|your)|enable javascript|try again later|by tapping the button|^shipment parameters updated[.!]?$|^a preferred drop-off location was booked\b/i.test(description);
|
|
33
|
+
return /enter .*?(?:postal|post|zip|phone)|select (?:a |the )?(?:carrier|destination country)|no information about your (?:package|parcel|shipment)|tracking (?:is |temporarily )?unavailable|tracking number (?:not found|is incorrect|must (?:only )?(?:contain|consist|be)\b)|check that (?:the |your )?tracking number is correct|no tracking (?:information|data)|delivery preference|captcha|verify (?:you|your)|enable javascript|try again later|by tapping the button|^(?:shipment parameters|recipient information) updated[.!]?$|^a preferred drop-off location was booked\b/i.test(description);
|
|
34
34
|
}
|
|
35
35
|
// Raw text, so accented and plain spellings are both listed. A carrier receiving the
|
|
36
36
|
// parcel ("Recibido por Estafeta") and German "Firma" (a business) are not private.
|
|
@@ -271,6 +271,19 @@ function providerWordingStage(description) {
|
|
|
271
271
|
// Canada Post's new label at a processing plant (0198), between two processing scans.
|
|
272
272
|
if (/^label correction applied[.!]?$/i.test(value))
|
|
273
273
|
return 'in_transit';
|
|
274
|
+
// SEUR's receipt at its origin facility (SX001) and Vinted Go's parcel dropped off by its sender, as their own maps read them.
|
|
275
|
+
if (/^the shipment has been received at the seur facilities of origin[.!]?$|^parcel was dropped off at the (?:locker|parcel shop)[.!]?$/i.test(value))
|
|
276
|
+
return 'accepted';
|
|
277
|
+
// FedEx's customs release, which its own map reads as a completed clearance.
|
|
278
|
+
if (/^international shipment release - (?:import|export)[.!]?$/i.test(value))
|
|
279
|
+
return 'in_transit';
|
|
280
|
+
// Straightship's shipper data, then its first scan in Canada and its stations, the town and province in brackets.
|
|
281
|
+
if (/^package information is created in the system[.!]?$/i.test(value))
|
|
282
|
+
return 'registered';
|
|
283
|
+
if (/^package received with origin scan warehouse(?: \([^()\d@]+\))?$/i.test(value))
|
|
284
|
+
return 'accepted';
|
|
285
|
+
if (/^package is received at a straightship station(?: \([^()\d@]+\))?$/i.test(value))
|
|
286
|
+
return 'in_transit';
|
|
274
287
|
// JS Express's steps at its Chinese warehouse between sorting and departure, and its hand-over to the
|
|
275
288
|
// destination's last-mile carrier, as its own map reads them.
|
|
276
289
|
if (/^domestic allocation has begun[.!]?$|^under domestic allocation[.!]?$/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.569.
|
|
3
|
+
"version": "0.569.4-main.2659",
|
|
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",
|