UNPKG

@capgo/cli

Version:
92 lines (91 loc) 3.95 kB
/** * The Play Developer API v3 has no public endpoint to enumerate the developer * accounts a user can access. The caller must supply a developer account ID — * the 16–20-digit number visible in the Play Console URL * (`play.google.com/console/u/0/developers/{developerId}/...`). */ export declare const PLAY_DEVELOPERS_URL = "https://play.google.com/console/u/0/developers/"; /** 10–25 digit numeric Play Console developer ID. */ export declare function isLikelyDeveloperId(value: string): boolean; /** * Normalize whatever the user pasted into a numeric developer ID. * * Accepts: * - Raw numeric ID: `1234567890123456789` * - Full Play Console URL: `https://play.google.com/console/u/0/developers/1234567890123456789/api-access` * - URL without account prefix: `https://play.google.com/console/developers/1234567890123456789` * - URLs wrapped in quotes or with surrounding whitespace * * Returns the extracted ID or null if nothing usable was found. */ export declare function extractDeveloperId(input: string): string | null; export interface PlayInvitedUser { name: string; email: string; accessState?: string; developerAccountPermissions?: string[]; } /** * Permissions granted to the Capgo service account. * * Play Developer API v3 splits permissions into two enums: * - `DeveloperLevelPermission` — account-wide, all values end in `_GLOBAL` * - `AppLevelPermission` — per-package, granted via `User.grants[]` * * References (authoritative — fetched 2026-04): * - https://developers.google.com/android-publisher/api-ref/rest/v3/users * - https://developers.google.com/android-publisher/api-ref/rest/v3/grants * * We grant the minimum needed for fastlane's `supply` to upload an AAB and * roll out a release on the app the user is onboarding. */ /** * Developer-account-level permission. `CAN_MANAGE_DRAFT_APPS_GLOBAL` lets the * SA see draft apps on this developer account — kept minimal so we don't ask * for financial data or order management access. */ export declare const CAPGO_SA_DEVELOPER_PERMISSIONS: readonly ["CAN_MANAGE_DRAFT_APPS_GLOBAL"]; /** * App-level permissions granted via `User.grants[].appLevelPermissions[]`. * * - `CAN_ACCESS_APP` — baseline read access to the app * - `CAN_MANAGE_DRAFT_APPS` — edit the app's draft state * - `CAN_MANAGE_TRACK_APKS` — upload APKs/AABs to testing tracks * (internal / alpha / beta) * - `CAN_MANAGE_PUBLIC_APKS` — upload APKs/AABs to the production track * and create/roll out production releases */ export declare const CAPGO_SA_APP_PERMISSIONS: readonly ["CAN_ACCESS_APP", "CAN_MANAGE_DRAFT_APPS", "CAN_MANAGE_TRACK_APKS", "CAN_MANAGE_PUBLIC_APKS"]; /** * Invite a service account into a Play Console developer account. * * The signed-in OAuth user MUST be an Admin on the developer account — Play * returns 403 otherwise. * * Body shape follows the `User` resource: * { * email: "...", * developerAccountPermissions: [ <DeveloperLevelPermission> ], * grants: [ * { packageName: "com.example.app", permissions: [ <AppLevelPermission> ] } * ] * } * * `developerAccountPermissions` is optional but we always send at least one * value so the SA shows up in the Play Console Users & permissions list. */ export declare function inviteServiceAccount(args: { accessToken: string; developerId: string; serviceAccountEmail: string; /** DeveloperLevelPermission values — see CAPGO_SA_DEVELOPER_PERMISSIONS. */ developerAccountPermissions?: readonly string[]; /** * Per-package grants. Each grant pins AppLevelPermission values to a * specific `packageName`. The Capacitor app ID is usually the only entry. */ grants?: ReadonlyArray<{ packageName: string; permissions: readonly string[]; }>; }): Promise<PlayInvitedUser>;