Skip to content

Add JavaScript/TypeScript wrapper for VesselFinder Container Tracking API#19

Draft
pragan333 with Copilot wants to merge 1 commit into
mainfrom
copilot/update-container-tracking-api-wrapper
Draft

Add JavaScript/TypeScript wrapper for VesselFinder Container Tracking API#19
pragan333 with Copilot wants to merge 1 commit into
mainfrom
copilot/update-container-tracking-api-wrapper

Conversation

Copilot AI commented Apr 9, 2026

Copy link
Copy Markdown

Adds a new packages/container-tracking-api-wrapper package implementing the VesselFinder Container Tracking API (GET /container/{apiKey}/{containerNumber}/{sealine}) in TypeScript, equivalent to the existing Python and PHP wrappers.

Core implementation

  • ContainerTrackingApi class initialized with an API key
  • ISO 6346 container number validation: length, regex (\w{3}[UJZR]\d{7}), and check-digit
  • Sealine (SCAC) validation: 2–4 chars
  • container(containerNumber, sealine?, timeout?) method with two modes:
    • Single-shot (timeout=0|null): one request, returns raw body
    • Polling (timeout≥10): retries every 10 s until HTTP status ≠ 202; throws Request timed out. when exhausted
const api = new ContainerTrackingApi('YOUR_API_KEY');

// Single-shot
const result = await api.container('MEDU6965343', undefined, 0);

// Polling with 2-minute timeout
const result = await api.container('MEDU6965343', 'MSCU', 120);

Package structure

  • src/ContainerTrackingApi.ts — main class
  • src/index.ts — public exports
  • __tests__/ContainerTrackingApi.test.ts — 18 unit tests covering validation, single-shot, polling, timeout, and URL construction

@vercel

vercel Bot commented Apr 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
expo Error Error Apr 9, 2026 10:41pm

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants