apple game-center: literal API paths (query guard reads them); api coverage regenerated

This commit is contained in:
CRTkafa 2026-10-21 05:14:23 +07:00
parent 93d7f8a5fc
commit d427b5c4a4
3 changed files with 27 additions and 13 deletions

View file

@ -69,6 +69,7 @@ export const WRAPPED: { apple: Record<string, string>; play: Record<string, stri
'appStoreVersions_build_getToOneRelated': 'apple/listing apple/resubmit validate',
'appStoreVersions_build_updateToOneRelationship': 'apple/listing apple/resubmit',
'appStoreVersions_createInstance': 'apple/listing',
'appStoreVersions_gameCenterAppVersion_getToOneRelated': 'apple/game-center',
'appStoreVersions_getInstance': 'apple/listing',
'appStoreVersions_updateInstance': 'apple/listing',
'apps_analyticsReportRequests_getToManyRelated': 'analytics',
@ -87,6 +88,7 @@ export const WRAPPED: { apple: Record<string, string>; play: Record<string, stri
'apps_betaGroups_getToManyRelated': 'apple/testflight',
'apps_buildUploads_getToManyRelated': 'apple/upload',
'apps_customerReviews_getToManyRelated': 'reviews',
'apps_gameCenterDetail_getToOneRelated': 'apple/game-center',
'apps_getCollection': 'apple/asc apple/bundle apps console/app-id console/verify lib/store-apps',
'apps_getInstance': 'apple/appinfo apple/status apps onboard',
'apps_inAppPurchasesV2_getToManyRelated': 'apple/first-products apple/iap apple/iap-review apple/iap-submit apple/offer-codes apple/promoted apple/status catalog prices validate',
@ -137,6 +139,12 @@ export const WRAPPED: { apple: Record<string, string>; play: Record<string, stri
'diagnosticSignatures_logs_getToManyRelated': 'health',
'endAppAvailabilityPreOrders_createInstance': 'lib/offers',
'financeReports_getCollection': 'lib/reports',
'gameCenterAchievements_localizations_getToManyRelated': 'apple/game-center',
'gameCenterAppVersions_createInstance': 'apple/game-center',
'gameCenterDetails_createInstance': 'apple/game-center',
'gameCenterDetails_gameCenterAchievements_getToManyRelated': 'apple/game-center',
'gameCenterDetails_gameCenterLeaderboards_getToManyRelated': 'apple/game-center',
'gameCenterLeaderboards_localizations_getToManyRelated': 'apple/game-center',
'inAppPurchaseAppStoreReviewScreenshots_createInstance': 'apple/iap-review',
'inAppPurchaseAppStoreReviewScreenshots_deleteInstance': 'apple/iap-review',
'inAppPurchaseAppStoreReviewScreenshots_updateInstance': 'apple/iap-review',

View file

@ -25,9 +25,15 @@ export interface GcState {
achievements: GcExisting[];
}
/** Literal paths (the API guard test reads them from the source). */
const locsPath = (type: 'gameCenterLeaderboards' | 'gameCenterAchievements', id: string): string =>
type === 'gameCenterLeaderboards' ? `/v1/gameCenterLeaderboards/${id}/localizations?limit=200` : `/v1/gameCenterAchievements/${id}/localizations?limit=200`;
const itemsPath = (type: 'gameCenterLeaderboards' | 'gameCenterAchievements', detail: string): string =>
type === 'gameCenterLeaderboards' ? `/v1/gameCenterDetails/${detail}/gameCenterLeaderboards?limit=200` : `/v1/gameCenterDetails/${detail}/gameCenterAchievements?limit=200`;
async function withLocs(c: Asc, list: J[], type: 'gameCenterLeaderboards' | 'gameCenterAchievements'): Promise<GcExisting[]> {
const out: GcExisting[] = [];
for (const x of list) out.push({ id: x.id, attributes: x.attributes ?? {}, localizations: (await c.all(`/v1/${type}/${x.id}/localizations?limit=200`)).map((l: J) => ({ id: l.id, attributes: l.attributes ?? {} })) });
for (const x of list) out.push({ id: x.id, attributes: x.attributes ?? {}, localizations: (await c.all(locsPath(type, x.id))).map((l: J) => ({ id: l.id, attributes: l.attributes ?? {} })) });
return out;
}
@ -100,12 +106,12 @@ export async function run(ctx: Ctx): Promise<void> {
log(TAG, `Game Center switched on for version ${s.version.versionString}`);
}
for (const p of plan) {
const type = p.kind === 'leaderboard' ? 'gameCenterLeaderboards' : 'gameCenterAchievements';
const type = p.kind === 'leaderboard' ? 'gameCenterLeaderboards' as const : 'gameCenterAchievements' as const;
const locType = p.kind === 'leaderboard' ? 'gameCenterLeaderboardLocalizations' : 'gameCenterAchievementLocalizations';
const parentRel = p.kind === 'leaderboard' ? 'gameCenterLeaderboard' : 'gameCenterAchievement';
let id = p.storeId;
if (p.action === 'create') {
const find = async () => (await c.all(`/v1/gameCenterDetails/${detail}/${type}?limit=200`)).find((x: J) => x.attributes?.vendorIdentifier === p.id)?.id ?? null;
const find = async () => (await c.all(itemsPath(type, detail!))).find((x: J) => x.attributes?.vendorIdentifier === p.id)?.id ?? null;
id = (await createOnce({ what: `${p.kind} ${p.id}`, tag: TAG, unique: true, find,
create: async () => (await c.asc('POST', `/v1/${type}`, { data: { type, attributes: { ...p.attributes, vendorIdentifier: p.id }, relationships: { gameCenterDetail: { data: { type: 'gameCenterDetails', id: detail } } } } })).data.id as string })).value;
log(TAG, `${p.kind} ${p.id}: created`);
@ -118,7 +124,7 @@ export async function run(ctx: Ctx): Promise<void> {
if (l.action === 'create') {
const pid = id!;
await createOnce({ what: `${p.kind} ${p.id} ${l.locale}`, tag: TAG, unique: true,
find: async () => (await c.all(`/v1/${type}/${pid}/localizations?limit=200`)).find((x: J) => x.attributes?.locale === l.locale)?.id ?? null,
find: async () => (await c.all(locsPath(type, pid))).find((x: J) => x.attributes?.locale === l.locale)?.id ?? null,
create: async () => (await c.asc('POST', `/v1/${locType}`, { data: { type: locType, attributes: { locale: l.locale, ...l.attributes }, relationships: { [parentRel]: { data: { type, id: pid } } } } })).data.id as string });
log(TAG, `${p.kind} ${p.id} ${l.locale}: created`);
} else if (l.action === 'update') {