@gpc-cli/cli 0.9.35 → 0.9.37
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 +9 -9
- package/dist/{anomalies-QZJGQXTZ.js → anomalies-KRRA75MJ.js} +1 -1
- package/dist/anomalies-KRRA75MJ.js.map +1 -0
- package/dist/{audit-4UPTLW37.js → audit-N2CRHWUN.js} +20 -4
- package/dist/audit-N2CRHWUN.js.map +1 -0
- package/dist/{auth-KPVEGAWV.js → auth-XGSTT5G5.js} +9 -3
- package/dist/auth-XGSTT5G5.js.map +1 -0
- package/dist/bin.js +2 -2
- package/dist/bin.js.map +1 -1
- package/dist/{bundle-7XYHNVNF.js → bundle-F43TD2BQ.js} +22 -13
- package/dist/{bundle-7XYHNVNF.js.map → bundle-F43TD2BQ.js.map} +1 -1
- package/dist/{cache-K23N6GJR.js → cache-SLNFRTI2.js} +7 -3
- package/dist/cache-SLNFRTI2.js.map +1 -0
- package/dist/{chunk-DDTPDKTB.js → chunk-EO7EJDT7.js} +49 -43
- package/dist/chunk-EO7EJDT7.js.map +1 -0
- package/dist/{chunk-7BXCQKJG.js → chunk-P5GF73XK.js} +1 -1
- package/dist/chunk-P5GF73XK.js.map +1 -0
- package/dist/{chunk-43SH6XEJ.js → chunk-U6ZTQ34I.js} +11 -13
- package/dist/chunk-U6ZTQ34I.js.map +1 -0
- package/dist/{completion-C3PPWNS7.js → completion-BCHRJSAT.js} +23 -10
- package/dist/completion-BCHRJSAT.js.map +1 -0
- package/dist/{config-REB7NINL.js → config-F2U3KUHX.js} +2 -2
- package/dist/{data-safety-GN5VBKAK.js → data-safety-JR6PZ2BD.js} +11 -8
- package/dist/data-safety-JR6PZ2BD.js.map +1 -0
- package/dist/{device-tiers-GHIYJPMB.js → device-tiers-5SGJPSYG.js} +7 -8
- package/dist/device-tiers-5SGJPSYG.js.map +1 -0
- package/dist/{docs-HIGQU4UL.js → docs-7DUXIKA3.js} +3 -3
- package/dist/docs-7DUXIKA3.js.map +1 -0
- package/dist/{doctor-QDIFTXNB.js → doctor-4BUPAVFT.js} +10 -8
- package/dist/doctor-4BUPAVFT.js.map +1 -0
- package/dist/{enterprise-IH5HXYRB.js → enterprise-7THXNBTC.js} +6 -2
- package/dist/{enterprise-IH5HXYRB.js.map → enterprise-7THXNBTC.js.map} +1 -1
- package/dist/{external-transactions-HCL7ROMN.js → external-transactions-O5P4QBIT.js} +5 -8
- package/dist/external-transactions-O5P4QBIT.js.map +1 -0
- package/dist/{feedback-NVGHRU7A.js → feedback-ERWH4SZF.js} +3 -3
- package/dist/{generated-apks-VX7HYZDU.js → generated-apks-KB2PLWDI.js} +2 -6
- package/dist/generated-apks-KB2PLWDI.js.map +1 -0
- package/dist/{grants-CXTTYKR3.js → grants-TKQJ3IER.js} +25 -6
- package/dist/grants-TKQJ3IER.js.map +1 -0
- package/dist/{iap-MBDD7VWP.js → iap-BNIAHBDN.js} +7 -3
- package/dist/iap-BNIAHBDN.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/{internal-sharing-E7SJYDW3.js → internal-sharing-M74VNIQ2.js} +7 -7
- package/dist/internal-sharing-M74VNIQ2.js.map +1 -0
- package/dist/{listings-7TWCGGMS.js → listings-IVHZJNES.js} +2 -2
- package/dist/listings-IVHZJNES.js.map +1 -0
- package/dist/{migrate-OHN2FDY6.js → migrate-SQT6RD6T.js} +2 -4
- package/dist/migrate-SQT6RD6T.js.map +1 -0
- package/dist/{one-time-products-2PK4QKWE.js → one-time-products-3WNXDKE3.js} +43 -28
- package/dist/one-time-products-3WNXDKE3.js.map +1 -0
- package/dist/{pricing-BYZSLN74.js → pricing-HMHZD44S.js} +1 -1
- package/dist/pricing-HMHZD44S.js.map +1 -0
- package/dist/{publish-XM43UA5R.js → publish-EPZXLGKZ.js} +3 -9
- package/dist/publish-EPZXLGKZ.js.map +1 -0
- package/dist/{purchases-WIDU3FDQ.js → purchases-7ZPVCN6D.js} +4 -2
- package/dist/purchases-7ZPVCN6D.js.map +1 -0
- package/dist/{quickstart-N7FXM5RQ.js → quickstart-EYNNOTVD.js} +2 -2
- package/dist/quickstart-EYNNOTVD.js.map +1 -0
- package/dist/quota-UHIQQYOY.js +58 -0
- package/dist/quota-UHIQQYOY.js.map +1 -0
- package/dist/{recovery-S5UNJDBO.js → recovery-YGPOVUFD.js} +7 -3
- package/dist/recovery-YGPOVUFD.js.map +1 -0
- package/dist/{releases-YRYM7JXC.js → releases-I7QQVKPJ.js} +59 -23
- package/dist/releases-I7QQVKPJ.js.map +1 -0
- package/dist/{reports-YOT4DQGL.js → reports-2YX3RDOS.js} +1 -1
- package/dist/reports-2YX3RDOS.js.map +1 -0
- package/dist/{reviews-NN7YQITF.js → reviews-MOVGATUI.js} +18 -9
- package/dist/reviews-MOVGATUI.js.map +1 -0
- package/dist/{status-L5S2FGZ4.js → status-G3AMJ34G.js} +5 -3
- package/dist/status-G3AMJ34G.js.map +1 -0
- package/dist/{subscriptions-OXAE7SNS.js → subscriptions-LSOJID6H.js} +8 -2
- package/dist/subscriptions-LSOJID6H.js.map +1 -0
- package/dist/{update-6XSZRXSU.js → update-O63L7KFJ.js} +6 -12
- package/dist/update-O63L7KFJ.js.map +1 -0
- package/dist/{users-JASXONRY.js → users-2YTC4Q36.js} +1 -1
- package/dist/users-2YTC4Q36.js.map +1 -0
- package/dist/{validate-NC4MWKOB.js → validate-VNIS6OEB.js} +2 -2
- package/dist/{version-2X32UAAE.js → version-JY5ITFST.js} +11 -9
- package/dist/version-JY5ITFST.js.map +1 -0
- package/dist/{vitals-LFL75LA6.js → vitals-H7DCI6JJ.js} +16 -9
- package/dist/vitals-H7DCI6JJ.js.map +1 -0
- package/package.json +5 -5
- package/dist/anomalies-QZJGQXTZ.js.map +0 -1
- package/dist/audit-4UPTLW37.js.map +0 -1
- package/dist/auth-KPVEGAWV.js.map +0 -1
- package/dist/cache-K23N6GJR.js.map +0 -1
- package/dist/chunk-43SH6XEJ.js.map +0 -1
- package/dist/chunk-7BXCQKJG.js.map +0 -1
- package/dist/chunk-DDTPDKTB.js.map +0 -1
- package/dist/completion-C3PPWNS7.js.map +0 -1
- package/dist/data-safety-GN5VBKAK.js.map +0 -1
- package/dist/device-tiers-GHIYJPMB.js.map +0 -1
- package/dist/docs-HIGQU4UL.js.map +0 -1
- package/dist/doctor-QDIFTXNB.js.map +0 -1
- package/dist/external-transactions-HCL7ROMN.js.map +0 -1
- package/dist/generated-apks-VX7HYZDU.js.map +0 -1
- package/dist/grants-CXTTYKR3.js.map +0 -1
- package/dist/iap-MBDD7VWP.js.map +0 -1
- package/dist/internal-sharing-E7SJYDW3.js.map +0 -1
- package/dist/listings-7TWCGGMS.js.map +0 -1
- package/dist/migrate-OHN2FDY6.js.map +0 -1
- package/dist/one-time-products-2PK4QKWE.js.map +0 -1
- package/dist/pricing-BYZSLN74.js.map +0 -1
- package/dist/publish-XM43UA5R.js.map +0 -1
- package/dist/purchases-WIDU3FDQ.js.map +0 -1
- package/dist/quickstart-N7FXM5RQ.js.map +0 -1
- package/dist/quota-SNUI75NM.js +0 -53
- package/dist/quota-SNUI75NM.js.map +0 -1
- package/dist/recovery-S5UNJDBO.js.map +0 -1
- package/dist/releases-YRYM7JXC.js.map +0 -1
- package/dist/reports-YOT4DQGL.js.map +0 -1
- package/dist/reviews-NN7YQITF.js.map +0 -1
- package/dist/status-L5S2FGZ4.js.map +0 -1
- package/dist/subscriptions-OXAE7SNS.js.map +0 -1
- package/dist/update-6XSZRXSU.js.map +0 -1
- package/dist/users-JASXONRY.js.map +0 -1
- package/dist/version-2X32UAAE.js.map +0 -1
- package/dist/vitals-LFL75LA6.js.map +0 -1
- /package/dist/{config-REB7NINL.js.map → config-F2U3KUHX.js.map} +0 -0
- /package/dist/{feedback-NVGHRU7A.js.map → feedback-ERWH4SZF.js.map} +0 -0
- /package/dist/{validate-NC4MWKOB.js.map → validate-VNIS6OEB.js.map} +0 -0
|
@@ -11,10 +11,7 @@ import {
|
|
|
11
11
|
import { loadConfig } from "@gpc-cli/config";
|
|
12
12
|
import { resolveAuth } from "@gpc-cli/auth";
|
|
13
13
|
import { createApiClient } from "@gpc-cli/api";
|
|
14
|
-
import {
|
|
15
|
-
importDataSafety,
|
|
16
|
-
formatOutput
|
|
17
|
-
} from "@gpc-cli/core";
|
|
14
|
+
import { importDataSafety, formatOutput } from "@gpc-cli/core";
|
|
18
15
|
function resolvePackageName(packageArg, config) {
|
|
19
16
|
const name = packageArg || config.app;
|
|
20
17
|
if (!name) {
|
|
@@ -30,13 +27,17 @@ async function getClient(config) {
|
|
|
30
27
|
function registerDataSafetyCommands(program) {
|
|
31
28
|
const dataSafety = program.command("data-safety").description("Manage data safety declarations");
|
|
32
29
|
dataSafety.command("get").description("Get the current data safety declaration").action(async () => {
|
|
33
|
-
console.error(
|
|
30
|
+
console.error(
|
|
31
|
+
"Error: The Google Play Developer API does not provide a GET endpoint for data safety declarations."
|
|
32
|
+
);
|
|
34
33
|
console.error("");
|
|
35
34
|
console.error("Data safety labels can only be updated (not read) via the API.");
|
|
36
35
|
console.error("To view your current data safety declaration, use the Google Play Console:");
|
|
37
36
|
console.error(" https://play.google.com/console \u2192 App content \u2192 Data safety");
|
|
38
37
|
console.error("");
|
|
39
|
-
console.error(
|
|
38
|
+
console.error(
|
|
39
|
+
"To update data safety via the API, use: gpc data-safety update --file <csv-file>"
|
|
40
|
+
);
|
|
40
41
|
process.exit(2);
|
|
41
42
|
});
|
|
42
43
|
dataSafety.command("update").description("Update data safety declaration from a JSON file").requiredOption("--file <path>", "Path to data safety JSON file").action(async (options) => {
|
|
@@ -65,7 +66,9 @@ function registerDataSafetyCommands(program) {
|
|
|
65
66
|
}
|
|
66
67
|
});
|
|
67
68
|
dataSafety.command("export").description("Export data safety declaration to a JSON file").option("--output <path>", "Output file path", "data-safety.json").action(async () => {
|
|
68
|
-
console.error(
|
|
69
|
+
console.error(
|
|
70
|
+
"Error: The Google Play Developer API does not provide a GET endpoint for data safety declarations."
|
|
71
|
+
);
|
|
69
72
|
console.error("Data safety labels cannot be exported via the API.");
|
|
70
73
|
console.error("");
|
|
71
74
|
console.error("To export your data safety declaration, use the Google Play Console:");
|
|
@@ -76,4 +79,4 @@ function registerDataSafetyCommands(program) {
|
|
|
76
79
|
export {
|
|
77
80
|
registerDataSafetyCommands
|
|
78
81
|
};
|
|
79
|
-
//# sourceMappingURL=data-safety-
|
|
82
|
+
//# sourceMappingURL=data-safety-JR6PZ2BD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/data-safety.ts"],"sourcesContent":["import type { Command } from \"commander\";\nimport type { GpcConfig } from \"@gpc-cli/config\";\nimport { loadConfig } from \"@gpc-cli/config\";\nimport { resolveAuth } from \"@gpc-cli/auth\";\nimport { createApiClient } from \"@gpc-cli/api\";\nimport { importDataSafety, formatOutput } from \"@gpc-cli/core\";\nimport { isDryRun, printDryRun } from \"../dry-run.js\";\nimport { getOutputFormat } from \"../format.js\";\n\nfunction resolvePackageName(packageArg: string | undefined, config: GpcConfig): string {\n const name = packageArg || config.app;\n if (!name) {\n console.error(\"Error: No package name. Use --app <package> or gpc config set app <package>\");\n process.exit(2);\n }\n return name;\n}\n\nasync function getClient(config: GpcConfig) {\n const auth = await resolveAuth({ serviceAccountPath: config.auth?.serviceAccount });\n return createApiClient({ auth });\n}\n\nexport function registerDataSafetyCommands(program: Command): void {\n const dataSafety = program.command(\"data-safety\").description(\"Manage data safety declarations\");\n\n // Get — not supported by Google Play API (no GET endpoint for data safety)\n dataSafety\n .command(\"get\")\n .description(\"Get the current data safety declaration\")\n .action(async () => {\n console.error(\n \"Error: The Google Play Developer API does not provide a GET endpoint for data safety declarations.\",\n );\n console.error(\"\");\n console.error(\"Data safety labels can only be updated (not read) via the API.\");\n console.error(\"To view your current data safety declaration, use the Google Play Console:\");\n console.error(\" https://play.google.com/console → App content → Data safety\");\n console.error(\"\");\n console.error(\n \"To update data safety via the API, use: gpc data-safety update --file <csv-file>\",\n );\n process.exit(2);\n });\n\n // Update\n dataSafety\n .command(\"update\")\n .description(\"Update data safety declaration from a JSON file\")\n .requiredOption(\"--file <path>\", \"Path to data safety JSON file\")\n .action(async (options) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const format = getOutputFormat(program, config);\n\n if (isDryRun(program)) {\n printDryRun(\n {\n command: \"data-safety update\",\n action: \"update data safety from\",\n target: options.file,\n },\n format,\n formatOutput,\n );\n return;\n }\n\n const client = await getClient(config);\n\n try {\n const result = await importDataSafety(client, packageName, options.file);\n console.log(formatOutput(result, format));\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n\n // Export — not supported (no GET endpoint)\n dataSafety\n .command(\"export\")\n .description(\"Export data safety declaration to a JSON file\")\n .option(\"--output <path>\", \"Output file path\", \"data-safety.json\")\n .action(async () => {\n console.error(\n \"Error: The Google Play Developer API does not provide a GET endpoint for data safety declarations.\",\n );\n console.error(\"Data safety labels cannot be exported via the API.\");\n console.error(\"\");\n console.error(\"To export your data safety declaration, use the Google Play Console:\");\n console.error(\" App content → Data safety → Export to CSV\");\n process.exit(2);\n });\n}\n"],"mappings":";;;;;;;;;;AAEA,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAChC,SAAS,kBAAkB,oBAAoB;AAI/C,SAAS,mBAAmB,YAAgC,QAA2B;AACrF,QAAM,OAAO,cAAc,OAAO;AAClC,MAAI,CAAC,MAAM;AACT,YAAQ,MAAM,6EAA6E;AAC3F,YAAQ,KAAK,CAAC;AAAA,EAChB;AACA,SAAO;AACT;AAEA,eAAe,UAAU,QAAmB;AAC1C,QAAM,OAAO,MAAM,YAAY,EAAE,oBAAoB,OAAO,MAAM,eAAe,CAAC;AAClF,SAAO,gBAAgB,EAAE,KAAK,CAAC;AACjC;AAEO,SAAS,2BAA2B,SAAwB;AACjE,QAAM,aAAa,QAAQ,QAAQ,aAAa,EAAE,YAAY,iCAAiC;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E;AACpF,YAAQ,MAAM,uDAA6C;AAC3D,YAAQ,KAAK,CAAC;AAAA,EAChB,CAAC;AACL;","names":[]}
|
|
@@ -11,12 +11,7 @@ import {
|
|
|
11
11
|
import { loadConfig } from "@gpc-cli/config";
|
|
12
12
|
import { resolveAuth } from "@gpc-cli/auth";
|
|
13
13
|
import { createApiClient } from "@gpc-cli/api";
|
|
14
|
-
import {
|
|
15
|
-
listDeviceTiers,
|
|
16
|
-
getDeviceTier,
|
|
17
|
-
createDeviceTier,
|
|
18
|
-
formatOutput
|
|
19
|
-
} from "@gpc-cli/core";
|
|
14
|
+
import { listDeviceTiers, getDeviceTier, createDeviceTier, formatOutput } from "@gpc-cli/core";
|
|
20
15
|
import { readFile } from "fs/promises";
|
|
21
16
|
function resolvePackageName(packageArg, config) {
|
|
22
17
|
const name = packageArg || config.app;
|
|
@@ -78,7 +73,11 @@ function registerDeviceTiersCommands(program) {
|
|
|
78
73
|
const format = getOutputFormat(program, config);
|
|
79
74
|
if (isDryRun(program)) {
|
|
80
75
|
printDryRun(
|
|
81
|
-
{
|
|
76
|
+
{
|
|
77
|
+
command: "device-tiers create",
|
|
78
|
+
action: "create device tier config from",
|
|
79
|
+
target: opts.file
|
|
80
|
+
},
|
|
82
81
|
format,
|
|
83
82
|
formatOutput
|
|
84
83
|
);
|
|
@@ -99,4 +98,4 @@ function registerDeviceTiersCommands(program) {
|
|
|
99
98
|
export {
|
|
100
99
|
registerDeviceTiersCommands
|
|
101
100
|
};
|
|
102
|
-
//# sourceMappingURL=device-tiers-
|
|
101
|
+
//# sourceMappingURL=device-tiers-5SGJPSYG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/device-tiers.ts"],"sourcesContent":["import type { Command } from \"commander\";\nimport type { GpcConfig } from \"@gpc-cli/config\";\nimport { loadConfig } from \"@gpc-cli/config\";\nimport { resolveAuth } from \"@gpc-cli/auth\";\nimport { createApiClient } from \"@gpc-cli/api\";\nimport { listDeviceTiers, getDeviceTier, createDeviceTier, formatOutput } from \"@gpc-cli/core\";\nimport { getOutputFormat } from \"../format.js\";\nimport { isDryRun, printDryRun } from \"../dry-run.js\";\nimport { readFile } from \"node:fs/promises\";\n\nfunction resolvePackageName(packageArg: string | undefined, config: GpcConfig): string {\n const name = packageArg || config.app;\n if (!name) {\n console.error(\"Error: No package name. Use --app <package> or gpc config set app <package>\");\n process.exit(2);\n }\n return name;\n}\n\nasync function getClient(config: GpcConfig) {\n const auth = await resolveAuth({ serviceAccountPath: config.auth?.serviceAccount });\n return createApiClient({ auth });\n}\n\nexport function registerDeviceTiersCommands(program: Command): void {\n const dt = program.command(\"device-tiers\").description(\"Manage device tier configurations\");\n\n dt.command(\"list\")\n .description(\"List device tier configurations\")\n .action(async () => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const client = await getClient(config);\n const format = getOutputFormat(program, config);\n\n try {\n const result = await listDeviceTiers(client, packageName);\n const configs = (result as unknown as Record<string, unknown>)[\"deviceTierConfigs\"] as\n | Record<string, unknown>[]\n | undefined;\n if (format !== \"json\" && (!configs || configs.length === 0)) {\n console.log(\"No device tier configs found.\");\n return;\n }\n if (format !== \"json\" && configs) {\n const rows = configs.map((c) => ({\n deviceTierConfigId: c[\"deviceTierConfigId\"] || \"-\",\n deviceGroups: Array.isArray(c[\"deviceGroups\"])\n ? (c[\"deviceGroups\"] as unknown[]).length\n : 0,\n deviceTierSet: c[\"deviceTierSet\"] ? \"yes\" : \"no\",\n }));\n console.log(formatOutput(rows, format));\n } else {\n console.log(formatOutput(result, format));\n }\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n\n dt.command(\"get <config-id>\")\n .description(\"Get a device tier configuration\")\n .action(async (configId: string) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const client = await getClient(config);\n const format = getOutputFormat(program, config);\n\n try {\n const result = await getDeviceTier(client, packageName, configId);\n console.log(formatOutput(result, format));\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n\n dt.command(\"create\")\n .description(\"Create a device tier configuration from a JSON file\")\n .requiredOption(\"--file <path>\", \"Path to JSON config file\")\n .action(async (opts: { file: string }) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const format = getOutputFormat(program, config);\n\n if (isDryRun(program)) {\n printDryRun(\n {\n command: \"device-tiers create\",\n action: \"create device tier config from\",\n target: opts.file,\n },\n format,\n formatOutput,\n );\n return;\n }\n\n const client = await getClient(config);\n\n try {\n const raw = await readFile(opts.file, \"utf-8\");\n const tierConfig = JSON.parse(raw);\n const result = await createDeviceTier(client, packageName, tierConfig);\n console.log(formatOutput(result, format));\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n}\n"],"mappings":";;;;;;;;;;AAEA,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAChC,SAAS,iBAAiB,eAAe,kBAAkB,oBAAoB;AAG/E,SAAS,gBAAgB;AAEzB,SAAS,mBAAmB,YAAgC,QAA2B;AACrF,QAAM,OAAO,cAAc,OAAO;AAClC,MAAI,CAAC,MAAM;AACT,YAAQ,MAAM,6EAA6E;AAC3F,YAAQ,KAAK,CAAC;AAAA,EAChB;AACA,SAAO;AACT;AAEA,eAAe,UAAU,QAAmB;AAC1C,QAAM,OAAO,MAAM,YAAY,EAAE,oBAAoB,OAAO,MAAM,eAAe,CAAC;AAClF,SAAO,gBAAgB,EAAE,KAAK,CAAC;AACjC;AAEO,SAAS,4BAA4B,SAAwB;AAClE,QAAM,KAAK,QAAQ,QAAQ,cAAc,EAAE,YAAY,mCAAmC;AAE1F,KAAG,QAAQ,MAAM,EACd,YAAY,iCAAiC,EAC7C,OAAO,YAAY;AAClB,UAAM,SAAS,MAAM,WAAW;AAChC,UAAM,cAAc,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,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC,EAAE;AAChF,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF,CAAC;AAEH,KAAG,QAAQ,QAAQ,EAChB,YAAY,qDAAqD,EACjE,eAAe,iBAAiB,0BAA0B,EAC1D,OAAO,OAAO,SAA2B;AACxC,UAAM,SAAS,MAAM,WAAW;AAChC,UAAM,cAAc,mBAAmB,QAAQ,KAAK,EAAE,KAAK,GAAG,MAAM;AACpE,UAAM,SAAS,gBAAgB,SAAS,MAAM;AAE9C,QAAI,SAAS,OAAO,GAAG;AACrB;AAAA,QACE;AAAA,UACE,SAAS;AAAA,UACT,QAAQ;AAAA,UACR,QAAQ,KAAK;AAAA,QACf;AAAA,QACA;AAAA,QACA;AAAA,MACF;AACA;AAAA,IACF;AAEA,UAAM,SAAS,MAAM,UAAU,MAAM;AAErC,QAAI;AACF,YAAM,MAAM,MAAM,SAAS,KAAK,MAAM,OAAO;AAC7C,YAAM,aAAa,KAAK,MAAM,GAAG;AACjC,YAAM,SAAS,MAAM,iBAAiB,QAAQ,aAAa,UAAU;AACrE,cAAQ,IAAI,aAAa,QAAQ,MAAM,CAAC;AAAA,IAC1C,SAAS,OAAO;AACd,cAAQ,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC,EAAE;AAChF,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF,CAAC;AACL;","names":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/commands/docs.ts
|
|
4
|
-
import
|
|
4
|
+
import * as cp from "child_process";
|
|
5
5
|
var PAGE_MAP = {
|
|
6
6
|
releases: "commands/releases",
|
|
7
7
|
status: "commands/status",
|
|
@@ -32,7 +32,7 @@ function registerDocsCommand(program) {
|
|
|
32
32
|
const url = path ? `${BASE}${path}` : BASE;
|
|
33
33
|
const platform = process.platform;
|
|
34
34
|
const cmd = platform === "darwin" ? "open" : platform === "win32" ? "start" : "xdg-open";
|
|
35
|
-
execFile(cmd, [url], (error) => {
|
|
35
|
+
cp.execFile(cmd, [url], (error) => {
|
|
36
36
|
if (error) {
|
|
37
37
|
console.log(`Open in your browser: ${url}`);
|
|
38
38
|
}
|
|
@@ -42,4 +42,4 @@ function registerDocsCommand(program) {
|
|
|
42
42
|
export {
|
|
43
43
|
registerDocsCommand
|
|
44
44
|
};
|
|
45
|
-
//# sourceMappingURL=docs-
|
|
45
|
+
//# sourceMappingURL=docs-7DUXIKA3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/docs.ts"],"sourcesContent":["import type { Command } from \"commander\";\nimport * as cp from \"node:child_process\";\n\nconst PAGE_MAP: Record<string, string> = {\n releases: \"commands/releases\",\n status: \"commands/status\",\n vitals: \"commands/vitals\",\n reviews: \"commands/reviews\",\n listings: \"commands/listings\",\n subscriptions: \"commands/subscriptions\",\n bundle: \"commands/bundle\",\n users: \"commands/users\",\n audit: \"commands/audit\",\n config: \"commands/config\",\n doctor: \"commands/doctor\",\n publish: \"commands/publish\",\n};\n\nconst BASE = \"https://yasserstudio.github.io/gpc/\";\n\nexport function registerDocsCommand(program: Command): void {\n program\n .command(\"docs [topic]\")\n .description(\"Open documentation in browser\")\n .option(\"--list\", \"List available documentation topics\")\n .action((topic?: string, opts?: { list?: boolean }) => {\n if (opts?.list) {\n console.log(\"Available topics:\");\n for (const key of Object.keys(PAGE_MAP)) console.log(` gpc docs ${key}`);\n return;\n }\n const path = topic ? PAGE_MAP[topic] : undefined;\n if (topic && !path) {\n console.error(`Unknown topic \"${topic}\". Run: gpc docs --list`);\n process.exit(2);\n }\n const url = path ? `${BASE}${path}` : BASE;\n const platform = process.platform;\n const cmd = platform === \"darwin\" ? \"open\" : platform === \"win32\" ? \"start\" : \"xdg-open\";\n cp.execFile(cmd, [url], (error) => {\n if (error) {\n console.log(`Open in your browser: ${url}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fig, getCacheDir, getConfigDir } from "@gpc-cli/config";
|
|
@@ -67,7 +67,10 @@ async function applyFix(check) {
|
|
|
67
67
|
const dirMatch = check.message.match(/: (.+)$/);
|
|
68
68
|
if (!dirMatch?.[1]) return null;
|
|
69
69
|
const { mkdir } = await import("fs/promises");
|
|
70
|
-
await mkdir(dirMatch[1], {
|
|
70
|
+
await mkdir(dirMatch[1], {
|
|
71
|
+
recursive: true,
|
|
72
|
+
mode: check.name === "cache-dir" ? 448 : 493
|
|
73
|
+
});
|
|
71
74
|
return `Created ${dirMatch[1]}`;
|
|
72
75
|
}
|
|
73
76
|
case "service-account-permissions": {
|
|
@@ -259,10 +262,7 @@ function registerDoctorCommand(program) {
|
|
|
259
262
|
});
|
|
260
263
|
}
|
|
261
264
|
}
|
|
262
|
-
const dnsHosts = [
|
|
263
|
-
"androidpublisher.googleapis.com",
|
|
264
|
-
"playdeveloperreporting.googleapis.com"
|
|
265
|
-
];
|
|
265
|
+
const dnsHosts = ["androidpublisher.googleapis.com", "playdeveloperreporting.googleapis.com"];
|
|
266
266
|
for (const host of dnsHosts) {
|
|
267
267
|
try {
|
|
268
268
|
await lookup(host);
|
|
@@ -324,7 +324,9 @@ function registerDoctorCommand(program) {
|
|
|
324
324
|
r.message += " (fixed)";
|
|
325
325
|
}
|
|
326
326
|
} catch (err) {
|
|
327
|
-
console.error(
|
|
327
|
+
console.error(
|
|
328
|
+
` ${red("\u2717")} Could not fix "${r.name}": ${err instanceof Error ? err.message : String(err)}`
|
|
329
|
+
);
|
|
328
330
|
}
|
|
329
331
|
}
|
|
330
332
|
}
|
|
@@ -367,4 +369,4 @@ export {
|
|
|
367
369
|
checkProxy,
|
|
368
370
|
registerDoctorCommand
|
|
369
371
|
};
|
|
370
|
-
//# sourceMappingURL=doctor-
|
|
372
|
+
//# sourceMappingURL=doctor-4BUPAVFT.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/doctor.ts"],"sourcesContent":["import type { Command } from \"commander\";\nimport { loadConfig, getCacheDir, getConfigDir } from \"@gpc-cli/config\";\nimport { green, red, yellow } from \"../colors.js\";\nimport { resolveAuth, AuthError } from \"@gpc-cli/auth\";\nimport { existsSync, accessSync, statSync, constants } from \"node:fs\";\nimport { resolve } from \"node:path\";\nimport { lookup } from \"node:dns/promises\";\n\nexport interface CheckResult {\n name: string;\n status: \"pass\" | \"fail\" | \"warn\" | \"info\";\n message: string;\n suggestion?: string;\n}\n\nconst PASS = \"\\u2713\";\nconst FAIL = \"\\u2717\";\nconst WARN = \"\\u26A0\";\nconst INFO = \"-\";\n\nfunction icon(status: CheckResult[\"status\"]): string {\n switch (status) {\n case \"pass\":\n return green(PASS);\n case \"fail\":\n return red(FAIL);\n case \"warn\":\n return yellow(WARN);\n case \"info\":\n return INFO;\n }\n}\n\n// ---------------------------------------------------------------------------\n// Pure, testable check helpers\n// ---------------------------------------------------------------------------\n\nconst ANDROID_PACKAGE_RE = /^[a-zA-Z][a-zA-Z0-9_]*(\\.[a-zA-Z][a-zA-Z0-9_]*)+$/;\n\nexport function checkNodeVersion(nodeVersion: string): CheckResult {\n const major = parseInt(nodeVersion.split(\".\")[0] ?? \"0\", 10);\n return major >= 20\n ? { name: \"node\", status: \"pass\", message: `Node.js ${nodeVersion}` }\n : {\n name: \"node\",\n status: \"fail\",\n message: `Node.js ${nodeVersion} (requires >=20)`,\n suggestion: \"Upgrade Node.js to v20 or later: https://nodejs.org\",\n };\n}\n\nexport function checkPackageName(app: string | undefined): CheckResult | null {\n if (!app) return null;\n return ANDROID_PACKAGE_RE.test(app)\n ? { name: \"package-name\", status: \"pass\", message: `Package name format OK: ${app}` }\n : {\n name: \"package-name\",\n status: \"warn\",\n message: `Package name may be invalid: ${app}`,\n suggestion:\n \"Android package names must have 2+ dot-separated segments, each starting with a letter (e.g. com.example.app)\",\n };\n}\n\nexport function checkProxy(url: string | undefined): CheckResult | null {\n if (!url) return null;\n try {\n new URL(url);\n return { name: \"proxy\", status: \"pass\", message: `Proxy configured: ${url}` };\n } catch {\n return {\n name: \"proxy\",\n status: \"warn\",\n message: `Invalid proxy URL: ${url}`,\n suggestion: \"Set HTTPS_PROXY to a valid URL (e.g. http://proxy.example.com:8080)\",\n };\n }\n}\n\n// ---------------------------------------------------------------------------\n// Command registration\n// ---------------------------------------------------------------------------\n\nasync function applyFix(check: CheckResult): Promise<string | null> {\n switch (check.name) {\n case \"config-dir\":\n case \"cache-dir\": {\n const dirMatch = check.message.match(/: (.+)$/);\n if (!dirMatch?.[1]) return null;\n const { mkdir } = await import(\"node:fs/promises\");\n await mkdir(dirMatch[1], {\n recursive: true,\n mode: check.name === \"cache-dir\" ? 0o700 : 0o755,\n });\n return `Created ${dirMatch[1]}`;\n }\n case \"service-account-permissions\": {\n const saPath = check.suggestion?.match(/chmod 600 (.+)$/)?.[1];\n if (!saPath) return null;\n const { chmod } = await import(\"node:fs/promises\");\n await chmod(saPath, 0o600);\n return `Fixed permissions on ${saPath}`;\n }\n case \"config\": {\n const { initConfig } = await import(\"@gpc-cli/config\");\n await initConfig({});\n return \"Initialized config file\";\n }\n default:\n return null;\n }\n}\n\nexport function registerDoctorCommand(program: Command): void {\n program\n .command(\"doctor\")\n .description(\"Verify setup and connectivity\")\n .option(\"--fix\", \"Attempt to auto-fix failing checks\")\n .action(async (opts, cmd) => {\n const results: CheckResult[] = [];\n const parentOpts = cmd.parent?.opts() ?? {};\n const jsonMode = !!(parentOpts[\"json\"] || parentOpts[\"output\"] === \"json\");\n\n // 1. Node.js version\n results.push(checkNodeVersion(process.versions.node));\n\n // 2. Config file\n let config;\n try {\n config = await loadConfig();\n results.push({ name: \"config\", status: \"pass\", message: \"Configuration loaded\" });\n if (config.app) {\n results.push({\n name: \"default-app\",\n status: \"pass\",\n message: `Default app: ${config.app}`,\n });\n // 2b. Package name format\n const pkgCheck = checkPackageName(config.app);\n if (pkgCheck) results.push(pkgCheck);\n } else {\n results.push({\n name: \"default-app\",\n status: \"info\",\n message: \"No default app configured\",\n suggestion: \"Use --app flag or run: gpc config set app <package>\",\n });\n }\n } catch {\n results.push({\n name: \"config\",\n status: \"fail\",\n message: \"Configuration could not be loaded\",\n suggestion:\n \"Run gpc config init to create a config file, or check .gpcrc.json for syntax errors\",\n });\n }\n\n // 3. Config directory permissions\n const configDir = getConfigDir();\n try {\n if (existsSync(configDir)) {\n accessSync(configDir, constants.R_OK | constants.W_OK);\n results.push({\n name: \"config-dir\",\n status: \"pass\",\n message: `Config directory: ${configDir}`,\n });\n } else {\n results.push({\n name: \"config-dir\",\n status: \"info\",\n message: `Config directory does not exist yet: ${configDir}`,\n });\n }\n } catch {\n results.push({\n name: \"config-dir\",\n status: \"warn\",\n message: `Config directory not writable: ${configDir}`,\n suggestion: `Fix permissions: chmod 755 ${configDir}`,\n });\n }\n\n // 4. Cache directory permissions\n const cacheDir = getCacheDir();\n try {\n if (existsSync(cacheDir)) {\n accessSync(cacheDir, constants.R_OK | constants.W_OK);\n results.push({\n name: \"cache-dir\",\n status: \"pass\",\n message: `Cache directory: ${cacheDir}`,\n });\n } else {\n results.push({\n name: \"cache-dir\",\n status: \"info\",\n message: `Cache directory does not exist yet: ${cacheDir}`,\n });\n }\n } catch {\n results.push({\n name: \"cache-dir\",\n status: \"warn\",\n message: `Cache directory not writable: ${cacheDir}`,\n suggestion: `Fix permissions: chmod 700 ${cacheDir}`,\n });\n }\n\n // 5. Service account file existence + permissions\n if (config?.auth?.serviceAccount) {\n const saValue = config.auth.serviceAccount;\n const looksLikePath = !saValue.trim().startsWith(\"{\");\n if (looksLikePath) {\n const saPath = resolve(saValue);\n if (existsSync(saPath)) {\n try {\n accessSync(saPath, constants.R_OK);\n results.push({\n name: \"service-account-file\",\n status: \"pass\",\n message: `Service account file: ${saPath}`,\n });\n } catch {\n results.push({\n name: \"service-account-file\",\n status: \"fail\",\n message: `Service account file not readable: ${saPath}`,\n suggestion: `Fix permissions: chmod 600 ${saPath}`,\n });\n }\n\n // 5b. SA key file permissions (Unix only)\n if (process.platform !== \"win32\") {\n try {\n const mode = statSync(saPath).mode;\n const groupRead = (mode & 0o040) !== 0;\n const worldRead = (mode & 0o004) !== 0;\n if (groupRead || worldRead) {\n results.push({\n name: \"service-account-permissions\",\n status: \"warn\",\n message: `Service account file is group/world-readable (mode: ${(mode & 0o777).toString(8)})`,\n suggestion: `Restrict permissions: chmod 600 ${saPath}`,\n });\n } else {\n results.push({\n name: \"service-account-permissions\",\n status: \"pass\",\n message: `Service account file permissions OK (mode: ${(mode & 0o777).toString(8)})`,\n });\n }\n } catch {\n // stat failed — skip permission check\n }\n }\n } else {\n results.push({\n name: \"service-account-file\",\n status: \"fail\",\n message: `Service account file not found: ${saPath}`,\n suggestion: \"Check the path in your config or GPC_SERVICE_ACCOUNT env var\",\n });\n }\n }\n }\n\n // 6. Profile validation\n const gpcProfile = process.env[\"GPC_PROFILE\"];\n if (gpcProfile && config) {\n if (config.profiles && gpcProfile in config.profiles) {\n results.push({\n name: \"profile\",\n status: \"pass\",\n message: `Profile \"${gpcProfile}\" found`,\n });\n } else {\n const available = config.profiles ? Object.keys(config.profiles).join(\", \") : \"\";\n results.push({\n name: \"profile\",\n status: \"fail\",\n message: `Profile \"${gpcProfile}\" not found`,\n suggestion: available\n ? `Available profiles: ${available}. Create with: gpc auth login --profile ${gpcProfile}`\n : `No profiles defined. Create one with: gpc auth login --profile ${gpcProfile}`,\n });\n }\n }\n\n // 7. Proxy configuration\n const proxyUrl =\n process.env[\"HTTPS_PROXY\"] ||\n process.env[\"https_proxy\"] ||\n process.env[\"HTTP_PROXY\"] ||\n process.env[\"http_proxy\"];\n const proxyCheck = checkProxy(proxyUrl);\n if (proxyCheck) results.push(proxyCheck);\n\n // 8. CA certificate\n const caCert = process.env[\"GPC_CA_CERT\"] || process.env[\"NODE_EXTRA_CA_CERTS\"];\n if (caCert) {\n if (existsSync(caCert)) {\n results.push({\n name: \"ca-cert\",\n status: \"pass\",\n message: `CA certificate: ${caCert}`,\n });\n } else {\n results.push({\n name: \"ca-cert\",\n status: \"warn\",\n message: `CA certificate file not found: ${caCert}`,\n suggestion: \"Check that GPC_CA_CERT points to an existing PEM file\",\n });\n }\n }\n\n // 9. DNS resolution — both API endpoints\n const dnsHosts = [\"androidpublisher.googleapis.com\", \"playdeveloperreporting.googleapis.com\"];\n for (const host of dnsHosts) {\n try {\n await lookup(host);\n results.push({\n name: \"dns\",\n status: \"pass\",\n message: `DNS: ${host}`,\n });\n } catch {\n results.push({\n name: \"dns\",\n status: \"fail\",\n message: `Cannot resolve ${host}`,\n suggestion: \"Check your DNS settings and network connection\",\n });\n }\n }\n\n // 10. Authentication + API connectivity\n try {\n const authConfig = config ?? (await loadConfig());\n const client = await resolveAuth({\n serviceAccountPath: authConfig.auth?.serviceAccount,\n });\n results.push({\n name: \"auth\",\n status: \"pass\",\n message: `Authenticated as ${client.getClientEmail()}`,\n });\n\n await client.getAccessToken();\n results.push({\n name: \"api-connectivity\",\n status: \"pass\",\n message: \"API connectivity verified\",\n });\n } catch (error) {\n if (error instanceof AuthError) {\n results.push({\n name: \"auth\",\n status: \"fail\",\n message: `Authentication: ${error.message}`,\n suggestion: error.suggestion,\n });\n } else {\n results.push({\n name: \"api-connectivity\",\n status: \"fail\",\n message: \"API connectivity failed\",\n suggestion: \"Check your network connection and credentials\",\n });\n }\n }\n\n // ---------------------------------------------------------------------------\n // Output\n // ---------------------------------------------------------------------------\n\n // Auto-fix failing checks if --fix was passed\n if (opts[\"fix\"]) {\n for (const r of results) {\n if (r.status === \"fail\" || r.status === \"warn\") {\n try {\n const fixMsg = await applyFix(r);\n if (fixMsg) {\n console.log(` ${green(\"→\")} Fixed: ${fixMsg}`);\n r.status = \"pass\";\n r.message += \" (fixed)\";\n }\n } catch (err) {\n console.error(\n ` ${red(\"✗\")} Could not fix \"${r.name}\": ${err instanceof Error ? err.message : String(err)}`,\n );\n }\n }\n }\n }\n\n const errors = results.filter((r) => r.status === \"fail\").length;\n const warnings = results.filter((r) => r.status === \"warn\").length;\n const passed = results.filter((r) => r.status === \"pass\").length;\n\n if (jsonMode) {\n console.log(\n JSON.stringify({ success: errors === 0, errors, warnings, checks: results }, null, 2),\n );\n if (errors > 0) process.exit(1);\n return;\n }\n\n console.log(\"GPC Doctor\\n\");\n for (const r of results) {\n console.log(` ${icon(r.status)} ${r.message}`);\n if (r.suggestion && r.status !== \"pass\") {\n console.log(` ${r.suggestion}`);\n }\n }\n\n console.log(\n `\\n ${PASS} ${passed} passed ${WARN} ${warnings} warning${warnings !== 1 ? \"s\" : \"\"} ${FAIL} ${errors} failed`,\n );\n\n if (errors > 0) {\n console.log(\"\\nSome checks failed. Fix the issues above and run again.\");\n process.exit(1);\n } else if (warnings > 0) {\n console.log(\"\\nAll checks passed with warnings.\");\n } else {\n console.log(`\\n${green(\"✓\")} Ready. Try: gpc status`);\n }\n });\n}\n"],"mappings":";;;;;;;;AACA,SAAS,YAAY,aAAa,oBAAoB;AAEtD,SAAS,aAAa,iBAAiB;AACvC,SAAS,YAAY,YAAY,UAAU,iBAAiB;AAC5D,SAAS,eAAe;AACxB,SAAS,cAAc;AASvB,IAAM,OAAO;AACb,IAAM,OAAO;AACb,IAAM,OAAO;AACb,IAAM,OAAO;AAEb,SAAS,KAAK,QAAuC;AACnD,UAAQ,QAAQ;AAAA,IACd,KAAK;AACH,aAAO,MAAM,IAAI;AAAA,IACnB,KAAK;AACH,aAAO,IAAI,IAAI;AAAA,IACjB,KAAK;AACH,aAAO,OAAO,IAAI;AAAA,IACpB,KAAK;AACH,aAAO;AAAA,EACX;AACF;AAMA,IAAM,qBAAqB;AAEpB,SAAS,iBAAiB,aAAkC;AACjE,QAAM,QAAQ,SAAS,YAAY,MAAM,GAAG,EAAE,CAAC,KAAK,KAAK,EAAE;AAC3D,SAAO,SAAS,KACZ,EAAE,MAAM,QAAQ,QAAQ,QAAQ,SAAS,WAAW,WAAW,GAAG,IAClE;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,SAAS,WAAW,WAAW;AAAA,IAC/B,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AQ;AAAA,QACN,KAAK,UAAU,EAAE,SAAS,WAAW,GAAG,QAAQ,UAAU,QAAQ,QAAQ,GAAG,MAAM,CAAC;AAAA,MACtF;AACA,UAAI,SAAS,EAAG,SAAQ,KAAK,CAAC;AAC9B;AAAA,IACF;AAEA,YAAQ,IAAI,cAAc;AAC1B,eAAW,KAAK,SAAS;AACvB,cAAQ,IAAI,KAAK,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE;AAC9C,UAAI,EAAE,cAAc,EAAE,WAAW,QAAQ;AACvC,gBAAQ,IAAI,OAAO,EAAE,UAAU,EAAE;AAAA,MACnC;AAAA,IACF;AAEA,YAAQ;AAAA,MACN;AAAA,IAAO,IAAI,IAAI,MAAM,YAAY,IAAI,IAAI,QAAQ,WAAW,aAAa,IAAI,MAAM,EAAE,KAAK,IAAI,IAAI,MAAM;AAAA,IAC1G;AAEA,QAAI,SAAS,GAAG;AACd,cAAQ,IAAI,2DAA2D;AACvE,cAAQ,KAAK,CAAC;AAAA,IAChB,WAAW,WAAW,GAAG;AACvB,cAAQ,IAAI,oCAAoC;AAAA,IAClD,OAAO;AACL,cAAQ,IAAI;AAAA,EAAK,MAAM,QAAG,CAAC,yBAAyB;AAAA,IACtD;AAAA,EACF,CAAC;AACL;","names":[]}
|
|
@@ -41,7 +41,11 @@ function registerEnterpriseCommands(program) {
|
|
|
41
41
|
const format = getOutputFormat(program, config);
|
|
42
42
|
if (isDryRun(program)) {
|
|
43
43
|
printDryRun(
|
|
44
|
-
{
|
|
44
|
+
{
|
|
45
|
+
command: "enterprise create",
|
|
46
|
+
action: "create enterprise app",
|
|
47
|
+
target: options.title
|
|
48
|
+
},
|
|
45
49
|
format,
|
|
46
50
|
formatOutput
|
|
47
51
|
);
|
|
@@ -62,4 +66,4 @@ function registerEnterpriseCommands(program) {
|
|
|
62
66
|
export {
|
|
63
67
|
registerEnterpriseCommands
|
|
64
68
|
};
|
|
65
|
-
//# sourceMappingURL=enterprise-
|
|
69
|
+
//# sourceMappingURL=enterprise-7THXNBTC.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/enterprise.ts"],"sourcesContent":["import type { Command } from \"commander\";\nimport { loadConfig } from \"@gpc-cli/config\";\nimport { resolveAuth } from \"@gpc-cli/auth\";\nimport { createEnterpriseClient } from \"@gpc-cli/api\";\nimport { listEnterpriseApps, createEnterpriseApp, formatOutput } from \"@gpc-cli/core\";\nimport { getOutputFormat } from \"../format.js\";\nimport { isDryRun, printDryRun } from \"../dry-run.js\";\n\nasync function getClient() {\n const config = await loadConfig();\n const auth = await resolveAuth({ serviceAccountPath: config.auth?.serviceAccount });\n return { client: createEnterpriseClient({ auth }), config };\n}\n\nexport function registerEnterpriseCommands(program: Command): void {\n const enterprise = program\n .command(\"enterprise\")\n .description(\"Manage private enterprise apps via Managed Google Play\")\n .requiredOption(\"--org <id>\", \"Google Play organization ID\");\n\n enterprise\n .command(\"list\")\n .description(\"List private enterprise apps\")\n .action(async () => {\n const { client, config } = await getClient();\n const orgId = enterprise.opts()[\"org\"] as string;\n const format = getOutputFormat(program, config);\n\n try {\n const result = await listEnterpriseApps(client, orgId);\n if (result.length === 0 && format !== \"json\") {\n console.log(\"No enterprise apps found.\");\n return;\n }\n console.log(formatOutput(result, format));\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n\n enterprise\n .command(\"create\")\n .description(\"Create a new private enterprise app\")\n .requiredOption(\"--title <title>\", \"App title\")\n .option(\"--lang <code>\", \"Language code (default: en_US)\", \"en_US\")\n .action(async (options) => {\n const { client, config } = await getClient();\n const orgId = enterprise.opts()[\"org\"] as string;\n const format = getOutputFormat(program, config);\n\n if (isDryRun(program)) {\n printDryRun(\n {
|
|
1
|
+
{"version":3,"sources":["../src/commands/enterprise.ts"],"sourcesContent":["import type { Command } from \"commander\";\nimport { loadConfig } from \"@gpc-cli/config\";\nimport { resolveAuth } from \"@gpc-cli/auth\";\nimport { createEnterpriseClient } from \"@gpc-cli/api\";\nimport { listEnterpriseApps, createEnterpriseApp, formatOutput } from \"@gpc-cli/core\";\nimport { getOutputFormat } from \"../format.js\";\nimport { isDryRun, printDryRun } from \"../dry-run.js\";\n\nasync function getClient() {\n const config = await loadConfig();\n const auth = await resolveAuth({ serviceAccountPath: config.auth?.serviceAccount });\n return { client: createEnterpriseClient({ auth }), config };\n}\n\nexport function registerEnterpriseCommands(program: Command): void {\n const enterprise = program\n .command(\"enterprise\")\n .description(\"Manage private enterprise apps via Managed Google Play\")\n .requiredOption(\"--org <id>\", \"Google Play organization ID\");\n\n enterprise\n .command(\"list\")\n .description(\"List private enterprise apps\")\n .action(async () => {\n const { client, config } = await getClient();\n const orgId = enterprise.opts()[\"org\"] as string;\n const format = getOutputFormat(program, config);\n\n try {\n const result = await listEnterpriseApps(client, orgId);\n if (result.length === 0 && format !== \"json\") {\n console.log(\"No enterprise apps found.\");\n return;\n }\n console.log(formatOutput(result, format));\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n\n enterprise\n .command(\"create\")\n .description(\"Create a new private enterprise app\")\n .requiredOption(\"--title <title>\", \"App title\")\n .option(\"--lang <code>\", \"Language code (default: en_US)\", \"en_US\")\n .action(async (options) => {\n const { client, config } = await getClient();\n const orgId = enterprise.opts()[\"org\"] as string;\n const format = getOutputFormat(program, config);\n\n if (isDryRun(program)) {\n printDryRun(\n {\n command: \"enterprise create\",\n action: \"create enterprise app\",\n target: options.title as string,\n },\n format,\n formatOutput,\n );\n return;\n }\n\n try {\n const result = await createEnterpriseApp(client, orgId, {\n title: options.title as string,\n languageCode: options.lang as string,\n });\n console.log(formatOutput(result, format));\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n}\n"],"mappings":";;;;;;;;;;AACA,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;AAC5B,SAAS,8BAA8B;AAC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ACR,QAAQ,QAAQ;AAAA,QAClB;AAAA,QACA;AAAA,QACA;AAAA,MACF;AACA;AAAA,IACF;AAEA,QAAI;AACF,YAAM,SAAS,MAAM,oBAAoB,QAAQ,OAAO;AAAA,QACtD,OAAO,QAAQ;AAAA,QACf,cAAc,QAAQ;AAAA,MACxB,CAAC;AACD,cAAQ,IAAI,aAAa,QAAQ,MAAM,CAAC;AAAA,IAC1C,SAAS,OAAO;AACd,cAAQ,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC,EAAE;AAChF,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF,CAAC;AACL;","names":[]}
|
|
@@ -83,25 +83,22 @@ function registerExternalTransactionsCommands(program) {
|
|
|
83
83
|
process.exit(4);
|
|
84
84
|
}
|
|
85
85
|
});
|
|
86
|
-
extTxn.command("refund <id>").description("Refund an external transaction").option("--full", "Full refund").option(
|
|
87
|
-
"--partial-amount <micros>",
|
|
88
|
-
"Partial refund pre-tax amount in micros (e.g., 1990000)"
|
|
89
|
-
).option("--currency <code>", "Currency code for partial refund (e.g. USD)").action(async (id, options) => {
|
|
86
|
+
extTxn.command("refund <id>").description("Refund an external transaction").option("--full", "Full refund").option("--partial-amount <micros>", "Partial refund pre-tax amount in micros (e.g., 1990000)").option("--currency <code>", "Currency code for partial refund (e.g. USD)").action(async (id, options) => {
|
|
90
87
|
const config = await loadConfig();
|
|
91
88
|
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
92
89
|
const format = getOutputFormat(program, config);
|
|
93
90
|
const refundData = {};
|
|
94
91
|
if (options.full) {
|
|
95
|
-
refundData
|
|
92
|
+
refundData["fullRefund"] = {};
|
|
96
93
|
} else if (options.partialAmount) {
|
|
97
|
-
refundData
|
|
94
|
+
refundData["partialRefund"] = {
|
|
98
95
|
refundPreTaxAmount: {
|
|
99
96
|
priceMicros: options.partialAmount,
|
|
100
97
|
currency: options.currency
|
|
101
98
|
}
|
|
102
99
|
};
|
|
103
100
|
} else {
|
|
104
|
-
refundData
|
|
101
|
+
refundData["fullRefund"] = {};
|
|
105
102
|
}
|
|
106
103
|
await requireConfirm(`Refund external transaction "${id}"?`, program);
|
|
107
104
|
if (isDryRun(program)) {
|
|
@@ -130,4 +127,4 @@ function registerExternalTransactionsCommands(program) {
|
|
|
130
127
|
export {
|
|
131
128
|
registerExternalTransactionsCommands
|
|
132
129
|
};
|
|
133
|
-
//# sourceMappingURL=external-transactions-
|
|
130
|
+
//# sourceMappingURL=external-transactions-O5P4QBIT.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/external-transactions.ts"],"sourcesContent":["import type { Command } from \"commander\";\nimport type { GpcConfig } from \"@gpc-cli/config\";\nimport { loadConfig } from \"@gpc-cli/config\";\nimport { resolveAuth } from \"@gpc-cli/auth\";\nimport { createApiClient } from \"@gpc-cli/api\";\nimport {\n createExternalTransaction,\n getExternalTransaction,\n refundExternalTransaction,\n formatOutput,\n} from \"@gpc-cli/core\";\nimport { getOutputFormat } from \"../format.js\";\nimport { isDryRun, printDryRun } from \"../dry-run.js\";\nimport { requireConfirm } from \"../prompt.js\";\nimport { readFileSync } from \"node:fs\";\n\nfunction resolvePackageName(packageArg: string | undefined, config: GpcConfig): string {\n const name = packageArg || config.app;\n if (!name) {\n console.error(\"Error: No package name. Use --app <package> or gpc config set app <package>\");\n process.exit(2);\n }\n return name;\n}\n\nasync function getClient(config: GpcConfig) {\n const auth = await resolveAuth({ serviceAccountPath: config.auth?.serviceAccount });\n return createApiClient({ auth });\n}\n\nexport function registerExternalTransactionsCommands(program: Command): void {\n const extTxn = program\n .command(\"external-transactions\")\n .alias(\"ext-txn\")\n .description(\"Manage external transactions (alternative billing)\");\n\n extTxn\n .command(\"create\")\n .description(\"Create a new external transaction\")\n .requiredOption(\"--file <path>\", \"Path to JSON file with transaction data\")\n .action(async (options) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const format = getOutputFormat(program, config);\n\n let data: Record<string, unknown>;\n try {\n data = JSON.parse(readFileSync(options.file, \"utf-8\"));\n } catch (err) {\n console.error(\n `Error: Could not read transaction data from ${options.file}: ${err instanceof Error ? err.message : String(err)}`,\n );\n process.exit(2);\n }\n\n if (isDryRun(program)) {\n printDryRun(\n {\n command: \"external-transactions create\",\n action: \"create external transaction\",\n target: packageName,\n details: data,\n },\n format,\n formatOutput,\n );\n return;\n }\n\n const client = await getClient(config);\n\n try {\n const result = await createExternalTransaction(client, packageName, data);\n console.log(formatOutput(result, format));\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n\n extTxn\n .command(\"get <id>\")\n .description(\"Get an external transaction by ID\")\n .action(async (id: string) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const client = await getClient(config);\n const format = getOutputFormat(program, config);\n\n try {\n const result = await getExternalTransaction(client, packageName, id);\n console.log(formatOutput(result, format));\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n\n extTxn\n .command(\"refund <id>\")\n .description(\"Refund an external transaction\")\n .option(\"--full\", \"Full refund\")\n .option(\"--partial-amount <micros>\", \"Partial refund pre-tax amount in micros (e.g., 1990000)\")\n .option(\"--currency <code>\", \"Currency code for partial refund (e.g. USD)\")\n .action(async (id: string, options) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const format = getOutputFormat(program, config);\n\n const refundData: Record<string, unknown> = {};\n if (options.full) {\n refundData[\"fullRefund\"] = {};\n } else if (options.partialAmount) {\n refundData[\"partialRefund\"] = {\n refundPreTaxAmount: {\n priceMicros: options.partialAmount,\n currency: options.currency,\n },\n };\n } else {\n refundData[\"fullRefund\"] = {};\n }\n\n await requireConfirm(`Refund external transaction \"${id}\"?`, program);\n\n if (isDryRun(program)) {\n printDryRun(\n {\n command: \"external-transactions refund\",\n action: \"refund external transaction\",\n target: id,\n details: refundData,\n },\n format,\n formatOutput,\n );\n return;\n }\n\n const client = await getClient(config);\n\n try {\n const result = await refundExternalTransaction(client, packageName, id, refundData);\n console.log(formatOutput(result, format));\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n}\n"],"mappings":";;;;;;;;;;;;;AAEA,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAIP,SAAS,oBAAoB;AAE7B,SAAS,mBAAmB,YAAgC,QAA2B;AACrF,QAAM,OAAO,cAAc,OAAO;AAClC,MAAI,CAAC,MAAM;AACT,YAAQ,MAAM,6EAA6E;AAC3F,YAAQ,KAAK,CAAC;AAAA,EAChB;AACA,SAAO;AACT;AAEA,eAAe,UAAU,QAAmB;AAC1C,QAAM,OAAO,MAAM,YAAY,EAAE,oBAAoB,OAAO,MAAM,eAAe,CAAC;AAClF,SAAO,gBAAgB,EAAE,KAAK,CAAC;AACjC;AAEO,SAAS,qCAAqC,SAAwB;AAC3E,QAAM,SAAS,QACZ,QAAQ,uBAAuB,EAC/B,MAAM,SAAS,EACf,YAAY,oDAAoD;AAEnE,SACG,QAAQ,QAAQ,EAChB,YAAY,mCAAmC,EAC/C,eAAe,iBAAiB,yCAAyC,EACzE,OAAO,OAAO,YAAY;AACzB,UAAM,SAAS,MAAM,WAAW;AAChC,UAAM,cAAc,mBAAmB,QAAQ,KAAK,EAAE,KAAK,GAAG,MAAM;AACpE,UAAM,SAAS,gBAAgB,SAAS,MAAM;AAE9C,QAAI;AACJ,QAAI;AACF,aAAO,KAAK,MAAM,aAAa,QAAQ,MAAM,OAAO,CAAC;AAAA,IACvD,SAAS,KAAK;AACZ,cAAQ;AAAA,QACN,+CAA+C,QAAQ,IAAI,KAAK,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG,CAAC;AAAA,MAClH;AACA,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KAAK,EAAE,KAAK,GAAG,MAAM;AACpE,UAAM,SAAS,gBAAgB,SAAS,MAAM;AAE9C,UAAM,aAAsC,CAAC;AAC7C,QAAI,QAAQ,MAAM;AAChB,iBAAW,YAAY,IAAI,CAAC;AAAA,IAC9B,WAAW,QAAQ,eAAe;AAChC,iBAAW,eAAe,IAAI;AAAA,QAC5B,oBAAoB;AAAA,UAClB,aAAa,QAAQ;AAAA,UACrB,UAAU,QAAQ;AAAA,QACpB;AAAA,MACF;AAAA,IACF,OAAO;AACL,iBAAW,YAAY,IAAI,CAAC;AAAA,IAC9B;AAEA,UAAM,eAAe,gCAAgC,EAAE,MAAM,OAAO;AAEpE,QAAI,SAAS,OAAO,GAAG;AACrB;AAAA,QACE;AAAA,UACE,SAAS;AAAA,UACT,QAAQ;AAAA,UACR,QAAQ;AAAA,UACR,SAAS;AAAA,QACX;AAAA,QACA;AAAA,QACA;AAAA,MACF;AACA;AAAA,IACF;AAEA,UAAM,SAAS,MAAM,UAAU,MAAM;AAErC,QAAI;AACF,YAAM,SAAS,MAAM,0BAA0B,QAAQ,aAAa,IAAI,UAAU;AAClF,cAAQ,IAAI,aAAa,QAAQ,MAAM,CAAC;AAAA,IAC1C,SAAS,OAAO;AACd,cAAQ,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC,EAAE;AAChF,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF,CAAC;AACL;","names":[]}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
detectInstallMethod
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-U6ZTQ34I.js";
|
|
5
5
|
import "./chunk-4O4D5SGL.js";
|
|
6
6
|
|
|
7
7
|
// src/commands/feedback.ts
|
|
8
8
|
import { execFile } from "child_process";
|
|
9
9
|
function registerFeedbackCommand(program) {
|
|
10
10
|
program.command("feedback").description("Open a pre-filled GitHub issue with system diagnostics").option("--title <title>", "Issue title").action(async (opts) => {
|
|
11
|
-
const version = "0.9.
|
|
11
|
+
const version = "0.9.37";
|
|
12
12
|
const body = [
|
|
13
13
|
"**GPC version:** " + version,
|
|
14
14
|
"**Node:** " + process.version,
|
|
@@ -43,4 +43,4 @@ ${url}`);
|
|
|
43
43
|
export {
|
|
44
44
|
registerFeedbackCommand
|
|
45
45
|
};
|
|
46
|
-
//# sourceMappingURL=feedback-
|
|
46
|
+
//# sourceMappingURL=feedback-ERWH4SZF.js.map
|
|
@@ -7,11 +7,7 @@ import {
|
|
|
7
7
|
import { loadConfig } from "@gpc-cli/config";
|
|
8
8
|
import { resolveAuth } from "@gpc-cli/auth";
|
|
9
9
|
import { createApiClient } from "@gpc-cli/api";
|
|
10
|
-
import {
|
|
11
|
-
listGeneratedApks,
|
|
12
|
-
downloadGeneratedApk,
|
|
13
|
-
formatOutput
|
|
14
|
-
} from "@gpc-cli/core";
|
|
10
|
+
import { listGeneratedApks, downloadGeneratedApk, formatOutput } from "@gpc-cli/core";
|
|
15
11
|
function resolvePackageName(packageArg, config) {
|
|
16
12
|
const name = packageArg || config.app;
|
|
17
13
|
if (!name) {
|
|
@@ -87,4 +83,4 @@ function registerGeneratedApksCommands(program) {
|
|
|
87
83
|
export {
|
|
88
84
|
registerGeneratedApksCommands
|
|
89
85
|
};
|
|
90
|
-
//# sourceMappingURL=generated-apks-
|
|
86
|
+
//# sourceMappingURL=generated-apks-KB2PLWDI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/generated-apks.ts"],"sourcesContent":["import type { Command } from \"commander\";\nimport type { GpcConfig } from \"@gpc-cli/config\";\nimport { loadConfig } from \"@gpc-cli/config\";\nimport { resolveAuth } from \"@gpc-cli/auth\";\nimport { createApiClient } from \"@gpc-cli/api\";\nimport { listGeneratedApks, downloadGeneratedApk, formatOutput } from \"@gpc-cli/core\";\nimport { getOutputFormat } from \"../format.js\";\n\nfunction resolvePackageName(packageArg: string | undefined, config: GpcConfig): string {\n const name = packageArg || config.app;\n if (!name) {\n console.error(\"Error: No package name. Use --app <package> or gpc config set app <package>\");\n process.exit(2);\n }\n return name;\n}\n\nasync function getClient(config: GpcConfig) {\n const auth = await resolveAuth({ serviceAccountPath: config.auth?.serviceAccount });\n return createApiClient({ auth });\n}\n\nexport function registerGeneratedApksCommands(program: Command): void {\n const cmd = program\n .command(\"generated-apks\")\n .description(\"Manage device-specific APKs generated by Google Play\");\n\n cmd\n .command(\"list <version-code>\")\n .description(\"List generated APKs for a version code\")\n .action(async (versionCodeStr: string) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const client = await getClient(config);\n const format = getOutputFormat(program, config);\n\n const versionCode = parseInt(versionCodeStr, 10);\n if (isNaN(versionCode)) {\n console.error(\"Error: version-code must be a number\");\n process.exit(2);\n }\n\n try {\n const result = await listGeneratedApks(client, packageName, versionCode);\n if (format !== \"json\") {\n const apks = (result as unknown as Record<string, unknown>)[\"generatedApks\"] as\n | Array<Record<string, unknown>>\n | undefined;\n if (apks && apks.length > 0) {\n const rows = apks.map((apk) => ({\n id: apk[\"generatedApkId\"] || \"-\",\n variantId: apk[\"variantId\"] || \"-\",\n moduleName: apk[\"moduleName\"] || \"-\",\n sha256: String(apk[\"certificateSha256Fingerprint\"] || \"-\").slice(0, 16) + \"...\",\n }));\n console.log(formatOutput(rows, format));\n } else {\n console.log(\"No generated APKs found.\");\n }\n } else {\n console.log(formatOutput(result, format));\n }\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n\n cmd\n .command(\"download <version-code> <apk-id>\")\n .description(\"Download a generated APK\")\n .requiredOption(\"--output <path>\", \"Output file path\")\n .action(async (versionCodeStr: string, apkId: string, opts: { output: string }) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const client = await getClient(config);\n const format = getOutputFormat(program, config);\n\n const versionCode = parseInt(versionCodeStr, 10);\n if (isNaN(versionCode)) {\n console.error(\"Error: version-code must be a number\");\n process.exit(2);\n }\n\n try {\n const result = await downloadGeneratedApk(\n client,\n packageName,\n versionCode,\n apkId,\n opts.output,\n );\n console.log(formatOutput(result, format));\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n}\n"],"mappings":";;;;;;AAEA,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAChC,SAAS,mBAAmB,sBAAsB,oBAAoB;AAGtE,SAAS,mBAAmB,YAAgC,QAA2B;AACrF,QAAM,OAAO,cAAc,OAAO;AAClC,MAAI,CAAC,MAAM;AACT,YAAQ,MAAM,6EAA6E;AAC3F,YAAQ,KAAK,CAAC;AAAA,EAChB;AACA,SAAO;AACT;AAEA,eAAe,UAAU,QAAmB;AAC1C,QAAM,OAAO,MAAM,YAAY,EAAE,oBAAoB,OAAO,MAAM,eAAe,CAAC;AAClF,SAAO,gBAAgB,EAAE,KAAK,CAAC;AACjC;AAEO,SAAS,8BAA8B,SAAwB;AACpE,QAAM,MAAM,QACT,QAAQ,gBAAgB,EACxB,YAAY,sDAAsD;AAErE,MACG,QAAQ,qBAAqB,EAC7B,YAAY,wCAAwC,EACpD,OAAO,OAAO,mBAA2B;AACxC,UAAM,SAAS,MAAM,WAAW;AAChC,UAAM,cAAc,mBAAmB,QAAQ,KAAK,EAAE,KAAK,GAAG,MAAM;AACpE,UAAM,SAAS,MAAM,UAAU,MAAM;AACrC,UAAM,SAAS,gBAAgB,SAAS,MAAM;AAE9C,UAAM,cAAc,SAAS,gBAAgB,EAAE;AAC/C,QAAI,MAAM,WAAW,GAAG;AACtB,cAAQ,MAAM,sCAAsC;AACpD,cAAQ,KAAK,CAAC;AAAA,IAChB;AAEA,QAAI;AACF,YAAM,SAAS,MAAM,kBAAkB,QAAQ,aAAa,WAAW;AACvE,UAAI,WAAW,QAAQ;AACrB,cAAM,OAAQ,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AAO;AACd,cAAQ,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC,EAAE;AAChF,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF,CAAC;AACL;","names":[]}
|
|
@@ -18,7 +18,9 @@ import { listGrants, createGrant, updateGrant, deleteGrant, formatOutput } from
|
|
|
18
18
|
function resolveDeveloperId(devIdArg, config) {
|
|
19
19
|
const id = devIdArg || config.developerId;
|
|
20
20
|
if (!id) {
|
|
21
|
-
console.error(
|
|
21
|
+
console.error(
|
|
22
|
+
"Error: No developer ID. Use --developer-id <id> or gpc config set developerId <id>"
|
|
23
|
+
);
|
|
22
24
|
process.exit(2);
|
|
23
25
|
}
|
|
24
26
|
return id;
|
|
@@ -50,14 +52,22 @@ function registerGrantsCommands(program) {
|
|
|
50
52
|
process.exit(4);
|
|
51
53
|
}
|
|
52
54
|
});
|
|
53
|
-
grants.command("create <email>").description("Grant app-level permissions to a user").requiredOption("--package <packageName>", "App package name").requiredOption(
|
|
55
|
+
grants.command("create <email>").description("Grant app-level permissions to a user").requiredOption("--package <packageName>", "App package name").requiredOption(
|
|
56
|
+
"--permissions <list>",
|
|
57
|
+
"Comma-separated permissions (e.g. CAN_MANAGE_RELEASES,VIEW_APP_INFORMATION)"
|
|
58
|
+
).action(async (email, options) => {
|
|
54
59
|
const config = await loadConfig();
|
|
55
60
|
const developerId = resolveDeveloperId(grants.opts()["developerId"], config);
|
|
56
61
|
const format = getOutputFormat(program, config);
|
|
57
62
|
const perms = options.permissions.split(",").map((p) => p.trim());
|
|
58
63
|
if (isDryRun(program)) {
|
|
59
64
|
printDryRun(
|
|
60
|
-
{
|
|
65
|
+
{
|
|
66
|
+
command: "grants create",
|
|
67
|
+
action: "grant permissions",
|
|
68
|
+
target: `${email}/${options.package}`,
|
|
69
|
+
details: { permissions: perms }
|
|
70
|
+
},
|
|
61
71
|
format,
|
|
62
72
|
formatOutput
|
|
63
73
|
);
|
|
@@ -79,7 +89,12 @@ function registerGrantsCommands(program) {
|
|
|
79
89
|
const perms = options.permissions.split(",").map((p) => p.trim());
|
|
80
90
|
if (isDryRun(program)) {
|
|
81
91
|
printDryRun(
|
|
82
|
-
{
|
|
92
|
+
{
|
|
93
|
+
command: "grants update",
|
|
94
|
+
action: "update permissions",
|
|
95
|
+
target: `${email}/${options.package}`,
|
|
96
|
+
details: { permissions: perms }
|
|
97
|
+
},
|
|
83
98
|
format,
|
|
84
99
|
formatOutput
|
|
85
100
|
);
|
|
@@ -101,7 +116,11 @@ function registerGrantsCommands(program) {
|
|
|
101
116
|
await requireConfirm(`Remove grant for "${email}" on ${options.package}?`, program);
|
|
102
117
|
if (isDryRun(program)) {
|
|
103
118
|
printDryRun(
|
|
104
|
-
{
|
|
119
|
+
{
|
|
120
|
+
command: "grants delete",
|
|
121
|
+
action: "remove grant",
|
|
122
|
+
target: `${email}/${options.package}`
|
|
123
|
+
},
|
|
105
124
|
format,
|
|
106
125
|
formatOutput
|
|
107
126
|
);
|
|
@@ -120,4 +139,4 @@ function registerGrantsCommands(program) {
|
|
|
120
139
|
export {
|
|
121
140
|
registerGrantsCommands
|
|
122
141
|
};
|
|
123
|
-
//# sourceMappingURL=grants-
|
|
142
|
+
//# sourceMappingURL=grants-TKQJ3IER.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/grants.ts"],"sourcesContent":["import type { Command } from \"commander\";\nimport type { GpcConfig } from \"@gpc-cli/config\";\nimport { loadConfig } from \"@gpc-cli/config\";\nimport { resolveAuth } from \"@gpc-cli/auth\";\nimport { createUsersClient } from \"@gpc-cli/api\";\nimport { listGrants, createGrant, updateGrant, deleteGrant, formatOutput } from \"@gpc-cli/core\";\nimport { getOutputFormat } from \"../format.js\";\nimport { isDryRun, printDryRun } from \"../dry-run.js\";\nimport { requireConfirm } from \"../prompt.js\";\n\nfunction resolveDeveloperId(devIdArg: string | undefined, config: GpcConfig): string {\n const id = devIdArg || config.developerId;\n if (!id) {\n console.error(\n \"Error: No developer ID. Use --developer-id <id> or gpc config set developerId <id>\",\n );\n process.exit(2);\n }\n return id;\n}\n\nasync function getClient(config: GpcConfig) {\n const auth = await resolveAuth({ serviceAccountPath: config.auth?.serviceAccount });\n return createUsersClient({ auth });\n}\n\nexport function registerGrantsCommands(program: Command): void {\n const grants = program\n .command(\"grants\")\n .description(\"Manage per-app permission grants for developer account users\")\n .option(\"--developer-id <id>\", \"Developer account ID\");\n\n grants\n .command(\"list <email>\")\n .description(\"List all per-app grants for a user\")\n .action(async (email: string) => {\n const config = await loadConfig();\n const developerId = resolveDeveloperId(grants.opts()[\"developerId\"], config);\n const client = await getClient(config);\n const format = getOutputFormat(program, config);\n\n try {\n const result = await listGrants(client, developerId, email);\n if (result.length === 0) {\n if (format === \"json\") {\n console.log(formatOutput([], format));\n } else {\n console.log(`No grants found for ${email}.`);\n }\n return;\n }\n console.log(formatOutput(result, format));\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n\n grants\n .command(\"create <email>\")\n .description(\"Grant app-level permissions to a user\")\n .requiredOption(\"--package <packageName>\", \"App package name\")\n .requiredOption(\n \"--permissions <list>\",\n \"Comma-separated permissions (e.g. CAN_MANAGE_RELEASES,VIEW_APP_INFORMATION)\",\n )\n .action(async (email: string, options) => {\n const config = await loadConfig();\n const developerId = resolveDeveloperId(grants.opts()[\"developerId\"], config);\n const format = getOutputFormat(program, config);\n const perms = (options.permissions as string).split(\",\").map((p: string) => p.trim());\n\n if (isDryRun(program)) {\n printDryRun(\n {\n command: \"grants create\",\n action: \"grant permissions\",\n target: `${email}/${options.package}`,\n details: { permissions: perms },\n },\n format,\n formatOutput,\n );\n return;\n }\n\n const client = await getClient(config);\n\n try {\n const result = await createGrant(client, developerId, email, options.package, perms);\n console.log(formatOutput(result, format));\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n\n grants\n .command(\"update <email>\")\n .description(\"Update app-level permissions for a user\")\n .requiredOption(\"--package <packageName>\", \"App package name\")\n .requiredOption(\"--permissions <list>\", \"New comma-separated permissions\")\n .action(async (email: string, options) => {\n const config = await loadConfig();\n const developerId = resolveDeveloperId(grants.opts()[\"developerId\"], config);\n const format = getOutputFormat(program, config);\n const perms = (options.permissions as string).split(\",\").map((p: string) => p.trim());\n\n if (isDryRun(program)) {\n printDryRun(\n {\n command: \"grants update\",\n action: \"update permissions\",\n target: `${email}/${options.package}`,\n details: { permissions: perms },\n },\n format,\n formatOutput,\n );\n return;\n }\n\n const client = await getClient(config);\n\n try {\n const result = await updateGrant(client, developerId, email, options.package, perms);\n console.log(formatOutput(result, format));\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n\n grants\n .command(\"delete <email>\")\n .description(\"Remove a per-app grant from a user\")\n .requiredOption(\"--package <packageName>\", \"App package name\")\n .action(async (email: string, options) => {\n const config = await loadConfig();\n const developerId = resolveDeveloperId(grants.opts()[\"developerId\"], config);\n const format = getOutputFormat(program, config);\n\n await requireConfirm(`Remove grant for \"${email}\" on ${options.package}?`, program);\n\n if (isDryRun(program)) {\n printDryRun(\n {\n command: \"grants delete\",\n action: \"remove grant\",\n target: `${email}/${options.package}`,\n },\n format,\n formatOutput,\n );\n return;\n }\n\n const client = await getClient(config);\n\n try {\n await deleteGrant(client, developerId, email, options.package);\n console.log(`Grant removed for ${email} on ${options.package}.`);\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n}\n"],"mappings":";;;;;;;;;;;;;AAEA,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;AAC5B,SAAS,yBAAyB;AAClC,SAAS,YAAY,aAAa,aAAa,aAAa,oBAAoB;AAKhF,SAAS,mBAAmB,UAA8B,QAA2B;AACnF,QAAM,KAAK,YAAY,OAAO;AAC9B,MAAI,CAAC,IAAI;AACP,YAAQ;AAAA,MAC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47
|
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
48
48
|
const client = await getClient(config);
|
|
49
49
|
const format = getOutputFormat(program, config);
|
|
50
|
-
console.error(
|
|
50
|
+
console.error(
|
|
51
|
+
"Note: Using oneTimeProducts API (inappproducts endpoint is deprecated, shutdown Aug 2027)"
|
|
52
|
+
);
|
|
51
53
|
try {
|
|
52
54
|
const result = await listOneTimeProducts(client, packageName);
|
|
53
55
|
let products = result.oneTimeProducts || [];
|
|
@@ -65,7 +67,9 @@ function registerIapCommands(program) {
|
|
|
65
67
|
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
66
68
|
const client = await getClient(config);
|
|
67
69
|
const format = getOutputFormat(program, config);
|
|
68
|
-
console.error(
|
|
70
|
+
console.error(
|
|
71
|
+
"Note: Using oneTimeProducts API (inappproducts endpoint is deprecated, shutdown Aug 2027)"
|
|
72
|
+
);
|
|
69
73
|
try {
|
|
70
74
|
const result = await getOneTimeProduct(client, packageName, sku);
|
|
71
75
|
console.log(formatOutput(result, format));
|
|
@@ -228,4 +232,4 @@ function registerIapCommands(program) {
|
|
|
228
232
|
export {
|
|
229
233
|
registerIapCommands
|
|
230
234
|
};
|
|
231
|
-
//# sourceMappingURL=iap-
|
|
235
|
+
//# sourceMappingURL=iap-BNIAHBDN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/iap.ts"],"sourcesContent":["import type { GpcConfig } from \"@gpc-cli/config\";\nimport type { Command } from \"commander\";\nimport { loadConfig } from \"@gpc-cli/config\";\nimport { resolveAuth } from \"@gpc-cli/auth\";\nimport { createApiClient } from \"@gpc-cli/api\";\nimport {\n listOneTimeProducts,\n getOneTimeProduct,\n createInAppProduct,\n updateInAppProduct,\n deleteInAppProduct,\n syncInAppProducts,\n formatOutput,\n sortResults,\n createSpinner,\n} from \"@gpc-cli/core\";\nimport { isDryRun, printDryRun } from \"../dry-run.js\";\nimport { getOutputFormat } from \"../format.js\";\nimport { requireConfirm } from \"../prompt.js\";\nimport { readJsonFile } from \"../json.js\";\n\nfunction resolvePackageName(packageArg: string | undefined, config: GpcConfig): string {\n const name = packageArg || config.app;\n if (!name) {\n console.error(\"Error: No package name. Use --app <package> or gpc config set app <package>\");\n process.exit(2);\n }\n return name;\n}\n\nasync function getClient(config: GpcConfig) {\n const auth = await resolveAuth({ serviceAccountPath: config.auth?.serviceAccount });\n return createApiClient({ auth });\n}\n\nexport function registerIapCommands(program: Command): void {\n const iap = program\n .command(\"iap\")\n .description(\"Manage in-app products (uses one-time products API)\");\n\n iap\n .command(\"list\")\n .description(\"List in-app products\")\n .option(\"--max <n>\", \"Maximum results per page\", parseInt)\n .option(\"--limit <n>\", \"Maximum total results\", parseInt)\n .option(\"--next-page <token>\", \"Resume from page token\")\n .option(\"--sort <field>\", \"Sort by field (prefix with - for descending)\")\n .action(async (options) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const client = await getClient(config);\n const format = getOutputFormat(program, config);\n\n console.error(\n \"Note: Using oneTimeProducts API (inappproducts endpoint is deprecated, shutdown Aug 2027)\",\n );\n\n try {\n const result = await listOneTimeProducts(client, packageName);\n let products = result.oneTimeProducts || [];\n if (options.sort) {\n products = sortResults(products, options.sort);\n }\n console.log(formatOutput(products, format));\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n\n iap\n .command(\"get <sku>\")\n .description(\"Get an in-app product\")\n .action(async (sku: string) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const client = await getClient(config);\n const format = getOutputFormat(program, config);\n\n console.error(\n \"Note: Using oneTimeProducts API (inappproducts endpoint is deprecated, shutdown Aug 2027)\",\n );\n\n try {\n const result = await getOneTimeProduct(client, packageName, sku);\n console.log(formatOutput(result, format));\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n\n iap\n .command(\"create\")\n .description(\"Create an in-app product from JSON file\")\n .requiredOption(\"--file <path>\", \"JSON file with product data\")\n .action(async (options) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const format = getOutputFormat(program, config);\n\n if (isDryRun(program)) {\n printDryRun(\n {\n command: \"iap create\",\n action: \"create\",\n target: `in-app product from ${options.file}`,\n },\n format,\n formatOutput,\n );\n return;\n }\n\n const client = await getClient(config);\n\n try {\n const data = await readJsonFile(options.file);\n const result = await createInAppProduct(client, packageName, data as any);\n console.log(formatOutput(result, format));\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n\n iap\n .command(\"update <sku>\")\n .description(\"Update an in-app product from JSON file\")\n .requiredOption(\"--file <path>\", \"JSON file with product data\")\n .action(async (sku: string, options) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const format = getOutputFormat(program, config);\n\n if (isDryRun(program)) {\n printDryRun(\n {\n command: \"iap update\",\n action: \"update\",\n target: sku,\n details: { file: options.file },\n },\n format,\n formatOutput,\n );\n return;\n }\n\n const client = await getClient(config);\n\n try {\n const data = await readJsonFile(options.file);\n const result = await updateInAppProduct(client, packageName, sku, data as any);\n console.log(formatOutput(result, format));\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n\n iap\n .command(\"delete <sku>\")\n .description(\"Delete an in-app product\")\n .action(async (sku: string) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n\n await requireConfirm(`Delete in-app product \"${sku}\"?`, program);\n\n if (isDryRun(program)) {\n const format = getOutputFormat(program, config);\n printDryRun(\n {\n command: \"iap delete\",\n action: \"delete\",\n target: sku,\n },\n format,\n formatOutput,\n );\n return;\n }\n\n const client = await getClient(config);\n\n try {\n await deleteInAppProduct(client, packageName, sku);\n console.log(`In-app product ${sku} deleted.`);\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n\n iap\n .command(\"sync\")\n .description(\"Sync in-app products from a directory of JSON files\")\n .requiredOption(\"--dir <path>\", \"Directory containing product JSON files\")\n .action(async (options) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const client = await getClient(config);\n const format = getOutputFormat(program, config);\n const dryRun = isDryRun(program);\n\n const spinner = createSpinner(\"Syncing in-app products...\");\n if (!program.opts()[\"quiet\"] && process.stderr.isTTY) spinner.start();\n\n try {\n const result = await syncInAppProducts(client, packageName, options.dir, {\n dryRun,\n });\n spinner.stop(\"Sync complete\");\n if (dryRun) {\n console.log(`[dry-run] Would create: ${result.created}, update: ${result.updated}`);\n }\n console.log(formatOutput(result, format));\n } catch (error) {\n spinner.fail(\"Sync failed\");\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n\n iap\n .command(\"batch-get\")\n .description(\"Batch get multiple in-app products\")\n .option(\"--skus <skus>\", \"Comma-separated list of SKUs\")\n .option(\"--file <path>\", \"JSON file with array of SKUs\")\n .action(async (_options) => {\n console.error(\n \"Note: The inappproducts batchGet endpoint is permanently blocked by Google Play (returns 403 PERMISSION_DENIED).\\n\" +\n \"Use `gpc iap get <sku>` for a single product, or `gpc iap list` for all products.\",\n );\n process.exit(1);\n });\n\n iap\n .command(\"batch-update\")\n .description(\"Batch update multiple in-app products from a JSON file\")\n .requiredOption(\"--file <path>\", \"JSON file with array of product objects\")\n .option(\"--dry-run\", \"Preview changes without executing\")\n .action(async (options) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const format = getOutputFormat(program, config);\n\n if (options.dryRun || isDryRun(program)) {\n const data = await readJsonFile(options.file);\n const products = Array.isArray(data) ? data : [];\n console.log(`[dry-run] Would batch update ${products.length} product(s)`);\n if (format !== \"json\") {\n const rows = products.map((p: Record<string, unknown>) => ({\n sku: p[\"sku\"] || \"-\",\n action: \"update\",\n }));\n console.log(formatOutput(rows, format));\n } else {\n console.log(formatOutput(products, format));\n }\n return;\n }\n\n const client = await getClient(config);\n console.error(\"Note: Using inappproducts batch API\");\n\n const spinner = createSpinner(\"Batch updating products...\");\n if (!program.opts()[\"quiet\"] && process.stderr.isTTY) spinner.start();\n\n try {\n const data = await readJsonFile(options.file);\n const products = Array.isArray(data) ? data : [];\n const request = {\n requests: products.map((p: Record<string, unknown>) => ({\n inappproduct: p,\n packageName,\n sku: p[\"sku\"] as string,\n })),\n };\n const result = await client.inappproducts.batchUpdate(packageName, request as any);\n spinner.stop(\"Batch update complete\");\n console.log(formatOutput(result, format));\n } catch (error) {\n spinner.fail(\"Batch update failed\");\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAEA,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAMP,SAAS,mBAAmB,YAAgC,QAA2B;AACrF,QAAM,OAAO,cAAc,OAAO;AAClC,MAAI,CAAC,MAAM;AACT,YAAQ,MAAM,6EAA6E;AAC3F,YAAQ,KAAK,CAAC;AAAA,EAChB;AACA,SAAO;AACT;AAEA,eAAe,UAAU,QAAmB;AAC1C,QAAM,OAAO,MAAM,YAAY,EAAE,oBAAoB,OAAO,MAAM,eAAe,CAAC;AAClF,SAAO,gBAAgB,EAAE,KAAK,CAAC;AACjC;AAEO,SAAS,oBAAoB,SAAwB;AAC1D,QAAM,MAAM,QACT,QAAQ,KAAK,EACb,YAAY,qDAAqD;AAEpE,MACG,QAAQ,MAAM,EACd,YAAY,sBAAsB,EAClC,OAAO,aAAa,4BAA4B,QAAQ,EACxD,OAAO,eAAe,yBAAyB,QAAQ,EACvD,OAAO,uBAAuB,wBAAwB,EACtD,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