apps / health / catalog / validate: fixes from a read-only run against live store accounts
- API error bodies on one line (errorBody): Google and App Store Connect pretty-print errors, which hid SERVICE_DISABLED from the Play account check (reported permission instead of api-disabled), broke tables and turned serve's apps.list error into a JSON fragment - apps list: failure says the reason and the fix (same words as apps check) - newest App Store version by createdDate, iOS first (the API groups versions by platform); all versions read so no platform is missed; per-app reads four at a time - apps check (apple): team app count from meta.paging.total with a one-app read - Play Money without units (prices under 1.00) read as 0.xx, not NaN (catalog diff, subscription diffs) - health: App Store Connect 404 for perfPowerMetrics / diagnosticSignatures means no field data yet; Play vitals behind a disabled Reporting API say so with the fix - validate: gracRatingClassificationNumber optional, socialMediaAgeRestricted only when socialMedia is yes, socialMedia unanswered is a warning - tests with sanitized recorded responses (tests/store-real-shapes.test.ts)
This commit is contained in:
parent
8bb28db45c
commit
b8da75e519
14 changed files with 342 additions and 34 deletions
|
|
@ -3,6 +3,7 @@
|
|||
import { createHash, createPrivateKey, sign } from 'node:crypto';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { ascKey } from '../lib/credentials';
|
||||
import { errorBody } from '../lib/http';
|
||||
|
||||
const b64 = (b: Buffer | string): string => Buffer.from(b).toString('base64url');
|
||||
export const md5 = (b: Buffer | Uint8Array): string => createHash('md5').update(b).digest('hex');
|
||||
|
|
@ -42,7 +43,7 @@ export async function ascClient(root: string, bundleId: string, appIdHint?: stri
|
|||
});
|
||||
const t = await r.text();
|
||||
if ((r.status >= 500 || r.status === 429) && attempt < 5) { await Bun.sleep(2000 * attempt); return asc(method, path, body, attempt + 1); }
|
||||
if (!r.ok) throw new Error(`${method} ${path} -> ${r.status} ${t.slice(0, 1500)}`);
|
||||
if (!r.ok) throw new Error(`${method} ${path} -> ${r.status} ${errorBody(t)}`);
|
||||
return t ? JSON.parse(t) : {};
|
||||
}
|
||||
|
||||
|
|
@ -52,7 +53,7 @@ export async function ascClient(root: string, bundleId: string, appIdHint?: stri
|
|||
const r = await fetch('https://api.appstoreconnect.apple.com' + path, { headers: { Authorization: 'Bearer ' + jwt(), Accept: accept } });
|
||||
const t = await r.text();
|
||||
if ((r.status >= 500 || r.status === 429) && attempt < 5) { await Bun.sleep(2000 * attempt); continue; }
|
||||
if (!r.ok) throw new Error(`GET ${path} -> ${r.status} ${t.slice(0, 800)}`);
|
||||
if (!r.ok) throw new Error(`GET ${path} -> ${r.status} ${errorBody(t, 800)}`);
|
||||
return t ? JSON.parse(t) : {};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue