universal-parcel-scraper 0.54.0-main.702 → 0.55.0-main.706
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/dist/browser/scraper.js +1 -6
- package/dist/carriers/australia-post/adapter.js +2 -1
- package/dist/carriers/australia-post/numbers.json +1 -1
- package/dist/carriers/ukrposhta/adapter.js +3 -2
- package/dist/core/catalog/handoff.js +3 -0
- package/dist/core/catalog/hints.js +7 -6
- package/dist/server/openapi.json +1 -1
- package/package.json +1 -1
package/dist/browser/scraper.js
CHANGED
|
@@ -9518,14 +9518,9 @@ var dc = /* @__PURE__ */ new Map([
|
|
|
9518
9518
|
["FI", "posti"],
|
|
9519
9519
|
["FR", "la-poste"],
|
|
9520
9520
|
["GB", "royal-mail"],
|
|
9521
|
-
["IN", "india-post"],
|
|
9522
9521
|
["JP", "japan-post"],
|
|
9523
|
-
["MY", "pos-malaysia"],
|
|
9524
9522
|
["NL", "spring-gds"],
|
|
9525
|
-
["PL", "poczta-polska"],
|
|
9526
|
-
["PT", "ctt"],
|
|
9527
9523
|
["SE", "postnord"],
|
|
9528
|
-
["UA", "ukrposhta"],
|
|
9529
9524
|
["US", "usps"]
|
|
9530
9525
|
]), fc = new Intl.DisplayNames(["en"], { type: "region" }), pc = (e) => new Intl.Locale(`und-${e}`).region ?? e;
|
|
9531
9526
|
new Map([
|
|
@@ -9560,7 +9555,7 @@ function vc(e, t, n) {
|
|
|
9560
9555
|
let r = gc([n.last_status_text, ...(n.events ?? []).map((e) => e.description)], e);
|
|
9561
9556
|
if (!n.delivery_carrier && r.length > 1) return null;
|
|
9562
9557
|
let i = n.delivery_carrier ?? r[0], a = "partner", o = n.delivery_tracking_number || t, s = typeof n.destination_country == "string" ? n.destination_country : typeof n.destination_country_name == "string" ? n.destination_country_name : void 0;
|
|
9563
|
-
if (!i && x(o) && (i = mc(s), i && (a = "destination")), !i && n.delivery_tracking_number) {
|
|
9558
|
+
if (!i && x(o) && (i = mc(s), i === "japan-post" && o.startsWith("U") && (i = void 0), i && (a = "destination")), !i && n.delivery_tracking_number) {
|
|
9564
9559
|
let e = S(o);
|
|
9565
9560
|
e.confidence === "high" && (i = e.carrier, a = "reference");
|
|
9566
9561
|
}
|
|
@@ -267,7 +267,8 @@ export class AustraliaPostTracker {
|
|
|
267
267
|
export const adapter = (environment) => {
|
|
268
268
|
const tracker = new AustraliaPostTracker({ trawl: environment.trawl, fetcher: environment.fetcher, recorder: environment.recorder });
|
|
269
269
|
// Recognition is plain HTTP: it asks the gateway alone, and a refusal there fails instead of starting a browser.
|
|
270
|
+
// A recognition budget can be longer than the minute a lookup takes at most.
|
|
270
271
|
const gateway = new AustraliaPostTracker({ trawl: null, fetcher: environment.fetcher, recorder: environment.recorder });
|
|
271
272
|
return { id: 'australia-post', recordsSteps: true, steps: ['direct', 'trawl'], track: (input, context) => tracker.fetch(input.number, context),
|
|
272
|
-
recognize: (number, context) => recognizeFromLookup(() => gateway.fetch(number, context), () => accepted(() => normalizeAustraliaPostNumber(number))) };
|
|
273
|
+
recognize: (number, context) => recognizeFromLookup(() => gateway.fetch(number, { ...context, budgetMs: Math.min(context?.budgetMs ?? 45_000, 60_000) }), () => accepted(() => normalizeAustraliaPostNumber(number))) };
|
|
273
274
|
};
|
|
@@ -230,7 +230,7 @@
|
|
|
230
230
|
"australia-post"
|
|
231
231
|
]
|
|
232
232
|
},
|
|
233
|
-
"note": "Open-source project example, not a real shipment. The source attributes it to Australia Post,
|
|
233
|
+
"note": "Open-source project example, not a real shipment. The source attributes it to Australia Post. Other carriers' 22-digit rules match too, so detection only suggests Australia Post."
|
|
234
234
|
},
|
|
235
235
|
{
|
|
236
236
|
"number": "LH290032509AU",
|
|
@@ -157,12 +157,13 @@ export const adapter = environment => {
|
|
|
157
157
|
const options = { token: environment.env.UKRPOSHTA_TRACKING_TOKEN?.trim() || APPLICATION_BEARER,
|
|
158
158
|
userAgent: environment.userAgent, fetcher: environment.fetcher, recorder: environment.recorder };
|
|
159
159
|
const tracker = new UkrposhtaTracker({ ...options, executablePath: environment.browserExecutablePath });
|
|
160
|
-
// Recognition is plain HTTP: the status API alone.
|
|
160
|
+
// Recognition is plain HTTP: the status API alone. A recognition budget can be
|
|
161
|
+
// longer than the minute a lookup takes at most.
|
|
161
162
|
const statusApi = new UkrposhtaTracker({ ...options, executablePath: null });
|
|
162
163
|
return { id: 'ukrposhta', recordsSteps: true, steps: ['direct', 'browser'], track: (input, context) => tracker.fetch(input.number, context),
|
|
163
164
|
recognize: (number, context) => recognizeFromLookup(async () => {
|
|
164
165
|
try {
|
|
165
|
-
return await statusApi.fetch(number, context);
|
|
166
|
+
return await statusApi.fetch(number, { ...context, budgetMs: Math.min(context?.budgetMs ?? 45_000, 60_000) });
|
|
166
167
|
}
|
|
167
168
|
catch (error) {
|
|
168
169
|
// The portal reads the same domestic records, so the status API's miss means Ukrposhta
|
|
@@ -28,8 +28,11 @@ export function deliveryHandoff(carrier, number, result) {
|
|
|
28
28
|
// S10 binds the postal identity across borders. Its issuer suffix does not
|
|
29
29
|
// identify the destination operator; try that country's post only when no
|
|
30
30
|
// partner is named, and let the shared progress/freshness checks confirm it.
|
|
31
|
+
// Japan Post does not track `U`-prefixed customs labels.
|
|
31
32
|
if (!target && isValidS10TrackingNumber(reference)) {
|
|
32
33
|
target = nationalPostCandidate(destination);
|
|
34
|
+
if (target === 'japan-post' && reference.startsWith('U'))
|
|
35
|
+
target = undefined;
|
|
33
36
|
if (target)
|
|
34
37
|
basis = 'destination';
|
|
35
38
|
}
|
|
@@ -22,14 +22,15 @@ const CATALOG_NAMES = new Set([
|
|
|
22
22
|
]);
|
|
23
23
|
// Postal lookup candidates, not proof of which operator delivers a shipment.
|
|
24
24
|
// Only operators whose dedicated adapter looks up mail from abroad by its S10
|
|
25
|
-
// number are useful here
|
|
26
|
-
//
|
|
25
|
+
// number are useful here: India Post's, Pos Malaysia's, CTT's and Poste
|
|
26
|
+
// Italiane's take only numbers of their own. Poczta Polska and Ukrposhta give
|
|
27
|
+
// wall clocks without an offset, so a host cannot tell their scans follow the
|
|
28
|
+
// origin's. The host also checks adapter availability and required inputs
|
|
29
|
+
// before making a request.
|
|
27
30
|
const NATIONAL_POSTS = new Map([
|
|
28
31
|
['AU', 'australia-post'], ['CA', 'canada-post'], ['CH', 'swiss-post'], ['DE', 'dhl'],
|
|
29
|
-
['ES', 'correos-spain'], ['FI', 'posti'], ['FR', 'la-poste'],
|
|
30
|
-
['
|
|
31
|
-
['JP', 'japan-post'], ['MY', 'pos-malaysia'], ['NL', 'spring-gds'], ['PL', 'poczta-polska'], ['PT', 'ctt'], ['SE', 'postnord'],
|
|
32
|
-
['UA', 'ukrposhta'], ['US', 'usps'],
|
|
32
|
+
['ES', 'correos-spain'], ['FI', 'posti'], ['FR', 'la-poste'], ['GB', 'royal-mail'],
|
|
33
|
+
['JP', 'japan-post'], ['NL', 'spring-gds'], ['SE', 'postnord'], ['US', 'usps'],
|
|
33
34
|
]);
|
|
34
35
|
const englishCountries = new Intl.DisplayNames(['en'], { type: 'region' });
|
|
35
36
|
// Deprecated codes carry their successor's name, so fold them into it ("FX" is France).
|
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.
|
|
3
|
+
"version": "0.55.0-main.706",
|
|
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",
|