@gpc-cli/core 0.9.7 → 0.9.8
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/index.d.ts +33 -2
- package/dist/index.js +272 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OutputFormat, ResolvedConfig, WebhookConfig } from '@gpc-cli/config';
|
|
2
2
|
import { AuthClient } from '@gpc-cli/auth';
|
|
3
3
|
import { GpcPlugin, PluginManifest, CommandEvent, CommandResult, PluginError, RequestEvent, ResponseEvent, PluginCommand } from '@gpc-cli/plugin-sdk';
|
|
4
|
-
import { PlayApiClient, Track, Listing, ImageType, CountryAvailability, Image, AppDetails, Review, ReviewReplyResponse, Subscription, SubscriptionOffer, OffersListResponse, BasePlanMigratePricesRequest, InAppProduct, SubscriptionDeferResponse, ProductPurchase, SubscriptionPurchaseV2, VoidedPurchase, UsersApiClient, User, DeveloperPermission, Grant, MetricRow, ReportingDimension, ReportingAggregation, ReportingApiClient, VitalsMetricSet, AnomalyDetectionResponse, MetricSetResponse, ErrorIssuesResponse, ConvertRegionPricesResponse, ReportType, StatsDimension, ReportBucket, Testers, AppRecoveryAction, DataSafety, ExternalTransaction, ExternalTransactionRefund } from '@gpc-cli/api';
|
|
4
|
+
import { PlayApiClient, Track, Listing, ImageType, CountryAvailability, Image, AppDetails, Review, ReviewReplyResponse, Subscription, SubscriptionOffer, OffersListResponse, BasePlanMigratePricesRequest, InAppProduct, SubscriptionDeferResponse, ProductPurchase, SubscriptionPurchaseV2, VoidedPurchase, UsersApiClient, User, DeveloperPermission, Grant, MetricRow, ReportingDimension, ReportingAggregation, ReportingApiClient, VitalsMetricSet, AnomalyDetectionResponse, MetricSetResponse, ErrorIssuesResponse, ConvertRegionPricesResponse, ReportType, StatsDimension, ReportBucket, Testers, AppRecoveryTargeting, AppRecoveryAction, CreateAppRecoveryActionRequest, DataSafety, ExternalTransaction, ExternalTransactionRefund, DeviceTierConfig, OneTimeOffer, OneTimeProduct, OneTimeOffersListResponse, OneTimeProductsListResponse, GeneratedApk } from '@gpc-cli/api';
|
|
5
5
|
|
|
6
6
|
declare class GpcError extends Error {
|
|
7
7
|
readonly code: string;
|
|
@@ -447,6 +447,8 @@ declare function generateNotesFromGit(options?: GitNotesOptions): Promise<GitRel
|
|
|
447
447
|
declare function listRecoveryActions(client: PlayApiClient, packageName: string): Promise<AppRecoveryAction[]>;
|
|
448
448
|
declare function cancelRecoveryAction(client: PlayApiClient, packageName: string, recoveryId: string): Promise<void>;
|
|
449
449
|
declare function deployRecoveryAction(client: PlayApiClient, packageName: string, recoveryId: string): Promise<void>;
|
|
450
|
+
declare function createRecoveryAction(client: PlayApiClient, packageName: string, request: CreateAppRecoveryActionRequest): Promise<AppRecoveryAction>;
|
|
451
|
+
declare function addRecoveryTargeting(client: PlayApiClient, packageName: string, actionId: string, targeting: AppRecoveryTargeting): Promise<AppRecoveryAction>;
|
|
450
452
|
|
|
451
453
|
declare function getDataSafety(client: PlayApiClient, packageName: string): Promise<DataSafety>;
|
|
452
454
|
declare function updateDataSafety(client: PlayApiClient, packageName: string, data: DataSafety): Promise<DataSafety>;
|
|
@@ -457,6 +459,21 @@ declare function createExternalTransaction(client: PlayApiClient, packageName: s
|
|
|
457
459
|
declare function getExternalTransaction(client: PlayApiClient, packageName: string, transactionId: string): Promise<ExternalTransaction>;
|
|
458
460
|
declare function refundExternalTransaction(client: PlayApiClient, packageName: string, transactionId: string, refundData: ExternalTransactionRefund): Promise<ExternalTransaction>;
|
|
459
461
|
|
|
462
|
+
declare function listDeviceTiers(client: PlayApiClient, packageName: string): Promise<DeviceTierConfig[]>;
|
|
463
|
+
declare function getDeviceTier(client: PlayApiClient, packageName: string, configId: string): Promise<DeviceTierConfig>;
|
|
464
|
+
declare function createDeviceTier(client: PlayApiClient, packageName: string, config: DeviceTierConfig): Promise<DeviceTierConfig>;
|
|
465
|
+
|
|
466
|
+
declare function listOneTimeProducts(client: PlayApiClient, packageName: string): Promise<OneTimeProductsListResponse>;
|
|
467
|
+
declare function getOneTimeProduct(client: PlayApiClient, packageName: string, productId: string): Promise<OneTimeProduct>;
|
|
468
|
+
declare function createOneTimeProduct(client: PlayApiClient, packageName: string, data: OneTimeProduct): Promise<OneTimeProduct>;
|
|
469
|
+
declare function updateOneTimeProduct(client: PlayApiClient, packageName: string, productId: string, data: Partial<OneTimeProduct>): Promise<OneTimeProduct>;
|
|
470
|
+
declare function deleteOneTimeProduct(client: PlayApiClient, packageName: string, productId: string): Promise<void>;
|
|
471
|
+
declare function listOneTimeOffers(client: PlayApiClient, packageName: string, productId: string): Promise<OneTimeOffersListResponse>;
|
|
472
|
+
declare function getOneTimeOffer(client: PlayApiClient, packageName: string, productId: string, offerId: string): Promise<OneTimeOffer>;
|
|
473
|
+
declare function createOneTimeOffer(client: PlayApiClient, packageName: string, productId: string, data: OneTimeOffer): Promise<OneTimeOffer>;
|
|
474
|
+
declare function updateOneTimeOffer(client: PlayApiClient, packageName: string, productId: string, offerId: string, data: Partial<OneTimeOffer>): Promise<OneTimeOffer>;
|
|
475
|
+
declare function deleteOneTimeOffer(client: PlayApiClient, packageName: string, productId: string, offerId: string): Promise<void>;
|
|
476
|
+
|
|
460
477
|
/**
|
|
461
478
|
* Normalize and resolve a user-supplied path.
|
|
462
479
|
* Prevents path traversal by normalizing `.` and `..` components.
|
|
@@ -536,4 +553,18 @@ declare function formatDiscordPayload(payload: WebhookPayload): object;
|
|
|
536
553
|
declare function formatCustomPayload(payload: WebhookPayload): object;
|
|
537
554
|
declare function sendWebhook(config: WebhookConfig, payload: WebhookPayload, target?: string): Promise<void>;
|
|
538
555
|
|
|
539
|
-
|
|
556
|
+
interface InternalSharingUploadResult {
|
|
557
|
+
downloadUrl: string;
|
|
558
|
+
sha256: string;
|
|
559
|
+
certificateFingerprint: string;
|
|
560
|
+
fileType: "bundle" | "apk";
|
|
561
|
+
}
|
|
562
|
+
declare function uploadInternalSharing(client: PlayApiClient, packageName: string, filePath: string, fileType?: "bundle" | "apk"): Promise<InternalSharingUploadResult>;
|
|
563
|
+
|
|
564
|
+
declare function listGeneratedApks(client: PlayApiClient, packageName: string, versionCode: number): Promise<GeneratedApk[]>;
|
|
565
|
+
declare function downloadGeneratedApk(client: PlayApiClient, packageName: string, versionCode: number, apkId: string, outputPath: string): Promise<{
|
|
566
|
+
path: string;
|
|
567
|
+
sizeBytes: number;
|
|
568
|
+
}>;
|
|
569
|
+
|
|
570
|
+
export { ApiError, type AppInfo, type AuditEntry, type CommandContext, ConfigError, type DiscoverPluginsOptions, type DryRunPublishResult, type DryRunResult, type DryRunUploadResult, type FileValidationResult, GOOGLE_PLAY_LANGUAGES, type GitNotesOptions, type GitReleaseNotes, GpcError, type ImageValidationResult, type InternalSharingUploadResult, type ListIapOptions, type ListSubscriptionsOptions, type ListUsersOptions, type ListVoidedOptions, type ListingDiff, type ListingsResult, type LoadedPlugin, NetworkError, PERMISSION_PROPAGATION_WARNING, type ParsedMonth, PluginManager, type PublishOptions, type PublishResult, type PushResult, type ReleaseNotesValidation, type ReleaseStatusResult, type ReviewExportOptions, type ReviewsFilterOptions, type ScaffoldOptions, type ScaffoldResult, type SyncResult, type ThresholdResult, type UploadResult, type ValidateCheck, type ValidateOptions, type ValidateResult, type VitalsOverview, type VitalsQueryOptions, type VitalsTrendComparison, type WebhookPayload, acknowledgeProductPurchase, activateBasePlan, activateOffer, addRecoveryTargeting, addTesters, cancelRecoveryAction, cancelSubscriptionPurchase, checkThreshold, compareVitalsTrend, consumeProductPurchase, convertRegionPrices, createAuditEntry, createDeviceTier, createExternalTransaction, createInAppProduct, createOffer, createOneTimeOffer, createOneTimeProduct, createRecoveryAction, createSubscription, deactivateBasePlan, deactivateOffer, deferSubscriptionPurchase, deleteBasePlan, deleteImage, deleteInAppProduct, deleteListing, deleteOffer, deleteOneTimeOffer, deleteOneTimeProduct, deleteSubscription, deployRecoveryAction, detectOutputFormat, diffListings, diffListingsCommand, discoverPlugins, downloadGeneratedApk, downloadReport, exportDataSafety, exportReviews, formatCustomPayload, formatDiscordPayload, formatOutput, formatSlackPayload, generateNotesFromGit, getAppInfo, getCountryAvailability, getDataSafety, getDeviceTier, getExternalTransaction, getInAppProduct, getListings, getOffer, getOneTimeOffer, getOneTimeProduct, getProductPurchase, getReleasesStatus, getReview, getSubscription, getSubscriptionPurchase, getUser, getVitalsAnomalies, getVitalsAnr, getVitalsBattery, getVitalsCrashes, getVitalsMemory, getVitalsOverview, getVitalsRendering, getVitalsStartup, importDataSafety, importTestersFromCsv, initAudit, inviteUser, isFinancialReportType, isStatsReportType, isValidBcp47, isValidReportType, isValidStatsDimension, listDeviceTiers, listGeneratedApks, listImages, listInAppProducts, listOffers, listOneTimeOffers, listOneTimeProducts, listRecoveryActions, listReports, listReviews, listSubscriptions, listTesters, listTracks, listUsers, listVoidedPurchases, migratePrices, parseGrantArg, parseMonth, promoteRelease, publish, pullListings, pushListings, readListingsFromDir, readReleaseNotesFromDir, redactSensitive, refundExternalTransaction, refundOrder, removeTesters, removeUser, replyToReview, revokeSubscriptionPurchase, safePath, safePathWithin, scaffoldPlugin, searchVitalsErrors, sendWebhook, sortResults, syncInAppProducts, updateAppDetails, updateDataSafety, updateInAppProduct, updateListing, updateOffer, updateOneTimeOffer, updateOneTimeProduct, updateRollout, updateSubscription, updateUser, uploadImage, uploadInternalSharing, uploadRelease, validateImage, validatePreSubmission, validateReleaseNotes, validateUploadFile, writeAuditLog, writeListingsToDir };
|
package/dist/index.js
CHANGED
|
@@ -2114,6 +2114,12 @@ async function cancelRecoveryAction(client, packageName, recoveryId) {
|
|
|
2114
2114
|
async function deployRecoveryAction(client, packageName, recoveryId) {
|
|
2115
2115
|
return client.appRecovery.deploy(packageName, recoveryId);
|
|
2116
2116
|
}
|
|
2117
|
+
async function createRecoveryAction(client, packageName, request) {
|
|
2118
|
+
return client.appRecovery.create(packageName, request);
|
|
2119
|
+
}
|
|
2120
|
+
async function addRecoveryTargeting(client, packageName, actionId, targeting) {
|
|
2121
|
+
return client.appRecovery.addTargeting(packageName, actionId, targeting);
|
|
2122
|
+
}
|
|
2117
2123
|
|
|
2118
2124
|
// src/commands/data-safety.ts
|
|
2119
2125
|
import { readFile as readFile6, writeFile as writeFile2 } from "fs/promises";
|
|
@@ -2169,6 +2175,179 @@ async function refundExternalTransaction(client, packageName, transactionId, ref
|
|
|
2169
2175
|
return client.externalTransactions.refund(packageName, transactionId, refundData);
|
|
2170
2176
|
}
|
|
2171
2177
|
|
|
2178
|
+
// src/commands/device-tiers.ts
|
|
2179
|
+
async function listDeviceTiers(client, packageName) {
|
|
2180
|
+
if (!packageName) {
|
|
2181
|
+
throw new GpcError(
|
|
2182
|
+
"Package name is required",
|
|
2183
|
+
"MISSING_PACKAGE_NAME",
|
|
2184
|
+
2,
|
|
2185
|
+
"Provide a package name with --app or set it in config."
|
|
2186
|
+
);
|
|
2187
|
+
}
|
|
2188
|
+
return client.deviceTiers.list(packageName);
|
|
2189
|
+
}
|
|
2190
|
+
async function getDeviceTier(client, packageName, configId) {
|
|
2191
|
+
if (!packageName) {
|
|
2192
|
+
throw new GpcError(
|
|
2193
|
+
"Package name is required",
|
|
2194
|
+
"MISSING_PACKAGE_NAME",
|
|
2195
|
+
2,
|
|
2196
|
+
"Provide a package name with --app or set it in config."
|
|
2197
|
+
);
|
|
2198
|
+
}
|
|
2199
|
+
if (!configId) {
|
|
2200
|
+
throw new GpcError(
|
|
2201
|
+
"Config ID is required",
|
|
2202
|
+
"MISSING_CONFIG_ID",
|
|
2203
|
+
2,
|
|
2204
|
+
"Provide a device tier config ID."
|
|
2205
|
+
);
|
|
2206
|
+
}
|
|
2207
|
+
return client.deviceTiers.get(packageName, configId);
|
|
2208
|
+
}
|
|
2209
|
+
async function createDeviceTier(client, packageName, config) {
|
|
2210
|
+
if (!packageName) {
|
|
2211
|
+
throw new GpcError(
|
|
2212
|
+
"Package name is required",
|
|
2213
|
+
"MISSING_PACKAGE_NAME",
|
|
2214
|
+
2,
|
|
2215
|
+
"Provide a package name with --app or set it in config."
|
|
2216
|
+
);
|
|
2217
|
+
}
|
|
2218
|
+
if (!config || !config.deviceGroups || config.deviceGroups.length === 0) {
|
|
2219
|
+
throw new GpcError(
|
|
2220
|
+
"Device tier config must include at least one device group",
|
|
2221
|
+
"INVALID_DEVICE_TIER_CONFIG",
|
|
2222
|
+
2,
|
|
2223
|
+
"Provide a valid config with deviceGroups."
|
|
2224
|
+
);
|
|
2225
|
+
}
|
|
2226
|
+
return client.deviceTiers.create(packageName, config);
|
|
2227
|
+
}
|
|
2228
|
+
|
|
2229
|
+
// src/commands/one-time-products.ts
|
|
2230
|
+
async function listOneTimeProducts(client, packageName) {
|
|
2231
|
+
try {
|
|
2232
|
+
return await client.oneTimeProducts.list(packageName);
|
|
2233
|
+
} catch (error) {
|
|
2234
|
+
throw new GpcError(
|
|
2235
|
+
`Failed to list one-time products: ${error instanceof Error ? error.message : String(error)}`,
|
|
2236
|
+
"OTP_LIST_FAILED",
|
|
2237
|
+
4,
|
|
2238
|
+
"Check your package name and API credentials."
|
|
2239
|
+
);
|
|
2240
|
+
}
|
|
2241
|
+
}
|
|
2242
|
+
async function getOneTimeProduct(client, packageName, productId) {
|
|
2243
|
+
try {
|
|
2244
|
+
return await client.oneTimeProducts.get(packageName, productId);
|
|
2245
|
+
} catch (error) {
|
|
2246
|
+
throw new GpcError(
|
|
2247
|
+
`Failed to get one-time product "${productId}": ${error instanceof Error ? error.message : String(error)}`,
|
|
2248
|
+
"OTP_GET_FAILED",
|
|
2249
|
+
4,
|
|
2250
|
+
"Check that the product ID exists."
|
|
2251
|
+
);
|
|
2252
|
+
}
|
|
2253
|
+
}
|
|
2254
|
+
async function createOneTimeProduct(client, packageName, data) {
|
|
2255
|
+
try {
|
|
2256
|
+
return await client.oneTimeProducts.create(packageName, data);
|
|
2257
|
+
} catch (error) {
|
|
2258
|
+
throw new GpcError(
|
|
2259
|
+
`Failed to create one-time product: ${error instanceof Error ? error.message : String(error)}`,
|
|
2260
|
+
"OTP_CREATE_FAILED",
|
|
2261
|
+
4,
|
|
2262
|
+
"Verify the product data and ensure the product ID is unique."
|
|
2263
|
+
);
|
|
2264
|
+
}
|
|
2265
|
+
}
|
|
2266
|
+
async function updateOneTimeProduct(client, packageName, productId, data) {
|
|
2267
|
+
try {
|
|
2268
|
+
return await client.oneTimeProducts.update(packageName, productId, data);
|
|
2269
|
+
} catch (error) {
|
|
2270
|
+
throw new GpcError(
|
|
2271
|
+
`Failed to update one-time product "${productId}": ${error instanceof Error ? error.message : String(error)}`,
|
|
2272
|
+
"OTP_UPDATE_FAILED",
|
|
2273
|
+
4,
|
|
2274
|
+
"Check that the product ID exists and the data is valid."
|
|
2275
|
+
);
|
|
2276
|
+
}
|
|
2277
|
+
}
|
|
2278
|
+
async function deleteOneTimeProduct(client, packageName, productId) {
|
|
2279
|
+
try {
|
|
2280
|
+
await client.oneTimeProducts.delete(packageName, productId);
|
|
2281
|
+
} catch (error) {
|
|
2282
|
+
throw new GpcError(
|
|
2283
|
+
`Failed to delete one-time product "${productId}": ${error instanceof Error ? error.message : String(error)}`,
|
|
2284
|
+
"OTP_DELETE_FAILED",
|
|
2285
|
+
4,
|
|
2286
|
+
"Check that the product ID exists and is not active."
|
|
2287
|
+
);
|
|
2288
|
+
}
|
|
2289
|
+
}
|
|
2290
|
+
async function listOneTimeOffers(client, packageName, productId) {
|
|
2291
|
+
try {
|
|
2292
|
+
return await client.oneTimeProducts.listOffers(packageName, productId);
|
|
2293
|
+
} catch (error) {
|
|
2294
|
+
throw new GpcError(
|
|
2295
|
+
`Failed to list offers for product "${productId}": ${error instanceof Error ? error.message : String(error)}`,
|
|
2296
|
+
"OTP_OFFERS_LIST_FAILED",
|
|
2297
|
+
4,
|
|
2298
|
+
"Check the product ID and your API credentials."
|
|
2299
|
+
);
|
|
2300
|
+
}
|
|
2301
|
+
}
|
|
2302
|
+
async function getOneTimeOffer(client, packageName, productId, offerId) {
|
|
2303
|
+
try {
|
|
2304
|
+
return await client.oneTimeProducts.getOffer(packageName, productId, offerId);
|
|
2305
|
+
} catch (error) {
|
|
2306
|
+
throw new GpcError(
|
|
2307
|
+
`Failed to get offer "${offerId}" for product "${productId}": ${error instanceof Error ? error.message : String(error)}`,
|
|
2308
|
+
"OTP_OFFER_GET_FAILED",
|
|
2309
|
+
4,
|
|
2310
|
+
"Check that the product and offer IDs exist."
|
|
2311
|
+
);
|
|
2312
|
+
}
|
|
2313
|
+
}
|
|
2314
|
+
async function createOneTimeOffer(client, packageName, productId, data) {
|
|
2315
|
+
try {
|
|
2316
|
+
return await client.oneTimeProducts.createOffer(packageName, productId, data);
|
|
2317
|
+
} catch (error) {
|
|
2318
|
+
throw new GpcError(
|
|
2319
|
+
`Failed to create offer for product "${productId}": ${error instanceof Error ? error.message : String(error)}`,
|
|
2320
|
+
"OTP_OFFER_CREATE_FAILED",
|
|
2321
|
+
4,
|
|
2322
|
+
"Verify the offer data and ensure the offer ID is unique."
|
|
2323
|
+
);
|
|
2324
|
+
}
|
|
2325
|
+
}
|
|
2326
|
+
async function updateOneTimeOffer(client, packageName, productId, offerId, data) {
|
|
2327
|
+
try {
|
|
2328
|
+
return await client.oneTimeProducts.updateOffer(packageName, productId, offerId, data);
|
|
2329
|
+
} catch (error) {
|
|
2330
|
+
throw new GpcError(
|
|
2331
|
+
`Failed to update offer "${offerId}" for product "${productId}": ${error instanceof Error ? error.message : String(error)}`,
|
|
2332
|
+
"OTP_OFFER_UPDATE_FAILED",
|
|
2333
|
+
4,
|
|
2334
|
+
"Check that the product and offer IDs exist and the data is valid."
|
|
2335
|
+
);
|
|
2336
|
+
}
|
|
2337
|
+
}
|
|
2338
|
+
async function deleteOneTimeOffer(client, packageName, productId, offerId) {
|
|
2339
|
+
try {
|
|
2340
|
+
await client.oneTimeProducts.deleteOffer(packageName, productId, offerId);
|
|
2341
|
+
} catch (error) {
|
|
2342
|
+
throw new GpcError(
|
|
2343
|
+
`Failed to delete offer "${offerId}" for product "${productId}": ${error instanceof Error ? error.message : String(error)}`,
|
|
2344
|
+
"OTP_OFFER_DELETE_FAILED",
|
|
2345
|
+
4,
|
|
2346
|
+
"Check that the product and offer IDs exist."
|
|
2347
|
+
);
|
|
2348
|
+
}
|
|
2349
|
+
}
|
|
2350
|
+
|
|
2172
2351
|
// src/utils/safe-path.ts
|
|
2173
2352
|
import { resolve, normalize } from "path";
|
|
2174
2353
|
function safePath(userPath) {
|
|
@@ -2504,6 +2683,81 @@ async function sendWebhook(config, payload, target) {
|
|
|
2504
2683
|
} catch {
|
|
2505
2684
|
}
|
|
2506
2685
|
}
|
|
2686
|
+
|
|
2687
|
+
// src/commands/internal-sharing.ts
|
|
2688
|
+
import { extname as extname4 } from "path";
|
|
2689
|
+
async function uploadInternalSharing(client, packageName, filePath, fileType) {
|
|
2690
|
+
const resolvedType = fileType ?? detectFileType(filePath);
|
|
2691
|
+
const validation = await validateUploadFile(filePath);
|
|
2692
|
+
if (!validation.valid) {
|
|
2693
|
+
throw new GpcError(
|
|
2694
|
+
`File validation failed:
|
|
2695
|
+
${validation.errors.join("\n")}`,
|
|
2696
|
+
"INTERNAL_SHARING_INVALID_FILE",
|
|
2697
|
+
2,
|
|
2698
|
+
"Check that the file is a valid AAB or APK and is not corrupted."
|
|
2699
|
+
);
|
|
2700
|
+
}
|
|
2701
|
+
let artifact;
|
|
2702
|
+
if (resolvedType === "bundle") {
|
|
2703
|
+
artifact = await client.internalAppSharing.uploadBundle(packageName, filePath);
|
|
2704
|
+
} else {
|
|
2705
|
+
artifact = await client.internalAppSharing.uploadApk(packageName, filePath);
|
|
2706
|
+
}
|
|
2707
|
+
return {
|
|
2708
|
+
downloadUrl: artifact.downloadUrl,
|
|
2709
|
+
sha256: artifact.sha256,
|
|
2710
|
+
certificateFingerprint: artifact.certificateFingerprint,
|
|
2711
|
+
fileType: resolvedType
|
|
2712
|
+
};
|
|
2713
|
+
}
|
|
2714
|
+
function detectFileType(filePath) {
|
|
2715
|
+
const ext = extname4(filePath).toLowerCase();
|
|
2716
|
+
if (ext === ".aab") return "bundle";
|
|
2717
|
+
if (ext === ".apk") return "apk";
|
|
2718
|
+
throw new GpcError(
|
|
2719
|
+
`Cannot detect file type from extension "${ext}". Use --type to specify bundle or apk.`,
|
|
2720
|
+
"INTERNAL_SHARING_UNKNOWN_TYPE",
|
|
2721
|
+
2,
|
|
2722
|
+
"Use --type bundle for .aab files or --type apk for .apk files."
|
|
2723
|
+
);
|
|
2724
|
+
}
|
|
2725
|
+
|
|
2726
|
+
// src/commands/generated-apks.ts
|
|
2727
|
+
import { writeFile as writeFile4 } from "fs/promises";
|
|
2728
|
+
async function listGeneratedApks(client, packageName, versionCode) {
|
|
2729
|
+
if (!Number.isInteger(versionCode) || versionCode <= 0) {
|
|
2730
|
+
throw new GpcError(
|
|
2731
|
+
`Invalid version code: ${versionCode}`,
|
|
2732
|
+
"GENERATED_APKS_INVALID_VERSION",
|
|
2733
|
+
2,
|
|
2734
|
+
"Provide a positive integer version code."
|
|
2735
|
+
);
|
|
2736
|
+
}
|
|
2737
|
+
return client.generatedApks.list(packageName, versionCode);
|
|
2738
|
+
}
|
|
2739
|
+
async function downloadGeneratedApk(client, packageName, versionCode, apkId, outputPath) {
|
|
2740
|
+
if (!Number.isInteger(versionCode) || versionCode <= 0) {
|
|
2741
|
+
throw new GpcError(
|
|
2742
|
+
`Invalid version code: ${versionCode}`,
|
|
2743
|
+
"GENERATED_APKS_INVALID_VERSION",
|
|
2744
|
+
2,
|
|
2745
|
+
"Provide a positive integer version code."
|
|
2746
|
+
);
|
|
2747
|
+
}
|
|
2748
|
+
if (!apkId) {
|
|
2749
|
+
throw new GpcError(
|
|
2750
|
+
"APK ID is required",
|
|
2751
|
+
"GENERATED_APKS_MISSING_ID",
|
|
2752
|
+
2,
|
|
2753
|
+
"Provide the generated APK ID. Use 'gpc generated-apks list <version-code>' to see available APKs."
|
|
2754
|
+
);
|
|
2755
|
+
}
|
|
2756
|
+
const buffer = await client.generatedApks.download(packageName, versionCode, apkId);
|
|
2757
|
+
const bytes = new Uint8Array(buffer);
|
|
2758
|
+
await writeFile4(outputPath, bytes);
|
|
2759
|
+
return { path: outputPath, sizeBytes: bytes.byteLength };
|
|
2760
|
+
}
|
|
2507
2761
|
export {
|
|
2508
2762
|
ApiError,
|
|
2509
2763
|
ConfigError,
|
|
@@ -2515,6 +2769,7 @@ export {
|
|
|
2515
2769
|
acknowledgeProductPurchase,
|
|
2516
2770
|
activateBasePlan,
|
|
2517
2771
|
activateOffer,
|
|
2772
|
+
addRecoveryTargeting,
|
|
2518
2773
|
addTesters,
|
|
2519
2774
|
cancelRecoveryAction,
|
|
2520
2775
|
cancelSubscriptionPurchase,
|
|
@@ -2523,9 +2778,13 @@ export {
|
|
|
2523
2778
|
consumeProductPurchase,
|
|
2524
2779
|
convertRegionPrices,
|
|
2525
2780
|
createAuditEntry,
|
|
2781
|
+
createDeviceTier,
|
|
2526
2782
|
createExternalTransaction,
|
|
2527
2783
|
createInAppProduct,
|
|
2528
2784
|
createOffer,
|
|
2785
|
+
createOneTimeOffer,
|
|
2786
|
+
createOneTimeProduct,
|
|
2787
|
+
createRecoveryAction,
|
|
2529
2788
|
createSubscription,
|
|
2530
2789
|
deactivateBasePlan,
|
|
2531
2790
|
deactivateOffer,
|
|
@@ -2535,12 +2794,15 @@ export {
|
|
|
2535
2794
|
deleteInAppProduct,
|
|
2536
2795
|
deleteListing,
|
|
2537
2796
|
deleteOffer,
|
|
2797
|
+
deleteOneTimeOffer,
|
|
2798
|
+
deleteOneTimeProduct,
|
|
2538
2799
|
deleteSubscription,
|
|
2539
2800
|
deployRecoveryAction,
|
|
2540
2801
|
detectOutputFormat,
|
|
2541
2802
|
diffListings,
|
|
2542
2803
|
diffListingsCommand,
|
|
2543
2804
|
discoverPlugins,
|
|
2805
|
+
downloadGeneratedApk,
|
|
2544
2806
|
downloadReport,
|
|
2545
2807
|
exportDataSafety,
|
|
2546
2808
|
exportReviews,
|
|
@@ -2552,10 +2814,13 @@ export {
|
|
|
2552
2814
|
getAppInfo,
|
|
2553
2815
|
getCountryAvailability,
|
|
2554
2816
|
getDataSafety,
|
|
2817
|
+
getDeviceTier,
|
|
2555
2818
|
getExternalTransaction,
|
|
2556
2819
|
getInAppProduct,
|
|
2557
2820
|
getListings,
|
|
2558
2821
|
getOffer,
|
|
2822
|
+
getOneTimeOffer,
|
|
2823
|
+
getOneTimeProduct,
|
|
2559
2824
|
getProductPurchase,
|
|
2560
2825
|
getReleasesStatus,
|
|
2561
2826
|
getReview,
|
|
@@ -2579,9 +2844,13 @@ export {
|
|
|
2579
2844
|
isValidBcp47,
|
|
2580
2845
|
isValidReportType,
|
|
2581
2846
|
isValidStatsDimension,
|
|
2847
|
+
listDeviceTiers,
|
|
2848
|
+
listGeneratedApks,
|
|
2582
2849
|
listImages,
|
|
2583
2850
|
listInAppProducts,
|
|
2584
2851
|
listOffers,
|
|
2852
|
+
listOneTimeOffers,
|
|
2853
|
+
listOneTimeProducts,
|
|
2585
2854
|
listRecoveryActions,
|
|
2586
2855
|
listReports,
|
|
2587
2856
|
listReviews,
|
|
@@ -2618,10 +2887,13 @@ export {
|
|
|
2618
2887
|
updateInAppProduct,
|
|
2619
2888
|
updateListing,
|
|
2620
2889
|
updateOffer,
|
|
2890
|
+
updateOneTimeOffer,
|
|
2891
|
+
updateOneTimeProduct,
|
|
2621
2892
|
updateRollout,
|
|
2622
2893
|
updateSubscription,
|
|
2623
2894
|
updateUser,
|
|
2624
2895
|
uploadImage,
|
|
2896
|
+
uploadInternalSharing,
|
|
2625
2897
|
uploadRelease,
|
|
2626
2898
|
validateImage,
|
|
2627
2899
|
validatePreSubmission,
|