@yoonion/mimi-seed-mcp 0.23.0 → 0.23.2
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.
- package/README.md +1 -1
- package/assets/agent-guide.md +30 -27
- package/dist/ai/notes.js +3 -2
- package/dist/ai/review.js +1 -1
- package/dist/appstore/app-info-policy.d.ts +27 -0
- package/dist/appstore/app-info-policy.js +104 -0
- package/dist/appstore/app-info.d.ts +19 -0
- package/dist/appstore/app-info.js +68 -0
- package/dist/appstore/apps.d.ts +2 -6
- package/dist/appstore/apps.js +20 -42
- package/dist/appstore/asset-library-write.d.ts +39 -0
- package/dist/appstore/asset-library-write.js +282 -0
- package/dist/appstore/asset-library.d.ts +28 -0
- package/dist/appstore/asset-library.js +204 -0
- package/dist/appstore/client.d.ts +4 -3
- package/dist/appstore/declarations.js +11 -14
- package/dist/appstore/previews.js +3 -29
- package/dist/appstore/read-response.d.ts +14 -0
- package/dist/appstore/read-response.js +20 -0
- package/dist/appstore/release-target.d.ts +49 -0
- package/dist/appstore/release-target.js +107 -0
- package/dist/appstore/review-submission.d.ts +1 -1
- package/dist/appstore/review-submission.js +12 -10
- package/dist/appstore/screenshots.d.ts +1 -0
- package/dist/appstore/screenshots.js +60 -4
- package/dist/appstore/upload-parts.d.ts +11 -0
- package/dist/appstore/upload-parts.js +29 -0
- package/dist/appstore/versions.d.ts +5 -1
- package/dist/appstore/versions.js +18 -16
- package/dist/checks/plan.d.ts +1 -0
- package/dist/checks/plan.js +89 -71
- package/dist/checks/risks.d.ts +18 -2
- package/dist/checks/risks.js +280 -177
- package/dist/playstore/reviews.d.ts +61 -0
- package/dist/playstore/reviews.js +27 -11
- package/dist/prompts.d.ts +3 -2
- package/dist/prompts.js +109 -88
- package/dist/registers/ai.js +2 -2
- package/dist/registers/appstore/customer-reviews.js +1 -1
- package/dist/registers/appstore/media.js +69 -24
- package/dist/registers/appstore/review-submission.js +4 -3
- package/dist/registers/appstore/versions.js +8 -4
- package/dist/registers/auth.js +1 -1
- package/dist/registers/checks.js +18 -8
- package/dist/registers/playstore.js +10 -1
- package/dist/server.js +7 -1
- package/package.json +1 -1
- package/tool-manifest.json +5 -2
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { apiGet } from './client.js';
|
|
3
|
+
export const appStorePagination = z.object({
|
|
4
|
+
links: z.object({ next: z.string().nullish() }).nullish(),
|
|
5
|
+
meta: z.object({ paging: z.object({
|
|
6
|
+
total: z.number().int().nonnegative().optional(),
|
|
7
|
+
nextCursor: z.string().nullish(),
|
|
8
|
+
}).optional() }).optional(),
|
|
9
|
+
});
|
|
10
|
+
export function pageIsIncomplete(page, count) {
|
|
11
|
+
return Boolean(page.links?.next || page.meta?.paging?.nextCursor) || (page.meta?.paging?.total ?? 0) > count;
|
|
12
|
+
}
|
|
13
|
+
export async function getAppStoreResponse(schema, path, params) {
|
|
14
|
+
const response = schema.safeParse(await apiGet(path, params));
|
|
15
|
+
if (!response.success) {
|
|
16
|
+
const field = response.error.issues[0]?.path.join('.') || '응답 본문';
|
|
17
|
+
throw new Error(`App Store Connect 응답 형식 오류 (${field}).`);
|
|
18
|
+
}
|
|
19
|
+
return response.data;
|
|
20
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const platformSchema: z.ZodEnum<{
|
|
3
|
+
IOS: "IOS";
|
|
4
|
+
MAC_OS: "MAC_OS";
|
|
5
|
+
TV_OS: "TV_OS";
|
|
6
|
+
VISION_OS: "VISION_OS";
|
|
7
|
+
}>;
|
|
8
|
+
export type AppStorePlatform = z.infer<typeof platformSchema>;
|
|
9
|
+
declare const processingState: z.ZodEnum<{
|
|
10
|
+
PROCESSING: "PROCESSING";
|
|
11
|
+
FAILED: "FAILED";
|
|
12
|
+
INVALID: "INVALID";
|
|
13
|
+
VALID: "VALID";
|
|
14
|
+
}>;
|
|
15
|
+
export type AppStoreBuildReadiness = {
|
|
16
|
+
status: 'missing';
|
|
17
|
+
} | {
|
|
18
|
+
status: 'unknown';
|
|
19
|
+
detail: string;
|
|
20
|
+
} | {
|
|
21
|
+
status: 'ready' | 'not-ready';
|
|
22
|
+
id: string;
|
|
23
|
+
processingState: z.infer<typeof processingState>;
|
|
24
|
+
};
|
|
25
|
+
export interface AppStoreVersionCandidate {
|
|
26
|
+
id: string;
|
|
27
|
+
versionString?: string;
|
|
28
|
+
state: string;
|
|
29
|
+
platform: AppStorePlatform;
|
|
30
|
+
linkedBuildId?: string;
|
|
31
|
+
build?: AppStoreBuildReadiness;
|
|
32
|
+
}
|
|
33
|
+
type VersionSelection = {
|
|
34
|
+
status: 'selected';
|
|
35
|
+
version: AppStoreVersionCandidate;
|
|
36
|
+
} | {
|
|
37
|
+
status: 'missing';
|
|
38
|
+
} | {
|
|
39
|
+
status: 'ambiguous';
|
|
40
|
+
} | {
|
|
41
|
+
status: 'incomplete';
|
|
42
|
+
};
|
|
43
|
+
export declare function selectEditableAppStoreVersion(appId: string, filters?: {
|
|
44
|
+
versionId?: string;
|
|
45
|
+
versionString?: string;
|
|
46
|
+
}): Promise<VersionSelection>;
|
|
47
|
+
/** Resolve the selected version's build without an API request when included data is complete. */
|
|
48
|
+
export declare function resolveAppStoreVersionBuild(version: AppStoreVersionCandidate): Promise<AppStoreBuildReadiness>;
|
|
49
|
+
export {};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { encodePathSegment } from '../lib/url-path.js';
|
|
3
|
+
import { isNotFound } from './http.js';
|
|
4
|
+
import { appStorePagination, getAppStoreResponse, pageIsIncomplete } from './read-response.js';
|
|
5
|
+
const editableStates = ['PREPARE_FOR_SUBMISSION', 'DEVELOPER_REJECTED', 'METADATA_REJECTED', 'REJECTED'];
|
|
6
|
+
const versionPage = appStorePagination.extend({
|
|
7
|
+
data: z.array(z.object({
|
|
8
|
+
id: z.string().min(1),
|
|
9
|
+
type: z.literal('appStoreVersions').optional(),
|
|
10
|
+
attributes: z.object({
|
|
11
|
+
versionString: z.string().nullish(),
|
|
12
|
+
appVersionState: z.string().nullish(),
|
|
13
|
+
appStoreState: z.string().nullish(),
|
|
14
|
+
platform: z.string().nullish(),
|
|
15
|
+
}).nullish(),
|
|
16
|
+
relationships: z.object({ build: z.unknown().optional() }).nullish(),
|
|
17
|
+
})),
|
|
18
|
+
included: z.array(z.unknown()).nullish(),
|
|
19
|
+
});
|
|
20
|
+
const platformSchema = z.enum(['IOS', 'MAC_OS', 'TV_OS', 'VISION_OS']);
|
|
21
|
+
const buildReference = z.object({ id: z.string().min(1), type: z.literal('builds') });
|
|
22
|
+
const buildRelationship = z.object({ data: buildReference.nullable() });
|
|
23
|
+
const processingState = z.enum(['PROCESSING', 'FAILED', 'INVALID', 'VALID']);
|
|
24
|
+
const buildResource = buildReference.extend({
|
|
25
|
+
attributes: z.object({ processingState }).nullish(),
|
|
26
|
+
});
|
|
27
|
+
const buildResponse = z.object({ data: buildResource.nullable() });
|
|
28
|
+
function buildReadiness(build) {
|
|
29
|
+
const state = build.attributes?.processingState;
|
|
30
|
+
if (!state)
|
|
31
|
+
return undefined;
|
|
32
|
+
return { status: state === 'VALID' ? 'ready' : 'not-ready', id: build.id, processingState: state };
|
|
33
|
+
}
|
|
34
|
+
export async function selectEditableAppStoreVersion(appId, filters = {}) {
|
|
35
|
+
const { versionId, versionString } = filters;
|
|
36
|
+
const page = await getAppStoreResponse(versionPage, `/apps/${encodePathSegment(appId)}/appStoreVersions`, {
|
|
37
|
+
'filter[appVersionState]': editableStates.join(','),
|
|
38
|
+
...(versionId ? { 'filter[id]': versionId } : {}),
|
|
39
|
+
...(versionString ? { 'filter[versionString]': versionString } : {}),
|
|
40
|
+
'fields[appStoreVersions]': 'versionString,platform,appVersionState,build',
|
|
41
|
+
'fields[builds]': 'processingState',
|
|
42
|
+
include: 'build',
|
|
43
|
+
limit: versionId ? '1' : '5',
|
|
44
|
+
});
|
|
45
|
+
const candidates = [];
|
|
46
|
+
let incomplete = pageIsIncomplete(page, page.data.length);
|
|
47
|
+
for (const row of page.data) {
|
|
48
|
+
const version = row.attributes?.versionString ?? undefined;
|
|
49
|
+
const state = row.attributes?.appVersionState ?? row.attributes?.appStoreState ?? undefined;
|
|
50
|
+
if ((versionId && versionId !== row.id) || (versionString && version && versionString !== version)
|
|
51
|
+
|| (state && !editableStates.includes(state)))
|
|
52
|
+
continue;
|
|
53
|
+
const platform = platformSchema.safeParse(row.attributes?.platform);
|
|
54
|
+
if (!state || !platform.success || (versionString && !version)) {
|
|
55
|
+
incomplete = true;
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
const linkage = buildRelationship.safeParse(row.relationships?.build);
|
|
59
|
+
const linkedBuildId = linkage.success ? linkage.data.data?.id : undefined;
|
|
60
|
+
const included = linkedBuildId ? (page.included ?? []).filter((item) => {
|
|
61
|
+
const ref = buildReference.safeParse(item);
|
|
62
|
+
return ref.success && ref.data.id === linkedBuildId;
|
|
63
|
+
}) : [];
|
|
64
|
+
const embedded = included.length === 1 ? buildResource.safeParse(included[0]) : undefined;
|
|
65
|
+
candidates.push({
|
|
66
|
+
id: row.id,
|
|
67
|
+
versionString: version,
|
|
68
|
+
state,
|
|
69
|
+
platform: platform.data,
|
|
70
|
+
linkedBuildId,
|
|
71
|
+
build: linkage.success && linkage.data.data === null
|
|
72
|
+
? { status: 'missing' }
|
|
73
|
+
: embedded?.success ? buildReadiness(embedded.data) : undefined,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
if (candidates.length > 1)
|
|
77
|
+
return { status: 'ambiguous' };
|
|
78
|
+
if (incomplete)
|
|
79
|
+
return { status: 'incomplete' };
|
|
80
|
+
const version = candidates[0];
|
|
81
|
+
return version ? { status: 'selected', version } : { status: 'missing' };
|
|
82
|
+
}
|
|
83
|
+
/** Resolve the selected version's build without an API request when included data is complete. */
|
|
84
|
+
export async function resolveAppStoreVersionBuild(version) {
|
|
85
|
+
if (version.build)
|
|
86
|
+
return version.build;
|
|
87
|
+
const missing = version.linkedBuildId
|
|
88
|
+
? { status: 'unknown', detail: '버전 목록의 빌드 연결과 상세 조회 결과가 일치하지 않습니다.' }
|
|
89
|
+
: { status: 'missing' };
|
|
90
|
+
try {
|
|
91
|
+
const { data } = await getAppStoreResponse(buildResponse, `/appStoreVersions/${encodePathSegment(version.id)}/build`, {
|
|
92
|
+
'fields[builds]': 'processingState',
|
|
93
|
+
});
|
|
94
|
+
if (!data)
|
|
95
|
+
return missing;
|
|
96
|
+
if (version.linkedBuildId && data.id !== version.linkedBuildId) {
|
|
97
|
+
return { status: 'unknown', detail: '버전 목록과 상세 조회에서 서로 다른 빌드 ID가 반환되었습니다.' };
|
|
98
|
+
}
|
|
99
|
+
return buildReadiness(data)
|
|
100
|
+
?? { status: 'unknown', detail: '연결된 빌드의 처리 상태가 응답에 없습니다.' };
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
if (isNotFound(error))
|
|
104
|
+
return missing;
|
|
105
|
+
return { status: 'unknown', detail: error instanceof Error ? error.message : String(error) };
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -34,7 +34,7 @@ export declare function submitVersionForReview(versionId: string): Promise<{
|
|
|
34
34
|
reusedSubmission: boolean;
|
|
35
35
|
itemAttached: boolean;
|
|
36
36
|
recoveredFromStaleSubmission: boolean;
|
|
37
|
-
state:
|
|
37
|
+
state: string;
|
|
38
38
|
}>;
|
|
39
39
|
export declare function addProductToReviewSubmission(args: {
|
|
40
40
|
internalId: string;
|
|
@@ -3,10 +3,6 @@
|
|
|
3
3
|
import { apiGet, apiPatch, apiPost } from './client.js';
|
|
4
4
|
import { getVersionAppAndPlatform, getVersionLocalizations } from './versions.js';
|
|
5
5
|
import { encodePathSegment } from '../lib/url-path.js';
|
|
6
|
-
// ─── 심사 제출 (Submit for Review) ───
|
|
7
|
-
// 2024년 1월부터 옛 /appStoreVersionSubmissions가 deprecated 됐고,
|
|
8
|
-
// 새 모델은 /reviewSubmissions + /reviewSubmissionItems 2단계 + PATCH submitted=true.
|
|
9
|
-
// 참고: https://developer.apple.com/documentation/appstoreconnectapi/submit-an-app-for-review
|
|
10
6
|
async function findOpenReviewSubmission(appId, platform, versionId) {
|
|
11
7
|
// ASC API는 filter[state]=CREATED를 더 이상 허용하지 않음 (READY_FOR_REVIEW, WAITING_FOR_REVIEW 등만 허용).
|
|
12
8
|
// CREATED 상태 submission은 별도로 조회 불가 → 이미 진행 중인 submission만 재사용.
|
|
@@ -20,7 +16,10 @@ async function findOpenReviewSubmission(appId, platform, versionId) {
|
|
|
20
16
|
if (data?.links?.next) {
|
|
21
17
|
throw new Error('reviewSubmission 목록이 여러 페이지야. 기존 버전 묶음을 모두 확인할 수 없어 제출을 중단했어.');
|
|
22
18
|
}
|
|
23
|
-
|
|
19
|
+
if (!Array.isArray(data?.data)) {
|
|
20
|
+
throw new Error('reviewSubmission 목록 응답에 data 배열이 없어. 제출을 중단했어.');
|
|
21
|
+
}
|
|
22
|
+
const submissions = data.data;
|
|
24
23
|
let reusable = null;
|
|
25
24
|
let staleSubmission = null;
|
|
26
25
|
let hasUnrelatedItems = false;
|
|
@@ -64,7 +63,7 @@ async function getReviewSubmissionItems(submissionId) {
|
|
|
64
63
|
if (data?.links?.next) {
|
|
65
64
|
throw new Error(`reviewSubmission ${submissionId} 항목이 여러 페이지야. 전체 항목을 확인할 수 없어 제출을 중단했어.`);
|
|
66
65
|
}
|
|
67
|
-
return { items:
|
|
66
|
+
return { items: data.data, included: data.included ?? [] };
|
|
68
67
|
}
|
|
69
68
|
/**
|
|
70
69
|
* submit_for_review dry-run 프리뷰 — 비가역 제출 직전 사용자 확인용.
|
|
@@ -307,7 +306,10 @@ async function findDraftReviewSubmission(appId, platform) {
|
|
|
307
306
|
if (data?.links?.next) {
|
|
308
307
|
throw new Error('심사 초안 목록이 여러 페이지야. 안전한 빈 초안을 확인할 수 없어 제출을 중단했어.');
|
|
309
308
|
}
|
|
310
|
-
|
|
309
|
+
if (!Array.isArray(data?.data)) {
|
|
310
|
+
throw new Error('심사 초안 목록 응답에 data 배열이 없어. 제출을 중단했어.');
|
|
311
|
+
}
|
|
312
|
+
const drafts = data.data;
|
|
311
313
|
for (const draft of drafts) {
|
|
312
314
|
const { items } = await getReviewSubmissionItems(draft.id);
|
|
313
315
|
if (items.length === 0 && !draft.relationships?.appStoreVersionForReview?.data?.id)
|
|
@@ -323,7 +325,7 @@ export async function listReviewSubmissions(args) {
|
|
|
323
325
|
'filter[platform]': platform,
|
|
324
326
|
'limit': String(limit),
|
|
325
327
|
});
|
|
326
|
-
const submissions =
|
|
328
|
+
const submissions = data?.data ?? [];
|
|
327
329
|
const result = [];
|
|
328
330
|
for (const sub of submissions) {
|
|
329
331
|
// 버전만 include 하면 IAP·구독·구독그룹 항목이 전부 "?" 로 남아, 정작 중요한
|
|
@@ -412,11 +414,11 @@ async function releaseVersionFromStaleSubmissions(appId, platform, versionId) {
|
|
|
412
414
|
'filter[state]': 'UNRESOLVED_ISSUES',
|
|
413
415
|
'limit': '5',
|
|
414
416
|
}).catch(() => null);
|
|
415
|
-
const stale =
|
|
417
|
+
const stale = data?.data ?? [];
|
|
416
418
|
let released = 0;
|
|
417
419
|
for (const sub of stale) {
|
|
418
420
|
const items = await apiGet(`/reviewSubmissions/${encodePathSegment(sub.id)}/items`, { limit: '50' }).catch(() => null);
|
|
419
|
-
const rows =
|
|
421
|
+
const rows = items?.data ?? [];
|
|
420
422
|
for (const row of rows) {
|
|
421
423
|
if (row?.relationships?.appStoreVersion?.data?.id !== versionId)
|
|
422
424
|
continue;
|
|
@@ -9,6 +9,7 @@ export declare function listScreenshotSets(localizationId: string): Promise<{
|
|
|
9
9
|
imageAsset: unknown;
|
|
10
10
|
}[];
|
|
11
11
|
}[]>;
|
|
12
|
+
export declare function checkLegacyScreenshotReadiness(localizationId: string): Promise<'ready' | 'missing' | 'not-ready' | 'unknown'>;
|
|
12
13
|
export declare function uploadScreenshot(localizationId: string, displayType: string, filePath: string): Promise<{
|
|
13
14
|
id: string;
|
|
14
15
|
fileName: string;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { getAuthHeaders } from './auth.js';
|
|
2
|
+
import { apiGet } from './client.js';
|
|
3
|
+
import { z } from 'zod';
|
|
2
4
|
import fs from 'node:fs';
|
|
3
5
|
import path from 'node:path';
|
|
4
6
|
import crypto from 'node:crypto';
|
|
@@ -42,11 +44,15 @@ async function req(pathOrUrl, init = {}) {
|
|
|
42
44
|
const text = await res.text();
|
|
43
45
|
return (text ? JSON.parse(text) : null);
|
|
44
46
|
}
|
|
47
|
+
function fetchScreenshotSets(localizationId, includeImageMetadata) {
|
|
48
|
+
return apiGet(`/appStoreVersionLocalizations/${encodePathSegment(localizationId)}/appScreenshotSets`, {
|
|
49
|
+
include: 'appScreenshots',
|
|
50
|
+
'fields[appScreenshotSets]': 'screenshotDisplayType,appScreenshots',
|
|
51
|
+
'fields[appScreenshots]': includeImageMetadata ? 'fileName,fileSize,assetDeliveryState,imageAsset' : 'assetDeliveryState',
|
|
52
|
+
});
|
|
53
|
+
}
|
|
45
54
|
export async function listScreenshotSets(localizationId) {
|
|
46
|
-
const data = await
|
|
47
|
-
`?include=appScreenshots` +
|
|
48
|
-
`&fields[appScreenshotSets]=screenshotDisplayType,appScreenshots` +
|
|
49
|
-
`&fields[appScreenshots]=fileName,fileSize,assetDeliveryState,imageAsset`);
|
|
55
|
+
const data = await fetchScreenshotSets(localizationId, true);
|
|
50
56
|
const included = data?.included ?? [];
|
|
51
57
|
return (data?.data ?? []).map((s) => ({
|
|
52
58
|
id: s.id,
|
|
@@ -63,6 +69,56 @@ export async function listScreenshotSets(localizationId) {
|
|
|
63
69
|
}),
|
|
64
70
|
}));
|
|
65
71
|
}
|
|
72
|
+
const pagingFields = {
|
|
73
|
+
links: z.object({ next: z.string().nullish() }).nullish(),
|
|
74
|
+
meta: z.object({ paging: z.object({
|
|
75
|
+
total: z.number().int().nonnegative().optional(),
|
|
76
|
+
nextCursor: z.string().nullish(),
|
|
77
|
+
}).optional() }).nullish(),
|
|
78
|
+
};
|
|
79
|
+
const legacyScreenshotRef = z.object({ type: z.literal('appScreenshots'), id: z.string().min(1) });
|
|
80
|
+
const legacyScreenshotSets = z.object({
|
|
81
|
+
...pagingFields,
|
|
82
|
+
data: z.array(z.object({
|
|
83
|
+
relationships: z.object({
|
|
84
|
+
appScreenshots: z.object({ ...pagingFields, data: z.array(legacyScreenshotRef) }).nullish(),
|
|
85
|
+
}).nullish(),
|
|
86
|
+
})),
|
|
87
|
+
included: z.array(legacyScreenshotRef.extend({
|
|
88
|
+
attributes: z.object({
|
|
89
|
+
assetDeliveryState: z.object({ state: z.string().nullish() }).nullish(),
|
|
90
|
+
}).nullish(),
|
|
91
|
+
})).nullish(),
|
|
92
|
+
});
|
|
93
|
+
function hasMoreScreenshots(page, count) {
|
|
94
|
+
return Boolean(page.links?.next || page.meta?.paging?.nextCursor) || (page.meta?.paging?.total ?? 0) > count;
|
|
95
|
+
}
|
|
96
|
+
export async function checkLegacyScreenshotReadiness(localizationId) {
|
|
97
|
+
const result = legacyScreenshotSets.safeParse(await fetchScreenshotSets(localizationId, false));
|
|
98
|
+
if (!result.success)
|
|
99
|
+
return 'unknown';
|
|
100
|
+
const { data, included } = result.data;
|
|
101
|
+
const states = new Map((included ?? []).map((asset) => [asset.id, asset.attributes?.assetDeliveryState?.state]));
|
|
102
|
+
let hasScreenshot = false;
|
|
103
|
+
let incomplete = hasMoreScreenshots(result.data, data.length);
|
|
104
|
+
for (const set of data) {
|
|
105
|
+
const relationship = set.relationships?.appScreenshots;
|
|
106
|
+
if (!relationship) {
|
|
107
|
+
incomplete = true;
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
incomplete ||= hasMoreScreenshots(relationship, relationship.data.length);
|
|
111
|
+
for (const screenshot of relationship.data) {
|
|
112
|
+
const state = states.get(screenshot.id);
|
|
113
|
+
if (state === 'COMPLETE')
|
|
114
|
+
return 'ready';
|
|
115
|
+
hasScreenshot = true;
|
|
116
|
+
if (state !== 'AWAITING_UPLOAD' && state !== 'UPLOAD_COMPLETE' && state !== 'FAILED')
|
|
117
|
+
incomplete = true;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return incomplete ? 'unknown' : hasScreenshot ? 'not-ready' : 'missing';
|
|
121
|
+
}
|
|
66
122
|
// ─── 셋 확보 (존재하면 재사용, 없으면 생성) ───
|
|
67
123
|
async function ensureScreenshotSet(localizationId, displayType) {
|
|
68
124
|
const existing = await listScreenshotSets(localizationId);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface UploadOperation {
|
|
2
|
+
method: string;
|
|
3
|
+
url: string;
|
|
4
|
+
length: number;
|
|
5
|
+
offset: number;
|
|
6
|
+
requestHeaders: Array<{
|
|
7
|
+
name: string;
|
|
8
|
+
value: string;
|
|
9
|
+
}>;
|
|
10
|
+
}
|
|
11
|
+
export declare function uploadFileParts(absPath: string, ops: readonly UploadOperation[], redirect?: RequestRedirect): Promise<void>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import { fetchWithTimeout, HTTP_TRANSFER_TIMEOUT_MS } from '../lib/http.js';
|
|
3
|
+
export async function uploadFileParts(absPath, ops, redirect) {
|
|
4
|
+
const fd = fs.openSync(absPath, 'r');
|
|
5
|
+
try {
|
|
6
|
+
for (const op of ops) {
|
|
7
|
+
// 파일 전체를 메모리에 올리지 않는다 — 동영상은 수백 MB 가 될 수 있다.
|
|
8
|
+
const chunk = Buffer.alloc(op.length);
|
|
9
|
+
const bytesRead = fs.readSync(fd, chunk, 0, op.length, op.offset);
|
|
10
|
+
// Buffer.alloc 은 0 으로 채운다 — 짧게 읽힌 걸 모르고 보내면 **0 패딩이 영상 데이터로**
|
|
11
|
+
// 올라가고, PUT 은 성공한 뒤 체크섬 불일치가 한참 뒤 인코딩 실패로 나타난다.
|
|
12
|
+
// 여기서 즉시 멈추는 게 그 추적 불가능한 실패보다 낫다.
|
|
13
|
+
if (bytesRead !== op.length) {
|
|
14
|
+
throw new Error(`파일을 읽는 중 크기가 어긋났다 (offset ${op.offset}: ${op.length} 바이트 요청, ${bytesRead} 읽음). ` +
|
|
15
|
+
'업로드 도중 파일이 바뀌었을 수 있다 — 파일을 확인하고 다시 시도할 것.');
|
|
16
|
+
}
|
|
17
|
+
const headers = {};
|
|
18
|
+
for (const h of op.requestHeaders ?? [])
|
|
19
|
+
headers[h.name] = h.value;
|
|
20
|
+
const res = await fetchWithTimeout(op.url, { method: op.method ?? 'PUT', headers, body: chunk, redirect }, HTTP_TRANSFER_TIMEOUT_MS);
|
|
21
|
+
if (!res.ok) {
|
|
22
|
+
throw new Error(`미디어 업로드 실패 (offset ${op.offset}): ${res.status} ${await res.text()}`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
finally {
|
|
27
|
+
fs.closeSync(fd);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
export declare function listVersions(appId: string
|
|
1
|
+
export declare function listVersions(appId: string, filters?: {
|
|
2
|
+
versionString?: string;
|
|
3
|
+
platform?: ApplePlatform;
|
|
4
|
+
}): Promise<{
|
|
2
5
|
id: string;
|
|
3
6
|
version: string | undefined;
|
|
7
|
+
platform: ApplePlatform | undefined;
|
|
4
8
|
state: string | undefined;
|
|
5
9
|
releaseType: string | undefined;
|
|
6
10
|
createdDate: string | undefined;
|
|
@@ -3,14 +3,17 @@
|
|
|
3
3
|
import { apiGet, apiPatch, apiPost } from './client.js';
|
|
4
4
|
import { encodePathSegment } from '../lib/url-path.js';
|
|
5
5
|
// ─── 버전 ───
|
|
6
|
-
export async function listVersions(appId) {
|
|
7
|
-
const data =
|
|
8
|
-
'fields[appStoreVersions]': 'versionString,appStoreState,releaseType,createdDate',
|
|
6
|
+
export async function listVersions(appId, filters = {}) {
|
|
7
|
+
const data = await apiGet(`/apps/${encodePathSegment(appId)}/appStoreVersions`, {
|
|
8
|
+
'fields[appStoreVersions]': 'versionString,platform,appStoreState,releaseType,createdDate',
|
|
9
9
|
'limit': '10',
|
|
10
|
-
|
|
10
|
+
...(filters.versionString ? { 'filter[versionString]': filters.versionString } : {}),
|
|
11
|
+
...(filters.platform ? { 'filter[platform]': filters.platform } : {}),
|
|
12
|
+
});
|
|
11
13
|
return (data.data ?? []).map((v) => ({
|
|
12
14
|
id: v.id,
|
|
13
15
|
version: v.attributes?.versionString,
|
|
16
|
+
platform: v.attributes?.platform,
|
|
14
17
|
state: v.attributes?.appStoreState,
|
|
15
18
|
releaseType: v.attributes?.releaseType,
|
|
16
19
|
createdDate: v.attributes?.createdDate,
|
|
@@ -130,9 +133,9 @@ export async function attachLatestValidBuild(versionId, opts) {
|
|
|
130
133
|
}
|
|
131
134
|
// ─── 로컬라이제이션 (메타데이터) ───
|
|
132
135
|
export async function getVersionLocalizations(versionId) {
|
|
133
|
-
const data =
|
|
136
|
+
const data = await apiGet(`/appStoreVersions/${encodePathSegment(versionId)}/appStoreVersionLocalizations`, {
|
|
134
137
|
'fields[appStoreVersionLocalizations]': 'locale,description,keywords,promotionalText,whatsNew',
|
|
135
|
-
})
|
|
138
|
+
});
|
|
136
139
|
return (data.data ?? []).map((l) => ({
|
|
137
140
|
id: l.id,
|
|
138
141
|
locale: l.attributes?.locale,
|
|
@@ -235,12 +238,12 @@ export async function getReviewNotes(versionId) {
|
|
|
235
238
|
}
|
|
236
239
|
// ─── 빌드 ───
|
|
237
240
|
export async function listBuilds(appId) {
|
|
238
|
-
const data =
|
|
241
|
+
const data = await apiGet('/builds', {
|
|
239
242
|
'filter[app]': appId,
|
|
240
243
|
'fields[builds]': 'version,uploadedDate,processingState,buildAudienceType',
|
|
241
244
|
'sort': '-uploadedDate',
|
|
242
245
|
'limit': '10',
|
|
243
|
-
})
|
|
246
|
+
});
|
|
244
247
|
return (data.data ?? []).map((b) => ({
|
|
245
248
|
id: b.id,
|
|
246
249
|
version: b.attributes?.version,
|
|
@@ -250,14 +253,13 @@ export async function listBuilds(appId) {
|
|
|
250
253
|
}
|
|
251
254
|
// ─── 버전 → 앱/플랫폼 역조회 (빌드 연결·심사 제출이 공유) ───
|
|
252
255
|
export async function getVersionAppAndPlatform(versionId) {
|
|
253
|
-
const data =
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
if (!platform || !appId) {
|
|
256
|
+
const data = await apiGet(`/appStoreVersions/${encodePathSegment(versionId)}`, { 'fields[appStoreVersions]': 'platform,app', include: 'app' });
|
|
257
|
+
const version = data?.data;
|
|
258
|
+
const platform = version?.attributes?.platform;
|
|
259
|
+
const app = version?.relationships?.app?.data;
|
|
260
|
+
if (version?.id !== versionId || version.type !== 'appStoreVersions' || app?.type !== 'apps'
|
|
261
|
+
|| typeof app.id !== 'string' || !app.id || typeof platform !== 'string' || !platform) {
|
|
260
262
|
throw new Error(`appStoreVersion ${versionId}에서 app 또는 platform을 찾지 못했어. 버전 ID 확인 필요.`);
|
|
261
263
|
}
|
|
262
|
-
return { appId, platform };
|
|
264
|
+
return { appId: app.id, platform };
|
|
263
265
|
}
|