@gpc-cli/core 0.9.45 → 0.9.47
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/README.md +2 -2
- package/dist/index.d.ts +43 -8
- package/dist/index.js +38 -36
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -75,6 +75,6 @@ const analysis = await analyzeBundle("./app.aab");
|
|
|
75
75
|
- [Full documentation](https://yasserstudio.github.io/gpc/)
|
|
76
76
|
- [Architecture](https://yasserstudio.github.io/gpc/advanced/architecture)
|
|
77
77
|
|
|
78
|
-
##
|
|
78
|
+
## Licensing
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
Free to use. Source code is on GitHub at [yasserstudio/gpc](https://github.com/yasserstudio/gpc).
|
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, EditCommitOptions, Track, ExternallyHostedApk, ExternallyHostedApkResponse, DeobfuscationFileType, UploadProgressEvent, ResumableUploadOptions, Listing, ImageType, CountryAvailability, Image, AppDetails, Review, ReviewReplyResponse, Subscription, SubscriptionOffer, OffersListResponse, BasePlanMigratePricesRequest, InAppProduct, Order, SubscriptionDeferResponse, SubscriptionsV2DeferResponse, ProductPurchase, ProductPurchaseV2, SubscriptionPurchaseV2, VoidedPurchase, UsersApiClient, User,
|
|
4
|
+
import { PlayApiClient, EditCommitOptions, Track, ExternallyHostedApk, ExternallyHostedApkResponse, DeobfuscationFileType, UploadProgressEvent, ResumableUploadOptions, Listing, ImageType, CountryAvailability, Image, AppDetails, Review, ReviewReplyResponse, Subscription, SubscriptionOffer, OffersListResponse, BasePlanMigratePricesRequest, InAppProduct, Order, SubscriptionDeferResponse, SubscriptionsV2DeferResponse, ProductPurchase, ProductPurchaseV2, SubscriptionPurchaseV2, VoidedPurchase, UsersApiClient, User, DeveloperLevelPermission, Grant, MetricRow, ReportingDimension, ReportingAggregation, VitalsMetricSet, ReportingApiClient, AnomalyDetectionResponse, MetricSetResponse, ErrorIssuesResponse, ConvertRegionPricesResponse, ReportType, StatsDimension, ReportBucket, Testers, AppRecoveryTargeting, AppRecoveryAction, CreateAppRecoveryActionRequest, DataSafety, ExternalTransaction, ExternalTransactionRefund, DeviceTierConfig, OneTimeOffer, OneTimeProduct, OneTimeOffersListResponse, OneTimeProductsListResponse, GamesApiClient, Achievement, GameEvent, Leaderboard, EnterpriseApiClient, CustomApp, GeneratedApk } from '@gpc-cli/api';
|
|
5
5
|
|
|
6
6
|
declare class GpcError extends Error {
|
|
7
7
|
readonly code: string;
|
|
@@ -570,8 +570,8 @@ declare function listUsers(client: UsersApiClient, developerId: string, options?
|
|
|
570
570
|
nextPageToken?: string;
|
|
571
571
|
}>;
|
|
572
572
|
declare function getUser(client: UsersApiClient, developerId: string, email: string): Promise<User>;
|
|
573
|
-
declare function inviteUser(client: UsersApiClient, developerId: string, email: string, permissions?:
|
|
574
|
-
declare function updateUser(client: UsersApiClient, developerId: string, userId: string, permissions?:
|
|
573
|
+
declare function inviteUser(client: UsersApiClient, developerId: string, email: string, permissions?: DeveloperLevelPermission[], grants?: Grant[]): Promise<User>;
|
|
574
|
+
declare function updateUser(client: UsersApiClient, developerId: string, userId: string, permissions?: DeveloperLevelPermission[], grants?: Grant[]): Promise<User>;
|
|
575
575
|
declare function removeUser(client: UsersApiClient, developerId: string, userId: string): Promise<void>;
|
|
576
576
|
declare function parseGrantArg(grantStr: string): Grant;
|
|
577
577
|
|
|
@@ -602,6 +602,7 @@ declare function getVitalsBattery(reporting: ReportingApiClient, packageName: st
|
|
|
602
602
|
declare function getVitalsMemory(reporting: ReportingApiClient, packageName: string, options?: VitalsQueryOptions): Promise<MetricSetResponse>;
|
|
603
603
|
/** LMK-specific query: enforces DAILY aggregation as required by the API. */
|
|
604
604
|
declare function getVitalsLmk(reporting: ReportingApiClient, packageName: string, options?: VitalsQueryOptions): Promise<MetricSetResponse>;
|
|
605
|
+
declare function getVitalsErrorCount(reporting: ReportingApiClient, packageName: string, options?: VitalsQueryOptions): Promise<MetricSetResponse>;
|
|
605
606
|
declare function getVitalsAnomalies(reporting: ReportingApiClient, packageName: string): Promise<AnomalyDetectionResponse>;
|
|
606
607
|
declare function searchVitalsErrors(reporting: ReportingApiClient, packageName: string, options?: {
|
|
607
608
|
filter?: string;
|
|
@@ -704,9 +705,7 @@ declare function deployRecoveryAction(client: PlayApiClient, packageName: string
|
|
|
704
705
|
declare function createRecoveryAction(client: PlayApiClient, packageName: string, request: CreateAppRecoveryActionRequest): Promise<AppRecoveryAction>;
|
|
705
706
|
declare function addRecoveryTargeting(client: PlayApiClient, packageName: string, actionId: string, targeting: AppRecoveryTargeting): Promise<AppRecoveryAction>;
|
|
706
707
|
|
|
707
|
-
declare function getDataSafety(client: PlayApiClient, packageName: string): Promise<DataSafety>;
|
|
708
708
|
declare function updateDataSafety(client: PlayApiClient, packageName: string, data: DataSafety): Promise<DataSafety>;
|
|
709
|
-
declare function exportDataSafety(client: PlayApiClient, packageName: string, outputPath: string): Promise<DataSafety>;
|
|
710
709
|
declare function importDataSafety(client: PlayApiClient, packageName: string, filePath: string): Promise<DataSafety>;
|
|
711
710
|
|
|
712
711
|
declare function createExternalTransaction(client: PlayApiClient, packageName: string, data: ExternalTransaction): Promise<ExternalTransaction>;
|
|
@@ -792,8 +791,44 @@ declare function listLeaderboards(client: GamesApiClient, packageName: string):
|
|
|
792
791
|
declare function listAchievements(client: GamesApiClient, packageName: string): Promise<Achievement[]>;
|
|
793
792
|
declare function listEvents(client: GamesApiClient, packageName: string): Promise<GameEvent[]>;
|
|
794
793
|
|
|
795
|
-
|
|
796
|
-
|
|
794
|
+
/**
|
|
795
|
+
* Parameters for creating a private enterprise app via the Play Custom App
|
|
796
|
+
* Publishing API. All fields are user-supplied inputs — the returned
|
|
797
|
+
* `CustomApp.packageName` is assigned by Google.
|
|
798
|
+
*/
|
|
799
|
+
interface CreateEnterpriseAppParams {
|
|
800
|
+
/** Developer account ID (int64-shaped, from Play Console URL). */
|
|
801
|
+
accountId: string;
|
|
802
|
+
/** Path to the AAB or APK to upload. */
|
|
803
|
+
bundlePath: string;
|
|
804
|
+
/** Title for the Android app. Required. */
|
|
805
|
+
title: string;
|
|
806
|
+
/** Default listing language. Defaults to "en_US" when omitted. */
|
|
807
|
+
languageCode?: string;
|
|
808
|
+
/** Target enterprise organizations. Zero or more. */
|
|
809
|
+
organizations?: Array<{
|
|
810
|
+
organizationId: string;
|
|
811
|
+
organizationName?: string;
|
|
812
|
+
}>;
|
|
813
|
+
}
|
|
814
|
+
/**
|
|
815
|
+
* Create and publish a private custom app. Orchestrates the input shape
|
|
816
|
+
* expected by the CLI layer (flat params) into the shape the api-client
|
|
817
|
+
* expects (accountId, bundlePath, metadata).
|
|
818
|
+
*
|
|
819
|
+
* Once created, the returned app is permanently private — it cannot be made
|
|
820
|
+
* public. Subsequent operations (version uploads, tracks, listings) use the
|
|
821
|
+
* regular Publisher API commands (`gpc releases`, `gpc tracks`, `gpc listings`)
|
|
822
|
+
* against the returned `packageName`.
|
|
823
|
+
*/
|
|
824
|
+
declare function createEnterpriseApp(client: EnterpriseApiClient, params: CreateEnterpriseAppParams): Promise<CustomApp>;
|
|
825
|
+
/**
|
|
826
|
+
* One-shot publish wrapper — functionally identical to `createEnterpriseApp`
|
|
827
|
+
* today but kept as a distinct function so the CLI `publish` subcommand has
|
|
828
|
+
* a stable entry point for future divergence (e.g. post-create validation,
|
|
829
|
+
* automatic first-release upload, analytics hooks).
|
|
830
|
+
*/
|
|
831
|
+
declare function publishEnterpriseApp(client: EnterpriseApiClient, params: CreateEnterpriseAppParams): Promise<CustomApp>;
|
|
797
832
|
|
|
798
833
|
interface QuotaUsage {
|
|
799
834
|
dailyCallsUsed: number;
|
|
@@ -1265,4 +1300,4 @@ declare function decodeNotification(base64Payload: string): DecodedNotification;
|
|
|
1265
1300
|
*/
|
|
1266
1301
|
declare function formatNotification(notification: DecodedNotification): Record<string, unknown>;
|
|
1267
1302
|
|
|
1268
|
-
export { ApiError, type AppInfo, type AppStatus, type AuditEntry, type BatchSyncResult, type BundleAnalysis, type BundleComparison, type BundleEntry, type BundleSizeCheckResult, type BundleSizeConfig, type ChangelogEntry, type CommandContext, ConfigError, DEFAULT_LIMITS, DEFAULT_PREFLIGHT_CONFIG, type DecodedNotification, type DiffToken, type DiscoverPluginsOptions, type DryRunPublishResult, type DryRunResult, type DryRunUploadResult, type ExportImagesOptions, type ExportImagesSummary, type FastlaneDetection, type FastlaneLane, type FetchChangelogOptions, type FieldLintResult, type FileValidationResult, type FindingSeverity, GOOGLE_PLAY_LANGUAGES, type GetAppStatusOptions, type GitNotesOptions, type GitReleaseNotes, GpcError, type ImageValidationResult, type InitOptions, type InitResult, type InternalSharingUploadResult, type ListIapOptions, type ListSubscriptionsOptions, type ListUsersOptions, type ListVoidedOptions, type ListingDiff, type ListingFieldLimits, type ListingLintResult, type ListingsResult, type LoadedPlugin, type MigrationResult, NetworkError, type OneTimeProductDiff, PERMISSION_PROPAGATION_WARNING, type ParsedManifest, type ParsedMonth, PluginManager, type PreflightConfig, type PreflightFinding, type PreflightOptions, type PreflightResult, type PreflightScanner, type PublishOptions, type PublishResult, type PushResult, type QuotaUsage, type ReleaseDiff, type ReleaseNotesValidation, type ReleaseStatusResult, type ReviewAnalysis, type ReviewExportOptions, type ReviewsFilterOptions, type RtdnStatus, SENSITIVE_ARG_KEYS, SENSITIVE_KEYS, SEVERITY_ORDER, type ScaffoldOptions, type ScaffoldResult, type Spinner, type StatusDiff, type StatusRelease, type StatusReviews, type StatusVitalMetric, type SubscriptionAnalytics, type SubscriptionDiff, type SyncResult, type ThresholdResult, type TrainConfig, type TrainState, type UploadResult, type ValidateCheck, type ValidateOptions, type ValidateResult, type VersionVitalsComparison, type VersionVitalsRow, type VitalsOverview, type VitalsQueryOptions, type VitalsTrendComparison, type WatchOptions, type WatchVitalsOptions, type WebhookPayload, abortTrain, acknowledgeProductPurchase, activateBasePlan, activateOffer, addRecoveryTargeting, addTesters, advanceTrain, analyzeBundle, analyzeRemoteListings, analyzeReviews, batchGetOrders, batchSyncInAppProducts, cancelRecoveryAction, cancelSubscriptionPurchase, cancelSubscriptionV2, checkBundleSize, checkThreshold, clearAuditLog, compareBundles, compareVersionVitals, compareVitalsTrend, computeStatusDiff, consumeProductPurchase, convertRegionPrices, createAuditEntry, createDeviceTier, createEnterpriseApp, createExternalTransaction, createGrant, createInAppProduct, createOffer, createOneTimeOffer, createOneTimeProduct, createRecoveryAction, createSpinner, createSubscription, createTrack, deactivateBasePlan, deactivateOffer, decodeNotification, deferSubscriptionPurchase, deferSubscriptionV2, deleteBasePlan, deleteGrant, deleteImage, deleteInAppProduct, deleteListing, deleteOffer, deleteOneTimeOffer, deleteOneTimeProduct, deleteSubscription, deployRecoveryAction, detectFastlane, detectOutputFormat, diffListings, diffListingsCommand, diffListingsEnhanced, diffOneTimeProduct, diffReleases, diffSubscription, discoverPlugins, downloadGeneratedApk, downloadReport,
|
|
1303
|
+
export { ApiError, type AppInfo, type AppStatus, type AuditEntry, type BatchSyncResult, type BundleAnalysis, type BundleComparison, type BundleEntry, type BundleSizeCheckResult, type BundleSizeConfig, type ChangelogEntry, type CommandContext, ConfigError, type CreateEnterpriseAppParams, DEFAULT_LIMITS, DEFAULT_PREFLIGHT_CONFIG, type DecodedNotification, type DiffToken, type DiscoverPluginsOptions, type DryRunPublishResult, type DryRunResult, type DryRunUploadResult, type ExportImagesOptions, type ExportImagesSummary, type FastlaneDetection, type FastlaneLane, type FetchChangelogOptions, type FieldLintResult, type FileValidationResult, type FindingSeverity, GOOGLE_PLAY_LANGUAGES, type GetAppStatusOptions, type GitNotesOptions, type GitReleaseNotes, GpcError, type ImageValidationResult, type InitOptions, type InitResult, type InternalSharingUploadResult, type ListIapOptions, type ListSubscriptionsOptions, type ListUsersOptions, type ListVoidedOptions, type ListingDiff, type ListingFieldLimits, type ListingLintResult, type ListingsResult, type LoadedPlugin, type MigrationResult, NetworkError, type OneTimeProductDiff, PERMISSION_PROPAGATION_WARNING, type ParsedManifest, type ParsedMonth, PluginManager, type PreflightConfig, type PreflightFinding, type PreflightOptions, type PreflightResult, type PreflightScanner, type PublishOptions, type PublishResult, type PushResult, type QuotaUsage, type ReleaseDiff, type ReleaseNotesValidation, type ReleaseStatusResult, type ReviewAnalysis, type ReviewExportOptions, type ReviewsFilterOptions, type RtdnStatus, SENSITIVE_ARG_KEYS, SENSITIVE_KEYS, SEVERITY_ORDER, type ScaffoldOptions, type ScaffoldResult, type Spinner, type StatusDiff, type StatusRelease, type StatusReviews, type StatusVitalMetric, type SubscriptionAnalytics, type SubscriptionDiff, type SyncResult, type ThresholdResult, type TrainConfig, type TrainState, type UploadResult, type ValidateCheck, type ValidateOptions, type ValidateResult, type VersionVitalsComparison, type VersionVitalsRow, type VitalsOverview, type VitalsQueryOptions, type VitalsTrendComparison, type WatchOptions, type WatchVitalsOptions, type WebhookPayload, abortTrain, acknowledgeProductPurchase, activateBasePlan, activateOffer, addRecoveryTargeting, addTesters, advanceTrain, analyzeBundle, analyzeRemoteListings, analyzeReviews, batchGetOrders, batchSyncInAppProducts, cancelRecoveryAction, cancelSubscriptionPurchase, cancelSubscriptionV2, checkBundleSize, checkThreshold, clearAuditLog, compareBundles, compareVersionVitals, compareVitalsTrend, computeStatusDiff, consumeProductPurchase, convertRegionPrices, createAuditEntry, createDeviceTier, createEnterpriseApp, createExternalTransaction, createGrant, createInAppProduct, createOffer, createOneTimeOffer, createOneTimeProduct, createRecoveryAction, createSpinner, createSubscription, createTrack, deactivateBasePlan, deactivateOffer, decodeNotification, deferSubscriptionPurchase, deferSubscriptionV2, deleteBasePlan, deleteGrant, deleteImage, deleteInAppProduct, deleteListing, deleteOffer, deleteOneTimeOffer, deleteOneTimeProduct, deleteSubscription, deployRecoveryAction, detectFastlane, detectOutputFormat, diffListings, diffListingsCommand, diffListingsEnhanced, diffOneTimeProduct, diffReleases, diffSubscription, discoverPlugins, downloadGeneratedApk, downloadReport, exportImages, exportReviews, fetchChangelog, fetchReleaseNotes, formatChangelogEntry, formatCustomPayload, formatDiscordPayload, formatJunit, formatNotification, formatOutput, formatSlackPayload, formatStatusDiff, formatStatusSummary, formatStatusTable, formatWordDiff, generateMigrationPlan, generateNotesFromGit, getAllScannerNames, getAppInfo, getAppStatus, getCountryAvailability, getDeviceTier, getExternalTransaction, getInAppProduct, getListings, getOffer, getOneTimeOffer, getOneTimeProduct, getOrderDetails, getProductPurchase, getProductPurchaseV2, getQuotaUsage, getReleasesStatus, getReview, getRtdnStatus, getSubscription, getSubscriptionAnalytics, getSubscriptionPurchase, getTrainStatus, getUser, getVitalsAnomalies, getVitalsAnr, getVitalsBattery, getVitalsCrashes, getVitalsErrorCount, getVitalsLmk, getVitalsMemory, getVitalsOverview, getVitalsRendering, getVitalsStartup, importDataSafety, importTestersFromCsv, initAudit, initProject, inviteUser, isFinancialReportType, isStatsReportType, isValidBcp47, isValidReportType, isValidStatsDimension, lintListing, lintListings, lintLocalListings, listAchievements, listAuditEvents, listDeviceTiers, listEvents, listGeneratedApks, listGrants, listImages, listInAppProducts, listLeaderboards, listOffers, listOneTimeOffers, listOneTimeProducts, listRecoveryActions, listReports, listReviews, listSubscriptions, listTesters, listTracks, listUsers, listVoidedPurchases, loadPreflightConfig, loadStatusCache, maybePaginate, migratePrices, parseAppfile, parseFastfile, parseGrantArg, parseMonth, pauseTrain, promoteRelease, publish, publishEnterpriseApp, pullListings, pushListings, readListingsFromDir, readReleaseNotesFromDir, redactAuditArgs, redactSensitive, refundExternalTransaction, refundOrder, relativeTime, removeTesters, removeUser, replyToReview, revokeSubscriptionPurchase, runPreflight, runWatchLoop, safePath, safePathWithin, saveStatusCache, scaffoldPlugin, searchAuditEvents, searchVitalsErrors, sendNotification, sendWebhook, sortResults, startTrain, statusHasBreach, syncInAppProducts, topFiles, trackBreachState, updateAppDetails, updateDataSafety, updateGrant, updateInAppProduct, updateListing, updateOffer, updateOneTimeOffer, updateOneTimeProduct, updateRollout, updateSubscription, updateTrackConfig, updateUser, uploadExternallyHosted, uploadImage, uploadInternalSharing, uploadRelease, validateImage, validateLanguageCode, validatePackageName, validatePreSubmission, validateReleaseNotes, validateSku, validateTrackName, validateUploadFile, validateVersionCode, watchVitalsWithAutoHalt, wordDiff, writeAuditLog, writeListingsToDir, writeMigrationOutput };
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,9 @@ var GpcError = class extends Error {
|
|
|
7
7
|
this.suggestion = suggestion;
|
|
8
8
|
this.name = "GpcError";
|
|
9
9
|
}
|
|
10
|
+
code;
|
|
11
|
+
exitCode;
|
|
12
|
+
suggestion;
|
|
10
13
|
toJSON() {
|
|
11
14
|
return {
|
|
12
15
|
success: false,
|
|
@@ -30,6 +33,7 @@ var ApiError = class extends GpcError {
|
|
|
30
33
|
this.statusCode = statusCode;
|
|
31
34
|
this.name = "ApiError";
|
|
32
35
|
}
|
|
36
|
+
statusCode;
|
|
33
37
|
};
|
|
34
38
|
var NetworkError = class extends GpcError {
|
|
35
39
|
constructor(message, suggestion) {
|
|
@@ -1666,7 +1670,7 @@ var ALL_IMAGE_TYPES = [
|
|
|
1666
1670
|
"tvBanner"
|
|
1667
1671
|
];
|
|
1668
1672
|
async function exportImages(client, packageName, dir, options) {
|
|
1669
|
-
const { mkdir: mkdir8, writeFile:
|
|
1673
|
+
const { mkdir: mkdir8, writeFile: writeFile9 } = await import("fs/promises");
|
|
1670
1674
|
const { join: join12 } = await import("path");
|
|
1671
1675
|
const edit = await client.edits.insert(packageName);
|
|
1672
1676
|
try {
|
|
@@ -1711,7 +1715,7 @@ async function exportImages(client, packageName, dir, options) {
|
|
|
1711
1715
|
}
|
|
1712
1716
|
const buffer = Buffer.from(await response.arrayBuffer());
|
|
1713
1717
|
const filePath = join12(dirPath, `${task.index}.png`);
|
|
1714
|
-
await
|
|
1718
|
+
await writeFile9(filePath, buffer);
|
|
1715
1719
|
return buffer.length;
|
|
1716
1720
|
})
|
|
1717
1721
|
);
|
|
@@ -2997,6 +3001,10 @@ async function getVitalsLmk(reporting, packageName, options) {
|
|
|
2997
3001
|
aggregation: "DAILY"
|
|
2998
3002
|
});
|
|
2999
3003
|
}
|
|
3004
|
+
async function getVitalsErrorCount(reporting, packageName, options) {
|
|
3005
|
+
const opts = options?.dimension ? options : { ...options, dimension: "reportType" };
|
|
3006
|
+
return queryMetric(reporting, packageName, "errorCountMetricSet", opts);
|
|
3007
|
+
}
|
|
3000
3008
|
async function getVitalsAnomalies(reporting, packageName) {
|
|
3001
3009
|
return reporting.getAnomalies(packageName);
|
|
3002
3010
|
}
|
|
@@ -3795,18 +3803,10 @@ async function addRecoveryTargeting(client, packageName, actionId, targeting) {
|
|
|
3795
3803
|
}
|
|
3796
3804
|
|
|
3797
3805
|
// src/commands/data-safety.ts
|
|
3798
|
-
import { readFile as readFile6
|
|
3799
|
-
async function getDataSafety(client, packageName) {
|
|
3800
|
-
return client.dataSafety.get(packageName);
|
|
3801
|
-
}
|
|
3806
|
+
import { readFile as readFile6 } from "fs/promises";
|
|
3802
3807
|
async function updateDataSafety(client, packageName, data) {
|
|
3803
3808
|
return client.dataSafety.update(packageName, data);
|
|
3804
3809
|
}
|
|
3805
|
-
async function exportDataSafety(client, packageName, outputPath) {
|
|
3806
|
-
const dataSafety = await getDataSafety(client, packageName);
|
|
3807
|
-
await writeFile3(outputPath, JSON.stringify(dataSafety, null, 2) + "\n", "utf-8");
|
|
3808
|
-
return dataSafety;
|
|
3809
|
-
}
|
|
3810
3810
|
async function importDataSafety(client, packageName, filePath) {
|
|
3811
3811
|
const content = await readFile6(filePath, "utf-8");
|
|
3812
3812
|
let data;
|
|
@@ -4112,7 +4112,7 @@ function createSpinner(message) {
|
|
|
4112
4112
|
}
|
|
4113
4113
|
|
|
4114
4114
|
// src/utils/train-state.ts
|
|
4115
|
-
import { mkdir as mkdir3, readFile as readFile7, writeFile as
|
|
4115
|
+
import { mkdir as mkdir3, readFile as readFile7, writeFile as writeFile3 } from "fs/promises";
|
|
4116
4116
|
import { dirname, join as join5 } from "path";
|
|
4117
4117
|
import { getCacheDir } from "@gpc-cli/config";
|
|
4118
4118
|
function stateFile(packageName) {
|
|
@@ -4131,7 +4131,7 @@ async function writeTrainState(packageName, state) {
|
|
|
4131
4131
|
const path = stateFile(packageName);
|
|
4132
4132
|
const dir = dirname(path);
|
|
4133
4133
|
await mkdir3(dir, { recursive: true });
|
|
4134
|
-
await
|
|
4134
|
+
await writeFile3(path, JSON.stringify(state, null, 2), "utf-8");
|
|
4135
4135
|
}
|
|
4136
4136
|
async function clearTrainState(packageName) {
|
|
4137
4137
|
const { unlink } = await import("fs/promises");
|
|
@@ -4289,16 +4289,19 @@ async function listEvents(client, packageName) {
|
|
|
4289
4289
|
}
|
|
4290
4290
|
|
|
4291
4291
|
// src/commands/enterprise.ts
|
|
4292
|
-
async function
|
|
4293
|
-
|
|
4294
|
-
|
|
4292
|
+
async function createEnterpriseApp(client, params) {
|
|
4293
|
+
return client.apps.create(params.accountId, params.bundlePath, {
|
|
4294
|
+
title: params.title,
|
|
4295
|
+
languageCode: params.languageCode ?? "en_US",
|
|
4296
|
+
organizations: params.organizations
|
|
4297
|
+
});
|
|
4295
4298
|
}
|
|
4296
|
-
async function
|
|
4297
|
-
return client
|
|
4299
|
+
async function publishEnterpriseApp(client, params) {
|
|
4300
|
+
return createEnterpriseApp(client, params);
|
|
4298
4301
|
}
|
|
4299
4302
|
|
|
4300
4303
|
// src/audit.ts
|
|
4301
|
-
import { appendFile, chmod, mkdir as mkdir4, readFile as readFile8, writeFile as
|
|
4304
|
+
import { appendFile, chmod, mkdir as mkdir4, readFile as readFile8, writeFile as writeFile4 } from "fs/promises";
|
|
4302
4305
|
import { join as join6 } from "path";
|
|
4303
4306
|
var auditDir = null;
|
|
4304
4307
|
function initAudit(configDir) {
|
|
@@ -4412,7 +4415,7 @@ async function clearAuditLog(options) {
|
|
|
4412
4415
|
if (!options?.before) {
|
|
4413
4416
|
const count = lines.length;
|
|
4414
4417
|
if (!options?.dryRun) {
|
|
4415
|
-
await
|
|
4418
|
+
await writeFile4(logPath, "", { encoding: "utf-8", mode: 384 });
|
|
4416
4419
|
}
|
|
4417
4420
|
return { deleted: count, remaining: 0 };
|
|
4418
4421
|
}
|
|
@@ -4432,7 +4435,7 @@ async function clearAuditLog(options) {
|
|
|
4432
4435
|
}
|
|
4433
4436
|
}
|
|
4434
4437
|
if (!options?.dryRun) {
|
|
4435
|
-
await
|
|
4438
|
+
await writeFile4(logPath, keep.length > 0 ? keep.join("\n") + "\n" : "", {
|
|
4436
4439
|
encoding: "utf-8",
|
|
4437
4440
|
mode: 384
|
|
4438
4441
|
});
|
|
@@ -4492,7 +4495,7 @@ function safePathWithin(userPath, baseDir) {
|
|
|
4492
4495
|
}
|
|
4493
4496
|
|
|
4494
4497
|
// src/commands/init.ts
|
|
4495
|
-
import { mkdir as mkdir5, writeFile as
|
|
4498
|
+
import { mkdir as mkdir5, writeFile as writeFile5, stat as stat7 } from "fs/promises";
|
|
4496
4499
|
import { join as join7 } from "path";
|
|
4497
4500
|
async function exists2(path) {
|
|
4498
4501
|
try {
|
|
@@ -4511,7 +4514,7 @@ async function safeWrite(filePath, content, created, skipped, skipExisting) {
|
|
|
4511
4514
|
}
|
|
4512
4515
|
const dir = filePath.substring(0, filePath.lastIndexOf("/"));
|
|
4513
4516
|
await mkdir5(dir, { recursive: true });
|
|
4514
|
-
await
|
|
4517
|
+
await writeFile5(filePath, content, "utf-8");
|
|
4515
4518
|
created.push(filePath);
|
|
4516
4519
|
}
|
|
4517
4520
|
async function initProject(options) {
|
|
@@ -6334,7 +6337,7 @@ function sortResults(items, sortSpec) {
|
|
|
6334
6337
|
}
|
|
6335
6338
|
|
|
6336
6339
|
// src/commands/plugin-scaffold.ts
|
|
6337
|
-
import { mkdir as mkdir6, writeFile as
|
|
6340
|
+
import { mkdir as mkdir6, writeFile as writeFile6 } from "fs/promises";
|
|
6338
6341
|
import { join as join10 } from "path";
|
|
6339
6342
|
async function scaffoldPlugin(options) {
|
|
6340
6343
|
const { name, dir, description = `GPC plugin: ${name}` } = options;
|
|
@@ -6377,7 +6380,7 @@ async function scaffoldPlugin(options) {
|
|
|
6377
6380
|
vitest: "^3.0.0"
|
|
6378
6381
|
}
|
|
6379
6382
|
};
|
|
6380
|
-
await
|
|
6383
|
+
await writeFile6(join10(dir, "package.json"), JSON.stringify(pkg, null, 2) + "\n");
|
|
6381
6384
|
files.push("package.json");
|
|
6382
6385
|
const tsconfig = {
|
|
6383
6386
|
compilerOptions: {
|
|
@@ -6393,7 +6396,7 @@ async function scaffoldPlugin(options) {
|
|
|
6393
6396
|
},
|
|
6394
6397
|
include: ["src"]
|
|
6395
6398
|
};
|
|
6396
|
-
await
|
|
6399
|
+
await writeFile6(join10(dir, "tsconfig.json"), JSON.stringify(tsconfig, null, 2) + "\n");
|
|
6397
6400
|
files.push("tsconfig.json");
|
|
6398
6401
|
const srcContent = `import { definePlugin } from "@gpc-cli/plugin-sdk";
|
|
6399
6402
|
import type { CommandEvent, CommandResult } from "@gpc-cli/plugin-sdk";
|
|
@@ -6426,7 +6429,7 @@ export const plugin = definePlugin({
|
|
|
6426
6429
|
},
|
|
6427
6430
|
});
|
|
6428
6431
|
`;
|
|
6429
|
-
await
|
|
6432
|
+
await writeFile6(join10(srcDir, "index.ts"), srcContent);
|
|
6430
6433
|
files.push("src/index.ts");
|
|
6431
6434
|
const testContent = `import { describe, it, expect, vi } from "vitest";
|
|
6432
6435
|
import { plugin } from "../src/index";
|
|
@@ -6451,7 +6454,7 @@ describe("${pluginName}", () => {
|
|
|
6451
6454
|
});
|
|
6452
6455
|
});
|
|
6453
6456
|
`;
|
|
6454
|
-
await
|
|
6457
|
+
await writeFile6(join10(testDir, "plugin.test.ts"), testContent);
|
|
6455
6458
|
files.push("tests/plugin.test.ts");
|
|
6456
6459
|
return { dir, files };
|
|
6457
6460
|
}
|
|
@@ -6601,7 +6604,7 @@ function detectFileType(filePath) {
|
|
|
6601
6604
|
}
|
|
6602
6605
|
|
|
6603
6606
|
// src/commands/generated-apks.ts
|
|
6604
|
-
import { writeFile as
|
|
6607
|
+
import { writeFile as writeFile7 } from "fs/promises";
|
|
6605
6608
|
async function listGeneratedApks(client, packageName, versionCode) {
|
|
6606
6609
|
if (!Number.isInteger(versionCode) || versionCode <= 0) {
|
|
6607
6610
|
throw new GpcError(
|
|
@@ -6632,7 +6635,7 @@ async function downloadGeneratedApk(client, packageName, versionCode, apkId, out
|
|
|
6632
6635
|
}
|
|
6633
6636
|
const buffer = await client.generatedApks.download(packageName, versionCode, apkId);
|
|
6634
6637
|
const bytes = new Uint8Array(buffer);
|
|
6635
|
-
await
|
|
6638
|
+
await writeFile7(outputPath, bytes);
|
|
6636
6639
|
return { path: outputPath, sizeBytes: bytes.byteLength };
|
|
6637
6640
|
}
|
|
6638
6641
|
|
|
@@ -6832,7 +6835,7 @@ async function checkBundleSize(analysis, configPath = ".bundlesize.json") {
|
|
|
6832
6835
|
}
|
|
6833
6836
|
|
|
6834
6837
|
// src/commands/status.ts
|
|
6835
|
-
import { mkdir as mkdir7, readFile as readFile15, writeFile as
|
|
6838
|
+
import { mkdir as mkdir7, readFile as readFile15, writeFile as writeFile8 } from "fs/promises";
|
|
6836
6839
|
import { execFile as execFile2 } from "child_process";
|
|
6837
6840
|
import { join as join11 } from "path";
|
|
6838
6841
|
import { getCacheDir as getCacheDir2 } from "@gpc-cli/config";
|
|
@@ -6861,7 +6864,7 @@ async function saveStatusCache(packageName, data, ttlSeconds = DEFAULT_TTL_SECON
|
|
|
6861
6864
|
const dir = getCacheDir2();
|
|
6862
6865
|
await mkdir7(dir, { recursive: true });
|
|
6863
6866
|
const entry = { fetchedAt: data.fetchedAt, ttl: ttlSeconds, data };
|
|
6864
|
-
await
|
|
6867
|
+
await writeFile8(cacheFilePath(packageName), JSON.stringify(entry, null, 2), {
|
|
6865
6868
|
encoding: "utf-8",
|
|
6866
6869
|
mode: 384
|
|
6867
6870
|
});
|
|
@@ -7264,7 +7267,7 @@ async function trackBreachState(packageName, isBreaching) {
|
|
|
7264
7267
|
if (prevBreaching !== isBreaching) {
|
|
7265
7268
|
try {
|
|
7266
7269
|
await mkdir7(getCacheDir2(), { recursive: true });
|
|
7267
|
-
await
|
|
7270
|
+
await writeFile8(
|
|
7268
7271
|
filePath,
|
|
7269
7272
|
JSON.stringify({ breaching: isBreaching, since: (/* @__PURE__ */ new Date()).toISOString() }, null, 2),
|
|
7270
7273
|
{ encoding: "utf-8", mode: 384 }
|
|
@@ -7520,7 +7523,6 @@ export {
|
|
|
7520
7523
|
discoverPlugins,
|
|
7521
7524
|
downloadGeneratedApk,
|
|
7522
7525
|
downloadReport,
|
|
7523
|
-
exportDataSafety,
|
|
7524
7526
|
exportImages,
|
|
7525
7527
|
exportReviews,
|
|
7526
7528
|
fetchChangelog,
|
|
@@ -7542,7 +7544,6 @@ export {
|
|
|
7542
7544
|
getAppInfo,
|
|
7543
7545
|
getAppStatus,
|
|
7544
7546
|
getCountryAvailability,
|
|
7545
|
-
getDataSafety,
|
|
7546
7547
|
getDeviceTier,
|
|
7547
7548
|
getExternalTransaction,
|
|
7548
7549
|
getInAppProduct,
|
|
@@ -7566,6 +7567,7 @@ export {
|
|
|
7566
7567
|
getVitalsAnr,
|
|
7567
7568
|
getVitalsBattery,
|
|
7568
7569
|
getVitalsCrashes,
|
|
7570
|
+
getVitalsErrorCount,
|
|
7569
7571
|
getVitalsLmk,
|
|
7570
7572
|
getVitalsMemory,
|
|
7571
7573
|
getVitalsOverview,
|
|
@@ -7587,7 +7589,6 @@ export {
|
|
|
7587
7589
|
listAchievements,
|
|
7588
7590
|
listAuditEvents,
|
|
7589
7591
|
listDeviceTiers,
|
|
7590
|
-
listEnterpriseApps,
|
|
7591
7592
|
listEvents,
|
|
7592
7593
|
listGeneratedApks,
|
|
7593
7594
|
listGrants,
|
|
@@ -7616,6 +7617,7 @@ export {
|
|
|
7616
7617
|
pauseTrain,
|
|
7617
7618
|
promoteRelease,
|
|
7618
7619
|
publish,
|
|
7620
|
+
publishEnterpriseApp,
|
|
7619
7621
|
pullListings,
|
|
7620
7622
|
pushListings,
|
|
7621
7623
|
readListingsFromDir,
|