universal-parcel-scraper 0.807.0-main.4337 → 0.807.2-main.4341

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.
@@ -3,7 +3,9 @@ export declare const CAINIAO_CHINA_ZONE = "Asia/Shanghai";
3
3
  /**
4
4
  * The wordings of Cainiao's steps in China, from the seller's to the
5
5
  * departing flight, and of its return warehouse. Its feed dates them on
6
- * China's clock wherever the parcel goes. Its later steps are on their site's
6
+ * China's clock wherever the parcel goes. So is the order's cancellation:
7
+ * on any clock west of UTC+7:36 it came after the check that first returned
8
+ * it, on a parcel to Portugal. Its later steps are on their site's
7
9
  * clock, which varies by parcel, so they are not listed: "Arrived at linehaul
8
10
  * office" came at China's digits on one parcel and Europe's on another. The
9
11
  * list holds Cainiao's English, as ParcelsApp relays it, and Postal Ninja's
@@ -3,14 +3,16 @@ export const CAINIAO_CHINA_ZONE = 'Asia/Shanghai';
3
3
  /**
4
4
  * The wordings of Cainiao's steps in China, from the seller's to the
5
5
  * departing flight, and of its return warehouse. Its feed dates them on
6
- * China's clock wherever the parcel goes. Its later steps are on their site's
6
+ * China's clock wherever the parcel goes. So is the order's cancellation:
7
+ * on any clock west of UTC+7:36 it came after the check that first returned
8
+ * it, on a parcel to Portugal. Its later steps are on their site's
7
9
  * clock, which varies by parcel, so they are not listed: "Arrived at linehaul
8
10
  * office" came at China's digits on one parcel and Europe's on another. The
9
11
  * list holds Cainiao's English, as ParcelsApp relays it, and Postal Ninja's
10
12
  * translation of it, which keeps Cainiao's digits.
11
13
  */
12
14
  export const CAINIAO_CHINA_LEG = [
13
- 'pending shipping by the seller', 'order received successfully', 'package finished', 'leave the warehouse',
15
+ 'pending shipping by the seller', 'order received successfully', 'order has been cancelled', 'package finished', 'leave the warehouse',
14
16
  'departed from warehouse', 'accepted by carrier', 'shipment information received by warehouse electronically',
15
17
  'package ready for shipping from warehouse', 'package shipped out from warehouse',
16
18
  '(?:inbound|outbound) in sorting center', 'processing at sorting center', 'departed from sorting center',
@@ -1,4 +1,8 @@
1
1
  import { type AmazonShippingOptions } from './adapter.js';
2
2
  import type { TrackingContext } from '../../core/adapter/index.js';
3
- /** A public eligibility check; transport errors remain errors for the consumer to report. */
3
+ /**
4
+ * A public eligibility check; transport errors remain errors for the consumer to report. It asks
5
+ * Amazon's tracker without the adapter registry, so it refuses placeholder numbers itself, as the
6
+ * registry does: trackers show other people's shipments under them.
7
+ */
4
8
  export declare function amazonShippingEligibility(number: string, options?: AmazonShippingOptions, context?: TrackingContext): Promise<'available' | 'expired' | 'not-found'>;
@@ -1,7 +1,15 @@
1
1
  import { AmazonShippingTracker } from './adapter.js';
2
- import { CarrierError } from '../../core/errors/index.js';
3
- /** A public eligibility check; transport errors remain errors for the consumer to report. */
2
+ import { isPlaceholderNumber } from '../../core/detection/index.js';
3
+ import { CarrierError, InvalidInputError } from '../../core/errors/index.js';
4
+ /**
5
+ * A public eligibility check; transport errors remain errors for the consumer to report. It asks
6
+ * Amazon's tracker without the adapter registry, so it refuses placeholder numbers itself, as the
7
+ * registry does: trackers show other people's shipments under them.
8
+ */
4
9
  export async function amazonShippingEligibility(number, options = {}, context = {}) {
10
+ if (isPlaceholderNumber(number)) {
11
+ throw new InvalidInputError('amazon-shipping', 'A placeholder number is not looked up', { reason: 'placeholder_number' });
12
+ }
5
13
  try {
6
14
  await new AmazonShippingTracker({ ...options, timeoutMs: options.timeoutMs ?? 5_000 }).fetch(number, context);
7
15
  return 'available';
@@ -2,7 +2,7 @@
2
2
  "openapi": "3.1.0",
3
3
  "info": {
4
4
  "title": "Universal Parcel Scraper",
5
- "version": "0.807.0-main.4337"
5
+ "version": "0.807.2-main.4341"
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.807.0-main.4337",
3
+ "version": "0.807.2-main.4341",
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",