universal-parcel-scraper 0.1102.2-main.6239 → 0.1102.4-main.6243

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.
@@ -49936,7 +49936,8 @@ for (let [e, t] of [
49936
49936
  ["USA", "US"],
49937
49937
  ["Czech Republic", "CZ"],
49938
49938
  ["Großbritannien", "GB"],
49939
- ["United Kingdom of Great Britain and Northern Ireland", "GB"]
49939
+ ["United Kingdom of Great Britain and Northern Ireland", "GB"],
49940
+ ["Russian Federation", "RU"]
49940
49941
  ]) el.set($c(e), t);
49941
49942
  function tl(e) {
49942
49943
  if (typeof e != "string") return null;
@@ -10,7 +10,7 @@ import { canadaProvinceTimeZone, countryCode, countryTimeZone, explicitOffsetTim
10
10
  import { clean, fetchBounded, TRAWL_TRANSPORT_ALLOWANCE_MS } from '../../core/transport/index.js';
11
11
  import { isRecord } from '../../core/types.js';
12
12
  import { browserContextProxy } from '../../core/transport/browserRouteTrial.js';
13
- import { trawlOutOfTime } from '../../core/transport/trawl.js';
13
+ import { budgetWhenOutOfTime } from '../../core/transport/trawl.js';
14
14
  import { australiaPostCode, australiaPostCodeParts, australiaPostStatus } from './status.js';
15
15
  const PROVIDER = 'Australia Post';
16
16
  const DETAIL = 'https://auspost.com.au/mypost/track/details/';
@@ -337,8 +337,7 @@ export class AustraliaPostTracker {
337
337
  const page = await trawl.scrape({ url: australiaPostTrackingUrl(number), skipHttp: true, maxTier: 3,
338
338
  maxTimeout: timeoutMs, captureResponses: [apiUrl], ...(proxy ? { proxy } : {}), settleTimeout: Math.min(timeoutMs, 10_000),
339
339
  }, { provider: 'TRAWL while fetching Australia Post', timeoutMs, signal, maxBytes: 6_000_000, requireSolved: false })
340
- // A read that ran out of time says nothing about the page.
341
- .catch((error) => { throw trawlOutOfTime(error) ? new BudgetExceededError(PROVIDER, budgetMs, { cause: error }) : error; });
340
+ .catch(budgetWhenOutOfTime(PROVIDER, budgetMs));
342
341
  signal.throwIfAborted();
343
342
  if (![2, 3].includes(page.tier) || ![200, 304].includes(page.statusCode)) {
344
343
  throw new TransportError(PROVIDER, 'The browser service did not load Australia Post tracking');
@@ -8,6 +8,7 @@ import { recoverableByDefault, runSteps } from '../../core/runner/index.js';
8
8
  import { paddedDate } from '../../core/time/fields.js';
9
9
  import { explicitOffsetTime, zonedTime } from '../../core/time/index.js';
10
10
  import { clean, parseJsonBytes } from '../../core/transport/index.js';
11
+ import { budgetWhenOutOfTime } from '../../core/transport/trawl.js';
11
12
  import { isRecord } from '../../core/types.js';
12
13
  import { DhlTrackingApi, isMissingShipment } from './api.js';
13
14
  import { facilityZone } from './clock.js';
@@ -258,7 +259,8 @@ export class DhlExpressTracker {
258
259
  throw new BudgetExceededError(PROVIDER, budget.budgetMs);
259
260
  const page = await this.environment.trawl.scrape({ url: `https://www.dhl.com/global-en/home/tracking/tracking-parcel.html?submit=1&tracking-id=${number}`, skipHttp: true, maxTier: 3,
260
261
  maxTimeout: timeoutMs, captureResponses: [BROWSER_API], settleTimeout: timeoutMs,
261
- }, { provider: PROVIDER, timeoutMs, signal: budget.signal, maxBytes: 6_000_000, requireSolved: false });
262
+ }, { provider: PROVIDER, timeoutMs, signal: budget.signal, maxBytes: 6_000_000, requireSolved: false })
263
+ .catch(budgetWhenOutOfTime(PROVIDER, budget.budgetMs));
262
264
  budget.signal.throwIfAborted();
263
265
  const captures = page.capturedResponses.filter((r) => {
264
266
  try {
@@ -0,0 +1,7 @@
1
+ /** Emirates Post's clock at home: the UAE keeps one, Dubai's. */
2
+ export declare const EMIRATES_POST_ZONE = "Asia/Dubai";
3
+ /**
4
+ * Places that identify a UAE office. A foreign office or a bare postal code
5
+ * keeps its own wall clock; neither the issuer nor the destination dates it.
6
+ */
7
+ export declare const UAE_PLACE: RegExp;
@@ -0,0 +1,7 @@
1
+ /** Emirates Post's clock at home: the UAE keeps one, Dubai's. */
2
+ export const EMIRATES_POST_ZONE = 'Asia/Dubai';
3
+ /**
4
+ * Places that identify a UAE office. A foreign office or a bare postal code
5
+ * keeps its own wall clock; neither the issuer nor the destination dates it.
6
+ */
7
+ export const UAE_PLACE = /\b(?:Dubai|Abu[ -]+Dhabi|Sharjah|Ajman|Fujairah|Umm[ -]+Al[ -]+Quwain|Ras[ -]+Al[ -]+Khaimah)\b/i;
@@ -7,14 +7,12 @@ import { paddedDate } from '../../core/time/fields.js';
7
7
  import { countryCode, explicitOffsetTime, zonedTime } from '../../core/time/index.js';
8
8
  import { clean } from '../../core/transport/index.js';
9
9
  import { isRecord } from '../../core/types.js';
10
+ import { EMIRATES_POST_ZONE, UAE_PLACE } from './clock.js';
10
11
  import { emiratesPostStage } from './status.js';
11
12
  export const PROVIDER = 'Emirates Post';
12
13
  export const EMIRATES_POST_MAX_BYTES = 2_000_000;
13
14
  const TRACK_PATH = '/all-services/track-a-package/step-two';
14
15
  const MAX_EVENTS = 2000;
15
- // These places identify a UAE office. A foreign office or a bare postal code
16
- // keeps its own wall clock; neither the issuer nor the destination dates it.
17
- const UAE_PLACE = /\b(?:Dubai|Abu[ -]+Dhabi|Sharjah|Ajman|Fujairah|Umm[ -]+Al[ -]+Quwain|Ras[ -]+Al[ -]+Khaimah)\b/i;
18
16
  const WALL = /^\d{2}\/\d{2}\/\d{4} \d{2}:\d{2}:\d{2} (?:AM|PM)$/;
19
17
  // "Shipped to SEYCHELLES", "Arrived at SEYCHELLES": the wording ends with where the item goes,
20
18
  // a country or a city.
@@ -48,8 +46,8 @@ function clockOf(value, location) {
48
46
  if (!parsed.isValid || parsed.year < 2000)
49
47
  throw new SchemaError(PROVIDER, 'Emirates Post returned an invalid scan clock');
50
48
  const local_time = parsed.toFormat("yyyy-MM-dd'T'HH:mm:ss");
51
- const instant = UAE_PLACE.test(location) ? zonedTime(local_time, "yyyy-MM-dd'T'HH:mm:ss", 'Asia/Dubai') : null;
52
- return { local_time, ...(instant ? { time: instant.iso, time_zone: 'Asia/Dubai', time_zone_basis: 'place' } : {}) };
49
+ const instant = UAE_PLACE.test(location) ? zonedTime(local_time, "yyyy-MM-dd'T'HH:mm:ss", EMIRATES_POST_ZONE) : null;
50
+ return { local_time, ...(instant ? { time: instant.iso, time_zone: EMIRATES_POST_ZONE, time_zone_basis: 'place' } : {}) };
53
51
  }
54
52
  /** Read only the single-number server-rendered lookup; omit parties and links. */
55
53
  export function parseEmiratesPost(html, raw) {
@@ -1,7 +1,7 @@
1
1
  import { type AdapterFactory, type TrackingContext } from '../../core/adapter/index.js';
2
2
  import type { CarrierResult } from '../../core/result/index.js';
3
3
  import type { StepRecorder } from '../../core/telemetry/index.js';
4
- import type { TrawlClient } from '../../core/transport/trawl.js';
4
+ import { type TrawlClient } from '../../core/transport/trawl.js';
5
5
  /**
6
6
  * How many searches are sent through one transport in an hour, which spreads a busy hour's
7
7
  * searches. It does not keep the CAPTCHA away: the service asks for it after every twenty
@@ -5,6 +5,7 @@ import { ChallengeError, IndeterminateError, InvalidInputError, NotFoundError, R
5
5
  import { clean, fetchBounded, parseJsonBytes, UpstreamHttpError, userAgentOf } from '../../core/transport/index.js';
6
6
  import { isRecord } from '../../core/types.js';
7
7
  import { runSteps } from '../../core/runner/index.js';
8
+ import { budgetWhenOutOfTime } from '../../core/transport/trawl.js';
8
9
  import { transportOf } from '../../core/transport/transportOf.js';
9
10
  import { classifyPosteItalianeStatus, posteItalianeMovementWording, posteItalianeUncollected } from './status.js';
10
11
  // Protocol provenance:
@@ -410,7 +411,8 @@ export class PosteItalianeTracker {
410
411
  async browser(number, signal, remainingMs) {
411
412
  const timeoutMs = Math.floor(remainingMs - 2000);
412
413
  const page = await this.options.trawl.scrape({ url: posteItalianeTrackingUrl(number), skipHttp: true, maxTier: 3,
413
- captureResponses: [TRACKING_ENDPOINT], maxTimeout: timeoutMs, settleTimeout: timeoutMs }, { provider: 'Poste Italiane', timeoutMs, signal, requireSolved: false, captureWindow: 'last', maxBytes: 6 * MAX_RESPONSE_BYTES });
414
+ captureResponses: [TRACKING_ENDPOINT], maxTimeout: timeoutMs, settleTimeout: timeoutMs }, { provider: 'Poste Italiane', timeoutMs, signal, requireSolved: false, captureWindow: 'last', maxBytes: 6 * MAX_RESPONSE_BYTES })
415
+ .catch(budgetWhenOutOfTime('Poste Italiane', remainingMs));
414
416
  signal.throwIfAborted();
415
417
  const responses = page.capturedResponses.filter(row => row.url === TRACKING_ENDPOINT);
416
418
  const response = responses.at(-1);
@@ -1,5 +1,5 @@
1
1
  import type { CarrierResult } from '../../core/result/index.js';
2
- import type { TrawlClient } from '../../core/transport/trawl.js';
2
+ import { type TrawlClient } from '../../core/transport/trawl.js';
3
3
  /** The current public tracker supplies epoch clocks and both milestones and full history. */
4
4
  export declare function parseXpoBrowser(payload: unknown, raw: string): CarrierResult;
5
5
  export declare function xpoBrowser(trawl: TrawlClient, raw: string, signal: AbortSignal, remainingMs: number): Promise<CarrierResult>;
@@ -1,6 +1,7 @@
1
1
  import { BudgetExceededError, ChallengeError, IndeterminateError, RateLimitedError, SchemaError, TransportError, UpstreamHttpError } from '../../core/errors/index.js';
2
2
  import { languageStageStatus } from '../../core/status/index.js';
3
3
  import { clean } from '../../core/transport/index.js';
4
+ import { budgetWhenOutOfTime } from '../../core/transport/trawl.js';
4
5
  import { isRecord } from '../../core/types.js';
5
6
  import { normalizeXpoLtlNumber, PROVIDER, XPO_LTL_MAX_BYTES } from './parser.js';
6
7
  import { xpoLtlEventStage, xpoLtlSummaryStatus } from './status.js';
@@ -91,7 +92,8 @@ export async function xpoBrowser(trawl, raw, signal, remainingMs) {
91
92
  if (timeoutMs < 1)
92
93
  throw new BudgetExceededError(PROVIDER, remainingMs);
93
94
  const page = await trawl.scrape({ url: `${ORIGIN}/public-app/shipments?referenceNumber=${number}`, skipHttp: true, maxTier: 3,
94
- captureResponses: [endpoint], maxTimeout: timeoutMs, settleTimeout: timeoutMs }, { provider: PROVIDER, timeoutMs, signal, requireSolved: false, captureWindow: 'last', maxBytes: 6 * XPO_LTL_MAX_BYTES });
95
+ captureResponses: [endpoint], maxTimeout: timeoutMs, settleTimeout: timeoutMs }, { provider: PROVIDER, timeoutMs, signal, requireSolved: false, captureWindow: 'last', maxBytes: 6 * XPO_LTL_MAX_BYTES })
96
+ .catch(budgetWhenOutOfTime(PROVIDER, remainingMs));
95
97
  signal.throwIfAborted();
96
98
  const responses = page.capturedResponses.filter(row => row.url === endpoint);
97
99
  const response = responses.at(-1);
@@ -216,10 +216,10 @@ for (const language of ['en', 'de', 'fr', 'it', 'es', 'nl', 'pt', 'pt-PT']) {
216
216
  }
217
217
  }
218
218
  // Full, former or abbreviated names carriers print, which Intl writes otherwise: Cainiao names
219
- // the United States "USA", DHL's German scans name the United Kingdom "Großbritannien", and
220
- // USPS's scans abroad name it in full.
219
+ // the United States "USA", DHL's German scans name the United Kingdom "Großbritannien", USPS's
220
+ // scans abroad name it in full, and the posts' IPS scans name Russia as ISO does.
221
221
  for (const [name, code] of [['United States of America', 'US'], ['USA', 'US'], ['Czech Republic', 'CZ'], ['Großbritannien', 'GB'],
222
- ['United Kingdom of Great Britain and Northern Ireland', 'GB']]) {
222
+ ['United Kingdom of Great Britain and Northern Ireland', 'GB'], ['Russian Federation', 'RU']]) {
223
223
  REGION_BY_NAME.set(regionKey(name), code);
224
224
  }
225
225
  /**
@@ -79,6 +79,11 @@ export declare const TRAWL_TRANSPORT_ALLOWANCE_MS = 15000;
79
79
  * passed, or that the page step ran out of its budget or was aborted at that deadline.
80
80
  */
81
81
  export declare function trawlOutOfTime(error: unknown): boolean;
82
+ /**
83
+ * A rejection handler for a carrier's TRAWL read: a read given up for lack of time says nothing
84
+ * about the page, so it fails as the lookup's budget. Other failures pass through unchanged.
85
+ */
86
+ export declare function budgetWhenOutOfTime(provider: string, budgetMs: number): (error: unknown) => never;
82
87
  export declare function trawlEndpoint(configured: string): URL;
83
88
  /**
84
89
  * Decode the several shapes TRAWL releases use for a captured body: a string,
@@ -8,7 +8,7 @@
8
8
  * response capture, cookies, user agent) and the legacy `/v1` command API
9
9
  * (`request.get`). Both are bounded like every other provider call.
10
10
  */
11
- import { CarrierError, ChallengeError, UpstreamHttpError } from '../errors/index.js';
11
+ import { BudgetExceededError, CarrierError, ChallengeError, UpstreamHttpError } from '../errors/index.js';
12
12
  import { decodeText, fetchBounded, parseJsonBytes } from './boundedFetch.js';
13
13
  import { cleanScalar } from './text.js';
14
14
  import { isRecord } from '../types.js';
@@ -45,6 +45,13 @@ export function trawlOutOfTime(error) {
45
45
  || (/"error"\s*:\s*"Max tier reached without success"/.test(reply)
46
46
  && /"reason"\s*:\s*"[^"]*(?:budget exhausted|operation was aborted)/.test(reply));
47
47
  }
48
+ /**
49
+ * A rejection handler for a carrier's TRAWL read: a read given up for lack of time says nothing
50
+ * about the page, so it fails as the lookup's budget. Other failures pass through unchanged.
51
+ */
52
+ export function budgetWhenOutOfTime(provider, budgetMs) {
53
+ return (error) => { throw trawlOutOfTime(error) ? new BudgetExceededError(provider, budgetMs, { cause: error }) : error; };
54
+ }
48
55
  /**
49
56
  * End the call when its signal has aborted. A cancellation is rethrown as the
50
57
  * caller gave it. A deadline is a browser service that did not answer in
@@ -28,6 +28,7 @@ import { chinaPostEnglish, chinaPostLabelPlace } from '../../carriers/china-post
28
28
  import { correosOriginZone } from '../../carriers/correos-spain/clock.js';
29
29
  import { cttSiteZone, portugalZone } from '../../carriers/ctt/clock.js';
30
30
  import { DHLINK_RECORD_ZONE, usClockCopy } from '../../carriers/dhlink/clock.js';
31
+ import { EMIRATES_POST_ZONE, UAE_PLACE } from '../../carriers/emirates-post/clock.js';
31
32
  import { epostGlobalCopyZone } from '../../carriers/epost-global/status.js';
32
33
  import { FIRST_LINE_CHINA_ZONE, firstLineInChina } from '../../carriers/first-line/clock.js';
33
34
  import { juxiExpressAbroadZone } from '../../carriers/juxi-express/clock.js';
@@ -648,7 +649,11 @@ function cttZone(payload, location, date, number, destination) {
648
649
  * time, and read on Johannesburg's, its arrival there came at the instant of
649
650
  * Parcelforce's label read on London's. "Yanwen Logistics"'s are China's: its
650
651
  * place-less shipment information came at the minute of Yanwen's own row,
651
- * stated +08:00, under ParcelsApp's UTC label. Their home clock is a guess,
652
+ * stated +08:00, under ParcelsApp's UTC label. Emirates Post's, which ParcelsApp
653
+ * files as "Emirates Post Group", are Dubai's: its own tracker gives the same
654
+ * scans at the same digits, on Dubai's clock where it names a UAE city, and
655
+ * read as labeled they came four hours late, after the UPU's copies of them.
656
+ * One naming a UAE city is placed there (`siteZone`). Their home clock is a guess,
652
657
  * which a location in another country rules out.
653
658
  */
654
659
  const HOME_COUNTRIES = {
@@ -657,6 +662,7 @@ const HOME_COUNTRIES = {
657
662
  spl: 'Asia/Riyadh', saudipost: 'Asia/Riyadh', yanwenlogistics: 'Asia/Shanghai',
658
663
  brtbartolini: 'Europe/Rome', brtbartoliniparcelid: 'Europe/Rome', brtbartolinidpd: 'Europe/Rome',
659
664
  southafricapostoffice: 'Africa/Johannesburg', southafricapost: 'Africa/Johannesburg',
665
+ emiratespost: EMIRATES_POST_ZONE, emiratespostgroup: EMIRATES_POST_ZONE,
660
666
  };
661
667
  /**
662
668
  * Royal Mail relays its partners' scans abroad on Central European time,
@@ -1197,10 +1203,15 @@ function placeClockLine(carrier, status, location, date) {
1197
1203
  * ("Portugal") on that country's wall clock, as DHL's own tracker shows it
1198
1204
  * (carriers/dhl): read on Berlin's clock, it came an hour before the
1199
1205
  * delivering partner's own scan of it.
1206
+ * HayPost names an office abroad by its postcode and IPS's name of its country
1207
+ * (`IPS_OFFICE`): read on Yerevan's clock, its copy of Russian Post's
1208
+ * acceptance came an hour before Russian Post's own row of it.
1200
1209
  */
1201
1210
  const RELAYING_POSTS = {
1202
- azerpost: 'AZ', 'correios-br': 'BR', 'correo-uruguayo': 'UY', dhl: 'DE', 'la-poste': 'FR', 'slovenska-posta': 'SK',
1211
+ azerpost: 'AZ', 'correios-br': 'BR', 'correo-uruguayo': 'UY', dhl: 'DE', haypost: 'AM', 'la-poste': 'FR', 'slovenska-posta': 'SK',
1203
1212
  };
1213
+ // An office as HayPost names it after IPS: its postcode, then its country in ISO's style ("Netherlands (the)").
1214
+ const IPS_OFFICE = /^(?:\d{3,6}\s+)?(.+?)(?:\s*\(the\))?$/i;
1204
1215
  // Correios Brazil names the sending post's country in Portuguese after the label ParcelsApp translates
1205
1216
  // from its "País". There a name a Brazilian town shares, which `countryCode` leaves to the town, is the country.
1206
1217
  const CORREIOS_TOWN_COUNTRIES = new Map([['FRANCA', 'FR'], ['TAILANDIA', 'TH']]);
@@ -1210,14 +1221,19 @@ const CORREIOS_TOWN_COUNTRIES = new Map([['FRANCA', 'FR'], ['TAILANDIA', 'TH']])
1210
1221
  * clocks. Undefined for a scan the place does not put abroad.
1211
1222
  */
1212
1223
  function relayedPostZone(carrier, location) {
1213
- const home = carrier && Object.hasOwn(RELAYING_POSTS, carrier) ? RELAYING_POSTS[carrier] : undefined;
1214
1224
  const labelled = carrier === 'correios-br' ? /^Country,\s*(.+)$/i.exec(location)?.[1] : undefined;
1215
1225
  const shared = labelled ? CORREIOS_TOWN_COUNTRIES.get(labelled.normalize('NFD').replace(/\p{Mn}/gu, '').trim().toUpperCase()) : undefined;
1216
1226
  if (shared)
1217
1227
  return countryTimeZone(shared);
1218
- const named = home ? [lastPlace(location), ...location.split(':')].find((part) => countryCode(part)) : undefined;
1219
- const country = countryCode(named);
1220
- return country && country !== home ? countryTimeZone(named) : undefined;
1228
+ const named = relayedCountry(carrier, location);
1229
+ return named ? countryTimeZone(named) : undefined;
1230
+ }
1231
+ /** The name of the country abroad that a relaying post's scan names (`RELAYING_POSTS`), if any. */
1232
+ function relayedCountry(carrier, location) {
1233
+ const home = carrier && Object.hasOwn(RELAYING_POSTS, carrier) ? RELAYING_POSTS[carrier] : undefined;
1234
+ const place = carrier === 'haypost' ? IPS_OFFICE.exec(location.trim())?.[1] ?? location : location;
1235
+ const named = home ? [lastPlace(place), ...place.split(':')].find((part) => countryCode(part)) : undefined;
1236
+ return named && countryCode(named) !== home ? named : undefined;
1221
1237
  }
1222
1238
  /**
1223
1239
  * The zone a scan's carrier gives it wherever it was: null for a date that is
@@ -1383,6 +1399,8 @@ function siteZone(payload, state, number, inNorthAmerica = false, status = '', d
1383
1399
  return facilityZone(location);
1384
1400
  if (carrier === 'china-post' && inChina(location))
1385
1401
  return CHINA_POST_ZONE;
1402
+ if (carrier === 'emirates-post' && UAE_PLACE.test(location))
1403
+ return EMIRATES_POST_ZONE;
1386
1404
  const place = (key === 'yunexpress' ? spacedCountry(location) : null) ?? lastPlace(location);
1387
1405
  // A state or province the town confirms beats the country its code also
1388
1406
  // names ("Chicago, IL"); a merely possible one comes after ("Koeln, DE").
@@ -1677,8 +1695,9 @@ function chinaPostTwinZones(items, zones, destination) {
1677
1695
  * in the reply's origin country, when they share one zone. Their dates are the origin office's wall
1678
1696
  * clock. UPU's "Posting/Collection" of an item posted in Russia, which has several clocks, came at
1679
1697
  * the minute of Russian Post's own acceptance on Moscow's clock and, read on ParcelsApp's UTC label,
1680
- * three hours after it. The destination post's copy of that acceptance at the same minute is placed
1681
- * on its own clock, so scans outside the origin are not counted.
1698
+ * three hours after it. So is a relaying post's copy of a scan in the origin country that keeps its
1699
+ * wall clock (`relayedPostZone`): HayPost's of that acceptance, in the words of IPS. Only a zone the
1700
+ * origin keeps places it, and a scan placed outside the origin is not counted.
1682
1701
  */
1683
1702
  function postalTwinZones(items, zones, origin) {
1684
1703
  const minute = (date) => mislabeledWallTime(date)?.slice(0, 16) ?? '';
@@ -1686,7 +1705,10 @@ function postalTwinZones(items, zones, origin) {
1686
1705
  const shared = (found) => (new Set(found).size === 1 ? found[0] : null);
1687
1706
  return items.map((item, index) => {
1688
1707
  const key = minute(item.date);
1689
- if (zones[index].zone || item.offset || !key || !POSTAL_FEEDS.has(nameKey(item.name)) || !POSTAL_ORIGIN_LEG.test(relayedLabel(item.raw.status).trim()))
1708
+ const carrier = typeof item.name === 'string' ? carrierIdFromName(item.name) : undefined;
1709
+ const relayed = !POSTAL_FEEDS.has(nameKey(item.name)) && origin !== null && countryCode(relayedCountry(carrier, item.location)) === origin;
1710
+ if (zones[index].zone || item.offset || !key || !(relayed || (POSTAL_FEEDS.has(nameKey(item.name))
1711
+ && POSTAL_ORIGIN_LEG.test(relayedLabel(item.raw.status).trim()))))
1690
1712
  return null;
1691
1713
  const twins = items.flatMap((other, at) => {
1692
1714
  const { zone, step } = zones[at];
@@ -1694,7 +1716,8 @@ function postalTwinZones(items, zones, origin) {
1694
1716
  });
1695
1717
  const copied = shared(twins.filter(({ same }) => same).map(({ zone }) => zone));
1696
1718
  const local = origin ? shared(twins.filter(({ zone }) => keepsZone(origin, zone)).map(({ zone }) => zone)) : null;
1697
- return fitsPlace(copied ?? local, item.location, true);
1719
+ const zone = copied ?? local;
1720
+ return relayed ? (zone && keepsZone(origin, zone) ? zone : null) : fitsPlace(zone, item.location, true);
1698
1721
  });
1699
1722
  }
1700
1723
  /**
@@ -2,7 +2,7 @@
2
2
  "openapi": "3.1.0",
3
3
  "info": {
4
4
  "title": "Universal Parcel Scraper",
5
- "version": "0.1102.2-main.6239"
5
+ "version": "0.1102.4-main.6243"
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.1102.2-main.6239",
3
+ "version": "0.1102.4-main.6243",
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",