@yoonion/mimi-seed-mcp 0.23.4 → 0.25.0
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/dist/admob/cli.js +34 -5
- package/dist/admob/errors.js +39 -14
- package/dist/ai/client.js +35 -14
- package/dist/ai/notes.js +14 -3
- package/dist/ai/review.js +17 -4
- package/dist/android/keystore-store.js +28 -8
- package/dist/android/keystore.d.ts +17 -2
- package/dist/android/keystore.js +110 -21
- package/dist/android/messages.d.ts +13 -11
- package/dist/android/messages.js +166 -72
- package/dist/android/playstore-sa.js +6 -3
- package/dist/appstore/analytics.js +46 -14
- package/dist/appstore/app-info-policy.js +7 -1
- package/dist/appstore/app-info.js +13 -3
- package/dist/appstore/apps.js +7 -1
- package/dist/appstore/asset-library-write.js +119 -37
- package/dist/appstore/asset-library.js +19 -5
- package/dist/appstore/auth.d.ts +2 -0
- package/dist/appstore/auth.js +31 -5
- package/dist/appstore/client.js +27 -6
- package/dist/appstore/declarations.js +22 -6
- package/dist/appstore/errors.d.ts +1 -1
- package/dist/appstore/errors.js +60 -34
- package/dist/appstore/http.d.ts +6 -0
- package/dist/appstore/http.js +22 -5
- package/dist/appstore/messages.js +86 -28
- package/dist/appstore/previews.js +22 -6
- package/dist/appstore/product-localization.js +10 -2
- package/dist/appstore/product-review.js +29 -10
- package/dist/appstore/products.js +20 -6
- package/dist/appstore/read-response.js +13 -3
- package/dist/appstore/release-target.js +13 -3
- package/dist/appstore/release.js +59 -22
- package/dist/appstore/review-preview.js +17 -6
- package/dist/appstore/review-submission.js +86 -35
- package/dist/appstore/sales.js +96 -44
- package/dist/appstore/screenshots.js +19 -5
- package/dist/appstore/testflight.js +41 -18
- package/dist/appstore/upload-parts.js +12 -3
- package/dist/appstore/versions.js +22 -10
- package/dist/auth/bigquery-auth.js +44 -15
- package/dist/auth/bigquery-setup-cli.js +1 -1
- package/dist/auth/cli.js +4 -2
- package/dist/auth/constants.js +13 -3
- package/dist/auth/drive-auth.d.ts +3 -2
- package/dist/auth/drive-auth.js +47 -17
- package/dist/auth/drive-setup-cli.js +1 -0
- package/dist/auth/errors.d.ts +75 -0
- package/dist/auth/errors.js +190 -86
- package/dist/auth/google-auth.d.ts +3 -1
- package/dist/auth/google-auth.js +39 -27
- package/dist/auth/playstore-auth.d.ts +1 -0
- package/dist/auth/playstore-auth.js +35 -15
- package/dist/auth/scopes.d.ts +18 -28
- package/dist/auth/scopes.js +53 -14
- package/dist/auth/youtube-channel.d.ts +8 -0
- package/dist/auth/youtube-channel.js +11 -3
- package/dist/bigquery/ids.js +19 -5
- package/dist/bigquery/tools.js +24 -8
- package/dist/billing/tools.js +22 -6
- package/dist/checks/appstore-submission.d.ts +1 -1
- package/dist/checks/appstore-submission.js +29 -8
- package/dist/checks/plan.js +169 -62
- package/dist/checks/release-status.js +10 -2
- package/dist/checks/risks.js +230 -63
- package/dist/checks/screenshots.d.ts +4 -4
- package/dist/checks/screenshots.js +63 -22
- package/dist/ci/config.js +8 -5
- package/dist/ci/gitlab.js +3 -1
- package/dist/core/atomic-write.d.ts +5 -2
- package/dist/core/atomic-write.js +8 -4
- package/dist/core/catch-scan.d.ts +17 -0
- package/dist/core/catch-scan.js +111 -0
- package/dist/core/checks/billing.d.ts +5 -0
- package/dist/core/checks/billing.js +36 -5
- package/dist/core/checks/lockfile.js +2 -0
- package/dist/core/checks/release-doctor/fcm.js +1 -0
- package/dist/core/checks/release-doctor/files.d.ts +3 -1
- package/dist/core/checks/release-doctor/files.js +12 -1
- package/dist/core/checks/release-doctor/gradle-apply.js +1 -0
- package/dist/core/checks/release-doctor/ios-xcode.js +22 -3
- package/dist/core/checks/release-doctor/target-sdk.js +1 -1
- package/dist/core/checks/release-doctor/util.d.ts +5 -0
- package/dist/core/checks/release-doctor/util.js +56 -0
- package/dist/core/checks/release-doctor.js +59 -16
- package/dist/core/credential-envelope.d.ts +25 -0
- package/dist/core/credential-envelope.js +66 -0
- package/dist/core/credential-keystore.d.ts +37 -0
- package/dist/core/credential-keystore.js +275 -0
- package/dist/core/credential-read.d.ts +33 -0
- package/dist/core/credential-read.js +112 -0
- package/dist/core/credential-store.d.ts +61 -0
- package/dist/core/credential-store.js +240 -0
- package/dist/core/http-errors.js +1 -0
- package/dist/core/i18n-scan.d.ts +10 -0
- package/dist/core/i18n-scan.js +79 -0
- package/dist/core/json-file.d.ts +30 -0
- package/dist/core/json-file.js +53 -0
- package/dist/core/lang.d.ts +14 -0
- package/dist/core/lang.js +22 -2
- package/dist/core/project-manifest.d.ts +24 -1
- package/dist/core/project-manifest.js +27 -16
- package/dist/drive/tools.js +86 -34
- package/dist/facebook/api.js +3 -1
- package/dist/facebook/config.js +11 -3
- package/dist/facebook/setup.d.ts +2 -0
- package/dist/facebook/setup.js +32 -9
- package/dist/firebase/cli.js +39 -5
- package/dist/firebase/tools.js +36 -10
- package/dist/ga4/cli.js +48 -4
- package/dist/ga4/tools.js +4 -2
- package/dist/googleads/config.js +24 -8
- package/dist/googleads/tools.js +3 -1
- package/dist/gsc/tools.d.ts +116 -9
- package/dist/gsc/tools.js +101 -17
- package/dist/helpers.d.ts +4 -2
- package/dist/helpers.js +82 -44
- package/dist/i18n/manifest-en.d.ts +6 -0
- package/dist/i18n/manifest-en.js +53 -0
- package/dist/i18n/tools-en/admob.d.ts +25 -0
- package/dist/i18n/tools-en/admob.js +24 -0
- package/dist/i18n/tools-en/ai.d.ts +14 -0
- package/dist/i18n/tools-en/ai.js +13 -0
- package/dist/i18n/tools-en/android.d.ts +14 -0
- package/dist/i18n/tools-en/android.js +13 -0
- package/dist/i18n/tools-en/appstore.d.ts +240 -0
- package/dist/i18n/tools-en/appstore.js +239 -0
- package/dist/i18n/tools-en/auth.d.ts +16 -0
- package/dist/i18n/tools-en/auth.js +15 -0
- package/dist/i18n/tools-en/bigquery.d.ts +16 -0
- package/dist/i18n/tools-en/bigquery.js +15 -0
- package/dist/i18n/tools-en/billing.d.ts +17 -0
- package/dist/i18n/tools-en/billing.js +16 -0
- package/dist/i18n/tools-en/checks.d.ts +23 -0
- package/dist/i18n/tools-en/checks.js +22 -0
- package/dist/i18n/tools-en/ci.d.ts +21 -0
- package/dist/i18n/tools-en/ci.js +20 -0
- package/dist/i18n/tools-en/drive.d.ts +33 -0
- package/dist/i18n/tools-en/drive.js +32 -0
- package/dist/i18n/tools-en/facebook.d.ts +14 -0
- package/dist/i18n/tools-en/facebook.js +13 -0
- package/dist/i18n/tools-en/firebase.d.ts +42 -0
- package/dist/i18n/tools-en/firebase.js +41 -0
- package/dist/i18n/tools-en/ga4.d.ts +35 -0
- package/dist/i18n/tools-en/ga4.js +34 -0
- package/dist/i18n/tools-en/googleads.d.ts +15 -0
- package/dist/i18n/tools-en/googleads.js +14 -0
- package/dist/i18n/tools-en/gsc.d.ts +27 -0
- package/dist/i18n/tools-en/gsc.js +26 -0
- package/dist/i18n/tools-en/iam.d.ts +15 -0
- package/dist/i18n/tools-en/iam.js +14 -0
- package/dist/i18n/tools-en/index.d.ts +7 -0
- package/dist/i18n/tools-en/index.js +58 -0
- package/dist/i18n/tools-en/instagram.d.ts +16 -0
- package/dist/i18n/tools-en/instagram.js +15 -0
- package/dist/i18n/tools-en/jenkins.d.ts +41 -0
- package/dist/i18n/tools-en/jenkins.js +40 -0
- package/dist/i18n/tools-en/naver.d.ts +10 -0
- package/dist/i18n/tools-en/naver.js +9 -0
- package/dist/i18n/tools-en/playstore.d.ts +148 -0
- package/dist/i18n/tools-en/playstore.js +147 -0
- package/dist/i18n/tools-en/registrar.d.ts +6 -0
- package/dist/i18n/tools-en/registrar.js +6 -0
- package/dist/i18n/tools-en/threads.d.ts +21 -0
- package/dist/i18n/tools-en/threads.js +20 -0
- package/dist/i18n/tools-en/tiktok.d.ts +21 -0
- package/dist/i18n/tools-en/tiktok.js +20 -0
- package/dist/i18n/tools-en/video.d.ts +59 -0
- package/dist/i18n/tools-en/video.js +58 -0
- package/dist/i18n/tools-en/youtube.d.ts +44 -0
- package/dist/i18n/tools-en/youtube.js +43 -0
- package/dist/iam/key-files.js +13 -3
- package/dist/instagram/api.js +19 -5
- package/dist/instagram/config.js +11 -3
- package/dist/instagram/setup.js +37 -11
- package/dist/jenkins/builds.d.ts +2 -2
- package/dist/jenkins/builds.js +70 -30
- package/dist/jenkins/config.d.ts +5 -0
- package/dist/jenkins/config.js +25 -6
- package/dist/jenkins/credentials.js +33 -13
- package/dist/jenkins/http.js +6 -3
- package/dist/jenkins/jobs.js +19 -5
- package/dist/jenkins/messages.js +93 -36
- package/dist/lib/cli-args.js +13 -7
- package/dist/lib/google-errors.js +31 -9
- package/dist/lib/http.js +10 -3
- package/dist/lib/json-file.d.ts +15 -0
- package/dist/lib/json-file.js +65 -0
- package/dist/lib/meta-auth.d.ts +1 -1
- package/dist/lib/meta-auth.js +26 -8
- package/dist/lib/package-name.js +15 -4
- package/dist/lib/package-root.js +1 -1
- package/dist/lib/paginate.js +10 -2
- package/dist/lib/path-containment.js +22 -6
- package/dist/lib/resource-id.js +10 -3
- package/dist/lib/store-create-result.js +54 -13
- package/dist/lib/text-validators.js +20 -5
- package/dist/lib/tool-registrar.d.ts +9 -0
- package/dist/lib/tool-registrar.js +33 -14
- package/dist/lib/tool-text.d.ts +31 -0
- package/dist/lib/tool-text.js +52 -0
- package/dist/lib/toolsets.js +13 -3
- package/dist/lib/url-path.js +3 -1
- package/dist/naver/tools.js +138 -46
- package/dist/playstore/data-safety.js +16 -4
- package/dist/playstore/errors.js +33 -8
- package/dist/playstore/financials.js +83 -35
- package/dist/playstore/listing.js +7 -1
- package/dist/playstore/messages.js +179 -57
- package/dist/playstore/products.js +10 -2
- package/dist/playstore/recovery.js +10 -2
- package/dist/playstore/releases.js +34 -14
- package/dist/playstore/reviews.js +14 -4
- package/dist/playstore/statistics.js +3 -1
- package/dist/prompts.js +160 -50
- package/dist/registers/admob.js +36 -11
- package/dist/registers/android.js +25 -9
- package/dist/registers/appstore/apps.js +22 -6
- package/dist/registers/appstore/customer-reviews.js +7 -1
- package/dist/registers/appstore/declarations.js +63 -19
- package/dist/registers/appstore/media.js +76 -24
- package/dist/registers/appstore/metadata.js +26 -8
- package/dist/registers/appstore/products.js +53 -19
- package/dist/registers/appstore/review-submission.js +31 -9
- package/dist/registers/appstore/testflight.js +82 -24
- package/dist/registers/appstore/versions.js +88 -30
- package/dist/registers/auth.js +343 -90
- package/dist/registers/bigquery.js +54 -14
- package/dist/registers/billing.js +18 -4
- package/dist/registers/checks.js +20 -5
- package/dist/registers/ci.js +60 -20
- package/dist/registers/drive.js +18 -7
- package/dist/registers/facebook.js +31 -9
- package/dist/registers/firebase.js +21 -7
- package/dist/registers/googleads.js +23 -6
- package/dist/registers/gsc.js +42 -39
- package/dist/registers/iam.js +44 -13
- package/dist/registers/instagram.js +19 -5
- package/dist/registers/jenkins.js +43 -14
- package/dist/registers/naver.js +13 -3
- package/dist/registers/playstore/financials.d.ts +6 -0
- package/dist/registers/playstore/financials.js +48 -0
- package/dist/registers/playstore/listing.d.ts +15 -0
- package/dist/registers/playstore/listing.js +138 -0
- package/dist/registers/playstore/media.d.ts +6 -0
- package/dist/registers/playstore/media.js +56 -0
- package/dist/registers/playstore/products.d.ts +21 -0
- package/dist/registers/playstore/products.js +238 -0
- package/dist/registers/playstore/recovery.d.ts +11 -0
- package/dist/registers/playstore/recovery.js +105 -0
- package/dist/registers/playstore/releases.d.ts +8 -0
- package/dist/registers/playstore/releases.js +157 -0
- package/dist/registers/playstore/reviews.d.ts +6 -0
- package/dist/registers/playstore/reviews.js +43 -0
- package/dist/registers/playstore/service-accounts.d.ts +13 -0
- package/dist/registers/playstore/service-accounts.js +127 -0
- package/dist/registers/playstore/shared.d.ts +12 -0
- package/dist/registers/playstore/shared.js +24 -0
- package/dist/registers/playstore.d.ts +8 -0
- package/dist/registers/playstore.js +28 -734
- package/dist/registers/threads.js +28 -8
- package/dist/registers/tiktok.js +4 -2
- package/dist/registers/video.js +3 -1
- package/dist/remote-sync.js +80 -28
- package/dist/resources.d.ts +0 -8
- package/dist/resources.js +73 -32
- package/dist/server.d.ts +2 -0
- package/dist/server.js +9 -1
- package/dist/social/profile-store.js +36 -12
- package/dist/social/setup-cli.js +1 -1
- package/dist/threads/api.js +23 -6
- package/dist/threads/setup.js +42 -14
- package/dist/tiktok-business/api.js +13 -3
- package/dist/tiktok-business/auth.js +10 -2
- package/dist/tiktok-business/config.js +8 -3
- package/dist/tiktok-business/posting.d.ts +6 -0
- package/dist/tiktok-business/posting.js +118 -36
- package/dist/tiktok-business/setup-cli.js +3 -1
- package/dist/tools-cli.js +4 -5
- package/dist/video/captions.js +3 -1
- package/dist/video/files.js +13 -3
- package/dist/video/project.js +65 -21
- package/dist/video/providers.js +52 -16
- package/dist/video/render.js +71 -22
- package/dist/video/research.js +10 -2
- package/dist/video/schemas.js +19 -5
- package/dist/video/youtube-publish.js +62 -32
- package/package.json +1 -1
package/dist/appstore/errors.js
CHANGED
|
@@ -11,37 +11,59 @@
|
|
|
11
11
|
*
|
|
12
12
|
* 비표준 body (HTML, plain text, 빈 응답 등) 는 폴백으로 원본 보존.
|
|
13
13
|
*/
|
|
14
|
+
import { catalog } from '#core/lang.js';
|
|
15
|
+
/** 코드로 찾아보는 표 — 키를 string 으로 넓혀 둔다. */
|
|
16
|
+
const hintTable = (hints) => hints;
|
|
14
17
|
/** Apple 에러 코드 → 친절한 hint (실측 거부 사례 기반). */
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
18
|
+
const M = catalog({
|
|
19
|
+
hints: hintTable({
|
|
20
|
+
// What's New / localization 텍스트 검증 실패
|
|
21
|
+
INVALID_CHARACTERS: 'HTML 태그·금지 문자가 포함됐어요. 제출 전 lib/text-validators.ts 로 사전 검증 권장.',
|
|
22
|
+
// 버전 상태가 편집 불가 (READY_FOR_SALE / WAITING_FOR_REVIEW 등)
|
|
23
|
+
ENTITY_STATE_INVALID: '버전 상태가 편집 가능 단계가 아니에요 (이미 심사중/출시됨). 새 versionString 으로 appstore_create_version 필요할 수 있어요.',
|
|
24
|
+
// 필수 필드 누락
|
|
25
|
+
// ⚠️ Apple 이 실제로 보내는 코드는 점 표기다 (ENTITY_ERROR.ATTRIBUTE.REQUIRED).
|
|
26
|
+
// 아래 언더스코어 키들은 오래 매칭된 적이 없었다 — 점 표기를 정본으로 두고
|
|
27
|
+
// 언더스코어 변형은 혹시 모를 옛 응답용으로 남긴다 (2026-07-21 실측으로 발견).
|
|
28
|
+
'ENTITY_ERROR.ATTRIBUTE.REQUIRED': '필수 필드가 빠졌어요 — source.pointer 위치 확인.',
|
|
29
|
+
ENTITY_ERROR_ATTRIBUTE_REQUIRED: '필수 필드가 빠졌어요 — source.pointer 위치 확인.',
|
|
30
|
+
// 길이 초과 — detail 에 실제 상한이 숫자로 들어온다 ("Max number of characters is (55)").
|
|
31
|
+
'ENTITY_ERROR.ATTRIBUTE.INVALID.TOO_LONG': '길이 초과 — detail 의 괄호 숫자가 Apple 이 강제하는 실제 상한이에요. 그 값에 맞춰 줄이세요.',
|
|
32
|
+
// 심사 중이라 필드가 잠김. 상품이 WAITING_FOR_REVIEW/IN_REVIEW 면 현지화를 못 고친다.
|
|
33
|
+
'ENTITY_ERROR.ATTRIBUTE.INVALID.UNMODIFIABLE': '지금 상태에선 못 고치는 필드예요 — 상품이 심사 중이면 현지화가 잠깁니다. '
|
|
34
|
+
+ '심사 결과를 기다리거나 appstore_cancel_review 로 철회한 뒤 수정하세요.',
|
|
35
|
+
'ENTITY_ERROR.ATTRIBUTE.INVALID': '필드 값이 정책 위반(길이/형식). source.pointer 위치 확인.',
|
|
36
|
+
ENTITY_ERROR_ATTRIBUTE_INVALID: '필드 값이 정책 위반(길이/형식). source.pointer 위치 확인.',
|
|
37
|
+
// 빌드 attach 시 빌드를 못 찾음
|
|
38
|
+
NOT_FOUND: '대상 리소스를 찾을 수 없어요 — id/versionId/buildId 가 유효한지, 동일 앱 소속인지 확인.',
|
|
39
|
+
// 권한 부족 (API Key role 문제)
|
|
40
|
+
FORBIDDEN_ERROR: 'API Key 권한 부족 — App Store Connect > Users and Access 에서 키 role 확인.',
|
|
41
|
+
// 상태 전이 거부. cancel 은 WAITING_FOR_REVIEW 까지 되고, IN_REVIEW 이후만 막힌다.
|
|
42
|
+
// (예전 문구는 "큐 진입 후라 불가"였는데, 그건 cancel 이 submitted:false 를 보내
|
|
43
|
+
// 항상 실패하던 버그의 증상을 상태 탓으로 오해한 것이었다 — 2026-07-25 정정.)
|
|
44
|
+
STATE_ERROR: '현재 상태에서 허용되지 않는 작업. 제출된 묶음은 항목 제거(removed)가 막히니 '
|
|
45
|
+
+ 'appstore_cancel_review 로 묶음째 취소하세요. IN_REVIEW 이후면 그마저도 불가 — 심사 결과를 기다립니다.',
|
|
46
|
+
// JWT 거부 — 잘못된 자격증명
|
|
47
|
+
NOT_AUTHORIZED: 'API 키가 거부됐어요 — issuerId/keyId/.p8 조합 불일치 가능. appstore_verify_credentials 로 진단하고 mimi-seed auth appstore 로 재등록.',
|
|
48
|
+
}),
|
|
49
|
+
}, {
|
|
50
|
+
hints: hintTable({
|
|
51
|
+
INVALID_CHARACTERS: 'Contains HTML tags or forbidden characters. Pre-validate with lib/text-validators.ts before submitting.',
|
|
52
|
+
ENTITY_STATE_INVALID: 'The version state is not editable (already in review/released). You may need appstore_create_version with a new versionString.',
|
|
53
|
+
'ENTITY_ERROR.ATTRIBUTE.REQUIRED': 'A required field is missing — check the source.pointer location.',
|
|
54
|
+
ENTITY_ERROR_ATTRIBUTE_REQUIRED: 'A required field is missing — check the source.pointer location.',
|
|
55
|
+
'ENTITY_ERROR.ATTRIBUTE.INVALID.TOO_LONG': 'Too long — the number in parentheses in detail is the actual limit Apple enforces. Shorten the value to fit it.',
|
|
56
|
+
'ENTITY_ERROR.ATTRIBUTE.INVALID.UNMODIFIABLE': 'This field cannot be changed in the current state — localizations are locked while the product is in review. '
|
|
57
|
+
+ 'Wait for the review result, or withdraw it with appstore_cancel_review, then edit.',
|
|
58
|
+
'ENTITY_ERROR.ATTRIBUTE.INVALID': 'The field value violates a policy (length/format). Check the source.pointer location.',
|
|
59
|
+
ENTITY_ERROR_ATTRIBUTE_INVALID: 'The field value violates a policy (length/format). Check the source.pointer location.',
|
|
60
|
+
NOT_FOUND: 'Target resource not found — check that id/versionId/buildId is valid and belongs to the same app.',
|
|
61
|
+
FORBIDDEN_ERROR: 'Insufficient API Key permissions — check the key role in App Store Connect > Users and Access.',
|
|
62
|
+
STATE_ERROR: 'Operation not allowed in the current state. Items cannot be removed from a submitted batch, so '
|
|
63
|
+
+ 'cancel the whole batch with appstore_cancel_review. After IN_REVIEW even that is not possible — wait for the review result.',
|
|
64
|
+
NOT_AUTHORIZED: 'The API key was rejected — the issuerId/keyId/.p8 combination may not match. Diagnose with appstore_verify_credentials and re-register with mimi-seed auth appstore.',
|
|
65
|
+
}),
|
|
66
|
+
});
|
|
45
67
|
/** Apple 표준 에러 응답 파싱 시도. 실패하면 null 반환. */
|
|
46
68
|
function parseAppleErrorBody(body) {
|
|
47
69
|
if (!body)
|
|
@@ -54,6 +76,7 @@ function parseAppleErrorBody(body) {
|
|
|
54
76
|
return null;
|
|
55
77
|
}
|
|
56
78
|
catch {
|
|
79
|
+
// JSON 이 아닌 본문(게이트웨이 HTML 등)은 Apple 형식이 아닐 뿐 — 호출자가 상태 코드와 본문 그대로 안내한다
|
|
57
80
|
return null;
|
|
58
81
|
}
|
|
59
82
|
}
|
|
@@ -65,11 +88,12 @@ function parseAppleErrorBody(body) {
|
|
|
65
88
|
function resolveHint(code) {
|
|
66
89
|
if (!code)
|
|
67
90
|
return undefined;
|
|
68
|
-
|
|
69
|
-
|
|
91
|
+
const hints = M().hints;
|
|
92
|
+
if (hints[code])
|
|
93
|
+
return hints[code];
|
|
70
94
|
const parts = code.split('.');
|
|
71
95
|
for (let i = parts.length - 1; i > 0; i -= 1) {
|
|
72
|
-
const hint =
|
|
96
|
+
const hint = hints[parts.slice(0, i).join('.')];
|
|
73
97
|
if (hint)
|
|
74
98
|
return hint;
|
|
75
99
|
}
|
|
@@ -114,7 +138,9 @@ export function friendlyAppStoreError(status, body) {
|
|
|
114
138
|
}
|
|
115
139
|
// ── 테스트용 export ────────────────────────────────────────────
|
|
116
140
|
export const __testing = {
|
|
117
|
-
CODE_HINTS
|
|
141
|
+
get CODE_HINTS() {
|
|
142
|
+
return M().hints;
|
|
143
|
+
},
|
|
118
144
|
parseAppleErrorBody,
|
|
119
145
|
formatAppleError,
|
|
120
146
|
};
|
package/dist/appstore/http.d.ts
CHANGED
|
@@ -16,3 +16,9 @@ export declare function apiRequest<T>(base: string, resourcePath: string, authHe
|
|
|
16
16
|
* 권한 오류가 조용히 빈 결과로 둔갑한다. 상태를 못 읽는 경우에만 문자열로 폴백한다.
|
|
17
17
|
*/
|
|
18
18
|
export declare function isNotFound(err: unknown): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* App Store 오류에 붙은 실제 HTTP 상태 (`cause.status`). 없으면 undefined.
|
|
21
|
+
*
|
|
22
|
+
* 분기는 이 값으로 한다 — 메시지 문구는 언어(ko/en)에 따라 바뀌므로 판정 근거가 될 수 없다.
|
|
23
|
+
*/
|
|
24
|
+
export declare function appStoreErrorStatus(err: unknown): number | undefined;
|
package/dist/appstore/http.js
CHANGED
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
import { getAuthHeaders } from './auth.js';
|
|
2
2
|
import { friendlyAppStoreError } from './errors.js';
|
|
3
3
|
import { fetchWithTimeout } from '../lib/http.js';
|
|
4
|
+
import { catalog } from '#core/lang.js';
|
|
5
|
+
const M = catalog({
|
|
6
|
+
authNeeded: '❌ App Store Connect 인증이 필요해.',
|
|
7
|
+
runInTerminal: '터미널에서 실행:',
|
|
8
|
+
}, {
|
|
9
|
+
authNeeded: '❌ App Store Connect authentication is required.',
|
|
10
|
+
runInTerminal: 'Run in a terminal:',
|
|
11
|
+
});
|
|
4
12
|
export const V1_BASE = 'https://api.appstoreconnect.apple.com/v1';
|
|
5
13
|
export const V2_BASE = 'https://api.appstoreconnect.apple.com/v2';
|
|
6
14
|
export async function authHeadersOrThrow() {
|
|
7
15
|
const headers = await getAuthHeaders();
|
|
8
16
|
if (!headers) {
|
|
9
17
|
throw new Error([
|
|
10
|
-
|
|
18
|
+
M().authNeeded,
|
|
11
19
|
'',
|
|
12
|
-
|
|
20
|
+
M().runInTerminal,
|
|
13
21
|
' npx -p @yoonion/mimi-seed-mcp mimi-seed-appstore-auth',
|
|
14
22
|
].join('\n'));
|
|
15
23
|
}
|
|
@@ -35,8 +43,17 @@ export async function apiRequest(base, resourcePath, authHeaders, init) {
|
|
|
35
43
|
* 권한 오류가 조용히 빈 결과로 둔갑한다. 상태를 못 읽는 경우에만 문자열로 폴백한다.
|
|
36
44
|
*/
|
|
37
45
|
export function isNotFound(err) {
|
|
38
|
-
const
|
|
39
|
-
if (
|
|
40
|
-
return
|
|
46
|
+
const status = appStoreErrorStatus(err);
|
|
47
|
+
if (status !== undefined)
|
|
48
|
+
return status === 404;
|
|
41
49
|
return /App Store API 404\b/.test(err?.message ?? '');
|
|
42
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* App Store 오류에 붙은 실제 HTTP 상태 (`cause.status`). 없으면 undefined.
|
|
53
|
+
*
|
|
54
|
+
* 분기는 이 값으로 한다 — 메시지 문구는 언어(ko/en)에 따라 바뀌므로 판정 근거가 될 수 없다.
|
|
55
|
+
*/
|
|
56
|
+
export function appStoreErrorStatus(err) {
|
|
57
|
+
const status = err?.cause?.status;
|
|
58
|
+
return typeof status === 'number' ? status : undefined;
|
|
59
|
+
}
|
|
@@ -1,14 +1,74 @@
|
|
|
1
1
|
// App Store 도구의 사람용 응답 문구 — register 는 조회·판단만 하고, 여러 줄짜리 요약·dry-run
|
|
2
2
|
// 미리보기는 여기서 조립한다. 반환값은 완성된 텍스트다.
|
|
3
|
+
import { catalog } from '#core/lang.js';
|
|
4
|
+
const M = catalog({
|
|
5
|
+
submissionsHeader: (n, platform) => `심사 제출 묶음 ${n}건 (${platform})`,
|
|
6
|
+
notSubmitted: '(미제출)',
|
|
7
|
+
itemsNone: ' items: (없음)',
|
|
8
|
+
itemCount: (n) => ` 항목 ${n}개`,
|
|
9
|
+
dryRunHeader: '🛑 심사 제출 dry-run — 아직 실제 제출 안 함.',
|
|
10
|
+
noBuild: ` attachedBuild: ⚠️ 미연결 — appstore_attach_build 필요 (buildId 생략 = 최신 VALID 빌드)`,
|
|
11
|
+
noWhatsNew: ` whatsNew : ⚠️ 등록된 출시 노트 없음`,
|
|
12
|
+
whatsNewLine: (locale, length, excerpt) => ` [${locale}] (${length}자) "${excerpt}"`,
|
|
13
|
+
confirmHint: '실제 제출하려면 같은 versionId 로 `confirm: true` 옵션을 추가해 재호출하세요.',
|
|
14
|
+
cancelWarning: '⚠️ 제출 후엔 cancel_review 가 큐 진입(WAITING_FOR_REVIEW) 시점에 막힐 수 있어요 (실측: 1.4.2→3, 1.4.5→6).',
|
|
15
|
+
version: (v) => `버전 ${v}`,
|
|
16
|
+
unknown: '알 수 없음',
|
|
17
|
+
state: (state, note) => ` 상태: ${state}${note ? ` — ${note}` : ''}`,
|
|
18
|
+
releaseTypeDefault: '(미지정 — Apple 기본값)',
|
|
19
|
+
releaseType: (t) => ` 출시 방식: ${t}`,
|
|
20
|
+
scheduled: (at) => ` 예약 시각: ${at}`,
|
|
21
|
+
phased: (state, day, start) => ` 단계적 출시: ${state}` + (day ? ` (${day}일째/7일)` : '') + (start ? ` · 시작 ${start}` : ''),
|
|
22
|
+
phasedOff: ' 단계적 출시: 꺼짐',
|
|
23
|
+
build: (buildId) => `빌드 ${buildId}`,
|
|
24
|
+
internalState: (state) => ` 내부 상태: ${state}`,
|
|
25
|
+
externalState: (state, note) => ` 외부 상태: ${state}${note ? ` — ${note}` : ''}`,
|
|
26
|
+
betaSubmission: (state) => (state ? ` 베타 심사 제출: ${state}` : ' 베타 심사 제출: 없음'),
|
|
27
|
+
whatToTestEmpty: '❌ 비어 있음 (외부 배포 필수)',
|
|
28
|
+
autoNotify: (v) => ` 자동 알림: ${v}`,
|
|
29
|
+
reviewDetailComplete: ' 베타 심사 정보: ✅ 채워짐',
|
|
30
|
+
reviewDetailMissing: (missing) => ` 베타 심사 정보: ❌ 누락 — ${missing}`,
|
|
31
|
+
noneX: '❌ 없음',
|
|
32
|
+
testInfoLocales: (locales) => ` 테스트 정보 로케일: ${locales}`,
|
|
33
|
+
}, {
|
|
34
|
+
submissionsHeader: (n, platform) => `${n} review submission(s) (${platform})`,
|
|
35
|
+
notSubmitted: '(not submitted)',
|
|
36
|
+
itemsNone: ' items: (none)',
|
|
37
|
+
itemCount: (n) => ` ${n} item(s)`,
|
|
38
|
+
dryRunHeader: '🛑 Submit for review dry-run — nothing has been submitted yet.',
|
|
39
|
+
noBuild: ` attachedBuild: ⚠️ not attached — appstore_attach_build required (omit buildId = latest VALID build)`,
|
|
40
|
+
noWhatsNew: ` whatsNew : ⚠️ no release notes registered`,
|
|
41
|
+
whatsNewLine: (locale, length, excerpt) => ` [${locale}] (${length} chars) "${excerpt}"`,
|
|
42
|
+
confirmHint: 'To actually submit, call again with the same versionId and add the `confirm: true` option.',
|
|
43
|
+
cancelWarning: '⚠️ After submission, cancel_review may be blocked once the version enters the queue (WAITING_FOR_REVIEW) (observed: 1.4.2→3, 1.4.5→6).',
|
|
44
|
+
version: (v) => `Version ${v}`,
|
|
45
|
+
unknown: 'unknown',
|
|
46
|
+
state: (state, note) => ` State: ${state}${note ? ` — ${note}` : ''}`,
|
|
47
|
+
releaseTypeDefault: '(not set — Apple default)',
|
|
48
|
+
releaseType: (t) => ` Release type: ${t}`,
|
|
49
|
+
scheduled: (at) => ` Scheduled time: ${at}`,
|
|
50
|
+
phased: (state, day, start) => ` Phased release: ${state}` + (day ? ` (day ${day}/7)` : '') + (start ? ` · started ${start}` : ''),
|
|
51
|
+
phasedOff: ' Phased release: off',
|
|
52
|
+
build: (buildId) => `Build ${buildId}`,
|
|
53
|
+
internalState: (state) => ` Internal state: ${state}`,
|
|
54
|
+
externalState: (state, note) => ` External state: ${state}${note ? ` — ${note}` : ''}`,
|
|
55
|
+
betaSubmission: (state) => (state ? ` Beta review submission: ${state}` : ' Beta review submission: none'),
|
|
56
|
+
whatToTestEmpty: '❌ empty (required for external distribution)',
|
|
57
|
+
autoNotify: (v) => ` Auto-notify: ${v}`,
|
|
58
|
+
reviewDetailComplete: ' Beta review information: ✅ complete',
|
|
59
|
+
reviewDetailMissing: (missing) => ` Beta review information: ❌ missing — ${missing}`,
|
|
60
|
+
noneX: '❌ none',
|
|
61
|
+
testInfoLocales: (locales) => ` Test information locales: ${locales}`,
|
|
62
|
+
});
|
|
3
63
|
/** appstore_list_review_submissions — 묶음별 state, 항목 종류 요약, 항목별 연결 리소스. */
|
|
4
64
|
export function reviewSubmissionsText(result) {
|
|
5
|
-
const lines = [
|
|
65
|
+
const lines = [M().submissionsHeader(result.submissions.length, result.platform)];
|
|
6
66
|
for (const sub of result.submissions) {
|
|
7
67
|
lines.push('');
|
|
8
68
|
lines.push(`● ${sub.id}`);
|
|
9
|
-
lines.push(` state: ${sub.state ?? '?'} submitted: ${sub.submittedDate ??
|
|
69
|
+
lines.push(` state: ${sub.state ?? '?'} submitted: ${sub.submittedDate ?? M().notSubmitted}`);
|
|
10
70
|
if (sub.items.length === 0) {
|
|
11
|
-
lines.push(
|
|
71
|
+
lines.push(M().itemsNone);
|
|
12
72
|
}
|
|
13
73
|
// 항목 종류별 요약. 상품이 몇 개 들어갔는지가 첫 심사에서 가장 중요한 정보다.
|
|
14
74
|
const kinds = new Map();
|
|
@@ -16,10 +76,10 @@ export function reviewSubmissionsText(result) {
|
|
|
16
76
|
const k = item.targetType ?? 'unknown';
|
|
17
77
|
kinds.set(k, (kinds.get(k) ?? 0) + 1);
|
|
18
78
|
}
|
|
19
|
-
lines.push(
|
|
79
|
+
lines.push(M().itemCount(sub.items.length) +
|
|
20
80
|
(kinds.size ? ` — ${[...kinds].map(([k, n]) => `${k} ${n}`).join(', ')}` : ''));
|
|
21
81
|
if (sub.items.length === 0) {
|
|
22
|
-
lines.push(
|
|
82
|
+
lines.push(M().itemsNone);
|
|
23
83
|
}
|
|
24
84
|
for (const item of sub.items) {
|
|
25
85
|
const target = item.versionString
|
|
@@ -36,7 +96,7 @@ export function reviewSubmissionsText(result) {
|
|
|
36
96
|
/** appstore_submit_for_review — confirm 없이 호출했을 때의 dry-run 미리보기 (versionString·빌드·whatsNew 발췌). */
|
|
37
97
|
export function submitForReviewDryRunText(preview) {
|
|
38
98
|
const lines = [];
|
|
39
|
-
lines.push(
|
|
99
|
+
lines.push(M().dryRunHeader);
|
|
40
100
|
lines.push('');
|
|
41
101
|
lines.push(` versionId : ${preview.versionId}`);
|
|
42
102
|
lines.push(` versionString: ${preview.versionString}`);
|
|
@@ -47,58 +107,56 @@ export function submitForReviewDryRunText(preview) {
|
|
|
47
107
|
lines.push(` attachedBuild: #${preview.attachedBuild.buildNumber} (id=${preview.attachedBuild.id}, state=${preview.attachedBuild.processingState})`);
|
|
48
108
|
}
|
|
49
109
|
else {
|
|
50
|
-
lines.push(
|
|
110
|
+
lines.push(M().noBuild);
|
|
51
111
|
}
|
|
52
112
|
if (preview.whatsNewByLocale.length === 0) {
|
|
53
|
-
lines.push(
|
|
113
|
+
lines.push(M().noWhatsNew);
|
|
54
114
|
}
|
|
55
115
|
else {
|
|
56
116
|
lines.push(` whatsNew :`);
|
|
57
117
|
for (const wn of preview.whatsNewByLocale) {
|
|
58
|
-
lines.push(
|
|
118
|
+
lines.push(M().whatsNewLine(wn.locale, wn.length, wn.excerpt));
|
|
59
119
|
}
|
|
60
120
|
}
|
|
61
121
|
lines.push('');
|
|
62
|
-
lines.push(
|
|
63
|
-
lines.push(
|
|
122
|
+
lines.push(M().confirmHint);
|
|
123
|
+
lines.push(M().cancelWarning);
|
|
64
124
|
return lines.join('\n');
|
|
65
125
|
}
|
|
66
126
|
/** appstore_release_status — 출시 상태·방식·예약 시각·단계적 출시 진행. */
|
|
67
127
|
export function releaseStatusText({ version, phased, note }) {
|
|
68
128
|
const lines = [
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
129
|
+
M().version(version.versionString ?? version.versionId),
|
|
130
|
+
M().state(version.state ?? M().unknown, note),
|
|
131
|
+
M().releaseType(version.releaseType ?? M().releaseTypeDefault),
|
|
72
132
|
];
|
|
73
133
|
if (version.earliestReleaseDate)
|
|
74
|
-
lines.push(
|
|
134
|
+
lines.push(M().scheduled(version.earliestReleaseDate));
|
|
75
135
|
if (phased) {
|
|
76
|
-
lines.push(
|
|
77
|
-
(phased.currentDayNumber ? ` (${phased.currentDayNumber}일째/7일)` : '') +
|
|
78
|
-
(phased.startDate ? ` · 시작 ${phased.startDate}` : ''));
|
|
136
|
+
lines.push(M().phased(phased.state ?? '?', phased.currentDayNumber, phased.startDate));
|
|
79
137
|
}
|
|
80
138
|
else {
|
|
81
|
-
lines.push(
|
|
139
|
+
lines.push(M().phasedOff);
|
|
82
140
|
}
|
|
83
141
|
return lines.join('\n');
|
|
84
142
|
}
|
|
85
143
|
/** appstore_beta_status — 빌드의 TestFlight 상태와 (appId 를 줬으면) 앱 단위 누락 항목. */
|
|
86
144
|
export function betaStatusText(buildId, s) {
|
|
87
145
|
const lines = [
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
` What to Test: ${s.whatsToTestLocales.length ? s.whatsToTestLocales.join(', ') :
|
|
93
|
-
|
|
146
|
+
M().build(buildId),
|
|
147
|
+
M().internalState(s.internalState ?? '?'),
|
|
148
|
+
M().externalState(s.externalState ?? '?', s.note),
|
|
149
|
+
M().betaSubmission(s.submissionState),
|
|
150
|
+
` What to Test: ${s.whatsToTestLocales.length ? s.whatsToTestLocales.join(', ') : M().whatToTestEmpty}`,
|
|
151
|
+
M().autoNotify(s.autoNotifyEnabled === undefined ? '?' : String(s.autoNotifyEnabled)),
|
|
94
152
|
];
|
|
95
153
|
if (s.reviewDetail) {
|
|
96
154
|
lines.push(s.reviewDetail.complete
|
|
97
|
-
?
|
|
98
|
-
:
|
|
155
|
+
? M().reviewDetailComplete
|
|
156
|
+
: M().reviewDetailMissing(s.reviewDetail.missing.join(', ')));
|
|
99
157
|
}
|
|
100
158
|
if (s.testInfoLocales) {
|
|
101
|
-
lines.push(
|
|
159
|
+
lines.push(M().testInfoLocales(s.testInfoLocales.length ? s.testInfoLocales.join(', ') : M().noneX));
|
|
102
160
|
}
|
|
103
161
|
return lines.join('\n');
|
|
104
162
|
}
|
|
@@ -15,14 +15,30 @@ import { getAuthHeaders } from './auth.js';
|
|
|
15
15
|
import { fetchWithTimeout } from '../lib/http.js';
|
|
16
16
|
import { uploadFileParts } from './upload-parts.js';
|
|
17
17
|
import { encodePathSegment } from '../lib/url-path.js';
|
|
18
|
+
import { catalog } from '#core/lang.js';
|
|
19
|
+
const M = catalog({
|
|
20
|
+
authNeeded: '❌ App Store Connect 인증이 필요해.',
|
|
21
|
+
runInTerminal: '터미널에서 실행:',
|
|
22
|
+
notAbsolute: (filePath) => `filePath 는 절대경로여야 한다: ${filePath}`,
|
|
23
|
+
noFile: (filePath) => `파일이 존재하지 않는다: ${filePath}`,
|
|
24
|
+
empty: '빈 파일이다.',
|
|
25
|
+
noOps: 'uploadOperations 가 비어 있다 — Apple 응답 형식 확인 필요.',
|
|
26
|
+
}, {
|
|
27
|
+
authNeeded: '❌ App Store Connect authentication is required.',
|
|
28
|
+
runInTerminal: 'Run in a terminal:',
|
|
29
|
+
notAbsolute: (filePath) => `filePath must be an absolute path: ${filePath}`,
|
|
30
|
+
noFile: (filePath) => `File does not exist: ${filePath}`,
|
|
31
|
+
empty: 'The file is empty.',
|
|
32
|
+
noOps: 'uploadOperations is empty — check the Apple response format.',
|
|
33
|
+
});
|
|
18
34
|
const BASE = 'https://api.appstoreconnect.apple.com/v1';
|
|
19
35
|
async function req(pathOrUrl, init = {}) {
|
|
20
36
|
const headers = await getAuthHeaders();
|
|
21
37
|
if (!headers) {
|
|
22
38
|
throw new Error([
|
|
23
|
-
|
|
39
|
+
M().authNeeded,
|
|
24
40
|
'',
|
|
25
|
-
|
|
41
|
+
M().runInTerminal,
|
|
26
42
|
' npx -p @yoonion/mimi-seed-mcp mimi-seed-appstore-auth',
|
|
27
43
|
].join('\n'));
|
|
28
44
|
}
|
|
@@ -102,13 +118,13 @@ function guessMimeType(fileName) {
|
|
|
102
118
|
export async function uploadPreview(args) {
|
|
103
119
|
const { localizationId, previewType, filePath, previewFrameTimeCode } = args;
|
|
104
120
|
if (!path.isAbsolute(filePath))
|
|
105
|
-
throw new Error(
|
|
121
|
+
throw new Error(M().notAbsolute(filePath));
|
|
106
122
|
if (!fs.existsSync(filePath))
|
|
107
|
-
throw new Error(
|
|
123
|
+
throw new Error(M().noFile(filePath));
|
|
108
124
|
const fileName = path.basename(filePath);
|
|
109
125
|
const fileSize = fs.statSync(filePath).size;
|
|
110
126
|
if (fileSize === 0)
|
|
111
|
-
throw new Error(
|
|
127
|
+
throw new Error(M().empty);
|
|
112
128
|
const setId = await ensurePreviewSet(localizationId, previewType);
|
|
113
129
|
const mimeType = guessMimeType(fileName);
|
|
114
130
|
const reserved = await req('/appPreviews', {
|
|
@@ -130,7 +146,7 @@ export async function uploadPreview(args) {
|
|
|
130
146
|
const previewId = reserved.data.id;
|
|
131
147
|
const ops = reserved.data.attributes?.uploadOperations ?? [];
|
|
132
148
|
if (ops.length === 0)
|
|
133
|
-
throw new Error(
|
|
149
|
+
throw new Error(M().noOps);
|
|
134
150
|
await uploadFileParts(filePath, ops);
|
|
135
151
|
// 체크섬은 전체 파일 기준이라 스트리밍으로 계산한다 (메모리에 다 올리지 않는다).
|
|
136
152
|
const md5 = await new Promise((resolve, reject) => {
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { V1_BASE, V2_BASE, apiRequest, authHeadersOrThrow } from './http.js';
|
|
2
2
|
import { encodePathSegment } from '../lib/url-path.js';
|
|
3
|
+
import { catalog } from '#core/lang.js';
|
|
4
|
+
const M = catalog({
|
|
5
|
+
needOne: 'name 또는 description 중 하나는 있어야 해.',
|
|
6
|
+
needName: (locale) => `새 로케일(${locale})을 만들려면 name 이 필요해.`,
|
|
7
|
+
}, {
|
|
8
|
+
needOne: 'Provide at least one of name or description.',
|
|
9
|
+
needName: (locale) => `name is required to create a new locale (${locale}).`,
|
|
10
|
+
});
|
|
3
11
|
function localizationResource(productType) {
|
|
4
12
|
if (productType === 'subscription') {
|
|
5
13
|
return {
|
|
@@ -56,7 +64,7 @@ export async function listProductLocalizations(args) {
|
|
|
56
64
|
export async function upsertProductLocalization(args) {
|
|
57
65
|
const { internalId, productType, locale, name, description } = args;
|
|
58
66
|
if (!name && description === undefined) {
|
|
59
|
-
throw new Error(
|
|
67
|
+
throw new Error(M().needOne);
|
|
60
68
|
}
|
|
61
69
|
const resource = localizationResource(productType);
|
|
62
70
|
const authHeaders = await authHeadersOrThrow();
|
|
@@ -81,7 +89,7 @@ export async function upsertProductLocalization(args) {
|
|
|
81
89
|
};
|
|
82
90
|
}
|
|
83
91
|
if (!name) {
|
|
84
|
-
throw new Error(
|
|
92
|
+
throw new Error(M().needName(locale));
|
|
85
93
|
}
|
|
86
94
|
const attributes = { locale, name };
|
|
87
95
|
if (description !== undefined)
|
|
@@ -4,6 +4,26 @@ import path from 'node:path';
|
|
|
4
4
|
import { V1_BASE, V2_BASE, apiRequest, authHeadersOrThrow } from './http.js';
|
|
5
5
|
import { fetchWithTimeout, HTTP_TRANSFER_TIMEOUT_MS } from '../lib/http.js';
|
|
6
6
|
import { encodePathSegment } from '../lib/url-path.js';
|
|
7
|
+
import { catalog } from '#core/lang.js';
|
|
8
|
+
const M = catalog({
|
|
9
|
+
notHttps: (protocol) => `HTTPS가 아닌 업로드 URL은 거부해: ${protocol}`,
|
|
10
|
+
badRange: (offset, length, fileSize) => `잘못된 업로드 청크 범위: offset=${offset}, ` + `length=${length}, fileSize=${fileSize}`,
|
|
11
|
+
chunkFailed: (offset, length, status, body) => `청크 업로드 실패 (offset=${offset}, length=${length}): ` + `${status} ${body}`,
|
|
12
|
+
notAbsolute: (filePath) => `절대 경로가 필요해: ${filePath}`,
|
|
13
|
+
noFile: (filePath) => `파일이 존재하지 않아: ${filePath}`,
|
|
14
|
+
pngJpgOnly: (fileName) => `PNG/JPG 파일만 업로드할 수 있어: ${fileName}`,
|
|
15
|
+
emptyFile: (fileName) => `빈 파일은 업로드할 수 없어: ${fileName}`,
|
|
16
|
+
noOps: 'uploadOperations가 비어있음 — Apple API 응답 형식 확인 필요.',
|
|
17
|
+
}, {
|
|
18
|
+
notHttps: (protocol) => `Refusing a non-HTTPS upload URL: ${protocol}`,
|
|
19
|
+
badRange: (offset, length, fileSize) => `Invalid upload chunk range: offset=${offset}, ` + `length=${length}, fileSize=${fileSize}`,
|
|
20
|
+
chunkFailed: (offset, length, status, body) => `Chunk upload failed (offset=${offset}, length=${length}): ` + `${status} ${body}`,
|
|
21
|
+
notAbsolute: (filePath) => `An absolute path is required: ${filePath}`,
|
|
22
|
+
noFile: (filePath) => `File does not exist: ${filePath}`,
|
|
23
|
+
pngJpgOnly: (fileName) => `Only PNG/JPG files can be uploaded: ${fileName}`,
|
|
24
|
+
emptyFile: (fileName) => `Cannot upload an empty file: ${fileName}`,
|
|
25
|
+
noOps: 'uploadOperations is empty — check the Apple API response format.',
|
|
26
|
+
});
|
|
7
27
|
function productResource(productType) {
|
|
8
28
|
if (productType === 'subscription') {
|
|
9
29
|
return { base: V1_BASE, type: 'subscriptions', path: '/subscriptions' };
|
|
@@ -48,13 +68,12 @@ async function uploadChunks(buffer, operations) {
|
|
|
48
68
|
for (const operation of operations) {
|
|
49
69
|
const uploadUrl = new URL(operation.url);
|
|
50
70
|
if (uploadUrl.protocol !== 'https:') {
|
|
51
|
-
throw new Error(
|
|
71
|
+
throw new Error(M().notHttps(uploadUrl.protocol));
|
|
52
72
|
}
|
|
53
73
|
if (operation.offset < 0 ||
|
|
54
74
|
operation.length <= 0 ||
|
|
55
75
|
operation.offset + operation.length > buffer.length) {
|
|
56
|
-
throw new Error(
|
|
57
|
-
`length=${operation.length}, fileSize=${buffer.length}`);
|
|
76
|
+
throw new Error(M().badRange(operation.offset, operation.length, buffer.length));
|
|
58
77
|
}
|
|
59
78
|
const chunk = buffer.subarray(operation.offset, operation.offset + operation.length);
|
|
60
79
|
const headers = {};
|
|
@@ -63,8 +82,7 @@ async function uploadChunks(buffer, operations) {
|
|
|
63
82
|
const response = await fetchWithTimeout(operation.url, { method: operation.method, headers, body: new Uint8Array(chunk) }, HTTP_TRANSFER_TIMEOUT_MS);
|
|
64
83
|
if (!response.ok) {
|
|
65
84
|
const body = await response.text();
|
|
66
|
-
throw new Error(
|
|
67
|
-
`${response.status} ${body}`);
|
|
85
|
+
throw new Error(M().chunkFailed(operation.offset, operation.length, response.status, body));
|
|
68
86
|
}
|
|
69
87
|
}
|
|
70
88
|
}
|
|
@@ -82,6 +100,7 @@ async function findExistingReviewScreenshotId(internalId, productType, authHeade
|
|
|
82
100
|
return res?.data?.id ?? null;
|
|
83
101
|
}
|
|
84
102
|
catch {
|
|
103
|
+
// 조회 실패는 '기존 없음'으로 보고 POST 로 간다 — 결과에 replacedId 가 없어 교체되지 않았음이 드러나고, 남은 스크린샷이 있으면 상품당 1장 제약으로 POST 가 거절된다
|
|
85
104
|
return null;
|
|
86
105
|
}
|
|
87
106
|
}
|
|
@@ -94,19 +113,19 @@ async function findExistingReviewScreenshotId(internalId, productType, authHeade
|
|
|
94
113
|
export async function uploadProductReviewScreenshot(args) {
|
|
95
114
|
const { internalId, productType, filePath, replace = false } = args;
|
|
96
115
|
if (!path.isAbsolute(filePath)) {
|
|
97
|
-
throw new Error(
|
|
116
|
+
throw new Error(M().notAbsolute(filePath));
|
|
98
117
|
}
|
|
99
118
|
if (!fs.existsSync(filePath)) {
|
|
100
|
-
throw new Error(
|
|
119
|
+
throw new Error(M().noFile(filePath));
|
|
101
120
|
}
|
|
102
121
|
const buffer = fs.readFileSync(filePath);
|
|
103
122
|
const fileName = path.basename(filePath);
|
|
104
123
|
const fileSize = buffer.length;
|
|
105
124
|
if (!/\.(png|jpe?g)$/i.test(fileName)) {
|
|
106
|
-
throw new Error(
|
|
125
|
+
throw new Error(M().pngJpgOnly(fileName));
|
|
107
126
|
}
|
|
108
127
|
if (fileSize === 0) {
|
|
109
|
-
throw new Error(
|
|
128
|
+
throw new Error(M().emptyFile(fileName));
|
|
110
129
|
}
|
|
111
130
|
const checksum = crypto.createHash('md5').update(buffer).digest('hex');
|
|
112
131
|
const resource = reviewScreenshotResource(productType);
|
|
@@ -141,7 +160,7 @@ export async function uploadProductReviewScreenshot(args) {
|
|
|
141
160
|
await apiRequest(V1_BASE, `${resource.path}/${encodePathSegment(screenshotId)}`, authHeaders, {
|
|
142
161
|
method: 'DELETE',
|
|
143
162
|
}).catch(() => undefined);
|
|
144
|
-
throw new Error(
|
|
163
|
+
throw new Error(M().noOps);
|
|
145
164
|
}
|
|
146
165
|
try {
|
|
147
166
|
await uploadChunks(buffer, operations);
|
|
@@ -3,6 +3,20 @@
|
|
|
3
3
|
import { apiRequest, authHeadersOrThrow, V2_BASE } from './http.js';
|
|
4
4
|
import { apiGet, apiPost } from './client.js';
|
|
5
5
|
import { encodePathSegment } from '../lib/url-path.js';
|
|
6
|
+
import { catalog } from '#core/lang.js';
|
|
7
|
+
const M = catalog({
|
|
8
|
+
priceMatch: (target, matched) => `요청 $${target} → 매칭 $${matched} (Apple tier 제약). 의도와 다르면 Console에서 수정.`,
|
|
9
|
+
iapNoId: (json) => `IAP 생성 응답에 id 없음: ${json}`,
|
|
10
|
+
noPricePoint: (territory) => `${territory}에서 가격 point를 찾지 못함 — Console에서 수동 설정 필요.`,
|
|
11
|
+
groupFailed: (json) => `subscriptionGroup 생성 실패: ${json}`,
|
|
12
|
+
subNoId: (json) => `subscription 생성 응답에 id 없음: ${json}`,
|
|
13
|
+
}, {
|
|
14
|
+
priceMatch: (target, matched) => `Requested $${target} → matched $${matched} (Apple tier constraint). If this is not what you intended, fix it in the Console.`,
|
|
15
|
+
iapNoId: (json) => `IAP creation response has no id: ${json}`,
|
|
16
|
+
noPricePoint: (territory) => `No price point found in ${territory} — set it manually in the Console.`,
|
|
17
|
+
groupFailed: (json) => `subscriptionGroup creation failed: ${json}`,
|
|
18
|
+
subNoId: (json) => `subscription creation response has no id: ${json}`,
|
|
19
|
+
});
|
|
6
20
|
// ─── 인앱 구매 (IAP) 생성 ───
|
|
7
21
|
// 2023년 출시된 IAP v2 API (POST /v2/inAppPurchases) 사용.
|
|
8
22
|
// 흐름: (1) IAP draft 생성 → (2) 로컬라이제이션 → (3) priceSchedule → (4) submission(선택).
|
|
@@ -44,7 +58,7 @@ function priceMatchWarning(targetPrice, matched) {
|
|
|
44
58
|
const diff = Math.abs(matched - targetPrice);
|
|
45
59
|
if (diff < PRICE_MATCH_WARN_THRESHOLD)
|
|
46
60
|
return undefined;
|
|
47
|
-
return
|
|
61
|
+
return M().priceMatch(targetPrice, matched.toFixed(2));
|
|
48
62
|
}
|
|
49
63
|
export async function createInAppPurchase(input) {
|
|
50
64
|
const locale = input.locale ?? 'en-US';
|
|
@@ -67,7 +81,7 @@ export async function createInAppPurchase(input) {
|
|
|
67
81
|
});
|
|
68
82
|
const iapId = created?.data?.id;
|
|
69
83
|
if (!iapId)
|
|
70
|
-
throw new Error(
|
|
84
|
+
throw new Error(M().iapNoId(JSON.stringify(created)));
|
|
71
85
|
const consoleUrl = `https://appstoreconnect.apple.com/apps/${encodePathSegment(input.appId)}/distribution/iaps/${encodePathSegment(iapId)}`;
|
|
72
86
|
const summary = {
|
|
73
87
|
iapId,
|
|
@@ -102,7 +116,7 @@ export async function createInAppPurchase(input) {
|
|
|
102
116
|
const matched = await findClosestPricePoint(`/inAppPurchases/${encodePathSegment(iapId)}/pricePoints`, baseTerritory, input.priceUsd);
|
|
103
117
|
if (!matched) {
|
|
104
118
|
summary.failedStep = 'priceSchedule';
|
|
105
|
-
summary.error =
|
|
119
|
+
summary.error = M().noPricePoint(baseTerritory);
|
|
106
120
|
return summary;
|
|
107
121
|
}
|
|
108
122
|
summary.priceMatchWarning = priceMatchWarning(input.priceUsd, matched.customerPrice);
|
|
@@ -179,7 +193,7 @@ async function findOrCreateSubscriptionGroup(appId, referenceName) {
|
|
|
179
193
|
});
|
|
180
194
|
const id = created?.data?.id;
|
|
181
195
|
if (!id)
|
|
182
|
-
throw new Error(
|
|
196
|
+
throw new Error(M().groupFailed(JSON.stringify(created)));
|
|
183
197
|
return id;
|
|
184
198
|
}
|
|
185
199
|
export async function createAutoRenewableSubscription(input) {
|
|
@@ -210,7 +224,7 @@ export async function createAutoRenewableSubscription(input) {
|
|
|
210
224
|
});
|
|
211
225
|
const subscriptionId = created?.data?.id;
|
|
212
226
|
if (!subscriptionId) {
|
|
213
|
-
throw new Error(
|
|
227
|
+
throw new Error(M().subNoId(JSON.stringify(created)));
|
|
214
228
|
}
|
|
215
229
|
const consoleUrl = `https://appstoreconnect.apple.com/apps/${encodePathSegment(input.appId)}/distribution/subscriptions/${encodePathSegment(subscriptionId)}`;
|
|
216
230
|
const summary = {
|
|
@@ -247,7 +261,7 @@ export async function createAutoRenewableSubscription(input) {
|
|
|
247
261
|
const matched = await findClosestPricePoint(`/subscriptions/${encodePathSegment(subscriptionId)}/pricePoints`, baseTerritory, input.priceUsd);
|
|
248
262
|
if (!matched) {
|
|
249
263
|
summary.failedStep = 'priceSchedule';
|
|
250
|
-
summary.error =
|
|
264
|
+
summary.error = M().noPricePoint(baseTerritory);
|
|
251
265
|
return summary;
|
|
252
266
|
}
|
|
253
267
|
summary.priceMatchWarning = priceMatchWarning(input.priceUsd, matched.customerPrice);
|