universal-parcel-scraper 0.1223.2-main.7890 → 0.1223.4-main.7894

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.
@@ -57355,7 +57355,7 @@ function Gl(e) {
57355
57355
  if (o) return Il(o, "link");
57356
57356
  } catch {}
57357
57357
  }
57358
- let i = ll(t, r);
57358
+ let i = ll(t.replace(/%[0-9A-F]{2}/gi, " "), r);
57359
57359
  if (i) return Il(i, t === i ? "number" : "text");
57360
57360
  let a = Wl(t);
57361
57361
  if (a) return Il(a.number, a.labelled ? "text" : "number");
@@ -62,6 +62,8 @@ export function parseDelhivery(payload, number) {
62
62
  // The separate shipment status establishes movement or completed delivery.
63
63
  const snapshotDescription = returning && description.toUpperCase() === 'RETURNED'
64
64
  ? clean(item.hqStatus, 200) : description;
65
+ // A status token reads as its words, "WAITING_PICKUP" as "Waiting pickup", which the map still classifies.
66
+ const snapshotWords = statusWords(snapshotDescription);
65
67
  const current = classifyDelhiveryStatus(snapshotDescription);
66
68
  const mapped = returning && current?.stage === 'delivered'
67
69
  ? classifyDelhiveryStatus('RTO DELIVERED') : current;
@@ -136,9 +138,9 @@ export function parseDelhivery(payload, number) {
136
138
  // delivered milestone already records the delivery the status repeats.
137
139
  const deliveryRecorded = mapped?.stage === 'delivered' && deliveredAt !== null;
138
140
  if (snapshotDescription && !latest && !deliveryRecorded && (!updated || !events.some(event => event.time && Date.parse(event.time) === updated.timestamp
139
- && event.description?.toUpperCase() === snapshotDescription.toUpperCase() && event.stage === mapped?.stage
141
+ && event.description?.toUpperCase() === snapshotWords.toUpperCase() && event.stage === mapped?.stage
140
142
  && (!returning || event.provider_leg === 'return')))) {
141
- events.unshift({ description: snapshotDescription, ...(updated ? { time: updated.iso } : currentTimeText ? { provider_time_text: currentTimeText } : {}),
143
+ events.unshift({ description: snapshotWords, ...(updated ? { time: updated.iso } : currentTimeText ? { provider_time_text: currentTimeText } : {}),
142
144
  ...(mapped ? { stage: mapped.stage } : {}), ...(returning ? { provider_leg: 'return' } : {}), summary_snapshot: true });
143
145
  }
144
146
  const dated = events.filter(event => event.time);
@@ -150,7 +152,10 @@ export function parseDelhivery(payload, number) {
150
152
  // A freight status can date a later proof-of-delivery audit: its delivered milestone dates the delivery.
151
153
  const deliveryTime = deliveredAt ?? updated;
152
154
  return { status: mapped?.status ?? 'unknown', ...(mapped ? { current_stage: mapped.stage } : {}),
153
- last_status_text: latest && !returning ? latest.description : description, last_update: updated?.iso ?? null, expected_delivery: null,
155
+ last_status_text: latest && !returning ? latest.description : statusWords(description), last_update: updated?.iso ?? null, expected_delivery: null,
154
156
  ...(mapped?.status === 'delivered' && deliveryTime ? { delivered_at: deliveryTime.iso } : {}),
155
157
  timezone: 'Asia/Kolkata', events: [...dated, ...undated].slice(0, 100) };
156
158
  }
159
+ function statusWords(value) {
160
+ return /^[A-Z]+(?:_[A-Z]+)+$/.test(value) ? value.charAt(0) + value.slice(1).toLowerCase().replaceAll('_', ' ') : value;
161
+ }
@@ -236,7 +236,9 @@ export function parseTrackingInput(raw) {
236
236
  // Keep looking: pasted prose can contain a truncated or malformed URL.
237
237
  }
238
238
  }
239
- const recognized = recognizedNumberInScan(input, scan);
239
+ // A link was read decoded above. Read raw, a percent escape would run into what follows it,
240
+ // "%3D201234567" into "3D201234567", so escapes are set apart, in a link and in prose alike.
241
+ const recognized = recognizedNumberInScan(input.replace(/%[0-9A-F]{2}/gi, ' '), scan);
240
242
  if (recognized) {
241
243
  return trackingMatch(recognized, input === recognized ? 'number' : 'text');
242
244
  }
@@ -2,7 +2,7 @@
2
2
  "openapi": "3.1.0",
3
3
  "info": {
4
4
  "title": "Universal Parcel Scraper",
5
- "version": "0.1223.2-main.7890"
5
+ "version": "0.1223.4-main.7894"
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.1223.2-main.7890",
3
+ "version": "0.1223.4-main.7894",
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",