@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
|
@@ -8,6 +8,88 @@ import { appStorePagination, getAppStoreResponse, pageIsIncomplete } from './rea
|
|
|
8
8
|
import { uploadFileParts } from './upload-parts.js';
|
|
9
9
|
import { getVersionAppAndPlatform } from './versions.js';
|
|
10
10
|
import { encodePathSegment } from '../lib/url-path.js';
|
|
11
|
+
import { catalog } from '#core/lang.js';
|
|
12
|
+
const M = catalog({
|
|
13
|
+
badShape: (label) => `App Store Connect ${label} 응답 형식이 올바르지 않습니다.`,
|
|
14
|
+
lblSpecs: '미디어 규격',
|
|
15
|
+
checkGroup: (placementType, groups) => `Apple ${placementType} 배치 그룹을 확인하세요. 지원 그룹: ${groups}`,
|
|
16
|
+
noneFound: '조회되지 않음',
|
|
17
|
+
lblLocale: '버전 로케일',
|
|
18
|
+
localeMismatch: 'App Store Connect 응답의 버전 로케일이 요청과 일치하지 않습니다.',
|
|
19
|
+
noLibrary: 'App Store Connect의 Asset Library ID를 확인할 수 없습니다.',
|
|
20
|
+
lblParts: '업로드 조각',
|
|
21
|
+
partsRange: 'Apple 업로드 조각이 요청 파일의 바이트 범위와 일치하지 않습니다.',
|
|
22
|
+
partsCoverage: 'Apple 업로드 조각이 요청 파일 전체를 포함하지 않습니다.',
|
|
23
|
+
assetMismatch: '대상 에셋 유형 또는 ID가 일치하지 않습니다.',
|
|
24
|
+
assetNotInLibrary: '대상 앱의 Asset Library에서 해당 에셋을 확인할 수 없습니다.',
|
|
25
|
+
fileOrAsset: 'filePath 또는 assetId 중 하나를 지정하세요.',
|
|
26
|
+
frameTimeCode: 'previewFrameTimeCode는 미리보기 파일 업로드에만 적용됩니다.',
|
|
27
|
+
notAbsolute: 'filePath는 로컬 파일의 절대 경로여야 합니다.',
|
|
28
|
+
notRegularFile: '내용이 있는 일반 미디어 파일을 지정하세요.',
|
|
29
|
+
specMismatch: '이 배치 그룹의 Apple 미디어 규격에 맞는 파일 확장자와 크기를 확인하세요.',
|
|
30
|
+
lblReserve: '미디어 예약',
|
|
31
|
+
reservedType: '예약된 에셋 유형을 확인할 수 없습니다.',
|
|
32
|
+
fileChanged: '업로드 중 로컬 파일이 변경되어 완료 요청을 중단했습니다.',
|
|
33
|
+
lblCommit: '미디어 업로드 완료',
|
|
34
|
+
commitId: '업로드 완료 응답의 에셋 ID를 확인할 수 없습니다.',
|
|
35
|
+
ambiguousPlacement: '대상 그룹의 기존 미디어 배치를 하나로 확인할 수 없습니다. 배치 목록을 확인하세요.',
|
|
36
|
+
noAssetId: 'App Store Connect 에셋 ID를 확인할 수 없습니다.',
|
|
37
|
+
processing: 'Apple에서 에셋을 처리 중입니다. 처리 완료 후 같은 assetId로 배치를 다시 요청하세요.',
|
|
38
|
+
stateUnknown: '상태 미상',
|
|
39
|
+
badState: (state) => `배치할 수 있는 에셋 상태를 확인할 수 없습니다 (${state}).`,
|
|
40
|
+
processedSpec: '처리된 에셋이 대상 배치 그룹의 규격에 맞는지 확인할 수 없습니다.',
|
|
41
|
+
lblPlacement: '미디어 배치',
|
|
42
|
+
noPlacementId: 'App Store Connect의 배치 ID를 확인할 수 없습니다.',
|
|
43
|
+
recoverUpload: '파일 전송을 완료하지 못했습니다. 남은 예약을 확인한 뒤 파일 업로드를 다시 시작하세요.',
|
|
44
|
+
recoverCommit: '업로드 완료 요청의 결과를 확인하세요. 처리가 시작됐다면 기존 assetId로 이어갈 수 있습니다.',
|
|
45
|
+
recoverPlace: '에셋 상태와 대상 그룹의 현재 배치를 확인하세요.',
|
|
46
|
+
assetError: (assetId, detail, recovery) => `Asset Library 에셋 ${assetId}: ${detail} ${recovery}`,
|
|
47
|
+
uniqueIds: '중복 없는 배치 ID를 순서대로 지정하세요.',
|
|
48
|
+
allIds: '대상 로케일과 배치 그룹의 기존 배치 ID 전체를 한 번씩 지정하세요.',
|
|
49
|
+
lblReorder: '배치 순서 변경',
|
|
50
|
+
noReorderId: 'App Store Connect의 순서 변경 요청 ID를 확인할 수 없습니다.',
|
|
51
|
+
reorderUnverified: (id) => `배치 순서 변경 요청 ${id} 생성 후 실제 표시 순서를 확인할 수 없습니다. 목록을 다시 조회하세요.`,
|
|
52
|
+
}, {
|
|
53
|
+
badShape: (label) => `The App Store Connect ${label} response has an invalid format.`,
|
|
54
|
+
lblSpecs: 'media specs',
|
|
55
|
+
checkGroup: (placementType, groups) => `Check the Apple ${placementType} placement group. Supported groups: ${groups}`,
|
|
56
|
+
noneFound: 'none found',
|
|
57
|
+
lblLocale: 'version locale',
|
|
58
|
+
localeMismatch: 'The version locale in the App Store Connect response does not match the request.',
|
|
59
|
+
noLibrary: 'Cannot confirm the App Store Connect Asset Library ID.',
|
|
60
|
+
lblParts: 'upload parts',
|
|
61
|
+
partsRange: 'The Apple upload parts do not match the byte ranges of the requested file.',
|
|
62
|
+
partsCoverage: 'The Apple upload parts do not cover the entire requested file.',
|
|
63
|
+
assetMismatch: 'The target asset type or ID does not match.',
|
|
64
|
+
assetNotInLibrary: 'Cannot find the asset in the target app\'s Asset Library.',
|
|
65
|
+
fileOrAsset: 'Specify exactly one of filePath or assetId.',
|
|
66
|
+
frameTimeCode: 'previewFrameTimeCode applies only to preview file uploads.',
|
|
67
|
+
notAbsolute: 'filePath must be an absolute path to a local file.',
|
|
68
|
+
notRegularFile: 'Specify a regular, non-empty media file.',
|
|
69
|
+
specMismatch: 'Check that the file extension and size meet Apple\'s media specs for this placement group.',
|
|
70
|
+
lblReserve: 'media reservation',
|
|
71
|
+
reservedType: 'Cannot confirm the type of the reserved asset.',
|
|
72
|
+
fileChanged: 'The local file changed during the upload, so the commit request was stopped.',
|
|
73
|
+
lblCommit: 'media upload commit',
|
|
74
|
+
commitId: 'Cannot confirm the asset ID in the upload commit response.',
|
|
75
|
+
ambiguousPlacement: 'Cannot resolve a single existing media placement in the target group. Check the placement list.',
|
|
76
|
+
noAssetId: 'Cannot confirm the App Store Connect asset ID.',
|
|
77
|
+
processing: 'Apple is processing the asset. After processing finishes, request the placement again with the same assetId.',
|
|
78
|
+
stateUnknown: 'state unknown',
|
|
79
|
+
badState: (state) => `Cannot confirm a placeable asset state (${state}).`,
|
|
80
|
+
processedSpec: 'Cannot confirm that the processed asset meets the target placement group\'s specs.',
|
|
81
|
+
lblPlacement: 'media placement',
|
|
82
|
+
noPlacementId: 'Cannot confirm the App Store Connect placement ID.',
|
|
83
|
+
recoverUpload: 'The file transfer did not complete. Check the remaining reservation, then restart the file upload.',
|
|
84
|
+
recoverCommit: 'Check the result of the upload commit request. If processing has started, you can continue with the existing assetId.',
|
|
85
|
+
recoverPlace: 'Check the asset state and the current placements of the target group.',
|
|
86
|
+
assetError: (assetId, detail, recovery) => `Asset Library asset ${assetId}: ${detail} ${recovery}`,
|
|
87
|
+
uniqueIds: 'Specify placement IDs in order, without duplicates.',
|
|
88
|
+
allIds: 'Specify every existing placement ID of the target locale and placement group exactly once.',
|
|
89
|
+
lblReorder: 'placement reorder',
|
|
90
|
+
noReorderId: 'Cannot confirm the App Store Connect reorder request ID.',
|
|
91
|
+
reorderUnverified: (id) => `Cannot confirm the actual display order after creating reorder request ${id}. List the placements again.`,
|
|
92
|
+
});
|
|
11
93
|
const category = 'APP_SCREENSHOTS_AND_PREVIEWS';
|
|
12
94
|
const resourceId = z.string().min(1);
|
|
13
95
|
const resourceRef = z.object({ type: z.string(), id: resourceId });
|
|
@@ -55,7 +137,7 @@ const assetTypes = {
|
|
|
55
137
|
function checked(schema, received, label) {
|
|
56
138
|
const parsed = schema.safeParse(received);
|
|
57
139
|
if (!parsed.success)
|
|
58
|
-
throw new Error(
|
|
140
|
+
throw new Error(M().badShape(label));
|
|
59
141
|
return parsed.data;
|
|
60
142
|
}
|
|
61
143
|
function link(type, id) {
|
|
@@ -66,7 +148,7 @@ async function supportsPlacement(placementGroup, placementType) {
|
|
|
66
148
|
const document = checked(referenceData, await apiGet('/appAssetLibraryRefData', {
|
|
67
149
|
'filter[features]': 'APP_STORE_VERSIONS',
|
|
68
150
|
'fields[appAssetLibraryRefData]': `placementTypes,${specKey}`,
|
|
69
|
-
}),
|
|
151
|
+
}), M().lblSpecs);
|
|
70
152
|
const records = document.data.map(({ attributes }) => attributes);
|
|
71
153
|
const mappings = records
|
|
72
154
|
.flatMap(({ placementTypes }) => placementTypes)
|
|
@@ -77,7 +159,7 @@ async function supportsPlacement(placementGroup, placementType) {
|
|
|
77
159
|
const specs = records.flatMap((record) => record[specKey] ?? []).filter(({ specId }) => supported.has(specId));
|
|
78
160
|
if (specs.length === 0) {
|
|
79
161
|
const groups = [...new Set(mappings.map(({ placementGroupId }) => placementGroupId))];
|
|
80
|
-
throw new Error(
|
|
162
|
+
throw new Error(M().checkGroup(placementType, groups.join(', ') || M().noneFound));
|
|
81
163
|
}
|
|
82
164
|
return specs;
|
|
83
165
|
}
|
|
@@ -86,28 +168,28 @@ async function libraryForLocalization(localizationId) {
|
|
|
86
168
|
include: 'appStoreVersion',
|
|
87
169
|
'fields[appStoreVersionLocalizations]': 'appStoreVersion',
|
|
88
170
|
'fields[appStoreVersions]': 'app',
|
|
89
|
-
}),
|
|
171
|
+
}), M().lblLocale).data;
|
|
90
172
|
if (localization.id !== localizationId || localization.type !== 'appStoreVersionLocalizations') {
|
|
91
|
-
throw new Error(
|
|
173
|
+
throw new Error(M().localeMismatch);
|
|
92
174
|
}
|
|
93
175
|
const { appId } = await getVersionAppAndPlatform(localization.relationships.appStoreVersion.data.id);
|
|
94
176
|
const library = checked(idDocument, await apiGet(`/apps/${encodePathSegment(appId)}/assetLibrary`), 'Asset Library').data;
|
|
95
177
|
if (library.type !== 'appAssetLibraries')
|
|
96
|
-
throw new Error(
|
|
178
|
+
throw new Error(M().noLibrary);
|
|
97
179
|
return library.id;
|
|
98
180
|
}
|
|
99
181
|
function checkUploadPlan(value, fileSize) {
|
|
100
|
-
const operations = checked(uploadPlan, value,
|
|
182
|
+
const operations = checked(uploadPlan, value, M().lblParts);
|
|
101
183
|
let offset = 0;
|
|
102
184
|
for (const operation of [...operations].sort((a, b) => a.offset - b.offset)) {
|
|
103
185
|
const url = new URL(operation.url);
|
|
104
186
|
if (url.username || url.password || operation.offset !== offset || operation.length > fileSize - offset) {
|
|
105
|
-
throw new Error(
|
|
187
|
+
throw new Error(M().partsRange);
|
|
106
188
|
}
|
|
107
189
|
offset += operation.length;
|
|
108
190
|
}
|
|
109
191
|
if (offset !== fileSize)
|
|
110
|
-
throw new Error(
|
|
192
|
+
throw new Error(M().partsCoverage);
|
|
111
193
|
return operations;
|
|
112
194
|
}
|
|
113
195
|
async function readAssetState(resource, assetId) {
|
|
@@ -115,7 +197,7 @@ async function readAssetState(resource, assetId) {
|
|
|
115
197
|
[`fields[${resource}]`]: 'state,specId',
|
|
116
198
|
});
|
|
117
199
|
if (response.data.id !== assetId || response.data.type !== resource) {
|
|
118
|
-
throw new Error(
|
|
200
|
+
throw new Error(M().assetMismatch);
|
|
119
201
|
}
|
|
120
202
|
return response.data.attributes;
|
|
121
203
|
}
|
|
@@ -125,22 +207,22 @@ async function readLibraryAsset(localizationId, placementType, assetId) {
|
|
|
125
207
|
const page = await getAppStoreResponse(statePage, `/appAssetLibraries/${encodePathSegment(libraryId)}/${encodePathSegment(collection)}`, { 'filter[id]': assetId, [`fields[${resource}]`]: 'state,specId', limit: '1' });
|
|
126
208
|
const [asset] = page.data;
|
|
127
209
|
if (pageIsIncomplete(page, page.data.length) || page.data.length !== 1 || asset.id !== assetId || asset.type !== resource) {
|
|
128
|
-
throw new Error(
|
|
210
|
+
throw new Error(M().assetNotInLibrary);
|
|
129
211
|
}
|
|
130
212
|
return asset.attributes;
|
|
131
213
|
}
|
|
132
214
|
export async function uploadAndPlaceMedia(args) {
|
|
133
215
|
const { localizationId, placementGroup, placementType, filePath, previewFrameTimeCode } = args;
|
|
134
216
|
if (Boolean(filePath) === Boolean(args.assetId))
|
|
135
|
-
throw new Error(
|
|
217
|
+
throw new Error(M().fileOrAsset);
|
|
136
218
|
if (previewFrameTimeCode && (!filePath || placementType !== 'APP_PREVIEW')) {
|
|
137
|
-
throw new Error(
|
|
219
|
+
throw new Error(M().frameTimeCode);
|
|
138
220
|
}
|
|
139
221
|
if (filePath && !path.isAbsolute(filePath))
|
|
140
|
-
throw new Error(
|
|
222
|
+
throw new Error(M().notAbsolute);
|
|
141
223
|
const file = filePath ? await stat(filePath) : undefined;
|
|
142
224
|
if (file && (!file.isFile() || file.size <= 0))
|
|
143
|
-
throw new Error(
|
|
225
|
+
throw new Error(M().notRegularFile);
|
|
144
226
|
const { resource, relation } = assetTypes[placementType];
|
|
145
227
|
const specs = await supportsPlacement(placementGroup, placementType);
|
|
146
228
|
let assetId = args.assetId;
|
|
@@ -151,7 +233,7 @@ export async function uploadAndPlaceMedia(args) {
|
|
|
151
233
|
const fileName = path.basename(filePath);
|
|
152
234
|
const extension = path.extname(fileName).toLowerCase();
|
|
153
235
|
if (!specs.some((spec) => spec.fileExtensions.includes(extension) && file.size <= spec.maxFileSize)) {
|
|
154
|
-
throw new Error(
|
|
236
|
+
throw new Error(M().specMismatch);
|
|
155
237
|
}
|
|
156
238
|
const libraryId = await libraryForLocalization(localizationId);
|
|
157
239
|
const reserved = checked(reservationDocument, await apiPost(`/${encodePathSegment(resource)}`, {
|
|
@@ -160,23 +242,23 @@ export async function uploadAndPlaceMedia(args) {
|
|
|
160
242
|
attributes: { category, fileName, fileSize: file.size, ...(previewFrameTimeCode ? { previewFrameTimeCode } : {}) },
|
|
161
243
|
relationships: { assetLibrary: link('appAssetLibraries', libraryId) },
|
|
162
244
|
},
|
|
163
|
-
}),
|
|
245
|
+
}), M().lblReserve).data;
|
|
164
246
|
if (reserved.type !== resource)
|
|
165
|
-
throw new Error(
|
|
247
|
+
throw new Error(M().reservedType);
|
|
166
248
|
assetId = reserved.id;
|
|
167
249
|
stage = 'upload';
|
|
168
250
|
const operations = checkUploadPlan(reserved.attributes?.uploadOperations, file.size);
|
|
169
251
|
await uploadFileParts(filePath, operations, 'error');
|
|
170
252
|
const afterUpload = await stat(filePath);
|
|
171
253
|
if (afterUpload.size !== file.size || afterUpload.mtimeMs !== file.mtimeMs || afterUpload.ino !== file.ino) {
|
|
172
|
-
throw new Error(
|
|
254
|
+
throw new Error(M().fileChanged);
|
|
173
255
|
}
|
|
174
256
|
stage = 'commit';
|
|
175
257
|
const commit = checked(stateDocument, await apiPatch(`/${encodePathSegment(resource)}/${encodePathSegment(assetId)}`, {
|
|
176
258
|
data: { type: resource, id: assetId, attributes: { uploaded: true } },
|
|
177
|
-
}),
|
|
259
|
+
}), M().lblCommit).data;
|
|
178
260
|
if (commit.id !== assetId || commit.type !== resource)
|
|
179
|
-
throw new Error(
|
|
261
|
+
throw new Error(M().commitId);
|
|
180
262
|
asset = commit.attributes;
|
|
181
263
|
stage = 'placement';
|
|
182
264
|
for (const waitMs of [0, 2_000, 4_000]) {
|
|
@@ -195,25 +277,25 @@ export async function uploadAndPlaceMedia(args) {
|
|
|
195
277
|
return { status: 'placed', assetId, placementGroup, placementId: existing[0].placementId, placementState: existing[0].placementState, assetState: existing[0].assetState, reusedPlacement: true };
|
|
196
278
|
}
|
|
197
279
|
if (existing.length > 1 || related.some((row) => !row.assetId)) {
|
|
198
|
-
throw new Error(
|
|
280
|
+
throw new Error(M().ambiguousPlacement);
|
|
199
281
|
}
|
|
200
282
|
asset = await readLibraryAsset(localizationId, placementType, assetId);
|
|
201
283
|
}
|
|
202
284
|
if (!assetId)
|
|
203
|
-
throw new Error(
|
|
285
|
+
throw new Error(M().noAssetId);
|
|
204
286
|
const assetState = asset?.state ?? undefined;
|
|
205
287
|
if (assetState === 'UPLOAD_COMPLETE') {
|
|
206
288
|
return {
|
|
207
289
|
status: 'processing', assetId, assetState, placementGroup,
|
|
208
|
-
message:
|
|
290
|
+
message: M().processing,
|
|
209
291
|
};
|
|
210
292
|
}
|
|
211
293
|
if (!assetState || !readyAssetStates.has(assetState)) {
|
|
212
|
-
throw new Error(
|
|
294
|
+
throw new Error(M().badState(assetState ?? M().stateUnknown));
|
|
213
295
|
}
|
|
214
296
|
const assetSpecId = asset?.specId;
|
|
215
297
|
if (!assetSpecId || !specs.some(({ specId }) => specId === assetSpecId)) {
|
|
216
|
-
throw new Error(
|
|
298
|
+
throw new Error(M().processedSpec);
|
|
217
299
|
}
|
|
218
300
|
const placement = checked(stateDocument, await apiPost('/appAssetLibraryPlacements', {
|
|
219
301
|
data: {
|
|
@@ -224,9 +306,9 @@ export async function uploadAndPlaceMedia(args) {
|
|
|
224
306
|
appStoreVersionLocalization: link('appStoreVersionLocalizations', localizationId),
|
|
225
307
|
},
|
|
226
308
|
},
|
|
227
|
-
}),
|
|
309
|
+
}), M().lblPlacement).data;
|
|
228
310
|
if (placement.type !== 'appAssetLibraryPlacements')
|
|
229
|
-
throw new Error(
|
|
311
|
+
throw new Error(M().noPlacementId);
|
|
230
312
|
return {
|
|
231
313
|
status: 'placed', assetId, placementGroup, placementId: placement.id, assetState,
|
|
232
314
|
placementState: placement.attributes?.state ?? undefined, reusedPlacement: false,
|
|
@@ -237,11 +319,11 @@ export async function uploadAndPlaceMedia(args) {
|
|
|
237
319
|
throw error;
|
|
238
320
|
const detail = error instanceof Error ? error.message : String(error);
|
|
239
321
|
const recovery = stage === 'upload'
|
|
240
|
-
?
|
|
322
|
+
? M().recoverUpload
|
|
241
323
|
: stage === 'commit'
|
|
242
|
-
?
|
|
243
|
-
:
|
|
244
|
-
throw new Error(
|
|
324
|
+
? M().recoverCommit
|
|
325
|
+
: M().recoverPlace;
|
|
326
|
+
throw new Error(M().assetError(assetId, detail, recovery), { cause: error });
|
|
245
327
|
}
|
|
246
328
|
}
|
|
247
329
|
function sameOrder(current, requested) {
|
|
@@ -251,12 +333,12 @@ export async function reorderMediaPlacements(args) {
|
|
|
251
333
|
const { localizationId, placementGroup, placementIds } = args;
|
|
252
334
|
const requested = new Set(placementIds);
|
|
253
335
|
if (requested.size === 0 || requested.size !== placementIds.length)
|
|
254
|
-
throw new Error(
|
|
336
|
+
throw new Error(M().uniqueIds);
|
|
255
337
|
const readOrder = async () => (await listPlacementGroup(localizationId, placementGroup)).map(({ placementId }) => placementId);
|
|
256
338
|
const current = await readOrder();
|
|
257
339
|
if (current.length !== placementIds.length || new Set(current).size !== current.length
|
|
258
340
|
|| current.some((id) => !requested.has(id))) {
|
|
259
|
-
throw new Error(
|
|
341
|
+
throw new Error(M().allIds);
|
|
260
342
|
}
|
|
261
343
|
if (sameOrder(current, placementIds))
|
|
262
344
|
return { changed: false, placementGroup, placementIds: current };
|
|
@@ -269,10 +351,10 @@ export async function reorderMediaPlacements(args) {
|
|
|
269
351
|
appStoreVersionLocalization: link('appStoreVersionLocalizations', localizationId),
|
|
270
352
|
},
|
|
271
353
|
},
|
|
272
|
-
}),
|
|
354
|
+
}), M().lblReorder).data;
|
|
273
355
|
if (request.type !== 'appAssetLibraryPlacementOrderingRequests')
|
|
274
|
-
throw new Error(
|
|
275
|
-
const verificationError =
|
|
356
|
+
throw new Error(M().noReorderId);
|
|
357
|
+
const verificationError = M().reorderUnverified(request.id);
|
|
276
358
|
const updated = await readOrder().catch((error) => {
|
|
277
359
|
throw new Error(verificationError, { cause: error });
|
|
278
360
|
});
|
|
@@ -4,6 +4,20 @@ import { isNotFound } from './http.js';
|
|
|
4
4
|
import { collectPages } from '../lib/paginate.js';
|
|
5
5
|
import { encodePathSegment } from '../lib/url-path.js';
|
|
6
6
|
import { appStoreNextPagePath } from './read-response.js';
|
|
7
|
+
import { catalog } from '#core/lang.js';
|
|
8
|
+
const M = catalog({
|
|
9
|
+
noGroup: 'App Store Connect에서 대상 미디어 배치 그룹을 확인할 수 없습니다.',
|
|
10
|
+
badShape: 'App Store Connect의 미디어 배치 응답 형식이 올바르지 않습니다.',
|
|
11
|
+
duplicate: 'App Store Connect의 미디어 배치 ID가 중복됩니다.',
|
|
12
|
+
incomplete: 'App Store Connect의 미디어 배치 목록이 불완전합니다.',
|
|
13
|
+
noMedia: 'App Store Connect에서 대상 로컬라이제이션의 미디어를 찾을 수 없습니다.',
|
|
14
|
+
}, {
|
|
15
|
+
noGroup: 'Cannot confirm the target media placement group in App Store Connect.',
|
|
16
|
+
badShape: 'The App Store Connect media placement response has an invalid format.',
|
|
17
|
+
duplicate: 'App Store Connect returned duplicate media placement IDs.',
|
|
18
|
+
incomplete: 'The App Store Connect media placement list is incomplete.',
|
|
19
|
+
noMedia: 'Cannot find media for the target localization in App Store Connect.',
|
|
20
|
+
});
|
|
7
21
|
const id = z.string().min(1);
|
|
8
22
|
const resourceRef = z.object({ type: z.string(), id });
|
|
9
23
|
const relationship = z.object({ data: resourceRef.nullish() }).nullish();
|
|
@@ -141,7 +155,7 @@ export async function listPlacementGroup(localizationId, placementGroup, include
|
|
|
141
155
|
...(includeAsset ? { include: includeAsset, [`fields[${assetType}]`]: 'state' } : {}),
|
|
142
156
|
});
|
|
143
157
|
if (!rows || rows.some((row) => row.placementGroup !== placementGroup)) {
|
|
144
|
-
throw new Error(
|
|
158
|
+
throw new Error(M().noGroup);
|
|
145
159
|
}
|
|
146
160
|
return rows;
|
|
147
161
|
}
|
|
@@ -162,18 +176,18 @@ async function readPlacements(localizationId, filters) {
|
|
|
162
176
|
return collectPages(async (next) => {
|
|
163
177
|
const page = placementPage.safeParse(next ? await apiGet(next) : first);
|
|
164
178
|
if (!page.success)
|
|
165
|
-
throw new Error(
|
|
179
|
+
throw new Error(M().badShape);
|
|
166
180
|
const { data, included, links, meta } = page.data;
|
|
167
181
|
const assets = indexIncludedResources(included ?? []);
|
|
168
182
|
for (const row of data) {
|
|
169
183
|
if (seen.has(row.id))
|
|
170
|
-
throw new Error(
|
|
184
|
+
throw new Error(M().duplicate);
|
|
171
185
|
seen.add(row.id);
|
|
172
186
|
}
|
|
173
187
|
total = Math.max(total, meta?.paging?.total ?? 0);
|
|
174
188
|
const nextPageToken = links?.next ? appStoreNextPagePath(path, links.next) : undefined;
|
|
175
189
|
if (!nextPageToken && (meta?.paging?.nextCursor || total > seen.size)) {
|
|
176
|
-
throw new Error(
|
|
190
|
+
throw new Error(M().incomplete);
|
|
177
191
|
}
|
|
178
192
|
return {
|
|
179
193
|
items: data.map((row) => toPlacement(row, assets)),
|
|
@@ -192,6 +206,6 @@ export async function listProductPageMedia(localizationId, kind, listLegacySets)
|
|
|
192
206
|
}),
|
|
193
207
|
]);
|
|
194
208
|
if (!placements && !legacySets)
|
|
195
|
-
throw new Error(
|
|
209
|
+
throw new Error(M().noMedia);
|
|
196
210
|
return { placements: placements ?? [], legacySets: legacySets ?? [] };
|
|
197
211
|
}
|
package/dist/appstore/auth.d.ts
CHANGED
|
@@ -41,6 +41,8 @@ export declare function normalizeVendorNumber(vendorNumber?: string): string | u
|
|
|
41
41
|
* 지우면 매출·분석 기능이 조용히 망가진다.
|
|
42
42
|
*/
|
|
43
43
|
export declare function mergeAppStoreCredentials(existing: AppStoreCredentials | null, primary: AppStoreKey, vendorNumber?: string): AppStoreCredentials;
|
|
44
|
+
/** getAppStoreCredentials 가 읽는 파일 — appstore.json, 없으면 레거시 경로. */
|
|
45
|
+
export declare function appStoreCredentialsPath(): string;
|
|
44
46
|
export declare function getAppStoreCredentials(): AppStoreCredentials | null;
|
|
45
47
|
export declare function saveAppStoreCredentials(creds: AppStoreCredentials): void;
|
|
46
48
|
export declare function generateToken(creds: AppStoreKey): Promise<string>;
|
package/dist/appstore/auth.js
CHANGED
|
@@ -5,6 +5,16 @@ import fs from 'node:fs';
|
|
|
5
5
|
import path from 'node:path';
|
|
6
6
|
import os from 'node:os';
|
|
7
7
|
import { writeCredentialJson } from '#core/atomic-write.js';
|
|
8
|
+
import { assertCredentialFileReadable } from '../lib/json-file.js';
|
|
9
|
+
import { catalog } from '#core/lang.js';
|
|
10
|
+
import { readCredentialFileSync } from '#core/credential-read.js';
|
|
11
|
+
const M = catalog({
|
|
12
|
+
vendorDigits: 'Vendor Number는 숫자만 입력하세요 (digits only).',
|
|
13
|
+
keyParse: (cause) => `App Store 개인 키 파싱 실패 — ~/.mimi-seed/appstore.json의 privateKey 형식 확인 필요.\n원인: ${cause}`,
|
|
14
|
+
}, {
|
|
15
|
+
vendorDigits: 'Vendor Number must contain digits only.',
|
|
16
|
+
keyParse: (cause) => `Failed to parse the App Store private key — check the privateKey format in ~/.mimi-seed/appstore.json.\nCause: ${cause}`,
|
|
17
|
+
});
|
|
8
18
|
// Primary location under ~/.mimi-seed. Legacy ~/.preseed read as fallback
|
|
9
19
|
// during the rebrand window so existing App Store Connect sessions don't
|
|
10
20
|
// force a re-setup.
|
|
@@ -16,7 +26,7 @@ export function normalizeVendorNumber(vendorNumber) {
|
|
|
16
26
|
if (!normalized)
|
|
17
27
|
return undefined;
|
|
18
28
|
if (!/^\d+$/.test(normalized)) {
|
|
19
|
-
throw new Error(
|
|
29
|
+
throw new Error(M().vendorDigits);
|
|
20
30
|
}
|
|
21
31
|
return normalized;
|
|
22
32
|
}
|
|
@@ -34,6 +44,10 @@ export function mergeAppStoreCredentials(existing, primary, vendorNumber) {
|
|
|
34
44
|
merged.vendorNumber = normalizedVendorNumber;
|
|
35
45
|
return merged;
|
|
36
46
|
}
|
|
47
|
+
/** getAppStoreCredentials 가 읽는 파일 — appstore.json, 없으면 레거시 경로. */
|
|
48
|
+
export function appStoreCredentialsPath() {
|
|
49
|
+
return !fs.existsSync(CONFIG_PATH) && fs.existsSync(LEGACY_CONFIG_PATH) ? LEGACY_CONFIG_PATH : CONFIG_PATH;
|
|
50
|
+
}
|
|
37
51
|
export function getAppStoreCredentials() {
|
|
38
52
|
const pathToRead = fs.existsSync(CONFIG_PATH)
|
|
39
53
|
? CONFIG_PATH
|
|
@@ -43,9 +57,10 @@ export function getAppStoreCredentials() {
|
|
|
43
57
|
if (!pathToRead)
|
|
44
58
|
return null;
|
|
45
59
|
try {
|
|
46
|
-
return JSON.parse(
|
|
60
|
+
return JSON.parse(readCredentialFileSync(pathToRead));
|
|
47
61
|
}
|
|
48
62
|
catch {
|
|
63
|
+
// 읽을 수 없으면 '미설정' — 깨진 파일은 assertAppStoreFileReadable · mimi_seed_status 가 json-file 로 따로 진단한다
|
|
49
64
|
return null;
|
|
50
65
|
}
|
|
51
66
|
}
|
|
@@ -74,7 +89,7 @@ export async function generateToken(creds) {
|
|
|
74
89
|
key = await importPKCS8(normalizedKey, 'ES256');
|
|
75
90
|
}
|
|
76
91
|
catch (err) {
|
|
77
|
-
throw new Error(
|
|
92
|
+
throw new Error(M().keyParse(err.message), { cause: err });
|
|
78
93
|
}
|
|
79
94
|
// Subtract 60s from iat to tolerate local clock running slightly ahead of Apple servers.
|
|
80
95
|
const iat = Math.floor(Date.now() / 1000) - 60;
|
|
@@ -112,10 +127,19 @@ function cachedToken(key) {
|
|
|
112
127
|
export function clearAppStoreTokenCache() {
|
|
113
128
|
tokenCache.clear();
|
|
114
129
|
}
|
|
130
|
+
/**
|
|
131
|
+
* 자격증명이 없을 때 호출자는 각자 "설정 없음" 안내를 던진다 — 그 전에, 파일이 있는데 깨진 경우라면 그 사실을
|
|
132
|
+
* 대신 알린다. ASC 도구 대부분은 requireAppStoreCreds 가 아니라 이 헤더 함수들을 거친다.
|
|
133
|
+
*/
|
|
134
|
+
function assertAppStoreFileReadable() {
|
|
135
|
+
assertCredentialFileReadable(appStoreCredentialsPath(), 'npx -y @yoonion/mimi-seed-mcp mimi-seed-appstore-auth');
|
|
136
|
+
}
|
|
115
137
|
export async function getAuthHeaders() {
|
|
116
138
|
const creds = getAppStoreCredentials();
|
|
117
|
-
if (!creds)
|
|
139
|
+
if (!creds) {
|
|
140
|
+
assertAppStoreFileReadable();
|
|
118
141
|
return null;
|
|
142
|
+
}
|
|
119
143
|
return { Authorization: `Bearer ${await cachedToken(creds)}` };
|
|
120
144
|
}
|
|
121
145
|
/**
|
|
@@ -126,8 +150,10 @@ export async function getAuthHeaders() {
|
|
|
126
150
|
*/
|
|
127
151
|
export async function getReportsAuthHeaders() {
|
|
128
152
|
const creds = getAppStoreCredentials();
|
|
129
|
-
if (!creds)
|
|
153
|
+
if (!creds) {
|
|
154
|
+
assertAppStoreFileReadable();
|
|
130
155
|
return null;
|
|
156
|
+
}
|
|
131
157
|
if (creds.reportsKey) {
|
|
132
158
|
return {
|
|
133
159
|
headers: { Authorization: `Bearer ${await cachedToken(creds.reportsKey)}` },
|
package/dist/appstore/client.js
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
1
|
-
import { getAppStoreCredentials, generateToken } from './auth.js';
|
|
1
|
+
import { appStoreCredentialsPath, getAppStoreCredentials, generateToken } from './auth.js';
|
|
2
2
|
import { authHeadersOrThrow, apiRequest, V1_BASE } from './http.js';
|
|
3
3
|
import { fetchWithTimeout } from '../lib/http.js';
|
|
4
|
+
import { jsonFileProblem } from '../lib/json-file.js';
|
|
5
|
+
import { catalog } from '#core/lang.js';
|
|
6
|
+
const M = catalog({
|
|
7
|
+
corrupt: (file, problem) => `${file} 이 손상되어 읽을 수 없습니다 (${problem}). \`mimi-seed auth appstore\` 로 다시 등록하세요.`,
|
|
8
|
+
missing: '~/.mimi-seed/appstore.json 이 없습니다. `mimi-seed auth appstore` 로 등록하세요.',
|
|
9
|
+
signFailed: (msg) => `JWT 서명 실패 — .p8 privateKey / keyId 확인 필요.\n${msg}`,
|
|
10
|
+
connectFailed: (msg) => `App Store API 연결 실패: ${msg}`,
|
|
11
|
+
rejected: 'Apple이 인증을 거부했어요 — issuerId / keyId / .p8 조합이 틀렸거나 키 권한이 부족합니다.\n`mimi-seed auth appstore` 로 재등록하세요.',
|
|
12
|
+
valid: '인증 유효',
|
|
13
|
+
}, {
|
|
14
|
+
corrupt: (file, problem) => `${file} is corrupted and cannot be read (${problem}). Register again with \`mimi-seed auth appstore\`.`,
|
|
15
|
+
missing: '~/.mimi-seed/appstore.json does not exist. Register with `mimi-seed auth appstore`.',
|
|
16
|
+
signFailed: (msg) => `JWT signing failed — check the .p8 privateKey / keyId.\n${msg}`,
|
|
17
|
+
connectFailed: (msg) => `App Store API connection failed: ${msg}`,
|
|
18
|
+
rejected: 'Apple rejected the credentials — the issuerId / keyId / .p8 combination is wrong or the key lacks permission.\nRegister again with `mimi-seed auth appstore`.',
|
|
19
|
+
valid: 'Credentials valid',
|
|
20
|
+
});
|
|
4
21
|
/**
|
|
5
22
|
* App Store Connect API v1 래퍼
|
|
6
23
|
* https://developer.apple.com/documentation/appstoreconnectapi
|
|
@@ -18,10 +35,14 @@ export async function apiGet(path, params) {
|
|
|
18
35
|
*/
|
|
19
36
|
export async function verifyAppStoreCredentials(creds = getAppStoreCredentials()) {
|
|
20
37
|
if (!creds) {
|
|
38
|
+
const file = appStoreCredentialsPath();
|
|
39
|
+
const problem = jsonFileProblem(file);
|
|
21
40
|
return {
|
|
22
41
|
ok: false,
|
|
23
42
|
stage: 'creds',
|
|
24
|
-
message:
|
|
43
|
+
message: problem
|
|
44
|
+
? M().corrupt(file, problem)
|
|
45
|
+
: M().missing,
|
|
25
46
|
};
|
|
26
47
|
}
|
|
27
48
|
let token;
|
|
@@ -32,7 +53,7 @@ export async function verifyAppStoreCredentials(creds = getAppStoreCredentials()
|
|
|
32
53
|
return {
|
|
33
54
|
ok: false,
|
|
34
55
|
stage: 'sign',
|
|
35
|
-
message:
|
|
56
|
+
message: M().signFailed(e.message),
|
|
36
57
|
};
|
|
37
58
|
}
|
|
38
59
|
let res;
|
|
@@ -40,14 +61,14 @@ export async function verifyAppStoreCredentials(creds = getAppStoreCredentials()
|
|
|
40
61
|
res = await fetchWithTimeout(`${BASE}/apps?limit=1`, { headers: { Authorization: `Bearer ${token}` } });
|
|
41
62
|
}
|
|
42
63
|
catch (e) {
|
|
43
|
-
return { ok: false, stage: 'api', message:
|
|
64
|
+
return { ok: false, stage: 'api', message: M().connectFailed(e.message) };
|
|
44
65
|
}
|
|
45
66
|
if (res.status === 401 || res.status === 403) {
|
|
46
67
|
return {
|
|
47
68
|
ok: false,
|
|
48
69
|
stage: 'auth',
|
|
49
70
|
httpStatus: res.status,
|
|
50
|
-
message:
|
|
71
|
+
message: M().rejected,
|
|
51
72
|
};
|
|
52
73
|
}
|
|
53
74
|
if (!res.ok) {
|
|
@@ -59,7 +80,7 @@ export async function verifyAppStoreCredentials(creds = getAppStoreCredentials()
|
|
|
59
80
|
return {
|
|
60
81
|
ok: true,
|
|
61
82
|
stage: 'done',
|
|
62
|
-
message:
|
|
83
|
+
message: M().valid,
|
|
63
84
|
appCount: data.meta?.paging?.total,
|
|
64
85
|
firstApp: first ? { id: first.id, name: first.attributes?.name } : undefined,
|
|
65
86
|
};
|
|
@@ -8,6 +8,22 @@
|
|
|
8
8
|
import { V1_BASE, V2_BASE, apiRequest, authHeadersOrThrow, isNotFound } from './http.js';
|
|
9
9
|
import { requireAppInfo } from './app-info.js';
|
|
10
10
|
import { encodePathSegment } from '../lib/url-path.js';
|
|
11
|
+
import { catalog } from '#core/lang.js';
|
|
12
|
+
const M = catalog({
|
|
13
|
+
nothingToChange: '바꿀 항목이 하나도 없다 — declaration 에 최소 한 필드는 넣어야 한다.',
|
|
14
|
+
noDeclaration: '❌ 이 앱에는 연령 등급 선언 리소스가 없다.',
|
|
15
|
+
noDeclarationHint: 'App Store Connect 에서 앱을 한 번 연 뒤 다시 시도하거나, appInfo 상태를 확인할 것.',
|
|
16
|
+
verifyFailed: (id) => `연령등급 변경 요청 후 대상 선언 ${id}의 저장 결과를 확인할 수 없습니다.`,
|
|
17
|
+
exportNoId: (json) => `수출 규정 선언 생성 응답에 id 가 없다: ${json}`,
|
|
18
|
+
noFields: '바꿀 필드가 없음',
|
|
19
|
+
}, {
|
|
20
|
+
nothingToChange: 'Nothing to change — declaration must contain at least one field.',
|
|
21
|
+
noDeclaration: '❌ This app has no age rating declaration resource.',
|
|
22
|
+
noDeclarationHint: 'Open the app once in App Store Connect and try again, or check the appInfo state.',
|
|
23
|
+
verifyFailed: (id) => `Cannot confirm the saved result of target declaration ${id} after the age rating update request.`,
|
|
24
|
+
exportNoId: (json) => `Export compliance declaration creation response has no id: ${json}`,
|
|
25
|
+
noFields: 'No fields to change',
|
|
26
|
+
});
|
|
11
27
|
async function get(base, path, params) {
|
|
12
28
|
const headers = await authHeadersOrThrow();
|
|
13
29
|
const query = params ? `?${new URLSearchParams(params).toString()}` : '';
|
|
@@ -50,19 +66,19 @@ export async function updateAgeRating(args) {
|
|
|
50
66
|
const { appId, declaration } = args;
|
|
51
67
|
const attributes = Object.fromEntries(Object.entries(declaration).filter(([, v]) => v !== undefined));
|
|
52
68
|
if (Object.keys(attributes).length === 0) {
|
|
53
|
-
throw new Error(
|
|
69
|
+
throw new Error(M().nothingToChange);
|
|
54
70
|
}
|
|
55
71
|
const current = await getAgeRating(appId);
|
|
56
72
|
if (!current.declarationId) {
|
|
57
73
|
throw new Error([
|
|
58
|
-
|
|
59
|
-
|
|
74
|
+
M().noDeclaration,
|
|
75
|
+
M().noDeclarationHint,
|
|
60
76
|
].join('\n'));
|
|
61
77
|
}
|
|
62
78
|
await send(V1_BASE, 'PATCH', `/ageRatingDeclarations/${encodePathSegment(current.declarationId)}`, {
|
|
63
79
|
data: { type: 'ageRatingDeclarations', id: current.declarationId, attributes },
|
|
64
80
|
});
|
|
65
|
-
const verificationError =
|
|
81
|
+
const verificationError = M().verifyFailed(current.declarationId);
|
|
66
82
|
const after = await readAppInfoAgeRating(current.appInfoId).catch((error) => {
|
|
67
83
|
throw new Error(verificationError, { cause: error });
|
|
68
84
|
});
|
|
@@ -88,7 +104,7 @@ export async function declareEncryption(args) {
|
|
|
88
104
|
});
|
|
89
105
|
const declarationId = created.data?.id;
|
|
90
106
|
if (!declarationId)
|
|
91
|
-
throw new Error(
|
|
107
|
+
throw new Error(M().exportNoId(JSON.stringify(created)));
|
|
92
108
|
if (buildIds.length > 0) {
|
|
93
109
|
await send(V1_BASE, 'POST', `/appEncryptionDeclarations/${encodePathSegment(declarationId)}/relationships/builds`, {
|
|
94
110
|
data: buildIds.map((id) => ({ type: 'builds', id })),
|
|
@@ -143,7 +159,7 @@ export async function setTerritoryAvailability(args) {
|
|
|
143
159
|
if (t.preOrderEnabled !== undefined)
|
|
144
160
|
attributes.preOrderEnabled = t.preOrderEnabled;
|
|
145
161
|
if (Object.keys(attributes).length === 0) {
|
|
146
|
-
results.push({ id: t.id, ok: false, error:
|
|
162
|
+
results.push({ id: t.id, ok: false, error: M().noFields });
|
|
147
163
|
continue;
|
|
148
164
|
}
|
|
149
165
|
try {
|
|
@@ -38,7 +38,7 @@ declare function formatAppleError(e: AppleError): string;
|
|
|
38
38
|
*/
|
|
39
39
|
export declare function friendlyAppStoreError(status: number, body: string): Error;
|
|
40
40
|
export declare const __testing: {
|
|
41
|
-
CODE_HINTS: Record<string, string>;
|
|
41
|
+
readonly CODE_HINTS: Record<string, string>;
|
|
42
42
|
parseAppleErrorBody: typeof parseAppleErrorBody;
|
|
43
43
|
formatAppleError: typeof formatAppleError;
|
|
44
44
|
};
|