@gpc-cli/core 0.9.18 → 0.9.19
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 +2 -2
- package/dist/index.js +46 -54
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -493,8 +493,8 @@ interface ParsedMonth {
|
|
|
493
493
|
month: number;
|
|
494
494
|
}
|
|
495
495
|
declare function parseMonth(monthStr: string): ParsedMonth;
|
|
496
|
-
declare function listReports(
|
|
497
|
-
declare function downloadReport(
|
|
496
|
+
declare function listReports(_client: PlayApiClient, _packageName: string, reportType: ReportType, _year: number, _month: number): Promise<ReportBucket[]>;
|
|
497
|
+
declare function downloadReport(_client: PlayApiClient, _packageName: string, reportType: ReportType, _year: number, _month: number): Promise<string>;
|
|
498
498
|
|
|
499
499
|
declare function listTesters(client: PlayApiClient, packageName: string, track: string): Promise<Testers>;
|
|
500
500
|
declare function addTesters(client: PlayApiClient, packageName: string, track: string, groupEmails: string[]): Promise<Testers>;
|
package/dist/index.js
CHANGED
|
@@ -217,8 +217,8 @@ function toTestCases(data, commandName) {
|
|
|
217
217
|
const cases = [];
|
|
218
218
|
let failures = 0;
|
|
219
219
|
if (Array.isArray(data)) {
|
|
220
|
-
for (
|
|
221
|
-
const tc = buildTestCase(
|
|
220
|
+
for (let i = 0; i < data.length; i++) {
|
|
221
|
+
const tc = buildTestCase(data[i], commandName, i);
|
|
222
222
|
cases.push(tc.xml);
|
|
223
223
|
if (tc.failed) failures++;
|
|
224
224
|
}
|
|
@@ -233,7 +233,7 @@ function toTestCases(data, commandName) {
|
|
|
233
233
|
}
|
|
234
234
|
return { cases, failures };
|
|
235
235
|
}
|
|
236
|
-
function buildTestCase(item, commandName) {
|
|
236
|
+
function buildTestCase(item, commandName, index = 0) {
|
|
237
237
|
if (typeof item !== "object" || item === null) {
|
|
238
238
|
const text = String(item);
|
|
239
239
|
return {
|
|
@@ -243,7 +243,9 @@ function buildTestCase(item, commandName) {
|
|
|
243
243
|
}
|
|
244
244
|
const record = item;
|
|
245
245
|
const name = escapeXml(
|
|
246
|
-
String(
|
|
246
|
+
String(
|
|
247
|
+
record["name"] ?? record["title"] ?? record["sku"] ?? record["id"] ?? record["productId"] ?? record["packageName"] ?? record["trackId"] ?? record["region"] ?? record["languageCode"] ?? `item-${index + 1}`
|
|
248
|
+
)
|
|
247
249
|
);
|
|
248
250
|
const classname = `gpc.${escapeXml(commandName)}`;
|
|
249
251
|
const breached = record["breached"];
|
|
@@ -1941,19 +1943,25 @@ function csvEscape(value) {
|
|
|
1941
1943
|
}
|
|
1942
1944
|
|
|
1943
1945
|
// src/commands/vitals.ts
|
|
1944
|
-
|
|
1946
|
+
var METRIC_SET_METRICS = {
|
|
1947
|
+
crashRateMetricSet: ["crashRate", "userPerceivedCrashRate", "distinctUsers"],
|
|
1948
|
+
anrRateMetricSet: ["anrRate", "userPerceivedAnrRate", "distinctUsers"],
|
|
1949
|
+
slowStartRateMetricSet: ["slowStartRate", "distinctUsers"],
|
|
1950
|
+
slowRenderingRateMetricSet: ["slowRenderingRate", "distinctUsers"],
|
|
1951
|
+
excessiveWakeupRateMetricSet: ["excessiveWakeupRate", "distinctUsers"],
|
|
1952
|
+
stuckBackgroundWakelockRateMetricSet: ["stuckBackgroundWakelockRate", "distinctUsers"],
|
|
1953
|
+
errorCountMetricSet: ["errorReportCount", "distinctUsers"]
|
|
1954
|
+
};
|
|
1955
|
+
function buildQuery(metricSet, options) {
|
|
1956
|
+
const metrics = METRIC_SET_METRICS[metricSet] ?? ["errorReportCount", "distinctUsers"];
|
|
1957
|
+
const days = options?.days ?? 30;
|
|
1958
|
+
const end = /* @__PURE__ */ new Date();
|
|
1959
|
+
const start = /* @__PURE__ */ new Date();
|
|
1960
|
+
start.setDate(start.getDate() - days);
|
|
1945
1961
|
const query = {
|
|
1946
|
-
metrics
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
query.dimensions = [options.dimension];
|
|
1950
|
-
}
|
|
1951
|
-
if (options?.days) {
|
|
1952
|
-
const end = /* @__PURE__ */ new Date();
|
|
1953
|
-
const start = /* @__PURE__ */ new Date();
|
|
1954
|
-
start.setDate(start.getDate() - options.days);
|
|
1955
|
-
query.timelineSpec = {
|
|
1956
|
-
aggregationPeriod: options.aggregation ?? "DAILY",
|
|
1962
|
+
metrics,
|
|
1963
|
+
timelineSpec: {
|
|
1964
|
+
aggregationPeriod: options?.aggregation ?? "DAILY",
|
|
1957
1965
|
startTime: {
|
|
1958
1966
|
year: start.getFullYear(),
|
|
1959
1967
|
month: start.getMonth() + 1,
|
|
@@ -1964,12 +1972,15 @@ function buildQuery(options) {
|
|
|
1964
1972
|
month: end.getMonth() + 1,
|
|
1965
1973
|
day: end.getDate()
|
|
1966
1974
|
}
|
|
1967
|
-
}
|
|
1975
|
+
}
|
|
1976
|
+
};
|
|
1977
|
+
if (options?.dimension) {
|
|
1978
|
+
query.dimensions = [options.dimension];
|
|
1968
1979
|
}
|
|
1969
1980
|
return query;
|
|
1970
1981
|
}
|
|
1971
1982
|
async function queryMetric(reporting, packageName, metricSet, options) {
|
|
1972
|
-
const query = buildQuery(options);
|
|
1983
|
+
const query = buildQuery(metricSet, options);
|
|
1973
1984
|
return reporting.queryMetricSet(packageName, metricSet, query);
|
|
1974
1985
|
}
|
|
1975
1986
|
async function getVitalsOverview(reporting, packageName) {
|
|
@@ -1983,9 +1994,7 @@ async function getVitalsOverview(reporting, packageName) {
|
|
|
1983
1994
|
];
|
|
1984
1995
|
const results = await Promise.allSettled(
|
|
1985
1996
|
metricSets.map(
|
|
1986
|
-
([metric]) => reporting.queryMetricSet(packageName, metric,
|
|
1987
|
-
metrics: ["errorReportCount", "distinctUsers"]
|
|
1988
|
-
})
|
|
1997
|
+
([metric]) => reporting.queryMetricSet(packageName, metric, buildQuery(metric))
|
|
1989
1998
|
)
|
|
1990
1999
|
);
|
|
1991
2000
|
const overview = {};
|
|
@@ -2033,8 +2042,9 @@ async function compareVitalsTrend(reporting, packageName, metricSet, days = 7) {
|
|
|
2033
2042
|
const previousEnd = new Date(currentStart);
|
|
2034
2043
|
const previousStart = new Date(previousEnd);
|
|
2035
2044
|
previousStart.setDate(previousStart.getDate() - days);
|
|
2045
|
+
const metrics = METRIC_SET_METRICS[metricSet] ?? ["errorReportCount", "distinctUsers"];
|
|
2036
2046
|
const makeQuery = (start, end) => ({
|
|
2037
|
-
metrics
|
|
2047
|
+
metrics,
|
|
2038
2048
|
timelineSpec: {
|
|
2039
2049
|
aggregationPeriod: "DAILY",
|
|
2040
2050
|
startTime: { year: start.getFullYear(), month: start.getMonth() + 1, day: start.getDate() },
|
|
@@ -2610,39 +2620,21 @@ function parseMonth(monthStr) {
|
|
|
2610
2620
|
}
|
|
2611
2621
|
return { year, month };
|
|
2612
2622
|
}
|
|
2613
|
-
async function listReports(
|
|
2614
|
-
|
|
2615
|
-
|
|
2623
|
+
async function listReports(_client, _packageName, reportType, _year, _month) {
|
|
2624
|
+
throw new GpcError(
|
|
2625
|
+
`Report listing for "${reportType}" is not available through the Google Play Developer API.`,
|
|
2626
|
+
"REPORT_NOT_SUPPORTED",
|
|
2627
|
+
1,
|
|
2628
|
+
isFinancialReportType(reportType) ? "Financial reports are delivered via Google Cloud Storage. Access them from Play Console \u2192 Download reports \u2192 Financial." : "Stats reports are delivered via Google Cloud Storage. For real-time metrics, use 'gpc vitals' commands."
|
|
2629
|
+
);
|
|
2616
2630
|
}
|
|
2617
|
-
async function downloadReport(
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
1,
|
|
2625
|
-
`Reports may not be available yet for this period. Financial reports are typically available a few days after the month ends. Try a different month or report type.`
|
|
2626
|
-
);
|
|
2627
|
-
}
|
|
2628
|
-
const bucket = reports[0];
|
|
2629
|
-
if (!bucket) {
|
|
2630
|
-
throw new GpcError(
|
|
2631
|
-
`No ${reportType} reports found for ${year}-${monthPadded}.`,
|
|
2632
|
-
"REPORT_NOT_FOUND",
|
|
2633
|
-
1,
|
|
2634
|
-
`Reports may not be available yet for this period. Try a different month or report type.`
|
|
2635
|
-
);
|
|
2636
|
-
}
|
|
2637
|
-
const uri = bucket.uri;
|
|
2638
|
-
const response = await fetch(uri);
|
|
2639
|
-
if (!response.ok) {
|
|
2640
|
-
throw new NetworkError(
|
|
2641
|
-
`Failed to download report from signed URI: HTTP ${response.status}`,
|
|
2642
|
-
"The signed download URL may have expired. Retry the command to generate a fresh URL."
|
|
2643
|
-
);
|
|
2644
|
-
}
|
|
2645
|
-
return response.text();
|
|
2631
|
+
async function downloadReport(_client, _packageName, reportType, _year, _month) {
|
|
2632
|
+
throw new GpcError(
|
|
2633
|
+
`Report download for "${reportType}" is not available through the Google Play Developer API.`,
|
|
2634
|
+
"REPORT_NOT_SUPPORTED",
|
|
2635
|
+
1,
|
|
2636
|
+
isFinancialReportType(reportType) ? "Financial reports are delivered via Google Cloud Storage. Access them from Play Console \u2192 Download reports \u2192 Financial." : "Stats reports are delivered via Google Cloud Storage. For real-time metrics, use 'gpc vitals' commands."
|
|
2637
|
+
);
|
|
2646
2638
|
}
|
|
2647
2639
|
|
|
2648
2640
|
// src/commands/users.ts
|