apphx 1.1.0 → 2.0.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.
Files changed (120) hide show
  1. package/README.md +50 -182
  2. package/benchmarks/peer-context-worker.mjs +186 -0
  3. package/benchmarks/peer-context.mjs +150 -0
  4. package/dist/apple-types.js.map +1 -1
  5. package/dist/cli.js +370 -118
  6. package/dist/cli.js.map +1 -1
  7. package/dist/config.js +42 -4
  8. package/dist/config.js.map +1 -1
  9. package/dist/dependencies.js +455 -16
  10. package/dist/dependencies.js.map +1 -1
  11. package/dist/export-options.js +44 -2
  12. package/dist/export-options.js.map +1 -1
  13. package/dist/flutter.js +13 -25
  14. package/dist/flutter.js.map +1 -1
  15. package/dist/go-dependencies.js +389 -0
  16. package/dist/go-dependencies.js.map +1 -0
  17. package/dist/inbox.js +7 -8
  18. package/dist/inbox.js.map +1 -1
  19. package/dist/integrations.js +3 -3
  20. package/dist/isolation.js +190 -0
  21. package/dist/isolation.js.map +1 -0
  22. package/dist/macos.js +57 -0
  23. package/dist/macos.js.map +1 -0
  24. package/dist/mygo-build.js +55 -0
  25. package/dist/mygo-build.js.map +1 -0
  26. package/dist/policy.js +35 -0
  27. package/dist/policy.js.map +1 -0
  28. package/dist/preflight.js +1 -1
  29. package/dist/process.js +3 -3
  30. package/dist/project-profiles.js +163 -0
  31. package/dist/project-profiles.js.map +1 -0
  32. package/dist/proof.js +33 -0
  33. package/dist/proof.js.map +1 -0
  34. package/dist/remote.js +1 -1
  35. package/dist/runner.js +269 -287
  36. package/dist/runner.js.map +1 -1
  37. package/dist/scheduler.js +0 -3
  38. package/dist/scheduler.js.map +1 -1
  39. package/dist/schemas.js +156 -44
  40. package/dist/schemas.js.map +1 -1
  41. package/dist/store.js +166 -44
  42. package/dist/store.js.map +1 -1
  43. package/dist/vendor/obfuscator/dist/cli.js +72 -0
  44. package/dist/vendor/obfuscator/dist/cli.js.map +1 -0
  45. package/dist/vendor/obfuscator/dist/code.js +585 -0
  46. package/dist/vendor/obfuscator/dist/code.js.map +1 -0
  47. package/dist/vendor/obfuscator/dist/common.js +262 -0
  48. package/dist/vendor/obfuscator/dist/common.js.map +1 -0
  49. package/dist/vendor/obfuscator/dist/config.js +123 -0
  50. package/dist/vendor/obfuscator/dist/config.js.map +1 -0
  51. package/dist/vendor/obfuscator/dist/content.js +89 -0
  52. package/dist/vendor/obfuscator/dist/content.js.map +1 -0
  53. package/dist/vendor/obfuscator/dist/obfuscate.js +93 -0
  54. package/dist/vendor/obfuscator/dist/obfuscate.js.map +1 -0
  55. package/dist/vendor/obfuscator/dist/png.js +283 -0
  56. package/dist/vendor/obfuscator/dist/png.js.map +1 -0
  57. package/dist/vendor/obfuscator/dist/project.js +159 -0
  58. package/dist/vendor/obfuscator/dist/project.js.map +1 -0
  59. package/dist/vendor/obfuscator/dist/resources.js +335 -0
  60. package/dist/vendor/obfuscator/dist/resources.js.map +1 -0
  61. package/dist/vendor/obfuscator/package.json +22 -0
  62. package/dist/workspace.js +113 -0
  63. package/dist/workspace.js.map +1 -0
  64. package/evals/control.mjs +73 -0
  65. package/evals/expectations.mjs +37 -0
  66. package/evals/host.mjs +51 -0
  67. package/evals/oracle.mjs +80 -0
  68. package/evals/policy.mjs +268 -0
  69. package/examples/android-java.factory.json +18 -0
  70. package/examples/android-java.json +16 -0
  71. package/examples/existing-project.factory.json +18 -0
  72. package/examples/existing-project.json +17 -0
  73. package/examples/expo.eas.json +17 -0
  74. package/examples/expo.factory.json +18 -0
  75. package/examples/expo.json +16 -0
  76. package/examples/factory.json +0 -2
  77. package/examples/flutter.factory.json +13 -0
  78. package/examples/flutter.json +16 -0
  79. package/examples/luggage.json +5 -3
  80. package/examples/mygo-web.factory.json +18 -0
  81. package/examples/mygo-web.json +16 -0
  82. package/examples/mygo.factory.json +18 -0
  83. package/examples/mygo.json +16 -0
  84. package/examples/react-native.factory.json +18 -0
  85. package/examples/react-native.json +16 -0
  86. package/examples/runtime/android-java/app/build.gradle +7 -0
  87. package/examples/runtime/android-java/app/src/main/AndroidManifest.xml +8 -0
  88. package/examples/runtime/android-java/app/src/main/java/dev/apphx/runtime/MainActivity.java +44 -0
  89. package/examples/runtime/android-java/sdk-build.mjs +29 -0
  90. package/examples/runtime/android-java/settings.gradle +2 -0
  91. package/examples/runtime/android-ui.mjs +70 -0
  92. package/examples/runtime/mygo-native/go.mod +13 -0
  93. package/examples/runtime/mygo-native/go.sum +10 -0
  94. package/examples/runtime/mygo-native/main.go +173 -0
  95. package/examples/runtime/mygo-native/main_test.go +14 -0
  96. package/examples/runtime/mygo-native/mygo.json +1 -0
  97. package/examples/runtime/mygo-web/bun.lock +15 -0
  98. package/examples/runtime/mygo-web/go.mod +9 -0
  99. package/examples/runtime/mygo-web/go.sum +8 -0
  100. package/examples/runtime/mygo-web/index.html +1 -0
  101. package/examples/runtime/mygo-web/main.go +60 -0
  102. package/examples/runtime/mygo-web/mygo.config.ts +10 -0
  103. package/examples/runtime/mygo-web/package.json +1 -0
  104. package/examples/runtime/mygo-web/src/main.ts +23 -0
  105. package/examples/runtime/mygo-web/src/mygo.ts +14 -0
  106. package/examples/swift.factory.json +18 -0
  107. package/examples/swift.json +16 -0
  108. package/examples/uni-app.factory.json +18 -0
  109. package/examples/uni-app.json +16 -0
  110. package/package.json +12 -5
  111. package/scripts/bundle-obfuscator.mjs +19 -0
  112. package/scripts/runtime-smoke.mjs +209 -0
  113. package/skills/apphx/SKILL.md +94 -17
  114. package/skills/apphx/resources/google-play-research-result.json +6 -0
  115. package/skills/apphx/resources/local-research-result.json +6 -0
  116. package/skills/apphx/resources/requirement.json +5 -8
  117. package/skills/apphx/resources/research-result.json +5 -14
  118. package/skills/apphx/resources/review-result.json +1 -1
  119. package/dist/apple.js +0 -900
  120. package/dist/apple.js.map +0 -1
package/dist/apple.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"apple.js","names":["defaultRun","run"],"sources":["../src/apple.ts"],"sourcesContent":["import { createHash, createPrivateKey, sign } from 'node:crypto';\nimport type { KeyObject } from 'node:crypto';\nimport { copyFile, chmod, mkdtemp, readdir, readFile, rm, stat } from 'node:fs/promises';\nimport { tmpdir } from 'node:os';\nimport { basename, join } from 'node:path';\nimport { z } from 'zod';\nimport { run as defaultRun } from './process.js';\nimport type { Run } from './process.js';\nimport type { AppleSpec, Spec } from './schemas.js';\nimport type { ApplePollResult, AppleReceipt } from './apple-types.js';\nexport { AppleReceiptSchema } from './apple-types.js';\nexport type { ApplePollResult, AppleReceipt } from './apple-types.js';\n\nconst UploadOperationSchema = z.object({\n url: z.string(), method: z.string(), offset: z.number().finite(), length: z.number().finite(),\n requestHeaders: z.array(z.object({ name: z.string(), value: z.string() })).nullish(),\n});\nconst AttributesSchema = z.object({\n bundleId: z.string().optional(), appVersionState: z.string().nullish(), appStoreState: z.string().nullish(), state: z.string().nullish(),\n processingState: z.string().optional(), usesNonExemptEncryption: z.boolean().nullish(),\n copyright: z.string().optional(), releaseType: z.string().optional(), locale: z.string().optional(),\n description: z.string().optional(), keywords: z.string().optional(), supportUrl: z.string().optional(), whatsNew: z.string().optional(),\n privacyPolicyUrl: z.string().optional(), contactFirstName: z.string().optional(), contactLastName: z.string().optional(),\n contactEmail: z.string().optional(), contactPhone: z.string().optional(), notes: z.string().optional(), demoAccountRequired: z.boolean().optional(),\n screenshotDisplayType: z.string().optional(), fileName: z.string().optional(), sourceFileChecksum: z.string().nullish(),\n assetDeliveryState: z.object({ state: z.string().optional() }).nullish(),\n uploadOperations: z.array(UploadOperationSchema).nullish(),\n});\nconst ResourceSchema = z.object({\n id: z.string().min(1), type: z.string().optional(), attributes: AttributesSchema.default({}),\n relationships: z.object({ appStoreVersion: z.object({ data: z.object({ id: z.string(), type: z.string().optional() }).nullish() }).optional() }).optional(),\n});\nconst ResponseSchema = z.object({\n data: z.union([ResourceSchema, z.array(ResourceSchema)]).nullish(),\n links: z.object({ next: z.string().nullish() }).optional(),\n});\nconst ErrorResponseSchema = z.object({ errors: z.array(z.object({ code: z.string().optional(), detail: z.string().nullish(), title: z.string().optional() })).optional() });\nconst ListingSchema = z.object({ results: z.array(z.object({ bundleId: z.string().optional(), version: z.string().optional() })) });\ntype Resource = z.infer<typeof ResourceSchema>;\ntype ResourceAttributes = z.infer<typeof AttributesSchema>;\ntype AppleResponse = z.infer<typeof ResponseSchema>;\ntype WriteMethod = 'POST' | 'PATCH' | 'PUT';\ninterface RequestOptions { method?: string; body?: unknown; optional?: boolean }\ninterface AppleClient {\n request(path: string, options?: RequestOptions & { optional?: false }): Promise<AppleResponse>;\n request(path: string, options: RequestOptions & { optional: true }): Promise<AppleResponse | null>;\n list(path: string | null | undefined): Promise<Resource[]>;\n credentials: { keyId: string; issuerId: string; keyPath: string };\n}\ntype Persist = (patch?: Partial<AppleReceipt>) => Promise<void>;\ntype Write = (key: string, path: string, method: WriteMethod, body: unknown) => Promise<Resource | undefined>;\ntype Reconcile = (key: string, resource: Resource) => Promise<Resource>;\ntype LocalInventory = Map<string, Map<string, { bytes: Buffer; checksum: string }>>;\nconst publishingFields = ['appId', 'bundleId', 'version', 'buildNumber', 'locale', 'description', 'keywords', 'supportUrl', 'privacyPolicyUrl', 'reviewNotes', 'copyright'] as const;\nconst contactFields = ['firstName', 'lastName', 'email', 'phone'] as const;\nexport type PublishingSpec = AppleSpec & Required<Pick<AppleSpec, typeof publishingFields[number]>> & { contact: Required<NonNullable<AppleSpec['contact']>>; manualSetupConfirmed: true };\ninterface AppleOptions { spec: Pick<Spec, 'apple'>; state?: AppleReceipt; env?: NodeJS.ProcessEnv; signal?: AbortSignal }\ninterface ShipOptions extends AppleOptions { ipaPath: string; save: (receipt: AppleReceipt) => void | Promise<unknown>; run?: Run; allowRelease?: boolean }\ninterface ScreenshotOptions {\n api: AppleClient; apple: PublishingSpec; localization: Resource;\n receipt: () => AppleReceipt; persist: Persist; write: Write; reconcile: Reconcile; signal?: AbortSignal;\n}\nfunction message(error: unknown): string { return error instanceof Error ? error.message : String(error); }\nfunction textAttribute(value: string | null | undefined): string {\n if (value === undefined || value === null) throw failure('App Store Connect returned a resource missing a required text field.', 'APPLE_API_ERROR');\n return value;\n}\nfunction resource(value: AppleResponse['data'] | undefined): Resource {\n if (!value || Array.isArray(value)) throw failure('App Store Connect returned an invalid resource.', 'APPLE_API_ERROR');\n return value;\n}\nfunction optionalResource(response: AppleResponse | null): Resource | undefined {\n return response?.data == null ? undefined : resource(response.data);\n}\n\nconst API = 'https://api.appstoreconnect.apple.com';\nconst editable = new Set<string | null | undefined>(['PREPARE_FOR_SUBMISSION', 'DEVELOPER_REJECTED', 'METADATA_REJECTED', 'REJECTED']);\nconst approved = new Set<string | null | undefined>(['ACCEPTED', 'PENDING_DEVELOPER_RELEASE', 'PENDING_APPLE_RELEASE', 'READY_FOR_SALE', 'READY_FOR_DISTRIBUTION', 'PROCESSING_FOR_DISTRIBUTION', 'PROCESSING_FOR_APP_STORE']);\nconst rejected = new Set<string | null | undefined>(['REJECTED', 'METADATA_REJECTED', 'INVALID_BINARY', 'DEVELOPER_REJECTED']);\nconst versionState = (resource: Resource) => resource.attributes.appVersionState ?? resource.attributes.appStoreState;\nconst ref = (type: string, id: string) => ({ data: { type, id } });\nconst matches = (resource: Resource, attributes: ResourceAttributes) => (Object.keys(attributes) as (keyof ResourceAttributes)[]).every(key => resource.attributes[key] === attributes[key]);\nconst query = (path: string, values: Record<string, string | number>) => `${path}?${new URLSearchParams(Object.entries(values).map(([key, value]) => [key, String(value)]))}`;\n\nfunction failure(message: string, code = 'APPLE_SETUP_REQUIRED') {\n return Object.assign(new Error(message), { code });\n}\n\nfunction requestFailure(message: string, code: string, httpStatus: number | null = null, transient = httpStatus === 408 || httpStatus === 429 || (httpStatus !== null && httpStatus >= 500)) {\n return Object.assign(failure(message, code), {\n httpStatus,\n transient,\n outcome: httpStatus !== null && httpStatus >= 400 && httpStatus < 500 && httpStatus !== 408 ? 'rejected' : 'unknown',\n });\n}\n\nfunction credential(env: NodeJS.ProcessEnv, key: string): string {\n const value = env[key];\n if (!value) throw failure(`Set ${key} in the publisher environment. App Store Connect requires a team API key with App Manager or Admin access.`);\n return value;\n}\n\nasync function client(env: NodeJS.ProcessEnv, signal?: AbortSignal): Promise<AppleClient> {\n const keyId = credential(env, 'ASC_KEY_ID');\n const issuerId = credential(env, 'ASC_ISSUER_ID');\n const keyPath = credential(env, 'ASC_PRIVATE_KEY_PATH');\n if (!/^[A-Za-z0-9]+$/.test(keyId)) throw failure('ASC_KEY_ID must be an App Store Connect key identifier.');\n let key: KeyObject;\n try {\n key = createPrivateKey(await readFile(keyPath));\n } catch (error) {\n throw failure(`Cannot load ASC_PRIVATE_KEY_PATH as a private signing key: ${message(error)}`);\n }\n if (key.asymmetricKeyType !== 'ec' || key.asymmetricKeyDetails?.namedCurve !== 'prime256v1') {\n throw failure('ASC_PRIVATE_KEY_PATH must contain the P-256 private key downloaded from App Store Connect for ES256 authentication.');\n }\n let token: string | undefined;\n let expires = 0;\n async function request(path: string, options?: RequestOptions & { optional?: false }): Promise<AppleResponse>;\n async function request(path: string, options: RequestOptions & { optional: true }): Promise<AppleResponse | null>;\n async function request(path: string, { method = 'GET', body, optional = false }: RequestOptions = {}): Promise<AppleResponse | null> {\n const url = new URL(path, API);\n if (url.origin !== API || !/^\\/v[12]\\//.test(url.pathname)) throw failure('Apple returned an unexpected API URL; refusing to send publisher credentials.', 'APPLE_API_ERROR');\n const now = Math.floor(Date.now() / 1000);\n if (expires < now + 30) {\n expires = now + 600;\n const encode = (value: unknown) => Buffer.from(JSON.stringify(value)).toString('base64url');\n const input = `${encode({ alg: 'ES256', kid: env.ASC_KEY_ID, typ: 'JWT' })}.${encode({ iss: env.ASC_ISSUER_ID, iat: now, exp: expires, aud: 'appstoreconnect-v1' })}`;\n token = `${input}.${sign('sha256', Buffer.from(input), { key, dsaEncoding: 'ieee-p1363' }).toString('base64url')}`;\n }\n let response: Response;\n try {\n response = await fetch(url, {\n method, redirect: 'error', signal: signal ? AbortSignal.any([signal, AbortSignal.timeout(30000)]) : AbortSignal.timeout(30000),\n headers: { Authorization: `Bearer ${token}`, Accept: 'application/json', ...(body ? { 'Content-Type': 'application/json' } : {}) },\n ...(body ? { body: JSON.stringify(body) } : {}),\n });\n } catch (error) {\n throw requestFailure(`App Store Connect ${method} ${url.pathname} did not complete: ${message(error)}. Resume to reconcile saved writes; do not repeat an upload manually.`, 'APPLE_API_ERROR', null, true);\n }\n if (optional && response.status === 404) return null;\n const httpCode = response.status === 429 ? 'APPLE_RATE_LIMIT' : response.status >= 500 || response.status === 408 || response.ok ? 'APPLE_API_ERROR' : 'APPLE_SETUP_REQUIRED';\n let text: string;\n try { text = await response.text(); } catch (error) {\n throw requestFailure(`App Store Connect ${method} ${url.pathname} response body was lost (HTTP ${response.status}): ${message(error)}. Resume to reconcile saved writes.`, httpCode, response.status, response.ok || response.status === 408 || response.status === 429 || response.status >= 500);\n }\n let data: unknown;\n try { data = text ? JSON.parse(text) : {}; } catch { throw requestFailure(`App Store Connect returned non-JSON data for ${url.pathname} (HTTP ${response.status}).`, httpCode, response.status); }\n if (!response.ok) {\n const errors = ErrorResponseSchema.safeParse(data);\n const detail = (errors.success ? errors.data.errors?.map(error => `${error.code}: ${error.detail ?? error.title}`).join('; ') : '') || response.statusText;\n throw requestFailure(`App Store Connect ${method} ${url.pathname} failed (HTTP ${response.status}): ${detail}${response.status === 429 ? '. Request limit reached; resume later. No write was retried.' : ''}`, httpCode, response.status);\n }\n const parsed = ResponseSchema.safeParse(data);\n if (!parsed.success) throw requestFailure(`App Store Connect returned invalid resource data for ${url.pathname} (HTTP ${response.status}): ${parsed.error.message}`, httpCode, response.status);\n return parsed.data;\n }\n async function list(path: string | null | undefined): Promise<Resource[]> {\n const result: Resource[] = [];\n for (let page = 0; path; page++) {\n if (page >= 100) throw failure('App Store Connect pagination exceeded 100 pages; narrow the app/version selection.', 'APPLE_API_ERROR');\n const response = await request(path);\n if (!Array.isArray(response.data)) throw failure('App Store Connect returned an invalid resource list.', 'APPLE_API_ERROR');\n result.push(...response.data);\n path = response.links?.next;\n }\n return result;\n }\n return { request, list, credentials: { keyId, issuerId, keyPath } };\n}\n\nexport async function appleDoctor({ env = process.env }: { env?: NodeJS.ProcessEnv } = {}) {\n const checks: { name: string; available: boolean; detail: string }[] = [];\n try {\n const api = await client(env);\n await api.request('/v1/apps?limit=1');\n checks.push({ name: 'App Store Connect API', available: true, detail: 'Team key authenticated with read access. Submission permissions and app setup are checked when shipping.' });\n } catch (error) {\n checks.push({ name: 'App Store Connect API', available: false, detail: message(error) });\n }\n try {\n const result = await defaultRun(['xcrun', 'altool', '--help'], { env, timeoutMs: 30000 });\n const supported = result.code === 0 && `${result.stdout}\\n${result.stderr}`.includes('--upload-package');\n checks.push({ name: 'Apple binary uploader', available: supported, detail: supported ? 'xcrun altool supports package upload. No binary was uploaded.' : 'Install/select full Xcode with a current altool supporting --upload-package; Command Line Tools alone are insufficient.' });\n } catch (error) {\n checks.push({ name: 'Apple binary uploader', available: false, detail: `Cannot invoke xcrun altool: ${message(error)}. Install/select full Xcode.` });\n }\n return checks;\n}\n\nexport function validateAppleSpec(spec: Pick<Spec, 'apple'>): PublishingSpec {\n const apple = spec?.apple;\n for (const field of publishingFields) {\n const value = apple?.[field];\n if (typeof value !== 'string' || !value.trim()) throw failure(`spec.apple.${field} is required before shipping. Provide real publisher metadata, not generated placeholders.`);\n }\n for (const field of contactFields) {\n const value = apple?.contact?.[field];\n if (typeof value !== 'string' || !value.trim()) throw failure(`spec.apple.contact.${field} is required for App Review.`);\n }\n for (const field of ['supportUrl', 'privacyPolicyUrl'] as const) {\n let url: URL;\n try { url = new URL(apple?.[field] ?? ''); } catch { throw failure(`spec.apple.${field} must be a public HTTPS URL.`); }\n if (url.protocol !== 'https:' || url.username || url.password) throw failure(`spec.apple.${field} must be a public HTTPS URL without credentials.`);\n }\n if (apple?.manualSetupConfirmed !== true) throw failure('Complete App Store Connect agreements, app privacy disclosures, age rating, content rights, export compliance, pricing/availability and applicable trader/legal declarations. Then set spec.apple.manualSetupConfirmed=true as the publisher’s attestation. Automation cannot answer these declarations for you.');\n return apple as PublishingSpec;\n}\n\nasync function findVersion(api: AppleClient, appId: string, version: string): Promise<Resource | undefined> {\n const versions = await api.list(query(`/v1/apps/${encodeURIComponent(appId)}/appStoreVersions`, { 'filter[platform]': 'IOS', 'filter[versionString]': version, limit: 200 }));\n if (versions.length > 1) throw failure('Multiple matching iOS App Store versions were returned; resolve the app record in App Store Connect.', 'APPLE_API_ERROR');\n return versions[0];\n}\n\nasync function requireSelectedBuild(api: AppleClient, versionId: string, buildId: string | undefined) {\n if (!buildId) throw failure('The saved Apple receipt has no build ID. Restore the receipt for the verified upload before resuming.', 'APPLE_STATE_MISMATCH');\n const selected = optionalResource(await api.request(`/v1/appStoreVersions/${encodeURIComponent(versionId)}/build`, { optional: true }));\n if (selected?.id !== buildId) throw failure('The selected App Store build differs from this job’s saved upload. Restore the verified build in App Store Connect before resuming.', 'APPLE_STATE_MISMATCH');\n}\n\nfunction requireDeliveryProvenance(receipt: AppleReceipt): void {\n if (receipt.upload && receipt.upload.status !== 'delivered') throw failure('The saved upload has no successful delivery receipt. App Store Connect cannot prove that a matching build came from this IPA. Check Apple delivery history; do not select a build, submit, or upload again from this job.', 'APPLE_WRITE_UNCERTAIN');\n}\n\nexport async function shipApple({ spec, ipaPath, state = {}, save, run = defaultRun, env = process.env, signal, allowRelease = false }: ShipOptions): Promise<AppleReceipt> {\n const apple = validateAppleSpec(spec);\n const releaseType = allowRelease === true ? 'AFTER_APPROVAL' : 'MANUAL';\n if (allowRelease && !/^[A-Za-z]{2}$/.test(apple.storefrontCountry ?? '')) throw failure('Automatic release requires apple.storefrontCountry as a two-letter country code so public listing availability can be checked.');\n if (typeof save !== 'function') throw failure('shipApple requires a durable save callback before it can make external writes.', 'APPLE_STATE_REQUIRED');\n let receipt: AppleReceipt = structuredClone(state);\n const identity = { appId: apple.appId, bundleId: apple.bundleId, version: apple.version, buildNumber: apple.buildNumber };\n if (receipt.identity && JSON.stringify(receipt.identity) !== JSON.stringify(identity)) throw failure('The saved Apple receipt belongs to another app/version/build. Resume the original job or create a new job.', 'APPLE_STATE_MISMATCH');\n requireDeliveryProvenance(receipt);\n receipt.identity = identity;\n async function persist(patch: Partial<AppleReceipt> = {}) {\n receipt = { ...receipt, ...patch };\n await save(structuredClone(receipt));\n }\n async function reconcile(key: string, resource: Resource) {\n if (receipt.pending?.key === key) await persist({ pending: null, effects: { ...receipt.effects, [key]: { id: resource?.id } }, lastEffect: { key, id: resource?.id, reconciled: true } });\n return resource;\n }\n async function write(key: string, path: string, method: WriteMethod, body: unknown): Promise<Resource | undefined> {\n if (receipt.pending) throw failure(`The saved write “${receipt.pending.key}” has an uncertain outcome. Resume after checking App Store Connect; this factory will not duplicate it.`, 'APPLE_WRITE_UNCERTAIN');\n await persist({ pending: { key, path, method, startedAt: new Date().toISOString() } });\n let result: Resource | undefined;\n try {\n result = optionalResource(await api.request(path, { method, body }));\n if (method === 'POST' && !result) throw requestFailure('App Store Connect returned no resource for a creation request. Resume to reconcile saved writes.', 'APPLE_API_ERROR');\n } catch (error) {\n if (error instanceof Error && 'outcome' in error && error.outcome === 'rejected') await persist({ pending: null });\n throw error;\n }\n await persist({ pending: null, effects: { ...receipt.effects, [key]: { id: result?.id } }, lastEffect: { key, id: result?.id, completedAt: new Date().toISOString() } });\n return result;\n }\n async function ensureAttributes(current: Resource, attributes: ResourceAttributes, key: string): Promise<Resource> {\n if (matches(current, attributes)) return reconcile(key, current);\n const type = textAttribute(current.type);\n return resource(await write(key, `/v1/${type}/${encodeURIComponent(current.id)}`, 'PATCH', { data: { type, id: current.id, attributes } }));\n }\n const api = await client(env, signal);\n const app = resource((await api.request(`/v1/apps/${encodeURIComponent(apple.appId)}`)).data);\n if (app.attributes.bundleId !== apple.bundleId) throw failure('spec.apple.appId and bundleId identify different apps. Correct the publisher specification before uploading.');\n await persist();\n let version = await findVersion(api, apple.appId, apple.version);\n if (version && !editable.has(versionState(version))) {\n const submissionId = receipt.submissionId ?? receipt.effects?.['create-review-submission']?.id;\n if (!submissionId || (receipt.versionId && receipt.versionId !== version.id)) throw failure(`Version ${apple.version} is ${versionState(version)} and has no matching submission receipt. Inspect it in App Store Connect; this factory will not overwrite or resubmit it.`, 'APPLE_WRITE_UNCERTAIN');\n await requireSelectedBuild(api, version.id, receipt.buildId);\n const submission = resource((await api.request(`/v1/reviewSubmissions/${encodeURIComponent(submissionId)}`)).data);\n const items = await api.list(`/v1/reviewSubmissions/${submission.id}/items?include=appStoreVersion&limit=200`);\n const versionId = version.id;\n const item = items.find(item => item.relationships?.appStoreVersion?.data?.id === versionId);\n if (!item || items.length !== 1) throw failure('The saved submission does not contain only this app version. Inspect it in App Store Connect before submitting.', 'APPLE_WRITE_UNCERTAIN');\n await reconcile('add-review-item', item);\n if (submission.attributes.state === 'READY_FOR_REVIEW') {\n if (apple.screenshotsDir) {\n const localizations = await api.list(`/v1/appStoreVersions/${version.id}/appStoreVersionLocalizations?limit=200`);\n const localization = localizations.find(item => item.attributes.locale === apple.locale);\n if (!localization) throw failure(`No ${apple.locale} App Store version localization exists. Restore the screenshot localization in App Store Connect before submitting.`, 'APPLE_STATE_MISMATCH');\n await verifyScreenshots({ api, apple, localization, localInventory: await readLocalScreenshots(apple.screenshotsDir) });\n }\n await write('submit-review', `/v1/reviewSubmissions/${submission.id}`, 'PATCH', { data: { type: 'reviewSubmissions', id: submission.id, attributes: { submitted: true } } });\n } else if (['WAITING_FOR_REVIEW', 'IN_REVIEW', 'COMPLETING', 'COMPLETE'].includes(submission.attributes.state ?? '')) await reconcile('submit-review', submission);\n else throw failure(`Review submission is ${submission.attributes.state}. Resolve review issues in App Store Connect; no resubmission was attempted.`);\n await persist({ submissionId: submission.id });\n await persist({ versionId: version.id, phase: 'submitted' });\n return receipt;\n }\n const ipa = await stat(ipaPath);\n if (!ipa.isFile() || ipa.size === 0) throw failure('The IPA archive is missing or empty. Package the verified app before shipping.');\n const builds = await api.list(query('/v1/builds', { 'filter[app]': apple.appId, 'filter[version]': apple.buildNumber, 'filter[preReleaseVersion.version]': apple.version, 'filter[preReleaseVersion.platform]': 'IOS', limit: 200 }));\n if (builds.length > 1) throw failure('Multiple builds match this app/version/build number. Inspect App Store Connect before resuming.', 'APPLE_STATE_MISMATCH');\n let build = builds[0];\n if (receipt.buildId && build?.id !== receipt.buildId) throw failure('The remote build differs from this job’s saved build binding. Restore the verified build before resuming; no upload was attempted.', 'APPLE_STATE_MISMATCH');\n if (build && !receipt.upload && !receipt.buildId) throw failure(`Build ${apple.version} (${apple.buildNumber}) already exists without this job’s upload receipt. Use a new build number; do not reuse an unverified remote binary.`, 'APPLE_WRITE_UNCERTAIN');\n if (!build && !receipt.upload && !receipt.buildId) {\n const help = await run(['xcrun', 'altool', '--help'], { env, signal, timeoutMs: 30000 });\n if (help.code !== 0 || !`${help.stdout}\\n${help.stderr}`.includes('--upload-package')) throw failure('Select full Xcode with altool supporting --upload-package before shipping. No upload was attempted.');\n const keyDirectory = await mkdtemp(join(tmpdir(), 'factory-asc-'));\n try {\n const keyFile = join(keyDirectory, `AuthKey_${env.ASC_KEY_ID}.p8`);\n await copyFile(api.credentials.keyPath, keyFile);\n await chmod(keyFile, 0o600);\n const upload = { status: 'intent' as const, startedAt: new Date().toISOString() };\n await persist({ upload });\n const result = await run(['xcrun', 'altool', '--upload-package', ipaPath, '--platform', 'ios', '--apple-id', apple.appId, '--bundle-id', apple.bundleId, '--bundle-version', apple.buildNumber, '--bundle-short-version-string', apple.version, '--api-key', api.credentials.keyId, '--api-issuer', api.credentials.issuerId, '--wait', '--output-format', 'json'], { env: { ...env, API_PRIVATE_KEYS_DIR: keyDirectory }, signal, timeoutMs: 1200000 });\n if (result.code !== 0) throw failure(`Apple’s uploader exited with code ${result.code}. Inspect its delivery history and App Store Connect for ${apple.version} (${apple.buildNumber}); the saved upload intent prevents a duplicate upload. ${result.stderr || result.stdout}`, 'APPLE_WRITE_UNCERTAIN');\n await persist({ upload: { ...upload, status: 'delivered' }, phase: 'processing' });\n } finally {\n await rm(keyDirectory, { recursive: true, force: true });\n }\n }\n if (!build) {\n const deliveredBuilds = await api.list(query('/v1/builds', { 'filter[app]': apple.appId, 'filter[version]': apple.buildNumber, 'filter[preReleaseVersion.version]': apple.version, 'filter[preReleaseVersion.platform]': 'IOS', limit: 200 }));\n if (deliveredBuilds.length > 1) throw failure('Multiple builds match the successful delivery. Inspect App Store Connect before resuming.', 'APPLE_STATE_MISMATCH');\n build = deliveredBuilds[0];\n }\n if (!build) throw failure(`Build ${apple.version} (${apple.buildNumber}) is not visible in App Store Connect. Apple is processing the delivery; resume this job later.`, 'APPLE_PROCESSING');\n await persist({ buildId: build.id });\n if (['FAILED', 'INVALID'].includes(build.attributes.processingState ?? '')) throw failure(`Apple marked build ${apple.buildNumber} ${build.attributes.processingState}. Inspect processing errors in App Store Connect and package a corrected build with a new build number.`);\n if (build.attributes.processingState !== 'VALID') throw failure(`Apple is processing build ${apple.buildNumber}; resume this job later. No second upload will be made.`, 'APPLE_PROCESSING');\n if (build.attributes.usesNonExemptEncryption == null) throw failure('Answer export compliance for this build in App Store Connect, or set the correct ITSAppUsesNonExemptEncryption value in the app and upload a new build. The factory cannot infer your encryption declaration.');\n if (!version) version = resource(await write('create-version', '/v1/appStoreVersions', 'POST', { data: { type: 'appStoreVersions', attributes: { platform: 'IOS', versionString: apple.version, copyright: apple.copyright, releaseType }, relationships: { app: ref('apps', apple.appId) } } }));\n else await reconcile('create-version', version);\n await persist({ versionId: version.id });\n version = await ensureAttributes(version, { copyright: apple.copyright, releaseType }, 'version-metadata');\n const localizations = await api.list(`/v1/appStoreVersions/${version.id}/appStoreVersionLocalizations?limit=200`);\n let localization = localizations.find(item => item.attributes.locale === apple.locale);\n const metadata = { description: apple.description, keywords: apple.keywords, supportUrl: apple.supportUrl, ...(apple.whatsNew ? { whatsNew: apple.whatsNew } : {}) };\n if (!localization) localization = resource(await write('create-localization', '/v1/appStoreVersionLocalizations', 'POST', { data: { type: 'appStoreVersionLocalizations', attributes: { locale: apple.locale, ...metadata }, relationships: { appStoreVersion: ref('appStoreVersions', version.id) } } }));\n else await reconcile('create-localization', localization);\n await ensureAttributes(localization, metadata, 'localization-metadata');\n const infos = await api.list(`/v1/apps/${encodeURIComponent(apple.appId)}/appInfos?limit=200`);\n const info = infos.find(item => editable.has(item.attributes.state ?? item.attributes.appStoreState));\n if (!info) throw failure('No editable app information record exists. Check app status and age rating in App Store Connect.');\n const infoLocales = await api.list(`/v1/appInfos/${info.id}/appInfoLocalizations?limit=200`);\n const infoLocale = infoLocales.find(item => item.attributes.locale === apple.locale);\n if (!infoLocale) throw failure(`Create the ${apple.locale} app information localization in App Store Connect, including the app name and privacy policy.`);\n await ensureAttributes(infoLocale, { privacyPolicyUrl: apple.privacyPolicyUrl }, 'privacy-url');\n let review = optionalResource(await api.request(`/v1/appStoreVersions/${version.id}/appStoreReviewDetail`, { optional: true }));\n const contact = apple.contact;\n const reviewAttributes = { contactFirstName: contact.firstName, contactLastName: contact.lastName, contactEmail: contact.email, contactPhone: contact.phone, notes: apple.reviewNotes, demoAccountRequired: false };\n if (!review) review = resource(await write('create-review-details', '/v1/appStoreReviewDetails', 'POST', { data: { type: 'appStoreReviewDetails', attributes: reviewAttributes, relationships: { appStoreVersion: ref('appStoreVersions', version.id) } } }));\n else await reconcile('create-review-details', review);\n if (review.attributes?.demoAccountRequired) throw failure('This app requires a demo account. Configure review access in App Store Connect; the offline utility pipeline does not handle account credentials.');\n await ensureAttributes(review, reviewAttributes, 'review-details');\n await screenshots({ api, apple, localization, receipt: () => receipt, persist, write, reconcile, signal });\n const selected = optionalResource(await api.request(`/v1/appStoreVersions/${version.id}/build`, { optional: true }));\n if (selected?.id === build.id) await reconcile('select-build', selected);\n else await write('select-build', `/v1/appStoreVersions/${version.id}/relationships/build`, 'PATCH', { data: { type: 'builds', id: build.id } });\n let submission: Resource | undefined;\n const submissions = await api.list(query('/v1/reviewSubmissions', { 'filter[app]': apple.appId, limit: 200 }));\n for (const candidate of submissions) {\n const items = await api.list(`/v1/reviewSubmissions/${candidate.id}/items?include=appStoreVersion&limit=200`);\n const item = items.find(item => item.relationships?.appStoreVersion?.data?.id === version.id);\n if (candidate.id === receipt.submissionId || candidate.id === receipt.effects?.['create-review-submission']?.id || item) {\n if (submission && submission.id !== candidate.id) throw failure('Multiple review submissions reference this version. Resolve them in App Store Connect before resuming.', 'APPLE_WRITE_UNCERTAIN');\n submission = candidate;\n if (item) await reconcile('add-review-item', item);\n }\n }\n if (!submission && receipt.pending?.key === 'create-review-submission') throw failure('Review submission creation has an uncertain outcome. Check App Store Connect and resume after the submission becomes visible; no duplicate will be created.', 'APPLE_WRITE_UNCERTAIN');\n if (!submission) {\n if (submissions.some(item => ['READY_FOR_REVIEW', 'WAITING_FOR_REVIEW', 'IN_REVIEW', 'UNRESOLVED_ISSUES'].includes(item.attributes.state ?? ''))) throw failure('Another active review submission exists for this app. Resolve it in App Store Connect before starting this version.');\n submission = resource(await write('create-review-submission', '/v1/reviewSubmissions', 'POST', { data: { type: 'reviewSubmissions', attributes: { platform: 'IOS' }, relationships: { app: ref('apps', apple.appId) } } }));\n }\n await reconcile('create-review-submission', submission);\n await persist({ submissionId: submission.id });\n if (submission.attributes.state === 'READY_FOR_REVIEW') {\n const items = await api.list(`/v1/reviewSubmissions/${submission.id}/items?include=appStoreVersion&limit=200`);\n const item = items.find(item => item.relationships?.appStoreVersion?.data?.id === version.id);\n if (items.some(item => item.relationships?.appStoreVersion?.data?.id !== version.id)) throw failure('The review submission contains other items. Inspect and submit it in App Store Connect; the factory will not submit unrelated content.');\n if (item) await reconcile('add-review-item', item);\n else await write('add-review-item', '/v1/reviewSubmissionItems', 'POST', { data: { type: 'reviewSubmissionItems', relationships: { reviewSubmission: ref('reviewSubmissions', submission.id), appStoreVersion: ref('appStoreVersions', version.id) } } });\n await write('submit-review', `/v1/reviewSubmissions/${submission.id}`, 'PATCH', { data: { type: 'reviewSubmissions', id: submission.id, attributes: { submitted: true } } });\n } else if (['WAITING_FOR_REVIEW', 'IN_REVIEW', 'COMPLETING', 'COMPLETE'].includes(submission.attributes.state ?? '')) await reconcile('submit-review', submission);\n else throw failure(`Review submission is ${submission.attributes.state}. Resolve review issues in App Store Connect; no resubmission was attempted.`);\n await persist({ phase: 'submitted' });\n return receipt;\n}\n\nasync function readLocalScreenshots(screenshotsDir: string): Promise<LocalInventory> {\n const directories = await readdir(screenshotsDir, { withFileTypes: true });\n if (!directories.length || directories.some(entry => !entry.isDirectory() || !/^(APP|IMESSAGE_APP)_[A-Z0-9_]+$/.test(entry.name))) throw failure('screenshotsDir must contain display-type directories such as APP_IPHONE_67, each containing real app screenshots.');\n const localInventory: LocalInventory = new Map();\n for (const directory of directories) {\n const files = await readdir(join(screenshotsDir, directory.name), { withFileTypes: true });\n if (!files.length || files.length > 10 || files.some(file => !file.isFile() || !/\\.(png|jpe?g)$/i.test(file.name))) throw failure(`Screenshot display set ${directory.name} must contain 1–10 PNG/JPEG files and no other entries.`);\n const inventory = new Map<string, { bytes: Buffer; checksum: string }>();\n for (const file of files.sort((a, b) => a.name.localeCompare(b.name))) {\n const bytes = await readFile(join(screenshotsDir, directory.name, file.name));\n inventory.set(file.name, { bytes, checksum: createHash('md5').update(bytes).digest('hex') });\n }\n localInventory.set(directory.name, inventory);\n }\n return localInventory;\n}\n\nasync function screenshots({ api, apple, localization, receipt, persist, write, reconcile, signal }: ScreenshotOptions) {\n const sets = await api.list(`/v1/appStoreVersionLocalizations/${localization.id}/appScreenshotSets?limit=200`);\n let localInventory: LocalInventory | undefined;\n if (apple.screenshotsDir) {\n localInventory = await readLocalScreenshots(apple.screenshotsDir);\n const displayTypes = new Set<string>();\n for (const set of sets) {\n const displayType = textAttribute(set.attributes.screenshotDisplayType);\n const inventory = localInventory.get(displayType);\n if (!inventory || displayTypes.has(displayType)) throw failure(`Remote screenshot display set ${displayType} is extra or duplicated. Match App Store Connect to screenshotsDir before resuming; the factory will not delete publisher assets.`, 'APPLE_STATE_MISMATCH');\n displayTypes.add(displayType);\n const names = new Set<string>();\n for (const shot of await api.list(`/v1/appScreenshotSets/${set.id}/appScreenshots?limit=200`)) {\n const name = textAttribute(shot.attributes.fileName);\n const local = inventory.get(name);\n if (!local || names.has(name) || (shot.attributes.sourceFileChecksum && shot.attributes.sourceFileChecksum !== local.checksum)) throw failure(`Remote screenshot ${displayType}/${name} is extra, duplicated or differs from screenshotsDir. Match the inventories in App Store Connect before resuming; the factory will not delete publisher assets.`, 'APPLE_STATE_MISMATCH');\n names.add(name);\n }\n }\n for (const [displayType, files] of [...localInventory].sort(([a], [b]) => a.localeCompare(b))) {\n const setKey = `screenshot-set:${displayType}`;\n let set = sets.find(set => set.attributes.screenshotDisplayType === displayType);\n if (set) await reconcile(setKey, set);\n else {\n set = resource(await write(setKey, '/v1/appScreenshotSets', 'POST', { data: { type: 'appScreenshotSets', attributes: { screenshotDisplayType: displayType }, relationships: { appStoreVersionLocalization: ref('appStoreVersionLocalizations', localization.id) } } }));\n sets.push(set);\n }\n const existing = await api.list(`/v1/appScreenshotSets/${set.id}/appScreenshots?limit=200`);\n for (const [name, { bytes, checksum }] of files) {\n const key = `screenshot:${displayType}:${name}:${checksum}`;\n let shot = existing.find(item => item.attributes.fileName === name);\n if (shot?.attributes.sourceFileChecksum && shot.attributes.sourceFileChecksum !== checksum) throw failure(`Remote screenshot ${displayType}/${name} differs from the workspace. Replace it in App Store Connect or use a new filename; the factory will not delete publisher assets.`, 'APPLE_STATE_MISMATCH');\n if (shot && !shot.attributes.sourceFileChecksum && receipt().effects?.[key]?.id !== shot.id && receipt().pending?.key !== key) throw failure(`Screenshot ${displayType}/${name} has an unfinished reservation not owned by this job. Finish or remove it in App Store Connect before resuming.`, 'APPLE_WRITE_UNCERTAIN');\n if (shot) await reconcile(key, shot);\n else {\n shot = resource(await write(key, '/v1/appScreenshots', 'POST', { data: { type: 'appScreenshots', attributes: { fileName: basename(name), fileSize: bytes.length }, relationships: { appScreenshotSet: ref('appScreenshotSets', set.id) } } }));\n existing.push(shot);\n }\n const delivery = shot.attributes.assetDeliveryState?.state;\n if (delivery === 'FAILED') throw failure(`Apple rejected screenshot ${displayType}/${name}. Inspect its asset errors in App Store Connect and replace the failed reservation.`);\n if (delivery === 'COMPLETE') {\n await reconcile(`${key}:commit`, shot);\n continue;\n }\n if (delivery === 'AWAITING_UPLOAD') {\n if (!shot.attributes.uploadOperations?.length) throw failure('Apple returned no screenshot upload operations. Inspect the reservation in App Store Connect.', 'APPLE_API_ERROR');\n // Apple explicitly permits replaying asset parts until commit: https://developer.apple.com/documentation/appstoreconnectapi/uploading-assets-to-app-store-connect\n for (const [index, operation] of (shot.attributes.uploadOperations ?? []).entries()) {\n if (index < (receipt().assetParts?.[shot.id] ?? 0)) continue;\n const url = new URL(operation.url);\n if (url.protocol !== 'https:' || !url.hostname.endsWith('.apple.com') || operation.method !== 'PUT' || !Number.isInteger(operation.offset) || !Number.isInteger(operation.length) || operation.offset < 0 || operation.length <= 0 || operation.offset + operation.length > bytes.length) throw failure('Apple returned invalid screenshot upload instructions; no data was sent.', 'APPLE_API_ERROR');\n const partKey = `${key}:part:${index}`;\n const pending = receipt().pending;\n if (pending && pending.key !== partKey) throw failure(`A previous Apple write “${pending.key}” is unresolved. Resume after checking its outcome.`, 'APPLE_WRITE_UNCERTAIN');\n await persist({ pending: { key: partKey, method: 'PUT', startedAt: new Date().toISOString() } });\n let response: Response;\n try {\n const part = new Uint8Array(bytes.buffer as ArrayBuffer, bytes.byteOffset + operation.offset, operation.length);\n response = await fetch(url, { method: operation.method, redirect: 'error', headers: Object.fromEntries((operation.requestHeaders ?? []).map(header => [header.name, header.value])), body: part, signal: signal ? AbortSignal.any([signal, AbortSignal.timeout(60000)]) : AbortSignal.timeout(60000) });\n } catch (error) {\n throw requestFailure(`Apple screenshot part upload did not complete: ${message(error)}. Resume to resend the uncommitted part.`, 'APPLE_API_ERROR');\n }\n if (!response.ok) {\n const error = requestFailure(`Apple screenshot part upload failed (HTTP ${response.status}); resume to resend the uncommitted part.`, response.status === 429 ? 'APPLE_RATE_LIMIT' : 'APPLE_API_ERROR', response.status);\n if (error.outcome === 'rejected') await persist({ pending: null });\n throw error;\n }\n try { await response.arrayBuffer(); } catch (error) {\n throw Object.assign(requestFailure(`Apple screenshot part upload response was lost (HTTP ${response.status}): ${message(error)}. Resume to resend the uncommitted part.`, 'APPLE_API_ERROR', response.status), { outcome: 'unknown' });\n }\n await persist({ pending: null, assetParts: { ...receipt().assetParts, [shot.id]: index + 1 }, lastEffect: { key: partKey, completedAt: new Date().toISOString() } });\n }\n await write(`${key}:commit`, `/v1/appScreenshots/${shot.id}`, 'PATCH', { data: { type: 'appScreenshots', id: shot.id, attributes: { uploaded: true, sourceFileChecksum: checksum } } });\n } else if (delivery === 'UPLOAD_COMPLETE') await reconcile(`${key}:commit`, shot);\n }\n }\n }\n await verifyScreenshots({ api, apple, localization, localInventory, sets });\n}\n\nasync function verifyScreenshots({ api, apple, localization, localInventory, sets = [] }: { api: AppleClient; apple: PublishingSpec; localization: Resource; localInventory?: LocalInventory; sets?: Resource[] }) {\n let complete = 0;\n if (localInventory) sets = await api.list(`/v1/appStoreVersionLocalizations/${localization.id}/appScreenshotSets?limit=200`);\n const displayTypes = new Set<string>();\n for (const set of sets) {\n const displayType = textAttribute(set.attributes.screenshotDisplayType);\n const inventory = localInventory?.get(displayType);\n if (localInventory && (!inventory || displayTypes.has(displayType))) throw failure(`Remote screenshot display set ${displayType} is extra or duplicated. Match App Store Connect to screenshotsDir before submitting; the factory will not delete publisher assets.`, 'APPLE_STATE_MISMATCH');\n displayTypes.add(displayType);\n const names = new Set<string>();\n for (const shot of await api.list(`/v1/appScreenshotSets/${set.id}/appScreenshots?limit=200`)) {\n if (inventory) {\n const name = textAttribute(shot.attributes.fileName);\n const local = inventory.get(name);\n if (!local || names.has(name) || shot.attributes.sourceFileChecksum !== local.checksum) throw failure(`Remote screenshot ${displayType}/${name} does not exactly match screenshotsDir. Match filenames and checksums in App Store Connect before submitting; the factory will not delete publisher assets.`, 'APPLE_STATE_MISMATCH');\n names.add(name);\n }\n if (shot.attributes.assetDeliveryState?.state !== 'COMPLETE') throw failure('Apple has not finished processing all screenshots. Check failed assets in App Store Connect or resume when processing finishes.', 'APPLE_PROCESSING');\n complete++;\n }\n if (inventory && names.size !== inventory.size) throw failure(`Remote screenshots for ${displayType} are missing files from screenshotsDir. Resume after the uploaded assets become visible.`, 'APPLE_PROCESSING');\n }\n if (localInventory && displayTypes.size !== localInventory.size) throw failure('Remote screenshot display sets are missing entries from screenshotsDir. Resume after the uploaded sets become visible.', 'APPLE_PROCESSING');\n if (!complete) throw failure(`No processed screenshots exist for ${apple.locale}. Set spec.apple.screenshotsDir to real screenshots grouped by Apple display type, or upload screenshots in App Store Connect.`);\n}\n\n\nexport async function pollApple({ spec, state = {}, env = process.env, signal }: AppleOptions): Promise<ApplePollResult> {\n requireDeliveryProvenance(state);\n const apple = spec?.apple;\n if (!apple?.appId || !apple.version) throw failure('Polling requires spec.apple.appId and version.');\n const api = await client(env, signal);\n const version = await findVersion(api, apple.appId, apple.version);\n if (!version) return { status: 'waiting', detail: `Version ${apple.version} is not visible in App Store Connect.` };\n if (state.versionId && version.id !== state.versionId) throw failure('The App Store version differs from the saved receipt. Inspect the app record before resuming.', 'APPLE_STATE_MISMATCH');\n const status = versionState(version);\n if (approved.has(status)) {\n await requireSelectedBuild(api, version.id, state.buildId);\n const distributionReady = ['READY_FOR_SALE', 'READY_FOR_DISTRIBUTION'].includes(status ?? '');\n let available = false;\n if (distributionReady && apple.storefrontCountry) {\n if (!/^[A-Za-z]{2}$/.test(apple.storefrontCountry)) throw failure('apple.storefrontCountry must be a two-letter country code.');\n const url = new URL('https://itunes.apple.com/lookup');\n url.search = new URLSearchParams({ id: apple.appId, country: apple.storefrontCountry }).toString();\n let response: Response;\n try {\n response = await fetch(url, { redirect: 'error', signal: signal ? AbortSignal.any([signal, AbortSignal.timeout(30000)]) : AbortSignal.timeout(30000) });\n } catch (error) {\n throw requestFailure(`Public App Store lookup did not complete: ${message(error)}. Resume to check publication.`, 'APPLE_API_ERROR', null, true);\n }\n if (!response.ok) throw requestFailure(`Public App Store lookup failed (HTTP ${response.status}); publication has not been proven.`, 'APPLE_API_ERROR', response.status);\n let text: string;\n try { text = await response.text(); } catch (error) {\n throw requestFailure(`Public App Store lookup response was lost: ${message(error)}. Resume to check publication.`, 'APPLE_API_ERROR', response.status, true);\n }\n let data: unknown;\n try { data = JSON.parse(text); } catch {\n throw failure('Public App Store lookup returned non-JSON data; publication has not been proven.', 'APPLE_API_ERROR');\n }\n const parsed = ListingSchema.safeParse(data);\n if (!parsed.success) throw failure(`Public App Store lookup returned invalid data: ${parsed.error.message}`, 'APPLE_API_ERROR');\n available = parsed.data.results.some(item => item.bundleId === apple.bundleId && item.version === apple.version);\n }\n return { status: 'approved', distributionReady, available, detail: `Apple version state: ${status}. Approval does not imply public availability; lookup of the exact bundle/version ${available ? 'confirmed the configured storefront' : 'has not confirmed the configured storefront'}.` };\n }\n if (rejected.has(status)) return { status: 'rejected', detail: `Apple version state: ${status}. Read App Review messages in App Store Connect before changing or resubmitting the app.` };\n return { status: 'waiting', detail: `Apple version state: ${status}.` };\n}\n"],"mappings":";;;;;;;;AAaA,MAAM,wBAAwB,EAAE,OAAO;CACrC,KAAK,EAAE,OAAO;CAAG,QAAQ,EAAE,OAAO;CAAG,QAAQ,EAAE,OAAO,CAAC,CAAC,OAAO;CAAG,QAAQ,EAAE,OAAO,CAAC,CAAC,OAAO;CAC5F,gBAAgB,EAAE,MAAM,EAAE,OAAO;EAAE,MAAM,EAAE,OAAO;EAAG,OAAO,EAAE,OAAO;CAAE,CAAC,CAAC,CAAC,CAAC,QAAQ;AACrF,CAAC;AACD,MAAM,mBAAmB,EAAE,OAAO;CAChC,UAAU,EAAE,OAAO,CAAC,CAAC,SAAS;CAAG,iBAAiB,EAAE,OAAO,CAAC,CAAC,QAAQ;CAAG,eAAe,EAAE,OAAO,CAAC,CAAC,QAAQ;CAAG,OAAO,EA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