feat: add debug script for inspecting raw API data per park+date
All checks were successful
Build and Deploy / Build & Push (push) Successful in 4m23s

npm run debug -- --park greatadventure --date 2026-07-04

Prints the raw API response for that day alongside the parsed result
so mismatched or missing hours can be traced to their source.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-04 10:39:37 -04:00
parent 5bef17aa41
commit 8a68251beb
3 changed files with 126 additions and 1 deletions

View File

@@ -97,6 +97,19 @@ async function fetchApi(url: string, attempt = 0, totalWaitedMs = 0): Promise<Ap
return res.json() as Promise<ApiResponse>;
}
/**
* Fetch the raw API response for a month — used by scripts/debug.ts.
*/
export async function scrapeMonthRaw(
apiId: number,
year: number,
month: number
): Promise<ApiResponse> {
const dateParam = `${year}${String(month).padStart(2, "0")}`;
const url = `${API_BASE}/${apiId}?date=${dateParam}`;
return fetchApi(url);
}
/**
* Fetch operating hours for an entire month in a single API call.
* apiId must be pre-discovered via scripts/discover.ts.